Merge "Split doc for $wgHKDFSecret/$wgHKDFAlgorithm in DefaultSettings.php"
[mediawiki.git] / tests / parser / parserTests.txt
blob8dfb4dd143c9c1888c91acc18907495342a3978c
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
16 # cat           add category links
17 # ill           add inter-language links
18 # subpage       enable subpages (disabled by default)
19 # noxml         don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX  set content language to XXX for this test
22 # variant=XXX   set the variant of language for this test (eg zh-tw)
23 # disabled      do not run test
24 # parsoid       parsoid-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
542 !! test
543 Italics and bold: 2-quote opening sequence: (2,3)
544 !! options
545 parsoid=wt2html
546 !! wikitext
547 ''foo'''
548 !! html/*
549 <p><i>foo'</i>
550 </p>
551 !!end
554 # same html as previous, but wikitext adjusted to match parsoid html2wt
555 !! test
556 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
557 !! wikitext
558 ''<nowiki>foo'</nowiki>''
559 !! html
560 <p><i>foo'</i>
561 </p>
562 !! end
565 !! test
566 Italics and bold: 2-quote opening sequence: (2,4)
567 !! options
568 parsoid=wt2html
569 !! wikitext
570 ''foo''''
571 !! html/*
572 <p><i>foo''</i>
573 </p>
574 !!end
577 # same html as previous, but wikitext adjusted to match parsoid html2wt
578 !! test
579 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
580 !! wikitext
581 ''<nowiki>foo''</nowiki>''
582 !! html
583 <p><i>foo''</i>
584 </p>
585 !! end
588 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
589 !! test
590 Italics and bold: 2-quote opening sequence: (2,5)
591 !! options
592 parsoid=wt2html
593 !! wikitext
594 ''foo'''''
595 !! html/php
596 <p><i>foo</i>
597 </p>
598 !! html/parsoid
599 <p><i>foo</i><b></b>
600 </p>
601 !!end
603 # same html as previous, but wikitext adjusted to match parsoid html2wt
604 !! test
605 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
606 !! wikitext
607 ''foo'''''<nowiki/>'''
608 !! html/php
609 <p><i>foo</i>
610 </p>
611 !! html/parsoid
612 <p><i>foo</i><b></b>
613 </p>
614 !! end
618 ### 3-quote opening sequence tests
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,2)
623 !! wikitext
624 '''foo''
625 !! html
626 <p>'<i>foo</i>
627 </p>
628 !!end
631 !! test
632 Italics and bold: 3-quote opening sequence: (3,3)
633 !! wikitext
634 '''foo'''
635 !! html
636 <p><b>foo</b>
637 </p>
638 !!end
641 !! test
642 Italics and bold: 3-quote opening sequence: (3,4)
643 !! options
644 parsoid=wt2html
645 !! wikitext
646 '''foo''''
647 !! html/*
648 <p><b>foo'</b>
649 </p>
650 !!end
653 # same html as previous, but wikitext adjusted to match parsoid html2wt
654 !! test
655 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
656 !! wikitext
657 '''<nowiki>foo'</nowiki>'''
658 !! html
659 <p><b>foo'</b>
660 </p>
661 !! end
664 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
665 !! test
666 Italics and bold: 3-quote opening sequence: (3,5)
667 !! options
668 parsoid=wt2html
669 !! wikitext
670 '''foo'''''
671 !! html/php
672 <p><b>foo</b>
673 </p>
674 !! html/parsoid
675 <p><b>foo</b><i></i>
676 </p>
677 !!end
679 # same html as previous, but wikitext adjusted to match parsoid html2wt
680 !! test
681 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
682 !! wikitext
683 '''foo'''''<nowiki/>''
684 !! html/php
685 <p><b>foo</b>
686 </p>
687 !! html/parsoid
688 <p><b>foo</b><i></i>
689 </p>
690 !! end
694 ### 4-quote opening sequence tests
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,2)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''
703 !! html/*
704 <p>''<i>foo</i>
705 </p>
706 !!end
709 # same html as previous, but wikitext adjusted to match parsoid html2wt
710 !! test
711 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
712 !! wikitext
713 <nowiki>''</nowiki>''foo''
714 !! html
715 <p>''<i>foo</i>
716 </p>
717 !! end
720 !! test
721 Italics and bold: 4-quote opening sequence: (4,3)
722 !! wikitext
723 ''''foo'''
724 !! html
725 <p>'<b>foo</b>
726 </p>
727 !!end
730 !! test
731 Italics and bold: 4-quote opening sequence: (4,4)
732 !! options
733 parsoid=wt2html
734 !! wikitext
735 ''''foo''''
736 !! html/*
737 <p>'<b>foo'</b>
738 </p>
739 !!end
742 # same html as previous, but wikitext adjusted to match parsoid html2wt
743 !! test
744 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
745 !! wikitext
746 ''''<nowiki>foo'</nowiki>'''
747 !! html
748 <p>'<b>foo'</b>
749 </p>
750 !! end
753 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
754 !! test
755 Italics and bold: 4-quote opening sequence: (4,5)
756 !! options
757 parsoid=wt2html
758 !! wikitext
759 ''''foo'''''
760 !! html/php
761 <p>'<b>foo</b>
762 </p>
763 !! html/parsoid
764 <p>'<b>foo</b><i></i>
765 </p>
766 !!end
768 # same html as previous, but wikitext adjusted to match parsoid html2wt
769 !! test
770 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
771 !! wikitext
772 ''''foo'''''<nowiki/>''
773 !! html/php
774 <p>'<b>foo</b>
775 </p>
776 !! html/parsoid
777 <p>'<b>foo</b><i></i>
778 </p>
779 !! end
783 ### 5-quote opening sequence tests
786 !! test
787 Italics and bold: 5-quote opening sequence: (5,2)
788 !! options
789 parsoid=wt2html
790 !! wikitext
791 '''''foo''
792 !! html/*
793 <p><b><i>foo</i></b>
794 </p>
795 !!end
798 # same html as previous, but wikitext adjusted to match parsoid html2wt
799 # skipping wt2html and html2html because it wants to put <i> before <b>
800 !! test
801 Italics and bold: 5-quote opening sequence: (5,2+3)
802 !! options
803 parsoid=wt2wt,html2wt
804 !! wikitext
805 '''''foo'''''
806 !! html
807 <p><b><i>foo</i></b>
808 </p>
809 !! end
811 !! test
812 Italics and bold: 5-quote opening sequence: (5,3)
813 !! options
814 parsoid=wt2html
815 !! wikitext
816 '''''foo'''
817 !! html/*
818 <p><i><b>foo</b></i>
819 </p>
820 !!end
823 # same html as previous, but wikitext adjusted to match parsoid html2wt
824 !! test
825 Italics and bold: 5-quote opening sequence: (5,3+2)
826 !! wikitext
827 '''''foo'''''
828 !! html
829 <p><i><b>foo</b></i>
830 </p>
831 !! end
834 !! test
835 Italics and bold: 5-quote opening sequence: (5,4)
836 !! options
837 parsoid=wt2html
838 !! wikitext
839 '''''foo''''
840 !! html/*
841 <p><i><b>foo'</b></i>
842 </p>
843 !!end
846 # same html as previous, but wikitext adjusted to match parsoid html2wt
847 !! test
848 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
849 !! wikitext
850 '''''<nowiki>foo'</nowiki>'''''
851 !! html
852 <p><i><b>foo'</b></i>
853 </p>
854 !! end
857 !! test
858 Italics and bold: 5-quote opening sequence: (5,5)
859 !! wikitext
860 '''''foo'''''
861 !! html
862 <p><i><b>foo</b></i>
863 </p>
864 !!end
867 ### multiple quote sequences in a line
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,2)
871 !! options
872 parsoid=wt2html
873 !! wikitext
874 ''foo''''bar''
875 !! html/*
876 <p><i>foo'<b>bar</b></i>
877 </p>
878 !!end
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
884 !! wikitext
885 ''<nowiki>foo'</nowiki>'''bar'''''
886 !! html
887 <p><i>foo'<b>bar</b></i>
888 </p>
889 !! end
892 !! test
893 Italics and bold: multiple quote sequences: (2,4,3)
894 !! options
895 parsoid=wt2html
896 !! wikitext
897 ''foo''''bar'''
898 !! html/*
899 <p><i>foo'<b>bar</b></i>
900 </p>
901 !!end
904 # same html as previous, but wikitext adjusted to match parsoid html2wt
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
907 !! wikitext
908 ''<nowiki>foo'</nowiki>'''bar'''''
909 !! html
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !! end
915 !! test
916 Italics and bold: multiple quote sequences: (2,4,4)
917 !! options
918 parsoid=wt2html
919 !! wikitext
920 ''foo''''bar''''
921 !! html/*
922 <p><i>foo'<b>bar'</b></i>
923 </p>
924 !!end
927 # same html as previous, but wikitext adjusted to match parsoid html2wt
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
930 !! wikitext
931 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
932 !! html
933 <p><i>foo'<b>bar'</b></i>
934 </p>
935 !! end
938 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,2)
941 !! options
942 parsoid=wt2html
943 !! wikitext
944 '''foo''''bar''
945 !! html/php
946 <p><b>foo'</b>bar
947 </p>
948 !! html/parsoid
949 <p><b>foo'</b>bar<i></i>
950 </p>
951 !!end
953 # same html as previous, but wikitext adjusted to match parsoid html2wt
954 !! test
955 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
956 !! options
957 parsoid
958 !! wikitext
959 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
960 !! html/php
961 <p><b>foo'</b>bar
962 </p>
963 !! html/parsoid
964 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
965 </p>
966 !! end
969 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
970 !! test
971 Italics and bold: multiple quote sequences: (3,4,3)
972 !! options
973 parsoid=wt2html
974 !! wikitext
975 '''foo''''bar'''
976 !! html/php
977 <p><b>foo'</b>bar
978 </p>
979 !! html/parsoid
980 <p><b>foo'</b>bar<b></b>
981 </p>
982 !!end
984 # same html as previous, but wikitext adjusted to match parsoid html2wt
985 !! test
986 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
987 !! wikitext
988 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
989 !! html/php
990 <p><b>foo'</b>bar
991 </p>
992 !! html/parsoid
993 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
994 </p>
995 !! end
998 ### other quote tests
1000 !! test
1001 Italics and bold: other quote tests: (2,3,5)
1002 !! wikitext
1003 ''this is about '''foo's family'''''
1004 !! html
1005 <p><i>this is about <b>foo's family</b></i>
1006 </p>
1007 !!end
1010 !! test
1011 Italics and bold: other quote tests: (2,(3,3),2)
1012 !! wikitext
1013 ''this is about '''foo's''' family''
1014 !! html
1015 <p><i>this is about <b>foo's</b> family</i>
1016 </p>
1017 !!end
1020 !! test
1021 Italics and bold: other quote tests: (3,2,3,2)
1022 !! options
1023 parsoid=wt2html
1024 !! wikitext
1025 '''this is about ''foo'''s family''
1026 !! html/*
1027 <p><b>this is about <i>foo</i></b><i>s family</i>
1028 </p>
1029 !!end
1032 # same html as previous, but wikitext adjusted to match parsoid html2wt
1033 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1034 !! test
1035 Italics and bold: other quote tests: (3,2,3+2+2,2)
1036 !! options
1037 parsoid
1038 !! wikitext
1039 '''this is about ''foo'''''<nowiki/>''s family''
1040 !! html/*
1041 <p><b>this is about <i>foo</i></b><i>s family</i>
1042 </p>
1043 !! end
1046 !! test
1047 Italics and bold: other quote tests: (3,2,3,3)
1048 !! options
1049 !! wikitext
1050 '''this is about ''foo'''s family'''
1051 !! html
1052 <p>'<i>this is about </i>foo<b>s family</b>
1053 </p>
1054 !!end
1057 !! test
1058 Italics and bold: other quote tests: (3,(2,2),3)
1059 !! wikitext
1060 '''this is about ''foo's'' family'''
1061 !! html
1062 <p><b>this is about <i>foo's</i> family</b>
1063 </p>
1064 !!end
1067 !! test
1068 Italicized possessive
1069 !! wikitext
1070 The ''[[Main Page]]'''s talk page.
1071 !! html
1072 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1073 </p>
1074 !! end
1076 !! test
1077 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1078 (Requires tidy for PHP parser output to be fixed up)
1079 !! options
1080 parsoid=wt2html,wt2wt
1081 !! wikitext
1083 !''a!!''b
1084 |''a||''b
1086 !! html/php+tidy
1087 <table>
1088 <tr>
1089 <th><i>a</i></th>
1090 <th><i>b</i></th>
1091 <td><i>a</i></td>
1092 <td><i>b</i></td>
1093 </tr>
1094 </table>
1095 !! html/parsoid
1096 <table>
1097 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1098 <td><i>a</i></td><td><i>b</i></td></tr>
1099 </tbody></table>
1100 !! end
1103 ### Non-html5 tags
1106 !! test
1107 Non-html5 tags should be accepted
1108 !! wikitext
1109 <center>''foo''</center>
1110 <big>''foo''</big>
1111 <font>''foo''</font>
1112 <strike>''foo''</strike>
1113 <tt>''foo''</tt>
1114 !! html
1115 <center><i>foo</i></center>
1116 <p><big><i>foo</i></big>
1117 <font><i>foo</i></font>
1118 <strike><i>foo</i></strike>
1119 <tt><i>foo</i></tt>
1120 </p>
1121 !! end
1123 !! test
1124 <wbr> is valid wikitext (bug 52468)
1125 !! wikitext
1126 <wbr>
1127 !! html
1128 <p><wbr />
1129 </p>
1130 !! end
1132 # <strike> is HTML4, <s> is HTML4/5.
1133 !! test
1134 <s> or <strike> for strikethrough
1135 !! wikitext
1136 <strike>strike</strike>
1138 <s>s</s>
1139 !! html
1140 <p><strike>strike</strike>
1141 </p><p><s>s</s>
1142 </p>
1143 !! end
1145 ## a not permitted
1146 ## i,b,br omitted
1147 !! test
1148 Text-level semantic html elements in wikitext
1149 !! wikitext
1150 <em>text</em>
1151 <strong>text</strong>
1152 <small>text</small>
1153 <s>text</s>
1154 <cite>text</cite>
1155 <q>text</q>
1156 <dfn>text</dfn>
1157 <abbr>text</abbr>
1158 <data>text</data>
1159 <time>text</time>
1160 <code>text</code>
1161 <var>text</var>
1162 <samp>text</samp>
1163 <kbd>text</kbd>
1164 <sub>text</sub>
1165 <u>text</u>
1166 <mark>text</mark>
1167 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1168 <bdi>text</bdi>
1169 <bdo>text</bdo>
1170 <span>text</span>
1171 <wbr />
1172 !! html
1173 <p><em>text</em>
1174 <strong>text</strong>
1175 <small>text</small>
1176 <s>text</s>
1177 <cite>text</cite>
1178 <q>text</q>
1179 <dfn>text</dfn>
1180 <abbr>text</abbr>
1181 <data>text</data>
1182 <time>text</time>
1183 <code>text</code>
1184 <var>text</var>
1185 <samp>text</samp>
1186 <kbd>text</kbd>
1187 <sub>text</sub>
1188 <u>text</u>
1189 <mark>text</mark>
1190 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1191 <bdi>text</bdi>
1192 <bdo>text</bdo>
1193 <span>text</span>
1194 <wbr />
1195 </p>
1196 !! end
1198 # test cases taken from
1199 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1200 !! test
1201 Ruby markup (W3C-style)
1202 !! wikitext
1203 ; Mono-ruby for individual base characters
1204 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1205 ; Group ruby
1206 : <ruby>今日<rt>きょう</rt></ruby>
1207 ; Jukugo ruby
1208 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1209 ; Inline ruby
1210 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1211 ; Double-sided ruby
1212 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1213 <ruby>
1214 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1215 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1216 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1217 </ruby>
1218 !! html
1219 <dl><dt> Mono-ruby for individual base characters</dt>
1220 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1221 <dt> Group ruby</dt>
1222 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1223 <dt> Jukugo ruby</dt>
1224 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1225 <dt> Inline ruby</dt>
1226 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1227 <dt> Double-sided ruby</dt>
1228 <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>
1229 <p><ruby>
1230 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1231 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1232 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1233 </ruby>
1234 </p>
1235 !! end
1237 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1238 !! test
1239 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1240 !! wikitext
1241 <b→> doesn't work! </b→>
1243 <bä> doesn't work! </bä>
1245 <boo> works fine </boo>
1247 <s.foo>s.foo</s.foo>
1249 <sub-ID#1>
1250 !! html
1251 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1252 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1253 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1254 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1255 </p><p>&lt;sub-ID#1&gt;
1256 </p>
1257 !! end
1259 !! test
1260 Isolated close tags should be treated as literal text (bug 52760)
1261 !! wikitext
1262 </b>
1264 <s.foo>s</s>
1265 !! html
1266 <p>&lt;/b&gt;
1267 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1268 </p>
1269 !! end
1272 ### Special characters
1275 !! test
1276 Bare pipe character (bug 52363)
1277 !! wikitext
1279 !! html
1280 <p>|
1281 </p>
1282 !! end
1284 !! test
1285 Bare pipe character from a template (bug 52363)
1286 !! wikitext
1287 {{pipe}}
1288 !! html
1289 <p>|
1290 </p>
1291 !! end
1294 ### <nowiki> test cases
1297 !! test
1298 <nowiki> unordered list
1299 !! wikitext
1300 <nowiki>* This is not an unordered list item.</nowiki>
1301 !! html
1302 <p>* This is not an unordered list item.
1303 </p>
1304 !! end
1306 !! test
1307 <nowiki> spacing
1308 !! wikitext
1309 <nowiki>Lorem ipsum dolor
1311 sed abit.
1312   sed nullum.
1314 :and a colon
1315 </nowiki>
1316 !! html
1317 <p>Lorem ipsum dolor
1319 sed abit.
1320   sed nullum.
1322 :and a colon
1324 </p>
1325 !! end
1327 !! test
1328 nowiki 3
1329 !! wikitext
1330 :There is not nowiki.
1331 :There is <nowiki>nowiki</nowiki>.
1333 #There is not nowiki.
1334 #There is <nowiki>nowiki</nowiki>.
1336 *There is not nowiki.
1337 *There is <nowiki>nowiki</nowiki>.
1338 !! html
1339 <dl><dd>There is not nowiki.</dd>
1340 <dd>There is nowiki.</dd></dl>
1341 <ol><li>There is not nowiki.</li>
1342 <li>There is nowiki.</li></ol>
1343 <ul><li>There is not nowiki.</li>
1344 <li>There is nowiki.</li></ul>
1346 !! end
1348 !! test
1349 Entities inside <nowiki>
1350 !! wikitext
1351 <nowiki>&lt;</nowiki>
1352 !! html
1353 <p>&lt;
1354 </p>
1355 !! end
1357 !! test
1358 Entities inside template parameters
1359 !! options
1360 parsoid
1361 !! wikitext
1362 {{echo|&ndash;}}
1363 !! html
1364 <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>
1365 !! end
1367 !! test
1368 Properly escape nowiki when combined with other wiki markup
1369 !! options
1370 parsoid=html2wt
1371 !! wikitext
1372 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1373 !! html
1374 <p>* &lt;/nowiki&gt; tag</p>
1375 !! end
1378 ### Comments
1380 !! test
1381 Comments and Indent-Pre
1382 !! wikitext
1383 <!-- comment 1 --> asdf
1385 <!-- comment 1 --> asdf
1386 <!-- comment 2 -->
1388 <!-- comment 1 --> asdf
1389 <!-- comment 2 -->xyz
1391 <!-- comment 1 --> asdf
1392 <!-- comment 2 --> xyz
1393 !! html
1394 <pre>asdf
1395 </pre>
1396 <pre>asdf
1397 </pre>
1398 <pre>asdf
1399 </pre>
1400 <p>xyz
1401 </p>
1402 <pre>asdf
1404 </pre>
1405 !! end
1407 !! test
1408 Comment test 2a
1409 !! wikitext
1410 asdf
1411 <!-- comment 1 -->
1413 !! html
1414 <p>asdf
1416 </p>
1417 !! end
1419 !! test
1420 Comment test 2b
1421 !! wikitext
1422 asdf
1423 <!-- comment 1 -->
1426 !! html
1427 <p>asdf
1428 </p><p>jkl
1429 </p>
1430 !! end
1432 !! test
1433 Comment test 3
1434 !! wikitext
1435 asdf
1436 <!-- comment 1 -->
1437 <!-- comment 2 -->
1439 !! html
1440 <p>asdf
1442 </p>
1443 !! end
1445 !! test
1446 Comment test 4
1447 !! wikitext
1448 asdf<!-- comment 1 -->jkl
1449 !! html
1450 <p>asdfjkl
1451 </p>
1452 !! end
1454 !! test
1455 Comment spacing
1456 !! wikitext
1458  <!-- foo --> b <!-- bar -->
1460 !! html
1461 <p>a
1462 </p>
1463 <pre> b 
1464 </pre>
1465 <p>c
1466 </p>
1467 !! end
1469 !! test
1470 Comment whitespace
1471 !! wikitext
1472 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1473 !! html
1475 !! end
1477 !! test
1478 Comment semantics and delimiters
1479 !! wikitext
1480 <!-- --><!----><!-----><!------>
1481 !! html
1483 !! end
1485 !! test
1486 Comment semantics and delimiters, redux
1487 !! wikitext
1488 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1489 -- foo -- funky huh? ... -->
1490 !! html
1492 !! end
1494 !! test
1495 Comment semantics and delimiters: directors cut
1496 !! wikitext
1497 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1498 everything starting with < followed by !-- until the first -- and > we see,
1499 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1500 -->-->
1501 !! html
1502 <p>--&gt;
1503 </p>
1504 !! end
1506 !! test
1507 Comment semantics: nesting
1508 !! wikitext
1509 <!--<!-- no, we're not going to do anything fancy here -->-->
1510 !! html
1511 <p>--&gt;
1512 </p>
1513 !! end
1515 !! test
1516 Comment semantics: unclosed comment at end
1517 !! wikitext
1518 <!--This comment will run out to the end of the document
1519 !! html
1521 !! end
1523 # Bug 58184: document parsoid's behaviour
1524 !! test
1525 Suppress comment closing tag in lenient browsers
1526 !! options
1527 parsoid=wt2html,html2html
1528 !! wikitext
1529 <!-- Browsers--!> think this is closed -->
1530 !! html/php
1532 !! html/parsoid
1533 <!-- Browsers--¡> think this is closed -->
1534 !! end
1536 !! test
1537 Comment in template title
1538 !! wikitext
1539 {{f<!---->oo}}
1540 !! html
1541 <p>FOO
1542 </p>
1543 !! end
1545 !! test
1546 Comment on its own line post-expand
1547 !! wikitext
1549 {{blank}}<!---->
1551 !! html
1552 <p>a
1553 </p><p>b
1554 </p>
1555 !! end
1557 !! test
1558 Comment on its own line post-expand with non-significant whitespace
1559 !! wikitext
1561  {{blank}} <!----> 
1563 !! html
1564 <p>a
1565 </p><p>b
1566 </p>
1567 !! end
1569 !! test
1570 Multiple comments should still parse as SOL-transparent
1571 !! options
1572 parsoid=wt2html,wt2wt
1573 !! wikitext
1574 <!--c1-->*a
1575 <!--c2--><!--c3--><!--c4-->*b
1576 !! html
1577 <ul>
1578 <li>a
1579 </li>
1580 <li>b
1581 </li>
1582 </ul>
1583 !! end
1586 ### paragraph wrapping tests
1588 !! test
1589 No block tags
1590 !! wikitext
1594 !! html
1595 <p>a
1596 </p><p>b
1597 </p>
1598 !! end
1600 !! test
1601 Block tag on one line (<div>)
1602 !! wikitext
1603 a <div>foo</div>
1606 !! html
1607 a <div>foo</div>
1608 <p>b
1609 </p>
1610 !! html+tidy
1611 <p>a</p>
1612 <div>foo</div>
1613 <p>b</p>
1614 !! end
1616 !! test
1617 Block tag on one line (<blockquote>)
1618 !! wikitext
1619 a <blockquote>foo</blockquote>
1622 !! html
1623 a <blockquote>foo</blockquote>
1624 <p>b
1625 </p>
1626 !! html+tidy
1627 <p>a</p>
1628 <blockquote>
1629 <p>foo</p>
1630 </blockquote>
1631 <p>b</p>
1632 !! end
1634 !! test
1635 Block tag on both lines (<div>)
1636 !! wikitext
1637 a <div>foo</div>
1639 b <div>foo</div>
1640 !! html
1641 a <div>foo</div>
1642 b <div>foo</div>
1644 !! html+tidy
1645 <p>a</p>
1646 <div>foo</div>
1647 <p>b</p>
1648 <div>foo</div>
1649 !! end
1651 !! test
1652 Block tag on both lines (<blockquote>)
1653 !! wikitext
1654 a <blockquote>foo</blockquote>
1656 b <blockquote>foo</blockquote>
1657 !! html
1658 a <blockquote>foo</blockquote>
1659 b <blockquote>foo</blockquote>
1661 !! html+tidy
1662 <p>a</p>
1663 <blockquote>
1664 <p>foo</p>
1665 </blockquote>
1666 <p>b</p>
1667 <blockquote>
1668 <p>foo</p>
1669 </blockquote>
1670 !! end
1672 !! test
1673 Multiple lines without block tags
1674 !! wikitext
1675 <div>foo</div> a
1678 d<!--foo--> e
1679 x <div>foo</div> z
1680 !! html
1681 <div>foo</div> a
1682 <p>b
1684 d e
1685 </p>
1686 x <div>foo</div> z
1688 !! html+tidy
1689 <div>foo</div>
1690 <p>a</p>
1691 <p>b c d e</p>
1692 <p>x</p>
1693 <div>foo</div>
1694 <p>z</p>
1695 !! end
1697 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1698 # So, we have a separate section for Parsoid. We don't want
1699 # to mimic this stripping behavior in Parsoid. It affects
1700 # editing experience and also requires us to maintain additional
1701 # info for RT-ing.
1702 !! test
1703 Empty lines between lines with block tags
1704 !! wikitext
1705 <div></div>
1708 <div></div>a
1711 <div>a</div>b
1713 <div>b</div>d
1716 <div>e</div>
1717 !! html
1718 <div></div>
1719 <p><br />
1720 </p>
1721 <div></div>a
1722 <p>b
1723 </p>
1724 <div>a</div>b
1725 <div>b</div>d
1726 <p><br />
1727 </p>
1728 <div>e</div>
1730 !! html+tidy
1731 <p><br /></p>
1732 <p>a</p>
1733 <p>b</p>
1734 <div>a</div>
1735 <p>b</p>
1736 <div>b</div>
1737 <p>d</p>
1738 <p><br /></p>
1739 <div>e</div>
1740 !! html/parsoid
1741 <div data-parsoid='{"stx":"html"}'></div>
1743 <p><br /></p>
1744 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1746 <p>b</p>
1747 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1749 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1751 <p><br /></p>
1752 <div data-parsoid='{"stx":"html"}'>e</div>
1753 !! end
1755 ## PHP parser emits output which is broken
1756 ## XXX The parsoid output doesn't match the tidy output.
1757 !! test
1758 Unclosed HTML p-tags should be handled properly
1759 !! wikitext
1760 <div><p>foo</div>
1764 !! html/php+tidy
1765 <div>
1766 <p>foo&lt;/div&gt;</p>
1767 <p>a</p>
1768 b</div>
1769 !! html/parsoid
1770 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1771 <p>a</p>
1772 <p>b</p>
1773 !! end
1775 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1776 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1777 ## them for now.
1778 !! test
1779 P-wrapping should leave sol-transparent tags outside p-tags where possible
1780 !! options
1781 parsoid=wt2html
1782 !! wikitext
1783 a [[Category:A1]] [[Category:A2]]
1784 [[Category:A3]]
1785 [[Category:A4]]
1786 !! html/parsoid
1787 <p>a</p>
1788 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1789 !! end
1792 ### Preformatted text
1794 !! test
1795 Preformatted text
1796 !! wikitext
1797  This is some
1798  Preformatted text
1799  With ''italic''
1800  And '''bold'''
1801  And a [[Main Page|link]]
1802 !! html
1803 <pre>This is some
1804 Preformatted text
1805 With <i>italic</i>
1806 And <b>bold</b>
1807 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1808 </pre>
1809 !! end
1811 !! test
1812 Tabs don't trigger preformatted text
1813 !! wikitext
1814         This is not
1815          preformatted text.
1816  This is preformatted text.
1817         So is this.
1818 !! html
1819 <p>     This is not
1820          preformatted text.
1821 </p>
1822 <pre>This is preformatted text.
1823         So is this.
1824 </pre>
1825 !! end
1827 !! test
1828 Ident preformatting with inline content
1829 !! wikitext
1831  ''b''
1832 !! html
1833 <pre>a
1834 <i>b</i>
1835 </pre>
1836 !! end
1838 !! test
1839 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1840 !! wikitext
1841 <pre><nowiki>
1843 <cite>
1844 <em>
1845 </nowiki></pre>
1846 !! html
1847 <pre>
1848 &lt;b&gt;
1849 &lt;cite&gt;
1850 &lt;em&gt;
1851 </pre>
1853 !! end
1855 !! test
1856 Regression with preformatted in <center>
1857 !! wikitext
1858 <center>
1859  Blah
1860 </center>
1861 !! html
1862 <center>
1863 <pre>Blah
1864 </pre>
1865 </center>
1867 !! end
1869 !! test
1870 Bug 52763: Preformatted in <blockquote>
1871 !! wikitext
1872 <blockquote>
1873  Blah
1876  indented cell (no pre-wrapping!)
1878 </blockquote>
1879 !! html
1880 <blockquote>
1881 <p> Blah
1882 </p>
1883 <table>
1884 <tr>
1885 <td>
1886 <p> indented cell (no pre-wrapping!)
1887 </p>
1888 </td></tr></table>
1889 </blockquote>
1891 !! end
1893 !! test
1894 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1895 !! wikitext
1896 <blockquote>
1900 </blockquote>
1901 !! html
1902 <blockquote>
1903 <p>Foo
1904 </p><p>Bar
1905 </p>
1906 </blockquote>
1908 !! end
1910 !! test
1911 Bug 15491: <ins>/<del> in blockquote
1912 !! wikitext
1913 <blockquote>
1914 Foo <del>bar</del> <ins>baz</ins> quux
1915 </blockquote>
1916 !! html
1917 <blockquote>
1918 <p>Foo <del>bar</del> <ins>baz</ins> quux
1919 </p>
1920 </blockquote>
1922 !! end
1924 # Note that the p-wrapping is newline sensitive, which could be
1925 # considered a bug: tidy will wrap only the 'Foo' in the example
1926 # below in a <p> tag. (see comment 23-25 of bug #6200)
1927 !! test
1928 Bug 15491: <ins>/<del> in blockquote (2)
1929 !! wikitext
1930 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1931 </blockquote>
1932 !! html
1933 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1934 </blockquote>
1936 !! html+tidy
1937 <blockquote>
1938 <p>Foo</p>
1939 <del>bar</del> <ins>baz</ins> quux</blockquote>
1940 !! end
1942 !! test
1943 <pre> with attributes (bug 3202)
1944 !! wikitext
1945 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1946 !! html
1947 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1949 !! end
1951 !! test
1952 <pre> with width attribute (bug 3202)
1953 !! wikitext
1954 <pre width="8">Narrow screen goodies</pre>
1955 !! html
1956 <pre width="8">Narrow screen goodies</pre>
1958 !! end
1960 !! test
1961 <pre> with forbidden attribute (bug 3202)
1962 !! wikitext
1963 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1964 !! html
1965 <pre width="8">Narrow screen goodies</pre>
1967 !! end
1969 !! test
1970 Entities inside <pre>
1971 !! wikitext
1972 <pre>&lt;</pre>
1973 !! html
1974 <pre>&lt;</pre>
1976 !! end
1978 !! test
1979 <pre> with forbidden attribute values (bug 3202)
1980 !! wikitext
1981 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1982 !! html
1983 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1985 !! end
1987 !! test
1988 <nowiki> inside <pre> (bug 13238)
1989 !! wikitext
1990 <pre>
1991 <nowiki>
1992 </pre>
1993 <pre>
1994 <nowiki></nowiki>
1995 </pre>
1996 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1997 !! html
1998 <pre>
1999 &lt;nowiki&gt;
2000 </pre>
2001 <pre>
2003 </pre>
2004 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2006 !! end
2008 !! test
2009 <nowiki> and <pre> preference (first one wins)
2010 !! wikitext
2011 <pre>
2012 <nowiki>
2013 </pre>
2014 </nowiki>
2015 </pre>
2017 <nowiki>
2018 <pre>
2019 <nowiki>
2020 </pre>
2021 </nowiki>
2022 </pre>
2024 !! html
2025 <pre>
2026 &lt;nowiki&gt;
2027 </pre>
2028 <p>&lt;/nowiki&gt;
2029 &lt;/pre&gt;
2030 </p><p>
2031 &lt;pre&gt;
2032 &lt;nowiki&gt;
2033 &lt;/pre&gt;
2035 &lt;/pre&gt;
2036 </p>
2037 !! end
2039 !! test
2040 </pre> inside nowiki
2041 !! wikitext
2042 <nowiki></pre></nowiki>
2043 !! html
2044 <p>&lt;/pre&gt;
2045 </p>
2046 !! end
2048 # Parsoid doesn't strip empty tags, like Tidy does.
2049 !! test
2050 Empty pre; pre inside other HTML tags (bug 54946)
2051 !! options
2052 parsoid=wt2html,wt2wt
2053 !! wikitext
2056 <div><pre>
2058 </pre></div>
2059 <pre></pre>
2060 !! html/php
2061 <p>a
2062 </p>
2063 <div><pre>
2065 </pre></div>
2066 <pre></pre>
2068 !! html/php+tidy
2069 <p>a</p>
2070 <div>
2071 <pre>
2073 </pre></div>
2074 !! html/parsoid
2075 <p>a</p>
2077 <div><pre>foo
2078 </pre></div>
2079 <pre></pre>
2080 !! end
2082 !! test
2083 HTML pre followed by indent-pre
2084 !! wikitext
2085 <pre>foo</pre>
2086  bar
2087 !! html
2088 <pre>foo</pre>
2089 <pre>bar
2090 </pre>
2091 !! end
2093 !!test
2094 Block tag pre
2095 !!options
2096 parsoid
2097 !! wikitext
2098 <p><pre>foo</pre></p>
2099 !! html
2100 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2101 !!end
2103 !!test
2104 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2105 !! wikitext
2106  {{echo|}}
2107 !! html
2109 !!end
2111 !!test
2112 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2113 !! wikitext
2114  {{echo|
2115 foo}}
2116 !! html
2117 <p>foo
2118 </p>
2119 !!end
2121 !! test
2122 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2123 !! wikitext
2124  {{echo|a
2126 !! html
2127 <pre>a
2128 </pre>
2129 <p>b
2130 </p>
2131 !!end
2133 !! test
2134 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2135 !! wikitext
2136  {{echo|a
2142 !! html
2143 <pre>a
2144 </pre>
2145 <p>b
2147 </p>
2148 <pre>d
2149 </pre>
2150 <p>e
2151 </p>
2152 !!end
2154 !!test
2155 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2156 !! wikitext
2157 {{echo| foo}}
2159 {{echo| foo}}{{echo| bar}}
2161 {{echo| foo}}
2162 {{echo| bar}}
2164 {{echo|<!--cmt--> foo}}
2166 <!--cmt-->{{echo| foo}}
2168 {{echo|{{echo| }}bar}}
2169 !! html
2170 <pre>foo
2171 </pre>
2172 <pre>foo bar
2173 </pre>
2174 <pre>foo
2176 </pre>
2177 <pre>foo
2178 </pre>
2179 <pre>foo
2180 </pre>
2181 <pre>bar
2182 </pre>
2183 !!end
2185 !! test
2186 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2187 !! wikitext
2188 {{echo| }}a
2190 {{echo|
2191  }}a
2193 {{echo|
2194  b}}
2196 {{echo|a
2197  }}b
2199 {{echo|a
2200 }} b
2201 !! html
2202 <pre>a
2203 </pre>
2204 <p><br />
2205 </p>
2206 <pre>a
2207 </pre>
2208 <p><br />
2209 </p>
2210 <pre>b
2211 </pre>
2212 <p>a
2213 </p>
2214 <pre>b
2215 </pre>
2216 <p>a
2217 </p>
2218 <pre>b
2219 </pre>
2220 !!end
2222 !! test
2223 Things that look like <pre> tags aren't treated as such
2224 !! wikitext
2225 Barack Obama <President> of the United States
2226 <President></President>
2227 !! html
2228 <p>Barack Obama &lt;President&gt; of the United States
2229 &lt;President&gt;&lt;/President&gt;
2230 </p>
2231 !! end
2233 ## PHP parser discards the "<pre " string
2234 !! test
2235 Handle broken pre-like tags (bug 64025)
2236 !! options
2237 parsoid=wt2html
2238 !! wikitext
2239 {{echo|<pre <pre>x</pre>}}
2241 <table><pre </table>
2242 !! html/php
2243 <pre>x</pre>
2244 <table><pre></pre></table>
2246 !! html/parsoid
2247 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </p><pre>x</pre>
2249 <p>&lt;pre </p>
2251 <table></table>
2252 !! end
2254 !! test
2255 Parsoid: handle pre with space after attribute
2256 !! options
2257 parsoid=wt2html
2258 !! wikitext
2259 <pre style="width:50%;" >{{echo|foo}}</pre>
2260 !! html
2261 <pre style="width:50%;">{{echo|foo}}</pre>
2262 !! end
2264 # TODO / maybe: fix wt2wt for this
2265 !! test
2266 Parsoid: Don't paragraph-wrap fosterable content
2267 !! options
2268 parsoid=wt2html
2269 !! wikitext
2271 <td></td>
2272 <td></td>
2277 !! html
2278 <table>
2280 <tbody>
2281 <tr>
2282 <td></td>
2284 <td></td></tr>
2288 </tbody></table>
2289 !! end
2291 !! test
2292 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2293 !! options
2294 parsoid=wt2html
2295 !! wikitext
2297 <td>
2298 <td>
2299 </td>
2304 !! html
2305 <table>
2307 <tbody>
2308 <tr>
2309 <td></td>
2311 <td>
2312 </td></tr>
2316 </tbody></table>
2317 !! end
2320 #--------------------------------------------------------------------
2321 # Transclusion parameter whitespace stripping tests
2322 # Behavior is different for positional and named parameters
2323 #--------------------------------------------------------------------
2324 !! test
2325 Templates: Strip leading and trailing whitespace from named-param values
2326 !! wikitext
2327 {{echo|1= a }}
2329 {{echo|1= {{echo|b}} }}
2331 {{echo| 1 =
2332  c }}
2334 {{echo| 1 =
2335 * d
2337 !! html
2338 <p>a
2339 </p><p>b
2340 </p><p>c
2341 </p>
2342 <ul><li> d</li></ul>
2344 !! end
2346 !! test
2347 Templates: Don't strip whitespace from positional-param values
2348 !! wikitext
2349 {{echo|a }}
2351 {{echo|{{echo|b}} }}
2353 {{echo| c 
2356 {{echo| {{echo|d}}
2359 {{echo|
2360  e}}
2362 {{echo|
2363 * f}}
2365 {{echo|
2366  }}g
2367 !! html
2368 <p>a 
2369 </p><p>b 
2370 </p>
2371 <pre>c 
2372 </pre>
2373 <p><br />
2374 </p>
2375 <pre>d
2376 </pre>
2377 <p><br />
2378 </p>
2379 <pre>e
2380 </pre>
2381 <p><br />
2382 </p>
2383 <ul><li> f</li></ul>
2384 <p><br />
2385 </p>
2386 <pre>g
2387 </pre>
2388 !! end
2390 !! test
2391 Templates: Handle empty comment-and-ws-only lines correctly
2392 !! wikitext
2393 {{echo|foo
2394 <!--should be ignored-->
2395  <!--should be ignored as well-->
2396 bar}}
2397 !! html
2398 <p>foo
2400 </p>
2401 !! end
2403 !! test
2404 Templates: Handle comments in the target
2405 !! wikitext
2406 {{echo
2407 <!-- should be ignored -->
2408 |foo}}
2410 {{echo<!-- should be ignored -->
2411 |foo}}
2413 {{echo<!-- should be ignored -->|foo}}
2415 {{<!-- should be ignored -->echo|foo}}
2416 !!html/parsoid
2417 <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>
2419 <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>
2421 <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>
2423 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</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
3910 ### External links
3912 !! test
3913 External links: non-bracketed
3914 !! wikitext
3915 Non-bracketed: http://example.com
3916 !! html
3917 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3918 </p>
3919 !! end
3921 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3922 !! test
3923 External links: numbered
3924 !! wikitext
3925 Numbered: [http://example.com]
3926 Numbered: [http://example.net]
3927 Numbered: [http://example.com]
3928 !! html/php
3929 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3930 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3931 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3932 </p>
3933 !! html/parsoid
3934 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3935 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3936 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3937 !!end
3939 !! test
3940 External links: specified text
3941 !! wikitext
3942 Specified text: [http://example.com link]
3943 !! html
3944 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3945 </p>
3946 !!end
3948 !! test
3949 External links: trail
3950 !! wikitext
3951 Linktrails should not work for external links: [http://example.com link]s
3952 !! html
3953 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3954 </p>
3955 !! end
3957 !! test
3958 External links: dollar sign in URL
3959 !! wikitext
3960 http://example.com/1$2345
3961 !! html
3962 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3963 </p>
3964 !! end
3966 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3967 !! test
3968 External links: dollar sign in URL (autonumber)
3969 !! wikitext
3970 [http://example.com/1$2345]
3971 !! html/php
3972 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3973 </p>
3974 !! html/parsoid
3975 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3976 !!end
3978 !! test
3979 External links: open square bracket forbidden in URL (bug 4377)
3980 !! options
3981 parsoid=wt2html,wt2wt,html2html
3982 !! wikitext
3983 http://example.com/1[2345
3984 !! html/php
3985 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3986 </p>
3987 !! html/parsoid
3988 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3989 !! end
3991 !! test
3992 External links: open square bracket forbidden in URL (named) (bug 4377)
3993 !! options
3994 parsoid=wt2html,html2html
3995 !! wikitext
3996 [http://example.com/1[2345]
3997 !! html/php
3998 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3999 </p>
4000 !! html/parsoid
4001 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4002 !!end
4004 # parsoid adds a space before the link name
4005 !! test
4006 External links: open square bracket forbidden in URL (named) (bug 4377)
4007 Parsoid variant.
4008 !! wikitext
4009 [http://example.com/1 [2345]
4010 !! html
4011 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4012 </p>
4013 !!end
4015 !! test
4016 External links: nowiki in URL link text (bug 6230)
4017 !! wikitext
4018 [http://example.com/ <nowiki>''example site''</nowiki>]
4019 !! html
4020 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4021 </p>
4022 !! end
4024 !! test
4025 External links: newline forbidden in text (bug 6230 regression check)
4026 !! wikitext
4027 [http://example.com/ first
4028 second]
4029 !! html
4030 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4031 second]
4032 </p>
4033 !!end
4035 !! test
4036 External links: Pipe char between url and text
4037 !! wikitext
4038 [http://example.com | link]
4039 !! html
4040 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4041 </p>
4042 !!end
4044 !! test
4045 External links: protocol-relative URL in brackets
4046 !! wikitext
4047 [//example.com/ Test]
4048 !! html
4049 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4050 </p>
4051 !! end
4053 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4054 !! test
4055 External links: protocol-relative URL in brackets without text
4056 !! wikitext
4057 [//example.com]
4058 !! html/php
4059 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4060 </p>
4061 !! html/parsoid
4062 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4063 !! end
4065 !! test
4066 External links: protocol-relative URL in free text is left alone
4067 !! wikitext
4068 //example.com/Foo
4069 !! html
4070 <p>//example.com/Foo
4071 </p>
4072 !!end
4074 !! test
4075 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4076 !! wikitext
4077 foo//example.com/Foo
4078 !! html
4079 <p>foo//example.com/Foo
4080 </p>
4081 !! end
4083 !! test
4084 External links: with no contents
4085 !! wikitext
4086 [http://en.wikipedia.org/wiki/Foo]
4088 [[wikipedia:Foo|Bar]]
4090 [[wikipedia:Foo|<span>Bar</span>]]
4091 !! html/php
4092 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4093 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4094 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4095 </p>
4096 !! html/parsoid
4097 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4098 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4099 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4100 !! end
4102 !! test
4103 External image
4104 !! wikitext
4105 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4106 !! html
4107 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4108 </p>
4109 !! end
4111 !! test
4112 External image from https
4113 !! wikitext
4114 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4115 !! html
4116 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4117 </p>
4118 !! end
4120 !! test
4121 External image (when not allowed)
4122 !! options
4123 wgAllowExternalImages=0
4124 !! wikitext
4125 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4126 !! html
4127 <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>
4128 </p>
4129 !! end
4131 !! test
4132 Link to non-http image, no img tag
4133 !! wikitext
4134 Link to non-http image, no img tag: ftp://example.com/test.jpg
4135 !! html
4136 <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>
4137 </p>
4138 !! end
4140 !! test
4141 External links: terminating separator
4142 !! wikitext
4143 Terminating separator: http://example.com/thing,
4144 !! html
4145 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4146 </p>
4147 !! end
4149 !! test
4150 External links: intervening separator
4151 !! wikitext
4152 Intervening separator: http://example.com/1,2,3
4153 !! html
4154 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4155 </p>
4156 !! end
4158 !! test
4159 External links: old bug with URL in query
4160 !! wikitext
4161 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4162 !! html
4163 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4164 </p>
4165 !! end
4167 !! test
4168 External links: old URL-in-URL bug, mixed protocols
4169 !! wikitext
4170 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4171 !! html
4172 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4173 </p>
4174 !!end
4176 !! test
4177 External links: URL in text
4178 !! wikitext
4179 URL in text: [http://example.com http://example.com]
4180 !! html
4181 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4182 </p>
4183 !! end
4185 !! test
4186 External links: Clickable images
4187 !! wikitext
4188 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4189 !! html
4190 <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>
4191 </p>
4192 !!end
4194 !! test
4195 External links: raw ampersand
4196 !! wikitext
4197 Old &amp; use: http://x&y
4198 !! html
4199 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4200 </p>
4201 !! end
4203 !! test
4204 External links: encoded ampersand
4205 !! wikitext
4206 Old &amp; use: http://x&amp;y
4207 !! html/php
4208 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4209 </p>
4210 !! html/parsoid
4211 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4212 !! end
4214 !! test
4215 External links: encoded equals (bug 6102)
4216 !! wikitext
4217 http://example.com/?foo&#61;bar
4218 !! html/php
4219 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4220 </p>
4221 !! html/parsoid
4222 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4223 !! end
4226 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4227 ## does it number them.  As discussed in bug 53505, we can identify
4228 ## autonumbered links via CSS.
4231 !! test
4232 External links: [raw ampersand]
4233 !! wikitext
4234 Old &amp; use: [http://x&y]
4235 !! html/php
4236 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4237 </p>
4238 !! html/parsoid
4239 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4240 !! end
4242 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4243 # mode will return the [raw ampersand] wikitext
4244 !! test
4245 External links: [encoded ampersand]
4246 !! options
4247 parsoid=wt2html,wt2wt,html2html
4248 !! wikitext
4249 Old &amp; use: [http://x&amp;y]
4250 !! html/php
4251 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4252 </p>
4253 !! html/parsoid
4254 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4255 !! end
4257 !! test
4258 External links: [raw equals]
4259 !! wikitext
4260 [http://example.com/?foo=bar]
4261 !! html/php
4262 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4263 </p>
4264 !! html/parsoid
4265 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4266 !! end
4268 # note that parsoid html is identical to [raw equals] case; so html2wt
4269 # mode will return the [raw equals] wikitext
4270 !! test
4271 External links: [encoded equals] (bug 6102)
4272 !! options
4273 parsoid=wt2html,wt2wt,html2html
4274 !! wikitext
4275 [http://example.com/?foo&#61;bar]
4276 !! html/php
4277 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4278 </p>
4279 !! html/parsoid
4280 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4281 !! end
4283 # xxx parsoid strips the IDN character, so the round-trip tests will
4284 #     obviously fail and are disabled. --cscott
4285 !! test
4286 External links: [IDN ignored character reference in hostname; strip it right off]
4287 !! options
4288 parsoid=wt2html,wt2wt,html2html
4289 !! wikitext
4290 [http://e&zwnj;xample.com/]
4291 !! html/php
4292 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4293 </p>
4294 !! html/parsoid
4295 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4296 !! end
4298 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4299 # Where an external link could easily circumvent the sanitization of the text of
4300 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4301 # test demands a higher standard. That's a bit strange.
4303 # Example:
4305 # http://e‌xample.com -> [http://example.com|http://example.com]
4306 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4308 # The first example is sanitized, but the second is not. Any security benefits
4309 # from this production are trivial to circumvent. Either remove this test and
4310 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4311 # the test accordingly.
4313 # All our love,
4314 # The Parsoid team.
4315 # xxx parsoid strips the IDN character, so the round-trip tests will
4316 #     obviously fail and are disabled. --cscott
4317 !! test
4318 External links: IDN ignored character reference in hostname; strip it right off
4319 !! options
4320 parsoid=wt2html,html2html
4321 !! wikitext
4322 http://e&zwnj;xample.com/
4323 !! html/php
4324 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4325 </p>
4326 !! html/parsoid
4327 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4328 !! end
4330 !! test
4331 External links: www.jpeg.org (bug 554)
4332 !! wikitext
4333 http://www.jpeg.org
4334 !! html
4335 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4336 </p>
4337 !! end
4339 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4340 !! test
4341 External links: URL within URL (original bug 2)
4342 !! wikitext
4343 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4344 !! html/php
4345 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4346 </p>
4347 !! html/parsoid
4348 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4349 !! end
4351 !! test
4352 BUG 361: URL inside bracketed URL
4353 !! wikitext
4354 [http://www.example.com/foo http://www.example.com/bar]
4355 !! html
4356 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4357 </p>
4358 !! end
4360 !! test
4361 BUG 361: URL within URL, not bracketed
4362 !! wikitext
4363 http://www.example.com/foo?=http://www.example.com/bar
4364 !! html
4365 <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>
4366 </p>
4367 !! end
4369 !! test
4370 BUG 289: ">"-token in URL-tail
4371 !! wikitext
4372 http://www.example.com/<hello>
4373 !! html
4374 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4375 </p>
4376 !!end
4378 !! test
4379 BUG 289: literal ">"-token in URL-tail
4380 !! wikitext
4381 http://www.example.com/<b>html</b>
4382 !! html
4383 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4384 </p>
4385 !!end
4387 !! test
4388 BUG 289: ">"-token in bracketed URL
4389 !! wikitext
4390 [http://www.example.com/<hello> stuff]
4391 !! html
4392 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4393 </p>
4394 !!end
4396 !! test
4397 BUG 289: literal ">"-token in bracketed URL
4398 !! wikitext
4399 [http://www.example.com/<b>html</b> stuff]
4400 !! html
4401 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4402 </p>
4403 !!end
4405 !! test
4406 BUG 289: literal double quote at end of URL
4407 !! wikitext
4408 http://www.example.com/"hello"
4409 !! html
4410 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4411 </p>
4412 !!end
4414 !! test
4415 BUG 289: literal double quote in bracketed URL
4416 !! wikitext
4417 [http://www.example.com/"hello" stuff]
4418 !! html
4419 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4420 </p>
4421 !!end
4423 !! test
4424 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4425 !! wikitext
4426 [http://www.example.com  test]
4427 !! html
4428 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4429 </p>
4430 !! end
4432 !! test
4433 External links: link text with spaces
4434 !! wikitext
4435 [http://www.example.com a b c]
4436 [http://www.example.com ''a'' ''b'']
4437 !! html
4438 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4439 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4440 </p>
4441 !! end
4443 !! test
4444 External links: wiki links within external link (Bug 3695)
4445 !! wikitext
4446 [http://example.com [[wikilink]] embedded in ext link]
4447 !! html/php
4448 <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>
4449 </p>
4450 !! html/parsoid
4451 <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>
4452 !! end
4454 !! test
4455 BUG 787: Links with one slash after the url protocol are invalid
4456 !! wikitext
4457 http:/example.com
4459 [http:/example.com title]
4460 !! html
4461 <p>http:/example.com
4462 </p><p>[http:/example.com title]
4463 </p>
4464 !! end
4466 !! test
4467 Bracketed external links with template-generated invalid target
4468 !! wikitext
4469 [{{echo|http:/example.com}} title]
4470 !! html
4471 <p>[http:/example.com title]
4472 </p>
4473 !! end
4475 !! test
4476 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4477 !! wikitext
4478 ''[http://example.com text'']
4479 [http://example.com '''text]'''
4480 ''Something [http://example.com in italic'']
4481 ''Something [http://example.com mixed''''', even bold]'''
4482 '''''Now [http://example.com both''''']
4483 !! html
4484 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4485 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4486 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4487 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4488 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4489 </p>
4490 !! end
4493 !! test
4494 Bug 4781: %26 in URL
4495 !! wikitext
4496 http://www.example.com/?title=AT%26T
4497 !! html/php
4498 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4499 </p>
4500 !! html/parsoid
4501 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4502 !! end
4504 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4505 # % is actually legal in HTML5. Any change in output would need testing though.
4506 !! test
4507 Bug 4781, 5267: %25 in URL
4508 !! wikitext
4509 http://www.example.com/?title=100%25_Bran
4510 !! html/php
4511 <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>
4512 </p>
4513 !! html/parsoid
4514 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4515 !! end
4517 !! test
4518 Bug 4781, 5267: %28, %29 in URL
4519 !! wikitext
4520 http://www.example.com/?title=Ben-Hur_%281959_film%29
4521 !! html/php
4522 <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>
4523 </p>
4524 !! html/parsoid
4525 <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>
4526 !! end
4529 !! test
4530 Bug 4781: %26 in autonumber URL
4531 !! wikitext
4532 [http://www.example.com/?title=AT%26T]
4533 !! html/php
4534 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4535 </p>
4536 !! html/parsoid
4537 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4538 !! end
4540 !! test
4541 Bug 4781, 5267: %26 in autonumber URL
4542 !! wikitext
4543 [http://www.example.com/?title=100%25_Bran]
4544 !! html/php
4545 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4546 </p>
4547 !! html/parsoid
4548 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4549 !! end
4551 !! test
4552 Bug 4781, 5267: %28, %29 in autonumber URL
4553 !! wikitext
4554 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4555 !! html/php
4556 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4557 </p>
4558 !! html/parsoid
4559 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4560 !! end
4563 !! test
4564 Bug 4781: %26 in bracketed URL
4565 !! wikitext
4566 [http://www.example.com/?title=AT%26T link]
4567 !! html/php
4568 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4569 </p>
4570 !! html/parsoid
4571 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4572 !! end
4574 !! test
4575 Bug 4781, 5267: %25 in bracketed URL
4576 !! wikitext
4577 [http://www.example.com/?title=100%25_Bran link]
4578 !! html
4579 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4580 </p>
4581 !! end
4583 !! test
4584 Bug 4781, 5267: %28, %29 in bracketed URL
4585 !! wikitext
4586 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4587 !! html/php
4588 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4589 </p>
4590 !! html/parsoid
4591 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4592 !! end
4594 !! test
4595 External link containing a period in the anchor. (bug 63947)
4596 !! wikitext
4597 [//foo.org/bar#baz. bang]
4599 [//foo.org/bar. bang]
4600 !! html/php
4601 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4602 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4603 </p>
4604 !! html/parsoid
4605 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4606 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4607 !! end
4609 !! test
4610 External link containing a single quote. (bug 63947)
4611 !! wikitext
4612 [//foo.org/bar'baz]
4614 [//foo.org/bar'baz bang]
4615 !! html/php
4616 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4617 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4618 </p>
4619 !! html/parsoid
4620 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4621 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4622 !! end
4625 !! test
4626 External link containing a period in the anchor. (bug 63947)
4627 !! wikitext
4628 [//foo.org/bar#baz. bang]
4630 [//foo.org/bar. bang]
4631 !! html/php
4632 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4633 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4634 </p>
4635 !! html/parsoid
4636 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4637 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4638 !! end
4640 !! test
4641 External link containing a single quote. (bug 63947)
4642 !! wikitext
4643 [//foo.org/bar'baz]
4645 [//foo.org/bar'baz bang]
4646 !! html/php
4647 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4648 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4649 </p>
4650 !! html/parsoid
4651 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4652 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4653 !! end
4656 !! test
4657 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4658 !! wikitext
4659 Some [http://example.com/ pretty ''italics'' and stuff]!
4660 !! html
4661 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4662 </p>
4663 !! end
4665 !! test
4666 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4667 !! wikitext
4668 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4669 !! html
4670 <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>
4671 </p>
4672 !! end
4674 !! test
4675 External link containing double-single-quotes with no space separating the url from text in italics
4676 !! wikitext
4677 [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]].]
4678 !! html/php
4679 <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>
4680 </p>
4681 !! html/php+tidy
4682 <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>
4683 !! html/parsoid
4684 <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>
4685 !! end
4687 !! test
4688 External link with comments in link text
4689 !! wikitext
4690 [http://www.google.com Google <!-- comment -->]
4691 !! html
4692 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4693 </p>
4694 !! end
4696 !! test
4697 URL-encoding in URL functions (single parameter)
4698 !! wikitext
4699 {{localurl:Some page|amp=&}}
4700 !! html
4701 <p>/index.php?title=Some_page&amp;amp=&amp;
4702 </p>
4703 !! end
4705 !! test
4706 URL-encoding in URL functions (multiple parameters)
4707 !! wikitext
4708 {{localurl:Some page|q=?&amp=&}}
4709 !! html
4710 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4711 </p>
4712 !! end
4714 !! test
4715 Brackets in urls
4716 !! wikitext
4717 http://example.com/index.php?foozoid%5B%5D=bar
4719 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4720 !! html/php
4721 <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>
4722 </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>
4723 </p>
4724 !! html/parsoid
4725 <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>
4727 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4728 !! end
4730 !! test
4731 IPv6 urls (bug 21261)
4732 !! options
4733 disabled
4734 !! wikitext
4735 http://[2404:130:0:1000::187:2]/index.php
4736 !! html
4737 <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>
4738 </p>
4739 !! end
4741 !! test
4742 Non-extlinks in brackets
4743 !! wikitext
4744 [foo]
4745 [foo bar]
4746 [foo ''bar'']
4747 [fool's] errand
4748 [fool's errand]
4749 [{{echo|foo}}]
4750 [{{echo|foo}} bar]
4751 [{{echo|foo}} ''bar'']
4752 [{{echo|foo}}l's] errand
4753 [{{echo|foo}}l's errand]
4754 [url={{echo|foo}}]
4755 [url=http://example.com]
4756 !! html
4757 <p>[foo]
4758 [foo bar]
4759 [foo <i>bar</i>]
4760 [fool's] errand
4761 [fool's errand]
4762 [foo]
4763 [foo bar]
4764 [foo <i>bar</i>]
4765 [fool's] errand
4766 [fool's errand]
4767 [url=foo]
4768 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4769 </p>
4770 !! end
4772 !! test
4773 Percent encoding in external links
4774 !! wikitext
4775 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4776 !! html/php
4777 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4778 </p>
4779 !! html/parsoid
4780 <p><a rel="mw:ExtLink"
4781 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4782 !! end
4784 !! test
4785 Use url link syntax for links where the content is equal the link target
4786 !! wikitext
4787 http://example.com
4788 !! html/php
4789 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4790 </p>
4791 !! html/parsoid
4792 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4793 !! end
4795 !! test
4796 Parenthesis in external links, especially URL links
4797 !! wikitext
4798 http://example.com)
4800 http://example.com/test)
4802 http://example.com/(test)
4804 http://example.com/((test)
4806 (http://example.com/(test))
4808 (http://example.com/(test)))))
4810 http://example.com/a)b
4812 [http://example.com) foo]
4813 !! html/php
4814 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4815 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4816 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4817 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4818 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4819 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4820 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4821 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4822 </p>
4823 !! html/parsoid
4824 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4825 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4826 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4827 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4828 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4829 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4830 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4831 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4832 !! end
4834 !! test
4835 Parenthesis in external links, w/ transclusion or comment
4836 !! wikitext
4837 (http://example.com/{{echo|hi}})
4839 (http://example.com<!-- hi -->)
4840 !! html/php
4841 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4842 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4843 </p>
4844 !! html/parsoid
4845 <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>
4847 <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>
4848 !! end
4850 !! test
4851 Replace invalid link targets when serializing
4852 !! options
4853 parsoid=html2wt
4854 !! html
4855 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4856 !! wikitext
4857 [[MediaWiki:Badtitletext|Manual]]
4858 !! end
4861 ### Quotes
4864 !! test
4865 Quotes
4866 !! wikitext
4867 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4869 Normal text. '''''Bold italic text.''''' Normal text.
4870 !! html
4871 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4872 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4873 </p>
4874 !! end
4877 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4878 # parser strips. The wikitext contains just the first half of the bold
4879 # quote pair.
4880 !! test
4881 Unclosed and unmatched quotes
4882 !! wikitext
4883 '''''Bold italic text '''with bold deactivated''' in between.'''''
4885 '''''Bold italic text ''with italic deactivated'' in between.'''''
4887 '''Bold text..
4889 ..spanning two paragraphs (should not work).'''
4891 '''Bold tag left open
4893 ''Italic tag left open
4895 Normal text.
4897 <!-- Unmatching number of opening, closing tags: -->
4898 '''This year''''s election ''should'' beat '''last year''''s.
4900 ''Tom'''s car is bigger than ''Susan'''s.
4902 Plain ''italic'''s plain
4903 !! html/php
4904 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4905 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4906 </p><p><b>Bold text..</b>
4907 </p><p>..spanning two paragraphs (should not work).
4908 </p><p><b>Bold tag left open</b>
4909 </p><p><i>Italic tag left open</i>
4910 </p><p>Normal text.
4911 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4912 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4913 </p><p>Plain <i>italic'</i>s plain
4914 </p>
4915 !! html/parsoid
4916 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4917 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4918 </p><p><b>Bold text..</b>
4919 </p><p>..spanning two paragraphs (should not work).<b></b>
4920 </p><p><b>Bold tag left open</b>
4921 </p><p><i>Italic tag left open</i>
4922 </p><p>Normal text.
4923 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4924 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4925 </p><p>Plain <i>italic'</i>s plain
4926 </p>
4927 !! end
4930 ### Tables
4932 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4935 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4936 # is the bare minimum required by the spec, see:
4937 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4938 # Parsoid team replies: empty table tags are legal in HTML5
4939 !! test
4940 A table with no data.
4941 !! options
4942 parsoid=wt2html
4943 !! wikitext
4944 {||}
4945 !! html/php
4947 !! html/parsoid
4948 <table></table>
4950 !! end
4952 !! test
4953 A table with stray table end tags on start tag line (wt2html)
4954 !! options
4955 parsoid=wt2html
4956 !! wikitext
4957 {|style="color: red;"|}
4959 {|style="color: red;" |}
4960 |foo
4963 {|style="color: red;"|} id="foo"
4964 |foo
4967 {|style="color: red;" |} id="foo"
4968 |foo
4970 !! html
4971 <table style="color: red;"></table>
4973 <table style="color: red;">
4974 <tbody><tr>
4975 <td>foo</td>
4976 </tr></tbody>
4977 </table>
4979 <table style="color: red;" id="foo">
4980 <tbody><tr>
4981 <td>foo</td>
4982 </tr></tbody>
4983 </table>
4985 <table style="color: red;" id="foo">
4986 <tbody><tr>
4987 <td>foo</td>
4988 </tr></tbody>
4989 </table>
4991 !! end
4993 !! test
4994 A table with no data (take 2)
4995 !! wikitext
4998 !! html/parsoid
4999 <table></table>
5000 !! end
5002 # A table with nothing but a caption is invalid XHTML, we might want to render
5003 # this as <p>caption</p>
5004 # Parsoid team replies: table with only a caption is legal in HTML5
5005 !! test
5006 A table with nothing but a caption
5007 !! wikitext
5009 |+ caption
5011 !! html/php
5012 <table>
5013 <caption> caption
5014 </caption><tr><td></td></tr></table>
5016 !! html/parsoid
5017 <table><caption> caption</caption></table>
5018 !! end
5020 !! test
5021 A table with caption with default-spaced attributes and a table row
5022 !! wikitext
5024 |+ style="color: red;" | caption1
5026 | foo
5028 !! html
5029 <table>
5030 <caption style="color: red;"> caption1
5031 </caption>
5032 <tr>
5033 <td> foo
5034 </td></tr></table>
5036 !! end
5038 !! test
5039 A table with captions with non-default spaced attributes and a table row
5040 !! wikitext
5042 |+style="color: red;"|caption2
5043 |+ style="color: red;"| caption3
5045 | foo
5047 !! html
5048 <table>
5049 <caption style="color: red;">caption2
5050 </caption>
5051 <caption style="color: red;"> caption3
5052 </caption>
5053 <tr>
5054 <td> foo
5055 </td></tr></table>
5057 !! end
5059 !! test
5060 Table td-cell syntax variations
5061 !! wikitext
5063 | foo bar foo | baz
5064 | foo bar foo || baz
5065 | style='color:red;' | baz
5066 | style='color:red;' || baz
5068 !! html
5069 <table>
5070 <tr>
5071 <td> baz
5072 </td>
5073 <td> foo bar foo </td>
5074 <td> baz
5075 </td>
5076 <td style="color:red;"> baz
5077 </td>
5078 <td> style='color:red;' </td>
5079 <td> baz
5080 </td></tr></table>
5082 !! end
5084 !! test
5085 Simple table
5086 !! wikitext
5088 | 1 || 2
5090 | 3 || 4
5092 !! html
5093 <table>
5094 <tr>
5095 <td> 1 </td>
5096 <td> 2
5097 </td></tr>
5098 <tr>
5099 <td> 3 </td>
5100 <td> 4
5101 </td></tr></table>
5103 !! end
5105 !! test
5106 Simple table but with multiple dashes for row wikitext
5107 !! wikitext
5109 | foo
5110 |-----
5111 | bar
5113 !! html
5114 <table>
5115 <tr>
5116 <td> foo
5117 </td></tr>
5118 <tr>
5119 <td> bar
5120 </td></tr></table>
5122 !! end
5123 !! test
5124 Multiplication table
5125 !! wikitext
5126 {| border="1" cellpadding="2"
5127 |+Multiplication table
5129 ! &times; !! 1 !! 2 !! 3
5131 ! 1
5132 | 1 || 2 || 3
5134 ! 2
5135 | 2 || 4 || 6
5137 ! 3
5138 | 3 || 6 || 9
5140 ! 4
5141 | 4 || 8 || 12
5143 ! 5
5144 | 5 || 10 || 15
5146 !! html
5147 <table border="1" cellpadding="2">
5148 <caption>Multiplication table
5149 </caption>
5150 <tr>
5151 <th> &#215; </th>
5152 <th> 1 </th>
5153 <th> 2 </th>
5154 <th> 3
5155 </th></tr>
5156 <tr>
5157 <th> 1
5158 </th>
5159 <td> 1 </td>
5160 <td> 2 </td>
5161 <td> 3
5162 </td></tr>
5163 <tr>
5164 <th> 2
5165 </th>
5166 <td> 2 </td>
5167 <td> 4 </td>
5168 <td> 6
5169 </td></tr>
5170 <tr>
5171 <th> 3
5172 </th>
5173 <td> 3 </td>
5174 <td> 6 </td>
5175 <td> 9
5176 </td></tr>
5177 <tr>
5178 <th> 4
5179 </th>
5180 <td> 4 </td>
5181 <td> 8 </td>
5182 <td> 12
5183 </td></tr>
5184 <tr>
5185 <th> 5
5186 </th>
5187 <td> 5 </td>
5188 <td> 10 </td>
5189 <td> 15
5190 </td></tr></table>
5192 !! end
5194 !! test
5195 Accept "||" in table headings
5196 !! wikitext
5198 !h1 || h2
5200 !! html
5201 <table>
5202 <tr>
5203 <th>h1 </th>
5204 <th> h2
5205 </th></tr></table>
5207 !! end
5209 !! test
5210 Accept "!!" in table data
5211 !! wikitext
5213 | Foo!! ||
5215 !! html
5216 <table>
5217 <tr>
5218 <td> Foo!! </td>
5219 <td>
5220 </td></tr></table>
5222 !! html/parsoid
5223 <table>
5224 <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>
5225 </tbody></table>
5226 !! end
5228 !! test
5229 Accept "||" in indented table headings
5230 !! wikitext
5232 !h1 || h2
5234 !! html
5235 <dl><dd><table>
5236 <tr>
5237 <th>h1 </th>
5238 <th> h2
5239 </th></tr></table></dd></dl>
5241 !! end
5243 !! test
5244 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5245 !! wikitext
5247 !| h1
5248 || a
5250 !! html
5251 <table>
5252 <tr>
5253 <th> h1
5254 </th>
5255 <td> a
5256 </td></tr></table>
5258 !! end
5260 !!test
5261 Accept "| !" at start of line in tables (ignore !-attribute)
5262 !! wikitext
5265 | !style="color:red" | bar
5267 !! html
5268 <table>
5270 <tr>
5271 <td> bar
5272 </td></tr></table>
5274 !!end
5276 !!test
5277 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 +/- 
5278 !! wikitext
5281 |style='color:red;'|+1
5282 |style='color:blue;'|-1
5284 | 1 || 2 || 3
5285 | 1 ||+2 ||-3
5287 | +1
5288 | -1
5290 !! html
5291 <table>
5293 <tr>
5294 <td style="color:red;">+1
5295 </td>
5296 <td style="color:blue;">-1
5297 </td></tr>
5298 <tr>
5299 <td> 1 </td>
5300 <td> 2 </td>
5301 <td> 3
5302 </td>
5303 <td> 1 </td>
5304 <td>+2 </td>
5305 <td>-3
5306 </td></tr>
5307 <tr>
5308 <td> +1
5309 </td>
5310 <td> -1
5311 </td></tr></table>
5313 !!end
5315 !! test
5316 Table rowspan
5317 !! wikitext
5318 {| border=1
5319 | Cell 1, row 1
5320 |rowspan=2| Cell 2, row 1 (and 2)
5321 | Cell 3, row 1
5323 | Cell 1, row 2
5324 | Cell 3, row 2
5326 !! html
5327 <table border="1">
5328 <tr>
5329 <td> Cell 1, row 1
5330 </td>
5331 <td rowspan="2"> Cell 2, row 1 (and 2)
5332 </td>
5333 <td> Cell 3, row 1
5334 </td></tr>
5335 <tr>
5336 <td> Cell 1, row 2
5337 </td>
5338 <td> Cell 3, row 2
5339 </td></tr></table>
5341 !! end
5343 !! test
5344 Nested table
5345 !! wikitext
5346 {| border=1
5347 | &alpha;
5349 {| bgcolor=#ABCDEF border=2
5350 |nested
5352 |table
5354 |the original table again
5356 !! html
5357 <table border="1">
5358 <tr>
5359 <td> &#945;
5360 </td>
5361 <td>
5362 <table bgcolor="#ABCDEF" border="2">
5363 <tr>
5364 <td>nested
5365 </td></tr>
5366 <tr>
5367 <td>table
5368 </td></tr></table>
5369 </td>
5370 <td>the original table again
5371 </td></tr></table>
5373 !! end
5375 !! test
5376 Invalid attributes in table cell (bug 1830)
5377 !! wikitext
5379 |Cell:|broken
5381 !! html
5382 <table>
5383 <tr>
5384 <td>broken
5385 </td></tr></table>
5387 !! end
5390 # The "|}" to close the table is missing from the input, so parsoid's
5391 # *2wt modes will fail.
5392 !! test
5393 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5394 !! options
5395 parsoid=wt2html,html2html
5396 !! wikitext
5398 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5399 !! html/php
5400 <table>
5401 <tr>
5402 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5403 <td>]" onmouseover="alert(document.cookie)"&gt;test
5404 </td>
5405 </tr>
5406 </table>
5408 !! html/parsoid
5409 <table><tbody>
5410 <tr>
5411 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5412 !! end
5415 !! test
5416 Indented table markup mixed with indented pre content (proposed in bug 6200)
5417 !! wikitext
5418  <table>
5419  <tr>
5420  <td>
5421  Text that should be rendered preformatted
5422  </td>
5423  </tr>
5424  </table>
5425 !! html
5426  <table>
5427  <tr>
5428  <td>
5429 <pre>Text that should be rendered preformatted
5430 </pre>
5431  </td>
5432  </tr>
5433  </table>
5435 !! end
5437 !! test
5438 Template-generated table cell attributes and cell content
5439 !! wikitext
5441 |{{table_attribs}}
5442 | {{table_attribs}}
5444 !! html
5445 <table>
5446 <tr>
5447 <td style="color: red"> Foo
5448 </td>
5449 <td style="color: red"> Foo
5450 </td></tr></table>
5452 !! end
5454 !! test
5455 Template-generated table cell attributes and cell content (2)
5456 !! wikitext
5458 |align=center {{table_attribs}}
5460 !! html
5461 <table>
5462 <tr>
5463 <td align="center" style="color: red"> Foo
5464 </td></tr></table>
5466 !! end
5468 !! test
5469 Template-generated table cell attributes and cell content (3)
5470 !! wikitext
5472 |align=center {{table_cells}}
5474 !! html
5475 <table>
5476 <tr>
5477 <td align="center" style="color: red"> Foo </td>
5478 <td> Bar </td>
5479 <td> Baz
5480 </td></tr></table>
5482 !! end
5484 !! test
5485 Table with row followed by newlines and table heading
5486 !! wikitext
5490 ! foo
5492 !! html
5493 <table>
5496 <tr>
5497 <th> foo
5498 </th></tr></table>
5500 !! end
5502 !! test
5503 Table with empty line following the start tag
5504 !! wikitext
5508 | foo
5510 !! html
5511 <table>
5514 <tr>
5515 <td> foo
5516 </td></tr></table>
5518 !! end
5520 # FIXME: Preserve the attribute properly (with an empty string as value) in
5521 # the PHP parser. Parsoid implements the behavior below.
5522 !! test
5523 Table attributes with empty value
5524 !! wikitext
5526 | style=| hello
5528 !! html/parsoid
5529 <table>
5530 <tbody>
5531 <tr>
5532 <td style=""> hello
5533 </td></tr></tbody></table>
5535 !! end
5537 !! test
5538 Wikitext table with a lot of comments
5539 !! wikitext
5541 <!-- c0 -->
5542 | foo
5543 <!-- c1 -->
5544 |- <!-- c2 -->
5545 <!-- c3 -->
5546 |<!-- c4 -->
5547 <!-- c5 -->
5549 !! html
5550 <table>
5551 <tr>
5552 <td> foo
5553 </td></tr>
5554 <tr>
5555 <td>
5556 </td></tr></table>
5558 !! end
5560 !! test
5561 Wikitext table with double-line table cell
5562 !! wikitext
5567 !! html
5568 <table>
5569 <tr>
5570 <td>a
5571 <p>b
5572 </p>
5573 </td></tr></table>
5575 !! end
5577 !! test
5578 Table cell with a single comment
5579 !! wikitext
5581 | <!-- c1 -->
5582 | a
5584 !! html
5585 <table>
5586 <tr>
5587 <td>
5588 </td>
5589 <td> a
5590 </td></tr></table>
5592 !! end
5594 !! test
5595 Table-cell after a comment-only-empty-line
5596 !! wikitext
5599 <!--c1-->
5600 <!--c2-->| b
5602 !! html
5603 <table>
5604 <tr>
5605 <td>a
5606 </td>
5607 <td> b
5608 </td></tr></table>
5610 !! html/parsoid
5611 <table>
5612 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5613 <!--c1-->
5614 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5615 </tbody></table>
5617 !! end
5619 !! test
5620 Build table with {{!}}
5621 !! wikitext
5622 {{{!}} class="wikitable"
5623 ! header
5624 ! second header
5625 {{!}}- style="color:red;"
5626 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5627 {{!}}}
5628 !! html
5629 <table class="wikitable">
5630 <tr>
5631 <th> header
5632 </th>
5633 <th> second header
5634 </th></tr>
5635 <tr style="color:red;">
5636 <td> data </td>
5637 <td style="color:red;"> second data
5638 </td></tr></table>
5640 !! end
5642 # The expected HTML structure in this test is debatable. The PHP parser does
5643 # not parse this kind of table at all. The main focus for Parsoid is on
5644 # round-tripping, so this output is ok for now. TODO: revisit!
5645 !! test
5646 Wikitext table with html-syntax row
5647 !! wikitext
5650 <td>foo</td>
5652 !! html/parsoid
5653 <table>
5654 <tbody>
5655 <tr>
5656 <td>foo</td></tr></tbody></table>
5657 !! end
5659 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5660 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5661 ## PHP parser, which tidy then compounds by fostering the content
5662 ## entirely out of the table.  Parsoid recognizes the table context
5663 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
5664 ## depends on PHP's treatment of broken table markup!
5665 !! test
5666 Implicit <td> after a |-
5667 !! options
5668 parsoid=wt2html,html2html
5669 !! wikitext
5674 !! html/php
5675 <table>
5678 </table>
5680 !! html/php+tidy
5681 <p>a</p>
5682 !! html/parsoid
5683 <table>
5684 <tr><td>a</td></tr>
5685 </table>
5686 !! end
5688 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5689 !! test
5690 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5691 !! options
5692 parsoid=wt2html,html2html
5693 !! wikitext
5701 !! html/php
5702 <table>
5704 <tr>
5705 <td>
5706 <pre>a
5707 </pre>
5708 </td></tr>
5710 </table>
5712 !! html/php+tidy
5713 <p>b</p>
5714 <table>
5715 <tr>
5716 <td>
5717 <pre>
5719 </pre></td>
5720 </tr>
5721 </table>
5722 !! html/parsoid
5723 <table>
5724 <tbody>
5725 <tr><td><pre>a</pre></td></tr>
5726 <tr><td> b</td></tr>
5727 </tbody>
5728 </table>
5729 !! end
5731 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5732 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5733 !! test
5734 Lists should be recognized in an implicit <td> context
5735 !! options
5736 parsoid=wt2html,html2html
5737 !! wikitext
5742 !! html/php
5743 <table>
5745 <ul><li>a</li></ul>
5746 </table>
5748 !! html/php+tidy
5749 <ul>
5750 <li>a</li>
5751 </ul>
5752 !! html/parsoid
5753 <table>
5754 <tr>
5755 <td><ul>
5756 <li>a</li>
5757 </ul></td>
5758 </tr>
5759 </table>
5760 !! end
5762 !! test
5763 Parsoid: Round-trip tables directly followed by content (bug 51219)
5764 !! options
5765 parsoid=wt2html,wt2wt
5766 !! wikitext
5768 |foo
5769 |} bar
5772 |baz
5773 |}<b>quux</b>
5774 !! html+tidy
5775 <table>
5776 <tr>
5777 <td>foo</td>
5778 </tr>
5779 </table>
5780 <p>bar</p>
5781 <table>
5782 <tr>
5783 <td>baz</td>
5784 </tr>
5785 </table>
5786 <p><b>quux</b></p>
5787 !! end
5789 !! test
5790 Parsoid: Default to a newline after tables in new content (bug 51219)
5791 !! options
5792 parsoid=html2wt
5793 !! wikitext
5795 |foo
5797 <nowiki> </nowiki>bar
5799 |baz
5801 '''quux'''
5802 !! html
5803 <table><tbody>
5804 <tr><td>foo</td></tr></tbody></table> bar
5805 <table><tbody>
5806 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5807 !! end
5809 !! test
5810 Parsoid: newline inducing block nodes don't suppress <nowiki>
5811 !! options
5812 parsoid=html2wt
5813 !! wikitext
5814 <nowiki> </nowiki>a
5816 = foo =
5817 !! html
5818  a<h1>foo</h1>
5819 !! end
5821 !! test
5822 Parsoid: Row-syntax table headings followed by comment & table cells
5823 !! options
5824 parsoid=wt2html,wt2wt
5825 !! wikitext
5827 ! foo || bar
5828 <!-- foo -->  || baz || quux
5830 !! html/php
5831 <table>
5832 <tr>
5833 <th> foo </th>
5834 <th> bar
5835 </th>
5836 <td> baz </td>
5837 <td> quux
5838 </td></tr></table>
5840 !! html/parsoid
5841 <table>
5842 <tbody><tr><th> foo </th><th> bar
5843 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
5844 </tbody></table>
5845 !! end
5848 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5849 # preserves it.
5850 !!test
5851 Parsoid: Recover better from broken table attributes
5852 !!options
5853 parsoid=wt2html
5854 !!wikitext
5855 {| class="foo
5856 | class="bar" |
5859 !!html/php+tidy
5860 <table>
5861 <tr>
5862 <td class="bar">
5863 <p>foo</p>
5864 </td>
5865 </tr>
5866 </table>
5867 !!html/parsoid
5868 <table class="foo">
5869 <tr>
5870 <td class="bar">
5871 <p>foo</p></td></tr>
5872 </tbody></table>
5873 !!end
5875 !! test
5876 Strip unsupported table tags
5877 !! options
5878 parsoid=html2wt
5879 !! html
5880 <table>
5881 <thead>
5882 <tr>
5883 <th>Month</th>
5884 <th>Savings</th>
5885 </tr>
5886 </thead>
5887 <tbody>
5888 <tr>
5889 <td>January</td>
5890 <td>$100</td>
5891 </tr>
5892 <tr>
5893 <td>February</td>
5894 <td>$80</td>
5895 </tr>
5896 </tbody>
5897 <tfoot>
5898 <tr>
5899 <td>Sum</td>
5900 <td>$180</td>
5901 </tr>
5902 </tfoot>
5903 </table>
5904 !! wikitext
5907 !Month
5908 !Savings
5910 |January
5911 |$100
5914 |February
5915 |$80
5917 |Sum
5918 |$180
5921 !! end
5924 ### Internal links
5926 !! test
5927 Plain link, capitalized
5928 !! wikitext
5929 [[Main Page]]
5930 !! html
5931 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5932 </p>
5933 !! end
5935 !! test
5936 Plain link, uncapitalized
5937 !! wikitext
5938 [[main Page]]
5939 !! html
5940 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5941 </p>
5942 !! end
5944 !! test
5945 Piped link
5946 !! wikitext
5947 [[Main Page|The Main Page]]
5948 !! html
5949 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5950 </p>
5951 !! end
5953 !! test
5954 Piped link with comment in link text
5955 !! wikitext
5956 [[Main Page|The Main<!--front--> Page]]
5957 !! html
5958 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5959 </p>
5960 !! end
5962 !! test
5963 Piped link with multiple pipe characters in link text
5964 !! wikitext
5965 [[Main Page||The|Main|Page|]]
5966 !! html/php
5967 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5968 </p>
5969 !! html/parsoid
5970 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
5971 !! end
5973 !! test
5974 Broken link
5975 !! wikitext
5976 [[Zigzagzogzagzig]]
5977 !! html
5978 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5979 </p>
5980 !! end
5982 !! test
5983 Broken link with fragment
5984 !! wikitext
5985 [[Zigzagzogzagzig#zug]]
5986 !! html
5987 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5988 </p>
5989 !! end
5991 !! test
5992 Special page link with fragment
5993 !! wikitext
5994 [[Special:Version#anchor]]
5995 !! html
5996 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5997 </p>
5998 !! end
6000 !! test
6001 Nonexistent special page link with fragment
6002 !! wikitext
6003 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6004 !! html
6005 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6006 </p>
6007 !! end
6009 !! test
6010 Link with prefix
6011 !! wikitext
6012 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6013 !! html
6014 <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>
6015 </p>
6016 !! end
6018 !! test
6019 Link with suffix
6020 !! wikitext
6021 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6022 !! html
6023 <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>!!!
6024 </p>
6025 !! end
6027 !! article
6028 prefixed article
6029 !! text
6030 Some text
6031 !! endarticle
6033 !! test
6034 Bug 43661: Piped links with identical prefixes
6035 !! wikitext
6036 [[prefixed article|prefixed articles with spaces]]
6038 [[prefixed article|prefixed articlesaoeu]]
6040 [[Main Page|Main Page test]]
6041 !! html
6042 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6043 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6044 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6045 </p>
6046 !! end
6049 !! test
6050 Link with HTML entity in suffix / tail
6051 !! wikitext
6052 [[Main Page]]&quot;, [[Main Page]]&#97;
6053 !! html
6054 <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;
6055 </p>
6056 !! end
6058 !! test
6059 Link with 3 brackets
6060 !! wikitext
6061 [[[Main Page]]]
6062 !! html
6063 <p>[[[Main Page]]]
6064 </p>
6065 !! end
6067 !! test
6068 Link with 4 brackets
6069 !! wikitext
6070 [[[[Main Page]]]]
6071 !! html
6072 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6073 </p>
6074 !! end
6076 !! test
6077 Piped link with 3 brackets
6078 !! wikitext
6079 [[[main page|the main page]]]
6080 !! html
6081 <p>[[[main page|the main page]]]
6082 </p>
6083 !! end
6085 !! test
6086 Piped link with extlink-like text
6087 !! wikitext
6088 [[Main Page|[bar]]]
6089 [[Main Page|This is a [bar]]]
6090 !! html
6091 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6092 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6093 </p>
6094 !! end
6096 !! test
6097 Link with multiple pipes
6098 !! wikitext
6099 [[Main Page|The|Main|Page]]
6100 !! html
6101 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6102 </p>
6103 !! end
6105 # Note that parsoid does not munge anchor text; all non-space
6106 # characters are valid in HTML5 ids.
6107 !! test
6108 Anchor containing a #. (bug 63430)
6109 !! wikitext
6110 [[Main Page#And#Link]]
6111 !! html/php
6112 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6113 </p>
6114 !! html/parsoid
6115 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6116 !! end
6118 !! test
6119 Link to namespaces
6120 !! wikitext
6121 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6122 !! html
6123 <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>
6124 </p>
6125 !! end
6127 !! test
6128 Link with space in namespace
6129 !! wikitext
6130 [[User talk:Foo bar]]
6131 !! html
6132 <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>
6133 </p>
6134 !! end
6136 !! article
6137 MemoryAlpha:AlphaTest
6138 !! text
6139 This is an article in the MemoryAlpha namespace
6140 (which shadows the memoryalpha interwiki link).
6141 !! endarticle
6143 !! test
6144 Namespace takes precedence over interwiki link (bug 51680)
6145 !! wikitext
6146 [[MemoryAlpha:AlphaTest]]
6147 !! html
6148 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6149 </p>
6150 !! end
6152 # The previous test doesn't work correctly in html2*, due to not recognizing the
6153 # link as an internal one. This one checks for the correct behavior.
6154 !! test
6155 Link to namespace preferred over interwiki with correct rel attribute
6156 !! options
6157 parsoid=html2wt,html2html
6158 !! wikitext
6159 [[MemoryAlpha:AlphaTest]]
6160 !! html
6161 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6162 </p>
6163 !! end
6165 !! test
6166 Piped link to namespace
6167 !! wikitext
6168 [[Meta:Disclaimers|The disclaimers]]
6169 !! html
6170 <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>
6171 </p>
6172 !! end
6174 !! test
6175 Link containing }
6176 !! wikitext
6177 [[Usually caused by a typo (oops}]]
6178 !! html
6179 <p>[[Usually caused by a typo (oops}]]
6180 </p>
6181 !! end
6183 !! article
6184 7% Solution
6185 !! text
6186 Just a test of an article title containing a percent.
6187 !! endarticle
6189 !! test
6190 Link containing % (not as a hex sequence)
6191 !! wikitext
6192 [[7% Solution]]
6193 !! html/php
6194 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6195 </p>
6196 !! html/parsoid
6197 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6198 !! end
6200 # note that the parsoid HTML is identical to the previous test output,
6201 # so the previous test ensures that the html2wt mode will generate the
6202 # "not as a hex sequence" wikitext.
6203 !! test
6204 Link containing % as a single hex sequence interpreted to char
6205 !! options
6206 parsoid=wt2wt,wt2html,html2html
6207 !! wikitext
6208 [[7%25 Solution]]
6209 !! html/php
6210 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6211 </p>
6212 !! html/parsoid
6213 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6214 !!end
6216 !! test
6217 Link containing % as a double hex sequence interpreted to hex sequence
6218 !! wikitext
6219 [[7%2525 Solution]]
6220 !! html
6221 <p>[[7%2525 Solution]]
6222 </p>
6223 !!end
6225 # note that parsoid does not munge anchor text; all non-space
6226 # characters are valid in HTML5 anchors.
6227 !! test
6228 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6229 Example for such a section: == < ==
6230 !! wikitext
6231 [[%23%3c]][[%23%3e]]
6232 !! html/php
6233 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6234 </p>
6235 !! html/parsoid
6236 <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>
6237 !! end
6239 !! test
6240 Link containing "<#" and ">#" as a hex sequences
6241 !! wikitext
6242 [[%3c%23]][[%3e%23]]
6243 !! html
6244 <p>[[%3c%23]][[%3e%23]]
6245 </p>
6246 !! end
6248 !! test
6249 Link containing an equals sign
6250 !! wikitext
6251 [[Special:BookSources/isbn=4-00-026157-6]]
6252 !! html/php
6253 <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>
6254 </p>
6255 !! html/parsoid
6256 <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>
6257 !! end
6259 !! article
6260 Foo~bar
6261 !! text
6262 Just a test of an article title containing a tilde.
6263 !! endarticle
6265 # note that links containing signatures, like [[Foo~~~~]], are
6266 # massaged by the pre-save transform (PST) and so the tildes are never
6267 # seen by the parser.
6268 !! test
6269 Link containing a tilde
6270 !! wikitext
6271 [[Foo~bar]]
6272 !! html/php
6273 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6274 </p>
6275 !! html/parsoid
6276 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6277 !! end
6279 !! test
6280 Link containing double-single-quotes '' (bug 4598)
6281 !! wikitext
6282 [[Lista d''e paise d''o munno]]
6283 !! html/php
6284 <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>
6285 </p>
6286 !! html/parsoid
6287 <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>
6288 !! end
6290 !! test
6291 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6292 !! wikitext
6293 Some [[Link|pretty ''italics'' and stuff]]!
6294 !! html/php
6295 <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>!
6296 </p>
6297 !! html/parsoid
6298 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6299 !! end
6301 !! test
6302 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6303 !! wikitext
6304 ''Some [[Link|pretty ''italics'' and stuff]]!''
6305 !! html
6306 <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>
6307 </p>
6308 !! end
6310 !! test
6311 Link with double quotes in title part (literal) and alternate part (interpreted)
6312 !! wikitext
6313 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6315 [[''Pentecoste'']]
6317 [[''Pentecoste''|Pentecoste]]
6319 [[''Pentecoste''|''Pentecoste'']]
6320 !! html/php
6321 <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>
6322 </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>
6323 </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>
6324 </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>
6325 </p>
6326 !! html/parsoid
6327 <meta typeof="mw:Placeholder"/>
6328 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6329 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6330 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6331 !! end
6333 !! test
6334 Broken image links with HTML captions (bug 39700)
6335 !! wikitext
6336 [[File:Nonexistent|<script></script>]]
6337 [[File:Nonexistent|100px|<script></script>]]
6338 [[File:Nonexistent|&lt;]]
6339 [[File:Nonexistent|a<i>b</i>c]]
6340 !! html
6341 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6342 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6343 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6344 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6345 </p>
6346 !! end
6348 !! test
6349 Plain link to URL
6350 !! wikitext
6351 [[http://www.example.com]]
6352 !! html/php
6353 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6354 </p>
6355 !! html/parsoid
6356 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6357 !! end
6359 !! test
6360 Plain link to URL with link text
6361 !! wikitext
6362 [[http://www.example.com Link text]]
6363 !! html
6364 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6365 </p>
6366 !! end
6368 !! test
6369 Plain link to protocol-relative URL
6370 !! wikitext
6371 [[//www.example.com]]
6372 !! html/php
6373 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6374 </p>
6375 !! html/parsoid
6376 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6377 !! end
6379 !! test
6380 Plain link to protocol-relative URL with link text
6381 !! wikitext
6382 [[//www.example.com Link text]]
6383 !! html
6384 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6385 </p>
6386 !! end
6388 !! test
6389 Plain link to page with question mark in title
6390 !! wikitext
6391 [[A?b]]
6393 [[A?b|Baz]]
6394 !! html
6395 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6396 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6397 </p>
6398 !! end
6401 # I'm fairly sure the expected result here is wrong.
6402 # We want these to be URL links, not pseudo-pages with URLs for titles....
6403 # However the current output is also pretty screwy.
6405 # ----
6406 # I'm changing it to match the current output--it arguably makes more
6407 # sense in the light of the test above. Old expected result was:
6408 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6409 #</p>
6410 # But I think this test is bordering on "garbage in, garbage out" anyway.
6411 # -- wtm
6412 !! test
6413 Piped link to URL
6414 !! wikitext
6415 Piped link to URL: [[http://www.example.com|an example URL]]
6416 !! html/php
6417 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6418 </p>
6419 !! html/parsoid
6420 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6421 !! end
6423 !! test
6424 BUG 2: [[page|http://url/]] should link to page, not http://url/
6425 !! wikitext
6426 [[Main Page|http://url/]]
6427 !! html/php
6428 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6429 </p>
6430 !! html/parsoid
6431 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6432 !! end
6434 # Parsoid does not mark self-links, by design.
6435 !! test
6436 BUG 337: Escaped self-links should be bold
6437 !! options
6438 title=[[Bug462]]
6439 !! wikitext
6440 [[Bu&#103;462]] [[Bug462]]
6441 !! html/php
6442 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6443 </p>
6444 !! html/php+tidy
6445 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6446 !! html/parsoid
6447 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6448 !! end
6450 !! test
6451 Self-link to section should not be bold
6452 !! options
6453 title=[[Main Page]]
6454 !! wikitext
6455 [[Main Page#section]]
6456 !! html
6457 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6458 </p>
6459 !! end
6461 !! article
6463 !! text
6464 This is 00.
6465 !! endarticle
6467 !!test
6468 Self-link to numeric title
6469 !!options
6470 title=[[0]]
6471 !! wikitext
6472 [[0]]
6473 !! html
6474 <p><strong class="selflink">0</strong>
6475 </p>
6476 !!end
6478 !!test
6479 Link to numeric-equivalent title
6480 !!options
6481 title=[[0]]
6482 !! wikitext
6483 [[00]]
6484 !! html
6485 <p><a href="/wiki/00" title="00">00</a>
6486 </p>
6487 !!end
6489 !! test
6490 <nowiki> inside a link
6491 !! wikitext
6492 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6493 !! html
6494 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6495 </p>
6496 !! end
6498 !! test
6499 Non-breaking spaces in title
6500 !! wikitext
6501 [[&nbsp; Main &nbsp; Page &nbsp;]]
6502 !! html
6503 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6504 </p>
6505 !!end
6507 !! test
6508 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6509 !! options
6510 language=ca
6511 !! wikitext
6512 '''[[Main Page]]'''
6513 !! html
6514 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6515 </p>
6516 !! end
6518 !! test
6519 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6520 !! options
6521 language=ca
6522 !! wikitext
6523 ''[[Main Page]]''
6524 !! html
6525 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6526 </p>
6527 !! end
6529 !! test
6530 Internal link with en linktrail: no apostrophes (bug 27473)
6531 !! options
6532 language=en
6533 !! wikitext
6534 [[Something]]'nice
6535 !! html
6536 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6537 </p>
6538 !! end
6540 !! test
6541 Internal link with ca linktrail with apostrophes (bug 27473)
6542 !! options
6543 language=ca
6544 !! wikitext
6545 [[Something]]'nice
6546 !! html
6547 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6548 </p>
6549 !! end
6551 !! test
6552 Internal link with kaa linktrail with apostrophes (bug 27473)
6553 !! options
6554 language=kaa
6555 !! wikitext
6556 [[Something]]'nice
6557 !! html
6558 <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>
6559 </p>
6560 !! end
6562 !! test
6563 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6564 !! wikitext
6565 [[User:Foo/Test/63636:Bar|Test]]
6566 !! html/php
6567 <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>
6568 </p>
6569 !! html/parsoid
6570 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6571 !! end
6573 !! test
6574 Purely hash wikilink
6575 !! options
6576 title=[[User:test/123]]
6577 !! wikitext
6578 [[#a|b]]
6579 !! html/php
6580 <p><a href="#a">b</a>
6581 </p>
6582 !! html/parsoid
6583 <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>
6584 !! end
6586 !! test
6587 1. Interaction of linktrail and template encapsulation
6588 !! options
6589 parsoid
6590 !! wikitext
6591 {{echo|[[Foo]]}}l
6592 !! html
6593 <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>
6594 !! end
6596 !! test
6597 2. Interaction of linktrail and template encapsulation
6598 !! options
6599 parsoid
6600 !! wikitext
6601 {{echo|Some [[Fool]]}}s
6602 !! html
6603 <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>
6604 !! end
6606 !! test
6607 3. Interaction of linktrail and template encapsulation
6608 !! options
6609 parsoid
6610 !! wikitext
6611 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6612 !! html
6613 <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>
6614 !! end
6616 !! article
6617 Söfnuður
6618 !! text
6619 Test.
6620 !! endarticle
6622 !! test
6623 Internal link with is link prefix
6624 !! options
6625 language=is
6626 !! wikitext
6627 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6628 !! html
6629 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6630 </p>
6631 !! end
6633 !! article
6634 Mótmælendatrú
6635 !! text
6636 Test.
6637 !! endarticle
6639 !! test
6640 Internal link with is link trail and link prefix
6641 !! options
6642 language=is
6643 !! wikitext
6644 [[mótmælendatrú|xxx]]ar
6645 [[mótmælendatrú]]ar
6646 mótmælenda[[söfnuður]]
6647 mótmælenda[[söfnuður|söfnuðir]]
6648 mótmælenda[[söfnuður|söfnuðir]]xxx
6649 !! html
6650 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6651 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6652 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6653 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6654 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6655 </p>
6656 !! end
6658 !! test
6659 Parsoid link trail escaping
6660 !! options
6661 parsoid=html2wt,html2html
6662 !! wikitext
6663 [[apple]]<nowiki/>s
6664 !! html
6665 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6666 !! end
6668 !! test
6669 Parsoid link prefix escaping
6670 !! options
6671 language=is
6672 parsoid=html2wt,html2html
6673 !! wikitext
6674 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6675 !! html
6676 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6677 !! end
6679 !! test
6680 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6681 !! wikitext
6682 [[Foo|  bar]]
6684 [[Foo|  ''bar'']]
6686 [http://wp.org   foo]
6688 [http://wp.org   ''foo'']
6689 !! html
6690 <p><a href="/wiki/Foo" title="Foo">  bar</a>
6691 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
6692 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6693 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6694 </p>
6695 !! end
6697 !! test
6698 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6699 !! options
6700 parsoid
6701 !! wikitext
6702 [[Foo|{{echo|a}} b {{echo|c}}]]
6703 !! html
6704 <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>
6705 !! end
6707 !! test
6708 Link with angle bracket after anchor
6709 !! wikitext
6710 [[Foo#<bar>]]
6711 !! html/php
6712 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6713 </p>
6714 !! html/parsoid
6715 <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>
6716 !! end
6719 ### Interwiki links (see maintenance/interwiki.sql)
6722 !! test
6723 Inline interwiki link
6724 !! options
6725 parsoid=wt2html,wt2wt,html2html
6726 !! wikitext
6727 [[MeatBall:SoftSecurity]]
6728 !! html/php
6729 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6730 </p>
6731 !! html/parsoid
6732 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6733 !! end
6735 !! test
6736 Inline interwiki link with empty title (bug 2372)
6737 !! options
6738 parsoid=wt2html,wt2wt,html2html
6739 !! wikitext
6740 [[MeatBall:]]
6741 !! html/php
6742 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6743 </p>
6744 !! html/parsoid
6745 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6746 !! end
6748 !! test
6749 Interwiki link encoding conversion (bug 1636)
6750 !! wikitext
6751 *[[Wikipedia:ro:Olteni&#0355;a]]
6752 *[[Wikipedia:ro:Olteni&#355;a]]
6753 !! html
6754 <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>
6755 <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>
6757 !! html+tidy
6758 <ul>
6759 <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>
6760 <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>
6761 </ul>
6762 !! end
6764 !! test
6765 Interwiki link with fragment (bug 2130)
6766 !! wikitext
6767 [[MeatBall:SoftSecurity#foo]]
6768 !! html
6769 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6770 </p>
6771 !! end
6773 # Ideally the wikipedia: prefix here should be proto-relative too
6774 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6775 # define the 'en' prefix, and originally the test used 'wikipedia',
6776 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6777 # article.
6778 !! test
6779 Different interwiki prefixes mapping to the same URL
6780 !! wikitext
6781 [[:en:Foo]]
6783 [[:en:Foo|Foo]]
6785 [[wikipedia:Foo]]
6787 [[:wikipedia:Foo|Foo]]
6789 [[wikipedia:en:Foo]]
6791 [[:wikipedia:en:Foo]]
6793 [[  wikiPEdia :Foo]]
6794 !! html/parsoid
6795 <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>
6797 <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>
6799 <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>
6801 <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>
6803 <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>
6805 <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>
6807 <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>
6808 !! end
6810 !! test
6811 Interwiki links that cannot be represented in wiki syntax
6812 !! wikitext
6813 [[meatball:ok]]
6814 [[meatball:ok#foo|ok with fragment]]
6815 [[meatball:ok_as_well?|ok ending with ? mark]]
6816 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6817 [http://de.wikipedia.org/wiki/#foo is just fragment]
6819 !! html/php
6820 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
6821 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
6822 <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>
6823 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6824 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
6825 </p>
6826 !! html/parsoid
6827 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
6828 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
6829 <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>
6830 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6831 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6832 !! end
6834 !! test
6835 Interwiki links: trail
6836 !! wikitext
6837 [[wikipedia:Foo|Ba]]r
6838 !! html/php
6839 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
6840 </p>
6841 !! html/parsoid
6842 <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>
6843 !! end
6845 !! test
6846 Local interwiki link
6847 !! options
6848 parsoid=wt2html,wt2wt,html2html
6849 !! wikitext
6850 [[local:Template:Foo]]
6851 !! html/php
6852 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6853 </p>
6854 !! html/parsoid
6855 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
6856 !! end
6858 # Parsoid does not mark self-links, by design.
6859 !! test
6860 Local interwiki link: self-link to current page
6861 !! options
6862 title=[[Main Page]]
6863 parsoid=wt2html,wt2wt,html2html
6864 !! wikitext
6865 [[local:Main Page]]
6866 !! html/php
6867 <p><strong class="selflink">local:Main Page</strong>
6868 </p>
6869 !! html/parsoid
6870 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
6871 !! end
6873 !! test
6874 Local interwiki link: prefix only (bug 64167)
6875 !! options
6876 parsoid=wt2html,wt2wt,html2html
6877 !! wikitext
6878 [[local:]]
6879 !! html/php
6880 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6881 </p>
6882 !! html/parsoid
6883 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
6884 !! end
6886 !! test
6887 Local interwiki link: with additional interwiki prefix (bug 61357)
6888 !! options
6889 parsoid=wt2html,wt2wt,html2html
6890 !! wikitext
6891 [[local:meatball:Hello]]
6892 !! html/php
6893 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6894 </p>
6895 !! html/parsoid
6896 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
6897 !! end
6899 !! test
6900 Multiple local interwiki link prefixes
6901 !! wikitext
6902 [[local:local:local:local:mi:local:Foo]]
6903 !! options
6904 parsoid=wt2html,wt2wt,html2html
6905 !! html/php
6906 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
6907 </p>
6908 !! html/parsoid
6909 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
6910 !! end
6913 ### Interlanguage links
6914 ### Language links (so that searching for '### language' matches..)
6917 !! test
6918 Interlanguage link
6919 !! wikitext
6920 Blah blah blah
6921 [[zh:Chinese]]
6922 !! html/php
6923 <p>Blah blah blah
6924 </p>
6925 !! html/parsoid
6926 <p>Blah blah blah</p>
6927 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6928 !! end
6930 !! test
6931 Interlanguage link with spacing
6932 !! options
6933 parsoid=wt2html,wt2wt,html2html
6934 !! wikitext
6935 Blah blah blah
6936 [[   zh  :    Chinese     ]]
6937 !! html/php
6938 <p>Blah blah blah
6939 </p>
6940 !! html/parsoid
6941 <p>Blah blah blah</p>
6942 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6943 !! end
6945 !! test
6946 Double interlanguage link
6947 !! wikitext
6948 Blah blah blah
6949 [[es:Spanish]]
6950 [[zh:Chinese]]
6951 !! html/php
6952 <p>Blah blah blah
6953 </p>
6954 !! html/parsoid
6955 <p>Blah blah blah</p>
6956 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
6957 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6958 !! end
6960 !! test
6961 Interlanguage link variations
6962 !! wikitext
6963 Blah blah blah
6964 [[   es :Spanish]]
6965 [[ ZH :Chinese]]
6966 !! html/php
6967 <p>Blah blah blah
6968 </p>
6969 !! html/parsoid
6970 <p>Blah blah blah</p>
6971 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" data-parsoid='{"stx":"simple","a":{"href":"http://es.wikipedia.org/wiki/Spanish"},"sa":{"href":"   es :Spanish"}}'/>
6972 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" data-parsoid='{"stx":"simple","a":{"href":"http://zh.wikipedia.org/wiki/Chinese"},"sa":{"href":" ZH :Chinese"}}'/>
6973 !! end
6975 !! test
6976 Interlanguage link, with prefix links
6977 !! options
6978 language=ln
6979 !! wikitext
6980 Blah blah blah
6981 [[zh:Chinese]]
6982 !! html/php
6983 <p>Blah blah blah
6984 </p>
6985 !! html/parsoid
6986 <p>Blah blah blah</p>
6987 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
6988 !! end
6990 !! test
6991 Double interlanguage link, with prefix links (bug 8897)
6992 !! options
6993 language=ln
6994 !! wikitext
6995 Blah blah blah
6996 [[es:Spanish]]
6997 [[zh:Chinese]]
6998 !! html/php
6999 <p>Blah blah blah
7000 </p>
7001 !! html/parsoid
7002 <p>Blah blah blah</p>
7003 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7004 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7005 !! end
7007 !! test
7008 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7009 !! wikitext
7010 Blah blah blah
7011 [[mul:Article]]
7012 !! html/php
7013 <p>Blah blah blah
7014 </p>
7015 !! html/parsoid
7016 <p>Blah blah blah</p>
7017 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7018 !! end
7020 !! test
7021 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7022 !! options
7023 language=ln
7024 !! wikitext
7025 [[WW&nbsp;II]]
7026 !! html
7027 <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>
7028 </p>
7029 !! end
7031 !! test
7032 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7033 !! options
7034 parsoid=html2wt
7035 !! wikitext
7036 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7038 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7039 !! html
7040 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7041 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7042 !! end
7044 !! test
7045 Parsoid: handle constructor well
7046 !! wikitext
7047 [[constructor]]
7049 [[constructor:foo]]
7050 !! html/php
7051 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7052 </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>
7053 </p>
7054 !! html/parsoid
7055 <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>
7057 <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>
7058 !! end
7060 !! article
7062 !! text
7063 Test.
7064 !! endarticle
7066 # Note that `ko` isn't a known interlanguage prefix
7067 !! test
7068 Parsoid: recognize interlanguage links without a target page
7069 !! options
7071 !! wikitext
7072 [[es:]]
7074 [[ko:]]
7075 !! html/php
7077 !! html/parsoid
7078 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7080 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7081 !! end
7083 # Note that `ko` isn't a known interwiki prefix
7084 !! test
7085 Parsoid: recognize interwiki links without a target page
7086 !! options
7087 parsoid=wt2html,wt2wt,html2html
7088 !! wikitext
7089 [[:es:]]
7091 [[:ko:]]
7092 !! html/php
7093 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7094 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7095 </p>
7096 !! html/parsoid
7097 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7098 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7099 !! end
7101 !! test
7102 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7103 !! wikitext
7104 [[mi:Foo]]
7105 !! html/php
7106 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7107 </p>
7108 !! html/parsoid
7109 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7110 !! end
7112 !! test
7113 Interlanguage link with preceding local interwiki link (bug 68085)
7114 !! options
7115 parsoid=wt2html,wt2wt,html2html
7116 !! wikitext
7117 Blah blah blah
7118 [[local:es:Spanish]]
7119 !! html/php
7120 <p>Blah blah blah
7121 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7122 </p>
7123 !! html/parsoid
7124 <p>Blah blah blah
7125 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7126 !! end
7128 !! test
7129 Looks like an interlanguage link, but is actually a local interwiki
7130 !! options
7131 parsoid=wt2html,wt2wt,html2html
7132 !! wikitext
7133 Blah blah blah
7134 [[mi:Template:Foo]]
7135 !! html/php
7136 <p>Blah blah blah
7137 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7138 </p>
7139 !! html/parsoid
7140 <p>Blah blah blah
7141 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7142 !! end
7145 ### Redirects, Parsoid-only
7147 !! test
7148 1. Simple redirect to page
7149 !! options
7150 parsoid
7151 !! wikitext
7152 #REDIRECT [[Main Page]]
7153 !! html
7154 <link rel="mw:PageProp/redirect" href="./Main_Page">
7155 !! end
7157 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7158 !! test
7159 2. Other redirect variants
7160 !! options
7161 parsoid=wt2html,wt2wt
7162 !! wikitext
7163 #REDIRECT [[Main_Page]]
7164 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7165 !! html/parsoid
7166 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7167 !! end
7169 !! test
7170 Empty redirect
7171 !! options
7172 parsoid=wt2html,wt2wt
7173 !! wikitext
7174 #REDIRECT [[]]
7175 !! html
7176 <ol>
7177 <li>REDIRECT [[]]</li></ol>
7178 !! end
7180 !! test
7181 Optional colon in #REDIRECT
7182 !! options
7183 # the colon is archaic syntax.  we support it for wt2html, but we
7184 # don't care that it roundtrips back to the modern syntax.
7185 parsoid=wt2html,html2html
7186 !! wikitext
7187 #REDIRECT:[[Main Page]]
7188 !! html
7189 <link rel="mw:PageProp/redirect" href="./Main_Page">
7190 !! end
7192 !! test
7193 Whitespace in #REDIRECT with optional colon
7194 !! options
7195 # the colon and gratuitous whitespace is archaic syntax.  we support
7196 # it for wt2html, but we don't care that it roundtrips back to the
7197 # modern syntax (without extra whitespace)
7198 parsoid=wt2html,html2html
7199 !! wikitext
7201  #REDIRECT 
7203 [[Main Page]]
7204 !! html
7205 <link rel="mw:PageProp/redirect" href="./Main_Page">
7206 !! end
7208 !! test
7209 Piped link in #REDIRECT
7210 !! options
7211 # content after piped link is ignored.  we support this syntax,
7212 # but don't care that the piped link is lost when we roundtrip this.
7213 parsoid=wt2html
7214 !! wikitext
7215 #REDIRECT [[Main Page|bar]]
7216 !! html
7217 <link rel="mw:PageProp/redirect" href="./Main_Page">
7218 !! end
7220 !! test
7221 Redirect to category
7222 !! options
7223 parsoid=wt2html
7224 !! wikitext
7225 #REDIRECT [[Category:Foo]]
7226 !! html
7227 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7228 !! end
7230 !! test
7231 Redirect to category with URL encoding
7232 !! options
7233 parsoid=wt2html
7234 !! wikitext
7235 #REDIRECT [[Category%3AFoo]]
7236 !! html
7237 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7238 !! end
7240 !! test
7241 Redirect to category page
7242 !! options
7243 parsoid=wt2html,html2html
7244 !! wikitext
7245 #REDIRECT [[:Category:Foo]]
7246 !! html
7247 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7248 !! end
7250 !! test
7251 Redirect to image page (1)
7252 !! options
7253 parsoid
7254 !! wikitext
7255 #REDIRECT [[File:Wiki.png]]
7256 !! html
7257 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7258 !! end
7260 !! test
7261 Redirect to image page (2)
7262 !! options
7263 parsoid
7264 !! wikitext
7265 #REDIRECT [[Image:Wiki.png]]
7266 !! html
7267 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7268 !! end
7270 !! test
7271 Redirect to language
7272 !! options
7273 parsoid
7274 !! wikitext
7275 #REDIRECT [[en:File:Wiki.png]]
7276 !! html
7277 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7278 !! end
7280 !! test
7281 Redirect to interwiki
7282 !! options
7283 parsoid
7284 !! wikitext
7285 #REDIRECT [[meatball:File:Wiki.png]]
7286 !! html
7287 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7288 !! end
7290 !! test
7291 Non-English #REDIRECT
7292 !! options
7293 parsoid
7294 language=is
7295 !! wikitext
7296 #TILVÍSUN [[Main Page]]
7297 !! html
7298 <link rel="mw:PageProp/redirect" href="./Main_Page">
7299 !! end
7301 !! test
7302 New redirect
7303 !! options
7304 parsoid=html2wt
7305 !! wikitext
7307 #REDIRECT [[Foo]]
7308 !! html
7309 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7310 !! end
7313 ## XHTML tidiness
7316 !! test
7317 <br> to <br />
7318 !! wikitext
7319 1<br>2<br />3
7320 !! html
7321 <p>1<br />2<br />3
7322 </p>
7323 !! end
7325 !! test
7326 Broken br tag sanitization
7327 !! wikitext
7328 </br>
7329 !! html/php
7330 <p>&lt;/br&gt;
7331 </p>
7332 !! end
7334 # TODO: Fix html2html mode (bug 51055)!
7335 # This </br> handling was added as part of bug 50831; but it
7336 # differs from how PHP+tidy handles this.  We should investigate
7337 # this.
7338 !! test
7339 Parsoid: Broken br tag recognition
7340 !! options
7341 parsoid=wt2html
7342 !! wikitext
7343 </br>
7345 <br/ >
7346 !! html/php+tidy
7347 <p>&lt;/br&gt;</p>
7348 <p><br /></p>
7349 !! html/parsoid
7350 <p><br></p>
7351 <p><br/></p>
7352 !! end
7354 !! test
7355 Incorrecly removing closing slashes from correctly formed XHTML
7356 !! wikitext
7357 <br style="clear:both;" />
7358 !! html
7359 <p><br style="clear:both;" />
7360 </p>
7361 !! end
7363 !! test
7364 Failing to transform badly formed HTML into correct XHTML
7365 !! wikitext
7366 <br style="clear: left;">
7367 <br style="clear: right;">
7368 <br style="clear: both;">
7369 !! html
7370 <p><br style="clear: left;" />
7371 <br style="clear: right;" />
7372 <br style="clear: both;" />
7373 </p>
7374 !!end
7376 !! test
7377 Handling html with a div self-closing tag
7378 !! wikitext
7379 <div title />
7380 <div title/>
7381 <div title/ >
7382 <div title=bar />
7383 <div title=bar/>
7384 <div title=bar/ >
7385 !! html
7386 <p>&lt;div title /&gt;
7387 &lt;div title/&gt;
7388 </p>
7389 <div>
7390 <p>&lt;div title=bar /&gt;
7391 &lt;div title=bar/&gt;
7392 </p>
7393 <div title="bar/"></div>
7394 </div>
7396 !! end
7398 !! test
7399 Handling html with a br self-closing tag
7400 !! wikitext
7401 <br title />
7402 <br title/>
7403 <br title/ >
7404 <br title=bar />
7405 <br title=bar/>
7406 <br title=bar/ >
7407 !! html/php
7408 <p><br title="title" />
7409 <br title="title" />
7410 <br />
7411 <br title="bar" />
7412 <br title="bar" />
7413 <br title="bar/" />
7414 </p>
7415 !! html/parsoid
7416 <p><br title="" />
7417 <br title="" />
7418 <br />
7419 <br title="bar" />
7420 <br title="bar" />
7421 <br title="bar/" />
7422 </p>
7423 !! end
7425 !! test
7426 Horizontal ruler (should it add that extra space?)
7427 !! wikitext
7428 <hr>
7429 <hr >
7430 foo <hr
7431 > bar
7432 !! html+tidy
7433 <hr />
7434 <hr />
7435 <p>foo</p>
7436 <hr />
7437 <p>bar</p>
7438 !! end
7440 !! test
7441 Horizontal ruler -- 4+ dashes render hr
7442 !! wikitext
7443 ----
7444 !! html
7445 <hr />
7447 !! end
7449 !! test
7450 Horizontal ruler -- eats additional dashes on the same line
7451 !! wikitext
7452 ---------
7453 !! html
7454 <hr />
7456 !! end
7458 !! test
7459 Horizontal ruler -- does not collapse dashes on consecutive lines
7460 !! wikitext
7461 ----
7462 ----
7463 !! html
7464 <hr />
7465 <hr />
7467 !! end
7469 !! test
7470 Horizontal ruler -- <4 dashes render as plain text
7471 !! wikitext
7473 !! html
7474 <p>---
7475 </p>
7476 !! end
7478 !! test
7479 Horizontal ruler -- Supports content following dashes on same line
7480 !! wikitext
7481 ---- Foo
7482 !! html
7483 <hr /> Foo
7485 !! html+tidy
7486 <hr />
7487 <p>Foo</p>
7488 !! end
7491 ### Block-level elements
7493 !! test
7494 Common list
7495 !! wikitext
7496 *Common list
7497 * item 2
7498 *item 3
7499 !! html
7500 <ul><li>Common list</li>
7501 <li> item 2</li>
7502 <li>item 3</li></ul>
7504 !! end
7506 !! test
7507 Numbered list
7508 !! wikitext
7509 #Numbered list
7510 #item 2
7511 # item 3
7512 !! html
7513 <ol><li>Numbered list</li>
7514 <li>item 2</li>
7515 <li> item 3</li></ol>
7517 !! end
7519 !! test
7520 Mixed list
7521 !! wikitext
7522 *Mixed list
7523 *# with numbers
7524 ** and bullets
7525 *# and numbers
7526 *bullets again
7527 **bullet level 2
7528 ***bullet level 3
7529 ***#Number on level 4
7530 **bullet level 2
7531 **#Number on level 3
7532 **#Number on level 3
7533 *#number level 2
7534 *Level 1
7535 *** Level 3
7536 #** Level 3, but ordered
7537 !! html
7538 <ul><li>Mixed list
7539 <ol><li> with numbers</li></ol>
7540 <ul><li> and bullets</li></ul>
7541 <ol><li> and numbers</li></ol></li>
7542 <li>bullets again
7543 <ul><li>bullet level 2
7544 <ul><li>bullet level 3
7545 <ol><li>Number on level 4</li></ol></li></ul></li>
7546 <li>bullet level 2
7547 <ol><li>Number on level 3</li>
7548 <li>Number on level 3</li></ol></li></ul>
7549 <ol><li>number level 2</li></ol></li>
7550 <li>Level 1
7551 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7552 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7554 !! end
7556 !! test
7557 Nested lists 1
7558 !! wikitext
7559 *foo
7560 **bar
7561 !! html
7562 <ul><li>foo
7563 <ul><li>bar</li></ul></li></ul>
7565 !! end
7567 !! test
7568 Nested lists 2
7569 !! wikitext
7570 **foo
7571 *bar
7572 !! html
7573 <ul><li><ul><li>foo</li></ul></li>
7574 <li>bar</li></ul>
7576 !! end
7578 !! test
7579 Nested lists 3 (first element empty)
7580 !! wikitext
7582 **bar
7583 !! html
7584 <ul><li>
7585 <ul><li>bar</li></ul></li></ul>
7587 !! end
7589 !! test
7590 Nested lists 4 (first element empty)
7591 !! wikitext
7593 *bar
7594 !! html
7595 <ul><li><ul><li></li></ul></li>
7596 <li>bar</li></ul>
7598 !! end
7600 !! test
7601 Nested lists 5 (both elements empty)
7602 !! wikitext
7605 !! html
7606 <ul><li><ul><li></li></ul></li>
7607 <li></li></ul>
7609 !! end
7611 !! test
7612 Nested lists 6 (both elements empty)
7613 !! wikitext
7616 !! html
7617 <ul><li>
7618 <ul><li></li></ul></li></ul>
7620 !! end
7622 !! test
7623 Nested lists 7 (skip initial nesting levels)
7624 !! wikitext
7625 *** foo
7626 !! html
7627 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7629 !! end
7631 !! test
7632 Nested lists 8 (multiple nesting transitions)
7633 !! wikitext
7634 * foo
7635 *** bar
7636 ** baz
7637 * boo
7638 !! html
7639 <ul><li> foo
7640 <ul><li><ul><li> bar</li></ul></li>
7641 <li> baz</li></ul></li>
7642 <li> boo</li></ul>
7644 !! end
7646 !! test
7647 1. Lists with start-of-line-transparent tokens before bullets: Comments
7648 !! wikitext
7649 *foo
7650 *<!--cmt-->bar
7651 <!--cmt-->*baz
7652 !! html
7653 <ul><li>foo</li>
7654 <li>bar</li>
7655 <li>baz</li></ul>
7657 !! end
7659 !! test
7660 2. Lists with start-of-line-transparent tokens before bullets: Template close
7661 !! wikitext
7662 *foo {{echo|bar
7663 }}*baz
7664 !! html
7665 <ul><li>foo bar</li>
7666 <li>baz</li></ul>
7668 !! end
7670 !! test
7671 List items are not parsed correctly following a <pre> block (bug 785)
7672 !! wikitext
7673 * <pre>foo</pre>
7674 * <pre>bar</pre>
7675 * zar
7676 !! html
7677 <ul><li> <pre>foo</pre></li>
7678 <li> <pre>bar</pre></li>
7679 <li> zar</li></ul>
7681 !! end
7683 !! test
7684 List items from template
7685 !! wikitext
7687 {{inner list}}
7688 * item 2
7690 * item 0
7691 {{inner list}}
7692 * item 2
7694 * item 0
7695 * notSOL{{inner list}}
7696 * item 2
7697 !! html
7698 <ul><li> item 1</li>
7699 <li> item 2</li></ul>
7700 <ul><li> item 0</li>
7701 <li> item 1</li>
7702 <li> item 2</li></ul>
7703 <ul><li> item 0</li>
7704 <li> notSOL</li>
7705 <li> item 1</li>
7706 <li> item 2</li></ul>
7708 !! end
7710 !! test
7711 List interrupted by empty line or heading
7712 !! wikitext
7713 * foo
7715 ** bar
7716 == A heading ==
7717 * Another list item
7718 !! html
7719 <ul><li> foo</li></ul>
7720 <ul><li><ul><li> bar</li></ul></li></ul>
7721 <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>
7722 <ul><li> Another list item</li></ul>
7724 !!end
7726 !!test
7727 Multiple list tags generated by templates
7728 !! wikitext
7729 {{echo|<li>}}a
7730 {{echo|<li>}}b
7731 {{echo|<li>}}c
7732 !! html
7733 <li>a
7734 <li>b
7735 <li>c</li>
7736 </li>
7737 </li>
7739 !! html+tidy
7740 <ul>
7741 <li>a</li>
7742 <li>b</li>
7743 <li>c</li>
7744 </ul>
7745 !!end
7747 !!test
7748 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7749 !! wikitext
7751 <!--This line will NOT split the list-->
7753  <!--This line will NOT split the list either-->
7755  <!--foo--> <!----> <!--This line NOT split the list either--> 
7757 !! html
7758 <ul><li>a</li>
7759 <li>b</li>
7760 <li>c</li>
7761 <li>d</li></ul>
7763 !!end
7765 !!test
7766 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7767 !! wikitext
7769 <!--This line will NOT split the list-->        
7771         <!--This line will NOT split the list either-->         
7773         <!--foo--> <!---->      <!--This line NOT split the list
7774         either-->        
7776 !! html
7777 <ul><li>a</li>
7778 <li>b</li>
7779 <li>c</li>
7780 <li>d</li></ul>
7782 !!end
7784 !!test
7785 Test the li-hack
7786 (The PHP parser relies on Tidy for the hack)
7787 !!options
7788 parsoid=wt2html,wt2wt
7789 !! wikitext
7790 * foo
7791 * <li>li-hack
7792 * {{echo|<li>templated li-hack}}
7793 * <!--foo--> <li> unsupported li-hack with preceding comments
7795 <ul>
7796 <li><li>not a li-hack
7797 </li>
7798 </ul>
7799 !! html+tidy
7800 <ul>
7801 <li>foo</li>
7802 <li>li-hack</li>
7803 <li>templated li-hack</li>
7804 <li>unsupported li-hack with preceding comments</li>
7805 </ul>
7806 <ul>
7807 <li>not a li-hack</li>
7808 </ul>
7809 !!end
7811 !! test
7812 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7813 !! options
7814 parsoid
7815 !! wikitext
7816 # foo
7817 ## bar
7818 * foo
7819 ** bar
7820 : foo
7821 :: bar
7822 !! html
7823 <ol>
7824 <li> foo<ol>
7825 <li> bar</li>
7826 </ol></li>
7827 </ol><ul>
7828 <li> foo<ul>
7829 <li> bar</li>
7830 </ul></li>
7831 </ul><dl>
7832 <dd> foo<dl>
7833 <dd> bar</dd>
7834 </dl></dd>
7835 </dl>
7836 !! end
7838 !! test
7839 Parsoid: Test of whitespace serialization with Templated bullets
7840 !! options
7841 parsoid
7842 !! wikitext
7843 * {{bullet}}
7844 !! html
7845 <ul>
7846 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7847 </ul>
7848 !! end
7850 # ------------------------------------------------------------------------
7851 # The next set of tests are about Parsoid's ability to handle badly nested
7852 # tags (parse, minimize scope of fixup, and roundtrip back)
7853 # ------------------------------------------------------------------------
7855 !! test
7856 Unbalanced closing block tags break a list
7857 (php parser relies on Tidy to fix up)
7858 !! wikitext
7859 <div>
7860 *a</div><div>
7861 *b</div>
7862 !! html+tidy
7863 <div>
7864 <ul>
7865 <li>a</li>
7866 </ul>
7867 </div>
7868 <div>
7869 <ul>
7870 <li>b</li>
7871 </ul>
7872 </div>
7873 !! end
7875 # Parsoid fails this test, but it might be tricky to support properly.
7876 # See bug 68395.
7877 !! test
7878 Unbalanced closing non-block tags don't break a list
7879 (php parser relies on Tidy to fix up)
7880 !! wikitext
7881 <span>
7882 *a</span><span>
7883 *b</span>
7884 !! html/php+tidy
7885 <ul>
7886 <li><span>a</span></li>
7887 <li><span>b</span></li>
7888 </ul>
7889 !! html/parsoid
7890 <span>
7891 <ul>
7892 <li>a<span></span>
7893 </li>
7894 <li>b
7895 </li>
7896 </ul>
7897 </span>
7898 !! end
7900 !! test
7901 Unclosed formatting tags that straddle lists are closed and reopened
7902 (php parser relies on Tidy to fix up)
7903 !! options
7904 parsoid=wt2html,wt2wt,html2html
7905 !! wikitext
7906 # <s> a
7907 # b </s>
7908 !! html/php+tidy
7909 <ol>
7910 <li><s>a</s></li>
7911 <li><s>b</s></li>
7912 </ol>
7913 !! html/parsoid
7914 <ol><li> <s> a</s></li>
7915 <li><s> b </s></li></ol>
7916 !! end
7918 # Parsoid fails this test, but it might be tricky to support properly.
7919 # See bug 68395.
7920 !!test
7921 List embedded in a non-block tag
7922 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
7923 !! wikitext
7924 <small>
7925 * foo
7926 </small>
7927 !! html/php+tidy
7928 <ul>
7929 <li><small>foo</small></li>
7930 </ul>
7931 !! html/parsoid
7932 <small>
7933 <ul>
7934 <li> foo</li>
7935 </ul>
7936 </small>
7937 !!end
7939 # This is a bug in the PHP parser + tidy combination.
7940 # (The </tr> tag gets parsed as text and html-escaped by PHP,
7941 # and then fostered out of the table by tidy.)
7942 # We believe the Parsoid output to be correct.
7943 !! test
7944 Table with missing opening <tr> tag
7945 !! options
7946 parsoid=wt2html,wt2wt
7947 !! wikitext
7948 <table>
7949 <td>foo</td>
7950 </tr>
7951 </table>
7952 !! html/php+tidy
7953 <p>&lt;/tr&gt;</p>
7954 <table>
7955 <tr>
7956 <td>foo</td>
7957 </tr>
7958 </table>
7959 !! html/parsoid
7960 <table>
7961 <tr>
7962 <td>foo</td>
7963 </tr>
7964 </table>
7965 !! end
7968 ### Magic Words
7971 # Note that the current date is hard-coded as
7972 #   1970-01-01T00:02:03Z (a Thursday)
7973 # when running parser tests.  The timezone is also fixed to GMT, so
7974 # local date will be identical to current date.
7976 !! test
7977 Magic Word: {{CURRENTDAY}}
7978 !! wikitext
7979 {{CURRENTDAY}}
7980 !! html
7981 <p>1
7982 </p>
7983 !! end
7985 !! test
7986 Magic Word: {{CURRENTDAY2}}
7987 !! wikitext
7988 {{CURRENTDAY2}}
7989 !! html
7990 <p>01
7991 </p>
7992 !! end
7994 !! test
7995 Magic Word: {{CURRENTDAYNAME}}
7996 !! wikitext
7997 {{CURRENTDAYNAME}}
7998 !! html
7999 <p>Thursday
8000 </p>
8001 !! end
8003 !! test
8004 Magic Word: {{CURRENTDOW}}
8005 !! wikitext
8006 {{CURRENTDOW}}
8007 !! html
8008 <p>4
8009 </p>
8010 !! end
8012 !! test
8013 Magic Word: {{CURRENTMONTH}}
8014 !! wikitext
8015 {{CURRENTMONTH}}
8016 !! html
8017 <p>01
8018 </p>
8019 !! end
8021 !! test
8022 Magic Word: {{CURRENTMONTH1}}
8023 !! wikitext
8024 {{CURRENTMONTH1}}
8025 !! html
8026 <p>1
8027 </p>
8028 !! end
8030 !! test
8031 Magic Word: {{CURRENTMONTHABBREV}}
8032 !! wikitext
8033 {{CURRENTMONTHABBREV}}
8034 !! html
8035 <p>Jan
8036 </p>
8037 !! end
8039 !! test
8040 Magic Word: {{CURRENTMONTHNAME}}
8041 !! wikitext
8042 {{CURRENTMONTHNAME}}
8043 !! html
8044 <p>January
8045 </p>
8046 !! end
8048 !! test
8049 Magic Word: {{CURRENTMONTHNAMEGEN}}
8050 !! wikitext
8051 {{CURRENTMONTHNAMEGEN}}
8052 !! html
8053 <p>January
8054 </p>
8055 !! end
8057 !! test
8058 Magic Word: {{CURRENTTIME}}
8059 !! wikitext
8060 {{CURRENTTIME}}
8061 !! html
8062 <p>00:02
8063 </p>
8064 !! end
8066 !! test
8067 Magic Word: {{CURRENTHOUR}}
8068 !! wikitext
8069 {{CURRENTHOUR}}
8070 !! html
8071 <p>00
8072 </p>
8073 !! end
8075 !! test
8076 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8077 !! wikitext
8078 {{CURRENTWEEK}}
8079 !! html
8080 <p>1
8081 </p>
8082 !! end
8084 !! test
8085 Magic Word: {{CURRENTYEAR}}
8086 !! wikitext
8087 {{CURRENTYEAR}}
8088 !! html
8089 <p>1970
8090 </p>
8091 !! end
8093 !! test
8094 Magic Word: {{CURRENTTIMESTAMP}}
8095 !! wikitext
8096 {{CURRENTTIMESTAMP}}
8097 !! html
8098 <p>19700101000203
8099 </p>
8100 !! end
8102 !! test
8103 Magic Words LOCAL (UTC)
8104 !! wikitext
8105 * {{LOCALMONTH}}
8106 * {{LOCALMONTH1}}
8107 * {{LOCALMONTHNAME}}
8108 * {{LOCALMONTHNAMEGEN}}
8109 * {{LOCALMONTHABBREV}}
8110 * {{LOCALDAY}}
8111 * {{LOCALDAY2}}
8112 * {{LOCALDAYNAME}}
8113 * {{LOCALYEAR}}
8114 * {{LOCALTIME}}
8115 * {{LOCALHOUR}}
8116 * {{LOCALWEEK}}
8117 * {{LOCALDOW}}
8118 * {{LOCALTIMESTAMP}}
8119 !! html
8120 <ul><li> 01</li>
8121 <li> 1</li>
8122 <li> January</li>
8123 <li> January</li>
8124 <li> Jan</li>
8125 <li> 1</li>
8126 <li> 01</li>
8127 <li> Thursday</li>
8128 <li> 1970</li>
8129 <li> 00:02</li>
8130 <li> 00</li>
8131 <li> 1</li>
8132 <li> 4</li>
8133 <li> 19700101000203</li></ul>
8135 !! end
8137 !! test
8138 Magic Word: {{FULLPAGENAME}}
8139 !! options
8140 title=[[User:Ævar Arnfjörð Bjarmason]]
8141 !! wikitext
8142 {{FULLPAGENAME}}
8143 !! html
8144 <p>User:Ævar Arnfjörð Bjarmason
8145 </p>
8146 !! end
8148 !! test
8149 Magic Word: {{FULLPAGENAMEE}}
8150 !! options
8151 title=[[User:Ævar Arnfjörð Bjarmason]]
8152 !! wikitext
8153 {{FULLPAGENAMEE}}
8154 !! html
8155 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8156 </p>
8157 !! end
8159 !! test
8160 Magic Word: {{TALKSPACE}}
8161 !! options
8162 title=[[User:Ævar Arnfjörð Bjarmason]]
8163 !! wikitext
8164 {{TALKSPACE}}
8165 !! html
8166 <p>User talk
8167 </p>
8168 !! end
8170 !! test
8171 Magic Word: {{TALKSPACE}}, same namespace
8172 !! options
8173 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8174 !! wikitext
8175 {{TALKSPACE}}
8176 !! html
8177 <p>User talk
8178 </p>
8179 !! end
8181 !! test
8182 Magic Word: {{TALKSPACE}}, main namespace
8183 !! options
8184 title=[[Parser Test]]
8185 !! wikitext
8186 {{TALKSPACE}}
8187 !! html
8188 <p>Talk
8189 </p>
8190 !! end
8192 !! test
8193 Magic Word: {{TALKSPACEE}}
8194 !! options
8195 title=[[User:Ævar Arnfjörð Bjarmason]]
8196 !! wikitext
8197 {{TALKSPACEE}}
8198 !! html
8199 <p>User_talk
8200 </p>
8201 !! end
8203 !! test
8204 Magic Word: {{SUBJECTSPACE}}
8205 !! options
8206 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8207 !! wikitext
8208 {{SUBJECTSPACE}}
8209 !! html
8210 <p>User
8211 </p>
8212 !! end
8214 !! test
8215 Magic Word: {{SUBJECTSPACE}}, same namespace
8216 !! options
8217 title=[[User:Ævar Arnfjörð Bjarmason]]
8218 !! wikitext
8219 {{SUBJECTSPACE}}
8220 !! html
8221 <p>User
8222 </p>
8223 !! end
8225 !! test
8226 Magic Word: {{SUBJECTSPACE}}, main namespace
8227 !! options
8228 title=[[Parser Test]]
8229 !! wikitext
8230 {{SUBJECTSPACE}}
8231 !! html
8233 !! end
8235 !! test
8236 Magic Word: {{SUBJECTSPACEE}}
8237 !! options
8238 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8239 !! wikitext
8240 {{SUBJECTSPACEE}}
8241 !! html
8242 <p>User
8243 </p>
8244 !! end
8246 !! test
8247 Magic Word: {{NAMESPACE}}
8248 !! options
8249 title=[[User:Ævar Arnfjörð Bjarmason]]
8250 !! wikitext
8251 {{NAMESPACE}}
8252 !! html
8253 <p>User
8254 </p>
8255 !! end
8257 !! test
8258 Magic Word: {{NAMESPACEE}}
8259 !! options
8260 title=[[User:Ævar Arnfjörð Bjarmason]]
8261 !! wikitext
8262 {{NAMESPACEE}}
8263 !! html
8264 <p>User
8265 </p>
8266 !! end
8268 !! test
8269 Magic Word: {{NAMESPACENUMBER}}
8270 !! options
8271 title=[[User:Ævar Arnfjörð Bjarmason]]
8272 !! wikitext
8273 {{NAMESPACENUMBER}}
8274 !! html
8275 <p>2
8276 </p>
8277 !! end
8279 !! test
8280 Magic Word: {{SUBPAGENAME}}
8281 !! options
8282 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8283 !! wikitext
8284 {{SUBPAGENAME}}
8285 !! html
8286 <p>sub ö
8287 </p>
8288 !! end
8290 !! test
8291 Magic Word: {{SUBPAGENAMEE}}
8292 !! options
8293 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8294 !! wikitext
8295 {{SUBPAGENAMEE}}
8296 !! html
8297 <p>sub_%C3%B6
8298 </p>
8299 !! end
8301 !! test
8302 Magic Word: {{ROOTPAGENAME}}
8303 !! options
8304 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8305 !! wikitext
8306 {{ROOTPAGENAME}}
8307 !! html
8308 <p>Ævar Arnfjörð Bjarmason
8309 </p>
8310 !! end
8312 !! test
8313 Magic Word: {{ROOTPAGENAMEE}}
8314 !! options
8315 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8316 !! wikitext
8317 {{ROOTPAGENAMEE}}
8318 !! html
8319 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8320 </p>
8321 !! end
8323 !! test
8324 Magic Word: {{BASEPAGENAME}}
8325 !! options
8326 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8327 !! wikitext
8328 {{BASEPAGENAME}}
8329 !! html
8330 <p>Ævar Arnfjörð Bjarmason
8331 </p>
8332 !! end
8334 !! test
8335 Magic Word: {{BASEPAGENAMEE}}
8336 !! options
8337 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8338 !! wikitext
8339 {{BASEPAGENAMEE}}
8340 !! html
8341 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8342 </p>
8343 !! end
8345 !! test
8346 Magic Word: {{TALKPAGENAME}}
8347 !! options
8348 title=[[User:Ævar Arnfjörð Bjarmason]]
8349 !! wikitext
8350 {{TALKPAGENAME}}
8351 !! html
8352 <p>User talk:Ævar Arnfjörð Bjarmason
8353 </p>
8354 !! end
8356 !! test
8357 Magic Word: {{TALKPAGENAMEE}}
8358 !! options
8359 title=[[User:Ævar Arnfjörð Bjarmason]]
8360 !! wikitext
8361 {{TALKPAGENAMEE}}
8362 !! html
8363 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8364 </p>
8365 !! end
8367 !! test
8368 Magic Word: {{SUBJECTPAGENAME}}
8369 !! options
8370 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8371 !! wikitext
8372 {{SUBJECTPAGENAME}}
8373 !! html
8374 <p>User:Ævar Arnfjörð Bjarmason
8375 </p>
8376 !! end
8378 !! test
8379 Magic Word: {{SUBJECTPAGENAMEE}}
8380 !! options
8381 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8382 !! wikitext
8383 {{SUBJECTPAGENAMEE}}
8384 !! html
8385 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8386 </p>
8387 !! end
8389 !! test
8390 Magic Word: {{NUMBEROFFILES}}
8391 !! wikitext
8392 {{NUMBEROFFILES}}
8393 !! html
8394 <p>5
8395 </p>
8396 !! end
8398 !! test
8399 Magic Word: {{PAGENAME}}
8400 !! options
8401 title=[[User:Ævar Arnfjörð Bjarmason]]
8402 !! wikitext
8403 {{PAGENAME}}
8404 !! html
8405 <p>Ævar Arnfjörð Bjarmason
8406 </p>
8407 !! end
8409 !! test
8410 Magic Word: {{PAGENAME}} with metacharacters
8411 !! options
8412 title=[['foo & bar = baz']]
8413 !! wikitext
8414 ''{{PAGENAME}}''
8415 !! html/php
8416 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8417 </p>
8418 !! html+tidy
8419 <p><i>'foo &amp; bar = baz'</i></p>
8420 !! end
8422 !! test
8423 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8424 !! options
8425 title=[[*RFC 1234 http://example.com/]]
8426 !! wikitext
8427 {{PAGENAME}}
8428 !! html/php
8429 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8430 </p>
8431 !! html+tidy
8432 <p>*RFC 1234 http://example.com/</p>
8433 !! end
8435 !! test
8436 Magic Word: {{PAGENAMEE}}
8437 !! options
8438 title=[[User:Ævar Arnfjörð Bjarmason]]
8439 !! wikitext
8440 {{PAGENAMEE}}
8441 !! html
8442 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8443 </p>
8444 !! end
8446 !! test
8447 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8448 !! options
8449 title=[[*RFC 1234 http://example.com/]]
8450 !! wikitext
8451 {{PAGENAMEE}}
8452 !! html/php
8453 <p>&#42;RFC_1234_http&#58;//example.com/
8454 </p>
8455 !! html+tidy
8456 <p>*RFC_1234_http://example.com/</p>
8457 !! end
8459 !! test
8460 Magic Word: {{REVISIONID}}
8461 !! wikitext
8462 {{REVISIONID}}
8463 !! html
8464 <p>1337
8465 </p>
8466 !! end
8468 !! test
8469 Magic Word: {{SCRIPTPATH}}
8470 !! wikitext
8471 {{SCRIPTPATH}}
8472 !! html
8473 <p>/
8474 </p>
8475 !! end
8477 !! test
8478 Magic Word: {{STYLEPATH}}
8479 !! wikitext
8480 {{STYLEPATH}}
8481 !! html
8482 <p>/skins
8483 </p>
8484 !! end
8486 !! test
8487 Magic Word: {{SERVER}}
8488 !! wikitext
8489 {{SERVER}}
8490 !! html
8491 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8492 </p>
8493 !! end
8495 !! test
8496 Magic Word: {{SERVERNAME}}
8497 !! wikitext
8498 {{SERVERNAME}}
8499 !! html
8500 <p>example.org
8501 </p>
8502 !! end
8504 !! test
8505 Magic Word: {{SITENAME}}
8506 !! wikitext
8507 {{SITENAME}}
8508 !! html
8509 <p>MediaWiki
8510 </p>
8511 !! end
8513 !! test
8514 Case-sensitive magic words, when cased differently, should just be template transclusions
8515 !! wikitext
8516 {{CurrentMonth}}
8517 {{currentday}}
8518 {{cURreNTweEK}}
8519 {{currentHour}}
8520 !! html
8521 <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>
8522 <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>
8523 <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>
8524 <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>
8525 </p>
8526 !! end
8528 !! test
8529 Case-insensitive magic words should still work with weird casing.
8530 !! wikitext
8531 {{sErVeRNaMe}}
8532 {{LCFirst:AOEU}}
8533 {{ucFIRST:aoeu}}
8534 {{SERver}}
8535 !! html
8536 <p>example.org
8537 aOEU
8538 Aoeu
8539 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8540 </p>
8541 !! end
8543 !! test
8544 Namespace 1 {{ns:1}}
8545 !! wikitext
8546 {{ns:1}}
8547 !! html
8548 <p>Talk
8549 </p>
8550 !! end
8552 !! test
8553 Namespace 1 {{ns:01}}
8554 !! wikitext
8555 {{ns:01}}
8556 !! html
8557 <p>Talk
8558 </p>
8559 !! end
8561 !! test
8562 Namespace 0 {{ns:0}} (bug 4783)
8563 !! wikitext
8564 {{ns:0}}
8565 !! html
8567 !! end
8569 !! test
8570 Namespace 0 {{ns:00}} (bug 4783)
8571 !! wikitext
8572 {{ns:00}}
8573 !! html
8575 !! end
8577 !! test
8578 Namespace -1 {{ns:-1}}
8579 !! wikitext
8580 {{ns:-1}}
8581 !! html
8582 <p>Special
8583 </p>
8584 !! end
8586 !! test
8587 Namespace User {{ns:User}}
8588 !! wikitext
8589 {{ns:User}}
8590 !! html
8591 <p>User
8592 </p>
8593 !! end
8595 !! test
8596 Namespace User talk {{ns:User_talk}}
8597 !! wikitext
8598 {{ns:User_talk}}
8599 !! html
8600 <p>User talk
8601 </p>
8602 !! end
8604 !! test
8605 Namespace User talk {{ns:uSeR tAlK}}
8606 !! wikitext
8607 {{ns:uSeR tAlK}}
8608 !! html
8609 <p>User talk
8610 </p>
8611 !! end
8613 !! test
8614 Namespace File {{ns:File}}
8615 !! wikitext
8616 {{ns:File}}
8617 !! html
8618 <p>File
8619 </p>
8620 !! end
8622 !! test
8623 Namespace File {{ns:Image}}
8624 !! wikitext
8625 {{ns:Image}}
8626 !! html
8627 <p>File
8628 </p>
8629 !! end
8631 !! test
8632 Namespace (lang=de) Benutzer {{ns:User}}
8633 !! options
8634 language=de
8635 !! wikitext
8636 {{ns:User}}
8637 !! html
8638 <p>Benutzer
8639 </p>
8640 !! end
8642 !! test
8643 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8644 !! options
8645 language=de
8646 !! wikitext
8647 {{ns:3}}
8648 !! html
8649 <p>Benutzer Diskussion
8650 </p>
8651 !! end
8654 !! test
8655 Urlencode
8656 !! wikitext
8657 {{urlencode:hi world?!}}
8658 {{urlencode:hi world?!|WIKI}}
8659 {{urlencode:hi world?!|PATH}}
8660 {{urlencode:hi world?!|QUERY}}
8661 !! html
8662 <p>hi+world%3F%21
8663 hi_world%3F!
8664 hi%20world%3F%21
8665 hi+world%3F%21
8666 </p>
8667 !! end
8669 !! test
8670 Magic Word: prioritize type info over data-parsoid
8671 !! options
8672 parsoid=html2wt
8673 !! wikitext
8674 __FORCETOC__
8675 !! html
8676 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8677 !! end
8679 !! test
8680 Magic Word: serialize on separate line (parsoid)
8681 !! options
8682 parsoid=wt2wt,html2wt
8683 !! wikitext
8685 __NOTOC__
8687 !! html
8688 foo<meta property="mw:PageProp/notoc"/>bar
8689 !! end
8691 !! test
8692 Magic Word: rt non-english wikis
8693 !! options
8694 parsoid=wt2wt
8695 language=de
8696 !! wikitext
8697 __NOEDITSECTION__
8698 !! html
8699 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8700 !! end
8703 ### Magic links
8705 !! test
8706 Magic links: internal link to RFC (bug 479)
8707 !! wikitext
8708 [[RFC 123]]
8709 !! html
8710 <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>
8711 </p>
8712 !! end
8714 !! test
8715 Magic links: RFC (bug 479)
8716 !! wikitext
8717 RFC 822
8718 !! html
8719 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8720 </p>
8721 !! end
8723 !! test
8724 Magic links: ISBN (bug 1937)
8725 !! wikitext
8726 ISBN 0-306-40615-2
8727 !! html
8728 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8729 </p>
8730 !! end
8732 !! test
8733 Magic links: PMID incorrectly converts space to underscore
8734 !! wikitext
8735 PMID 1234
8736 !! html
8737 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8738 </p>
8739 !! end
8742 ### Templates
8743 ####
8745 !! test
8746 Nonexistent template
8747 !! wikitext
8748 {{thistemplatedoesnotexist}}
8749 !! html
8750 <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>
8751 </p>
8752 !! end
8754 !! test
8755 Template with invalid target containing tags
8756 !! wikitext
8757 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8758 !! html
8759 <p>{{a<b>b</b>|foo|a=b|a = b}}
8760 </p>
8761 !! end
8763 !! test
8764 Template with invalid target containing unclosed tag
8765 !! wikitext
8766 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8767 !! html
8768 <p>{{a<b>|foo|a=b|a = b}}</b>
8769 </p>
8770 !! end
8772 !! test
8773 Template with invalid target containing wikilink
8774 !! wikitext
8775 {{[[Main Page]]}}
8776 !! html/php
8777 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8778 </p>
8779 !! html/parsoid
8780 <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>
8781 !! end
8783 !! test
8784 Template with just whitespace in it, bug #68421
8785 !! wikitext
8786 {{echo|{{ }}}}
8787 !! html/parsoid
8788 <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>
8789 !! end
8791 !! article
8792 Template:test
8793 !! text
8794 This is a test template
8795 !! endarticle
8797 !! test
8798 Simple template
8799 !! wikitext
8800 {{test}}
8801 !! html
8802 <p>This is a test template
8803 </p>
8804 !! end
8806 !! test
8807 Template with explicit namespace
8808 !! wikitext
8809 {{Template:test}}
8810 !! html
8811 <p>This is a test template
8812 </p>
8813 !! end
8816 !! article
8817 Template:paramtest
8818 !! text
8819 This is a test template with parameter {{{param}}}
8820 !! endarticle
8822 !! test
8823 Template parameter
8824 !! wikitext
8825 {{paramtest|param=foo}}
8826 !! html
8827 <p>This is a test template with parameter foo
8828 </p>
8829 !! end
8831 !! article
8832 Template:paramtestnum
8833 !! text
8834 [[{{{1}}}|{{{2}}}]]
8835 !! endarticle
8837 !! test
8838 Template unnamed parameter
8839 !! wikitext
8840 {{paramtestnum|Main Page|the main page}}
8841 !! html
8842 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8843 </p>
8844 !! end
8846 !! article
8847 Template:templatesimple
8848 !! text
8849 (test)
8850 !! endarticle
8852 !! article
8853 Template:templateredirect
8854 !! text
8855 #redirect [[Template:templatesimple]]
8856 !! endarticle
8858 !! article
8859 Template:templateasargtestnum
8860 !! text
8861 {{{{{1}}}}}
8862 !! endarticle
8864 !! article
8865 Template:templateasargtest
8866 !! text
8867 {{template{{{templ}}}}}
8868 !! endarticle
8870 !! article
8871 Template:templateasargtest2
8872 !! text
8873 {{{{{templ}}}}}
8874 !! endarticle
8876 !! test
8877 Template with template name as unnamed argument
8878 !! wikitext
8879 {{templateasargtestnum|templatesimple}}
8880 !! html
8881 <p>(test)
8882 </p>
8883 !! end
8885 !! test
8886 Template with template name as argument
8887 !! wikitext
8888 {{templateasargtest|templ=simple}}
8889 !! html
8890 <p>(test)
8891 </p>
8892 !! end
8894 !! test
8895 Template with template name as argument (2)
8896 !! wikitext
8897 {{templateasargtest2|templ=templatesimple}}
8898 !! html
8899 <p>(test)
8900 </p>
8901 !! end
8903 !! article
8904 Template:templateasargtestdefault
8905 !! text
8906 {{{{{templ|templatesimple}}}}}
8907 !! endarticle
8909 !! article
8910 Template:templa
8911 !! text
8912 '''templ'''
8913 !! endarticle
8915 !! test
8916 Template with default value
8917 !! wikitext
8918 {{templateasargtestdefault}}
8919 !! html
8920 <p>(test)
8921 </p>
8922 !! end
8924 !! test
8925 Template with default value (value set)
8926 !! wikitext
8927 {{templateasargtestdefault|templ=templa}}
8928 !! html
8929 <p><b>templ</b>
8930 </p>
8931 !! end
8933 !! test
8934 Template redirect
8935 !! wikitext
8936 {{templateredirect}}
8937 !! html
8938 <p>(test)
8939 </p>
8940 !! end
8942 !! test
8943 Template with argument in separate line
8944 !! wikitext
8945 {{ templateasargtest  |
8946  templ = simple }}
8947 !! html
8948 <p>(test)
8949 </p>
8950 !! end
8952 !! test
8953 Template with complex template as argument
8954 !! wikitext
8955 {{paramtest|
8956   param ={{ templateasargtest  |
8957  templ = simple }}}}
8958 !! html
8959 <p>This is a test template with parameter (test)
8960 </p>
8961 !! end
8963 !! test
8964 Template with thumb image (with link in description)
8965 !! wikitext
8966 {{paramtest|
8967   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8968 !! html/php
8969 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>
8971 !! html+tidy
8972 <p>This is a test template with parameter</p>
8973 <div class="thumb tright">
8974 <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>
8975 <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>
8976 </div>
8977 </div>
8978 !! end
8980 !! article
8981 Template:complextemplate
8982 !! text
8983 {{{1}}} {{paramtest|
8984   param ={{{param}}}}}
8985 !! endarticle
8987 !! test
8988 Template with complex arguments
8989 !! wikitext
8990 {{complextemplate|
8991   param ={{ templateasargtest  |
8992  templ = simple }}|[[Template:complextemplate|link]]}}
8993 !! html
8994 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8995 </p>
8996 !! end
8998 !! test
8999 BUG 553: link with two variables in a piped link
9000 !! wikitext
9002 |[[{{{1}}}|{{{2}}}]]
9004 !! html
9005 <table>
9006 <tr>
9007 <td>[[{{{1}}}|{{{2}}}]]
9008 </td></tr></table>
9010 !! end
9012 !! test
9013 Magic variable as template parameter
9014 !! wikitext
9015 {{paramtest|param={{SITENAME}}}}
9016 !! html
9017 <p>This is a test template with parameter MediaWiki
9018 </p>
9019 !! end
9021 !! article
9022 Template:linktest
9023 !! text
9024 [[{{{param}}}|link]]
9025 !! endarticle
9027 !! test
9028 Template parameter as link source
9029 !! wikitext
9030 {{linktest|param=Main Page}}
9031 !! html
9032 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9033 </p>
9034 !! end
9036 !!test
9037 Template-generated attribute string (k='v')
9038 !! wikitext
9039 <span {{attr_str|id|v1}}>bar</span>
9040 !! html
9041 <p><span id="v1">bar</span>
9042 </p>
9043 !!end
9045 !!article
9046 Template:paramtest2
9047 !! text
9048 including another template, {{paramtest|param={{{arg}}}}}
9049 !! endarticle
9051 !! test
9052 Template passing argument to another template
9053 !! wikitext
9054 {{paramtest2|arg='hmm'}}
9055 !! html
9056 <p>including another template, This is a test template with parameter 'hmm'
9057 </p>
9058 !! end
9060 !! article
9061 Template:Linktest2
9062 !! text
9063 Main Page
9064 !! endarticle
9066 !! test
9067 Template as link source
9068 !! wikitext
9069 [[{{linktest2}}]]
9071 [[{{linktest2}}|Main Page]]
9073 [[{{linktest2}}]]Page
9074 !! html
9075 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9076 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9077 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9078 </p>
9079 !! end
9082 !! article
9083 Template:loop1
9084 !! text
9085 {{loop2}}
9086 !! endarticle
9088 !! article
9089 Template:loop2
9090 !! text
9091 {{loop1}}
9092 !! endarticle
9094 !! test
9095 Template infinite loop
9096 !! wikitext
9097 {{loop1}}
9098 !! html
9099 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9100 </p>
9101 !! end
9103 !! test
9104 Template from main namespace
9105 !! wikitext
9106 {{:Main Page}}
9107 !! html
9108 <p>blah blah
9109 </p>
9110 !! end
9112 !! article
9113 Template:table
9114 !! text
9116 | 1 || 2
9118 | 3 || 4
9120 !! endarticle
9122 !! test
9123 BUG 529: Template with table, not included at beginning of line
9124 !! wikitext
9125 foo {{table}}
9126 !! html
9127 <p>foo 
9128 </p>
9129 <table>
9130 <tr>
9131 <td> 1 </td>
9132 <td> 2
9133 </td></tr>
9134 <tr>
9135 <td> 3 </td>
9136 <td> 4
9137 </td></tr></table>
9139 !! end
9141 !! test
9142 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9143 !! wikitext
9145 {{table}}
9146 !! html
9147 <p>foo
9148 </p>
9149 <table>
9150 <tr>
9151 <td> 1 </td>
9152 <td> 2
9153 </td></tr>
9154 <tr>
9155 <td> 3 </td>
9156 <td> 4
9157 </td></tr></table>
9159 !! end
9161 !! test
9162 BUG 41: Template parameters shown as broken links
9163 !! wikitext
9164 {{{parameter}}}
9165 !! html
9166 <p>{{{parameter}}}
9167 </p>
9168 !! end
9170 !! test
9171 Template with targets containing wikilinks
9172 !! wikitext
9173 {{[[foo]]}}
9175 {{[[{{echo|foo}}]]}}
9177 {{{{echo|[[foo}}]]}}
9178 !! html
9179 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9180 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9181 </p><p>{{[[foo}}]]
9182 </p>
9183 !! end
9185 !! article
9186 Template:MSGNW test
9187 !! text
9188 ''None'' of '''this''' should be 
9189 * interpreted
9190  but rather passed unmodified
9191 {{test}}
9192 <gallery>
9193 File:Foobar.jpg
9194 </gallery>
9195 !! endarticle
9197 # hmm, fix this or just deprecate msgnw and document its behavior?
9198 !! test
9199 msgnw keyword
9200 !! wikitext
9201 {{msgnw:MSGNW test}}
9202 !! html
9203 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
9204 &#42; interpreted
9205 &#32;but rather passed unmodified
9206 &#123;&#123;test&#125;&#125;
9207 &#60;gallery&#62;
9208 File:Foobar.jpg
9209 &#60;/gallery&#62;
9210 </p>
9211 !! end
9213 !! test
9214 int keyword
9215 !! wikitext
9216 {{int:youhavenewmessages|lots of money|not!}}
9217 !! html
9218 <p>You have lots of money (not!).
9219 </p>
9220 !! end
9222 !! article
9223 Template:Includes
9224 !! text
9225 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9226 !! endarticle
9228 !! test
9229 <includeonly> and <noinclude> being included
9230 !! wikitext
9231 {{Includes}}
9232 !! html
9233 <p>Foobar
9234 </p>
9235 !! end
9237 !! article
9238 Template:Includes2
9239 !! text
9240 <onlyinclude>Foo</onlyinclude>bar
9241 !! endarticle
9243 !! test
9244 <onlyinclude> being included
9245 !! wikitext
9246 {{Includes2}}
9247 !! html
9248 <p>Foo
9249 </p>
9250 !! end
9253 !! article
9254 Template:Includes3
9255 !! text
9256 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9257 !! endarticle
9259 !! test
9260 <onlyinclude> and <includeonly> being included
9261 !! wikitext
9262 {{Includes3}}
9263 !! html
9264 <p>Foo
9265 </p>
9266 !! end
9268 !! test
9269 <includeonly> and <noinclude> on a page
9270 !! wikitext
9271 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9272 !! html
9273 <p>Foozar
9274 </p>
9275 !! end
9277 !! test
9278 Un-closed <noinclude>
9279 !! wikitext
9280 <noinclude>
9281 !! html
9282 !! end
9284 !! test
9285 <onlyinclude> on a page
9286 !! wikitext
9287 <onlyinclude>Foo</onlyinclude>bar
9288 !! html
9289 <p>Foobar
9290 </p>
9291 !! end
9293 !! test
9294 Un-closed <onlyinclude>
9295 !! wikitext
9296 <onlyinclude>
9297 !! html
9298 !! end
9300 !!test
9301 Self-closed noinclude, includeonly, onlyinclude tags
9302 !! wikitext
9303 <noinclude />
9304 <includeonly />
9305 <onlyinclude />
9306 !! html
9307 <p><br />
9308 </p>
9309 !!end
9311 !!test
9312 Unbalanced includeonly and noinclude tags
9313 !! wikitext
9315 |a</noinclude>
9316 |b</noinclude></noinclude>
9317 |c</noinclude></includeonly>
9318 |d</includeonly></includeonly>
9320 !! html
9321 <table>
9322 <tr>
9323 <td>a
9324 </td>
9325 <td>b
9326 </td>
9327 <td>c&lt;/includeonly&gt;
9328 </td>
9329 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9330 </td></tr></table>
9332 !!end
9334 !! article
9335 Template:Includeonly section
9336 !! text
9337 <includeonly>
9338 ==Includeonly section==
9339 </includeonly>
9340 ==Section T-1==
9341 !!endarticle
9343 !! test
9344 Bug 6563: Edit link generation for section shown by <includeonly>
9345 !! wikitext
9346 {{includeonly section}}
9347 !! html
9348 <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>
9349 <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>
9351 !! end
9353 # Uses same input as the contents of [[Template:Includeonly section]]
9354 !! test
9355 Bug 6563: Section extraction for section shown by <includeonly>
9356 !! options
9357 section=T-2
9358 !! wikitext
9359 <includeonly>
9360 ==Includeonly section==
9361 </includeonly>
9362 ==Section T-2==
9363 !! html
9364 ==Section T-2==
9365 !! end
9367 !! test
9368 Bug 6563: Edit link generation for section suppressed by <includeonly>
9369 !! wikitext
9370 <includeonly>
9371 ==Includeonly section==
9372 </includeonly>
9373 ==Section 1==
9374 !! html
9375 <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>
9377 !! end
9379 !! test
9380 Bug 6563: Section extraction for section suppressed by <includeonly>
9381 !! options
9382 section=1
9383 !! wikitext
9384 <includeonly>
9385 ==Includeonly section==
9386 </includeonly>
9387 ==Section 1==
9388 !! html
9389 ==Section 1==
9390 !! end
9392 !! test
9393 Un-closed <includeonly>
9394 !! wikitext
9395 <includeonly>
9396 !! html
9397 !! end
9399 !! test
9400 Includes and comments at SOL
9401 !! wikitext
9402 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9404 <noinclude>
9405 some
9406 </noinclude>* stuff
9407 * here
9409 <includeonly>can have stuff</includeonly>=== here ===
9411 !! html/php
9412 <h2><span class="mw-headline" id="hu">hu</span></h2>
9413 <p>some
9414 </p>
9415 <ul><li> stuff</li>
9416 <li> here</li></ul>
9417 <h3><span class="mw-headline" id="here">here</span></h3>
9419 !! html/parsoid
9420 <!-- 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>
9422 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9423 <p>some</p>
9424 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9425 <li> here</li></ul>
9427 <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>
9429 !! end
9431 # TODO: test with DOM fragment reuse!
9432 !! test
9433 Parsoid: DOM fragment reuse
9434 !! options
9435 parsoid=wt2wt,wt2html
9436 !! wikitext
9437 a{{echo|b<table></table>c}}d
9439 a{{echo|b
9440 <table></table>
9441 c}}d
9443 {{echo|a
9445 <table></table>
9448 !! html
9449 <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>
9451 <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">
9452 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9453 </span><p about="#mwt2">cd</p>
9455 <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">
9457 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9459 </span><p about="#mwt3">b</p>
9460 !! end
9462 !! test
9463 Parsoid: Merge double tds (bug 50603)
9464 !! options
9465 parsoid
9466 !! wikitext
9468 |{{echo|{{!}} foo}}
9470 !! html
9471 <table><tbody>
9472 <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>
9473 </tbody></table>
9474 !! end
9476 !! test
9477 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9478 !! options
9479 parsoid
9480 !! wikitext
9481 {{echo|<div>}}
9483 |{{echo|{{!}} foo}}
9485 {{echo|</div>}}
9486 !! html
9487 <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}}]}'>
9488 <table><tbody>
9489 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9490 </tbody></table>
9491 </div>
9492 !! end
9495 ### <includeonly> and <noinclude> in attributes
9497 !!test
9498 0. includeonly around the entire attribute
9499 !! wikitext
9500 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9501 !! html
9502 <p><span id="v2">bar</span>
9503 </p>
9504 !!end
9506 !!test
9507 1. includeonly in html attr key
9508 !! wikitext
9509 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9510 !! html
9511 <p><span id="foo">bar</span>
9512 </p>
9513 !!end
9515 !!test
9516 2. includeonly in html attr value
9517 !! wikitext
9518 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9519 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9520 !! html
9521 <p><span id="v1">bar</span>
9522 <span id="v1">bar</span>
9523 </p>
9524 !!end
9526 !!test
9527 3. includeonly in part of an attr value
9528 !! wikitext
9529 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9530 !! html
9531 <p><span style="color:red;">bar</span>
9532 </p>
9533 !!end
9535 !!test
9536 4. includeonly in table attributes
9537 !! wikitext
9539 |- <noinclude>
9542 </noinclude>
9543 |- <includeonly>
9546 </includeonly>
9548 !! html
9549 <table>
9552 <tr>
9553 <td>a
9554 </td></tr>
9555 </table>
9557 !!end
9560 ### Token Stream Patcher tests
9562 ### These tests won't always pass wt2wt and other modes because
9563 ### on serialization, the table will be output on a new line.
9564 ### For now, we are blacklisting them, and using this to test selser.
9567 !!test
9568 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9569 !!options
9570 parsoid=wt2html,wt2wt
9571 !!wikitext
9572 {{echo|}}{| width = '100%'
9573 |foo
9575 !!html/parsoid
9576 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9577 <tbody><tr><td>foo</td></tr>
9578 </tbody></table>
9579 !!end
9581 !!test
9582 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9583 !!options
9584 parsoid=wt2html,wt2wt
9585 !!wikitext
9586 <includeonly>a</includeonly>{| {{{b}}}
9589 !!html/parsoid
9590 <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}}}":""}}'>
9591 <tbody><tr><td>c</td></tr>
9592 </tbody></table>
9594 !!end
9597 ### Testing parsing of templates where a template arg
9598 ### has the same name as the template itself.
9601 !! article
9602 Template:quote
9603 !! text
9604 {{{quote|{{{1}}}}}}
9605 !! endarticle
9607 !!test
9608 Templates: Template Name/Arg clash: 1. Use of positional param
9609 !! wikitext
9610 {{quote|foo}}
9611 !! html
9612 <p>foo
9613 </p>
9614 !!end
9616 !!test
9617 Templates: Template Name/Arg clash: 2. Use of named param
9618 !! wikitext
9619 {{quote|quote=foo}}
9620 !! html
9621 <p>foo
9622 </p>
9623 !!end
9625 !!test
9626 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9627 !! wikitext
9628 {{quote|quote}}
9629 !! html
9630 <p>quote
9631 </p>
9632 !!end
9635 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9638 !!test
9639 Templates: 1. Simple use
9640 !! wikitext
9641 {{echo|Foo}}
9642 !! html
9643 <p>Foo
9644 </p>
9645 !!end
9647 !!test
9648 Templates: 2. Inside a block tag
9649 !! wikitext
9650 <div>{{echo|Foo}}</div>
9651 <blockquote>{{echo|Foo}}</blockquote>
9652 !! html
9653 <div>Foo</div>
9654 <blockquote>Foo</blockquote>
9656 !! html+tidy
9657 <div>Foo</div>
9658 <blockquote>
9659 <p>Foo</p>
9660 </blockquote>
9661 !!end
9663 !!test
9664 Templates: P-wrapping: 1a. Templates on consecutive lines
9665 !! wikitext
9666 {{echo|Foo}}
9667 {{echo|bar}}
9668 !! html
9669 <p>Foo
9671 </p>
9672 !!end
9674 !!test
9675 Templates: P-wrapping: 1b. Templates on consecutive lines
9676 !! wikitext
9679 {{echo|bar}}
9680 {{echo|baz}}
9681 !! html
9682 <p>Foo
9683 </p><p>bar
9685 </p>
9686 !!end
9688 !!test
9689 Templates: P-wrapping: 1c. Templates on consecutive lines
9690 !! wikitext
9691 {{echo|Foo}}
9692 {{echo|bar}} <div>baz</div>
9693 !! html
9694 <p>Foo
9695 </p>
9696 bar <div>baz</div>
9698 !! html+tidy
9699 <p>Foo</p>
9700 <p>bar</p>
9701 <div>baz</div>
9702 !! end
9704 !!test
9705 Templates: P-wrapping: 1d. Template preceded by comment-only line
9706 !!options
9707 parsoid
9708 !! wikitext
9709 <!-- foo -->
9710 {{echo|Bar}}
9711 !! html
9712 <!-- foo -->
9714 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9715 !!end
9717 !!test
9718 Templates: Inline Text: 1. Multiple template uses
9719 !! wikitext
9720 {{echo|Foo}}bar{{echo|baz}}
9721 !! html
9722 <p>Foobarbaz
9723 </p>
9724 !!end
9726 !!test
9727 Templates: Inline Text: 2. Back-to-back template uses
9728 !! wikitext
9729 {{echo|Foo}}{{echo|bar}}
9730 !! html
9731 <p>Foobar
9732 </p>
9733 !!end
9735 !!test
9736 Templates: Block Tags: 1. Multiple template uses
9737 !! wikitext
9738 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9739 !! html
9740 <div>Foo</div><div>bar</div><div>baz</div>
9742 !!end
9744 !!test
9745 Templates: Block Tags: 2. Back-to-back template uses
9746 !! wikitext
9747 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9748 !! html
9749 <div>Foo</div><div>bar</div>
9751 !!end
9753 # This is an edge case relating to paragraph wrapping.
9754 !!test
9755 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9756 !! wikitext
9757 {{echo|a
9758 b</p>}}
9759 !! html/parsoid
9760 <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
9761 b</p>
9762 !!end
9764 !!test
9765 Templates: Links: 1. Simple example
9766 !! wikitext
9767 {{echo|[[Foo|bar]]}}
9768 !! html
9769 <p><a href="/wiki/Foo" title="Foo">bar</a>
9770 </p>
9771 !!end
9773 !!test
9774 Templates: Links: 2. Generation of link href
9775 !! wikitext
9776 [[{{echo|Foo}}|bar]]
9777 !! html
9778 <p><a href="/wiki/Foo" title="Foo">bar</a>
9779 </p>
9780 !!end
9782 !!test
9783 Templates: Links: 3. Generation of part of a link href
9784 !! wikitext
9785 [[Fo{{echo|o}}|bar]]
9787 [[Foo{{echo|bar}}]]
9789 [[Foo{{echo|bar}}baz]]
9791 [[Foo{{echo|bar}}|bar]]
9793 [[:Foo{{echo|bar}}]]
9795 [[:Foo{{echo|bar}}|bar]]
9796 !! html
9797 <p><a href="/wiki/Foo" title="Foo">bar</a>
9798 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9799 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9800 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9801 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9802 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9803 </p>
9804 !!end
9806 !!test
9807 Templates: Links: 4. Multiple templates generating link href
9808 !! wikitext
9809 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9810 !! html
9811 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9812 </p>
9813 !!end
9815 !!test
9816 Templates: Links: 5. Generation of link text
9817 !! wikitext
9818 [[Foo|{{echo|bar}}]]
9819 !! html
9820 <p><a href="/wiki/Foo" title="Foo">bar</a>
9821 </p>
9822 !!end
9824 !!test
9825 Templates: Links: 5. Nested templates (only outermost template should be marked)
9826 !! wikitext
9827 {{echo|[[{{echo|Foo}}|bar]]}}
9828 !! html
9829 <p><a href="/wiki/Foo" title="Foo">bar</a>
9830 </p>
9831 !!end
9833 !!test
9834 Templates: HTML Tag: 1. Generation of HTML attr. key
9835 !! wikitext
9836 <div {{echo|style}}="color:red;">foo</div>
9837 !! html
9838 <div style="color:red;">foo</div>
9840 !!end
9842 !!test
9843 Templates: HTML Tag: 2. Generation of HTML attr. value
9844 !! wikitext
9845 <div style={{echo|'color:red;'}}>foo</div>
9846 !! html
9847 <div style="color:red;">foo</div>
9849 !!end
9851 !!test
9852 Templates: HTML Tag: 3. Generation of HTML attr key and value
9853 !! wikitext
9854 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9855 !! html
9856 <div style="color:red;">foo</div>
9858 !!end
9860 !!test
9861 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9862 !! wikitext
9863 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9864 !! html
9865 <div title="This is a long title with just one piece templated">foo</div>
9867 !!end
9869 !!test
9870 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9871 !! wikitext
9872 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9873 !! html
9874 <div title="This is a long title with just one piece templated">foo</div>
9876 !!end
9878 !!test
9879 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9880 !! wikitext
9881 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9882 !! html
9883 <div title="This is a long title with just one piece templated">foo</div>
9885 !!end
9887 !!test
9888 Templates: HTML Tag: 7. Generation of partial attribute key string
9889 !! wikitext
9890 <div st{{echo|yle}}="color:red;">foo</div>
9891 !! html
9892 <div style="color:red;">foo</div>
9894 !!end
9896 !!test
9897 Templates: HTML Tables: 1. Generating start of a HTML table
9898 !! wikitext
9899 {{echo|<table><tr><td>foo</td>}}</tr></table>
9900 !! html
9901 <table><tr><td>foo</td></tr></table>
9903 !!end
9905 !!test
9906 Templates: HTML Tables: 2a. Generating middle of a HTML table
9907 !! wikitext
9908 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9909 !! html
9910 <table><tr><td>foo</td></tr></table>
9912 !!end
9914 !!test
9915 Templates: HTML Tables: 2b. Generating middle of a HTML table
9916 !! wikitext
9917 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9918 !! html
9919 <table><tr><td>foo</td></tr></table>
9921 !!end
9923 !!test
9924 Templates: HTML Tables: 3. Generating end of a HTML table
9925 !! wikitext
9926 <table><tr>{{echo|<td>foo</td></tr></table>}}
9927 !! html
9928 <table><tr><td>foo</td></tr></table>
9930 !!end
9932 !!test
9933 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9934 !! wikitext
9935 {{echo|<table>}}<tr><td>foo</td></tr></table>
9936 !! html
9937 <table><tr><td>foo</td></tr></table>
9939 !!end
9941 !!test
9942 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9943 !! wikitext
9944 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9945 !! html
9946 <table><tr><td>foo</td></tr></table>
9948 !!end
9950 !!test
9951 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9952 !! wikitext
9953 <table><tr>{{echo|<td>}}foo</td></tr></table>
9954 !! html
9955 <table><tr><td>foo</td></tr></table>
9957 !!end
9959 !!test
9960 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9961 !! wikitext
9962 <table><tr><td>foo{{echo|</td>}}</tr></table>
9963 !! html
9964 <table><tr><td>foo</td></tr></table>
9966 !!end
9968 !!test
9969 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9970 !! wikitext
9971 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9972 !! html
9973 <table><tr><td>foo</td></tr></table>
9975 !!end
9977 !!test
9978 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9979 !! wikitext
9980 <table><tr><td>foo</td></tr>{{echo|</table>}}
9981 !! html
9982 <table><tr><td>foo</td></tr></table>
9984 !!end
9986 !!test
9987 Templates: HTML Tables: 5. Proper fostering of categories from inside
9988 !!options
9989 parsoid=wt2html,wt2wt
9990 !! wikitext
9991 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9992 <!--Two categories (Bug 50330)-->
9993 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9994 !! html
9995 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9996 <!--Two categories (Bug 50330)-->
9997 <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>
9998 !!end
10000 !!test
10001 Templates: Wiki Tables: 1a. Fostering of entire template content
10002 !! wikitext
10004 {{echo|a}}
10006 !! html
10007 <table>
10009 <tr><td></td></tr></table>
10011 !! html+tidy
10012 <p>a</p>
10013 <table>
10014 <tr>
10015 <td></td>
10016 </tr>
10017 </table>
10018 !! end
10020 !!test
10021 Templates: Wiki Tables: 1b. Fostering of entire template content
10022 !! wikitext
10024 {{echo|<div>}}
10026 {{echo|</div>}}
10028 !! html
10029 <table>
10030 <div>
10031 <p>foo
10032 </p>
10033 </div>
10034 <tr><td></td></tr></table>
10036 !! html+tidy
10037 <div>
10038 <p>foo</p>
10039 </div>
10040 <table>
10041 <tr>
10042 <td></td>
10043 </tr>
10044 </table>
10045 !! end
10047 !!test
10048 Templates: Wiki Tables: 2. Fostering of partial template content
10049 !! wikitext
10051 {{echo|a
10052 <div>b</div>}}
10054 !! html
10055 <table>
10057 <div>b</div>
10058 <tr><td></td></tr></table>
10060 !! html+tidy
10061 <p>a</p>
10062 <div>b</div>
10063 <table>
10064 <tr>
10065 <td></td>
10066 </tr>
10067 </table>
10068 !! end
10070 !!test
10071 Templates: Wiki Tables: 3. td-content via multiple templates
10072 !! wikitext
10074 {{echo|{{pipe}}a}}{{echo|b}}
10076 !! html
10077 <table>
10078 <tr>
10079 <td>ab
10080 </td></tr></table>
10082 !!end
10084 !!test
10085 Templates: Wiki Tables: 4. Templated tags, no content
10086 !! wikitext
10087 {{tbl-start}}
10088 {{tbl-end}}
10089 !! html
10090 <table>
10091 <tr><td></td></tr></table>
10093 !!end
10095 !!test
10096 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10097 !! wikitext
10098 {{tbl-start}}
10099 |foo
10100 {{tbl-end}}
10101 !! html
10102 <table>
10103 <tr>
10104 <td>foo
10105 </td></tr></table>
10107 !!end
10109 !!test
10110 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10111 !! wikitext
10112 {{tbl-start}}
10113 {{!}}foo
10114 {{tbl-end}}
10115 !! html
10116 <table>
10117 <tr>
10118 <td>foo
10119 </td></tr></table>
10121 !!end
10123 !!test
10124 Templates: Lists: Multi-line list-items via templates
10125 !! wikitext
10126 *{{echo|a {{nonexistent|
10127 unused}}}}
10128 *{{echo|b {{nonexistent|
10129 unused}}}}
10130 !! html
10131 <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>
10132 <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>
10134 !!end
10136 !!test
10137 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10138 !! wikitext
10139 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10140 !! html
10141 <p><i>ab</i>c<i>d</i>e
10142 </p>
10143 !!end
10145 !!test
10146 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10147 (PHP parser generates misnested html)
10148 !! wikitext
10149 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10150 !! html/parsoid
10151 <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>
10152 !!end
10154 !!test
10155 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10156 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10157 !! options
10158 parsoid=wt2html,wt2wt
10159 !! wikitext
10160 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10161 !! html
10162 <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>
10163 <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>
10164 <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>
10165 !!end
10167 !!test
10168 Templates: Ugly nesting: 4. Divs opened/closed across templates
10169 !! wikitext
10170 a<div>b{{echo|c</div>d}}e
10171 !! html
10172 a<div>bc</div>de
10174 !! html+tidy
10175 <p>a</p>
10176 <div>bc</div>
10177 <p>de</p>
10178 !! end
10180 !!test
10181 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10182 (Parsoid-centric)
10183 !! options
10184 parsoid
10185 !! wikitext
10187 |{{echo|foo</table>}}
10188 |bar
10190 !! html
10191 <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|}"]}'>
10193 <tbody>
10194 <tr>
10195 <td>foo</td></tr></tbody></table><span about="#mwt1">
10196 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10197 |}</span>
10198 !!end
10200 !!test
10201 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10202 (Parsoid-centric)
10203 !! options
10204 parsoid
10205 !! wikitext
10206 <table>
10207   <tr>
10208     <td>
10209     <table>
10210       <tr>
10211         <td>1. {{echo|foo </table>}}</td>
10212         <td> bar </td>
10213         <td>2. {{echo|baz </table>}}</td>
10214       </tr>
10215       <tr>
10216         <td>abc</td>
10217       </tr>
10218     </table>
10219     </td>
10220   </tr>
10221   <tr>
10222     <td>xyz</td>
10223   </tr>
10224 </table>
10225 !! html
10226 <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>"]}'>
10227   <tbody><tr>
10228     <td>
10229     <table>
10230       <tbody><tr>
10231         <td>1. foo </td></tr></tbody></table></td>
10232         <td> bar </td>
10233         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10234       </span><span about="#mwt2">
10235       </span><span about="#mwt2">
10236         </span><span about="#mwt2">abc</span><span about="#mwt2">
10237       </span><span about="#mwt2">
10238     </span><span about="#mwt2">
10239     </span><span about="#mwt2">
10240   </span><span about="#mwt2">
10241   </span><span about="#mwt2">
10242     </span><span about="#mwt2">xyz</span><span about="#mwt2">
10243   </span><span about="#mwt2">
10244 </span>
10245 !!end
10247 !! test
10248 Templates: Ugly templates: 3. newline-only template parameter
10249 !! wikitext
10250 foo {{echo|
10252 !! html
10253 <p>foo 
10254 </p>
10255 !! end
10257 # This looks like a bug: a single newline triggers p/br for some reason.
10258 !! test
10259 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10260 !! wikitext
10261 {{echo|
10263 !! html
10264 <p><br />
10265 </p>
10266 !! end
10268 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10269 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10270 !! test
10271 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10272 !! wikitext
10273 {{echo|<table>}}
10274 {{echo|<div>foo}}
10275 {{echo|</table>}}
10276 !! html/parsoid
10277 <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
10278 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10279 </table>
10280 !! end
10282 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10283 # that are "identical" and generate nesting cycles in the algorithm
10284 !! test
10285 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10286 !! wikitext
10287 {{echo|<table><tr><td><table>}}
10288 {{echo|<div>}}
10289 {{echo|</div>}}
10290 !! html/parsoid
10291 <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"}'>
10292 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10293 </table></td></tr></tbody></table>
10294 !! end
10296 !!test
10297 Parser Functions: 1. Simple example
10298 !! wikitext
10299 {{uc:foo}}
10300 !! html
10301 <p>FOO
10302 </p>
10303 !!end
10305 !!test
10306 Parser Functions: 2. Nested use (only outermost should be marked up)
10307 !! wikitext
10308 {{uc:{{lc:FOO}}}}
10309 !! html
10310 <p>FOO
10311 </p>
10312 !!end
10315 ### Pre-save transform tests
10317 !! test
10318 pre-save transform: subst:
10319 !! options
10321 !! wikitext
10322 {{subst:test}}
10323 !! html
10324 This is a test template
10325 !! end
10327 !! test
10328 pre-save transform: normal template
10329 !! options
10331 !! wikitext
10332 {{test}}
10333 !! html
10334 {{test}}
10335 !! end
10337 !! test
10338 pre-save transform: nonexistent template
10339 !! options
10341 !! wikitext
10342 {{thistemplatedoesnotexist}}
10343 !! html
10344 {{thistemplatedoesnotexist}}
10345 !! end
10348 !! test
10349 pre-save transform: subst magic variables
10350 !! options
10352 !! wikitext
10353 {{subst:SITENAME}}
10354 !! html
10355 MediaWiki
10356 !! end
10358 # This is bug 89, which I fixed. -- wtm
10359 !! test
10360 pre-save transform: subst: templates with parameters
10361 !! options
10363 !! wikitext
10364 {{subst:paramtest|param="something else"}}
10365 !! html
10366 This is a test template with parameter "something else"
10367 !! end
10369 !! article
10370 Template:nowikitest
10371 !! text
10372 <nowiki>'''not wiki'''</nowiki>
10373 !! endarticle
10375 !! test
10376 pre-save transform: nowiki in subst (bug 1188)
10377 !! options
10379 !! wikitext
10380 {{subst:nowikitest}}
10381 !! html
10382 <nowiki>'''not wiki'''</nowiki>
10383 !! end
10386 !! article
10387 Template:commenttest
10388 !! text
10389 This template has <!-- a comment --> in it.
10390 !! endarticle
10392 !! test
10393 pre-save transform: comment in subst (bug 1936)
10394 !! options
10396 !! wikitext
10397 {{subst:commenttest}}
10398 !! html
10399 This template has <!-- a comment --> in it.
10400 !! end
10402 !! test
10403 pre-save transform: unclosed tag
10404 !! options
10405 pst noxml
10406 !! wikitext
10407 <nowiki>'''not wiki'''
10408 !! html
10409 <nowiki>'''not wiki'''
10410 !! end
10412 !! test
10413 pre-save transform: mixed tag case
10414 !! options
10415 pst noxml
10416 !! wikitext
10417 <NOwiki>'''not wiki'''</noWIKI>
10418 !! html
10419 <NOwiki>'''not wiki'''</noWIKI>
10420 !! end
10422 !! test
10423 pre-save transform: unclosed comment in <nowiki>
10424 !! options
10425 pst noxml
10426 !! wikitext
10427 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10428 !! html
10429 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10430 !!end
10432 # Leading @ in this template definition works around a limitation
10433 # in parsoid's parserTests which otherwise strips the <span> from the
10434 # result (confusing it for a template wrapper)
10435 !! article
10436 Template:dangerous
10437 !!text
10438 @<span onmouseover="alert('crap')">Oh no</span>
10439 !!endarticle
10441 !!test
10442 (confirming safety of fix for subst bug 1936)
10443 !! wikitext
10444 {{Template:dangerous}}
10445 !! html
10446 <p>@<span>Oh no</span>
10447 </p>
10448 !! end
10450 !! test
10451 pre-save transform: comment containing gallery (bug 5024)
10452 !! options
10454 !! wikitext
10455 <!-- <gallery>data</gallery> -->
10456 !! html
10457 <!-- <gallery>data</gallery> -->
10458 !!end
10460 !! test
10461 pre-save transform: comment containing extension
10462 !! options
10464 !! wikitext
10465 <!-- <tag>data</tag> -->
10466 !! html
10467 <!-- <tag>data</tag> -->
10468 !!end
10470 !! test
10471 pre-save transform: comment containing nowiki
10472 !! options
10474 !! wikitext
10475 <!-- <nowiki>data</nowiki> -->
10476 !! html
10477 <!-- <nowiki>data</nowiki> -->
10478 !!end
10480 !! test
10481 pre-save transform: <noinclude> in subst (bug 3298)
10482 !! options
10484 !! wikitext
10485 {{subst:Includes}}
10486 !! html
10487 Foobar
10488 !! end
10490 !! test
10491 pre-save transform: <onlyinclude> in subst (bug 3298)
10492 !! options
10494 !! wikitext
10495 {{subst:Includes2}}
10496 !! html
10498 !! end
10500 !! article
10501 Template:SubstTest
10502 !!text
10503 {{<includeonly>subst:</includeonly>Includes}}
10504 !! endarticle
10506 !! article
10507 Template:SafeSubstTest
10508 !! text
10509 {{<includeonly>safesubst:</includeonly>Includes}}
10510 !! endarticle
10512 !! test
10513 bug 22297: safesubst: works during PST
10514 !! options
10516 !! wikitext
10517 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10518 !! html
10519 FoobarFoobar
10520 !! end
10522 !! test
10523 bug 22297: safesubst: works during normal parse
10524 !! wikitext
10525 {{SafeSubstTest}}
10526 !! html
10527 <p>Foobar
10528 </p>
10529 !! end
10531 !! test
10532 subst: does not work during normal parse
10533 !! wikitext
10534 {{SubstTest}}
10535 !! html
10536 <p>{{subst:Includes}}
10537 </p>
10538 !! end
10540 !! test
10541 pre-save transform: context links ("pipe trick")
10542 !! options
10544 !! wikitext
10545 [[Article (context)|]]
10546 [[Bar:Article|]]
10547 [[:Bar:Article|]]
10548 [[Bar:Article (context)|]]
10549 [[:Bar:Article (context)|]]
10550 [[|Article]]
10551 [[|Article (context)]]
10552 [[Bar:X (Y) Z|]]
10553 [[:Bar:X (Y) Z|]]
10554 !! html
10555 [[Article (context)|Article]]
10556 [[Bar:Article|Article]]
10557 [[:Bar:Article|Article]]
10558 [[Bar:Article (context)|Article]]
10559 [[:Bar:Article (context)|Article]]
10560 [[Article]]
10561 [[Article (context)]]
10562 [[Bar:X (Y) Z|X (Y) Z]]
10563 [[:Bar:X (Y) Z|X (Y) Z]]
10564 !! end
10566 !! test
10567 pre-save transform: context links ("pipe trick") with interwiki prefix
10568 !! options
10570 !! wikitext
10571 [[interwiki:Article|]]
10572 [[:interwiki:Article|]]
10573 [[interwiki:Bar:Article|]]
10574 [[:interwiki:Bar:Article|]]
10575 !! html
10576 [[interwiki:Article|Article]]
10577 [[:interwiki:Article|Article]]
10578 [[interwiki:Bar:Article|Bar:Article]]
10579 [[:interwiki:Bar:Article|Bar:Article]]
10580 !! end
10582 !! test
10583 pre-save transform: context links ("pipe trick") with parens in title
10584 !! options
10585 pst title=[[Somearticle (context)]]
10586 !! wikitext
10587 [[|Article]]
10588 !! html
10589 [[Article (context)|Article]]
10590 !! end
10592 !! test
10593 pre-save transform: context links ("pipe trick") with comma in title
10594 !! options
10595 pst title=[[Someplace, Somewhere]]
10596 !! wikitext
10597 [[|Otherplace]]
10598 [[Otherplace, Elsewhere|]]
10599 [[Otherplace, Elsewhere, Anywhere|]]
10600 !! html
10601 [[Otherplace, Somewhere|Otherplace]]
10602 [[Otherplace, Elsewhere|Otherplace]]
10603 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10604 !! end
10606 !! test
10607 pre-save transform: context links ("pipe trick") with parens and comma
10608 !! options
10609 pst title=[[Someplace (IGNORED), Somewhere]]
10610 !! wikitext
10611 [[|Otherplace]]
10612 [[Otherplace (place), Elsewhere|]]
10613 !! html
10614 [[Otherplace, Somewhere|Otherplace]]
10615 [[Otherplace (place), Elsewhere|Otherplace]]
10616 !! end
10618 !! test
10619 pre-save transform: context links ("pipe trick") with comma and parens
10620 !! options
10621 pst title=[[Who, me? (context)]]
10622 !! wikitext
10623 [[|Yes, you.]]
10624 [[Me, Myself, and I (1937 song)|]]
10625 !! html
10626 [[Yes, you. (context)|Yes, you.]]
10627 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10628 !! end
10630 !! test
10631 pre-save transform: context links ("pipe trick") with namespace
10632 !! options
10633 pst title=[[Ns:Somearticle]]
10634 !! wikitext
10635 [[|Article]]
10636 !! html
10637 [[Ns:Article|Article]]
10638 !! end
10640 !! test
10641 pre-save transform: context links ("pipe trick") with namespace and parens
10642 !! options
10643 pst title=[[Ns:Somearticle (context)]]
10644 !! wikitext
10645 [[|Article]]
10646 !! html
10647 [[Ns:Article (context)|Article]]
10648 !! end
10650 !! test
10651 pre-save transform: context links ("pipe trick") with namespace and comma
10652 !! options
10653 pst title=[[Ns:Somearticle, Context, Whatever]]
10654 !! wikitext
10655 [[|Article]]
10656 !! html
10657 [[Ns:Article, Context, Whatever|Article]]
10658 !! end
10660 !! test
10661 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10662 !! options
10663 pst title=[[Ns:Somearticle, Context (context)]]
10664 !! wikitext
10665 [[|Article]]
10666 !! html
10667 [[Ns:Article (context)|Article]]
10668 !! end
10670 !! test
10671 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10672 !! options
10673 pst title=[[Ns:Somearticle (IGNORED), Context]]
10674 !! wikitext
10675 [[|Article]]
10676 !! html
10677 [[Ns:Article, Context|Article]]
10678 !! end
10680 !! test
10681 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10682 !! options
10684 !! wikitext
10685 [[Article(context)|]]
10686 [[Bar:Article(context)|]]
10687 [[:Bar:Article(context)|]]
10688 [[|Article(context)]]
10689 [[Bar:X(Y)Z|]]
10690 [[:Bar:X(Y)Z|]]
10691 !! html
10692 [[Article(context)|Article]]
10693 [[Bar:Article(context)|Article]]
10694 [[:Bar:Article(context)|Article]]
10695 [[Article(context)]]
10696 [[Bar:X(Y)Z|X(Y)Z]]
10697 [[:Bar:X(Y)Z|X(Y)Z]]
10698 !! end
10700 !! test
10701 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10702 !! options
10704 !! wikitext
10705 [[Article (context)|]]
10706 [[Bar:Article (context)|]]
10707 [[:Bar:Article (context)|]]
10708 [[|Article (context)]]
10709 [[Bar:X (Y) Z|]]
10710 [[:Bar:X (Y) Z|]]
10711 !! html
10712 [[Article (context)|Article]]
10713 [[Bar:Article (context)|Article]]
10714 [[:Bar:Article (context)|Article]]
10715 [[Article (context)]]
10716 [[Bar:X (Y) Z|X (Y) Z]]
10717 [[:Bar:X (Y) Z|X (Y) Z]]
10718 !! end
10720 !! test
10721 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10722 !! options
10724 !! wikitext
10725 [[Article(context)|]]
10726 [[Bar:Article(context)|]]
10727 [[:Bar:Article(context)|]]
10728 [[|Article(context)]]
10729 [[Bar:X(Y)Z|]]
10730 [[:Bar:X(Y)Z|]]
10731 !! html
10732 [[Article(context)|Article]]
10733 [[Bar:Article(context)|Article]]
10734 [[:Bar:Article(context)|Article]]
10735 [[Article(context)]]
10736 [[Bar:X(Y)Z|X(Y)Z]]
10737 [[:Bar:X(Y)Z|X(Y)Z]]
10738 !! end
10740 !! test
10741 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10742 !! options
10744 !! wikitext
10745 [[Article (context), context|]]
10746 [[Article (context),context|]]
10747 [[Bar:Article (context), context|]]
10748 [[Bar:Article (context),context|]]
10749 [[:Bar:Article (context), context|]]
10750 [[:Bar:Article (context),context|]]
10751 !! html
10752 [[Article (context), context|Article]]
10753 [[Article (context),context|Article]]
10754 [[Bar:Article (context), context|Article]]
10755 [[Bar:Article (context),context|Article]]
10756 [[:Bar:Article (context), context|Article]]
10757 [[:Bar:Article (context),context|Article]]
10758 !! end
10760 !! test
10761 pre-save transform: trim trailing empty lines
10762 !! options
10764 !! wikitext
10765 Empty lines are trimmed
10770 !! html
10771 Empty lines are trimmed
10772 !! end
10774 !! test
10775 pre-save transform: Signature expansion
10776 !! options
10778 !! wikitext
10779 * ~~~
10780 * <noinclude>~~~</noinclude>
10781 * <includeonly>~~~</includeonly>
10782 * <onlyinclude>~~~</onlyinclude>
10783 !! html
10784 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10785 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10786 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10787 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10788 !! end
10791 !! test
10792 pre-save transform: Signature expansion in nowiki tags (bug 93)
10793 !! options
10794 pst disabled
10795 !! wikitext
10796 Shall not expand:
10798 <nowiki>~~~~</nowiki>
10800 <includeonly><nowiki>~~~~</nowiki></includeonly>
10802 <noinclude><nowiki>~~~~</nowiki></noinclude>
10804 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10806 {{subst:Foo}} shall be converted to FOO
10808 As well as inside noinclude/onlyinclude
10809 <noinclude>{{subst:Foo}}</noinclude>
10810 <onlyinclude>{{subst:Foo}}</onlyinclude>
10812 But not inside includeonly
10813 <includeonly>{{subst:Foo}}</includeonly>
10814 !! html
10815 Shall not expand:
10817 <nowiki>~~~~</nowiki>
10819 <includeonly><nowiki>~~~~</nowiki></includeonly>
10821 <noinclude><nowiki>~~~~</nowiki></noinclude>
10823 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10825 FOO shall be converted to FOO
10827 As well as inside noinclude/onlyinclude
10828 <noinclude>FOO</noinclude>
10829 <onlyinclude>FOO</onlyinclude>
10831 But not inside includeonly
10832 <includeonly>{{subst:Foo}}</includeonly>
10833 !! end
10835 !! test
10836 Parsoid: Recognize nowiki with trailing space in tags
10837 !! options
10838 parsoid=wt2html
10839 !! wikitext
10840 <nowiki ><div>[[foo]]</nowiki >
10842 a<nowiki / >b
10844 c<nowiki />d
10846 e<nowiki/ >f
10847 !! html
10848 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10849 <p>ab</p>
10850 <p>cd</p>
10851 <p>ef</p>
10852 !! end
10854 !! test
10855 Parsoid: Recognize nowiki with odd capitalization
10856 !! options
10857 parsoid=wt2html
10858 !! wikitext
10859 <noWikI ><div>[[foo]]</Nowiki >
10860 !! html
10861 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10862 !! end
10865 !! test
10866 Parsoid: Escape nowiki with trailing space in tags
10867 !! options
10868 parsoid=html2wt
10869 !! wikitext
10870 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10872 a&lt;nowiki /&gt;b
10874 c&lt;nowiki/ &gt;d
10875 !! html
10876 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10877 <p>a&lt;nowiki /&gt;b</p>
10878 <p>c&lt;nowiki/ &gt;d</p>
10879 !! end
10881 !! test
10882 Parsoid: Escape weird noWikI capitalizations
10883 !! options
10884 parsoid=html2wt
10885 !! wikitext
10886 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10887 !! html
10888 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10889 !! end
10892 ### Message transform tests
10894 !! test
10895 message transform: magic variables
10896 !! options
10898 !! wikitext
10899 {{SITENAME}}
10900 !! html
10901 MediaWiki
10902 !! end
10904 !! test
10905 message transform: should not transform wiki markup
10906 !! options
10908 !! wikitext
10909 ''test''
10910 !! html
10911 ''test''
10912 !! end
10914 !! test
10915 message transform: <noinclude> in transcluded template (bug 4926)
10916 !! options
10918 !! wikitext
10919 {{Includes}}
10920 !! html
10921 Foobar
10922 !! end
10924 !! test
10925 message transform: <onlyinclude> in transcluded template (bug 4926)
10926 !! options
10928 !! wikitext
10929 {{Includes2}}
10930 !! html
10932 !! end
10934 !! test
10935 {{#special:}} page name, known
10936 !! options
10938 !! wikitext
10939 {{#special:Recentchanges}}
10940 !! html
10941 Special:RecentChanges
10942 !! end
10944 !! test
10945 {{#special:}} page name with subpage, known
10946 !! options
10948 !! wikitext
10949 {{#special:Recentchanges/param}}
10950 !! html
10951 Special:RecentChanges/param
10952 !! end
10954 !! test
10955 {{#special:}} page name, unknown
10956 !! options
10958 !! wikitext
10959 {{#special:foobar nonexistent}}
10960 !! html
10961 Special:Foobar nonexistent
10962 !! end
10964 !! test
10965 {{#speciale:}} page name, known
10966 !! options
10968 !! wikitext
10969 {{#speciale:Recentchanges}}
10970 !! html
10971 Special:RecentChanges
10972 !! end
10974 !! test
10975 {{#speciale:}} page name with subpage, known
10976 !! options
10978 !! wikitext
10979 {{#speciale:Recentchanges/param}}
10980 !! html
10981 Special:RecentChanges/param
10982 !! end
10984 !! test
10985 {{#speciale:}} page name, unknown
10986 !! options
10988 !! wikitext
10989 {{#speciale:foobar nonexistent}}
10990 !! html
10991 Special:Foobar_nonexistent
10992 !! end
10995 ### Images
10997 ### For Parsoid-specific tests, see
10998 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11000 !! test
11001 Simple image
11002 !! options
11003 parsoid=wt2html,wt2wt,html2html
11004 !! wikitext
11005 [[Image:foobar.jpg]]
11006 !! html/php
11007 <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>
11008 </p>
11009 !! html/parsoid
11010 <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>
11011 !! end
11013 !! test
11014 Simple image (using File: namespace, now canonical)
11015 !! wikitext
11016 [[File:Foobar.jpg]]
11017 !! html/php
11018 <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>
11019 </p>
11020 !! html/parsoid
11021 <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>
11022 !! end
11024 !! test
11025 Right-aligned image
11026 !! wikitext
11027 [[File:Foobar.jpg|right]]
11028 !! html/php
11029 <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>
11031 !! html/parsoid
11032 <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>
11033 !! end
11035 !! test
11036 Image with caption
11037 !! wikitext
11038 [[File:Foobar.jpg|right|Caption text]]
11039 !! html/php
11040 <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>
11042 !! html/parsoid
11043 <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>
11044 !! end
11046 !! test
11047 Image with caption, bug 53312 #1
11048 !! wikitext
11049 [[File:Foobar.jpg|right|Caption page stuff]]
11050 !! html/php
11051 <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>
11053 !! html/parsoid
11054 <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>
11055 !! end
11057 !! test
11058 Image with caption, bug 53312 #2
11059 !! wikitext
11060 [[File:Foobar.jpg|right|Caption page=]]
11061 !! html/php
11062 <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>
11064 !! html/parsoid
11065 <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>
11066 !! end
11068 !! test
11069 Image with caption, bug 53312 #3
11070 !! wikitext
11071 [[File:Foobar.jpg|right|Caption page=stuff]]
11072 !! html/php
11073 <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>
11075 !! html/parsoid
11076 <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>
11077 !! end
11079 !! test
11080 Allow empty links in image captions (Bug 60753)
11081 !! options
11082 thumbsize=220
11083 !! wikitext
11084 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11085 [[]]
11086 [[Link2]]
11088 !! html/php
11089 <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>
11091 !! html/parsoid
11092 <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>
11093 [[]]
11094 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11095 </figcaption></figure>
11096 !! end
11098 !! test
11099 Link with empty target
11100 !! wikitext
11101 [[]]
11102 !! html
11103 <p>[[]]
11104 </p>
11105 !! end
11107 !! test
11108 Image with empty attribute
11109 !! options
11110 parsoid=wt2html,wt2wt,html2html
11111 !! wikitext
11112 [[File:Foobar.jpg|right||Caption text]]
11113 !! html/php
11114 <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>
11116 !! html/parsoid
11117 <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>
11118 !! end
11120 !! test
11121 1. Block image with individual attributes from templates
11122 !! wikitext
11123 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11124 !! html/php
11125 <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>
11127 !! html/parsoid
11128 <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>
11129 !! end
11131 !! test
11132 2. Block Image with individual attributes from templates
11133 !! wikitext
11134 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11135 !! html/php
11136 <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>
11138 !! html/parsoid
11139 <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>
11140 !! end
11142 !! test
11143 3. Inline image with individual attributes from templates
11144 !! wikitext
11145 [[File:Foobar.jpg|{{echo|50px}}]]
11146 !! html/php
11147 <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>
11148 </p>
11149 !! html/parsoid
11150 <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>
11151 !! end
11153 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11154 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11155 !! test
11156 Image with multiple attributes from the same template
11157 !! wikitext
11158 [[File:Foobar.jpg|{{image_attribs}}]]
11159 !! html/php
11160 <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>
11162 !! html/parsoid
11163 <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>
11164 !! end
11166 !! test
11167 Image with link tails
11168 !! options
11169 thumbsize=220
11170 !! wikitext
11171 123[[File:Foobar.jpg]]456
11172 123[[File:Foobar.jpg|right]]456
11173 123[[File:Foobar.jpg|thumb]]456
11174 !! html/php
11175 <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
11176 </p>
11177 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
11178 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
11180 !! html/php+tidy
11181 <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>
11182 <p>123</p>
11183 <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>
11184 <p>456 123</p>
11185 <div class="thumb tright">
11186 <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>
11187 <div class="thumbcaption">
11188 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11189 </div>
11190 </div>
11191 </div>
11192 <p>456</p>
11193 !! html/parsoid
11194 <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>
11195 <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>
11196 <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>
11197 !! end
11199 !! test
11200 Image with multiple captions -- only last one is accepted
11201 !! wikitext
11202 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11203 !! html/php
11204 <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>
11206 !! html/parsoid
11207 <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>
11208 !! end
11210 !! test
11211 Image with multiple widths -- use last
11212 !! wikitext
11213 [[File:Foobar.jpg|200px|300px|caption]]
11214 !! html/php
11215 <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>
11216 </p>
11217 !! html/parsoid
11218 <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>
11219 !! end
11221 !! test
11222 Image with multiple alignments -- use first (bug 48664)
11223 !! options
11224 thumbsize=220
11225 !! wikitext
11226 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11228 [[File:Foobar.jpg|middle|text-top|caption]]
11229 !! html/php
11230 <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>
11231 <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>
11232 </p>
11233 !! html/parsoid
11234 <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>
11235 <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>
11236 !! end
11238 !! test
11239 Image with width attribute at different positions
11240 !! wikitext
11241 [[File:Foobar.jpg|200px|right|Caption]]
11242 [[File:Foobar.jpg|right|200px|Caption]]
11243 [[File:Foobar.jpg|right|Caption|200px]]
11244 !! html/php
11245 <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>
11246 <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>
11247 <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>
11249 !! html/parsoid
11250 <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>
11251 <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>
11252 <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>
11253 !! end
11255 # a sad bit of backward-compatibility
11256 !! test
11257 Image with size specified with pxpx (bug 13500, 51628)
11258 !! options
11259 parsoid=wt2html,wt2wt,html2html
11260 !! wikitext
11261 [[File:Foobar.jpg|20pxpx]]
11262 [[File:Foobar.jpg|200x20pxpx]]
11263 !! html/php
11264 <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>
11265 <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>
11266 </p>
11267 !! html/parsoid
11268 <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>
11269 !! end
11271 !! test
11272 Image with link parameter, wiki target
11273 !! wikitext
11274 [[File:Foobar.jpg|link=Main Page]]
11275 !! html/php
11276 <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>
11277 </p>
11278 !! html/parsoid
11279 <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>
11280 !! end
11282 # parsoid bug 49293 (part 1)
11283 !! test
11284 Image with link parameter, URL target
11285 !! wikitext
11286 [[File:Foobar.jpg|link=http://example.com/]]
11287 !! html/php
11288 <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>
11289 </p>
11290 !! html/parsoid
11291 <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>
11292 !! end
11294 # parsoid bug 49293 (part 2)
11295 !! test
11296 Image with link parameter, protocol-less URL target
11297 !! wikitext
11298 [[File:Foobar.jpg|link=//example.com/]]
11299 !! html/php
11300 <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>
11301 </p>
11302 !! html/parsoid
11303 <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>
11304 !! end
11306 !! test
11307 Image with link parameter, wgExternalLinkTarget
11308 !! wikitext
11309 [[Image:foobar.jpg|link=http://example.com/]]
11310 !! config
11311 wgExternalLinkTarget='foobar'
11312 !! html
11313 <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>
11314 </p>
11315 !! end
11317 !! test
11318 Image with link parameter, wgNoFollowLinks set to false
11319 !! wikitext
11320 [[Image:foobar.jpg|link=http://example.com/]]
11321 !! config
11322 wgNoFollowLinks=false
11323 !! html
11324 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11325 </p>
11326 !! end
11328 !! test
11329 Image with link parameter, wgNoFollowDomainExceptions
11330 !! wikitext
11331 [[Image:foobar.jpg|link=http://example.com/]]
11332 !! config
11333 wgNoFollowDomainExceptions='example.com'
11334 !! html
11335 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11336 </p>
11337 !! end
11339 !! test
11340 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11341 !! wikitext
11342 [[Image:foobar.jpg|link=http://example.com/|Title]]
11343 !! config
11344 wgExternalLinkTarget='foobar'
11345 !! html
11346 <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>
11347 </p>
11348 !! end
11350 !! test
11351 Image with empty link parameter
11352 !! wikitext
11353 [[File:Foobar.jpg|link=]]
11354 !! html/php
11355 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11356 </p>
11357 !! html/parsoid
11358 <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>
11359 !! end
11361 !! test
11362 Image with link parameter (wiki target) and unnamed parameter
11363 !! wikitext
11364 [[File:Foobar.jpg|link=Main_Page|Title]]
11365 !! html/php
11366 <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>
11367 </p>
11368 !! html/parsoid
11369 <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>
11370 !! end
11372 !! test
11373 Image with link parameter (URL target) and unnamed parameter
11374 !! wikitext
11375 [[File:Foobar.jpg|link=http://example.com/|Title]]
11376 !! html/php
11377 <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>
11378 </p>
11379 !! html/parsoid
11380 <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>
11381 !! end
11383 !! test
11384 Thumbnail image with link parameter
11385 !! options
11386 thumbsize=220
11387 parsoid=wt2html,wt2wt,html2html
11388 !! wikitext
11389 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11390 !! html/php
11391 <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>
11393 !! html/parsoid
11394 <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>
11395 !! end
11397 !! test
11398 Manually-specified thumbnail image
11399 !! options
11400 thumbsize=220
11401 !! wikitext
11402 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11403 !! html/php
11404 <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>
11406 !! html/parsoid
11407 <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>
11408 !! end
11410 !! test
11411 Manually-specified thumbnail image with explicit link to wiki page
11412 !! options
11413 thumbsize=220
11414 parsoid=wt2html,wt2wt,html2html
11415 !! wikitext
11416 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11417 !! html/php
11418 <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>
11420 !! html/parsoid
11421 <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>
11422 !! end
11424 !! test
11425 Manually-specified thumbnail image with explicit link to url
11426 !! options
11427 thumbsize=220
11428 parsoid=wt2html,wt2wt,html2html
11429 !! wikitext
11430 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11431 !! html/php
11432 <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>
11434 !! html/parsoid
11435 <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>
11436 !! end
11438 !! test
11439 Manually-specified thumbnail image with explicit no link
11440 !! options
11441 thumbsize=220
11442 parsoid=wt2html,wt2wt,html2html
11443 !! wikitext
11444 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11445 !! html/php
11446 <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>
11448 !! html/parsoid
11449 <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>
11450 !! end
11452 !! test
11453 Manually-specified thumbnail image with explicit link and alt text
11454 !! options
11455 thumbsize=220
11456 parsoid=wt2html,wt2wt,html2html
11457 !! wikitext
11458 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11459 !! html/php
11460 <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>
11462 !! html/parsoid
11463 <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>
11464 !! end
11466 !! test
11467 Image with frame and link
11468 !! options
11469 parsoid=wt2html,wt2wt,html2html
11470 !! wikitext
11471 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11472 !! html/php
11473 <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>
11475 !! html/parsoid
11476 <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>
11477 !! end
11479 !! test
11480 Image with frame and link and explicit alt
11481 !! options
11482 parsoid=wt2html,wt2wt,html2html
11483 !! wikitext
11484 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11485 !! html/php
11486 <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>
11488 !! html/parsoid
11489 <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>
11490 !! end
11492 !! test
11493 Image with wiki markup in implicit alt
11494 !! options
11495 parsoid=wt2html,wt2wt,html2html
11496 !! wikitext
11497 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11499 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11500 !! html/php
11501 <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>
11502 </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>
11503 </p>
11504 !! html/parsoid
11505 <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>
11506 <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>
11507 !! end
11509 ###################
11510 # Conflicting image format options.
11511 # First option specified should 'win'.
11512 # All three cases in each test should be identical.
11514 !! test
11515 Image with 'frameless' first.
11516 !! options
11517 parsoid=wt2html,wt2wt,html2html
11518 !! wikitext
11519 [[File:Foobar.jpg|frameless|caption]]
11521 [[File:Foobar.jpg|frameless|frame|caption]]
11523 [[File:Foobar.jpg|frameless|thumb|caption]]
11524 !! html/php
11525 <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>
11526 </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>
11527 </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>
11528 </p>
11529 !! html/parsoid
11530 <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>
11531 <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>
11532 <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>
11533 !! end
11535 !! test
11536 Image with 'frame' first.
11537 !! options
11538 parsoid=wt2html,wt2wt,html2html
11539 !! wikitext
11540 [[File:Foobar.jpg|frame|caption]]
11541 [[File:Foobar.jpg|frame|frameless|caption]]
11542 [[File:Foobar.jpg|frame|thumb|caption]]
11543 !! html/php
11544 <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>
11545 <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>
11546 <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>
11548 !! html/parsoid
11549 <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>
11550 <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>
11551 <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>
11552 !! end
11554 !! test
11555 Image with 'thumb' first.
11556 !! options
11557 parsoid=wt2html,wt2wt,html2html
11558 !! wikitext
11559 [[File:Foobar.jpg|thumb|caption]]
11560 [[File:Foobar.jpg|thumb|frameless|caption]]
11561 [[File:Foobar.jpg|thumb|frame|caption]]
11562 !! html/php
11563 <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>
11564 <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>
11565 <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>
11567 !! html/parsoid
11568 <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>
11569 <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>
11570 <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>
11571 !! end
11573 ###################
11574 # Image sizing.
11575 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11576 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11577 # Foobar has actual size of 1941x220
11578 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11579 #    a scalable format.
11580 # 2. Framed images always ignore size options; always render at default size.
11581 # 3. "Unspecified format" and border are the only types which can be
11582 #    enlarged.
11584 !! test
11585 Image: "unspecified format" and border enlarge
11586 !! options
11587 parsoid=wt2html,wt2wt,html2html
11588 !! wikitext
11589 [[File:Foobar.jpg|2000px]]
11591 [[File:Foobar.jpg|border|2000px]]
11592 !! html/php
11593 <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>
11594 </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>
11595 </p>
11596 !! html/parsoid
11597 <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>
11598 <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>
11599 !! end
11601 !! test
11602 Image: "unspecified format" and border reduce
11603 !! options
11604 parsoid=wt2html,wt2wt,html2html
11605 !! wikitext
11606 [[File:Foobar.jpg|1000px]]
11608 [[File:Foobar.jpg|border|1000px]]
11609 !! html/php
11610 <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>
11611 </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>
11612 </p>
11613 !! html/parsoid
11614 <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>
11615 <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>
11616 !! end
11618 !! test
11619 Image: thumbs reduce
11620 !! options
11621 parsoid=wt2html,wt2wt,html2html
11622 !! wikitext
11623 [[File:Foobar.jpg|thumb|50px]]
11624 !! html/php
11625 <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>
11627 !! html/parsoid
11628 <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>
11629 !! end
11631 !! test
11632 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11633 !! options
11634 parsoid=wt2html,wt2wt,html2html
11635 !! wikitext
11636 [[File:Foobar.jpg|thumb|2000px]]
11638 [[File:Foobar.svg|thumb|2000px]]
11639 !! html/php
11640 <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>
11641 <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>
11643 !! html/parsoid
11644 <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>
11645 <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>
11646 !! end
11648 !! test
11649 Image: frameless can reduce in size
11650 !! options
11651 parsoid=wt2html,wt2wt,html2html
11652 !! wikitext
11653 [[File:Foobar.jpg|frameless|50px]]
11654 !! html/php
11655 <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>
11656 </p>
11657 !! html/parsoid
11658 <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>
11659 !! end
11661 !! test
11662 Image: bitmap frameless can't be enlarged past original size, but vector can
11663 !! options
11664 parsoid=wt2html,wt2wt,html2html
11665 !! wikitext
11666 [[File:Foobar.jpg|frameless|2000px]]
11668 [[File:Foobar.svg|frameless|2000px]]
11669 !! html/php
11670 <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>
11671 </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>
11672 </p>
11673 !! html/parsoid
11674 <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>
11675 <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>
11676 !! end
11678 !! test
11679 Image: framed images are always unscaled.
11680 !! options
11681 parsoid=wt2html,wt2wt,html2html
11682 !! wikitext
11683 [[File:Foobar.jpg|frame]]
11685 [[File:Foobar.jpg|frame|50px]]
11687 [[File:Foobar.jpg|frame|50x50px]]
11689 [[File:Foobar.jpg|frame|2000px]]
11690 !! html/php
11691 <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>
11692 <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>
11693 <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>
11694 <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>
11696 !! html/parsoid
11697 <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>
11698 <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>
11699 <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>
11700 <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>
11701 !! end
11703 ###################
11705 !! test
11706 Link to image page- image page normally doesn't exists, hence edit link
11707 Add test with existing image page
11708 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11709 !! wikitext
11710 [[:Image:test]]
11711 !! html
11712 <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>
11713 </p>
11714 !! end
11716 !! test
11717 bug 18784  Link to non-existent image page with caption should use caption as link text
11718 !! wikitext
11719 [[:Image:test|caption]]
11720 !! html
11721 <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>
11722 </p>
11723 !! end
11725 !! test
11726 Frameless image caption with a free URL
11727 !! wikitext
11728 [[File:Foobar.jpg|http://example.com]]
11729 !! html/php
11730 <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>
11731 </p>
11732 !! html/parsoid
11733 <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>
11734 !! end
11736 !! test
11737 Thumbnail image caption with a free URL
11738 !! options
11739 thumbsize=220
11740 !! wikitext
11741 [[File:Foobar.jpg|thumb|http://example.com]]
11742 !! html/php
11743 <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>
11745 !! html/parsoid
11746 <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>
11747 !! end
11749 !! test
11750 Thumbnail image caption with a free URL and explicit alt
11751 !! options
11752 thumbsize=220
11753 parsoid=wt2html,wt2wt,html2html
11754 !! wikitext
11755 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11756 !! html/php
11757 <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>
11759 !! html/parsoid
11760 <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>
11761 !! end
11763 !! test
11764 SVG thumbnails with no language set
11765 !! options
11766 !! wikitext
11767 [[File:Foobar.svg|thumb|caption]]
11768 !! html/php
11769 <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>
11771 !! html/parsoid
11772 <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>
11773 !! end
11775 !! test
11776 SVG thumbnails with language de
11777 !! options
11778 parsoid=wt2html,wt2wt,html2html
11779 !! wikitext
11780 [[File:Foobar.svg|thumb|caption|lang=de]]
11781 !! html/php
11782 <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>
11784 !! html/parsoid
11785 <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>
11786 !! end
11788 !! test
11789 SVG thumbnails with invalid language code
11790 !! options
11791 parsoid=wt2html,wt2wt,html2html
11792 !! wikitext
11793 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11794 !! html/php
11795 <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>
11797 !! html/parsoid
11798 <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>
11799 !! end
11801 !! test
11802 BUG 1887: A ISBN with a thumbnail
11803 !! wikitext
11804 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11805 !! html/php
11806 <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>
11808 !! html/parsoid
11809 <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>
11810 !! end
11812 !! test
11813 BUG 1887: A RFC with a thumbnail
11814 !! wikitext
11815 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11816 !! html/php
11817 <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>
11819 !! html/parsoid
11820 <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>
11821 !! end
11823 !! test
11824 BUG 1887: A mailto link with a thumbnail
11825 !! wikitext
11826 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11827 !! html/php
11828 <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>
11830 !! html/parsoid
11831 <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>
11832 !! end
11834 # Pending resolution to bug 368
11835 !! test
11836 BUG 648: Frameless image caption with a link
11837 !! wikitext
11838 [[File:Foobar.jpg|text with a [[link]] in it]]
11839 !! html/php
11840 <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>
11841 </p>
11842 !! html/parsoid
11843 <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>
11844 !! end
11846 !! test
11847 BUG 648: Frameless image caption with a link (suffix)
11848 !! wikitext
11849 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11850 !! html/php
11851 <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>
11852 </p>
11853 !! html/parsoid
11854 <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>
11855 !! end
11857 !! test
11858 BUG 648: Frameless image caption with an interwiki link
11859 !! wikitext
11860 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11861 !! html/php
11862 <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>
11863 </p>
11864 !! html/parsoid
11865 <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>
11866 !! end
11868 !! test
11869 BUG 648: Frameless image caption with a piped interwiki link
11870 !! wikitext
11871 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11872 !! html/php
11873 <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>
11874 </p>
11875 !! html/parsoid
11876 <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>
11877 !! end
11879 !! test
11880 Escape HTML special chars in image alt text
11881 !! wikitext
11882 [[File:Foobar.jpg|& < > "]]
11883 !! html/php
11884 <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>
11885 </p>
11886 !! html/parsoid
11887 <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>
11888 !! end
11890 !! test
11891 BUG 499: Alt text should have &#1234;, not &amp;1234;
11892 !! wikitext
11893 [[File:Foobar.jpg|&#9792;]]
11894 !! html/php
11895 <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>
11896 </p>
11897 !! html/parsoid
11898 <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>
11899 !! end
11901 !! test
11902 Broken image caption with link
11903 !! options
11904 parsoid=wt2html,wt2wt,html2html
11905 !! wikitext
11906 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11907 !! html/php
11908 <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.
11909 </p>
11910 !! html/parsoid
11911 <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>
11912 !! end
11914 !! test
11915 Image caption containing another image
11916 !! wikitext
11917 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11918 !! html/php
11919 <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>
11921 !! html/parsoid
11922 <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>
11923 !! end
11925 !! test
11926 Image: caption containing a newline
11927 !! wikitext
11928 [[File:Foobar.jpg|This
11929 *is some text]]
11930 !! html/php
11931 <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>
11932 </p>
11933 !! html/parsoid
11934 <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>
11935 !!end
11937 !!test
11938 Image: caption containing leading space
11939 (The leading space should not trigger nowiki escaping in wt2wt mode)
11940 !! wikitext
11941 [[File:Foobar.jpg|thumb| bar]]
11942 !! html/php
11943 <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>
11945 !! html/parsoid
11946 <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>
11947 !!end
11949 !! test
11950 Image: caption containing a table
11951 !! options
11952 parsoid=wt2html,wt2wt,html2html
11953 !! wikitext
11954 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11956 ! Foo !! Bar
11958 | Foo1 || Bar1
11960 and some more text.]]
11961 !! html/php
11962 <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>
11964 !! html/parsoid
11965 <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
11966 <table>
11967 <tbody>
11968 <tr><th>Foo </th><th>Bar</th></tr>
11969 <tr>
11970 <td>Foo1 </td>
11971 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11972 !! end
11974 !! test
11975 Bug 3090: External links other than http: in image captions
11976 !! wikitext
11977 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11978 !! html/php
11979 <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>
11981 !! html/parsoid
11982 <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>
11983 !! end
11985 !! test
11986 Custom class
11987 !! options
11988 parsoid=wt2html,wt2wt,html2html
11989 !! wikitext
11990 [[Image:foobar.jpg|a|class=b]]
11991 !! html/php
11992 <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>
11993 </p>
11994 !! html/parsoid
11995 <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>
11996 !! end
11998 !! test
11999 Localized image handling (1).
12000 !! options
12001 parsoid=wt2html,wt2wt,html2html
12002 language=es
12003 !! wikitext
12004 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12005 !! html/php
12006 <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>
12008 !! html/parsoid
12009 <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>
12010 !! end
12012 !! test
12013 Localized image handling (2).
12014 !! options
12015 thumbsize=220
12016 parsoid=wt2html,wt2wt,html2html
12017 language=es
12018 !! wikitext
12019 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12020 !! html/php
12021 <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>
12023 !! html/parsoid
12024 <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>
12025 !! end
12027 !! test
12028 "border", "frameless" and "class" attributes on an image.
12029 !! options
12030 thumbsize=220
12031 parsoid=wt2html,wt2wt,html2html
12032 !! wikitext
12033 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12034 !! html/php
12035 <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>
12036 </p>
12037 !! html/parsoid
12038 <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>
12039 !! end
12041 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12042 !! test
12043 Invalid image attributes (bug 62500)
12044 !! options
12045 thumbsize=220
12046 parsoid=wt2html,wt2wt,html2html
12047 !! wikitext
12048 [[File:Foobar.jpg|thumb|float|left|caption]]
12050 [[File:Foobar.jpg|thumb|righ|caption]]
12052 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12053 !! html/php
12054 <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>
12055 <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>
12056 <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>
12058 !! html/parsoid
12059 <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>
12060 <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>
12061 <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>
12062 !! end
12064 !! article
12065 File:Barfoo.jpg
12066 !! text
12067 #REDIRECT [[File:Barfoo.jpg]]
12068 !! endarticle
12070 !! test
12071 Redirected image
12072 !! wikitext
12073 [[Image:Barfoo.jpg]]
12074 !! html
12075 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12076 </p>
12077 !! end
12079 !! test
12080 Missing image with uploads disabled
12081 !! options
12082 wgEnableUploads=0
12083 !! wikitext
12084 [[Image:Foobaz.jpg]]
12085 !! html
12086 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12087 </p>
12088 !! end
12090 # Parsoid-specific testing for images
12091 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12092 # Currently imperfect due to a flaw in the Parsoid testrunner
12093 # Work in progress
12094 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12095 # image tests.
12097 !! test
12098 Parsoid-specific image handling - simple image with size and middle alignment
12099 !! wikitext
12100 [[File:Foobar.jpg|middle|50px]]
12101 !! html/parsoid
12102 <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>
12103 !! end
12105 !! test
12106 Parsoid-specific image handling - simple image with size, middle alignment,
12107 non-standard namespace alias
12108 !! options
12109 parsoid=wt2wt,wt2html,html2html
12110 !! wikitext
12111 [[Image:Foobar.jpg|middle|50px]]
12112 !! html/parsoid
12113 <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>
12114 !! end
12116 !! test
12117 Parsoid-specific image handling - simple image with size and middle alignment
12118 (existing content)
12119 !! wikitext
12120 [[File:Foobar.jpg|50px|middle]]
12121 !! html/parsoid
12122 <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>
12123 !! end
12125 !! test
12126 Parsoid-specific image handling - simple image with size and middle alignment
12127 and non-standard namespace name
12128 !! options
12129 parsoid=wt2html,wt2wt,html2html
12130 !! wikitext
12131 [[Image:Foobar.jpg|50px|middle]]
12132 !! html/parsoid
12133 <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>
12134 !! end
12136 !! test
12137 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12138 !! wikitext
12139 [[File:Foobar.jpg|500x10px|baseline|caption]]
12140 !! html/parsoid
12141 <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>
12142 !! end
12144 !! test
12145 Parsoid-specific image handling - simple image with border and size spec
12146 !! wikitext
12147 [[File:Foobar.jpg|50px|border|caption]]
12148 !! html/parsoid
12149 <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>
12150 !! end
12152 !! test
12153 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12154 !! wikitext
12155 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12156 !! html/parsoid
12157 <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>
12158 !! end
12160 !! test
12161 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12162 (existing content)
12163 !! wikitext
12164 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12165 !! html/parsoid
12166 <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>
12167 !! end
12169 !! test
12170 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12171 !! wikitext
12172 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12173 !! html/parsoid
12174 <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>
12175 !! end
12177 !! test
12178 Parsoid-specific image handling - thumbnail with specific size, halign,
12179 valign, and caption (existing content)
12180 !! wikitext
12181 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12182 !! html/parsoid
12183 <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>
12184 !! end
12186 !! test
12187 Parsoid-specific image handling - framed image with specific size and caption
12188 (size is ignored)
12189 !! options
12190 parsoid=wt2html,wt2wt,html2html
12191 !! wikitext
12192 [[File:Foobar.jpg|frame|500x50px|caption]]
12193 !! html/parsoid
12194 <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>
12195 !! end
12197 !! test
12198 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12199 (size is ignored)
12200 !! options
12201 parsoid=wt2html,wt2wt,html2html
12202 !! wikitext
12203 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12204 !! html/parsoid
12205 <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>
12206 !! end
12208 !! test
12209 Parsoid-specific image handling - frameless image with specific size, border, and caption
12210 !! wikitext
12211 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12212 !! html/parsoid
12213 <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>
12214 !! end
12216 !! test
12217 Parsoid-specific image handling - simple image with a formatted caption
12218 !! wikitext
12219 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12220 !! html/parsoid
12221 <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>
12222 !! end
12224 !! test
12225 Parsoid-specific image handling - caption with a template in it
12226 !! wikitext
12227 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12228 !! html/parsoid
12229 <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>
12230 !! end
12232 !! test
12233 Parsoid-specific image handling - caption with unbalanced tags in it
12234 !! options
12235 parsoid=wt2html,wt2wt,html2html
12236 !! wikitext
12238 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12240 !! html/parsoid
12241 <p>foo</p>
12242 <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>
12243 <p>bar</p>
12244 !! end
12246 !! test
12247 Parsoid-specific image handling - empty caption (1)
12248 !! options
12249 parsoid=wt2html,wt2wt
12250 !! wikitext
12251 [[File:Foobar.jpg|thumb|]]
12252 !! html/parsoid
12253 <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>
12254 !! end
12256 # empty captions don't get serialized unless we're in the "round trip" case
12257 !! test
12258 Parsoid-specific image handling - empty caption (2)
12259 !! options
12260 parsoid=html2wt
12261 !! html/parsoid
12262 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12263   <a href="File:Foobar.jpg">
12264     <img resource="./File:Foobar.jpg"
12265          src="//example.com/images/3/3a/Foobar.jpg"
12266          height="25" width="220"/>
12267   </a>
12268   <figcaption></figcaption>
12269 </figure>
12270 !! wikitext
12271 [[File:Foobar.jpg|thumb]]
12272 !! end
12274 !! test
12275 Parsoid-specific image handling - whitespace caption
12276 !! wikitext
12277 [[File:Foobar.jpg|thumb| ]]
12278 !! html/parsoid
12279 <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>
12280 !! end
12282 !! test
12283 Parsoid-specific image handling - lang option
12284 !! wikitext
12286 [[File:Foobar.svg|lang=de|caption]]
12288 !! html/parsoid
12289 <p>foo
12290 <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>
12291 bar</p>
12292 !! end
12296 ### Subpages
12298 !! article
12299 Subpage test/subpage
12300 !! text
12302 !! endarticle
12304 !! test
12305 Subpage link
12306 !! options
12307 subpage title=[[Subpage test]]
12308 !! wikitext
12309 [[/subpage]]
12310 !! html
12311 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12312 </p>
12313 !! end
12315 !! test
12316 Subpage noslash link
12317 !! options
12318 subpage title=[[Subpage test]]
12319 !! wikitext
12320 [[/subpage/]]
12321 !! html
12322 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12323 </p>
12324 !! end
12326 # TODO: make this PHP-parser compatible!
12327 !! test
12328 Relative subpage noslash link
12329 !! options
12330 parsoid=wt2wt,wt2html,html2html
12331 subpage title=[[Subpage test/1/2/3/4]]
12332 !! wikitext
12333 [[../../subpage/]]
12335 [[../../subpage]]
12336 !! html
12337 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p>
12338 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12339 !! end
12341 !! test
12342 Parsoid: dot-slash prefixed wikilinks
12343 !! wikitext
12344 [[./foo]]
12346 [[././bar]]
12348 [[././baz/]]
12349 !! html/php
12350 <p>[[./foo]]
12351 </p><p>[[././bar]]
12352 </p><p>[[././baz/]]
12353 </p>
12354 !! html/parsoid
12355 <p>[[./foo]]
12356 </p><p>[[././bar]]
12357 </p><p>[[././baz/]]
12358 </p>
12359 !! end
12361 !! test
12362 Render invalid page names as plain text (bug 51090)
12363 !! wikitext
12364 [[./../foo|bar]]
12365 [[foo�|bar]]
12366 [[foo/.|bar]]
12367 [[foo/..|bar]]
12368 [[foo~~~bar]]
12369 [[foo>bar]]
12370 [[foo[bar]]
12371 [[.]]
12372 [[..]]
12373 [[foo././bar]]
12375 [[{{echo|./../foo}}|bar]]
12376 [[{{echo|foo/.}}|bar]]
12377 [[{{echo|foo/..}}|bar]]
12378 [[{{echo|foo~~~~bar}}]]
12379 [[{{echo|foo>bar}}]]
12380 [[{{echo|foo././bar}}]]
12381 [[{{echo|foo{bar}}]]
12382 [[{{echo|foo}bar}}]]
12383 [[{{echo|foo[bar}}]]
12384 [[{{echo|foo]bar}}]]
12385 [[{{echo|foo<bar}}]]
12386 !!html/php
12387 <p>[[./../foo|bar]]
12388 [[foo�|bar]]
12389 [[foo/.|bar]]
12390 [[foo/..|bar]]
12391 [[foo~~~bar]]
12392 [[foo&gt;bar]]
12393 [[foo[bar]]
12394 [[.]]
12395 [[..]]
12396 [[foo././bar]]
12397 </p><p>[[./../foo|bar]]
12398 [[foo/.|bar]]
12399 [[foo/..|bar]]
12400 [[foo~~~~bar]]
12401 [[foo&gt;bar]]
12402 [[foo././bar]]
12403 [[foo{bar]]
12404 [[foo}bar]]
12405 [[foo[bar]]
12406 [[foo]bar]]
12407 [[foo&lt;bar]]
12408 </p>
12409 !!html/parsoid
12410 <p>[[./../foo|bar]]
12411 [[foo�|bar]]
12412 [[foo/.|bar]]
12413 [[foo/..|bar]]
12414 [[foo~~~bar]]
12415 [[foo>bar]]
12416 [[foo[bar]]
12417 [[.]]
12418 [[..]]
12419 [[foo././bar]]</p>
12421 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12422 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12423 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12424 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12425 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12426 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12427 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12428 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12429 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12430 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12431 [[<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>
12432 !!end
12434 !! test
12435 Disabled subpages
12436 !! wikitext
12437 [[/subpage]]
12438 !! html
12439 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12440 </p>
12441 !! end
12443 !! test
12444 BUG 561: {{/Subpage}}
12445 !! options
12446 subpage title=[[Page]]
12447 !! wikitext
12448 {{/Subpage}}
12449 !! html
12450 <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>
12451 </p>
12452 !! end
12455 ### Categories
12457 !! article
12458 Category:MediaWiki User's Guide
12459 !! text
12460 blah
12461 !! endarticle
12463 !! test
12464 Link to category
12465 !! wikitext
12466 [[:Category:MediaWiki User's Guide]]
12467 !! html
12468 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12469 </p>
12470 !! end
12472 !! test
12473 Simple category
12474 !! options
12476 !! wikitext
12477 [[Category:MediaWiki User's Guide]]
12478 !! html
12479 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12480 !! end
12482 !! test
12483 PAGESINCATEGORY invalid title fatal (r33546 fix)
12484 !! wikitext
12485 {{PAGESINCATEGORY:<bogus>}}
12486 !! html
12487 <p>0
12488 </p>
12489 !! end
12491 !! test
12492 Category with different sort key
12493 !! options
12495 !! wikitext
12496 [[Category:MediaWiki User's Guide|Foo]]
12497 !! html
12498 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12499 !! end
12501 !! test
12502 Category with identical sort key
12503 !! options
12505 !! wikitext
12506 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12507 !! html
12508 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12509 !! end
12511 !! test
12512 Category with empty sort key
12513 !! options
12516 !! wikitext
12517 [[Category:MediaWiki User's Guide|]]
12518 !! html
12519 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12520 !! end
12522 !! test
12523 Category with empty sort key and parentheses
12524 !! options
12527 !! wikitext
12528 [[Category:Foo (bar)|]]
12529 !! html
12530 [[Category:Foo (bar)|Foo]]
12531 !! end
12533 !! test
12534 Category with link tail
12535 !! options
12538 !! wikitext
12539 123[[Category:Foo]]456
12540 !! html
12541 123[[Category:Foo]]456
12542 !! end
12544 !! test
12545 Category with template
12546 !! options
12549 !! wikitext
12550 [[Category:{{echo|Foo}}]]
12551 !! html
12552 [[Category:{{echo|Foo}}]]
12553 !! end
12555 !! test
12556 Category with template in sort key
12557 !! options
12560 !! wikitext
12561 [[Category:Foo|{{echo|Bar}}]]
12562 !! html
12563 [[Category:Foo|{{echo|Bar}}]]
12564 !! end
12566 !! test
12567 Category with template in sort key and title
12568 !! options
12571 !! wikitext
12572 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12573 !! html
12574 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12575 !! end
12577 !! test
12578 Category / paragraph interactions
12579 !! wikitext
12580 Foo [[Category:Baz]] Bar
12582 Foo [[Category:Baz]]
12586 [[Category:Baz]]
12590 [[Category:Baz]] Bar
12593 [[Category:Baz]]
12594  [[Category:Baz]]
12595 [[Category:Baz]]
12598 [[Category:Baz]]
12599  [[Category:Baz]]
12600 [[Category:Baz]]
12602 [[Category:Baz]]
12603  {{echo|[[Category:Baz]]}}
12604 [[Category:Baz]]
12605 !! html
12606 <p>Foo Bar
12607 </p><p>Foo
12609 </p><p>Foo
12611 </p><p>Foo Bar
12612 </p><p>Foo
12614 </p>
12615 !! end
12617 !! test
12618 Parsoid: Serialize link to category page with colon escape
12619 !! options
12620 parsoid
12621 !! wikitext
12623 [[:Category:Foo]]
12624 [[:Category:Foo|Bar]]
12625 !! html
12627 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12628 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12629 </p>
12630 !! end
12632 !! test
12633 Parsoid: Link prefix/suffixes aren't applied to category links
12634 !! options
12635 parsoid=wt2html,wt2wt,html2html
12636 language=is
12637 !! wikitext
12638 x[[Category:Foo]]y
12639 !! html
12640 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12641 !! end
12643 !! test
12644 Parsoid: Serialize link to file page with colon escape
12645 !! options
12646 parsoid
12647 !! wikitext
12649 [[:File:Foo.png]]
12650 [[:File:Foo.png|Bar]]
12651 !! html
12653 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12654 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12655 </p>
12656 !! end
12658 !! test
12659 Parsoid: Serialize a genuine category link without colon escape
12660 !! options
12661 parsoid
12662 !! wikitext
12663 [[Category:Foo]]
12664 [[Category:Foo|Bar]]
12665 !! html
12666 <link rel="mw:PageProp/Category" href="Category:Foo">
12667 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12668 !! end
12670 !! test
12671 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12672 !! options
12673 parsoid=html2wt
12674 !! html
12675 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12676 !! wikitext
12677 [[Category:Toxine bactérienne]]
12678 !! end
12680 !! test
12681 Parsoid: Defaultsort
12682 !! options
12683 parsoid
12684 !! wikitext
12685 {{DEFAULTSORT:Foo}}
12686 !! html
12687 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12688 !! end
12691 ### Inter-language links
12693 !! test
12694 Interlanguage links
12695 !! options
12697 !! wikitext
12698 [[es:Alimento]]
12699 [[fr:Nourriture]]
12700 [[zh:食品]]
12701 !! html/php
12702 es:Alimento fr:Nourriture zh:食品
12703 !! html/parsoid
12704 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
12705 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
12706 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
12707 !! end
12709 !! test
12710 Duplicate interlanguage links (bug 24502)
12711 !! options
12713 !! wikitext
12714 [[es:1]]
12715 [[es:2]]
12716 [[fr:1]]
12717 [[fr:2]]
12718 !! html/php
12719 es:1 fr:1
12720 !! html/parsoid
12721 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
12722 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
12723 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
12724 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
12725 !! end
12728 ### Sections
12730 !! test
12731 Basic section headings
12732 !! wikitext
12733 == Headline 1 ==
12734 Some text
12736 ==Headline 2==
12737 More
12738 ===Smaller headline===
12739 Blah blah
12740 !! html
12741 <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>
12742 <p>Some text
12743 </p>
12744 <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>
12745 <p>More
12746 </p>
12747 <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>
12748 <p>Blah blah
12749 </p>
12750 !! end
12752 !! test
12753 Section headings with TOC
12754 !! wikitext
12755 == Headline 1 ==
12756 === Subheadline 1 ===
12757 ===== Skipping a level =====
12758 ====== Skipping a level ======
12760 == Headline 2 ==
12761 Some text
12762 ===Another headline===
12763 !! html
12764 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12765 <ul>
12766 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12767 <ul>
12768 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12769 <ul>
12770 <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>
12771 <ul>
12772 <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>
12773 </ul>
12774 </li>
12775 </ul>
12776 </li>
12777 </ul>
12778 </li>
12779 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12780 <ul>
12781 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12782 </ul>
12783 </li>
12784 </ul>
12785 </div>
12787 <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>
12788 <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>
12789 <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>
12790 <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>
12791 <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>
12792 <p>Some text
12793 </p>
12794 <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>
12796 !! end
12798 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12799 !! test
12800 Handling of sections up to level 6 and beyond
12801 !! wikitext
12802 = Level 1 Heading=
12803 == Level 2 Heading==
12804 === Level 3 Heading===
12805 ==== Level 4 Heading====
12806 ===== Level 5 Heading=====
12807 ====== Level 6 Heading======
12808 ======= Level 7 Heading=======
12809 ======== Level 8 Heading========
12810 ========= Level 9 Heading=========
12811 ========== Level 10 Heading==========
12812 !! html
12813 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12814 <ul>
12815 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12816 <ul>
12817 <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>
12818 <ul>
12819 <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>
12820 <ul>
12821 <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>
12822 <ul>
12823 <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>
12824 <ul>
12825 <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>
12826 <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>
12827 <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>
12828 <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>
12829 <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>
12830 </ul>
12831 </li>
12832 </ul>
12833 </li>
12834 </ul>
12835 </li>
12836 </ul>
12837 </li>
12838 </ul>
12839 </li>
12840 </ul>
12841 </div>
12843 <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>
12844 <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>
12845 <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>
12846 <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>
12847 <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>
12848 <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>
12849 <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>
12850 <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>
12851 <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>
12852 <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>
12854 !! end
12856 !! test
12857 TOC regression (bug 9764)
12858 !! wikitext
12859 == title 1 ==
12860 === title 1.1 ===
12861 ==== title 1.1.1 ====
12862 === title 1.2 ===
12863 == title 2 ==
12864 === title 2.1 ===
12865 !! html
12866 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12867 <ul>
12868 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12869 <ul>
12870 <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>
12871 <ul>
12872 <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>
12873 </ul>
12874 </li>
12875 <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>
12876 </ul>
12877 </li>
12878 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12879 <ul>
12880 <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>
12881 </ul>
12882 </li>
12883 </ul>
12884 </div>
12886 <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>
12887 <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>
12888 <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>
12889 <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>
12890 <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>
12891 <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>
12893 !! end
12895 !! test
12896 TOC with wgMaxTocLevel=3 (bug 6204)
12897 !! options
12898 wgMaxTocLevel=3
12899 !! wikitext
12900 == title 1 ==
12901 === title 1.1 ===
12902 ==== title 1.1.1 ====
12903 === title 1.2 ===
12904 == title 2 ==
12905 === title 2.1 ===
12906 !! html
12907 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12908 <ul>
12909 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12910 <ul>
12911 <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>
12912 <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>
12913 </ul>
12914 </li>
12915 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12916 <ul>
12917 <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>
12918 </ul>
12919 </li>
12920 </ul>
12921 </div>
12923 <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>
12924 <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>
12925 <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>
12926 <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>
12927 <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>
12928 <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>
12930 !! end
12932 !! test
12933 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12934 !! options
12935 wgMaxTocLevel=3
12936 !! wikitext
12937 ==Section 1==
12938 ===Section 1.1===
12939 ====Section 1.1.1====
12940 ====Section 1.1.1.1====
12941 ==Section 2==
12942 !! html
12943 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12944 <ul>
12945 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12946 <ul>
12947 <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>
12948 </ul>
12949 </li>
12950 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12951 </ul>
12952 </div>
12954 <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>
12955 <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>
12956 <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>
12957 <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>
12958 <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>
12960 !! end
12963 !! test
12964 Resolving duplicate section names
12965 !! wikitext
12966 == Foo bar ==
12967 == Foo bar ==
12968 !! html
12969 <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>
12970 <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>
12972 !! end
12974 !! test
12975 Resolving duplicate section names with differing case (bug 10721)
12976 !! wikitext
12977 == Foo bar ==
12978 == Foo Bar ==
12979 !! html
12980 <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>
12981 <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>
12983 !! end
12985 !! article
12986 Template:sections
12987 !! text
12988 ===Section 1===
12989 ==Section 2==
12990 !! endarticle
12992 !! test
12993 Template with sections, __NOTOC__
12994 !! wikitext
12995 __NOTOC__
12996 ==Section 0==
12997 {{sections}}
12998 ==Section 4==
12999 !! html
13000 <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>
13001 <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>
13002 <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>
13003 <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>
13005 !! end
13007 !! test
13008 __NOEDITSECTION__ keyword
13009 !! wikitext
13010 __NOEDITSECTION__
13011 ==Section 1==
13012 ==Section 2==
13013 !! html
13014 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13015 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13017 !! end
13019 !! test
13020 Link inside a section heading
13021 !! wikitext
13022 ==Section with a [[Main Page|link]] in it==
13023 !! html
13024 <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>
13026 !! end
13028 !! test
13029 TOC regression (bug 12077)
13030 !! wikitext
13031 __TOC__
13032 == title 1 ==
13033 === title 1.1 ===
13034 == title 2 ==
13035 !! html
13036 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13037 <ul>
13038 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13039 <ul>
13040 <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>
13041 </ul>
13042 </li>
13043 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13044 </ul>
13045 </div>
13047 <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>
13048 <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>
13049 <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>
13051 !! end
13053 !! test
13054 BUG 1219 URL next to image (good)
13055 !! wikitext
13056 http://example.com [[Image:foobar.jpg]]
13057 !! html
13058 <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>
13059 </p>
13060 !!end
13062 !! test
13063 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13064 !! wikitext
13065 === 
13066 The line above must have a trailing space!
13067 === <!--
13068 --> <!-- -->
13069 But just in case it doesn't...
13070 !! html
13071 <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>
13072 <p>The line above must have a trailing space!
13073 </p>
13074 <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>
13075 <p>But just in case it doesn't...
13076 </p>
13077 !! end
13079 !! test
13080 Header with special characters (bug 25462)
13081 !! wikitext
13082 The tooltips shall not show entities to the user (ie. be double escaped)
13084 == text > text ==
13085 section 1
13087 == text < text ==
13088 section 2
13090 == text & text ==
13091 section 3
13093 == text ' text ==
13094 section 4
13096 == text " text ==
13097 section 5
13098 !! html
13099 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13100 </p>
13101 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13102 <ul>
13103 <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>
13104 <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>
13105 <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>
13106 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13107 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13108 </ul>
13109 </div>
13111 <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>
13112 <p>section 1
13113 </p>
13114 <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>
13115 <p>section 2
13116 </p>
13117 <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>
13118 <p>section 3
13119 </p>
13120 <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>
13121 <p>section 4
13122 </p>
13123 <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>
13124 <p>section 5
13125 </p>
13126 !! end
13128 !! test
13129 Header with space, plus and underscore as entity
13130 !! wikitext
13131 Id should not contain + for spaces
13133 == Space between Text ==
13134 section 1
13136 == Space-Entity&#32;between&#32;Text ==
13137 section 2
13139 == Plus+between+Text ==
13140 section 3
13142 == Plus-Entity&#43;between&#43;Text ==
13143 section 4
13145 == Underscore_between_Text ==
13146 section 5
13148 == Underscore-Entity&#95;between&#95;Text ==
13149 section 6
13151 [[#Space between Text]]
13152 [[#Space-Entity&#32;between&#32;Text]]
13153 [[#Plus+between+Text]]
13154 [[#Plus-Entity&#43;between&#43;Text]]
13155 [[#Underscore_between_Text]]
13156 [[#Underscore-Entity&#95;between&#95;Text]]
13157 !! html
13158 <p>Id should not contain + for spaces
13159 </p>
13160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13161 <ul>
13162 <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>
13163 <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>
13164 <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>
13165 <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>
13166 <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>
13167 <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>
13168 </ul>
13169 </div>
13171 <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>
13172 <p>section 1
13173 </p>
13174 <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>
13175 <p>section 2
13176 </p>
13177 <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>
13178 <p>section 3
13179 </p>
13180 <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>
13181 <p>section 4
13182 </p>
13183 <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>
13184 <p>section 5
13185 </p>
13186 <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>
13187 <p>section 6
13188 </p><p><a href="#Space_between_Text">#Space between Text</a>
13189 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13190 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13191 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13192 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13193 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13194 </p>
13195 !! end
13197 !! test
13198 Headers with excess '=' characters
13199 (Are similar tests necessary beyond the 1st level?)
13200 !! wikitext
13201 =foo==
13202 ==foo=
13203 =''italic'' heading==
13204 ==''italic'' heading=
13205 !! html
13206 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13207 <ul>
13208 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13209 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13210 <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>
13211 <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>
13212 </ul>
13213 </div>
13215 <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>
13216 <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>
13217 <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>
13218 <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>
13220 !! end
13222 !! test
13223 HTML headers vs TOC (bug 23393)
13224 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13225 !! wikitext
13226 <h1>Header 1</h1>
13227 == Header 1.1 ==
13228 == Header 1.2 ==
13230 <h1>Header 2
13231 </h1>
13232 == Header 2.1 ==
13233 == Header 2.2 ==
13234 __NOEDITSECTION__
13235 !! html
13236 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13237 <ul>
13238 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13239 <ul>
13240 <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>
13241 <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>
13242 </ul>
13243 </li>
13244 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13245 <ul>
13246 <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>
13247 <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>
13248 </ul>
13249 </li>
13250 </ul>
13251 </div>
13253 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13254 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13255 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13256 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13257 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13258 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13260 !! end
13262 !! test
13263 Single-line or multiline-comments can follow headings
13264 !! options
13265 parsoid=wt2html,wt2wt
13266 !! wikitext
13267 ==foo==<!---->
13268 ==bar==<!--c1-->
13269 ==baz==<!--
13271 c3-->
13272 !! html
13273 <h2><span class="mw-headline" id="foo">foo</span></h2>
13274 <h2><span class="mw-headline" id="bar">bar</span></h2>
13275 <h2><span class="mw-headline" id="baz">baz</span></h2>
13277 !! end
13279 !! test
13280 BUG 1219 URL next to image (broken)
13281 !! wikitext
13282 http://example.com[[Image:foobar.jpg]]
13283 !! html
13284 <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>
13285 </p>
13286 !!end
13288 !! test
13289 Bug 1186 news: in the middle of text
13290 !! wikitext
13291 http://en.wikinews.org/wiki/Wikinews:Workplace
13292 !! html
13293 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13294 </p>
13295 !!end
13298 !! test
13299 Namespaced link must have a title
13300 !! wikitext
13301 [[Project:]]
13302 !! html
13303 <p>[[Project:]]
13304 </p>
13305 !!end
13307 !! test
13308 Namespaced link must have a title (bad fragment version)
13309 !! wikitext
13310 [[Project:#fragment]]
13311 !! html
13312 <p>[[Project:#fragment]]
13313 </p>
13314 !!end
13318 ### HTML tags and HTML attributes
13321 !! test
13322 div with no attributes
13323 !! wikitext
13324 <div>HTML rocks</div>
13325 !! html
13326 <div>HTML rocks</div>
13328 !! end
13330 !! test
13331 div with double-quoted attribute
13332 !! wikitext
13333 <div id="rock">HTML rocks</div>
13334 !! html
13335 <div id="rock">HTML rocks</div>
13337 !! end
13339 !! test
13340 div with single-quoted attribute
13341 !! wikitext
13342 <div id='rock'>HTML rocks</div>
13343 !! html
13344 <div id="rock">HTML rocks</div>
13346 !! end
13348 !! test
13349 div with unquoted attribute
13350 !! wikitext
13351 <div id=rock>HTML rocks</div>
13352 !! html
13353 <div id="rock">HTML rocks</div>
13355 !! end
13357 !! test
13358 div with illegal double attributes
13359 !! wikitext
13360 <div id="a" id="b">HTML rocks</div>
13361 !! html
13362 <div id="b">HTML rocks</div>
13364 !!end
13366 # FIXME: produce empty string instead of "class" in the PHP parser, following
13367 # the HTML5 spec.
13368 !! test
13369 div with empty attribute value, space before equals
13370 !! options
13371 parsoid
13372 !! wikitext
13373 <div class =>HTML rocks</div>
13374 !! html
13375 <div class="">HTML rocks</div>
13377 !! end
13379 !! test
13380 div with multiple empty attribute values
13381 !! options
13382 parsoid
13383 !! wikitext
13384 <div id= title=>HTML rocks</div>
13385 !! html
13386 <div id="" title="">HTML rocks</div>
13388 !! end
13390 !! test
13391 table with multiple empty attribute values
13392 !! options
13393 parsoid
13394 !! wikitext
13395 {| title= id=
13396 | hi
13398 !! html
13399 <table title="" id="">
13400 <tbody><tr><td> hi</td></tr>
13401 </tbody></table>
13402 !! end
13404 !! test
13405 div with braces in attribute value
13406 !! wikitext
13407 <div title="{}">Foo</div>
13408 !! html/php
13409 <div title="&#123;}">Foo</div>
13411 !! html/parsoid
13412 <div title="{}">Foo</div>
13413 !! end
13415 # This it very inconsistent in the PHP parser: it returns 
13416 # class="class" if there is a space between the name and the equal sign (see
13417 # 'div with empty attribute value, space before equals'), but strips the
13418 # attribute completely if the space is missing. We hope that not much content
13419 # depends on this, so are implementing the behavior below in Parsoid for
13420 # consistencies' sake.
13421 # FIXME: fix this behavior in the PHP parser?
13422 !! test
13423 div with empty attribute value, no space before equals
13424 !! options
13425 parsoid=wt2html,html2html
13426 !! wikitext
13427 <div class=>HTML rocks</div>
13428 !! html/php
13429 <div>HTML rocks</div>
13431 !! html/parsoid
13432 <div class="">HTML rocks</div>
13433 !! end
13435 !! test
13436 HTML multiple attributes correction
13437 !! wikitext
13438 <p class="error" class="awesome">Awesome!</p>
13439 !! html
13440 <p class="awesome">Awesome!</p>
13442 !!end
13444 !! test
13445 Table multiple attributes correction
13446 !! wikitext
13448 !+ class="error" class="awesome"| status
13450 !! html
13451 <table>
13452 <tr>
13453 <th class="awesome"> status
13454 </th></tr></table>
13456 !!end
13458 !! test
13459 DIV IN UPPERCASE
13460 !! wikitext
13461 <DIV ID="x">HTML ROCKS</DIV>
13462 !! html
13463 <div id="x">HTML ROCKS</div>
13465 !!end
13467 !! test
13468 Non-ASCII pseudo-tags are rendered as text
13469 !! wikitext
13470 <khyô>
13471 !! html
13472 <p>&lt;khyô&gt;
13473 </p>
13474 !! end
13476 !! test
13477 Pseudo-tag with URL 'name' renders as url link
13478 !! wikitext
13479 <http://example.com/>
13480 !! html
13481 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13482 </p>
13483 !! end
13485 !! test
13486 text with amp in the middle of nowhere
13487 !! wikitext
13488 Remember AT&T?
13489 !! html
13490 <p>Remember AT&amp;T?
13491 </p>
13492 !! end
13494 !! test
13495 text with character entity: eacute
13496 !! wikitext
13497 I always thought &eacute; was a cute letter.
13498 !! html
13499 <p>I always thought &#233; was a cute letter.
13500 </p>
13501 !! html+tidy
13502 <p>I always thought é was a cute letter.</p>
13503 !! end
13505 !! test
13506 text with entity-escaped character entity-like string: eacute
13507 !! wikitext
13508 I always thought &amp;eacute; was a cute letter.
13509 !! html
13510 <p>I always thought &amp;eacute; was a cute letter.
13511 </p>
13512 !! end
13514 !! test
13515 text with undefined character entity: xacute
13516 !! wikitext
13517 I always thought &xacute; was a cute letter.
13518 !! html
13519 <p>I always thought &amp;xacute; was a cute letter.
13520 </p>
13521 !! end
13523 # TODO: generalize to PHP parser?
13524 !! test
13525 HTML5 tags
13526 !! options
13527 parsoid
13528 !! wikitext
13529 <data value="5">five</data>
13530 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13531 <mark>This highlighted text</mark>
13532 !! html
13533 <p><data value="5">five</data>
13534 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13535 <mark>This highlighted text</mark></p>
13536 !! end
13538 !! test
13539 HTML tag with leading space is parsed as text
13540 !! wikitext
13541 < div>foo< /div>
13542 !! html
13543 <p>&lt; div&gt;foo&lt; /div&gt;
13544 </p>
13545 !! end
13548 ### Nesting tests (see bug 41545, 50604, 51081)
13551 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13552 # Note that html2wt is considerably more difficult if we use <b> in
13553 # the test case, instead of <big>
13554 !! test
13555 Ensure that HTML adoption agency algorithm is properly implemented.
13556 !! wikitext
13557 <big>X<big>Y</big>Z</big>
13558 !! html
13559 <p><big>X<big>Y</big>Z</big>
13560 </p>
13561 !! end
13563 # This was bug 41545 in the PHP parser.
13564 # Note that tidy doesn't handle this correctly.
13565 !! test
13566 Nesting of <kbd>
13567 !! wikitext
13568 <kbd>X<kbd>Y</kbd>Z</kbd>
13569 !! html
13570 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13571 </p>
13572 !! end
13574 # The following cases were bug 51081 in the PHP parser.
13575 # Note that there are some other nestable tags (b, i, etc) which are
13576 # not covered; see bug 51081 for discussion.
13578 # Note that tidy doesn't handle this correctly.
13579 !! test
13580 Nesting of <em>
13581 !! wikitext
13582 <em>X<em>Y</em>Z</em>
13583 !! html
13584 <p><em>X<em>Y</em>Z</em>
13585 </p>
13586 !! end
13588 # Note that tidy doesn't handle this correctly.
13589 !! test
13590 Nesting of <strong>
13591 !! wikitext
13592 <strong>X<strong>Y</strong>Z</strong>
13593 !! html
13594 <p><strong>X<strong>Y</strong>Z</strong>
13595 </p>
13596 !! end
13598 !! test
13599 Nesting of <q>
13600 !! wikitext
13601 <q>X<q>Y</q>Z</q>
13602 !! html+tidy
13603 <p><q>X<q>Y</q>Z</q></p>
13604 !! end
13606 # Note that tidy doesn't handle this correctly.
13607 !! test
13608 Nesting of <ruby>
13609 !! wikitext
13610 <ruby>X<ruby>Y</ruby>Z</ruby>
13611 !! html
13612 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13613 </p>
13614 !! end
13616 # Note that tidy doesn't handle this correctly.
13617 !! test
13618 Nesting of <bdo>
13619 !! wikitext
13620 <bdo>X<bdo>Y</bdo>Z</bdo>
13621 !! html
13622 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13623 </p>
13624 !! end
13628 ### Media links
13631 !! test
13632 Media link
13633 !! wikitext
13634 [[Media:Foobar.jpg]]
13635 !! html
13636 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13637 </p>
13638 !! end
13640 !! test
13641 Media link with text
13642 !! wikitext
13643 [[Media:Foobar.jpg|A neat file to look at]]
13644 !! html
13645 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13646 </p>
13647 !! end
13649 # FIXME: this is still bad HTML tag nesting
13650 !! test
13651 Media link with nasty text
13652 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13653 !! wikitext
13654 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13655 !! html
13656 <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>
13658 !! html+tidy
13659 <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>
13660 !! end
13662 !! test
13663 Media link to nonexistent file (bug 1702)
13664 !! wikitext
13665 [[Media:No such.jpg]]
13666 !! html
13667 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13668 </p>
13669 !! end
13671 !! test
13672 Image link to nonexistent file (bug 1850 - good)
13673 !! wikitext
13674 [[Image:No such.jpg]]
13675 !! html
13676 <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>
13677 </p>
13678 !! end
13680 !! test
13681 :Image link to nonexistent file (bug 1850 - bad)
13682 !! wikitext
13683 [[:Image:No such.jpg]]
13684 !! html
13685 <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>
13686 </p>
13687 !! end
13691 !! test
13692 Character reference normalization in link text (bug 1938)
13693 !! wikitext
13694 [[Main Page|this&that]]
13695 !! html
13696 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13697 </p>
13698 !!end
13700 !! article
13701 אַ
13702 !! text
13703 Test for unicode normalization
13705 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13706 !! endarticle
13708 !! test
13709 (bug 19451) Links should refer to the normalized form.
13710 !! wikitext
13711 [[&#xFB2E;]]
13712 [[&#x5d0;&#x5b7;]]
13713 [[&#x5d0;ַ]]
13714 [[א&#x5b7;]]
13715 [[אַ]]
13716 !! html
13717 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13718 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13719 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13720 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13721 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13722 </p>
13723 !! end
13725 !! test
13726 Empty attribute crash test (bug 2067)
13727 !! wikitext
13728 <font color="">foo</font>
13729 !! html
13730 <p><font color="">foo</font>
13731 </p>
13732 !! end
13734 !! test
13735 Empty attribute crash test single-quotes (bug 2067)
13736 !! wikitext
13737 <font color=''>foo</font>
13738 !! html
13739 <p><font color="">foo</font>
13740 </p>
13741 !! end
13743 !! test
13744 Attribute test: equals, then nothing
13745 !! wikitext
13746 <font color=>foo</font>
13747 !! html
13748 <p><font>foo</font>
13749 </p>
13750 !! end
13752 !! test
13753 Attribute test: unquoted value
13754 !! wikitext
13755 <font color=x>foo</font>
13756 !! html
13757 <p><font color="x">foo</font>
13758 </p>
13759 !! end
13761 !! test
13762 Attribute test: unquoted but illegal value (hash)
13763 !! wikitext
13764 <font color=#x>foo</font>
13765 !! html
13766 <p><font color="#x">foo</font>
13767 </p>
13768 !! end
13770 !! test
13771 Attribute test: no value
13772 !! wikitext
13773 <font color>foo</font>
13774 !! html
13775 <p><font color="color">foo</font>
13776 </p>
13777 !! end
13779 !! test
13780 Bug 2095: link with three closing brackets
13781 !! wikitext
13782 [[Main Page]]]
13783 !! html/php
13784 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13785 </p>
13786 !! html/parsoid
13787 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13788 !! end
13790 !! test
13791 Bug 2095: link with pipe and three closing brackets
13792 !! wikitext
13793 [[Main Page|link]]]
13794 !! html/php
13795 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13796 </p>
13797 !! html/parsoid
13798 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13799 !! end
13801 !! test
13802 Bug 2095: link with pipe and three closing brackets, version 2
13803 !! wikitext
13804 [[Main Page|[http://example.com/]]]
13805 !! html/php
13806 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13807 </p>
13808 !! html/parsoid
13809 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13810 !! end
13814 ### Safety
13817 !! article
13818 Template:Dangerous attribute
13819 !! text
13820 " onmouseover="alert(document.cookie)
13821 !! endarticle
13823 !! article
13824 Template:Dangerous style attribute
13825 !! text
13826 border-size: expression(alert(document.cookie))
13827 !! endarticle
13829 !! article
13830 Template:Div style
13831 !! text
13832 <div style="float: right; {{{1}}}">Magic div</div>
13833 !! endarticle
13835 !! test
13836 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13837 !! wikitext
13838 <div title="{{test}}"></div>
13839 !! html
13840 <div title="This is a test template"></div>
13842 !! end
13844 # Parsoid has enough context to handle this case
13845 !! test
13846 Bug 2304: HTML attribute safety (dangerous template; 2309)
13847 !! wikitext
13848 <div title="{{dangerous attribute}}"></div>
13849 !! html/php
13850 <div title=""></div>
13852 !! html/parsoid
13853 <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>
13854 !! end
13856 !! test
13857 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13858 !! wikitext
13859 <div style="{{dangerous style attribute}}"></div>
13860 !! html
13861 <div style="/* insecure input */"></div>
13863 !! end
13865 !! test
13866 Bug 2304: HTML attribute safety (safe parameter; 2309)
13867 !! wikitext
13868 {{div style|width: 200px}}
13869 !! html
13870 <div style="float: right; width: 200px">Magic div</div>
13872 !! end
13874 !! test
13875 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13876 !! wikitext
13877 {{div style|width: expression(alert(document.cookie))}}
13878 !! html
13879 <div style="/* insecure input */">Magic div</div>
13881 !! end
13883 !! test
13884 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13885 !! wikitext
13886 {{div style|"><script>alert(document.cookie)</script>}}
13887 !! html
13888 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13890 !! end
13892 !! test
13893 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13894 !! wikitext
13895 {{div style|" ><script>alert(document.cookie)</script>}}
13896 !! html
13897 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13899 !! end
13901 !! test
13902 Bug 2304: HTML attribute safety (link)
13903 !! wikitext
13904 <div title="[[Main Page]]"></div>
13905 !! html
13906 <div title="&#91;&#91;Main Page]]"></div>
13908 !! end
13910 !! test
13911 Bug 2304: HTML attribute safety (italics)
13912 !! wikitext
13913 <div title="''foobar''"></div>
13914 !! html
13915 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13917 !! end
13919 !! test
13920 Bug 2304: HTML attribute safety (bold)
13921 !! wikitext
13922 <div title="'''foobar'''"></div>
13923 !! html
13924 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13926 !! end
13929 !! test
13930 Bug 2304: HTML attribute safety (ISBN)
13931 !! wikitext
13932 <div title="ISBN 1234567890"></div>
13933 !! html
13934 <div title="&#73;SBN 1234567890"></div>
13936 !! end
13938 !! test
13939 Bug 2304: HTML attribute safety (RFC)
13940 !! wikitext
13941 <div title="RFC 1234"></div>
13942 !! html
13943 <div title="&#82;FC 1234"></div>
13945 !! end
13947 !! test
13948 Bug 2304: HTML attribute safety (PMID)
13949 !! wikitext
13950 <div title="PMID 1234567890"></div>
13951 !! html
13952 <div title="&#80;MID 1234567890"></div>
13954 !! end
13956 !! test
13957 Bug 2304: HTML attribute safety (web link)
13958 !! wikitext
13959 <div title="http://example.com/"></div>
13960 !! html
13961 <div title="http&#58;//example.com/"></div>
13963 !! end
13965 !! test
13966 Bug 2304: HTML attribute safety (named web link)
13967 !! wikitext
13968 <div title="[http://example.com/ link]"></div>
13969 !! html
13970 <div title="&#91;http&#58;//example.com/ link]"></div>
13972 !! end
13974 !! test
13975 Bug 3244: HTML attribute safety (extension; safe)
13976 !! wikitext
13977 <div style="<nowiki>background:blue</nowiki>"></div>
13978 !! html
13979 <div style="background:blue"></div>
13981 !! end
13983 !! test
13984 Bug 3244: HTML attribute safety (extension; unsafe)
13985 !! wikitext
13986 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13987 !! html
13988 <div style="/* insecure input */"></div>
13990 !! end
13992 # More MSIE fun discovered by Tom Gilder
13994 !! test
13995 MSIE CSS safety test: spurious slash
13996 !! wikitext
13997 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13998 !! html
13999 <div style="/* insecure input */">evil</div>
14001 !! end
14003 !! test
14004 MSIE CSS safety test: hex code
14005 !! wikitext
14006 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14007 !! html
14008 <div style="/* insecure input */">evil</div>
14010 !! end
14012 !! test
14013 MSIE CSS safety test: comment in url
14014 !! wikitext
14015 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14016 !! html
14017 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14019 !! end
14021 !! test
14022 MSIE CSS safety test: comment in expression
14023 !! wikitext
14024 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14025 !! html
14026 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14028 !! end
14030 !! test
14031 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14032 !! wikitext
14033 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14034 !! html
14035 <p style="/* invalid control char */">A</p>
14037 !! end
14039 !! test
14040 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14041 !! wikitext
14042 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14043 <div style="top:EXPRESSION(alert())">B</div>
14044 !! html
14045 <p style="/* insecure input */">A</p>
14046 <div style="/* insecure input */">B</div>
14048 !! end
14050 !! test
14051 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14052 !! wikitext
14053 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14054 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14055 !! html
14056 <div style="/* insecure input */">A</div>
14057 <p style="/* insecure input */">B</p>
14059 !! end
14061 !! test
14062 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14063 !! wikitext
14064 <div style="background-image:url⁽javascript:alert())">A</div>
14065 <div style="background-image:url₍javascript:alert())">B</div>
14066 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14067 !! html
14068 <div style="/* insecure input */">A</div>
14069 <div style="/* insecure input */">B</div>
14070 <p style="/* insecure input */">C</p>
14072 !! end
14074 !! test
14075 Opera -o-link CSS
14076 !! wikitext
14077 <div
14078 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;"
14079 style="-o-link:attr(title);-o-link-source:current">X</div>
14080 !! html
14081 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14083 !! end
14085 !! test
14086 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14087 !! wikitext
14088 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14089 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14090 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14091 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14092 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14093 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14094 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14095 !! html
14096 <p style="/* insecure input */">A</p>
14097 <p style="/* insecure input */">B</p>
14098 <p style="/* insecure input */">C</p>
14099 <p style="/* insecure input */">D</p>
14100 <p style="/* insecure input */">E</p>
14101 <p style="/* insecure input */">F</p>
14102 <p style="/* insecure input */">G</p>
14104 !! end
14106 !! test
14107 Table attribute legitimate extension
14108 !! wikitext
14110 !+ style="<nowiki>color:blue</nowiki>"| status
14112 !! html
14113 <table>
14114 <tr>
14115 <th style="color:blue"> status
14116 </th></tr></table>
14118 !!end
14120 !! test
14121 Table attribute safety
14122 !! wikitext
14124 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14126 !! html
14127 <table>
14128 <tr>
14129 <th style="/* insecure input */"> status
14130 </th></tr></table>
14132 !! end
14134 !! test
14135 CSS line continuation 1
14136 !! wikitext
14137 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14138 !! html
14139 <div style="/* insecure input */"></div>
14141 !! end
14143 !! test
14144 CSS line continuation 2
14145 !! wikitext
14146 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14147 !! html
14148 <div style="/* insecure input */"></div>
14150 !! end
14152 !! article
14153 Template:Identity
14154 !! text
14155 {{{1}}}
14156 !! endarticle
14158 !! test
14159 Expansion of multi-line templates in attribute values (bug 6255)
14160 !! wikitext
14161 <div style="background: {{identity|#00FF00}}">-</div>
14162 !! html
14163 <div style="background: #00FF00">-</div>
14165 !! end
14168 !! test
14169 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14170 !! wikitext
14171 <div style="background: 
14172 #00FF00">-</div>
14173 !! html/php
14174 <div style="background: #00FF00">-</div>
14176 !! html/parsoid
14177 <div style="background: 
14178 #00FF00">-</div>
14179 !! end
14181 !! test
14182 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14183 !! wikitext
14184 <div style="background: &#10;#00FF00">-</div>
14185 !! html
14186 <div style="background: &#10;#00FF00">-</div>
14188 !! end
14190 !! test
14191 evil <math>-wiki-tags without Extension:Math enabled
14192 !! wikitext
14193 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14194 !! html+tidy
14195 <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>
14196 !! end
14199 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14201 !! test
14202 Parser hook: empty input
14203 !! wikitext
14204 <tag></tag>
14205 !! html
14206 <pre>
14208 array (
14210 </pre>
14212 !! end
14214 !! test
14215 Parser hook: empty input using terminated empty elements
14216 !! wikitext
14217 <tag/>
14218 !! html
14219 <pre>
14220 NULL
14221 array (
14223 </pre>
14225 !! end
14227 !! test
14228 Parser hook: empty input using terminated empty elements (space before)
14229 !! wikitext
14230 <tag />
14231 !! html
14232 <pre>
14233 NULL
14234 array (
14236 </pre>
14238 !! end
14240 !! test
14241 Parser hook: basic input
14242 !! wikitext
14243 <tag>input</tag>
14244 !! html
14245 <pre>
14246 'input'
14247 array (
14249 </pre>
14251 !! end
14254 !! test
14255 Parser hook: case insensitive
14256 !! wikitext
14257 <TAG>input</TAG>
14258 !! html
14259 <pre>
14260 'input'
14261 array (
14263 </pre>
14265 !! end
14268 !! test
14269 Parser hook: case insensitive, redux
14270 !! wikitext
14271 <TaG>input</TAg>
14272 !! html
14273 <pre>
14274 'input'
14275 array (
14277 </pre>
14279 !! end
14281 !! test
14282 Parser hook: nested tags
14283 !! options
14284 noxml
14285 !! wikitext
14286 <tag><tag></tag></tag>
14287 !! html
14288 <pre>
14289 '<tag>'
14290 array (
14292 </pre>&lt;/tag&gt;
14294 !! end
14296 !! test
14297 Parser hook: basic arguments
14298 !! wikitext
14299 <tag width=200 height = "100" depth = '50' square></tag>
14300 !! html
14301 <pre>
14303 array (
14304   'width' => '200',
14305   'height' => '100',
14306   'depth' => '50',
14307   'square' => 'square',
14309 </pre>
14311 !! end
14313 !! test
14314 Parser hook: argument containing a forward slash (bug 5344)
14315 !! wikitext
14316 <tag filename='/tmp/bla'></tag>
14317 !! html
14318 <pre>
14320 array (
14321   'filename' => '/tmp/bla',
14323 </pre>
14325 !! end
14327 !! test
14328 Parser hook: empty input using terminated empty elements (bug 2374)
14329 !! wikitext
14330 <tag foo=bar/>text
14331 !! html
14332 <pre>
14333 NULL
14334 array (
14335   'foo' => 'bar',
14337 </pre>text
14339 !! end
14341 # </tag> should be output literally since there is no matching tag that begins it
14342 !! test
14343 Parser hook: basic arguments using terminated empty elements (bug 2374)
14344 !! wikitext
14345 <tag width=200 height = "100" depth = '50' square/>
14346 other stuff
14347 </tag>
14348 !! html
14349 <pre>
14350 NULL
14351 array (
14352   'width' => '200',
14353   'height' => '100',
14354   'depth' => '50',
14355   'square' => 'square',
14357 </pre>
14358 <p>other stuff
14359 &lt;/tag&gt;
14360 </p>
14361 !! end
14364 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14367 !! test
14368 Parser hook: static parser hook not inside a comment
14369 !! wikitext
14370 <statictag>hello, world</statictag>
14371 <statictag action=flush/>
14372 !! html
14373 <p>hello, world
14374 </p>
14375 !! end
14378 !! test
14379 Parser hook: static parser hook inside a comment
14380 !! wikitext
14381 <!-- <statictag>hello, world</statictag> -->
14382 <statictag action=flush/>
14383 !! html
14384 <p><br />
14385 </p>
14386 !! end
14388 # Nested template calls; this case was broken by Parser.php rev 1.506,
14389 # since reverted.
14391 !! article
14392 Template:One-parameter
14393 !! text
14394 (My parameter is: {{{1}}})
14395 !! endarticle
14397 !! article
14398 Template:Map-one-parameter
14399 !! text
14400 {{{{{1}}}|{{{2}}}}}
14401 !! endarticle
14403 !! test
14404 Nested template calls
14405 !! wikitext
14406 {{Map-one-parameter|One-parameter|param}}
14407 !! html
14408 <p>(My parameter is: param)
14409 </p>
14410 !! end
14414 ### Sanitizer
14417 # HTML+Tidy effectively strips out the empty tags completely
14418 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14419 # which Tidy would have done for the PHP parser had there been content inside it.
14420 !! test
14421 Sanitizer: Closing of open tags
14422 !! wikitext
14423 <s></s><table></table>
14424 !! html
14425 <s></s><table></table>
14427 !! html/parsoid
14428 <p><s></s></p><table></table>
14429 !! end
14431 !! test
14432 Sanitizer: Closing of open but not closed tags
14433 !! wikitext
14434 <s>foo
14435 !! html
14436 <p><s>foo</s>
14437 </p>
14438 !! end
14440 !! test
14441 Sanitizer: Closing of closed but not open tags
14442 !! wikitext
14443 </s>
14444 !! html
14445 <p>&lt;/s&gt;
14446 </p>
14447 !! end
14449 !! test
14450 Sanitizer: Closing of closed but not open table tags
14451 !! wikitext
14452 Table not started</td></tr></table>
14453 !! html
14454 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14455 </p>
14456 !! end
14458 !! test
14459 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14460 !! wikitext
14461 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14462 !! html
14463 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14464 </p>
14465 !! end
14467 # In HTML5, the restrictions are that id must contain at least one character,
14468 # and must not contain any space characters.
14469 !! test
14470 Sanitizer: Validating the contents of the id attribute (bug 4515)
14471 !! options
14472 disabled
14473 !! wikitext
14474 <br id="" /><br id="a space" />
14475 !! html
14476 Something ...
14477 !! end
14479 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14480 !! test
14481 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14482 !! options
14483 disabled
14484 !! wikitext
14485 <br id="foo" /><br id="foo" />
14486 !! html
14487 Something need to be done. foo-2 ? 
14488 !! end
14490 !! test
14491 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14492 !! wikitext
14493 <div itemscope>
14494         <meta itemprop="hello" content="world">
14495         <meta http-equiv="refresh" content="5">
14496         <meta itemprop="hello" http-equiv="refresh" content="5">
14497         <link itemprop="hello" href="{{SERVER}}">
14498         <link rel="stylesheet" href="{{SERVER}}">
14499         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14500 </div>
14501 !! html
14502 <div itemscope="itemscope">
14503 <p>     <meta itemprop="hello" content="world" />
14504         &lt;meta http-equiv="refresh" content="5"&gt;
14505         <meta itemprop="hello" content="5" />
14506 </p>
14507         <link itemprop="hello" href="http&#58;//example.org" />
14508         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14509         <link itemprop="hello" href="http&#58;//example.org" />
14510 </div>
14512 !! end
14514 !! test
14515 Language converter: output gets cut off unexpectedly (bug 5757)
14516 !! options
14517 language=zh
14518 !! wikitext
14519 this bit is safe: }-
14521 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14523 then we get cut off here: }-
14525 all additional text is vanished
14526 !! html
14527 <p>this bit is safe: }-
14528 </p><p>but if we add a conversion instance: xxx
14529 </p><p>then we get cut off here: }-
14530 </p><p>all additional text is vanished
14531 </p>
14532 !! end
14534 !! test
14535 Self closed html pairs (bug 5487)
14536 !! options
14537 !! wikitext
14538 <center><font id="bug" />Centered text</center>
14539 <div><font id="bug2" />In div text</div>
14540 !! html
14541 <center>&lt;font id="bug" /&gt;Centered text</center>
14542 <div>&lt;font id="bug2" /&gt;In div text</div>
14544 !! end
14550 !! test
14551 Punctuation: nbsp before exclamation
14552 !! wikitext
14553 C'est grave !
14554 !! html
14555 <p>C'est grave&#160;!
14556 </p>
14557 !! end
14559 !! test
14560 Punctuation: CSS !important (bug 11874)
14561 !! wikitext
14562 <div style="width:50% !important">important</div>
14563 !! html
14564 <div style="width:50% !important">important</div>
14566 !!end
14568 !! test
14569 Punctuation: CSS ! important (bug 11874; with space after)
14570 !! wikitext
14571 <div style="width:50% ! important">important</div>
14572 !! html
14573 <div style="width:50% ! important">important</div>
14575 !!end
14578 !! test
14579 HTML bullet list, closed tags (bug 5497)
14580 !! wikitext
14581 <ul>
14582 <li>One</li>
14583 <li>Two</li>
14584 </ul>
14585 !! html/php
14586 <ul>
14587 <li>One</li>
14588 <li>Two</li>
14589 </ul>
14591 !! html/parsoid
14592 <ul data-parsoid='{"stx":"html"}'>
14593 <li data-parsoid='{"stx":"html"}'>One</li>
14594 <li data-parsoid='{"stx":"html"}'>Two</li>
14595 </ul>
14597 !! end
14599 !! test
14600 HTML bullet list, unclosed tags (bug 5497)
14601 !! wikitext
14602 <ul>
14603 <li>One
14604 <li>Two
14605 </ul>
14606 !! html/php+tidy
14607 <ul>
14608 <li>One</li>
14609 <li>Two</li>
14610 </ul>
14611 !! html/parsoid
14612 <ul data-parsoid='{"stx":"html"}'>
14613 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14614 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14615 </ul>
14617 !! end
14619 !! test
14620 HTML ordered list, closed tags (bug 5497)
14621 !! wikitext
14622 <ol>
14623 <li>One</li>
14624 <li>Two</li>
14625 </ol>
14626 !! html/php
14627 <ol>
14628 <li>One</li>
14629 <li>Two</li>
14630 </ol>
14632 !! html/parsoid
14633 <ol data-parsoid='{"stx":"html"}'>
14634 <li data-parsoid='{"stx":"html"}'>One</li>
14635 <li data-parsoid='{"stx":"html"}'>Two</li>
14636 </ol>
14638 !! end
14640 !! test
14641 HTML ordered list, unclosed tags (bug 5497)
14642 !! options
14643 !! wikitext
14644 <ol>
14645 <li>One
14646 <li>Two
14647 </ol>
14648 !! html/php+tidy
14649 <ol>
14650 <li>One</li>
14651 <li>Two</li>
14652 </ol>
14653 !! html/parsoid
14654 <ol data-parsoid='{"stx":"html"}'>
14655 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14656 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14657 </ol>
14659 !! end
14661 !! test
14662 HTML nested bullet list, closed tags (bug 5497)
14663 !! wikitext
14664 <ul>
14665 <li>One</li>
14666 <li>Two:
14667 <ul>
14668 <li>Sub-one</li>
14669 <li>Sub-two</li>
14670 </ul>
14671 </li>
14672 </ul>
14673 !! html
14674 <ul>
14675 <li>One</li>
14676 <li>Two:
14677 <ul>
14678 <li>Sub-one</li>
14679 <li>Sub-two</li>
14680 </ul>
14681 </li>
14682 </ul>
14684 !! end
14686 !! test
14687 HTML nested bullet list, open tags (bug 5497)
14688 !! wikitext
14689 <ul>
14690 <li>One
14691 <li>Two:
14692 <ul>
14693 <li>Sub-one
14694 <li>Sub-two
14695 </ul>
14696 </ul>
14697 !! html/php+tidy
14698 <ul>
14699 <li>One</li>
14700 <li>Two:
14701 <ul>
14702 <li>Sub-one</li>
14703 <li>Sub-two</li>
14704 </ul>
14705 </li>
14706 </ul>
14707 !! html/parsoid
14708 <ul>
14709 <li>One
14710 </li>
14711 <li>Two:
14712 <ul>
14713 <li>Sub-one
14714 </li>
14715 <li>Sub-two
14716 </li>
14717 </ul>
14718 </li>
14719 </ul>
14721 !! end
14723 !! test
14724 HTML nested ordered list, closed tags (bug 5497)
14725 !! wikitext
14726 <ol>
14727 <li>One</li>
14728 <li>Two:
14729 <ol>
14730 <li>Sub-one</li>
14731 <li>Sub-two</li>
14732 </ol>
14733 </li>
14734 </ol>
14735 !! html
14736 <ol>
14737 <li>One</li>
14738 <li>Two:
14739 <ol>
14740 <li>Sub-one</li>
14741 <li>Sub-two</li>
14742 </ol>
14743 </li>
14744 </ol>
14746 !! end
14748 !! test
14749 HTML nested ordered list, open tags (bug 5497)
14750 !! wikitext
14751 <ol>
14752 <li>One
14753 <li>Two:
14754 <ol>
14755 <li>Sub-one
14756 <li>Sub-two
14757 </ol>
14758 </ol>
14759 !! html/php
14760 <ol>
14761 <li>One
14762 <li>Two:
14763 <ol>
14764 <li>Sub-one
14765 <li>Sub-two
14766 </ol>
14767 </ol>
14769 !! html/parsoid
14770 <ol>
14771 <li>One
14772 </li>
14773 <li>Two:
14774 <ol>
14775 <li>Sub-one
14776 </li>
14777 <li>Sub-two
14778 </li>
14779 </ol>
14780 </li>
14781 </ol>
14783 !! end
14785 !! test
14786 HTML ordered list item with parameters oddity
14787 !! wikitext
14788 <ol><li id="fragment">One</li>
14789 </ol>
14790 !! html
14791 <ol><li id="fragment">One</li>
14792 </ol>
14794 !! end
14796 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14797 !!test
14798 bug 5918: autonumbering
14799 !! wikitext
14800 [http://first/] [http://second] [ftp://ftp]
14802 ftp://inlineftp
14804 [mailto:enclosed@mail.tld With target]
14806 [mailto:enclosed@mail.tld]
14808 mailto:inline@mail.tld
14809 !! html/php
14810 <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>
14811 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14812 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14813 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14814 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14815 </p>
14816 !! html/parsoid
14817 <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>
14818 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14819 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14820 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14821 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14822 !! end
14826 # Security and HTML correctness
14827 # From Nick Jenkins' fuzz testing
14830 !! test
14831 Fuzz testing: Parser13
14832 !! wikitext
14833 {| 
14834 | http://a|
14835 !! html
14836 <table>
14837 <tr>
14838 <td>
14839 </td>
14840 </tr>
14841 </table>
14843 !! end
14845 !! test
14846 Fuzz testing: Parser14
14847 !! wikitext
14848 == onmouseover= ==
14849 http://__TOC__
14850 !! html
14851 <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>
14852 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14853 <ul>
14854 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14855 </ul>
14856 </div>
14859 !! html+tidy
14860 <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>
14861 <p>http://</p>
14862 <div id="toc" class="toc">
14863 <div id="toctitle">
14864 <h2>Contents</h2>
14865 </div>
14866 <ul>
14867 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14868 </ul>
14869 </div>
14870 !! end
14872 !! test
14873 Fuzz testing: Parser14-table
14874 !! wikitext
14875 ==a==
14876 {| STYLE=__TOC__
14877 !! html
14878 <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>
14879 <table style="&#95;_TOC&#95;_">
14880 <tr><td></td></tr>
14881 </table>
14883 !! html+tidy
14884 <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>
14885 <table style="__TOC__">
14886 <tr>
14887 <td></td>
14888 </tr>
14889 </table>
14890 !! end
14892 # Known to produce bogus xml (extra </td>)
14893 !! test
14894 Fuzz testing: Parser16
14895 !! options
14896 noxml
14897 !! wikitext
14899 !https://||||||
14900 !! html
14901 <table>
14902 <tr>
14903 <th>https://</th>
14904 <th></th>
14905 <th></th>
14906 <th>
14907 </td>
14908 </tr>
14909 </table>
14911 !! html+tidy
14912 <table>
14913 <tr>
14914 <th>https://</th>
14915 <th></th>
14916 <th></th>
14917 <th></th>
14918 </tr>
14919 </table>
14920 !! end
14922 !! test
14923 Fuzz testing: Parser21
14924 !! wikitext
14926 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14928 !! html
14929 <table>
14930 <tr>
14931 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14932 </th>
14933 <td>
14934 </td>
14935 </tr>
14936 </table>
14938 !! end
14940 !! test
14941 Fuzz testing: Parser22
14942 !! wikitext
14943 http://===r:::https://b
14946 !! html
14947 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14948 </p>
14949 <table>
14950 <tr><td></td></tr>
14951 </table>
14953 !! end
14955 # Known to produce bad XML for now
14956 !! test
14957 Fuzz testing: Parser24
14958 !! options
14959 noxml
14960 !! wikitext
14962 {{{|
14963 <u CLASS=
14964 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14965 <br style="onmouseover='alert(document.cookie);' " />
14967 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14969 !! html
14970 <table>
14971 {{{|
14972 <u class="&#124;">}}}} &gt;
14973 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14975 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14976 <tr>
14977 <td></u>
14978 </td>
14979 </tr>
14980 </table>
14982 !! end
14984 # Note: the current result listed for this is not what the original one was,
14985 # but the original bug was JavaScript injection, which is fixed in any case.
14986 # It's not clear that the original result listed was any more correct than the
14987 # current one.  Original result:
14988 # <p>{{{| 
14989 # </p>
14990 # <li class="&#124;&#124;">
14991 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14992 !!test
14993 Fuzz testing: Parser25 (bug 6055)
14994 !! wikitext
14997 <LI CLASS=||
14999 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15000 !! html
15001 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15002 </p>
15003 !! end
15005 !!test
15006 Fuzz testing: URL adjacent extension (with space, clean)
15007 !! wikitext
15008 http://example.com <nowiki>junk</nowiki>
15009 !! html
15010 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15011 </p>
15012 !!end
15014 !!test
15015 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15016 !! wikitext
15017 http://example.com<nowiki>junk</nowiki>
15018 !! html
15019 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15020 </p>
15021 !!end
15023 !!test
15024 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15025 !! wikitext
15026 http://example.com<pre>junk</pre>
15027 !! html
15028 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15030 !! html+tidy
15031 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15032 <pre>
15033 junk
15034 </pre>
15035 !!end
15037 !!test
15038 Fuzz testing: image with bogus manual thumbnail
15039 !! wikitext
15040 [[Image:foobar.jpg|thumbnail= ]]
15041 !! html/php
15042 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
15044 !! html/parsoid
15045 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}'/>
15046 !!end
15048 !! test
15049 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15050 !! wikitext
15051 <pre dir="&#10;"></pre>
15052 !! html
15053 <pre dir="&#10;"></pre>
15055 !! end
15057 !! test
15058 Parsing optional HTML elements (Bug 6171)
15059 !! options
15060 !! wikitext
15061 <table>
15062   <tr>
15063     <td> Some tabular data</td>
15064     <td> More tabular data ...
15065     <td> And yet som tabular data</td>
15066   </tr>
15067 </table>
15068 !! html
15069 <table>
15070   <tr>
15071     <td> Some tabular data</td>
15072     <td> More tabular data ...
15073     </td><td> And yet som tabular data</td>
15074   </tr>
15075 </table>
15077 !! end
15079 !! test
15080 Correct handling of <td>, <tr> (Bug 6171)
15081 !! options
15082 !! wikitext
15083 <table>
15084   <tr>
15085     <td> Some tabular data</td>
15086     <td> More tabular data ...</td>
15087     <td> And yet som tabular data</td>
15088   </tr>
15089 </table>
15090 !! html
15091 <table>
15092   <tr>
15093     <td> Some tabular data</td>
15094     <td> More tabular data ...</td>
15095     <td> And yet som tabular data</td>
15096   </tr>
15097 </table>
15099 !! end
15102 !! test
15103 Parsing crashing regression (fr:JavaScript)
15104 !! wikitext
15105 </body></x>
15106 !! html
15107 <p>&lt;/body&gt;&lt;/x&gt;
15108 </p>
15109 !! end
15111 !! test
15112 Inline wiki vs wiki block nesting
15113 !! wikitext
15114 '''Bold paragraph
15116 New wiki paragraph
15117 !! html
15118 <p><b>Bold paragraph</b>
15119 </p><p>New wiki paragraph
15120 </p>
15121 !! end
15123 # FIXME: The current php output is documented
15124 # and desired output is the parsoid target.
15125 !! test
15126 Inline HTML vs wiki block nesting
15127 !! wikitext
15128 <b>Bold paragraph
15130 New wiki paragraph
15131 !! html/php
15132 <p><b>Bold paragraph
15133 </p><p>New wiki paragraph</b>
15134 </p>
15135 !! html/parsoid
15136 <p><b>Bold paragraph</b>
15137 </p><p>New wiki paragraph
15138 </p>
15139 !! end
15141 # Original result was this:
15142 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15143 # </p>
15144 # While that might be marginally more intuitive, maybe, the six-apostrophe
15145 # construct is clearly pathological and the result stated here (which is what
15146 # the parser actually does) is about as reasonable as anything.
15147 !!test
15148 Mixing markup for italics and bold
15149 !! options
15150 !! wikitext
15151 '''bold''''''bold''bolditalics'''''
15152 !! html
15153 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15154 </p>
15155 !! end
15158 !! article
15159 Xyzzyx
15160 !! text
15161 Article for special page transclusion test
15162 !! endarticle
15164 !! test
15165 Special page transclusion
15166 !! options
15167 !! wikitext
15168 {{Special:Prefixindex/Xyzzyx}}
15169 !! html
15170 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15172 !! end
15174 !! test
15175 Special page transclusion twice (bug 5021)
15176 !! options
15177 !! wikitext
15178 {{Special:Prefixindex/Xyzzyx}}
15179 {{Special:Prefixindex/Xyzzyx}}
15180 !! html
15181 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15182 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15184 !! end
15186 !! test
15187 Transclusion of default MediaWiki message
15188 !! wikitext
15189 {{MediaWiki:Mainpage}}
15190 !! html
15191 <p>Main Page
15192 </p>
15193 !! end
15195 !! test
15196 Transclusion of nonexistent MediaWiki message
15197 !! wikitext
15198 {{MediaWiki:Mainpagexxx}}
15199 !! html
15200 <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>
15201 </p>
15202 !! end
15204 !! test
15205 Transclusion of MediaWiki message with underscore
15206 !! wikitext
15207 {{MediaWiki:history_short}}
15208 !! html
15209 <p>History
15210 </p>
15211 !! end
15213 !! test
15214 Transclusion of MediaWiki message with space
15215 !! wikitext
15216 {{MediaWiki:history short}}
15217 !! html
15218 <p>History
15219 </p>
15220 !! end
15222 !! test
15223 Invalid header with following text
15224 !! wikitext
15225 = x = y
15226 !! html
15227 <p>= x = y
15228 </p>
15229 !! end
15232 !! test
15233 Section extraction test (section 0)
15234 !! options
15235 section=0
15236 !! wikitext
15237 start
15238 ==a==
15239 ===aa===
15240 ====aaa====
15241 ==b==
15242 ===ba===
15243 ===bb===
15244 ====bba====
15245 ===bc===
15246 ==c==
15247 ===ca===
15248 !! html
15249 start
15250 !! end
15252 !! test
15253 Section extraction test (section 1)
15254 !! options
15255 section=1
15256 !! wikitext
15257 start
15258 ==a==
15259 ===aa===
15260 ====aaa====
15261 ==b==
15262 ===ba===
15263 ===bb===
15264 ====bba====
15265 ===bc===
15266 ==c==
15267 ===ca===
15268 !! html
15269 ==a==
15270 ===aa===
15271 ====aaa====
15272 !! end
15274 !! test
15275 Section extraction test (section 2)
15276 !! options
15277 section=2
15278 !! wikitext
15279 start
15280 ==a==
15281 ===aa===
15282 ====aaa====
15283 ==b==
15284 ===ba===
15285 ===bb===
15286 ====bba====
15287 ===bc===
15288 ==c==
15289 ===ca===
15290 !! html
15291 ===aa===
15292 ====aaa====
15293 !! end
15295 !! test
15296 Section extraction test (section 3)
15297 !! options
15298 section=3
15299 !! wikitext
15300 start
15301 ==a==
15302 ===aa===
15303 ====aaa====
15304 ==b==
15305 ===ba===
15306 ===bb===
15307 ====bba====
15308 ===bc===
15309 ==c==
15310 ===ca===
15311 !! html
15312 ====aaa====
15313 !! end
15315 !! test
15316 Section extraction test (section 4)
15317 !! options
15318 section=4
15319 !! wikitext
15320 start
15321 ==a==
15322 ===aa===
15323 ====aaa====
15324 ==b==
15325 ===ba===
15326 ===bb===
15327 ====bba====
15328 ===bc===
15329 ==c==
15330 ===ca===
15331 !! html
15332 ==b==
15333 ===ba===
15334 ===bb===
15335 ====bba====
15336 ===bc===
15337 !! end
15339 !! test
15340 Section extraction test (section 5)
15341 !! options
15342 section=5
15343 !! wikitext
15344 start
15345 ==a==
15346 ===aa===
15347 ====aaa====
15348 ==b==
15349 ===ba===
15350 ===bb===
15351 ====bba====
15352 ===bc===
15353 ==c==
15354 ===ca===
15355 !! html
15356 ===ba===
15357 !! end
15359 !! test
15360 Section extraction test (section 6)
15361 !! options
15362 section=6
15363 !! wikitext
15364 start
15365 ==a==
15366 ===aa===
15367 ====aaa====
15368 ==b==
15369 ===ba===
15370 ===bb===
15371 ====bba====
15372 ===bc===
15373 ==c==
15374 ===ca===
15375 !! html
15376 ===bb===
15377 ====bba====
15378 !! end
15380 !! test
15381 Section extraction test (section 7)
15382 !! options
15383 section=7
15384 !! wikitext
15385 start
15386 ==a==
15387 ===aa===
15388 ====aaa====
15389 ==b==
15390 ===ba===
15391 ===bb===
15392 ====bba====
15393 ===bc===
15394 ==c==
15395 ===ca===
15396 !! html
15397 ====bba====
15398 !! end
15400 !! test
15401 Section extraction test (section 8)
15402 !! options
15403 section=8
15404 !! wikitext
15405 start
15406 ==a==
15407 ===aa===
15408 ====aaa====
15409 ==b==
15410 ===ba===
15411 ===bb===
15412 ====bba====
15413 ===bc===
15414 ==c==
15415 ===ca===
15416 !! html
15417 ===bc===
15418 !! end
15420 !! test
15421 Section extraction test (section 9)
15422 !! options
15423 section=9
15424 !! wikitext
15425 start
15426 ==a==
15427 ===aa===
15428 ====aaa====
15429 ==b==
15430 ===ba===
15431 ===bb===
15432 ====bba====
15433 ===bc===
15434 ==c==
15435 ===ca===
15436 !! html
15437 ==c==
15438 ===ca===
15439 !! end
15441 !! test
15442 Section extraction test (section 10)
15443 !! options
15444 section=10
15445 !! wikitext
15446 start
15447 ==a==
15448 ===aa===
15449 ====aaa====
15450 ==b==
15451 ===ba===
15452 ===bb===
15453 ====bba====
15454 ===bc===
15455 ==c==
15456 ===ca===
15457 !! html
15458 ===ca===
15459 !! end
15461 !! test
15462 Section extraction test (nonexistent section 11)
15463 !! options
15464 section=11
15465 !! wikitext
15466 start
15467 ==a==
15468 ===aa===
15469 ====aaa====
15470 ==b==
15471 ===ba===
15472 ===bb===
15473 ====bba====
15474 ===bc===
15475 ==c==
15476 ===ca===
15477 !! html
15478 !! end
15480 !! test
15481 Section extraction test with bogus heading (section 1)
15482 !! options
15483 section=1
15484 !! wikitext
15485 ==a==
15486 ==bogus== not a legal section
15487 ==b==
15488 !! html
15489 ==a==
15490 ==bogus== not a legal section
15491 !! end
15493 !! test
15494 Section extraction test with bogus heading (section 2)
15495 !! options
15496 section=2
15497 !! wikitext
15498 ==a==
15499 ==bogus== not a legal section
15500 ==b==
15501 !! html
15502 ==b==
15503 !! end
15505 !! test
15506 Section extraction test with comment after heading (section 1)
15507 !! options
15508 section=1
15509 !! wikitext
15510 ==a==
15511 ==b== <!-- -->
15512 ==c==
15513 !! html
15514 ==a==
15515 !! end
15517 !! test
15518 Section extraction test with comment after heading (section 2)
15519 !! options
15520 section=2
15521 !! wikitext
15522 ==a==
15523 ==b== <!-- -->
15524 ==c==
15525 !! html
15526 ==b== <!-- -->
15527 !! end
15529 !! test
15530 Section extraction test with bogus <nowiki> heading (section 1)
15531 !! options
15532 section=1
15533 !! wikitext
15534 ==a==
15535 ==bogus== <nowiki>not a legal section</nowiki>
15536 ==b==
15537 !! html
15538 ==a==
15539 ==bogus== <nowiki>not a legal section</nowiki>
15540 !! end
15542 !! test
15543 Section extraction test with bogus <nowiki> heading (section 2)
15544 !! options
15545 section=2
15546 !! wikitext
15547 ==a==
15548 ==bogus== <nowiki>not a legal section</nowiki>
15549 ==b==
15550 !! html
15551 ==b==
15552 !! end
15555 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15556 # instead of respecting commented sections
15557 !! test
15558 Section extraction prefixed by comment (section 1)
15559 !! options
15560 section=1
15561 !! wikitext
15562 <!-- -->==sec1==
15563 ==sec2==
15564 !! html
15565 ==sec2==
15566 !!end
15568 !! test
15569 Section extraction prefixed by comment (section 2)
15570 !! options
15571 section=2
15572 !! wikitext
15573 <!-- -->==sec1==
15574 ==sec2==
15575 !! html
15577 !!end
15580 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15581 # instead of respecting HTML-style headings
15582 !! test
15583 Section extraction, mixed wiki and html (section 1)
15584 !! options
15585 section=1
15586 !! wikitext
15587 <h2>unmarked</h2>
15588 unmarked
15589 ==1==
15591 ==2==
15593 !! html
15594 ==1==
15596 !! end
15598 !! test
15599 Section extraction, mixed wiki and html (section 2)
15600 !! options
15601 section=2
15602 !! wikitext
15603 <h2>unmarked</h2>
15604 unmarked
15605 ==1==
15607 ==2==
15609 !! html
15610 ==2==
15612 !! end
15615 # Formerly testing for bug 3342
15616 !! test
15617 Section extraction, heading surrounded by <noinclude>
15618 !! options
15619 section=1
15620 !! wikitext
15621 <noinclude>==unmarked==</noinclude>
15622 ==marked==
15623 !! html
15624 ==marked==
15625 !!end
15627 # Test behavior of bug 19910
15628 !! test
15629 Sectiion with all-equals
15630 !! options
15631 section=2
15632 !! wikitext
15633 === 
15634 The line above must have a trailing space
15635 === <!--
15636 --> <!-- -->
15637 But just in case it doesn't...
15638 !! html
15639 === <!--
15640 --> <!-- -->
15641 But just in case it doesn't...
15642 !! end
15644 !! test
15645 Section replacement test (section 0)
15646 !! options
15647 replace=0,"xxx"
15648 !! wikitext
15649 start
15650 ==a==
15651 ===aa===
15652 ====aaa====
15653 ==b==
15654 ===ba===
15655 ===bb===
15656 ====bba====
15657 ===bc===
15658 ==c==
15659 ===ca===
15660 !! html
15663 ==a==
15664 ===aa===
15665 ====aaa====
15666 ==b==
15667 ===ba===
15668 ===bb===
15669 ====bba====
15670 ===bc===
15671 ==c==
15672 ===ca===
15673 !! end
15675 !! test
15676 Section replacement test (section 1)
15677 !! options
15678 replace=1,"xxx"
15679 !! wikitext
15680 start
15681 ==a==
15682 ===aa===
15683 ====aaa====
15684 ==b==
15685 ===ba===
15686 ===bb===
15687 ====bba====
15688 ===bc===
15689 ==c==
15690 ===ca===
15691 !! html
15692 start
15695 ==b==
15696 ===ba===
15697 ===bb===
15698 ====bba====
15699 ===bc===
15700 ==c==
15701 ===ca===
15702 !! end
15704 !! test
15705 Section replacement test (section 2)
15706 !! options
15707 replace=2,"xxx"
15708 !! wikitext
15709 start
15710 ==a==
15711 ===aa===
15712 ====aaa====
15713 ==b==
15714 ===ba===
15715 ===bb===
15716 ====bba====
15717 ===bc===
15718 ==c==
15719 ===ca===
15720 !! html
15721 start
15722 ==a==
15725 ==b==
15726 ===ba===
15727 ===bb===
15728 ====bba====
15729 ===bc===
15730 ==c==
15731 ===ca===
15732 !! end
15734 !! test
15735 Section replacement test (section 3)
15736 !! options
15737 replace=3,"xxx"
15738 !! wikitext
15739 start
15740 ==a==
15741 ===aa===
15742 ====aaa====
15743 ==b==
15744 ===ba===
15745 ===bb===
15746 ====bba====
15747 ===bc===
15748 ==c==
15749 ===ca===
15750 !! html
15751 start
15752 ==a==
15753 ===aa===
15756 ==b==
15757 ===ba===
15758 ===bb===
15759 ====bba====
15760 ===bc===
15761 ==c==
15762 ===ca===
15763 !! end
15765 !! test
15766 Section replacement test (section 4)
15767 !! options
15768 replace=4,"xxx"
15769 !! wikitext
15770 start
15771 ==a==
15772 ===aa===
15773 ====aaa====
15774 ==b==
15775 ===ba===
15776 ===bb===
15777 ====bba====
15778 ===bc===
15779 ==c==
15780 ===ca===
15781 !! html
15782 start
15783 ==a==
15784 ===aa===
15785 ====aaa====
15788 ==c==
15789 ===ca===
15790 !! end
15792 !! test
15793 Section replacement test (section 5)
15794 !! options
15795 replace=5,"xxx"
15796 !! wikitext
15797 start
15798 ==a==
15799 ===aa===
15800 ====aaa====
15801 ==b==
15802 ===ba===
15803 ===bb===
15804 ====bba====
15805 ===bc===
15806 ==c==
15807 ===ca===
15808 !! html
15809 start
15810 ==a==
15811 ===aa===
15812 ====aaa====
15813 ==b==
15816 ===bb===
15817 ====bba====
15818 ===bc===
15819 ==c==
15820 ===ca===
15821 !! end
15823 !! test
15824 Section replacement test (section 6)
15825 !! options
15826 replace=6,"xxx"
15827 !! wikitext
15828 start
15829 ==a==
15830 ===aa===
15831 ====aaa====
15832 ==b==
15833 ===ba===
15834 ===bb===
15835 ====bba====
15836 ===bc===
15837 ==c==
15838 ===ca===
15839 !! html
15840 start
15841 ==a==
15842 ===aa===
15843 ====aaa====
15844 ==b==
15845 ===ba===
15848 ===bc===
15849 ==c==
15850 ===ca===
15851 !! end
15853 !! test
15854 Section replacement test (section 7)
15855 !! options
15856 replace=7,"xxx"
15857 !! wikitext
15858 start
15859 ==a==
15860 ===aa===
15861 ====aaa====
15862 ==b==
15863 ===ba===
15864 ===bb===
15865 ====bba====
15866 ===bc===
15867 ==c==
15868 ===ca===
15869 !! html
15870 start
15871 ==a==
15872 ===aa===
15873 ====aaa====
15874 ==b==
15875 ===ba===
15876 ===bb===
15879 ===bc===
15880 ==c==
15881 ===ca===
15882 !! end
15884 !! test
15885 Section replacement test (section 8)
15886 !! options
15887 replace=8,"xxx"
15888 !! wikitext
15889 start
15890 ==a==
15891 ===aa===
15892 ====aaa====
15893 ==b==
15894 ===ba===
15895 ===bb===
15896 ====bba====
15897 ===bc===
15898 ==c==
15899 ===ca===
15900 !! html
15901 start
15902 ==a==
15903 ===aa===
15904 ====aaa====
15905 ==b==
15906 ===ba===
15907 ===bb===
15908 ====bba====
15911 ==c==
15912 ===ca===
15913 !!end
15915 !! test
15916 Section replacement test (section 9)
15917 !! options
15918 replace=9,"xxx"
15919 !! wikitext
15920 start
15921 ==a==
15922 ===aa===
15923 ====aaa====
15924 ==b==
15925 ===ba===
15926 ===bb===
15927 ====bba====
15928 ===bc===
15929 ==c==
15930 ===ca===
15931 !! html
15932 start
15933 ==a==
15934 ===aa===
15935 ====aaa====
15936 ==b==
15937 ===ba===
15938 ===bb===
15939 ====bba====
15940 ===bc===
15942 !! end
15944 !! test
15945 Section replacement test (section 10)
15946 !! options
15947 replace=10,"xxx"
15948 !! wikitext
15949 start
15950 ==a==
15951 ===aa===
15952 ====aaa====
15953 ==b==
15954 ===ba===
15955 ===bb===
15956 ====bba====
15957 ===bc===
15958 ==c==
15959 ===ca===
15960 !! html
15961 start
15962 ==a==
15963 ===aa===
15964 ====aaa====
15965 ==b==
15966 ===ba===
15967 ===bb===
15968 ====bba====
15969 ===bc===
15970 ==c==
15972 !! end
15974 !! test
15975 Section replacement test with initial whitespace (bug 13728)
15976 !! options
15977 replace=2,"xxx"
15978 !! wikitext
15979  Preformatted initial line
15980 ==a==
15981 ===a===
15982 !! html
15983  Preformatted initial line
15984 ==a==
15986 !! end
15989 !! test
15990 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15991 !! options
15992 section=1
15993 !! wikitext
15994 ==a==
15995                     a
15996 !! html
15997 ==a==
15998                     a
15999 !! end
16001 !! test
16002 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16003 !! options
16004 section=1
16005 !! wikitext
16006 ==a==
16007                    a
16008 !! html
16009 ==a==
16010                    a
16011 !! end
16014 !! test
16015 Section extraction, <pre> around bogus header (bug 10309)
16016 !! options
16017 noxml section=2
16018 !! wikitext
16019 == Section One ==
16020 <pre>
16021 =======
16022 </pre>
16024 == Section Two ==
16025 stuff
16026 !! html
16027 == Section Two ==
16028 stuff
16029 !! end
16031 !! test
16032 Section replacement, <pre> around bogus header (bug 10309)
16033 !! options
16034 noxml replace=2,"xxx"
16035 !! wikitext
16036 == Section One ==
16037 <pre>
16038 =======
16039 </pre>
16041 == Section Two ==
16042 stuff
16043 !! html
16044 == Section One ==
16045 <pre>
16046 =======
16047 </pre>
16050 !! end
16054 !! test
16055 Handling of &#x0A; in URLs
16056 !! wikitext
16057 ** irc://&#x0A;a
16058 !! html/php
16059 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16061 !! html/parsoid
16062 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16063 a">irc://
16064 a</a></li></ul></li></ul>
16065 !! end
16067 !! test
16068 Handling of %0A in URLs
16069 !! wikitext
16070 ** irc://%0Aa
16071 !! html/php
16072 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16074 !! html/parsoid
16075 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16076 !! end
16079 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16080 !! test
16081 5 quotes, code coverage +1 line
16082 !! options
16083 parsoid=wt2html
16084 !! wikitext
16085 '''''
16086 !! html/php
16087 !! html/parsoid
16088 <p><b><i></i></b></p>
16089 !! end
16091 # same html as previous, but wikitext adjusted to match parsoid html2wt
16092 # note that wt2html and html2html will put the <i> before the <b>
16093 !! test
16094 5 quotes, code coverage +1 line w/ nowiki (1)
16095 !! options
16096 parsoid=wt2wt,html2wt
16097 !! wikitext
16098 '''''<nowiki/>'''''
16099 !! html/php
16100 <p><i></i>
16101 </p>
16102 !! html/parsoid
16103 <p><b><i></i></b></p>
16104 !! end
16106 # same as previous, just swapping the <i> and <b>
16107 !! test
16108 5 quotes, code coverage +1 line w/ nowiki (2)
16109 !! wikitext
16110 '''''<nowiki/>'''''
16111 !! html/php
16112 <p><i></i>
16113 </p>
16114 !! html/parsoid
16115 <p><i><b></b></i></p>
16116 !! end
16118 !! test
16119 Special:Search page linking.
16120 !! wikitext
16121 {{Special:search}}
16122 !! html
16123 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16124 </p>
16125 !! end
16127 !! test
16128 {{!}} is a magic word
16129 !! wikitext
16130 {{!}} is a magic word there and {{!}} is still a magic word here
16131 !! html/php
16132 <p>| is a magic word there and | is still a magic word here
16133 </p>
16134 !! html/parsoid
16135 <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>
16136 !! end
16138 !! test
16139 Say the magic word
16140 !! options
16141 title=[[Parser test]]
16142 !! wikitext
16143 * {{PAGENAME}}
16144 * {{PAGENAMEE}}
16145 * {{FULLPAGENAME}}
16146 * {{FULLPAGENAMEE}}
16147 * {{BASEPAGENAME}}
16148 * {{BASEPAGENAMEE}}
16149 * {{SUBPAGENAME}}
16150 * {{SUBPAGENAMEE}}
16151 * {{ROOTPAGENAME}}
16152 * {{ROOTPAGENAMEE}}
16153 * {{TALKPAGENAME}}
16154 * {{TALKPAGENAMEE}}
16155 * {{SUBJECTPAGENAME}}
16156 * {{SUBJECTPAGENAMEE}}
16157 * {{NAMESPACEE}}
16158 * {{NAMESPACE}}
16159 * {{NAMESPACENUMBER}}
16160 * {{TALKSPACE}}
16161 * {{TALKSPACEE}}
16162 * {{SUBJECTSPACE}}
16163 * {{SUBJECTSPACEE}}
16164 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16165 !! html
16166 <ul><li> Parser test</li>
16167 <li> Parser_test</li>
16168 <li> Parser test</li>
16169 <li> Parser_test</li>
16170 <li> Parser test</li>
16171 <li> Parser_test</li>
16172 <li> Parser test</li>
16173 <li> Parser_test</li>
16174 <li> Parser test</li>
16175 <li> Parser_test</li>
16176 <li> Talk:Parser test</li>
16177 <li> Talk:Parser_test</li>
16178 <li> Parser test</li>
16179 <li> Parser_test</li>
16180 <li> </li>
16181 <li> </li>
16182 <li> 0</li>
16183 <li> Talk</li>
16184 <li> Talk</li>
16185 <li> </li>
16186 <li> </li>
16187 <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>
16189 !! end
16190 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16192 !! test
16193 Gallery
16194 !! wikitext
16195 <gallery>
16196 image1.png |
16197 image2.gif|||||
16199 image3|
16200 image4    |300px| centre
16201  image5.svg| http://///////
16202 [[x|xx]]]]
16203 * image6
16204 </gallery>
16205 !! html
16206 <ul class="gallery mw-gallery-traditional">
16207                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16208                         <div class="thumb" style="height: 150px;">Image1.png</div>
16209                         <div class="gallerytext">
16210                         </div>
16211                 </div></li>
16212                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16213                         <div class="thumb" style="height: 150px;">Image2.gif</div>
16214                         <div class="gallerytext">
16215 <p>||||
16216 </p>
16217                         </div>
16218                 </div></li>
16219                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16220                         <div class="thumb" style="height: 150px;">Image3</div>
16221                         <div class="gallerytext">
16222                         </div>
16223                 </div></li>
16224                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16225                         <div class="thumb" style="height: 150px;">Image4</div>
16226                         <div class="gallerytext">
16227 <p>300px| centre
16228 </p>
16229                         </div>
16230                 </div></li>
16231                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16232                         <div class="thumb" style="height: 150px;">Image5.svg</div>
16233                         <div class="gallerytext">
16234 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16235 </p>
16236                         </div>
16237                 </div></li>
16238                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16239                         <div class="thumb" style="height: 150px;">* image6</div>
16240                         <div class="gallerytext">
16241                         </div>
16242                 </div></li>
16243 </ul>
16245 !! end
16247 !! test
16248 Gallery (with options)
16249 !! wikitext
16250 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16251 File:Nonexistant.jpg|caption
16252 File:Nonexistant.jpg
16253 image:foobar.jpg|some '''caption''' [[Main Page]]
16254 image:foobar.jpg
16255 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16256 </gallery>
16257 !! html
16258 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16259         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16260                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16261                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16262                         <div class="gallerytext">
16263 <p>caption
16264 </p>
16265                         </div>
16266                 </div></li>
16267                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16268                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16269                         <div class="gallerytext">
16270                         </div>
16271                 </div></li>
16272                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16273                         <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>
16274                         <div class="gallerytext">
16275 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16276 </p>
16277                         </div>
16278                 </div></li>
16279                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16280                         <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>
16281                         <div class="gallerytext">
16282                         </div>
16283                 </div></li>
16284                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16285                         <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>
16286                         <div class="gallerytext">
16287 <p>Blabla|blabla.
16288 </p>
16289                         </div>
16290                 </div></li>
16291 </ul>
16293 !! end
16295 !! test
16296 Gallery with link that has fragment
16297 !! wikitext
16298 <gallery>
16299 image:foobar.jpg|link=Main_Page
16300 image:foobar.jpg|link=Main_Page#section
16301 image:foobar.jpg|link=Main Page#section|caption
16302 </gallery>
16303 !! html
16304 <ul class="gallery mw-gallery-traditional">
16305                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16306                         <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>
16307                         <div class="gallerytext">
16308                         </div>
16309                 </div></li>
16310                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16311                         <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>
16312                         <div class="gallerytext">
16313                         </div>
16314                 </div></li>
16315                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16316                         <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>
16317                         <div class="gallerytext">
16318 <p>caption
16319 </p>
16320                         </div>
16321                 </div></li>
16322 </ul>
16324 !! end
16326 !! test
16327 Gallery with wikitext inside caption
16328 !! wikitext
16329 <gallery>
16330 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16331 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16332 </gallery>
16333 !! html
16334 <ul class="gallery mw-gallery-traditional">
16335                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16336                         <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>
16337                         <div class="gallerytext">
16338 <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>
16339 </p>
16340                         </div>
16341                 </div></li>
16342                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16343                         <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>
16344                         <div class="gallerytext">
16345 <p>This is a test template
16346 </p>
16347                         </div>
16348                 </div></li>
16349 </ul>
16351 !! end
16353 !! test
16354 gallery (with showfilename option)
16355 !! wikitext
16356 <gallery showfilename>
16357 File:Nonexistant.jpg|caption
16358 File:Nonexistant.jpg
16359 image:foobar.jpg|some '''caption''' [[Main Page]]
16360 File:Foobar.jpg
16361 </gallery>
16362 !! html
16363 <ul class="gallery mw-gallery-traditional">
16364                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16365                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16366                         <div class="gallerytext">
16367 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16368 caption
16369 </p>
16370                         </div>
16371                 </div></li>
16372                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16373                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16374                         <div class="gallerytext">
16375 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16376 </p>
16377                         </div>
16378                 </div></li>
16379                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16380                         <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>
16381                         <div class="gallerytext">
16382 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16383 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16384 </p>
16385                         </div>
16386                 </div></li>
16387                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16388                         <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>
16389                         <div class="gallerytext">
16390 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16391 </p>
16392                         </div>
16393                 </div></li>
16394 </ul>
16396 !! end
16398 !! test
16399 Gallery (with namespace-less filenames)
16400 !! wikitext
16401 <gallery>
16402 File:Nonexistant.jpg
16403 Nonexistant.jpg
16404 image:foobar.jpg
16405 foobar.jpg
16406 </gallery>
16407 !! html
16408 <ul class="gallery mw-gallery-traditional">
16409                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16410                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16411                         <div class="gallerytext">
16412                         </div>
16413                 </div></li>
16414                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16415                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16416                         <div class="gallerytext">
16417                         </div>
16418                 </div></li>
16419                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16420                         <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>
16421                         <div class="gallerytext">
16422                         </div>
16423                 </div></li>
16424                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16425                         <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>
16426                         <div class="gallerytext">
16427                         </div>
16428                 </div></li>
16429 </ul>
16431 !! end
16433 !! test
16434 HTML Hex character encoding (spells the word "JavaScript")
16435 !! options
16436 parsoid=wt2html,wt2wt,html2html
16437 !! wikitext
16438 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16439 !! html/php
16440 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16441 </p>
16442 !! html/php+tidy
16443 <p>JavaScript</p>
16444 !! html/parsoid
16445 <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>
16446 !! end
16448 !! test
16449 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16450 !! wikitext
16451 &#xsee;&#XSEE;
16452 !! html/php
16453 <p>&amp;#xsee;&amp;#XSEE;
16454 </p>
16455 !! html/parsoid
16456 <p>&amp;#xsee;&amp;#XSEE;</p>
16457 !! end
16459 !! test
16460 HTML Hex character encoding mixed case
16461 !! options
16462 parsoid=wt2html,wt2wt,html2html
16463 !! wikitext
16464 &#xEE;&#Xee;
16465 !! html/php
16466 <p>&#xee;&#xee;
16467 </p>
16468 !! html/php+tidy
16469 <p>îî</p>
16470 !! html/parsoid
16471 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16472 !! end
16474 !! test
16475 __FORCETOC__ override
16476 !! wikitext
16477 __NEWSECTIONLINK__
16478 __FORCETOC__
16479 !! html
16480 <p><br />
16481 </p>
16482 !! end
16484 !! test
16485 ISBN code coverage
16486 !! wikitext
16487 ISBN  978-0-1234-56&#x20;789
16488 !! html
16489 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16490 </p>
16491 !! html+tidy
16492 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16493 !! end
16495 !! test
16496 ISBN followed by 5 spaces
16497 !! wikitext
16498 ISBN    
16499 !! html
16500 <p>ISBN    
16501 </p>
16502 !! end
16504 !! test
16505 Double ISBN
16506 !! wikitext
16507 ISBN ISBN 1234567890
16508 !! html
16509 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16510 </p>
16511 !! end
16513 !! test
16514 ISBN with an X
16515 !! wikitext
16516 ISBN 3-462-04561-X
16517 !! html
16518 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16519 </p>
16520 !! end
16522 !! test
16523 ISBN with empty prefix (parsoid test)
16524 !! wikitext
16525 ISBN 1234567890
16526 !! html/parsoid
16527 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16528 !! end
16530 !! test
16531 Bug 22905: <abbr> followed by ISBN followed by </a>
16532 !! wikitext
16533 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16534 !! html
16535 <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>
16536 </p>
16537 !! end
16539 !! test
16540 Double RFC
16541 !! wikitext
16542 RFC RFC 1234
16543 !! html
16544 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16545 </p>
16546 !! end
16548 !! test
16549 Double RFC with a wiki link
16550 !! wikitext
16551 RFC [[RFC 1234]]
16552 !! html
16553 <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>
16554 </p>
16555 !! end
16557 !! test
16558 RFC code coverage
16559 !! wikitext
16560 RFC   983&#x20;987
16561 !! html
16562 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16563 </p>
16564 !! html+tidy
16565 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16566 !! end
16568 !! test
16569 Centre-aligned image
16570 !! wikitext
16571 [[Image:foobar.jpg|centre]]
16572 !! html
16573 <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>
16575 !!end
16577 !! test
16578 None-aligned image
16579 !! wikitext
16580 [[Image:foobar.jpg|none]]
16581 !! html
16582 <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>
16584 !!end
16586 !! test
16587 Width + Height sized image (using px) (height is ignored)
16588 !! wikitext
16589 [[Image:foobar.jpg|640x480px]]
16590 !! html
16591 <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>
16592 </p>
16593 !!end
16595 !! test
16596 Width-sized image (using px, no following whitespace)
16597 !! wikitext
16598 [[Image:foobar.jpg|640px]]
16599 !! html
16600 <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>
16601 </p>
16602 !!end
16604 !! test
16605 Width-sized image (using px, with following whitespace - test regression from r39467)
16606 !! wikitext
16607 [[Image:foobar.jpg|640px ]]
16608 !! html
16609 <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>
16610 </p>
16611 !!end
16613 !! test
16614 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16615 !! wikitext
16616 [[Image:foobar.jpg| 640px]]
16617 !! html
16618 <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>
16619 </p>
16620 !!end
16622 !! test
16623 Image with page parameter
16624 !! options
16625 djvu
16626 !! wikitext
16627 [[File:LoremIpsum.djvu|page=2]]
16628 !! html
16629 <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>
16630 </p>
16631 !! end
16633 !! test
16634 Another italics / bold test
16635 !! wikitext
16636  ''' ''x'
16637 !! html
16638 <pre>'<i> </i>x'
16639 </pre>
16640 !!end
16642 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16643 !! test
16644 dt/dd/dl test
16645 !! wikitext
16646 :;;;::
16647 !! html/php
16648 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16650 !! html/parsoid
16651 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16653 !!end
16656 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16657 !! test
16658 Images with the "|" character in the comment
16659 !! wikitext
16660 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16661 !! html/php
16662 <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>
16664 !! html/parsoid
16665 <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>
16666 !! end
16668 !! test
16669 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16670 !! wikitext
16671 <html><script>alert(1);</script></html>
16672 !! html
16673 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16674 </p>
16675 !! end
16677 !! test
16678 HTML with raw HTML ($wgRawHtml==true)
16679 !! options
16680 wgRawHtml=1
16681 !! wikitext
16682 <html><script>alert(1);</script></html>
16683 !! html
16684 <p><script>alert(1);</script>
16685 </p>
16686 !! end
16688 !! test
16689 Parents of subpages, one level up
16690 !! options
16691 subpage title=[[Subpage test/L1/L2/L3]]
16692 !! wikitext
16693 [[../|L2]]
16694 !! html
16695 <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>
16696 </p>
16697 !! end
16700 !! test
16701 Parents of subpages, one level up, not named
16702 !! options
16703 subpage title=[[Subpage test/L1/L2/L3]]
16704 !! wikitext
16705 [[../]]
16706 !! html
16707 <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>
16708 </p>
16709 !! end
16713 !! test
16714 Parents of subpages, two levels up
16715 !! options
16716 subpage title=[[Subpage test/L1/L2/L3]]
16717 !! wikitext
16718 [[../../|L1]]2
16720 [[../../|L1]]l
16721 !! html
16722 <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
16723 </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>
16724 </p>
16725 !! end
16727 !! test
16728 Parents of subpages, two levels up, without trailing slash or name.
16729 !! options
16730 subpage title=[[Subpage test/L1/L2/L3]]
16731 !! wikitext
16732 [[../..]]
16733 !! html
16734 <p>[[../..]]
16735 </p>
16736 !! end
16738 !! test
16739 Parents of subpages, two levels up, with lots of extra trailing slashes.
16740 !! options
16741 subpage title=[[Subpage test/L1/L2/L3]]
16742 !! wikitext
16743 [[../../////]]
16744 !! html
16745 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
16746 </p>
16747 !! end
16749 !! article
16750 Subpage test/L1/L2/L3Sibling
16751 !! text
16752 Sibling article
16753 !! endarticle
16755 !! test
16756 Transclusion of a sibling page (one level up)
16757 !! options
16758 subpage title=[[Subpage test/L1/L2/L3]]
16759 !! wikitext
16760 {{../L3Sibling}}
16761 !! html
16762 <p>Sibling article
16763 </p>
16764 !! end
16766 !! test
16767 Transclusion of a child page
16768 !! options
16769 subpage title=[[Subpage test/L1/L2]]
16770 !! wikitext
16771 {{/L3Sibling}}
16772 !! html
16773 <p>Sibling article
16774 </p>
16775 !! end
16777 !! test
16778 Non-transclusion because of too many up levels
16779 !! options
16780 subpage title=[[Subpage test/L1/L2/L3]]
16781 !! wikitext
16782 {{../../../../More than parent}}
16783 !! html
16784 <p>{{../../../../More than parent}}
16785 </p>
16786 !! end
16788 !! test
16789 Definition list code coverage
16790 !! wikitext
16791 ; title   : def
16792 ; title : def
16793 ;title: def
16794 !! html/php
16795 <dl><dt> title  &#160;</dt>
16796 <dd> def</dd>
16797 <dt> title&#160;</dt>
16798 <dd> def</dd>
16799 <dt>title</dt>
16800 <dd> def</dd></dl>
16802 !! html/parsoid
16803 <dl><dt> title  <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16804 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
16805 <dt>title</dt><dd> def</dd></dl>
16806 !! end
16808 !! test
16809 Don't fall for the self-closing div
16810 !! wikitext
16811 <div>hello world</div/>
16812 !! html
16813 <div>hello world</div>
16815 !! end
16817 !! test
16818 MSGNW magic word
16819 !! wikitext
16820 {{MSGNW:msg}}
16821 !! html
16822 <p>&#91;&#91;:Template:Msg&#93;&#93;
16823 </p>
16824 !! end
16826 !! test
16827 RAW magic word
16828 !! wikitext
16829 {{RAW:QUERTY}}
16830 !! html
16831 <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>
16832 </p>
16833 !! end
16835 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16836 !! test
16837 Always escape literal '>' in output, not just after '<'
16838 !! wikitext
16840 !! html
16841 <p>&gt;&lt;&gt;
16842 </p>
16843 !! end
16845 !! test
16846 Template caching
16847 !! wikitext
16848 {{Test}}
16849 {{Test}}
16850 !! html
16851 <p>This is a test template
16852 This is a test template
16853 </p>
16854 !! end
16857 !! article
16858 MediaWiki:Fake
16859 !! text
16860 ==header==
16861 !! endarticle
16863 !! test
16864 Inclusion of !userCanEdit() content
16865 !! wikitext
16866 {{MediaWiki:Fake}}
16867 !! html
16868 <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>
16870 !! end
16873 !! test
16874 Out-of-order TOC heading levels
16875 !! wikitext
16876 ==2==
16877 ======6======
16878 ===3===
16880 =====5=====
16881 ==2==
16882 !! html
16883 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16884 <ul>
16885 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16886 <ul>
16887 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16888 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16889 </ul>
16890 </li>
16891 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16892 <ul>
16893 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16894 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16895 </ul>
16896 </li>
16897 </ul>
16898 </div>
16900 <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>
16901 <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>
16902 <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>
16903 <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>
16904 <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>
16905 <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>
16907 !! end
16910 !! test
16911 ISBN with a dummy number
16912 !! wikitext
16913 ISBN ---
16914 !! html
16915 <p>ISBN ---
16916 </p>
16917 !! end
16920 !! test
16921 ISBN with space-delimited number
16922 !! wikitext
16923 ISBN 92 9017 032 8
16924 !! html
16925 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16926 </p>
16927 !! end
16930 !! test
16931 ISBN with multiple spaces, no number
16932 !! wikitext
16933 ISBN  foo
16934 !! html
16935 <p>ISBN  foo
16936 </p>
16937 !! end
16940 !! test
16941 ISBN length
16942 !! wikitext
16943 ISBN 123456789
16945 ISBN 1234567890
16947 ISBN 12345678901
16948 !! html
16949 <p>ISBN 123456789
16950 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16951 </p><p>ISBN 12345678901
16952 </p>
16953 !! end
16956 !! test
16957 ISBN with trailing year (bug 8110)
16958 !! wikitext
16959 ISBN 1-234-56789-0 - 2006
16961 ISBN 1 234 56789 0 - 2006
16962 !! html
16963 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16964 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16965 </p>
16966 !! end
16969 !! test
16970 anchorencode
16971 !! wikitext
16972 {{anchorencode:foo bar©#%n}}
16973 !! html
16974 <p>foo_bar.C2.A9.23.25n
16975 </p>
16976 !! end
16978 !! test
16979 anchorencode trims spaces
16980 !! wikitext
16981 {{anchorencode: __pretty__please__}}
16982 !! html
16983 <p>pretty_please
16984 </p>
16985 !! end
16987 !! test
16988 anchorencode deals with links
16989 !! wikitext
16990 {{anchorencode: [[hello|world]] [[hi]]}}
16991 !! html
16992 <p>world_hi
16993 </p>
16994 !! end
16996 !! test
16997 anchorencode deals with templates
16998 !! wikitext
16999 {{anchorencode: {{Foo}} }}
17000 !! html
17001 <p>FOO
17002 </p>
17003 !! end
17005 !! test
17006 anchorencode encodes like the TOC generator: (bug 18431)
17007 !! wikitext
17008 === _ +:.3A%3A&&amp;]] ===
17009 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17010 __NOEDITSECTION__
17011 !! html
17012 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17013 <p>.2B:.3A.253A.26.26.5D.5D
17014 </p>
17015 !! end
17017 !! test
17018 Bug 6200: blockquotes and paragraph formatting
17019 !! wikitext
17020 <blockquote>
17022 </blockquote>
17026  baz
17027 !! html
17028 <blockquote>
17029 <p>foo
17030 </p>
17031 </blockquote>
17032 <p>bar
17033 </p>
17034 <pre>baz
17035 </pre>
17036 !! end
17038 !! test
17039 Bug 8293: Use of center tag ruins paragraph formatting
17040 !! wikitext
17041 <center>
17043 </center>
17047  baz
17048 !! html
17049 <center>
17050 <p>foo
17051 </p>
17052 </center>
17053 <p>bar
17054 </p>
17055 <pre>baz
17056 </pre>
17057 !! end
17059 !!test
17060 Parsing of overlapping (improperly nested) inline html tags
17061 !! wikitext
17062 <span><s>x</span></s>
17063 !! html/php
17064 <p><span><s>x&lt;/span&gt;</s></span>
17065 </p>
17066 !! html/parsoid
17067 <p><span><s>x</s></span>
17068 </p>
17069 !!end
17072 ### Language variants related tests
17074 !! test
17075 Self-link in language variants
17076 !! options
17077 title=[[Dunav]] language=sr
17078 !! wikitext
17079 Both [[Dunav]] and [[Дунав]] are names for this river.
17080 !! html
17081 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17082 </p>
17083 !!end
17085 !! article
17086 Дуна
17087 !! text
17088 content
17089 !! endarticle
17091 !! test
17092 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17093 !! options
17094 title=[[Duna]] language=sr
17095 !! wikitext
17096 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17097 !! html
17098 <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.
17099 </p>
17100 !! end
17102 !! test
17103 Link to a section of a variant of this title shouldn't be parsed as self-link
17104 !! options
17105 title=[[Duna]] language=sr
17106 !! wikitext
17107 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17108 !! html
17109 <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.
17110 </p>
17111 !! end
17113 !! test
17114 Link to pages in language variants
17115 !! options
17116 language=sr
17117 !! wikitext
17118 Main Page can be written as [[Маин Паге]]
17119 !! html
17120 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17121 </p>
17122 !!end
17125 !! test
17126 Multiple links to pages in language variants
17127 !! options
17128 language=sr
17129 !! wikitext
17130 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17131 !! html
17132 <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>.
17133 </p>
17134 !!end
17137 !! test
17138 Simple template in language variants
17139 !! options
17140 language=sr
17141 !! wikitext
17142 {{тест}}
17143 !! html
17144 <p>This is a test template
17145 </p>
17146 !! end
17149 !! test
17150 Template with explicit namespace in language variants
17151 !! options
17152 language=sr
17153 !! wikitext
17154 {{Template:тест}}
17155 !! html
17156 <p>This is a test template
17157 </p>
17158 !! end
17161 !! test
17162 Basic test for template parameter in language variants
17163 !! options
17164 language=sr
17165 !! wikitext
17166 {{парамтест|param=foo}}
17167 !! html
17168 <p>This is a test template with parameter foo
17169 </p>
17170 !! end
17173 !! test
17174 Simple category in language variants
17175 !! options
17176 language=sr cat
17177 !! wikitext
17178 [[Category:МедиаWики Усер'с Гуиде]]
17179 !! html
17180 <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>
17181 !! end
17184 !! article
17185 Category:分类
17186 !! text
17187 blah
17188 !! endarticle
17190 !! article
17191 Category:分類
17192 !! text
17193 blah
17194 !! endarticle
17196 !! test
17197 Don't convert blue categorylinks to another variant (bug 33210)
17198 !! options
17199 language=zh cat
17200 !! wikitext
17201 [[A]][[Category:分类]]
17202 !! html
17203 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17204 !! end
17207 !! test
17208 Stripping -{}- tags (language variants)
17209 !! options
17210 language=sr
17211 !! wikitext
17212 Latin proverb: -{Ne nuntium necare}-
17213 !! html
17214 <p>Latin proverb: Ne nuntium necare
17215 </p>
17216 !! end
17219 !! test
17220 Prevent conversion with -{}- tags (language variants)
17221 !! options
17222 language=sr variant=sr-ec
17223 !! wikitext
17224 Latinski: -{Ne nuntium necare}-
17225 !! html
17226 <p>Латински: Ne nuntium necare
17227 </p>
17228 !! end
17231 !! test
17232 Prevent conversion of text with -{}- tags (language variants)
17233 !! options
17234 language=sr variant=sr-ec
17235 !! wikitext
17236 Latinski: -{Ne nuntium necare}-
17237 !! html
17238 <p>Латински: Ne nuntium necare
17239 </p>
17240 !! end
17243 !! test
17244 Prevent conversion of links with -{}- tags (language variants)
17245 !! options
17246 language=sr variant=sr-ec
17247 !! wikitext
17248 -{[[Main Page]]}-
17249 !! html
17250 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17251 </p>
17252 !! end
17255 !! test
17256 -{}- tags within headlines (within html for parserConvert())
17257 !! options
17258 language=sr variant=sr-ec
17259 !! wikitext
17260 == -{Naslov}- ==
17261 !! html
17262 <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>
17264 !! end
17267 !! test
17268 Explicit definition of language variant alternatives
17269 !! options
17270 language=zh variant=zh-tw
17271 !! wikitext
17272 -{zh:China;zh-tw:Taiwan}-, not China
17273 !! html
17274 <p>Taiwan, not China
17275 </p>
17276 !! end
17279 !! test
17280 Conversion around HTML tags
17281 !! options
17282 language=sr variant=sr-ec
17283 !! wikitext
17284 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17285 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17286 !! html
17288 <span title="ЛаCтин">ски</span>
17289 </p>
17290 !! end
17293 !! test
17294 Explicit session-wise language variant mapping (A flag and - flag)
17295 !! options
17296 language=zh variant=zh-tw
17297 !! wikitext
17298 Taiwan is not China.
17299 But -{A|zh:China;zh-tw:Taiwan}- is China,
17300 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17301 and -{China}- is China.
17302 !! html
17303 <p>Taiwan is not China.
17304 But Taiwan is Taiwan,
17305 (This should be stripped!)
17306 and China is China.
17307 </p>
17308 !! end
17310 !! test
17311 Explicit session-wise language variant mapping (H flag for hide)
17312 !! options
17313 language=zh variant=zh-tw
17314 !! wikitext
17315 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17316 Taiwan is China.
17317 !! html
17318 <p>(This should be stripped!)
17319 Taiwan is Taiwan.
17320 </p>
17321 !! end
17323 !! test
17324 Adding explicit conversion rule for title (T flag)
17325 !! options
17326 language=zh variant=zh-tw showtitle
17327 !! wikitext
17328 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17329 !! html
17330 Taiwan
17331 <p>Should be stripped!
17332 </p>
17333 !! end
17335 !! test
17336 Testing that changing the language variant here in the tests actually works
17337 !! options
17338 language=zh variant=zh showtitle
17339 !! wikitext
17340 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17341 !! html
17342 China
17343 <p>Should be stripped!
17344 </p>
17345 !! end
17347 !! test
17348 Recursive conversion of alt and title attrs shouldn't clear converter state
17349 !! options
17350 language=zh variant=zh-cn showtitle
17351 !! wikitext
17352 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17353 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17354 !! html
17355 China
17357 Should be stripped<span title="Exclamation">!</span>
17358 </p>
17359 !! end
17361 !! test
17362 Bug 24072: more test on conversion rule for title
17363 !! options
17364 language=zh variant=zh-tw showtitle
17365 !! wikitext
17366 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17367 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17368 !! html
17369 Taiwan
17370 <p>This should be stripped!
17371 This won't take interferes with the title rule.
17372 </p>
17373 !! end
17375 !! test
17376 Partly disable title conversion if variant == main language code
17377 !! options
17378 language=zh variant=zh title=[[ZH]] showtitle
17379 !! wikitext
17380 -{T|zh-cn:CN;zh-tw:TW}-
17381 !! html
17384 </p>
17385 !! end
17387 !! test
17388 Partly disable title conversion if variant == main language code, more
17389 !! options
17390 language=zh variant=zh title=[[ZH]] showtitle
17391 !! wikitext
17392 -{T|TW}-
17393 !! html
17396 </p>
17397 !! end
17399 !! test
17400 Raw output of variant escape tags (R flag)
17401 !! options
17402 language=zh variant=zh-tw
17403 !! wikitext
17404 Raw: -{R|zh:China;zh-tw:Taiwan}-
17405 !! html
17406 <p>Raw: zh:China;zh-tw:Taiwan
17407 </p>
17408 !! end
17410 !! test
17411 Nested using of manual convert syntax
17412 !! options
17413 language=zh variant=zh-hk
17414 !! wikitext
17415 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17416 !! html
17417 <p>Nested: Hello Hong Kong!
17418 </p>
17419 !! end
17421 !! test
17422 Proper conversion of text in external links
17423 !! options
17424 language=sr variant=sr-ec
17425 !! wikitext
17426 http://www.google.com
17427 gopher://www.google.com
17428 [http://www.google.com http://www.google.com]
17429 [gopher://www.google.com gopher://www.google.com]
17430 [https://www.google.com irc://www.google.com]
17431 [ftp://www.google.com www.google.com/ftp://dir]
17432 [//www.google.com www.google.com]
17433 !! html
17434 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17435 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17436 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17437 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17438 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17439 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17440 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17441 </p>
17442 !! end
17444 !! test
17445 Do not convert roman numbers to language variants
17446 !! options
17447 language=sr variant=sr-ec
17448 !! wikitext
17449 Fridrih IV je car.
17450 !! html
17451 <p>Фридрих IV је цар.
17452 </p>
17453 !! end
17455 !! test
17456 Unclosed language converter markup "-{"
17457 !! options
17458 language=sr
17459 !! wikitext
17460 -{T|hello
17461 !! html
17462 <p>-{T|hello
17463 </p>
17464 !! end
17466 !! test
17467 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17468 !! options
17469 language=sr
17470 !! wikitext
17471 -{R|=&gt;}-
17472 !! html
17473 <p>=&gt;
17474 </p>
17475 !!end
17477 !! test
17478 Don't break link parsing if language converter markup is in the caption.
17479 !! options
17480 language=sr variant=sr-ec
17481 !! wikitext
17482 [[Main Page|-{R|main page}-]]
17483 !! html
17484 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17485 </p>
17486 !! end
17488 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17489 !! test
17490 Don't break image parsing if language converter markup is in the caption.
17491 !! options
17492 language=sr
17493 !! wikitext
17494 [[File:Foobar.jpg|-{R|caption}-]]
17495 !! html/parsoid
17496 <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>
17497 </p>
17498 !! end
17500 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17501 !! test
17502 Don't break list handling if language converter markup is in the item.
17503 !! options
17504 language=zh variant=zh-cn
17505 !! wikitext
17506 ;-{zh-cn:AAA;zh-tw:BBB}-
17507 !! html/php
17508 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17510 !! html/parsoid
17511 <dl><dt>AAA
17512 </dt></dl>
17513 !! end
17515 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17516 !! test
17517 Don't break table handling if language converter markup is in the cell.
17518 !! options
17519 language=sr variant=sr-ec
17520 !! wikitext
17523 | -{R|B}-
17525 !! html/php
17526 <table>
17528 <tr>
17529 <td>Б}-
17530 </td></tr></table>
17532 !! html/parsoid
17533 <table>
17535 <tr>
17536 <td> B
17537 </td></tr></table>
17539 !! end
17541 !! test
17542 Bug 529: Uncovered bullet
17543 !! wikitext
17544 * Foo {{bullet}}
17545 !! html
17546 <ul><li> Foo </li>
17547 <li> Bar</li></ul>
17549 !! end
17551 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17552 # Templates in Wikipedia rely on this behavior, as tidy has always been
17553 # enabled there. These tests are normally run *without* tidy, so specify the
17554 # full output here. 
17555 # To test realistic parsing behavior, apply a tidy-like transformation to both
17556 # the expected output and your parser's output.
17557 !! test
17558 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17559 !! wikitext
17560 ******* Foo {{bullet}}
17561 !! html
17562 <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>
17563 <li> Bar</li></ul>
17565 !! end
17567 !! test
17568 Bug 529: Uncovered table already at line-start
17569 !! wikitext
17572 {{table}}
17574 !! html
17575 <p>x
17576 </p>
17577 <table>
17578 <tr>
17579 <td> 1 </td>
17580 <td> 2
17581 </td></tr>
17582 <tr>
17583 <td> 3 </td>
17584 <td> 4
17585 </td></tr></table>
17586 <p>y
17587 </p>
17588 !! end
17590 !! test
17591 Bug 529: Uncovered bullet in parser function result
17592 !! wikitext
17593 * Foo {{lc:{{bullet}} }}
17594 !! html
17595 <ul><li> Foo </li>
17596 <li> bar</li></ul>
17598 !! end
17600 !! test
17601 Bug 5678: Double-parsed template argument
17602 !! wikitext
17603 {{lc:{{{1}}}|hello}}
17604 !! html
17605 <p>{{{1}}}
17606 </p>
17607 !! end
17609 !! test
17610 Bug 5678: Double-parsed template invocation
17611 !! wikitext
17612 {{lc:{{paramtest {{!}} param = hello }} }}
17613 !! html
17614 <p>{{paramtest | param = hello }}
17615 </p>
17616 !! end
17618 !! test
17619 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17620 !! options
17621 language=cs
17622 title=[[Main Page]]
17623 !! wikitext
17624 {{PRVNÍVELKÉ:ěščř}}
17625 {{prvnívelké:ěščř}}
17626 {{PRVNÍMALÉ:ěščř}}
17627 {{prvnímalé:ěščř}}
17628 {{MALÁ:ěščř}}
17629 {{malá:ěščř}}
17630 {{VELKÁ:ěščř}}
17631 {{velká:ěščř}}
17632 !! html
17633 <p>Ěščř
17634 Ěščř
17635 ěščř
17636 ěščř
17637 ěščř
17638 ěščř
17639 ĚŠČŘ
17640 ĚŠČŘ
17641 </p>
17642 !! end
17644 !! test
17645 Morwen/13: Unclosed link followed by heading
17646 !! wikitext
17647 [[link
17648 ==heading==
17649 !! html
17650 <p>[[link
17651 </p>
17652 <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>
17654 !! end
17656 !! test
17657 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17658 !! wikitext
17659 {{foo|
17660 =heading=
17661 !! html
17662 <p>{{foo|
17663 </p>
17664 <h1><span class="mw-headline" id="heading">heading</span></h1>
17666 !! end
17668 !! test
17669 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17670 !! wikitext
17671 {{foo|
17672 ==heading==
17673 !! html
17674 <p>{{foo|
17675 </p>
17676 <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>
17678 !! end
17680 !! test
17681 Tildes in comments
17682 !! options
17684 !! wikitext
17685 <!-- ~~~~ -->
17686 !! html
17687 <!-- ~~~~ -->
17688 !! end
17690 !! test
17691 Paragraphs inside divs (no extra line breaks)
17692 !! wikitext
17693 <div>Line one
17695 Line two</div>
17696 !! html
17697 <div>Line one
17698 Line two</div>
17700 !! end
17702 !! test
17703 Paragraphs inside divs (extra line break on open)
17704 !! wikitext
17705 <div>
17706 Line one
17708 Line two</div>
17709 !! html
17710 <div>
17711 <p>Line one
17712 </p>
17713 Line two</div>
17715 !! end
17717 !! test
17718 Paragraphs inside divs (extra line break on close)
17719 !! wikitext
17720 <div>Line one
17722 Line two
17723 </div>
17724 !! html
17725 <div>Line one
17726 <p>Line two
17727 </p>
17728 </div>
17730 !! end
17732 !! test
17733 Paragraphs inside divs (extra line break on open and close)
17734 !! wikitext
17735 <div>
17736 Line one
17738 Line two
17739 </div>
17740 !! html
17741 <div>
17742 <p>Line one
17743 </p><p>Line two
17744 </p>
17745 </div>
17747 !! end
17749 !! test
17750 Nesting tags, paragraphs on lines which begin with <div>
17751 !! wikitext
17752 <div></div><strong>A
17753 B</strong>
17754 !! html/php+tidy
17755 <p><strong>A</strong></p>
17756 <p><strong>B</strong></p>
17757 !! html/parsoid
17758 <div></div>
17759 <p><strong>A
17760 B</strong>
17761 </p>
17762 !! end
17764 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17765 !! test
17766 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17767 !! wikitext
17768 <blockquote>Line one
17770 Line two</blockquote>
17771 !! html
17772 <blockquote>Line one
17773 Line two</blockquote>
17775 !! html+tidy
17776 <blockquote>
17777 <p>Line one Line two</p>
17778 </blockquote>
17779 !! end
17781 !! test
17782 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17783 !! wikitext
17784 <blockquote>
17785 Line one
17787 Line two</blockquote>
17788 !! html
17789 <blockquote>
17790 <p>Line one
17791 </p>
17792 Line two</blockquote>
17794 !! html+tidy
17795 <blockquote>
17796 <p>Line one</p>
17797 Line two</blockquote>
17798 !! end
17800 !! test
17801 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17802 !! wikitext
17803 <blockquote>Line one
17805 Line two
17806 </blockquote>
17807 !! html
17808 <blockquote>Line one
17809 <p>Line two
17810 </p>
17811 </blockquote>
17813 !! html+tidy
17814 <blockquote>
17815 <p>Line one</p>
17816 <p>Line two</p>
17817 </blockquote>
17818 !! end
17820 !! test
17821 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17822 !! wikitext
17823 <blockquote>
17824 Line one
17826 Line two
17827 </blockquote>
17828 !! html
17829 <blockquote>
17830 <p>Line one
17831 </p><p>Line two
17832 </p>
17833 </blockquote>
17835 !! html+tidy
17836 <blockquote>
17837 <p>Line one</p>
17838 <p>Line two</p>
17839 </blockquote>
17840 !! end
17842 !! test
17843 Paragraphs inside blockquotes/divs (no extra line breaks)
17844 !! wikitext
17845 <blockquote><div>Line one
17847 Line two</div></blockquote>
17848 !! html
17849 <blockquote><div>Line one
17850 Line two</div></blockquote>
17852 !! end
17854 !! test
17855 Paragraphs inside blockquotes/divs (extra line break on open)
17856 !! wikitext
17857 <blockquote><div>
17858 Line one
17860 Line two</div></blockquote>
17861 !! html
17862 <blockquote><div>
17863 <p>Line one
17864 </p>
17865 Line two</div></blockquote>
17867 !! end
17869 !! test
17870 Paragraphs inside blockquotes/divs (extra line break on close)
17871 !! wikitext
17872 <blockquote><div>Line one
17874 Line two
17875 </div></blockquote>
17876 !! html
17877 <blockquote><div>Line one
17878 <p>Line two
17879 </p>
17880 </div></blockquote>
17882 !! end
17884 !! test
17885 Paragraphs inside blockquotes/divs (extra line break on open and close)
17886 !! wikitext
17887 <blockquote><div>
17888 Line one
17890 Line two
17891 </div></blockquote>
17892 !! html
17893 <blockquote><div>
17894 <p>Line one
17895 </p><p>Line two
17896 </p>
17897 </div></blockquote>
17899 !! end
17901 !! test
17902 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17903 !! options
17904 wgLinkHolderBatchSize=0
17905 !! wikitext
17906 [[meatball:1]]
17907 [[meatball:2]]
17908 [[meatball:3]]
17909 !! html
17910 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17911 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17912 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17913 </p>
17914 !! end
17916 !! test
17917 Free external link invading image caption
17918 !! wikitext
17919 [[Image:Foobar.jpg|thumb|http://x|hello]]
17920 !! html
17921 <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>
17923 !! end
17925 !! test
17926 Bug 15196: localised external link numbers
17927 !! options
17928 language=fa
17929 !! wikitext
17930 [http://en.wikipedia.org/]
17931 !! html/php
17932 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17933 </p>
17934 !! html/parsoid
17935 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17936 !! end
17938 !! test
17939 Multibyte character in padleft
17940 !! wikitext
17941 {{padleft:-Hello|7|Æ}}
17942 !! html
17943 <p>Æ-Hello
17944 </p>
17945 !! end
17947 !! test
17948 Multibyte character in padright
17949 !! wikitext
17950 {{padright:Hello-|7|Æ}}
17951 !! html
17952 <p>Hello-Æ
17953 </p>
17954 !! end
17956 !!test
17957 formatdate parser function
17958 !! wikitext
17959 {{#formatdate:2009-03-24}}
17960 !! html
17961 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17962 </p>
17963 !! end
17965 !!test
17966 formatdate parser function, with default format
17967 !! wikitext
17968 {{#formatdate:2009-03-24|mdy}}
17969 !! html
17970 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17971 </p>
17972 !! end
17974 !! test
17975 Spacing of numbers in formatted dates
17976 !! wikitext
17977 {{#formatdate:January 15}}
17978 !! html
17979 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17980 </p>
17981 !! end
17983 !! test
17984 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
17985 !! options
17986 language=nl title=[[MediaWiki:Common.css]]
17987 !! wikitext
17988 {{#formatdate:2009-03-24|dmy}}
17989 !! html
17990 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17991 </p>
17992 !! end
17999 # Edit comments
18002 !! test
18003 Edit comment with link
18004 !! options
18005 comment
18006 !! wikitext
18007 I like the [[Main Page]] a lot
18008 !! html
18009 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18010 !!end
18012 !! test
18013 Edit comment with link and link text
18014 !! options
18015 comment
18016 !! wikitext
18017 I like the [[Main Page|best pages]] a lot
18018 !! html
18019 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18020 !!end
18022 !! test
18023 Edit comment with link and link text with suffix
18024 !! options
18025 comment
18026 !! wikitext
18027 I like the [[Main Page|best page]]s a lot
18028 !! html
18029 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18030 !!end
18032 !! test
18033 Edit comment with section link (non-local, eg in history list)
18034 !! options
18035 comment title=[[Main Page]]
18036 !! wikitext
18037 /* External links */ removed bogus entries
18038 !! html
18039 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18040 !!end
18042 !! test
18043 Edit comment with section link and text before it (non-local, eg in history list)
18044 !! options
18045 comment title=[[Main Page]]
18046 !! wikitext
18047 pre-comment text /* External links */ removed bogus entries
18048 !! html
18049 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>
18050 !!end
18052 !! test
18053 Edit comment with section link (local, eg in diff view)
18054 !! options
18055 comment local title=[[Main Page]]
18056 !! wikitext
18057 /* External links */ removed bogus entries
18058 !! html
18059 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18060 !!end
18062 !! test
18063 Edit comment with subpage link (bug 14080)
18064 !! options
18065 comment
18066 subpage
18067 title=[[Subpage test]]
18068 !! wikitext
18069 Poked at a [[/subpage]] here...
18070 !! html
18071 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18072 !!end
18074 !! test
18075 Edit comment with subpage link and link text (bug 14080)
18076 !! options
18077 comment
18078 subpage
18079 title=[[Subpage test]]
18080 !! wikitext
18081 Poked at a [[/subpage|neat little page]] here...
18082 !! html
18083 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18084 !!end
18086 !! test
18087 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18088 !! options
18089 comment
18090 title=[[Subpage test]]
18091 !! wikitext
18092 Poked at a [[/subpage]] here...
18093 !! html
18094 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...
18095 !!end
18097 !! test
18098 Edit comment with bare anchor link (local, as on diff)
18099 !! options
18100 comment
18101 local
18102 title=[[Main Page]]
18103 !! wikitext
18104 [[#section]]
18105 !! html
18106 <a href="#section">#section</a>
18107 !! end
18109 !! test
18110 Edit comment with bare anchor link (non-local, as on history)
18111 !! options
18112 comment
18113 title=[[Main Page]]
18114 !! wikitext
18115 [[#section]]
18116 !! html
18117 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18118 !! end
18120 !! test
18121 Anchor starting with underscore
18122 !! wikitext
18123 [[#_ref|One]]
18124 !! html
18125 <p><a href="#_ref">One</a>
18126 </p>
18127 !! end
18129 !! test
18130 Id starting with underscore
18131 !! wikitext
18132 <div id="_ref"></div>
18133 !! html
18134 <div id="_ref"></div>
18136 !! end
18138 !! test
18139 Space normalisation on autocomment (bug 22784)
18140 !! options
18141 comment
18142 title=[[Main Page]]
18143 !! wikitext
18144 /* __hello__world__ */
18145 !! html
18146 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18147 !! end
18149 !! test
18150 percent-encoding and + signs in comments (Bug 26410)
18151 !! options
18152 comment
18153 !! wikitext
18154 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18155 !! html
18156 <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>
18157 !! end
18159 # FIXME: Omitting the php sections here because of differences in the local and
18160 # jenkins output. But, more importantly, the Bad.jpg isn't being stripped,
18161 # which seems to be a problem with the testing infrastructure.
18162 !! test
18163 Bad images - basic functionality
18164 !! wikitext
18165 [[File:Bad.jpg]]
18166 !! html/parsoid
18167 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[File:Bad.jpg]]","optList":[]}'/>
18168 !! end
18170 # FIXME: Same reasoning as above. The expected php is:
18171 #  <p>Foo bar
18172 #  </p><p>Bar foo
18173 #  </p>
18174 !! test
18175 Bad images - bug 16039: text after bad image disappears
18176 !! wikitext
18177 Foo bar
18178 [[File:Bad.jpg]]
18179 Bar foo
18180 !! html/parsoid
18181 <p>Foo bar
18182 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[File:Bad.jpg]]","optList":[]}'/>
18183 Bar foo</p>
18184 !! end
18186 !! test
18187 Verify that displaytitle works (bug #22501) no displaytitle
18188 !! options
18189 showtitle
18190 !! config
18191 wgAllowDisplayTitle=true
18192 wgRestrictDisplayTitle=false
18193 !! wikitext
18194 this is not the the title
18195 !! html
18196 Parser test
18197 <p>this is not the the title
18198 </p>
18199 !! end
18201 !! test
18202 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18203 !! options
18204 showtitle
18205 title=[[Screen]]
18206 !! config
18207 wgAllowDisplayTitle=true
18208 wgRestrictDisplayTitle=false
18209 !! wikitext
18210 this is not the the title
18211 {{DISPLAYTITLE:whatever}}
18212 !! html
18213 whatever
18214 <p>this is not the the title
18215 </p>
18216 !! end
18218 !! test
18219 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18220 !! options
18221 showtitle
18222 title=[[Screen]]
18223 !! config
18224 wgAllowDisplayTitle=true
18225 wgRestrictDisplayTitle=true
18226 !! wikitext
18227 this is not the the title
18228 {{DISPLAYTITLE:whatever}}
18229 !! html
18230 Screen
18231 <p>this is not the the title
18232 </p>
18233 !! end
18235 !! test
18236 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18237 !! options
18238 showtitle
18239 title=[[Screen]]
18240 !! config
18241 wgAllowDisplayTitle=true
18242 wgRestrictDisplayTitle=true
18243 !! wikitext
18244 this is not the the title
18245 {{DISPLAYTITLE:screen}}
18246 !! html
18247 screen
18248 <p>this is not the the title
18249 </p>
18250 !! end
18252 !! test
18253 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18254 !! options
18255 showtitle
18256 title=[[Screen]]
18257 !! config
18258 wgAllowDisplayTitle=false
18259 !! wikitext
18260 this is not the the title
18261 {{DISPLAYTITLE:screen}}
18262 !! html
18263 Screen
18264 <p>this is not the the title
18265 <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>
18266 </p>
18267 !! end
18269 !! test
18270 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18271 !! options
18272 showtitle
18273 title=[[Screen]]
18274 !! config
18275 wgAllowDisplayTitle=false
18276 !! wikitext
18277 this is not the the title
18278 !! html
18279 Screen
18280 <p>this is not the the title
18281 </p>
18282 !! end
18284 !! test
18285 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18286 !! options
18287 showtitle
18288 title=[[Screen]]
18289 !! config
18290 wgAllowDisplayTitle=true
18291 wgRestrictDisplayTitle=true
18292 !! wikitext
18293 this is not the the title
18294 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18295 !! html
18296 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18297 <p>this is not the the title
18298 </p>
18299 !! end
18301 !! test
18302 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18303 !! options
18304 showtitle
18305 title=[[Screen]]
18306 !! config
18307 wgAllowDisplayTitle=true
18308 wgRestrictDisplayTitle=true
18309 !! wikitext
18310 this is not the the title
18311 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18312 !! html
18313 <span style="color: red;">s</span>creen
18314 <p>this is not the the title
18315 </p>
18316 !! end
18318 !! test
18319 preload: check <noinclude> and <includeonly>
18320 !! options
18321 preload
18322 !! wikitext
18323 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18324 !! html
18325 Hello kind world.
18326 !! end
18328 !! test
18329 preload: check <onlyinclude>
18330 !! options
18331 preload
18332 !! wikitext
18333 Goodbye <onlyinclude>Hello world</onlyinclude>
18334 !! html
18335 Hello world
18336 !! end
18338 !! test
18339 preload: can pass tags through if we want to
18340 !! options
18341 preload
18342 !! wikitext
18343 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18344 !! html
18345 <includeonly>Hello world</includeonly>
18346 !! end
18348 !! test
18349 preload: check that it doesn't try to do tricks
18350 !! options
18351 preload
18352 !! wikitext
18353 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18354 !! html
18355 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18356 !! end
18358 !! test
18359 Play a bit with r67090 and bug 3158
18360 !! wikitext
18361 <div style="width:50% !important">&nbsp;</div>
18362 <div style="width:50%&nbsp;!important">&nbsp;</div>
18363 <div style="width:50%&#160;!important">&nbsp;</div>
18364 <div style="border : solid;">&nbsp;</div>
18365 !! html/php
18366 <div style="width:50% !important">&#160;</div>
18367 <div style="width:50% !important">&#160;</div>
18368 <div style="width:50% !important">&#160;</div>
18369 <div style="border&#160;: solid;">&#160;</div>
18371 !! html/parsoid
18372 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18373 <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>
18374 <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>
18375 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18377 !! end
18379 !! test
18380 HTML5 data attributes
18381 !! wikitext
18382 <span data-foo="bar">Baz</span>
18383 <p data-abc-def_hij="">Quuz</p>
18384 !! html
18385 <p><span data-foo="bar">Baz</span>
18386 </p>
18387 <p data-abc-def_hij="">Quuz</p>
18389 !! end
18391 !! test
18392 percent-encoding and + signs in internal links (Bug 26410)
18393 !! wikitext
18394 [[User:+%]] [[Page+title%]]
18395 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18396 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18397 [[%33%45]] [[%33%45+]]
18398 !! html
18399 <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>
18400 <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>
18401 <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>
18402 <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>
18403 </p>
18404 !! end
18406 !! test
18407 Special characters in embedded file links (bug 27679)
18408 !! wikitext
18409 [[File:Contains & ampersand.jpg]]
18410 [[File:Does not exist.jpg|Title with & ampersand]]
18411 !! html
18412 <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>
18413 <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>
18414 </p>
18415 !! end
18418 !! test
18419 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18420 !! wikitext
18421 Text&apos;s been normalized?
18422 !! html
18423 <p>Text&#39;s been normalized?
18424 </p>
18425 !! end
18427 !! test
18428 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18429 !! wikitext
18430 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18431 !! html
18432 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18433 </p>
18434 !! end
18436 !! test
18437 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18438 !! wikitext
18439 [http://www.example.org/ ideograms]
18440 !! html
18441 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18442 </p>
18443 !! end
18445 !! test
18446 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18447 !! wikitext
18448 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18449 !! html
18450 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18451 </p>
18452 !! end
18454 !! article
18455 Mediawiki:loop1
18456 !! text
18457 {{Identical|A}}
18458 !! endarticle
18460 !! article
18461 Mediawiki:loop2
18462 !! text
18463 {{Identical|B}}
18464 !! endarticle
18466 !! article
18467 Template:Identical
18468 !! text
18469 {{int:loop1}}
18470 {{int:loop2}}
18471 !! endarticle
18473 !! test
18474 Bug 31098 Template which includes system messages which includes the template
18475 !! wikitext
18476 {{Identical}}
18477 !! html
18478 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18479 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18480 </p>
18481 !! end
18483 !! test
18484 Bug31490 Turkish: ucfirst 'blah'
18485 !! options
18486 language=tr
18487 !! wikitext
18488 {{ucfirst:blah}}
18489 !! html
18490 <p>Blah
18491 </p>
18492 !! end
18494 !! test
18495 Bug31490 Turkish: ucfirst 'ix'
18496 !! options
18497 language=tr
18498 !! wikitext
18499 {{ucfirst:ix}}
18500 !! html
18501 <p>İx
18502 </p>
18503 !! end
18505 !! test
18506 Bug31490 Turkish: lcfirst 'BLAH'
18507 !! options
18508 language=tr
18509 !! wikitext
18510 {{lcfirst:BLAH}}
18511 !! html
18512 <p>bLAH
18513 </p>
18514 !! end
18516 !! test
18517 Bug31490 Turkish: ucfırst (with a dotless i)
18518 !! options
18519 language=tr
18520 !! wikitext
18521 {{ucfırst:blah}}
18522 !! html
18523 <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>
18524 </p>
18525 !! end
18527 !! test
18528 Bug31490 ucfırst (with a dotless i) with English language
18529 !! options
18530 language=en
18531 !! wikitext
18532 {{ucfırst:blah}}
18533 !! html
18534 <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>
18535 </p>
18536 !! end
18538 !! test
18539 Bug 26375: TOC with italics
18540 !! options
18541 title=[[Main Page]]
18542 !! wikitext
18543 __TOC__
18544 == ''Lost'' episodes ==
18545 !! html
18546 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18547 <ul>
18548 <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>
18549 </ul>
18550 </div>
18552 <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>
18554 !! end
18556 !! test
18557 Bug 26375: TOC with bold
18558 !! options
18559 title=[[Main Page]]
18560 !! wikitext
18561 __TOC__
18562 == '''should be bold''' then normal text ==
18563 !! html
18564 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18565 <ul>
18566 <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>
18567 </ul>
18568 </div>
18570 <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>
18572 !! end
18574 !! test
18575 Bug 33845: Headings become cursive in TOC when they contain an image
18576 !! options
18577 title=[[Main Page]]
18578 !! wikitext
18579 __TOC__
18580 == Image [[Image:foobar.jpg]] ==
18581 !! html
18582 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18583 <ul>
18584 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18585 </ul>
18586 </div>
18588 <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>
18590 !! end
18592 !! test
18593 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18594 !! options
18595 title=[[Main Page]]
18596 !! wikitext
18597 __TOC__
18598 == <blockquote>Quote</blockquote> ==
18599 !! html
18600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18601 <ul>
18602 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18603 </ul>
18604 </div>
18606 <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>
18608 !! html+tidy
18609 <div id="toc" class="toc">
18610 <div id="toctitle">
18611 <h2>Contents</h2>
18612 </div>
18613 <ul>
18614 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18615 </ul>
18616 </div>
18617 <h2><span class="mw-headline" id="Quote"></span></h2>
18618 <blockquote>
18619 <p><span class="mw-headline" id="Quote">Quote</span></p>
18620 </blockquote>
18621 <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>
18622 !! end
18624 !! test
18625 Unclosed tags in TOC
18626 !! options
18627 title=[[Main Page]]
18628 !! wikitext
18629 __TOC__
18630 == Proof: 2 < 3 ==
18631 <small>Hanc marginis exiguitas non caperet.</small>
18633 !! html
18634 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18635 <ul>
18636 <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>
18637 </ul>
18638 </div>
18640 <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>
18641 <p><small>Hanc marginis exiguitas non caperet.</small>
18643 </p>
18644 !! end
18646 !! test
18647 Multiple tags in TOC
18648 !! wikitext
18649 __TOC__
18650 == <i>Foo</i> <b>Bar</b> ==
18652 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18653 !! html
18654 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18655 <ul>
18656 <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>
18657 <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>
18658 </ul>
18659 </div>
18661 <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>
18662 <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>
18664 !! html+tidy
18665 <div id="toc" class="toc">
18666 <div id="toctitle">
18667 <h2>Contents</h2>
18668 </div>
18669 <ul>
18670 <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>
18671 <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>
18672 </ul>
18673 </div>
18674 <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>
18675 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18676 <blockquote>
18677 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18678 </blockquote>
18679 <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>
18680 !! end
18682 !! test
18683 Tags with parameters in TOC
18684 !! wikitext
18685 __TOC__
18686 == <sup class="in-h2">Hello</sup> ==
18688 == <sup class="a > b">Evilbye</sup> ==
18689 !! html
18690 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18691 <ul>
18692 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18693 <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>
18694 </ul>
18695 </div>
18697 <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>
18698 <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>
18700 !! end
18702 !! test
18703 span tags with directionality in TOC
18704 !! wikitext
18705 __TOC__
18706 == <span dir="ltr">C++</span> ==
18708 == <span dir="rtl">זבנג!</span> ==
18710 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18712 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18714 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18715 !! html
18716 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18717 <ul>
18718 <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>
18719 <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>
18720 <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>
18721 <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>
18722 <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>
18723 </ul>
18724 </div>
18726 <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>
18727 <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>
18728 <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>
18729 <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>
18730 <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>
18732 !! end
18734 !! article
18735 MediaWiki:Bug32057
18736 !! text
18737 == {{int:headline_sample}} ==
18738 !! endarticle
18740 !! test
18741 Bug 32057: Title needed when expanding <h> nodes.
18742 !! options
18743 title=[[Main Page]]
18744 !! wikitext
18745 {{int:Bug32057}}
18746 !! html
18747 <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>
18749 !! end
18751 !! test
18752 Strip marker in urlencode
18753 !! wikitext
18754 {{urlencode:x<nowiki/>y}}
18755 {{urlencode:x<nowiki/>y|wiki}}
18756 {{urlencode:x<nowiki/>y|path}}
18757 !! html
18758 <p>xy
18761 </p>
18762 !! end
18764 !! test
18765 Strip marker in lc
18766 !! wikitext
18767 {{lc:x<nowiki/>y}}
18768 !! html
18769 <p>xy
18770 </p>
18771 !! end
18773 !! test
18774 Strip marker in uc
18775 !! wikitext
18776 {{uc:x<nowiki/>y}}
18777 !! html
18778 <p>XY
18779 </p>
18780 !! end
18782 !! test
18783 Strip marker in formatNum
18784 !! wikitext
18785 {{formatnum:1<nowiki/>2}}
18786 {{formatnum:1<nowiki/>2|R}}
18787 !! html
18788 <p>12
18790 </p>
18791 !! end
18793 !! test
18794 Check noCommafy in formatNum
18795 !! options
18796 language=be-tarask
18797 !! wikitext
18798 {{formatnum:123456.78}}
18799 {{formatnum:123456.78|NOSEP}}
18800 !! html
18801 <p>123 456,78
18802 123456.78
18803 </p>
18804 !! end
18806 !! test
18807 Wrong option for formatNum (bug 56199)
18808 !! wikitext
18809 {{formatnum:1,234.56|Random}}
18810 {{formatnum:1,234.56|EVERYTHING}}
18811 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18812 !! html
18813 <p>1,234.56
18814 1,234.56
18815 1,234.56
18816 </p>
18817 !! end
18819 !! test
18820 Strip marker in grammar
18821 !! options
18822 language=fi
18823 !! wikitext
18824 {{grammar:elative|foo<nowiki/>bar}}
18825 !! html
18826 <p>foobarista
18827 </p>
18828 !! end
18830 !! test
18831 Strip marker in padleft
18832 !! wikitext
18833 {{padleft:|2|x<nowiki/>y}}
18834 !! html
18835 <p>xy
18836 </p>
18837 !! end
18839 !! test
18840 Strip marker in padright
18841 !! wikitext
18842 {{padright:|2|x<nowiki/>y}}
18843 !! html
18844 <p>xy
18845 </p>
18846 !! end
18848 !! test
18849 Strip marker in anchorencode
18850 !! wikitext
18851 {{anchorencode:x<nowiki/>y}}
18852 !! html
18853 <p>xy
18854 </p>
18855 !! end
18857 !! test
18858 nowiki inside link inside heading (bug 18295)
18859 !! wikitext
18860 ==[[foo|x<nowiki>y</nowiki>z]]==
18861 !! html
18862 <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>
18864 !! end
18866 !! test
18867 new support for bdi element (bug 31817)
18868 !! wikitext
18869 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18870 !! html
18871 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18873 !!end
18875 !! test
18876 Ignore pipe between table row attributes
18877 !! wikitext
18879 | quux
18880 |- id=foo | style='color: red'
18881 | bar
18883 !! html
18884 <table>
18885 <tr>
18886 <td> quux
18887 </td></tr>
18888 <tr id="foo" style="color: red">
18889 <td> bar
18890 </td></tr></table>
18892 !! end
18894 !!test
18895 Gallery override link with WikiLink (bug 34852)
18896 !! wikitext
18897 <gallery>
18898 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18899 </gallery>
18900 !! html
18901 <ul class="gallery mw-gallery-traditional">
18902                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18903                         <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>
18904                         <div class="gallerytext">
18905 <p>caption
18906 </p>
18907                         </div>
18908                 </div></li>
18909 </ul>
18911 !! end
18913 !!test
18914 Gallery override link with absolute external link (bug 34852)
18915 !! wikitext
18916 <gallery>
18917 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18918 </gallery>
18919 !! html
18920 <ul class="gallery mw-gallery-traditional">
18921                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18922                         <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>
18923                         <div class="gallerytext">
18924 <p>caption
18925 </p>
18926                         </div>
18927                 </div></li>
18928 </ul>
18930 !! end
18932 !!test
18933 Gallery override link with malicious javascript (bug 34852)
18934 !! wikitext
18935 <gallery>
18936 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18937 </gallery>
18938 !! html
18939 <ul class="gallery mw-gallery-traditional">
18940                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18941                         <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>
18942                         <div class="gallerytext">
18943 <p>caption
18944 </p>
18945                         </div>
18946                 </div></li>
18947 </ul>
18949 !! end
18951 !!test
18952 Gallery with invalid title as link (bug 43964)
18953 !! wikitext
18954 <gallery>
18955 File:foobar.jpg|link=<
18956 </gallery>
18957 !! html
18958 <ul class="gallery mw-gallery-traditional">
18959                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18960                         <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>
18961                         <div class="gallerytext">
18962                         </div>
18963                 </div></li>
18964 </ul>
18966 !! end
18968 !!test
18969 Language parser function
18970 !! wikitext
18971 {{#language:ar}}
18972 !! html
18973 <p>العربية
18974 </p>
18975 !! end
18977 !!test
18978 Padleft and padright as substr
18979 !! wikitext
18980 {{padleft:|3|abcde}}
18981 {{padright:|3|abcde}}
18982 !! html
18983 <p>abc
18985 </p>
18986 !! end
18988 !!test
18989 Special parser function
18990 !! wikitext
18991 {{#special:RandomPage}}
18992 {{#special:BaDtItLe}}
18993 {{#special:Foobar}}
18994 !! html
18995 <p>Special:Random
18996 Special:Badtitle
18997 Special:Foobar
18998 </p>
18999 !! end
19001 !!test
19002 Bug 34939 - Case insensitive link parsing ([HttP://])
19003 !! wikitext
19004 [HttP://MediaWiki.Org/]
19005 !! html/php
19006 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19007 </p>
19008 !! html/parsoid
19009 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19010 !! end
19012 !!test
19013 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19014 !! wikitext
19015 [HttP://MediaWiki.Org/ MediaWiki]
19016 !! html
19017 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19018 </p>
19019 !! end
19021 !!test
19022 Bug 34939 - Case insensitive link parsing (HttP://)
19023 !! wikitext
19024 HttP://MediaWiki.Org/
19025 !! html/php
19026 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19027 </p>
19028 !! html/parsoid
19029 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19030 !! end
19032 !!test
19033 Disable TOC
19034 !! options
19035 notoc
19036 !! wikitext
19037 Lead
19038 == Section 1 ==
19039 == Section 2 ==
19040 == Section 3 ==
19041 == Section 4 ==
19042 == Section 5 ==
19043 !! html
19044 <p>Lead
19045 </p>
19047 <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>
19048 <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>
19049 <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>
19050 <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>
19051 <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>
19053 !! end
19057 ### Parsoid-specific tests
19058 ### Parsoid-PHP parser incompatibilities
19060 !!test
19061 1. SOL-sensitive wikitext tokens as template-args
19062 !!options
19063 parsoid=wt2html,wt2wt
19064 !! wikitext
19065 {{echo|*a}}
19066 {{echo|#a}}
19067 {{echo|:a}}
19068 !! html
19069 <span about="#mwt1" typeof="mw:Transclusion">
19070 </span><ul about="#mwt1"><li>a</li>
19071 </ul>
19072 <span about="#mwt2" typeof="mw:Transclusion">
19073 </span><ol about="#mwt2"><li>a</li>
19074 </ol>
19075 <span about="#mwt3" typeof="mw:Transclusion">
19076 </span><dl about="#mwt3"><dd>a</dd>
19077 </dl>
19078 !!end
19080 #### -----------------------------------------------------------------
19081 #### Parsoid-specific functionality tests
19082 #### -----------------------------------------------------------------
19084 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19085 # We know wt2wt will fail, but we expect selser to pass.
19086 # Due to the nature of our testing, wt2wt and selser tests will enter the
19087 # blacklist and we'll catch selser regressions based on changes to the
19088 # blacklist entries for selser tests.
19089 !! test
19090 1. Bad treebuilder fixup of formatting elt is cleaned up
19091 !! options
19092 parsoid=wt2html,wt2wt
19093 !! wikitext
19096 <small>
19097 [[Image:Foobar.jpg|right|Test]]
19098 </small>
19100 !! html/parsoid
19101 <table>
19102 <tbody><tr><td>
19103 <small>
19104 <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>
19105 </small>
19106 </td></tr>
19107 </tbody></table>
19108 !! end
19110 !! test
19111 2. Bad treebuilder fixup of formatting elt is cleaned up
19112 !! options
19113 parsoid=wt2html,wt2wt
19114 !! wikitext
19115 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19117 <small>[[Image:Foobar.jpg|right|300px]]</small>
19118 !! html/parsoid
19119 <p><b>foo</b></p>
19120 <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>
19121 <p><b>bar</b></p>
19122 <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>
19123 !! end
19125 #### ----------------------------------------------------------------
19126 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19127 #### tags. Parsoid's output for these tags differs from that of the
19128 #### PHP parser.
19129 #### ----------------------------------------------------------------
19131 !!test
19132 Ref: 1. ref-location should be replaced with an index span
19133 !!options
19134 parsoid
19135 !! wikitext
19136 A <ref>foo</ref>
19137 B <ref name="x">foo</ref>
19138 C <ref name="y" />
19139 !! html
19140 <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>
19141 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>
19142 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>
19143 !!end
19145 !!test
19146 Ref: 2. ref-tags with identical names should all get the same index
19147 !!options
19148 parsoid
19149 !! wikitext
19150 A <ref name="x">foo</ref>
19151 B <ref name="x" />
19152 !! html
19153 <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>
19154 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>
19155 !!end
19157 !!test
19158 Ref: 3. spaces in ref-names should be ignored
19159 !!options
19160 parsoid
19161 !! wikitext
19162 A <ref name="x">foo</ref>
19163 B <ref name=" x " />
19164 C <ref name= x  />
19165 !! html
19166 <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>
19167 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>
19168 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>
19169 !!end
19171 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19172 !!test
19173 Ref: 4. 'constructor' should be accepted as a valid ref-name
19174 !!options
19175 parsoid
19176 !! wikitext
19177 A <ref name="constructor">foo</ref>
19178 !! html
19179 <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>
19180 !!end
19182 !!test
19183 Ref: 5. body should accept generic wikitext
19184 !!options
19185 parsoid
19186 !! wikitext
19187 A <ref>
19188  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19189 </ref>
19191 <references />
19192 !! html
19193 <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>
19195 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19196 <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>
19197 </li>
19198 </ol>
19199 !!end
19201 !!test
19202 Ref: 6. indent-pres should not be output in ref-body
19203 !!options
19204 parsoid
19205 !! wikitext
19206 A <ref>
19207  foo
19208  bar
19209  baz
19210 </ref>
19212 <references />
19213 !! html
19214 <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>
19216 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19217 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19218  bar
19219  baz
19220 </li>
19221 </ol>
19222 !!end
19224 !!test
19225 Ref: 7. No p-wrapping in ref-body
19226 !!options
19227 parsoid
19228 !! wikitext
19229 A <ref>
19239 booz
19240 </ref>
19242 <references />
19243 !! html
19244 <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>
19246 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19247 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19256 booz
19257 </li>
19258 </ol>
19259 !!end
19261 !!test
19262 Ref: 8. transclusion wikitext has lower precedence
19263 !!options
19264 parsoid
19265 !! wikitext
19266 A <ref> foo {{echo|</ref> B C}}
19268 <references />
19269 !! html
19270 <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>
19271 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19272 <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>
19273 </ol>
19274 !!end
19276 !!test
19277 Ref: 9. unclosed comments should not leak out of ref-body
19278 !!options
19279 parsoid
19280 !! wikitext
19281 A <ref> foo <!--</ref> B C
19282 <references />
19283 !! html
19284 <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>
19285 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19286 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19287 </ol>
19288 !!end
19290 !!test
19291 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19292 !!options
19293 parsoid
19294 !! wikitext
19295 A <ref> <b> foo </ref> B C
19297 <references />
19298 !! html
19299 <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>
19302 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19303 <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>
19304 </ol>
19305 !!end
19307 !!test
19308 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19309 !!options
19310 parsoid
19311 !! wikitext
19312 A <ref>foo</ref> B
19313 C <ref>bar</ref> D
19314 !! html
19315 <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
19316 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>
19317 !!end
19319 !!test
19320 Ref: 12. ref-tags act as trailing newline migration barrier
19321 !!options
19322 parsoid
19323 !! wikitext
19324 <!--the newline at the end of this line moves out of the p-tag-->a
19326 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19327 <ref />
19330 !! html
19331 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19334 <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>
19335 <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>
19337 <p>c</p>
19338 !!end
19340 !!test
19341 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19342 !!options
19343 parsoid
19344 !! wikitext
19345 <ref>foo</ref> A
19346 <ref>bar
19347 </ref> B
19348 !! html
19349 <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
19350 <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>
19351 !!end
19353 !!test
19354 Ref: 14. A nested ref-tag should be emitted as plain text
19355 !!options
19356 parsoid
19357 !! wikitext
19358 <ref>foo <ref>bar</ref> baz</ref>
19360 <references />
19361 !! html
19362 <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>
19364 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19365 <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>
19366 </ol>
19367 !!end
19369 !!test
19370 Ref: 15. ref-tags with identical names should get identical indexes
19371 !!options
19372 parsoid
19373 !! wikitext
19374 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19375 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19377 <references />
19378 !! html
19379 <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>
19380 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>
19382 <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>
19383 </ol>
19384 !!end
19386 ## We don't bother wt2wt-ing non-standard whitespace
19387 !!test
19388 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19389 !!options
19390 parsoid=wt2html
19391 !! wikitext
19392 A <ref >foo</ref >
19394 <references />
19395 !! html
19396 <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>
19398 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19399 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19400 !!end
19402 !!test
19403 References: 1. references tag without any refs should be handled properly
19404 !!options
19405 parsoid
19406 !! wikitext
19407 <references />
19408 !! html
19409 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19410 !!end
19412 !!test
19413 References: 2. references tag with group only outputs references from that group
19414 !!options
19415 parsoid
19416 !! wikitext
19417 A <ref group="a">foo</ref>
19418 B <ref group="b">bar</ref>
19420 <references group="a" />
19421 !! html
19422 <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>
19423 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>
19425 <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>
19426 </ol>
19427 !!end
19429 !!test
19430 References: 3. ref list should be cleared after processing references
19431 !!options
19432 parsoid
19433 !! wikitext
19434 A <ref>foo</ref>
19436 <references />
19438 B <ref>bar</ref>
19440 <references />
19441 !! html
19442 <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>
19444 <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>
19445 </ol>
19447 <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>
19449 <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>
19450 </ol>
19451 !!end
19453 !!test
19454 References: 4. only referenced group should be cleared after processing references
19455 !!options
19456 parsoid
19457 !! wikitext
19458 A <ref group="a">afoo</ref>
19459 B <ref>bfoo</ref>
19461 <references group="a" />
19463 C <ref>cfoo</ref>
19465 <references />
19466 !! html
19467 <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>
19468 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>
19470 <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>
19471 </ol>
19473 <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>
19475 <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>
19476 </ol>
19477 !!end
19479 !!test
19480 References: 5. ref tags in references should be processed while ignoring all other content
19481 !!options
19482 parsoid
19483 !! wikitext
19484 A <ref name="a" />
19485 B <ref name="b">bar</ref>
19487 <references>
19488 <ref name="a">foo</ref>
19489 This should just get lost.
19490 </references>
19491 !! html
19492 <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>
19493 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>
19496 <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>
19497 </ol>
19498 !!end
19500 !!test
19501 References: 6. <references /> from a transclusion
19502 !!options
19503 parsoid
19504 !! wikitext
19505 <ref>Foo</ref> {{echo|<references />}}
19506 !! html
19507 <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>
19508 !!end
19510 !! test
19511 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19512 !! options
19513 parsoid
19514 !! wikitext
19515 A <ref>foo bar for a</ref>
19516 B <ref group="X" name="b" />
19518 <references />
19520 <references group="X">
19521 <ref name="b">foo</ref>
19522 </references>
19523 !! html
19524 <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>
19525 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>
19527 <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>
19529 <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>
19530 !! end
19532 !! test
19533 Entities in ref name
19534 !! options
19535 parsoid
19536 !! wikitext
19537 <ref name="test &amp; me">hi</ref>
19538 !! html
19539 <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>
19540 !! end
19542 # This test is wt2html only because we're permitting the serializer to produce
19543 # dirty diffs, normalizing the unclosed references to the self-closed version.
19544 !! test
19545 Generate references for unclosed references tag
19546 !! options
19547 parsoid=wt2html
19548 !! wikitext
19549 a<ref>foo</ref>
19551 <references>
19552 !! html
19553 <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>
19556 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19557 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19558 !! end
19560 !! test
19561 New reference serializes on its own line
19562 !! options
19563 parsoid=wt2wt,html2wt
19564 !! wikitext
19566 <references />
19567 !! html
19568 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19569 !! end
19571 #--------- Test stripping of empty nodes in template content ----------
19572 !!test
19573 Empty LI and TR nodes should be stripped from template content
19574 !!wikitext
19575 {{EmptyLITest}}
19576 {{EmptyTRTest}}
19577 !!html/parsoid
19578 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19579 <li>a</li>
19580 <li>b</li>
19581 </ul>
19582 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19583 <tbody>
19584 <tr>
19585 <td>foo</td>
19586 </tr>
19587 <tr>
19588 <td>bar</td>
19589 </tr>
19590 </tbody>
19591 </table>
19592 !!end
19594 !!test
19595 Empty LI and TR nodes should not be stripped from top-level content
19596 !!wikitext
19597 * a
19599 * b
19603 |foo
19605 !!html/parsoid
19606 <ul>
19607 <li> a</li>
19608 <li></li>
19609 <li> b</li>
19610 </ul>
19611 <table>
19612 <tbody>
19613 <tr></tr>
19614 <tr>
19615 <td>foo</td>
19616 </tr>
19617 </tbody>
19618 </table>
19619 !!end
19621 !!test
19622 Empty TR nodes should not be stripped if they have any attributes set
19623 !!wikitext
19624 {{EmptyTRWithHTMLAttrTest}}
19625 !!html/parsoid
19626 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19627 <tr align="center"></tr>
19628 <tr><td>foo</td></tr>
19629 <tr align="center"></tr>
19630 <tr><td>bar</td></tr>
19631 </table>
19632 !!end
19634 #### ----------------------------------------------------------------
19635 #### The following section of tests are primarily to test
19636 #### wikitext escaping capabilities of Parsoid.  Given that
19637 #### escaping can be done any number of ways, the wikitext (input)
19638 #### is always adjusted to reflect how Parsoid adds nowiki
19639 #### escape tags.
19640 ####
19641 #### We are marking several tests as parsoid-only since the
19642 #### HTML in the result section is different from what the
19643 #### PHP parser generates for it.
19644 #### ----------------------------------------------------------------
19647 #### --------------- Headings ---------------
19648 #### 0. Unnested
19649 #### 1. Nested inside html <h1>=foo=</h1>
19650 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19651 #### 3. Nested inside html with wikitext split by html tags
19652 #### 4. No escape needed
19653 #### 5. Empty headings <h1></h1>
19654 #### 6. Heading chars in SOL context
19655 #### ----------------------------------------
19656 !! test
19657 Headings: 0. Unnested
19658 !! options
19659 parsoid
19660 !! wikitext
19661 <nowiki>=foo=</nowiki>
19663 <nowiki> =foo= </nowiki>
19664 <!--cmt-->
19665 <nowiki>=foo=</nowiki>
19667 =foo''a''<nowiki>=</nowiki>
19668 !! html
19669 <p><span typeof="mw:Nowiki">=foo=</span></p>
19671 <p><span typeof="mw:Nowiki"> =foo= </span>
19672 <!--cmt-->
19673 <span typeof="mw:Nowiki">=foo=</span></p>
19675 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19676 !!end
19678 # New headings and existing headings are handled differently
19679 !! test
19680 Headings: 1. Nested inside html
19681 !! options
19682 parsoid=html2wt
19683 !! wikitext
19684 = =foo= =
19686 == =foo= ==
19688 === =foo= ===
19690 =<nowiki>=foo=</nowiki>=
19691 ==<nowiki>=foo=</nowiki>==
19692 ===<nowiki>=foo=</nowiki>===
19693 ====<nowiki>=foo=</nowiki>====
19694 =====<nowiki>=foo=</nowiki>=====
19695 ======<nowiki>=foo=</nowiki>======
19697 !! html
19698 <h1>=foo=</h1>
19699 <h2>=foo=</h2>
19700 <h3>=foo=</h3>
19702 <h1 data-parsoid=''>=foo=</h1>
19703 <h2 data-parsoid=''>=foo=</h2>
19704 <h3 data-parsoid=''>=foo=</h3>
19705 <h4 data-parsoid=''>=foo=</h4>
19706 <h5 data-parsoid=''>=foo=</h5>
19707 <h6 data-parsoid=''>=foo=</h6>
19708 !!end
19710 !! test
19711 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19712 !! options
19713 parsoid=html2wt
19714 !! wikitext
19715 = foo =
19716 <nowiki>*</nowiki>bar
19718 = foo =
19719 =bar
19721 = foo =
19722 <nowiki>=bar=</nowiki>
19723 !! html
19724 <h1>foo</h1>*bar
19725 <h1>foo</h1>=bar
19726 <h1>foo</h1>=bar=
19727 !!end
19729 !! test
19730 Headings: 3. Nested inside html with wikitext split by html tags
19731 !! options
19732 parsoid=html2wt
19733 !! wikitext
19734 = ='''bold'''<nowiki>foo=</nowiki> =
19735 !! html
19736 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19737 !!end
19739 !! test
19740 Headings: 4a. No escaping needed (testing just h1 and h2)
19741 !! options
19742 parsoid=html2wt
19743 !! wikitext
19744 = =foo =
19746 = foo= =
19748 = =foo= =
19750 = =foo= bar =
19752 == =foo ==
19754 == foo= ==
19756 = ''=''foo= =
19758 = <nowiki>=</nowiki> =
19759 !! html
19760 <h1>=foo</h1>
19761 <h1>foo=</h1>
19762 <h1> =foo= </h1>
19763 <h1>=foo= bar</h1>
19764 <h2>=foo</h2>
19765 <h2>foo=</h2>
19766 <h1><i>=</i>foo=</h1>
19767 <h1><span typeof="mw:Nowiki">=</span></h1>
19768 !!end
19770 !! test
19771 Headings: 4b. No escaping needed (inside p-tags)
19772 !! options
19773 parsoid=html2wt
19774 !! wikitext
19776 =foo= x
19777 =foo= <s></s>
19778 !! html
19779 <p>===
19780 =foo= x
19781 =foo= <s></s>
19782 </p>
19783 !!end
19785 !! test
19786 Headings: 5. Empty headings
19787 !! options
19788 parsoid
19789 !! wikitext
19790 =<nowiki/>=
19792 ==<nowiki/>==
19794 ===<nowiki/>===
19796 ====<nowiki/>====
19798 =====<nowiki/>=====
19800 ======<nowiki/>======
19801 !! html
19802 <h1></h1>
19803 <h2></h2>
19804 <h3></h3>
19805 <h4></h4>
19806 <h5></h5>
19807 <h6></h6>
19808 !!end
19810 !! test
19811 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19812 !! options
19813 parsoid
19814 !! wikitext
19815 <nowiki>=a=</nowiki>
19817 <nowiki>=a=</nowiki> 
19819 <nowiki>=a=</nowiki>    
19821 <nowiki>=a=</nowiki>    
19822 !! html
19823 <p>=a=</p>
19824 <p>=a= </p>
19825 <p>=a=  </p>
19826 <p>=a=  </p>
19827 !!end
19829 !! test
19830 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19831 !! options
19832 parsoid
19833 !! wikitext
19834 <nowiki>=a=
19835 b</nowiki>
19837 <nowiki>=a= 
19838 b</nowiki>
19840 <nowiki>=a=     
19841 b</nowiki>
19843 <nowiki>=a=      
19844 b</nowiki>
19845 !! html
19846 <p>=a=
19847 b</p>
19848 <p>=a= 
19849 b</p>
19850 <p>=a=  
19851 b</p>
19852 <p>=a=   
19853 b</p>
19854 </p>
19855 !!end
19857 !! test
19858 Headings: 6c. Heading chars in SOL context (leading newline break)
19859 !! options
19860 parsoid
19861 !! wikitext
19863 <nowiki>=b=</nowiki>
19864 !! html
19865 <p>a
19866 =b=</p>
19867 !!end
19869 !! test
19870 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19871 !! options
19872 parsoid
19873 !! wikitext
19874 <!--c0--><nowiki>=a=</nowiki>
19876 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
19877 !! html
19878 <p><!--c0-->=a=</p>
19879 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
19880 !!end
19882 !! test
19883 Headings: 6d. Heading chars in SOL context (No escaping needed)
19884 !! options
19885 parsoid=html2wt
19886 !! wikitext
19887 =a=<div>b</div>
19888 !! html
19889 =a=<div>b</div>
19890 !!end
19892 #### --------------- Lists ---------------
19893 #### 0. Outside nests (*foo, etc.)
19894 #### 1. Nested inside html <ul><li>*foo</li></ul>
19895 #### 2. Inside definition lists
19896 #### 3. Only bullets at start should be escaped
19897 #### 4. No escapes needed
19898 #### 5. No unnecessary escapes
19899 #### 6. Escape bullets in SOL position
19900 #### 7. Escape bullets in a multi-line context
19901 #### ----------------------------------------
19903 !! test
19904 Lists: 0. Outside nests
19905 !! wikitext
19906 <nowiki>*</nowiki>foo
19908 <nowiki>#</nowiki>foo
19910 <nowiki>;Foo:</nowiki>bar
19911 !! html
19912 <p>*foo
19913 </p><p>#foo
19914 </p><p>;Foo:bar
19915 </p>
19916 !!end
19918 !! test
19919 Lists: 1. Nested inside html
19920 !! wikitext
19921 *<nowiki>*foo</nowiki>
19923 *<nowiki>#foo</nowiki>
19925 *<nowiki>:foo</nowiki>
19927 *<nowiki>;foo</nowiki>
19929 #<nowiki>*foo</nowiki>
19931 #<nowiki>#foo</nowiki>
19933 #<nowiki>:foo</nowiki>
19935 #<nowiki>;foo</nowiki>
19936 !! html
19937 <ul><li>*foo</li></ul>
19938 <ul><li>#foo</li></ul>
19939 <ul><li>:foo</li></ul>
19940 <ul><li>;foo</li></ul>
19941 <ol><li>*foo</li></ol>
19942 <ol><li>#foo</li></ol>
19943 <ol><li>:foo</li></ol>
19944 <ol><li>;foo</li></ol>
19946 !!end
19948 !! test
19949 Lists: 2. Inside definition lists
19950 !! wikitext
19951 ;<nowiki>;foo</nowiki>
19953 ;<nowiki>:foo</nowiki>
19955 ;<nowiki>:foo</nowiki>
19956 :bar
19958 :<nowiki>:foo</nowiki>
19959 !! html
19960 <dl><dt>;foo</dt></dl>
19961 <dl><dt>:foo</dt></dl>
19962 <dl><dt>:foo</dt>
19963 <dd>bar</dd></dl>
19964 <dl><dd>:foo</dd></dl>
19966 !!end
19968 !! test
19969 Lists: 3. Only bullets at start of text should be escaped
19970 !! wikitext
19971 *<nowiki>*foo*bar</nowiki>
19973 *<nowiki>*foo</nowiki>''it''*bar
19974 !! html
19975 <ul><li>*foo*bar</li></ul>
19976 <ul><li>*foo<i>it</i>*bar</li></ul>
19978 !!end
19980 !! test
19981 Lists: 4. No escapes needed
19982 !! options
19983 parsoid
19984 !! wikitext
19985 *foo*bar
19987 *''foo''*bar
19989 *[[Foo]]: bar
19991 *[[Foo]]*bar
19992 !! html
19993 <ul>
19994 <li>foo*bar
19995 </li>
19996 </ul>
19997 <ul>
19998 <li><i>foo</i>*bar
19999 </li>
20000 </ul>
20001 <ul>
20002 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20003 </li>
20004 </ul>
20005 <ul>
20006 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20007 </li>
20008 </ul>
20009 !!end
20011 !! test
20012 Lists: 5. No unnecessary escapes
20013 !! wikitext
20014 * bar <span><nowiki>[[foo]]</nowiki></span>
20016 *=bar <span><nowiki>[[foo]]</nowiki></span>
20018 *[[bar <span><nowiki>[[foo]]</nowiki></span>
20020 *]]bar <span><nowiki>[[foo]]</nowiki></span>
20022 *=bar <span>foo]]</span>=
20024 * <s></s>: a
20025 !! html
20026 <ul><li> bar <span>[[foo]]</span></li></ul>
20027 <ul><li>=bar <span>[[foo]]</span></li></ul>
20028 <ul><li>[[bar <span>[[foo]]</span></li></ul>
20029 <ul><li>]]bar <span>[[foo]]</span></li></ul>
20030 <ul><li>=bar <span>foo]]</span>=</li></ul>
20031 <ul><li> <s></s>: a</li></ul>
20033 !!end
20035 !! test
20036 Lists: 6. Escape bullets in SOL position
20037 !! options
20038 parsoid
20039 !! wikitext
20040 <!--cmt--><nowiki>*foo</nowiki>
20041 !! html
20042 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
20043 !!end
20045 !! test
20046 Lists: 7. Escape bullets in a multi-line context
20047 !! wikitext
20049 <nowiki>*</nowiki>b
20050 !! html
20051 <p>a
20053 </p>
20054 !!end
20056 #### --------------- HRs ---------------
20057 #### 1. Single line
20058 #### -----------------------------------
20060 !! test
20061 HRs: 1. Single line
20062 !! options
20063 parsoid
20064 !! wikitext
20065 ----<nowiki>----</nowiki>
20066 ----=foo=
20067 ----*foo
20068 !! html
20069 <hr><p><span typeof="mw:Nowiki">----</span></p>
20070 <hr><p>=foo=</p>
20071 <hr><p>*foo</p>
20072 !! end
20074 #### --------------- Tables ---------------
20075 #### 1a. Simple example
20076 #### 1b. No escaping needed (!foo)
20077 #### 1c. No escaping needed (|foo)
20078 #### 1d. No escaping needed (|}foo)
20079 ####
20080 #### 2a. Nested in td (<td>foo|bar</td>)
20081 #### 2b. Nested in td (<td>foo||bar</td>)
20082 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20083 ####
20084 #### 3a. Nested in th (<th>foo!bar</th>)
20085 #### 3b. Nested in th (<th>foo!!bar</th>)
20086 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20087 ####
20088 #### 4a. Escape -
20089 #### 4b. Escape +
20090 #### 4c. No escaping needed
20091 #### --------------------------------------
20093 !! test
20094 Tables: 1a. Simple example
20095 !! wikitext
20096 <nowiki>{|
20097 |}</nowiki>
20098 !! html
20099 <p>{|
20101 </p>
20102 !! end
20104 !! test
20105 Tables: 1b. No escaping needed
20106 !! wikitext
20107 !foo
20108 !! html
20109 <p>!foo
20110 </p>
20111 !! end
20113 !! test
20114 Tables: 1c. No escaping needed
20115 !! wikitext
20116 |foo
20117 !! html
20118 <p>|foo
20119 </p>
20120 !! end
20122 !! test
20123 Tables: 1d. No escaping needed
20124 !! wikitext
20125 |}foo
20126 !! html
20127 <p>|}foo
20128 </p>
20129 !! end
20131 !! test
20132 Tables: 2a. Nested in td
20133 !! options
20134 parsoid=html2wt
20135 !! wikitext
20137 |<nowiki>foo|bar</nowiki>
20139 |x<div><nowiki>a|b</nowiki></div>
20141 !! html
20142 <table><tbody><tr>
20143 <td>foo|bar</td></tr>
20144 <tr><td>x<div>a|b</div></td>
20145 </tbody></table>
20146 !! end
20148 !! test
20149 Tables: 2b. Nested in td
20150 !! options
20151 parsoid
20152 !! wikitext
20154 |<nowiki>foo||bar</nowiki>
20155 |''it''<nowiki>foo||bar</nowiki>
20157 !! html
20158 <table><tbody><tr>
20159 <td><span typeof="mw:Nowiki">foo||bar</span></td>
20160 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
20161 !! end
20163 !! test
20164 Tables: 2c. Nested in td -- no escaping needed
20165 !! options
20166 parsoid
20167 !! wikitext
20169 |foo!!bar
20171 !! html
20172 <table><tbody><tr><td>foo!!bar
20173 </td></tr></tbody></table>
20175 !! end
20177 !! test
20178 Tables: 3a. Nested in th
20179 !! options
20180 parsoid
20181 !! wikitext
20183 !foo!bar
20185 !! html
20186 <table><tbody><tr><th>foo!bar
20187 </th></tr></tbody></table>
20189 !! end
20191 !! test
20192 Tables: 3b. Nested in th
20193 !! options
20194 parsoid
20195 !! wikitext
20197 !<nowiki>foo!!bar</nowiki>
20199 !! html
20200 <table>
20201 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
20202 </tbody></table>
20203 !! end
20205 !! test
20206 Tables: 3c. Nested in th -- no escaping needed
20207 !! options
20208 parsoid
20209 !! wikitext
20211 !<nowiki>foo||bar</nowiki>
20213 !! html
20214 <table><tbody><tr>
20215 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
20216 !! end
20218 !! test
20219 Tables: 4a. Escape -
20220 !! options
20221 parsoid
20222 !! wikitext
20224 !-bar
20226 |<nowiki>-bar</nowiki>
20228 !! html
20229 <table><tbody>
20230 <tr><th>-bar</th></tr>
20231 <tr>
20232 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
20233 !! end
20235 !! test
20236 Tables: 4b. Escape +
20237 !! options
20238 parsoid
20239 !! wikitext
20241 !+bar
20243 |<nowiki>+bar</nowiki>
20245 !! html
20246 <table><tbody>
20247 <tr><th>+bar</th></tr>
20248 <tr>
20249 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
20250 !! end
20252 !! test
20253 Tables: 4c. No escaping needed
20254 !! options
20255 parsoid
20256 !! wikitext
20258 |foo-bar
20259 |foo+bar
20261 |''foo''-bar
20262 |''foo''+bar
20264 |foo
20265 bar|baz
20266 +bar
20267 -bar
20270 <div>a|b</div>
20272 !! html
20273 <table><tbody>
20274 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20275 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20276 <tr><td>foo
20277 <p>bar|baz
20278 +bar
20279 -bar</p></td></tr>
20280 <tr><td>x
20281 <div>a|b</div></td>
20282 </tbody></table>
20283 !! end
20285 !! test
20286 Tables: 4d. No escaping needed
20287 !! options
20288 parsoid
20289 !! wikitext
20291 |[[Foo]]-bar
20292 ||+1
20293 ||-2
20295 !! html
20296 <table>
20297 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20298 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20299 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20300 </tbody></table>
20301 !! end
20303 !! test
20304 Tables: Digest broken attributes on table and tr tag
20305 !! options
20306 parsoid=wt2html
20307 !! wikitext
20308 {| || |} ++
20309 |- || || ++ --
20310 |- > [
20312 !! html
20313 <table>
20314 <tbody>
20315 <tr></tr>
20316 <tr></tr>
20317 </tbody></table>
20318 !! end
20320 #### --------------- Links ----------------
20321 #### 1. Quote marks in link text
20322 #### 2. Wikilinks: Escapes needed
20323 #### 3. Wikilinks: No escapes needed
20324 #### 4. Extlinks: Escapes needed
20325 #### 5. Extlinks: No escapes needed
20326 #### --------------------------------------
20327 !! test
20328 Links 1. Quote marks in link text
20329 !! options
20330 parsoid
20331 !! wikitext
20332 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20333 !! html
20334 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20335 !! end
20337 !! test
20338 Links 2. WikiLinks: Escapes needed
20339 !! options
20340 parsoid
20341 !! wikitext
20342 [[Foo|[Foobar]]]
20343 [[Foo|<nowiki>Foobar]</nowiki>]]
20344 [[Foo|x [Foobar] x]]
20345 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20346 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20347 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20348 [[Foo|<nowiki>|Bar</nowiki>]]
20349 [[Foo|<nowiki>]]bar</nowiki>]]
20350 [[Foo|<nowiki>[[bar</nowiki>]]
20351 [[Foo|<nowiki>x [[ y</nowiki>]]
20352 [[Foo|<nowiki>x ]] y</nowiki>]]
20353 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20354 !! html
20355 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20356 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20357 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20358 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20359 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20360 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20361 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20362 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20363 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20364 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20365 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20366 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20367 !! end
20369 !! test
20370 Links 3. WikiLinks: No escapes needed
20371 !! options
20372 parsoid
20373 !! wikitext
20374 [[Foo|[Foobar]]
20375 [[Foo|foo|bar]]
20376 !! html
20377 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20378 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20379 !! end
20381 !! test
20382 Links 4. ExtLinks: Escapes needed
20383 !! options
20384 parsoid
20385 !! wikitext
20386 [http://google.com <nowiki>[google]</nowiki>]
20387 [http://google.com <nowiki>google]</nowiki>]
20389 <nowiki>[http://google.com]</nowiki>
20391 <nowiki>[http://google.com google]</nowiki>
20393 !! html
20394 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20395 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20396 <p>[http://google.com]</p>
20397 <p>[http://google.com google]</p>
20398 !! end
20400 !! test
20401 Links 5. ExtLinks: No escapes needed
20402 !! options
20403 parsoid
20404 !! wikitext
20405 [http://google.com [google]
20406 !! html
20407 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20408 !! end
20410 !! test
20411 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20412 !! html/parsoid
20413 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20414 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20415 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20416 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20417 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20418 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20419 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20420 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20421 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20423 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20424 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20425 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20426 </p>
20427 !! wikitext
20428 x<nowiki/>http://example.com<nowiki/>y
20429 http://example.com<nowiki/>?x
20430 http://example.com<nowiki/>&x
20431 http://example.com<nowiki/>'x
20432 http://example.com<nowiki/>,x
20433 http://example.com<nowiki/>.x
20434 http://example.com<nowiki/>;x
20435 http://example.com<nowiki/>:x
20436 http://example.com<nowiki/>;x
20437 http://example.com<nowiki/>!x
20438 http://example.com<nowiki/>=x
20439 http://example.com<nowiki/>(x)
20440 http://example.com(x<nowiki/>)
20441 !! end
20443 !! test
20444 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20445 !! html/parsoid
20446 <p>x
20447 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20449 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20450 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20451 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20452 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20453 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20454 </p>
20455 !! wikitext
20457 http://example.com
20459 "http://example.com"
20460 (http://example.com)
20461 (http://example.com) foo
20462 http://example.com,
20463 http://example.com, foo
20464 !! end
20466 ## Parsoid currently fails wt2html on this one!
20467 !! test
20468 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20469 !! html/parsoid
20470 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20471 !! wikitext
20472 http://example.com.,;:!?
20473 !! end
20475 !! test
20476 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20477 !! html/parsoid
20478 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20479 !! wikitext
20480 RFC 123<nowiki/>4
20481 !! end
20483 !! test
20484 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20485 !! html/parsoid
20486 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20487 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20488 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20489 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20490 </p>
20491 !! wikitext
20492 xRFC 123y
20493 XRFC 123y
20494 RFC 123?foo
20495 RFC 123&foo
20496 !! end
20498 !! test
20499 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20500 !! html/parsoid
20501 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20502 !! wikitext
20503 PMID 123<nowiki/>4
20504 !! end
20506 !! test
20507 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20508 !! html/parsoid
20509 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20510 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20511 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20512 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20513 </p>
20514 !! wikitext
20515 xPMID 123y
20516 XPMID 123y
20517 PMID 123?foo
20518 PMID 123&foo
20519 !! end
20521 !! test
20522 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20523 !! html/parsoid
20524 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20525 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20526 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20527 </p>
20528 !! wikitext
20529 ISBN 1234567890<nowiki/>1
20530 ISBN 1234567890<nowiki/>x
20531 ISBN 1234567890<nowiki/>b
20532 !! end
20534 !! test
20535 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20536 !! html/parsoid
20537 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20538 !! wikitext
20539 ISBN 1234567890's
20540 !! end
20542 #### --------------- Quotes ---------------
20543 #### 1. Quotes inside <b> and <i>
20544 #### 2. Link fragments separated by <i> and <b> tags
20545 #### 3. Link fragments inside <i> and <b>
20546 #### 4. No escaping needed
20547 #### --------------------------------------
20548 !! test
20549 1. Quotes inside <b> and <i>
20550 !! options
20551 parsoid=html2wt,wt2wt
20552 !! wikitext
20553 ''<nowiki>'foo'</nowiki>''
20554 ''<nowiki>''foo''</nowiki>''
20555 ''<nowiki>'''foo'''</nowiki>''
20556 ''foo''<nowiki/>'s
20557 '''<nowiki>'foo'</nowiki>'''
20558 '''<nowiki>''foo''</nowiki>'''
20559 '''<nowiki>'''foo'''</nowiki>'''
20560 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20561 '''foo'''<nowiki/>'s
20562 '''foo''
20563 ''foo''<nowiki/>'
20564 '<nowiki/>''foo''<nowiki/>'
20565 ''''foo'''
20566 '''foo'''<nowiki/>'
20567 '<nowiki/>'''foo'''<nowiki/>'
20568 ''fools'<span> errand</span>''
20569 ''<span>fool</span>'s errand''
20570 !! html
20571 <p><i>'foo'</i>
20572 <i>''foo''</i>
20573 <i>'''foo'''</i>
20574 <i>foo</i>'s
20575 <b>'foo'</b>
20576 <b>''foo''</b>
20577 <b>'''foo'''</b>
20578 <b>foo'<i>bar'</i>baz</b>
20579 <b>foo</b>'s
20580 '<i>foo</i>
20581 <i>foo</i>'
20582 '<i>foo</i>'
20583 '<b>foo</b>
20584 <b>foo</b>'
20585 '<b>foo</b>'</p>
20586 <i>fools'<span> errand</span></i>
20587 <i><span>fool</span>'s errand</i>
20588 !! end
20590 !! test
20591 2. Link fragments separated by <i> and <b> tags
20592 !! wikitext
20593 [[''foo''<nowiki>hello]]</nowiki>
20595 [['''foo'''<nowiki>hello]]</nowiki>
20596 !! html
20597 <p>[[<i>foo</i>hello]]
20598 </p><p>[[<b>foo</b>hello]]
20599 </p>
20600 !! end
20602 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
20603 #        this is one of the shortcomings of this format
20604 !! test
20605 3. Link fragments inside <i> and <b>
20606 !! wikitext
20607 ''[[foo''<nowiki>]]</nowiki>
20609 '''[[foo'''<nowiki>]]</nowiki>
20610 !! html
20611 <p><i>[[foo</i>]]
20612 </p><p><b>[[foo</b>]]
20613 </p>
20614 !! end
20616 !! test
20617 4. No escaping needed
20618 !! wikitext
20619 '<span>''bar''</span>'
20620 '<span>'''bar'''</span>'
20621 !! html
20622 <p>'<span><i>bar</i></span>'
20623 '<span><b>bar</b></span>'
20624 </p>
20625 !! end
20627 #### ----------- Paragraphs ---------------
20628 #### 1. No unnecessary escapes
20629 #### --------------------------------------
20631 !! test
20632 1. No unnecessary escapes
20633 !! wikitext
20634 bar <span><nowiki>[[foo]]</nowiki></span>
20636 =bar <span><nowiki>[[foo]]</nowiki></span>
20638 [[bar <span><nowiki>[[foo]]</nowiki></span>
20640 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20642 =bar <span>foo]]</span><nowiki>=</nowiki>
20643 !! html
20644 <p>bar <span>[[foo]]</span>
20645 </p><p>=bar <span>[[foo]]</span>
20646 </p><p>[[bar <span>[[foo]]</span>
20647 </p><p>]]bar <span>[[foo]]</span>
20648 </p><p>=bar <span>foo]]</span>=
20649 </p>
20650 !!end
20652 #### ----------------------- PRE --------------------------
20653 #### 1. Leading whitespace in SOL context should be escaped
20654 #### ------------------------------------------------------
20655 !! test
20656 1. Leading whitespace in SOL context should be escaped
20657 !! options
20658 parsoid
20659 !! wikitext
20660 <nowiki> </nowiki>a
20662 <nowiki> </nowiki> a
20664 <nowiki>        </nowiki>a(tab)
20666 <nowiki> </nowiki>      a
20667 <!--cmt-->
20668 <nowiki> </nowiki> a
20671 <nowiki> </nowiki>b
20674 <nowiki>        </nowiki>b
20677 <nowiki>        </nowiki> b
20678 !! html
20679 <p> a</p>
20680 <p>  a</p>
20681 <p>     a(tab)</p>
20682 <p>     a</p>
20683 <p><!--cmt-->  a</p>
20684 <p>a
20685  b</p>
20686 <p>a
20687         b</p>
20688 <p>a
20689          b</p>
20690 !! end
20692 !! test
20693 2. Leading whitespace in non-indent-pre contexts should not be escaped
20694 !! options
20695 parsoid
20696 !! wikitext
20697 foo <ref>''a''
20698  b</ref>
20699 !! html
20700 <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>
20701 !! end
20703 !! test
20704 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20705 !! options
20706 parsoid
20707 !! wikitext
20708 <blockquote>
20710  <span>b</span>
20712 </blockquote>
20713 !! html
20714 <blockquote>
20717  <span>b</span>
20718  c</p>
20719 </blockquote>
20720 !! end
20722 !! test
20723 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20724 !! options
20725 parsoid
20726 !! wikitext
20727  [[File:Foobar.jpg|thumb|caption]]
20728 !! html
20729 !! html/parsoid
20730  <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>
20731 !! end
20733 !! test
20734 5. Nowiki escaping should account for indent-pres
20735 !! options
20736 parsoid=html2wt
20737 !! html
20738 <pre>==foo==</pre>
20739 !! wikitext
20740  ==foo==
20741 !! end
20743 #### --------------- Behavior Switches --------------------
20744 !! test
20745 1. Valid behavior switches should be escaped
20746 !! options
20747 parsoid=html2wt
20748 !! wikitext
20749 <nowiki>__TOC__</nowiki>
20750 ''<nowiki>__TOC__</nowiki>''
20751 !! html
20752 __TOC__
20753 <i>__TOC__</i>
20754 !! end
20756 !! test
20757 2. Invalid behavior switches should not be escaped
20758 !! options
20759 parsoid=html2wt
20760 !! wikitext
20761 __TOO__
20762 __|__
20763 !! html
20764 __TOO__
20765 __|__
20766 !! end
20768 #### --------------- HTML tags ---------------
20769 #### 1. a tags
20770 #### 2. other tags
20771 #### 3. multi-line html tag
20772 #### 4. extension tags
20773 #### -----------------------------------------
20774 !! test
20775 1. a tags
20776 !! options
20777 parsoid
20778 !! wikitext
20779 <a href="http://google.com">google</a>
20780 !! html
20781 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20782 !! end
20784 !! test
20785 2. other tags
20786 !! wikitext
20787 <nowiki><div>foo</div>
20788 <div style="color:red">foo</div></nowiki>
20789 !! html
20790 <p>&lt;div&gt;foo&lt;/div&gt;
20791 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20792 </p>
20793 !! end
20795 !! test
20796 3. multi-line html tag
20797 !! wikitext
20798 <nowiki><div
20799 >foo</div
20800 ></nowiki>
20801 !! html
20802 <p>&lt;div
20803 &gt;foo&lt;/div
20804 &gt;
20805 </p>
20806 !! end
20808 !! test
20809 4. extension tags
20810 !! wikitext
20811 <nowiki><ref>foo</ref></nowiki>
20813 <nowiki><ref>bar</nowiki>
20815 baz<nowiki></ref></nowiki>
20816 !! html
20817 <p>&lt;ref&gt;foo&lt;/ref&gt;
20818 </p><p>&lt;ref&gt;bar
20819 </p><p>baz&lt;/ref&gt;
20820 </p>
20821 !! end
20823 #### --------------- Others ---------------
20824 !! test
20825 Escaping nowikis
20826 !! wikitext
20827 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20828 !! html
20829 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20830 </p>
20831 !! end
20833 ## The quote-char in the input is necessary for triggering the bug
20834 !! test
20835 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20836 !! options
20837 parsoid=wt2wt,html2wt
20838 !! wikitext
20839 foo's bar :
20840 !! html
20841 <p>foo's bar :</p>
20842 !! end
20844 !! test
20846 Tag-like HTML structures are passed through as text
20847 !! wikitext
20848 <x y>
20850 <x.y>
20852 <x-y>
20860 1<d e>f
20861 !! html
20862 <p>&lt;x y&gt;
20863 </p><p>&lt;x.y&gt;
20864 </p><p>&lt;x-y&gt;
20865 </p><p>1&gt;2
20866 </p><p>x&lt;y
20867 </p><p>a&gt;b
20868 </p><p>1&lt;d e&gt;f
20869 </p>
20870 !! end
20873 # This was a bug in the PHP parser (see bug 17663 and its dups,
20874 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20875 !! test
20876 Tag names followed by punctuation should not be recognized as tags
20877 !! wikitext
20878 <s.ome> text
20879 !! html
20880 <p>&lt;s.ome&gt; text
20881 </p>
20882 !! end
20884 !! test
20885 HTML tag with necessary entities in attributes
20886 !! wikitext
20887 <span title="&amp;amp;">foo</span>
20888 !! html
20889 <p><span title="&amp;amp;">foo</span>
20890 </p>
20891 !! end
20893 !! test
20894 HTML tag with 'unnecessary' entity encoding in attributes
20895 !! wikitext
20896 <span title="&amp;">foo</span>
20897 !! html
20898 <p><span title="&amp;">foo</span>
20899 </p>
20900 !! end
20902 !! test
20903 HTML tag with broken attribute value quoting
20904 !! wikitext
20905 <span title="Hello world>Foo</span>
20906 !! html/php
20907 <p><span>Foo</span>
20908 </p>
20909 !! html/parsoid
20910 <p><span title="Hello world">Foo</span>
20911 </p>
20912 !! end
20914 !! test
20915 Parsoid-only: HTML tag with broken attribute value quoting
20916 !! options
20917 parsoid
20918 !! wikitext
20919 <span title="Hello world>Foo</span>
20920 !! html
20921 <p><span title="Hello world">Foo</span>
20922 </p>
20923 !! end
20925 !! test
20926 Table with broken attribute value quoting
20927 !! wikitext
20929 | title="Hello world|Foo
20931 !! html/php
20932 <table>
20933 <tr>
20934 <td>Foo
20935 </td></tr></table>
20937 !! html/parsoid
20938 <table>
20939 <tr>
20940 <td title="Hello world">Foo
20941 </td></tr></table>
20943 !! end
20945 !! test
20946 Table with broken attribute value quoting on consecutive lines
20947 !! wikitext
20949 | title="Hello world|Foo
20950 | style="color:red|Bar
20952 !! html/php
20953 <table>
20954 <tr>
20955 <td>Foo
20956 </td>
20957 <td>Bar
20958 </td></tr></table>
20960 !! html/parsoid
20961 <table><tbody>
20962 <tr>
20963 <td title="Hello world">Foo
20964 </td><td style="color: red">Bar
20965 </td></tr></tbody></table>
20967 !! end
20969 !! test
20970 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20971 !! options
20972 parsoid
20973 !! wikitext
20974 {{}}
20975 !! html
20976 {{}}
20977 !! end
20979 !! test
20980 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20981 !! options
20982 parsoid
20983 !! wikitext
20984 }}{{
20985 !! html
20986 }}{{
20987 !! end
20989 !!test
20990 Accept empty td cell attribute
20991 !! wikitext
20993 | align="center" | foo ||  |
20995 !! html
20996 <table>
20997 <tr>
20998 <td align="center"> foo </td>
20999 <td>
21000 </td></tr></table>
21002 !!end
21004 !!test
21005 Non-empty attributes in th-cells
21006 !! wikitext
21008 ! Foo !! style="color: red" | Bar
21010 !! html
21011 <table>
21012 <tr>
21013 <th> Foo </th>
21014 <th style="color: red"> Bar
21015 </th></tr></table>
21017 !!end
21019 !!test
21020 Accept empty attributes in th-cells
21021 !! wikitext
21023 !| foo !!| bar
21025 !! html
21026 <table>
21027 <tr>
21028 <th> foo </th>
21029 <th> bar
21030 </th></tr></table>
21032 !!end
21034 !!test
21035 Empty table rows go away
21036 !! wikitext
21038 | Hello
21039 | there
21040 |- class="foo"
21043 !! html
21044 <table>
21045 <tr>
21046 <td> Hello
21047 </td>
21048 <td> there
21049 </td></tr>
21051 </table>
21053 !! end
21056 ### Parsoid-centric tests for testing RTing of inter-element separators
21057 ### Edge cases not tested by existing parser tests and specific to
21058 ### Parsoid-specific serialization strategies.
21061 !!test
21062 RT-ed inter-element separators should be valid separators
21063 !! wikitext
21065 |- [[foo]]
21067 !! html
21068 <table>
21070 </table>
21072 !!end
21074 # Parsoid-only since PHP parser relies on Tidy for correct output
21075 !!test
21076 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21077 !!options
21078 parsoid
21079 !! wikitext
21081 |<small>foo
21086 |<small>foo<small>
21088 !! html
21089 <table>
21090 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21091 <p>bar</p></small></td></tr>
21092 </tbody></table>
21094 <table>
21095 <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>
21096 </tbody></table>
21097 !!end
21099 !!test
21100 Empty TD followed by TD with tpl-generated attribute
21101 !! wikitext
21105 |{{echo|style='color:red'}}|foo
21107 !! html
21108 <table>
21110 <tr>
21111 <td>
21112 </td>
21113 <td>foo
21114 </td></tr></table>
21116 !!end
21118 !!test
21119 Indented table with an empty td
21120 !! wikitext
21121  {|
21122  |-
21124  |foo
21125  |}
21126 !! html
21127 <table>
21129 <tr>
21130 <td>
21131 </td>
21132 <td>foo
21133 </td></tr></table>
21135 !!end
21137 !!test
21138 Indented block & table
21139 !! wikitext
21140  <div>foo</div>
21141  {|
21142  |foo
21143  |}
21144 !! html/php
21145  <div>foo</div>
21146 <table>
21147 <tr>
21148 <td>foo
21149 </td></tr></table>
21151 !! html/parsoid
21152  <div data-parsoid='{"stx":"html"}'>foo</div>
21153  <table><tbody>
21154  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21155  </tbody></table>
21156 !!end
21158 !! test
21159 Indent and comment before table row
21160 !! wikitext
21162  <!--hi-->|-
21163  | there
21165 !! html/php
21166 <table>
21168 <tr>
21169 <td> there
21170 </td></tr></table>
21172 !! html/parsoid
21173 <table>
21174  <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21175  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21176 </tbody></table>
21177 !! end
21179 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21180 !!test
21181 Empty TR followed by a template-generated TR
21182 !!options
21183 parsoid
21184 !! wikitext
21187 {{echo|<tr><td>foo</td></tr>}}
21189 !! html
21190 <table>
21191 <tbody>
21192 <tr></tr>
21193 <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}}]}'>
21194 <td>foo</td></tr>
21195 </tbody></table>
21196 !!end
21198 ## PHP and parsoid output differ for this, and since this is primarily
21199 ## for testing Parsoid's serializer, marking this Parsoid only
21200 !!test
21201 Empty TR followed by mixed-ws-comment line should RT correctly
21202 !!options
21203 parsoid
21204 !! wikitext
21207  <!--c-->
21209 <!--c--> <!--d-->
21211 !! html
21212 <table>
21213 <tbody>
21214 <tr></tr>
21215  <!--c-->
21216 <tr>
21217 <!--c--> </tr><!--d-->
21218 </tbody></table>
21220 !!end
21222 !!test
21223 Multi-line image caption generated by templates with/without trailing newlines
21224 !!options
21225 parsoid
21226 !! wikitext
21227 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21228 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21229 !! html
21230 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
21231 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
21233 !!end
21235 !! test
21236 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21237 !! options
21238 parsoid=html2wt
21239 !! wikitext
21240 <includeonly>foo</includeonly>
21241 new para
21243 [[./Category:Foo]]
21245 = new heading =
21246 !! html
21247 <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>
21249 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21250 !! end
21252 ## PHP emits broken html for this, and since this is primarily
21253 ## a Parsoid serializer test, marking this Parsoid only
21254 !!test
21255 Improperly nested inline or quotes tags with whitespace in between
21256 !!options
21257 parsoid
21258 !! wikitext
21259 <span> <s>x</span> </s>
21260 ''' ''x''' ''
21261 !! html
21262 <p><span> <s>x</s></span><s> </s>
21263 <b> <i>x</i></b><i> </i>
21264 </p>
21265 !!end
21267 !!test
21268 Encapsulate protected attributes from wt
21269 !!options
21270 parsoid
21271 !! wikitext
21272 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21273 !! html
21274 <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>
21275 </body>
21276 !!end
21278 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21279 ## Having nested or stray pre tags results in the attempt to add duplicates,
21280 ## causing an assertion fail. This test tries to prevent that situation.
21281 !!test
21282 Ensure ParagraphWrapper can deal with stray closing pre tags
21283 !!options
21284 parsoid=wt2html
21285 !! wikitext
21286 plain text</pre>
21287 !! html
21288 plain text
21289 !!end
21291 !!test
21292 1. Ensure fostered text content is wrapped in element nodes
21293 !!options
21294 parsoid=wt2html
21295 !! wikitext
21296 <table>hi</table><table>ho</table>
21297 !! html
21298 <p>hi</p>
21299 <table></table>
21300 <p>ho</p>
21301 <table></table>
21302 !!end
21304 !!test
21305 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21306 !!options
21307 parsoid=wt2html,wt2wt
21308 !! wikitext
21309 <table>
21310 <tr> || ||
21311 <td> a
21312 </table>
21313 !! html
21314 <p> || ||
21315 </p><table>
21316 <tbody><tr><td> a</td></tr>
21317 </tbody></table>
21318 !!end
21320 !!test
21321 Encapsulation properly handles null DSR information from foster box
21322 !!options
21323 parsoid=wt2html,wt2wt
21324 !! wikitext
21325 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21326 !! html
21327 <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>
21328 !!end
21330 !!test
21331 1. Encapsulate foster-parented transclusion content
21332 !!options
21333 parsoid=wt2wt,wt2html
21334 !! wikitext
21335 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21336 !! html
21337 <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>
21338 <tbody>
21339 <tr>
21340 <td>bar</td>
21341 </tr>
21342 </tbody>
21343 </table>
21344 !!end
21346 !!test
21347 2. Encapsulate foster-parented transclusion content
21348 !!options
21349 parsoid=wt2wt,wt2html
21350 !! wikitext
21351 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21352 !! html
21353 <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>
21354 <table>
21355 <tbody>
21356 <tr>
21357 <td>bar</td>
21358 </tr>
21359 </tbody>
21360 </table>
21361 !!end
21363 !!test
21364 3. Encapsulate foster-parented transclusion content
21365 !!options
21366 parsoid=wt2wt,wt2html
21367 !! wikitext
21368 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21369 !! html
21370 <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;]}">
21371 <p>foo</p>
21372 </div>
21373 <table>
21374 <tbody>
21375 <tr>
21376 <td>bar</td>
21377 </tr>
21378 </tbody>
21379 </table>
21380 !!end
21382 !!test
21383 4. Encapsulate foster-parented transclusion content
21384 !!options
21385 parsoid=wt2wt,wt2html
21386 !! wikitext
21387 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21388 !! html
21389 <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;]}">
21390 <p>foo</p>
21391 </div>
21392 <table>
21393 <tbody>
21394 <tr>
21395 <td>bar</td>
21396 </tr>
21397 </tbody>
21398 </table>
21399 !!end
21401 !!test
21402 5. Encapsulate foster-parented transclusion content
21403 !!options
21404 parsoid=wt2wt,wt2html
21405 !! wikitext
21406 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21407 !! html
21408 <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>
21409 <table>
21410 <tbody>
21411 <tr>
21412 <td>
21413 <div>
21414 <p>foo</p>
21415 </div>
21416 </td>
21417 </tr>
21418 </tbody>
21419 </table>
21420 !!end
21422 !!test
21423 6. Encapsulate foster-parented transclusion content
21424 !!options
21425 parsoid=wt2wt,wt2html
21426 !! wikitext
21427 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21428 !! html
21429 <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>
21430 <table>
21431 <tbody>
21432 <tr>
21433 <td>
21434 <div>
21435 <p>foo</p>
21436 </div>
21437 </td>
21438 </tr>
21439 </tbody>
21440 </table>
21441 <p>ok</p>
21442 !!end
21444 !!test
21445 7. Encapsulate foster-parented transclusion content
21446 !!options
21447 parsoid=wt2wt,wt2html
21448 !! wikitext
21449 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21450 !! html
21451 <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>
21452 <table>
21453 <tbody>
21454 <tr>
21455 <td>bar</td>
21456 </tr>
21457 </tbody>
21458 </table>
21459 !!end
21461 !!test
21462 8. Encapsulate foster-parented transclusion content
21463 !!options
21464 parsoid=wt2wt,wt2html
21465 !! wikitext
21466 {{echo|a
21467 }}{|{{echo|style='color:red'}}
21471 !! html
21472 <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>
21473 <tbody>
21474 <tr>
21475 <td>b</td>
21476 </tr>
21477 </tbody>
21478 </table>
21479 !!end
21481 !!test
21482 9. Encapsulate foster-parented transclusion content
21483 !!options
21484 parsoid=wt2wt,wt2html
21485 !! wikitext
21486 <table>{{echo|hi</table>hello}}
21487 !! html
21488 <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>
21489 !!end
21491 !!test
21492 Table in fosterable position
21493 !!options
21494 parsoid=wt2html,wt2wt
21495 !! wikitext
21496 {{OpenTable}}
21497 <div>
21500 </div>
21502 !! html
21503 <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">
21504 </span>
21505 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21507 <table>
21508 </table>
21509 !!end
21511 # Parsoid only for bug 64747
21512 !! test
21513 Properly encapsulate empty-content transclusions in fosterable positions
21514 !! wikitext
21515 <table>
21516 {{#if:|
21517 <td>foo</td>
21519 </table>
21520 !! html/parsoid
21521 <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>"}'>
21523 </table>
21524 !! end
21526 !!test
21527 Support <object> element with .data attribute
21528 !!options
21529 parsoid=html2wt
21530 !! wikitext
21531 <object data="test.swf"></object>
21532 !! html
21533 <object data="test.swf"></object>
21534 !!end
21536 # -----------------------------------------------------------------
21537 # The following section of tests are primarily to spec requirements
21538 # around serialization of new/edited content.
21540 # All these tests are marked Parsoid html2wt and html2html only
21541 # ----------------------------------------------------------------
21543 # 'mi' is a localinterwiki prefix as well as a language
21544 !! test
21545 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21546 !! options
21547 parsoid=html2wt
21548 !! wikitext
21549 [[Foo]]
21550 !! html
21551 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
21552 !! end
21554 !! test
21555 Image: Modifying size of an image (1)
21556 !! options
21557 parsoid={
21558   "modes": ["wt2wt"],
21559   "changes": [
21560     ["img[height]", "attr", "height", "22"],
21561     ["img[width]", "attr", "width", "200"]
21562   ]
21564 !! wikitext
21565 [[Image:Foobar.jpg|230x230px]]
21566 !! wikitext/edited
21567 [[Image:Foobar.jpg|200x200px]]
21568 !!end
21570 !! test
21571 Image: Modifying size of an image (2)
21572 !! options
21573 parsoid={
21574   "modes": ["wt2wt"],
21575   "changes": [
21576     ["img[height]", "attr", "height", "100"],
21577     ["img[width]", "attr", "width", "500"]
21578   ]
21580 !! wikitext
21581 [[Image:Foobar.jpg|230x230px]]
21582 !! wikitext/edited
21583 [[Image:Foobar.jpg|500x500px]]
21584 !!end
21586 # Change in size is ignored so long as class='mw-default-size'
21587 !! test
21588 Image: Modifying size of an image (3)
21589 !! options
21590 parsoid={
21591   "modes": ["wt2wt"],
21592   "changes": [
21593     ["figure[class]", "removeClass", "mw-default-size"],
21594     ["figure img", "attr", "height", "19"],
21595     ["figure img", "attr", "width", "170"]
21596   ]
21598 !! wikitext
21599 [[Image:Foobar.jpg|thumb]]
21600 !! wikitext/edited
21601 [[Image:Foobar.jpg|thumb|170x170px]]
21602 !!end
21604 !! test
21605 Image: Modifying alignment of an image (bug 48665)
21606 !! options
21607 parsoid={
21608   "modes": ["wt2wt"],
21609   "changes": [
21610     ["figure[class]", "removeClass", "mw-halign-right"],
21611     ["figure[class]", "addClass", "mw-halign-left"]
21612   ]
21614 !! wikitext
21615 [[Image:Foobar.jpg|thumb|caption|right]]
21616 !! wikitext/edited
21617 [[Image:Foobar.jpg|thumb|caption|left]]
21618 !! end
21620 !! test
21621 Image: Modifying mw-default-size of an frameless image (bug 62805)
21622 !! options
21623 parsoid={
21624   "modes": ["wt2wt"],
21625   "changes": [
21626     ["figure.mw-default-size", "removeClass", "mw-default-size"]
21627   ]
21629 !! wikitext
21630 [[Image:Foobar.jpg|frameless|right]]
21631 !! wikitext/edited
21632 [[Image:Foobar.jpg|frameless|right|220x220px]]
21633 !! end
21635 !! test
21636 Image: Modifying valign of an image (bug 49221)
21637 !! options
21638 parsoid={
21639   "modes": ["wt2wt"],
21640   "changes": [
21641     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21642     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21643   ]
21645 !! wikitext
21646 [[File:Foobar.jpg|20px|middle]]
21647 !! wikitext/edited
21648 [[File:Foobar.jpg|20px|text-top]]
21649 !! end
21651 !! test
21652 Image: Modifying alt attribute of an image (bug 56400)
21653 !! options
21654 parsoid={
21655   "modes": ["wt2wt"],
21656   "changes": [
21657     ["img[alt]", "attr", "alt", "some alternate edited text"]
21658   ]
21660 !! wikitext
21661 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21662 !! wikitext/edited
21663 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21664 !!end
21666 !! test
21667 Image: Modifying caption of an image
21668 !! options
21669 parsoid={
21670   "modes": ["wt2wt"],
21671   "changes": [
21672     ["figcaption", "text", "new caption"]
21673   ]
21675 !! wikitext
21676 [[Image:Foobar.jpg|thumb|original caption]]
21677 !! wikitext/edited
21678 [[Image:Foobar.jpg|thumb|new caption]]
21679 !!end
21681 !! test
21682 Image: empty alt attribute (bug 48924)
21683 !! options
21684 parsoid
21685 !! wikitext
21686 [[File:Foobar.jpg|thumb|alt=|bar]]
21687 !! html
21688 <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>
21689 !! end
21691 #!! test
21692 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21693 #!! options
21694 #parsoid=html2wt
21695 #language=ar
21696 #!! input
21697 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21698 #!! result
21699 #<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>
21700 #!! end
21702 !! test
21703 Image: Block level image should have \n before and after
21704 !! options
21705 parsoid
21706 !! wikitext
21708 [[File:Foobar.jpg|right|thumb|150x150px]]
21710 !! html
21711 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p>
21712 !!end
21714 !! test
21715 Image: New block level image should have \n before and after (existing content)
21716 !! options
21717 parsoid
21718 !! wikitext
21720 [[File:Foobar.jpg|right|thumb|150x150px]]
21722 !! html
21723 <p>123</p>
21724 <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>
21725 <p>456</p>
21726 !!end
21728 !! test
21729 Image: upright option (parsoid)
21730 !! options
21731 parsoid
21732 !! wikitext
21733 [[File:Foobar.jpg|thumb|upright|caption]]
21734 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21735 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21736 !! html
21737 <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>
21738 <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>
21739 <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>
21740 !!end
21742 !! test
21743 Image: upright option is ignored on inline and frame images (parsoid)
21744 !! options
21745 parsoid
21746 !! wikitext
21747 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21748 !! html
21749 <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>
21750 !!end
21752 !! test
21753 Image: from basic HTML (1)
21754 !! options
21755 parsoid=html2wt
21756 !! html/parsoid
21757 <span typeof="mw:Image">
21758   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21759 </span>
21760 !! wikitext
21761 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21762 !! end
21764 !! test
21765 Image: from basic HTML (2)
21766 !! options
21767 parsoid=html2wt
21768 !! html/parsoid
21769 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21770 !! wikitext
21771 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21772 !! end
21774 !! test
21775 Image: from basic HTML (3)
21776 !! options
21777 parsoid=html2wt
21778 !! html/parsoid
21779 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21780 !! wikitext
21781 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21782 !! end
21784 !! test
21785 Image: from basic HTML (4)
21786 !! options
21787 parsoid=html2wt
21788 !! html/parsoid
21789 <img src="File:Foobar.jpg">
21790 !! wikitext
21791 [[File:Foobar.jpg|link=]]
21792 !! end
21794 !! test
21795 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21796 !! options
21797 parsoid=html2wt
21798 !! wikitext
21799 * foo
21800 !! html
21801 <ul>
21802 <li><p>foo</p></li>
21803 </ul>
21804 !! end
21806 !! test
21807 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21808 !! options
21809 parsoid=html2wt
21810 !! wikitext
21811 * foo
21812 !! html
21813 <ul> <li>foo</li></ul>
21814 !! end
21816 !! test
21817 Don't strip leading whitespace when handling indent-pre suppressing tags
21818 !! options
21819 parsoid=html2wt
21820 !! wikitext
21822   | indented row
21824 <blockquote>
21825  '''This is very bold of you!'''
21829  indented cell (no pre-wrapping!)
21831 </blockquote>
21833  <div>bar</div>
21834 !! html
21835 <table>
21836   <tr><td> indented row</td></tr>
21837 </table>
21838 <blockquote><p>
21839  <b>This is very bold of you!</b>
21840 </p>
21841 <table><tr><td>
21842  indented cell (no pre-wrapping!)
21843 </td></tr></table>
21844 </blockquote>
21845 <p>foo</p>
21846  <div>bar</div>
21847 !! end
21849 !! test
21850 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21851 !! options
21852 parsoid=html2wt
21853 !! wikitext
21855 <nowiki> </nowiki><span>bar</span>
21857 <span>foo2
21858 <nowiki> </nowiki></span>bar2
21860 <div>foo</div>
21861 <nowiki> </nowiki><span>bar</span>
21863 <div>
21864 <nowiki> </nowiki><span>foo</span>
21865 </div>
21866 !! html
21867 <p>foo</p>
21868  <span>bar</span>
21870 <span>foo2
21871  </span>bar2
21873 <div>foo</div>
21874  <span>bar</span>
21876 <div>
21877  <span>foo</span>
21878 </div>
21879 !! end
21881 !! test
21882 Lists: Add space after bullets
21883 !! options
21884 parsoid=html2wt
21885 !! wikitext
21886 * foo
21887 * bar
21888 * <span> baz</span>
21889 !! html
21890 <ul>
21891 <li>foo</li>
21892 <li> bar</li>
21893 <li><span> baz</span></li>
21894 </ul>
21895 !! end
21897 !! test
21898 Lists: Dont insert newlines in a serialized list item.
21899 !! options
21900 parsoid=html2wt
21901 !! wikitext
21902 * a<br>b
21903 * c
21904 !! html
21905 <ul><li>a<br>b</li><li>c</li></ul>
21906 !! end
21908 !! test
21909 Headings: Add space before/after == (Bug 51744)
21910 !! options
21911 parsoid=html2wt
21912 !! wikitext
21913 == foo ==
21915 == bar ==
21917 == baz ==
21919 == <span> baz</span> ==
21920 !! html
21921 <h2>foo</h2>
21922 <h2> bar</h2>
21923 <h2>baz </h2>
21924 <h2><span> baz</span></h2>
21925 !! end
21927 !! test
21928 Parsoid: Serialize positional parameters with = in them as named parameter
21929 !! options
21930 parsoid=html2wt
21931 !! wikitext
21932 {{echo|1 = f=oo}}
21934 {{echo|1 = f=oo|2 = bar}}
21936 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21937 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21938 {{echo|<nowiki>f=oo</nowiki>|bar}}
21939 !! html
21940 <p about="#mwt1" typeof="mw:Transclusion"
21941 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21943 <p about="#mwt1" typeof="mw:Transclusion"
21944 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21946 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21947 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21948 <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>
21949 !! end
21951 !! test
21952 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21953 !! options
21954 parsoid=html2wt
21955 !! wikitext
21956 <div>a
21958 </div>
21959 <div>a
21961 </div>
21962 <div>
21966 </div>
21967 !! html
21968 <div>a<p>b</p></div>
21969 <div>a
21970 <p>b</p></div>
21971 <div>
21973 <p>b</p></div>
21974 !! end
21976 !! test
21977 Substrings resembling wikitext in hrefs should not get nowiki escapes
21978 !! options
21979 parsoid=html2wt
21980 !! wikitext
21981 [[Foo''bar''baz]]
21982 !! html
21983 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21984 !! end
21986 #-----------------------------
21987 # I/B quote minimization tests
21988 #-----------------------------
21990 !! test
21991 1. I/B quote minimization: wikitext-only tags should be combined
21992 !! options
21993 parsoid=html2wt
21994 !! wikitext
21995 ''AB''
21997 '''AB'''
21999 ''A'''B'''''
22001 '''A''B'''''
22003 '''A''BC''D'''
22005 '''''AB'''''
22007 '''''AB'''''
22009 '''''AB'''''
22010 !! html
22011 <p><i>A</i><i>B</i></p>
22012 <p><b>A</b><b>B</b></p>
22013 <p><i>A</i><b><i>B</i></b></p>
22014 <p><b>A</b><i><b>B</b></i></p>
22015 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22016 <p><i><b>A</b></i><i><b>B</b></i></p>
22017 <p><i><b>A</b></i><b><i>B</i></b></p>
22018 <p><b><i>A</i></b><i><b>B</b></i></p>
22019 !! end
22021 !! test
22022 2. I/B quote minimization: wikitext and html tags should not be combined
22023 !! options
22024 parsoid=html2wt
22025 !! wikitext
22026 ''A''<i>B</i>
22028 ''A'''''<i>B</i>'''
22029 !! html
22030 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22031 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22032 !! end
22034 !! test
22035 3. I/B quote minimization: templated content stops minimization
22036 !! options
22037 parsoid=html2wt
22038 !! wikitext
22039 ''A''{{echo|''B''}}
22041 ''A''{{echo|'''''B'''''}}
22042 !! html
22043 <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>
22044 <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>
22045 !! end
22047 !! test
22048 4. I/B quote minimization: new content should be mimimized with adjacent old content
22049 !! options
22050 parsoid=html2wt
22051 !! wikitext
22052 ''AB''
22054 '''AB'''
22056 ''A'''B'''''
22057 !! html
22058 <p><i>A</i><i>B</i></p>
22059 <p><b>A</b><b>B</b></p>
22060 <p><i>A</i><b><i>B</i></b></p>
22061 !! end
22063 #------------------------------------
22064 # End of I/B quote minimization tests
22065 #------------------------------------
22067 !!test
22068 Bug 54262: New entities
22069 !! options
22070 parsoid=html2wt
22071 !! wikitext
22072 &nbsp;
22073 !! html
22074 <span typeof="mw:Entity">&nbsp;</span>
22075 !! end
22077 ## Note that there is no wikitext output for 'unknownproperty' ##
22078 ## Unknown magic words are silently dropped ##
22080 !! test
22081 Magic words
22082 !! options
22083 parsoid=html2wt
22084 !! wikitext
22085 __TOC__
22086 __NOTOC__
22087 __FORCETOC__
22088 __INDEX__
22089 __NOINDEX__
22090 __NOGALLERY__
22091 __NOEDITSECTION__
22092 __NOTITLECONVERT__
22093 __NOCONTENTCONVERT__
22094 !! html
22095 <meta property='mw:PageProp/toc' />
22096 <meta property='mw:PageProp/notoc' />
22097 <meta property='mw:PageProp/forcetoc' />
22098 <meta property='mw:PageProp/index' />
22099 <meta property='mw:PageProp/noindex' />
22100 <meta property='mw:PageProp/nogallery' />
22101 <meta property='mw:PageProp/noeditsection' />
22102 <meta property='mw:PageProp/notitleconvert' />
22103 <meta property='mw:PageProp/nocontentconvert' />
22104 <meta property='mw:PageProp/unknownproperty' />
22105 !! end
22107 !! test
22108 Consecutive <pre>s should not get merged
22109 !! options
22110 parsoid=html2wt,html2html
22111 !! wikitext
22125 !! html
22126 <pre>a</pre><pre>b</pre>
22128 <pre>c
22129 </pre><pre>
22130 d</pre>
22132 <pre>e
22134 </pre><pre>
22136 f</pre>
22137 !! end
22139 !! test
22140 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22141 !! options
22142 parsoid=html2wt
22143 !! wikitext
22144 [[Special:BookSources/1234567890|ISBN 1234567895]]
22145 !! html
22146 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22147 !! end
22149 !! test
22150 Edited RFC links not serializable as RFC links should serialize as extlinks
22151 !! options
22152 parsoid=html2wt
22153 !! wikitext
22154 [//tools.ietf.org/html/rfc123 New RFC]
22155 !! html
22156 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22157 !! end
22159 !! test
22160 Edited PMID links not serializable as PMID links should serialize as extlinks
22161 !! options
22162 parsoid=html2wt
22163 !! wikitext
22164 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22165 !! html
22166 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22167 !! end
22169 !! test
22170 Edited Redirect link should emit a non-piped wikitext link
22171 !! options
22172 parsoid=html2wt
22173 !! wikitext
22174 #REDIRECT [[Bar]]
22175 !! html
22176 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22177 !! end
22179 # -----------------------------------------------------------------
22180 # End of section for Parsoid-only html2wt tests for serialization
22181 # of new content
22182 # -----------------------------------------------------------------
22184 TODO:
22185 more images
22186 more tables
22187 character entities
22188 and much more
22189 Try for 100% code coverage