Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / parser / parserTests.txt
blobcc662808f5322a3b407e641e2068439f7796dcb7
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
16 # cat           add category links
17 # ill           add inter-language links
18 # subpage       enable subpages (disabled by default)
19 # noxml         don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX  set content language to XXX for this test
22 # variant=XXX   set the variant of language for this test (eg zh-tw)
23 # disabled      do not run test
24 # parsoid       parsoid-specific options (not run by PHP parser unless
25 #                 the test includes an html/php section)
26 # php           php-only test (not run by the parsoid parser unless
27 #                 the test includes an html/parsoid section)
28 # showtitle     make the first line the title
29 # comment       run through Linker::formatComment() instead of main parser
30 # local         format section links in edit comment text as local links
31 # notoc         disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 # You can also set the following parser properties via test options:
35 #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 #  wgLinkHolderBatchSize, wgRawHtml
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
66 !! article
67 Template:pipe
68 !! text
70 !! endarticle
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
84 !! article
85 Template:tbl-start
86 !! text
88 !! endarticle
90 !! article
91 Template:tbl-end
92 !! text
94 !! endarticle
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color: red"| Foo
119 !! endarticle
121 !! article
122 Template:table_cells
123 !! text
124 {{table_attribs}} || Bar || Baz
125 !! endarticle
127 !! article
128 Template:image_attribs
129 !! text
130 <noinclude>
131 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
132 !! endarticle
134 ## See T48811 for details
135 !! article
136 Template:mixed_attr_content_template
137 !! text
138 style="color:red;" title="T48811"
140 |foo
141 !! endarticle
143 !! article
145 !! text
146 Weirdo titles!
147 !! endarticle
149 !!article
150 Template:Bullet
151 !!text
152 * Bar
153 !!endarticle
155 !!article
156 Template:OpenTable
157 !!text
159 !!endarticle
161 !!article
162 Template:EmptyLITest
163 !!text
168 !!endarticle
170 !!article
171 Template:EmptyTRTest
172 !!text
176 |foo
179 |bar
181 !!endarticle
183 !!article
184 Template:EmptyTRWithHTMLAttrTest
185 !!text
186 <table>
187 <tr align="center"></tr>
188 <tr><td>foo</td></tr>
189 <tr align="center"></tr>
190 <tr><td>bar</td></tr>
191 </table>
192 !!endarticle
195 ### Basic tests
197 !! test
198 Blank input
199 !! wikitext
200 !! html
201 !! end
204 !! test
205 Simple paragraph
206 !! wikitext
207 This is a simple paragraph.
208 !! html
209 <p>This is a simple paragraph.
210 </p>
211 !! end
213 !! test
214 Paragraphs with extra newline spacing
215 !! wikitext
225 booz
226 !! html
227 <p>foo
228 </p><p>bar
229 </p><p><br />
231 </p><p><br />
232 </p><p>booz
233 </p>
234 !! end
236 !! test
237 Paragraphs with newline spacing with comment lines in between
238 !! wikitext
239 ----
241 <!--foo-->
243 ----
245 <!--foo--><!--More than 1 comment, still stripped-->
247 ----
249  <!--foo--> <!----> <!-- bar --> 
251 ----
253 <!--foo-->
256 ----
259 <!--foo-->
261 ----
263 <!--foo-->
267 ----
271 <!--foo-->
273 ----
274 !! html
275 <hr />
276 <p>a
278 </p>
279 <hr />
280 <p>a
282 </p>
283 <hr />
284 <p>a
286 </p>
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p>b
294 </p>
295 <hr />
296 <p>a
297 </p><p><br />
299 </p>
300 <hr />
301 <p>a
302 </p><p><br />
304 </p>
305 <hr />
307 !! end
309 !! test
310 Paragraphs with newline spacing with non-empty white-space lines in between
311 !! wikitext
312 ----
316 ----
321 ----
322 !! html
323 <hr />
324 <p>a
325 </p><p>b
326 </p>
327 <hr />
328 <p>a
329 </p><p><br /> 
331 </p>
332 <hr />
334 !! end
336 !! test
337 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
338 !! wikitext
339 ----
341  <!--foo-->
343 ----
345  <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
347 ----
350 <!--foo-->
351  <!--bar-->
353 ----
356  <!--foo-->
357  <!--bar-->
360 ----
361 !! html
362 <hr />
363 <p>a
365 </p>
366 <hr />
367 <p>a
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br /> 
378 </p>
379 <hr />
381 !! end
383 !! test
384 Extra newlines: More paragraphs with indented comment
385 !! wikitext
388    <!--boo-->
391 !! html
392 <p>a
393 </p><p><br />
395 </p>
396 !!end
398 !! test
399 Extra newlines followed by heading
400 !! wikitext
406 [[a]]
410 !! html
411 <p>a
412 </p><p><br />
413 </p>
414 <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>
415 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
416 </p><p><br />
417 </p>
418 <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>
420 !! end
422 !! test
423 Extra newlines between heading and content are swallowed
424 !! wikitext
429 [[a]]
430 !! html
431 <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>
432 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
433 </p>
434 !! end
436 !! test
437 Parsing an URL
438 !! wikitext
439 http://fr.wikipedia.org/wiki/🍺
440 <!-- EasterEgg we love beer, better be able be able to link to it -->
441 !! html
442 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
443 </p>
444 !! end
446 # Note that the html+tidy output removes the spaces after the <li>,
447 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
448 # This is an issue for all tests with lists.  We intentionally do
449 # *not* add html+tidy clauses for these, as we don't want to
450 # document/test the broken behavior.  (Parsoid matches the non-tidy
451 # output in these cases.)
453 !! test
454 Simple list
455 !! wikitext
456 * Item 1
457 * Item 2
458 !! html
459 <ul><li> Item 1</li>
460 <li> Item 2</li></ul>
462 !! end
464 !! test
465 Italics and bold
466 !! wikitext
467 * plain
468 * plain''italic''plain
469 * plain''italic''plain''italic''plain
470 * plain'''bold'''plain
471 * plain'''bold'''plain'''bold'''plain
472 * plain''italic''plain'''bold'''plain
473 * plain'''bold'''plain''italic''plain
474 * plain''italic'''bold-italic'''italic''plain
475 * plain'''bold''bold-italic''bold'''plain
476 * plain'''''bold-italic'''italic''plain
477 * plain'''''bold-italic''bold'''plain
478 * plain''italic'''bold-italic'''''plain
479 * plain'''bold''bold-italic'''''plain
480 * plain l'''italic''plain
481 * plain l''''bold''' plain
482 !! html
483 <ul><li> plain</li>
484 <li> plain<i>italic</i>plain</li>
485 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
486 <li> plain<b>bold</b>plain</li>
487 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
488 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
489 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
490 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
491 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
492 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
493 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
494 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
495 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
496 <li> plain l'<i>italic</i>plain</li>
497 <li> plain l'<b>bold</b> plain</li></ul>
499 !! end
501 # this example taken from the [[simple:Moon]] article (bug 47326)
502 !! test
503 Italics and possessives (1)
504 !! wikitext
505 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
506 !! html
507 <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
508 </p>
509 !! end
511 # this example taken from [[en:Flaming Pie]] (bug 49926)
512 !! test
513 Italics and possessives (2)
514 !! wikitext
515 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
516 !! html
517 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
518 </p>
519 !! end
521 # this example taken from [[en:Dictionary]] (bug 49926)
522 !! test
523 Italics and possessives (3)
524 !! wikitext
525 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''.
526 !! html
527 <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>.
528 </p>
529 !! end
533 ### 2-quote opening sequence tests
535 !! test
536 Italics and bold: 2-quote opening sequence: (2,2)
537 !! wikitext
538 ''foo''
539 !! html
540 <p><i>foo</i>
541 </p>
542 !!end
544 !! test
545 Italics and bold: 2-quote opening sequence: (2,3)
546 !! wikitext
547 ''foo'''
548 !! html/*
549 <p><i>foo'</i>
550 </p>
551 !!end
553 !! test
554 Italics and bold: 2-quote opening sequence: (2,4)
555 !! options
556 parsoid=wt2html
557 !! wikitext
558 ''foo''''
559 !! html/*
560 <p><i>foo''</i>
561 </p>
562 !!end
564 # same html as previous, but wikitext adjusted to match parsoid html2wt
565 !! test
566 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
567 !! wikitext
568 ''foo<nowiki>''</nowiki>''
569 !! html
570 <p><i>foo''</i>
571 </p>
572 !! end
574 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
575 !! test
576 Italics and bold: 2-quote opening sequence: (2,5)
577 !! options
578 parsoid=wt2html
579 !! wikitext
580 ''foo'''''
581 !! html/php
582 <p><i>foo</i>
583 </p>
584 !! html/parsoid
585 <p><i>foo</i><b></b>
586 </p>
587 !!end
589 # same html as previous, but wikitext adjusted to match parsoid html2wt
590 !! test
591 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
592 !! wikitext
593 ''foo'''''<nowiki/>'''
594 !! html/php
595 <p><i>foo</i>
596 </p>
597 !! html/parsoid
598 <p><i>foo</i><b></b>
599 </p>
600 !! end
604 ### 3-quote opening sequence tests
607 !! test
608 Italics and bold: 3-quote opening sequence: (3,2)
609 !! wikitext
610 '''foo''
611 !! html/*
612 <p>'<i>foo</i>
613 </p>
614 !!end
616 !! test
617 Italics and bold: 3-quote opening sequence: (3,3)
618 !! wikitext
619 '''foo'''
620 !! html
621 <p><b>foo</b>
622 </p>
623 !!end
625 !! test
626 Italics and bold: 3-quote opening sequence: (3,4)
627 !! wikitext
628 '''foo''''
629 !! html/*
630 <p><b>foo'</b>
631 </p>
632 !!end
634 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
635 !! test
636 Italics and bold: 3-quote opening sequence: (3,5)
637 !! options
638 parsoid=wt2html
639 !! wikitext
640 '''foo'''''
641 !! html/php
642 <p><b>foo</b>
643 </p>
644 !! html/parsoid
645 <p><b>foo</b><i></i>
646 </p>
647 !!end
649 # same html as previous, but wikitext adjusted to match parsoid html2wt
650 !! test
651 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
652 !! wikitext
653 '''foo'''''<nowiki/>''
654 !! html/php
655 <p><b>foo</b>
656 </p>
657 !! html/parsoid
658 <p><b>foo</b><i></i>
659 </p>
660 !! end
664 ### 4-quote opening sequence tests
667 !! test
668 Italics and bold: 4-quote opening sequence: (4,2)
669 !! options
670 parsoid=wt2html
671 !! wikitext
672 ''''foo''
673 !! html/*
674 <p>''<i>foo</i>
675 </p>
676 !!end
678 # same html as previous, but wikitext adjusted to match parsoid html2wt
679 !! test
680 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
681 !! wikitext
682 <nowiki>''</nowiki>''foo''
683 !! html
684 <p>''<i>foo</i>
685 </p>
686 !! end
688 !! test
689 Italics and bold: 4-quote opening sequence: (4,3)
690 !! wikitext
691 ''''foo'''
692 !! html/*
693 <p>'<b>foo</b>
694 </p>
695 !!end
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 ''''foo''''
703 !! html/*
704 <p>'<b>foo'</b>
705 </p>
706 !!end
708 # same html as previous, but wikitext adjusted to match parsoid html2wt
709 !! test
710 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
711 !! wikitext
712 '<nowiki/>'''foo''''
713 !! html
714 <p>'<b>foo'</b>
715 </p>
716 !! end
718 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
719 !! test
720 Italics and bold: 4-quote opening sequence: (4,5)
721 !! options
722 parsoid=wt2html
723 !! wikitext
724 ''''foo'''''
725 !! html/php
726 <p>'<b>foo</b>
727 </p>
728 !! html/parsoid
729 <p>'<b>foo</b><i></i>
730 </p>
731 !!end
733 # same html as previous, but wikitext adjusted to match parsoid html2wt
734 !! test
735 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
736 !! wikitext
737 '<nowiki/>'''foo'''''<nowiki/>''
738 !! html/php
739 <p>'<b>foo</b>
740 </p>
741 !! html/parsoid
742 <p>'<b>foo</b><i></i>
743 </p>
744 !! end
748 ### 5-quote opening sequence tests
751 !! test
752 Italics and bold: 5-quote opening sequence: (5,2)
753 !! options
754 parsoid=wt2html
755 !! wikitext
756 '''''foo''
757 !! html/*
758 <p><b><i>foo</i></b>
759 </p>
760 !!end
762 # same html as previous, but wikitext adjusted to match parsoid html2wt
763 # skipping wt2html and html2html because it wants to put <i> before <b>
764 !! test
765 Italics and bold: 5-quote opening sequence: (5,2+3)
766 !! options
767 parsoid=wt2wt,html2wt
768 !! wikitext
769 '''''foo'''''
770 !! html
771 <p><b><i>foo</i></b>
772 </p>
773 !! end
775 !! test
776 Italics and bold: 5-quote opening sequence: (5,3)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 '''''foo'''
781 !! html/*
782 <p><i><b>foo</b></i>
783 </p>
784 !!end
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 5-quote opening sequence: (5,3+2)
789 !! wikitext
790 '''''foo'''''
791 !! html
792 <p><i><b>foo</b></i>
793 </p>
794 !! end
796 !! test
797 Italics and bold: 5-quote opening sequence: (5,4)
798 !! options
799 parsoid=wt2html
800 !! wikitext
801 '''''foo''''
802 !! html/*
803 <p><i><b>foo'</b></i>
804 </p>
805 !!end
807 !! test
808 Italics and bold: 5-quote opening sequence: (5,5)
809 !! wikitext
810 '''''foo'''''
811 !! html
812 <p><i><b>foo</b></i>
813 </p>
814 !!end
816 !! test
817 Italics and bold: 5-quote opening sequence: (5,6)
818 !! wikitext
819 '''''foo''''''
820 !! html/*
821 <p><i><b>foo'</b></i>
822 </p>
823 !! end
826 ### multiple quote sequences in a line
828 !! test
829 Italics and bold: multiple quote sequences: (2,4,2)
830 !! options
831 parsoid=wt2html
832 !! wikitext
833 ''foo''''bar''
834 !! html/*
835 <p><i>foo'<b>bar</b></i>
836 </p>
837 !!end
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
843 !! wikitext
844 ''foo'<nowiki/>'''bar'''''
845 !! html
846 <p><i>foo'<b>bar</b></i>
847 </p>
848 !! end
851 !! test
852 Italics and bold: multiple quote sequences: (2,4,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 ''foo''''bar'''
857 !! html/*
858 <p><i>foo'<b>bar</b></i>
859 </p>
860 !!end
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
866 !! wikitext
867 ''foo'<nowiki/>'''bar'''''
868 !! html
869 <p><i>foo'<b>bar</b></i>
870 </p>
871 !! end
874 !! test
875 Italics and bold: multiple quote sequences: (2,4,4)
876 !! options
877 parsoid=wt2html
878 !! wikitext
879 ''foo''''bar''''
880 !! html/*
881 <p><i>foo'<b>bar'</b></i>
882 </p>
883 !!end
886 # same html as previous, but wikitext adjusted to match parsoid html2wt
887 !! test
888 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
889 !! wikitext
890 ''foo'<nowiki/>'''bar'<nowiki/>'''''
891 !! html
892 <p><i>foo'<b>bar'</b></i>
893 </p>
894 !! end
897 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
898 !! test
899 Italics and bold: multiple quote sequences: (3,4,2)
900 !! options
901 parsoid=wt2html
902 !! wikitext
903 '''foo''''bar''
904 !! html/php
905 <p><b>foo'</b>bar
906 </p>
907 !! html/parsoid
908 <p><b>foo'</b>bar<i></i>
909 </p>
910 !!end
912 # same html as previous, but wikitext adjusted to match parsoid html2wt
913 !! test
914 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
915 !! options
916 parsoid
917 !! wikitext
918 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
919 !! html/php
920 <p><b>foo'</b>bar
921 </p>
922 !! html/parsoid
923 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
924 </p>
925 !! end
928 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
929 !! test
930 Italics and bold: multiple quote sequences: (3,4,3)
931 !! options
932 parsoid=wt2html
933 !! wikitext
934 '''foo''''bar'''
935 !! html/php
936 <p><b>foo'</b>bar
937 </p>
938 !! html/parsoid
939 <p><b>foo'</b>bar<b></b>
940 </p>
941 !!end
943 # same html as previous, but wikitext adjusted to match parsoid html2wt
944 !! test
945 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
946 !! wikitext
947 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
948 !! html/php
949 <p><b>foo'</b>bar
950 </p>
951 !! html/parsoid
952 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
953 </p>
954 !! end
957 ### other quote tests
959 !! test
960 Italics and bold: other quote tests: (2,3,5)
961 !! wikitext
962 ''this is about '''foo's family'''''
963 !! html
964 <p><i>this is about <b>foo's family</b></i>
965 </p>
966 !!end
969 !! test
970 Italics and bold: other quote tests: (2,(3,3),2)
971 !! wikitext
972 ''this is about '''foo's''' family''
973 !! html
974 <p><i>this is about <b>foo's</b> family</i>
975 </p>
976 !!end
979 !! test
980 Italics and bold: other quote tests: (3,2,3,2)
981 !! options
982 parsoid=wt2html
983 !! wikitext
984 '''this is about ''foo'''s family''
985 !! html/*
986 <p><b>this is about <i>foo</i></b><i>s family</i>
987 </p>
988 !!end
991 # same html as previous, but wikitext adjusted to match parsoid html2wt
992 !! test
993 Italics and bold: other quote tests: (3,2,3+2+2,2)
994 !! wikitext
995 '''this is about ''foo'''''<nowiki/>''s family''
996 !! html
997 <p><b>this is about <i>foo</i></b><i>s family</i>
998 </p>
999 !! end
1002 !! test
1003 Italics and bold: other quote tests: (3,2,3,3)
1004 !! wikitext
1005 '''this is about ''foo'''s family'''
1006 !! html/*
1007 <p>'<i>this is about </i>foo<b>s family</b>
1008 </p>
1009 !!end
1012 !! test
1013 Italics and bold: other quote tests: (3,(2,2),3)
1014 !! wikitext
1015 '''this is about ''foo's'' family'''
1016 !! html
1017 <p><b>this is about <i>foo's</i> family</b>
1018 </p>
1019 !!end
1022 !! test
1023 Italicized possessive
1024 !! wikitext
1025 The ''[[Main Page]]'''s talk page.
1026 !! html/php
1027 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1028 </p>
1029 !! html/parsoid
1030 <p>The <i><a rel="mw:WikiLink"  href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1031 !! end
1033 !! test
1034 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1035 (Requires tidy for PHP parser output to be fixed up)
1036 !! options
1037 parsoid=wt2html,wt2wt
1038 !! wikitext
1040 !''a!!''b
1041 |''a||''b
1043 !! html/php+tidy
1044 <table>
1045 <tr>
1046 <th><i>a</i></th>
1047 <th><i>b</i></th>
1048 <td><i>a</i></td>
1049 <td><i>b</i></td>
1050 </tr>
1051 </table>
1052 !! html/parsoid
1053 <table>
1054 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1055 <td><i>a</i></td><td><i>b</i></td></tr>
1056 </tbody></table>
1057 !! end
1060 ### Non-html5 tags
1063 !! test
1064 Non-html5 tags should be accepted
1065 !! wikitext
1066 <center>''foo''</center>
1067 <big>''foo''</big>
1068 <font>''foo''</font>
1069 <strike>''foo''</strike>
1070 <tt>''foo''</tt>
1071 !! html
1072 <center><i>foo</i></center>
1073 <p><big><i>foo</i></big>
1074 <font><i>foo</i></font>
1075 <strike><i>foo</i></strike>
1076 <tt><i>foo</i></tt>
1077 </p>
1078 !! end
1080 !! test
1081 <wbr> is valid wikitext (bug 52468)
1082 !! wikitext
1083 <wbr>
1084 !! html
1085 <p><wbr />
1086 </p>
1087 !! end
1089 # <strike> is HTML4, <s> is HTML4/5.
1090 !! test
1091 <s> or <strike> for strikethrough
1092 !! wikitext
1093 <strike>strike</strike>
1095 <s>s</s>
1096 !! html
1097 <p><strike>strike</strike>
1098 </p><p><s>s</s>
1099 </p>
1100 !! end
1102 ## a not permitted
1103 ## i,b,br omitted
1104 !! test
1105 Text-level semantic html elements in wikitext
1106 !! wikitext
1107 <em>text</em>
1108 <strong>text</strong>
1109 <small>text</small>
1110 <s>text</s>
1111 <cite>text</cite>
1112 <q>text</q>
1113 <dfn>text</dfn>
1114 <abbr>text</abbr>
1115 <data>text</data>
1116 <time>text</time>
1117 <code>text</code>
1118 <var>text</var>
1119 <samp>text</samp>
1120 <kbd>text</kbd>
1121 <sub>text</sub>
1122 <u>text</u>
1123 <mark>text</mark>
1124 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1125 <bdi>text</bdi>
1126 <bdo>text</bdo>
1127 <span>text</span>
1128 <wbr />
1129 !! html
1130 <p><em>text</em>
1131 <strong>text</strong>
1132 <small>text</small>
1133 <s>text</s>
1134 <cite>text</cite>
1135 <q>text</q>
1136 <dfn>text</dfn>
1137 <abbr>text</abbr>
1138 <data>text</data>
1139 <time>text</time>
1140 <code>text</code>
1141 <var>text</var>
1142 <samp>text</samp>
1143 <kbd>text</kbd>
1144 <sub>text</sub>
1145 <u>text</u>
1146 <mark>text</mark>
1147 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1148 <bdi>text</bdi>
1149 <bdo>text</bdo>
1150 <span>text</span>
1151 <wbr />
1152 </p>
1153 !! end
1155 # test cases taken from
1156 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1157 !! test
1158 Ruby markup (W3C-style)
1159 !! wikitext
1160 ; Mono-ruby for individual base characters
1161 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1162 ; Group ruby
1163 : <ruby>今日<rt>きょう</rt></ruby>
1164 ; Jukugo ruby
1165 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1166 ; Inline ruby
1167 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1168 ; Double-sided ruby
1169 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1170 <ruby>
1171 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1172 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1173 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1174 </ruby>
1175 !! html
1176 <dl><dt> Mono-ruby for individual base characters</dt>
1177 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1178 <dt> Group ruby</dt>
1179 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1180 <dt> Jukugo ruby</dt>
1181 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1182 <dt> Inline ruby</dt>
1183 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1184 <dt> Double-sided ruby</dt>
1185 <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>
1186 <p><ruby>
1187 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1188 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1189 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1190 </ruby>
1191 </p>
1192 !! end
1194 # The next two test different paths in the sanitizer.
1195 !! test
1196 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1197 !! wikitext
1198 <b→> doesn't terminate </b→>
1200 <bä> doesn't terminate </bä>
1202 <boo> doesn't terminate </boo>
1204 <s.foo> doesn't terminate </s.foo>
1206 <sub-ID#1>
1207 !! html
1208 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1209 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1210 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1211 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1212 </p><p>&lt;sub-ID#1&gt;
1213 </p>
1214 !! end
1216 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1217 !! test
1218 Non-word characters don't terminate tag names + tidy
1219 !! wikitext
1220 <b→> doesn't terminate </b→>
1222 <bä> doesn't terminate </bä>
1224 <boo> doesn't terminate </boo>
1226 <s.foo> doesn't terminate </s.foo>
1228 <sub-ID#1>
1229 !! html+tidy
1230 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1231 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1232 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1233 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1234 <p>&lt;sub-ID#1&gt;</p>
1235 !! end
1237 !! test
1238 Isolated close tags should be treated as literal text (bug 52760)
1239 !! wikitext
1240 </b>
1242 <s.foo>s</s>
1243 !! html
1244 <p>&lt;/b&gt;
1245 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1246 </p>
1247 !! end
1250 ### Special characters
1253 !! test
1254 Bare pipe character (bug 52363)
1255 !! wikitext
1257 !! html
1258 <p>|
1259 </p>
1260 !! end
1262 !! test
1263 Bare pipe character from a template (bug 52363)
1264 !! wikitext
1265 {{pipe}}
1266 !! html
1267 <p>|
1268 </p>
1269 !! end
1272 ### <nowiki> test cases
1275 !! test
1276 <nowiki> unordered list
1277 !! wikitext
1278 <nowiki>* This is not an unordered list item.</nowiki>
1279 !! html
1280 <p>* This is not an unordered list item.
1281 </p>
1282 !! end
1284 !! test
1285 <nowiki> spacing
1286 !! wikitext
1287 <nowiki>Lorem ipsum dolor
1289 sed abit.
1290   sed nullum.
1292 :and a colon
1293 </nowiki>
1294 !! html
1295 <p>Lorem ipsum dolor
1297 sed abit.
1298   sed nullum.
1300 :and a colon
1302 </p>
1303 !! end
1305 !! test
1306 nowiki 3
1307 !! wikitext
1308 :There is not nowiki.
1309 :There is <nowiki>nowiki</nowiki>.
1311 #There is not nowiki.
1312 #There is <nowiki>nowiki</nowiki>.
1314 *There is not nowiki.
1315 *There is <nowiki>nowiki</nowiki>.
1316 !! html
1317 <dl><dd>There is not nowiki.</dd>
1318 <dd>There is nowiki.</dd></dl>
1319 <ol><li>There is not nowiki.</li>
1320 <li>There is nowiki.</li></ol>
1321 <ul><li>There is not nowiki.</li>
1322 <li>There is nowiki.</li></ul>
1324 !! end
1326 !! test
1327 Entities inside <nowiki>
1328 !! wikitext
1329 <nowiki>&lt;</nowiki>
1330 !! html
1331 <p>&lt;
1332 </p>
1333 !! end
1335 !! test
1336 Entities inside template parameters
1337 !! options
1338 parsoid
1339 !! wikitext
1340 {{echo|&ndash;}}
1341 !! html
1342 <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>
1343 !! end
1345 !! test
1346 Properly escape nowiki when combined with other wiki markup
1347 !! options
1348 parsoid=html2wt
1349 !! html
1350 <p>* &lt;/nowiki&gt; tag</p>
1351 !! wikitext
1352 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1353 !! end
1356 ### Comments
1358 !! test
1359 Comments and Indent-Pre
1360 !! wikitext
1361 <!-- comment 1 --> asdf
1363 <!-- comment 1 --> asdf
1364 <!-- comment 2 -->
1366 <!-- comment 1 --> asdf
1367 <!-- comment 2 -->xyz
1369 <!-- comment 1 --> asdf
1370 <!-- comment 2 --> xyz
1371 !! html
1372 <pre>asdf
1373 </pre>
1374 <pre>asdf
1375 </pre>
1376 <pre>asdf
1377 </pre>
1378 <p>xyz
1379 </p>
1380 <pre>asdf
1382 </pre>
1383 !! end
1385 !! test
1386 Comment test 2a
1387 !! wikitext
1388 asdf
1389 <!-- comment 1 -->
1391 !! html
1392 <p>asdf
1394 </p>
1395 !! end
1397 !! test
1398 Comment test 2b
1399 !! wikitext
1400 asdf
1401 <!-- comment 1 -->
1404 !! html
1405 <p>asdf
1406 </p><p>jkl
1407 </p>
1408 !! end
1410 !! test
1411 Comment test 3
1412 !! wikitext
1413 asdf
1414 <!-- comment 1 -->
1415 <!-- comment 2 -->
1417 !! html
1418 <p>asdf
1420 </p>
1421 !! end
1423 !! test
1424 Comment test 4
1425 !! wikitext
1426 asdf<!-- comment 1 -->jkl
1427 !! html
1428 <p>asdfjkl
1429 </p>
1430 !! end
1432 !! test
1433 Comment spacing
1434 !! wikitext
1436  <!-- foo --> b <!-- bar -->
1438 !! html
1439 <p>a
1440 </p>
1441 <pre> b 
1442 </pre>
1443 <p>c
1444 </p>
1445 !! end
1447 !! test
1448 Comment whitespace
1449 !! wikitext
1450 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1451 !! html
1453 !! end
1455 !! test
1456 Comment semantics and delimiters
1457 !! wikitext
1458 <!-- --><!----><!-----><!------>
1459 !! html
1461 !! end
1463 !! test
1464 Comment semantics and delimiters, redux
1465 !! wikitext
1466 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1467 -- foo -- funky huh? ... -->
1468 !! html
1470 !! end
1472 !! test
1473 Comment semantics and delimiters: directors cut
1474 !! wikitext
1475 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1476 everything starting with < followed by !-- until the first -- and > we see,
1477 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1478 -->-->
1479 !! html
1480 <p>--&gt;
1481 </p>
1482 !! end
1484 !! test
1485 Comment semantics: nesting
1486 !! wikitext
1487 <!--<!-- no, we're not going to do anything fancy here -->-->
1488 !! html
1489 <p>--&gt;
1490 </p>
1491 !! end
1493 !! test
1494 Comment semantics: unclosed comment at end
1495 !! wikitext
1496 <!--This comment will run out to the end of the document
1497 !! html
1499 !! end
1501 # Bug 58184: document parsoid's behaviour
1502 !! test
1503 Suppress comment closing tag in lenient browsers
1504 !! options
1505 parsoid=wt2html,html2html
1506 !! wikitext
1507 <!-- Browsers--!> think this is closed -->
1508 !! html/php
1510 !! html/parsoid
1511 <!-- Browsers--¡> think this is closed -->
1512 !! end
1514 !! test
1515 Comment in template title
1516 !! wikitext
1517 {{f<!---->oo}}
1518 !! html
1519 <p>FOO
1520 </p>
1521 !! end
1523 !! test
1524 Comment on its own line post-expand
1525 !! wikitext
1527 {{blank}}<!---->
1529 !! html
1530 <p>a
1531 </p><p>b
1532 </p>
1533 !! end
1535 !! test
1536 Comment on its own line post-expand with non-significant whitespace
1537 !! wikitext
1539  {{blank}} <!----> 
1541 !! html
1542 <p>a
1543 </p><p>b
1544 </p>
1545 !! end
1547 !! test
1548 Multiple comments should still parse as SOL-transparent
1549 !! options
1550 parsoid=wt2html,wt2wt
1551 !! wikitext
1552 <!--c1-->*a
1553 <!--c2--><!--c3--><!--c4-->*b
1554 !! html
1555 <ul>
1556 <li>a
1557 </li>
1558 <li>b
1559 </li>
1560 </ul>
1561 !! end
1564 ### paragraph wrapping tests
1566 !! test
1567 No block tags
1568 !! wikitext
1572 !! html
1573 <p>a
1574 </p><p>b
1575 </p>
1576 !! end
1578 !! test
1579 Block tag on one line (<div>)
1580 !! wikitext
1581 a <div>foo</div>
1584 !! html
1585 a <div>foo</div>
1586 <p>b
1587 </p>
1588 !! html+tidy
1589 <p>a</p>
1590 <div>foo</div>
1591 <p>b</p>
1592 !! end
1594 !! test
1595 Block tag on one line (<blockquote>)
1596 !! wikitext
1597 a <blockquote>foo</blockquote>
1600 !! html
1601 a <blockquote>foo</blockquote>
1602 <p>b
1603 </p>
1604 !! html+tidy
1605 <p>a</p>
1606 <blockquote>
1607 <p>foo</p>
1608 </blockquote>
1609 <p>b</p>
1610 !! end
1612 !! test
1613 Block tag on both lines (<div>)
1614 !! wikitext
1615 a <div>foo</div>
1617 b <div>foo</div>
1618 !! html
1619 a <div>foo</div>
1620 b <div>foo</div>
1622 !! html+tidy
1623 <p>a</p>
1624 <div>foo</div>
1625 <p>b</p>
1626 <div>foo</div>
1627 !! end
1629 !! test
1630 Block tag on both lines (<blockquote>)
1631 !! wikitext
1632 a <blockquote>foo</blockquote>
1634 b <blockquote>foo</blockquote>
1635 !! html
1636 a <blockquote>foo</blockquote>
1637 b <blockquote>foo</blockquote>
1639 !! html+tidy
1640 <p>a</p>
1641 <blockquote>
1642 <p>foo</p>
1643 </blockquote>
1644 <p>b</p>
1645 <blockquote>
1646 <p>foo</p>
1647 </blockquote>
1648 !! end
1650 !! test
1651 Multiple lines without block tags
1652 !! wikitext
1653 <div>foo</div> a
1656 d<!--foo--> e
1657 x <div>foo</div> z
1658 !! html
1659 <div>foo</div> a
1660 <p>b
1662 d e
1663 </p>
1664 x <div>foo</div> z
1666 !! html+tidy
1667 <div>foo</div>
1668 <p>a</p>
1669 <p>b c d e</p>
1670 <p>x</p>
1671 <div>foo</div>
1672 <p>z</p>
1673 !! end
1675 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1676 # So, we have a separate section for Parsoid. We don't want
1677 # to mimic this stripping behavior in Parsoid. It affects
1678 # editing experience and also requires us to maintain additional
1679 # info for RT-ing.
1680 !! test
1681 Empty lines between lines with block tags
1682 !! wikitext
1683 <div></div>
1686 <div></div>a
1689 <div>a</div>b
1691 <div>b</div>d
1694 <div>e</div>
1695 !! html
1696 <div></div>
1697 <p><br />
1698 </p>
1699 <div></div>a
1700 <p>b
1701 </p>
1702 <div>a</div>b
1703 <div>b</div>d
1704 <p><br />
1705 </p>
1706 <div>e</div>
1708 !! html+tidy
1709 <p><br /></p>
1710 <p>a</p>
1711 <p>b</p>
1712 <div>a</div>
1713 <p>b</p>
1714 <div>b</div>
1715 <p>d</p>
1716 <p><br /></p>
1717 <div>e</div>
1718 !! html/parsoid
1719 <div data-parsoid='{"stx":"html"}'></div>
1721 <p><br /></p>
1722 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1724 <p>b</p>
1725 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1727 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1729 <p><br /></p>
1730 <div data-parsoid='{"stx":"html"}'>e</div>
1731 !! end
1733 ## PHP parser emits output which is broken
1734 ## XXX The parsoid output doesn't match the tidy output.
1735 !! test
1736 Unclosed HTML p-tags should be handled properly
1737 !! wikitext
1738 <div><p>foo</div>
1742 !! html/php+tidy
1743 <div>
1744 <p>foo&lt;/div&gt;</p>
1745 <p>a</p>
1746 b</div>
1747 !! html/parsoid
1748 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1749 <p>a</p>
1750 <p>b</p>
1751 !! end
1753 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1754 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1755 ## them for now.
1756 !! test
1757 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1758 !! options
1759 parsoid=wt2html
1760 !! wikitext
1761 a [[Category:A1]] [[Category:A2]]
1762 [[Category:A3]]
1763 [[Category:A4]]
1764 !! html/parsoid
1765 <p>a</p>
1766 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1767 !! end
1769 !! test
1770 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1771 !! options
1772 parsoid=wt2html
1773 !! wikitext
1774 [[Category:A1]]a
1775 !! html/parsoid
1776 <link href="Category:A1"/><p>a</p>
1777 !! end
1780 ### Preformatted text
1782 !! test
1783 Preformatted text
1784 !! wikitext
1785  This is some
1786  Preformatted text
1787  With ''italic''
1788  And '''bold'''
1789  And a [[Main Page|link]]
1790 !! html
1791 <pre>This is some
1792 Preformatted text
1793 With <i>italic</i>
1794 And <b>bold</b>
1795 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1796 </pre>
1797 !! end
1799 !! test
1800 Tabs don't trigger preformatted text
1801 !! wikitext
1802         This is not
1803          preformatted text.
1804  This is preformatted text.
1805         So is this.
1806 !! html
1807 <p>     This is not
1808          preformatted text.
1809 </p>
1810 <pre>This is preformatted text.
1811         So is this.
1812 </pre>
1813 !! end
1815 !! test
1816 Ident preformatting with inline content
1817 !! wikitext
1819  ''b''
1820 !! html
1821 <pre>a
1822 <i>b</i>
1823 </pre>
1824 !! end
1826 !! test
1827 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1828 !! wikitext
1829 <pre><nowiki>
1831 <cite>
1832 <em>
1833 </nowiki></pre>
1834 !! html
1835 <pre>
1836 &lt;b&gt;
1837 &lt;cite&gt;
1838 &lt;em&gt;
1839 </pre>
1841 !! end
1843 !! test
1844 Regression with preformatted in <center>
1845 !! wikitext
1846 <center>
1847  Blah
1848 </center>
1849 !! html
1850 <center>
1851 <pre>Blah
1852 </pre>
1853 </center>
1855 !! end
1857 !! test
1858 Bug 52763: Preformatted in <blockquote>
1859 !! wikitext
1860 <blockquote>
1861  Blah
1864  indented cell (no pre-wrapping!)
1866 </blockquote>
1867 !! html
1868 <blockquote>
1869 <p> Blah
1870 </p>
1871 <table>
1872 <tr>
1873 <td>
1874 <p> indented cell (no pre-wrapping!)
1875 </p>
1876 </td></tr></table>
1877 </blockquote>
1879 !! end
1881 !! test
1882 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1883 !! wikitext
1884 <blockquote>
1888 </blockquote>
1889 !! html
1890 <blockquote>
1891 <p>Foo
1892 </p><p>Bar
1893 </p>
1894 </blockquote>
1896 !! end
1898 !! test
1899 Bug 15491: <ins>/<del> in blockquote
1900 !! wikitext
1901 <blockquote>
1902 Foo <del>bar</del> <ins>baz</ins> quux
1903 </blockquote>
1904 !! html
1905 <blockquote>
1906 <p>Foo <del>bar</del> <ins>baz</ins> quux
1907 </p>
1908 </blockquote>
1910 !! end
1912 # Note that the p-wrapping is newline sensitive, which could be
1913 # considered a bug: tidy will wrap only the 'Foo' in the example
1914 # below in a <p> tag. (see comment 23-25 of bug #6200)
1915 !! test
1916 Bug 15491: <ins>/<del> in blockquote (2)
1917 !! wikitext
1918 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1919 </blockquote>
1920 !! html
1921 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1922 </blockquote>
1924 !! html+tidy
1925 <blockquote>
1926 <p>Foo</p>
1927 <del>bar</del> <ins>baz</ins> quux</blockquote>
1928 !! end
1930 !! test
1931 <pre> with attributes (bug 3202)
1932 !! wikitext
1933 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1934 !! html
1935 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1937 !! end
1939 !! test
1940 <pre> with width attribute (bug 3202)
1941 !! wikitext
1942 <pre width="8">Narrow screen goodies</pre>
1943 !! html
1944 <pre width="8">Narrow screen goodies</pre>
1946 !! end
1948 !! test
1949 <pre> with forbidden attribute (bug 3202)
1950 !! wikitext
1951 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1952 !! html
1953 <pre width="8">Narrow screen goodies</pre>
1955 !! end
1957 !! test
1958 Entities inside <pre>
1959 !! wikitext
1960 <pre>&lt;</pre>
1961 !! html
1962 <pre>&lt;</pre>
1964 !! end
1966 !! test
1967 <pre> with forbidden attribute values (bug 3202)
1968 !! wikitext
1969 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1970 !! html
1971 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1973 !! end
1975 !! test
1976 <nowiki> inside <pre> (bug 13238)
1977 !! wikitext
1978 <pre>
1979 <nowiki>
1980 </pre>
1981 <pre>
1982 <nowiki></nowiki>
1983 </pre>
1984 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1985 !! html
1986 <pre>
1987 &lt;nowiki&gt;
1988 </pre>
1989 <pre>
1991 </pre>
1992 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1994 !! end
1996 !! test
1997 <nowiki> and <pre> preference (first one wins)
1998 !! wikitext
1999 <pre>
2000 <nowiki>
2001 </pre>
2002 </nowiki>
2003 </pre>
2005 <nowiki>
2006 <pre>
2007 <nowiki>
2008 </pre>
2009 </nowiki>
2010 </pre>
2012 !! html
2013 <pre>
2014 &lt;nowiki&gt;
2015 </pre>
2016 <p>&lt;/nowiki&gt;
2017 &lt;/pre&gt;
2018 </p><p>
2019 &lt;pre&gt;
2020 &lt;nowiki&gt;
2021 &lt;/pre&gt;
2023 &lt;/pre&gt;
2024 </p>
2025 !! end
2027 !! test
2028 </pre> inside nowiki
2029 !! wikitext
2030 <nowiki></pre></nowiki>
2031 !! html
2032 <p>&lt;/pre&gt;
2033 </p>
2034 !! end
2036 # Parsoid doesn't strip empty tags, like Tidy does.
2037 !! test
2038 Empty pre; pre inside other HTML tags (bug 54946)
2039 !! options
2040 parsoid=wt2html,wt2wt
2041 !! wikitext
2044 <div><pre>
2046 </pre></div>
2047 <pre></pre>
2048 !! html/php
2049 <p>a
2050 </p>
2051 <div><pre>
2053 </pre></div>
2054 <pre></pre>
2056 !! html/php+tidy
2057 <p>a</p>
2058 <div>
2059 <pre>
2061 </pre></div>
2062 !! html/parsoid
2063 <p>a</p>
2065 <div><pre>foo
2066 </pre></div>
2067 <pre></pre>
2068 !! end
2070 !! test
2071 HTML pre followed by indent-pre
2072 !! wikitext
2073 <pre>foo</pre>
2074  bar
2075 !! html
2076 <pre>foo</pre>
2077 <pre>bar
2078 </pre>
2079 !! end
2081 !!test
2082 Block tag pre
2083 !!options
2084 parsoid
2085 !! wikitext
2086 <p><pre>foo</pre></p>
2087 !! html
2088 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2089 !!end
2091 !!test
2092 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2093 !! wikitext
2094  {{echo|}}
2095 !! html
2097 !!end
2099 !!test
2100 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2101 !! wikitext
2102  {{echo|
2103 foo}}
2104 !! html
2105 <p>foo
2106 </p>
2107 !!end
2109 !! test
2110 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2111 !! wikitext
2112  {{echo|a
2114 !! html
2115 <pre>a
2116 </pre>
2117 <p>b
2118 </p>
2119 !!end
2121 !! test
2122 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2123 !! wikitext
2124  {{echo|a
2130 !! html
2131 <pre>a
2132 </pre>
2133 <p>b
2135 </p>
2136 <pre>d
2137 </pre>
2138 <p>e
2139 </p>
2140 !!end
2142 !!test
2143 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2144 !! wikitext
2145 {{echo| foo}}
2147 {{echo| foo}}{{echo| bar}}
2149 {{echo| foo}}
2150 {{echo| bar}}
2152 {{echo|<!--cmt--> foo}}
2154 <!--cmt-->{{echo| foo}}
2156 {{echo|{{echo| }}bar}}
2157 !! html
2158 <pre>foo
2159 </pre>
2160 <pre>foo bar
2161 </pre>
2162 <pre>foo
2164 </pre>
2165 <pre>foo
2166 </pre>
2167 <pre>foo
2168 </pre>
2169 <pre>bar
2170 </pre>
2171 !!end
2173 !! test
2174 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2175 !! wikitext
2176 {{echo| }}a
2178 {{echo|
2179  }}a
2181 {{echo|
2182  b}}
2184 {{echo|a
2185  }}b
2187 {{echo|a
2188 }} b
2189 !! html
2190 <pre>a
2191 </pre>
2192 <p><br />
2193 </p>
2194 <pre>a
2195 </pre>
2196 <p><br />
2197 </p>
2198 <pre>b
2199 </pre>
2200 <p>a
2201 </p>
2202 <pre>b
2203 </pre>
2204 <p>a
2205 </p>
2206 <pre>b
2207 </pre>
2208 !!end
2210 !! test
2211 Things that look like <pre> tags aren't treated as such
2212 !! wikitext
2213 Barack Obama <President> of the United States
2214 <President></President>
2215 !! html
2216 <p>Barack Obama &lt;President&gt; of the United States
2217 &lt;President&gt;&lt;/President&gt;
2218 </p>
2219 !! end
2221 ## PHP parser discards the "<pre " string
2222 !! test
2223 Handle broken pre-like tags (bug 64025)
2224 !! options
2225 parsoid=wt2html
2226 !! wikitext
2227 {{echo|<pre <pre>x</pre>}}
2229 <table><pre </table>
2230 !! html/php
2231 <pre>x</pre>
2232 <table><pre></pre></table>
2234 !! html/parsoid
2235 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2238 <p>&lt;pre </p>
2240 <table></table>
2241 !! end
2243 !! test
2244 Parsoid: handle pre with space after attribute
2245 !! options
2246 parsoid=wt2html
2247 !! wikitext
2248 <pre style="width:50%;" >{{echo|foo}}</pre>
2249 !! html
2250 <pre style="width:50%;">{{echo|foo}}</pre>
2251 !! end
2253 # TODO / maybe: fix wt2wt for this
2254 !! test
2255 Parsoid: Don't paragraph-wrap fosterable content
2256 !! options
2257 parsoid=wt2html
2258 !! wikitext
2260 <td></td>
2261 <td></td>
2266 !! html
2267 <table>
2269 <tbody>
2270 <tr>
2271 <td></td>
2273 <td></td></tr>
2277 </tbody></table>
2278 !! end
2280 !! test
2281 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2282 !! options
2283 parsoid=wt2html
2284 !! wikitext
2286 <td>
2287 <td>
2288 </td>
2293 !! html
2294 <table>
2296 <tbody>
2297 <tr>
2298 <td></td>
2300 <td>
2301 </td></tr>
2305 </tbody></table>
2306 !! end
2309 #--------------------------------------------------------------------
2310 # Transclusion parameter whitespace stripping tests
2311 # Behavior is different for positional and named parameters
2312 #--------------------------------------------------------------------
2313 !! test
2314 Templates: Strip leading and trailing whitespace from named-param values
2315 !! wikitext
2316 {{echo|1= a }}
2318 {{echo|1= {{echo|b}} }}
2320 {{echo| 1 =
2321  c }}
2323 {{echo| 1 =
2324 * d
2326 !! html
2327 <p>a
2328 </p><p>b
2329 </p><p>c
2330 </p>
2331 <ul><li> d</li></ul>
2333 !! end
2335 !! test
2336 Templates: Don't strip whitespace from positional-param values
2337 !! wikitext
2338 {{echo|a }}
2340 {{echo|{{echo|b}} }}
2342 {{echo| c 
2345 {{echo| {{echo|d}}
2348 {{echo|
2349  e}}
2351 {{echo|
2352 * f}}
2354 {{echo|
2355  }}g
2356 !! html
2357 <p>a 
2358 </p><p>b 
2359 </p>
2360 <pre>c 
2361 </pre>
2362 <p><br />
2363 </p>
2364 <pre>d
2365 </pre>
2366 <p><br />
2367 </p>
2368 <pre>e
2369 </pre>
2370 <p><br />
2371 </p>
2372 <ul><li> f</li></ul>
2373 <p><br />
2374 </p>
2375 <pre>g
2376 </pre>
2377 !! end
2379 !! test
2380 Templates: Handle empty comment-and-ws-only lines correctly
2381 !! wikitext
2382 {{echo|foo
2383 <!--should be ignored-->
2384  <!--should be ignored as well-->
2385 bar}}
2386 !! html
2387 <p>foo
2389 </p>
2390 !! end
2392 !! test
2393 Templates: Handle comments in the target
2394 !! wikitext
2395 {{echo
2396 <!-- should be ignored -->
2397 |foo}}
2399 {{echo<!-- should be ignored -->
2400 |foo}}
2402 {{echo<!-- should be ignored -->|foo}}
2404 {{<!-- should be ignored -->echo|foo}}
2405 !!html/parsoid
2406 <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>
2408 <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>
2410 <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>
2412 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2413 !!end
2415 !! test
2416 Templates: Handle comments in parameter names (bug 67657)
2417 !! wikitext
2418 {{echo|1
2419 <!-- should be ignored -->
2420 =foo}}
2422 {{echo|
2423 <!-- should be ignored -->
2424 1 = foo}}
2426 {{echo|1<!-- should be ignored --> = foo}}
2428 {{echo|<!-- should be ignored -->1 = foo}}
2429 !!html/parsoid
2430 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2432 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2434 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2436 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2437 !!end
2439 !! test
2440 Templates: Other wikitext in parameter names (bug 67657)
2441 !! wikitext
2442 {{echo|''1''=foo}}
2443 !!html/parsoid
2444 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2445 !!html/php
2446 <p>{{{1}}}
2447 </p>
2448 !!end
2450 #--------------------------------------------------------------------
2451 # Transclusion parameter escaping tests
2452 #--------------------------------------------------------------------
2453 !! test
2454 Templates: Parsoid parameter escaping test 1
2455 !! options
2456 parsoid
2457 !! wikitext
2458 {{echo|[foo]|{{echo|[bar]}}}}
2459 !! html
2460 <p about="#mwt1" typeof="mw:Transclusion"
2461 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2462 !! end
2464 !! test
2465 Parsoid: Pipes in external links in template parameter
2466 !! options
2467 parsoid
2468 !! wikitext
2469 {{echo|[{{echo|http://example.com}} link]}}
2470 !! html
2471 <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>
2472 !! end
2474 !! test
2475 Parsoid: pipe in transclusion parameter
2476 !! options
2477 parsoid
2478 !! wikitext
2479 {{echo|http://foo.com/a&#124;b}}
2480 !! html
2481 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2482 typeof="mw:Transclusion"
2483 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>
2484 !! end
2486 !! test
2487 Parsoid: Pipe in external link target and content in template parameter
2488 !! options
2489 parsoid=html2wt,wt2wt
2490 !! wikitext
2491 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2492 !! html
2493 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2494 typeof="mw:Transclusion"
2495 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2496 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2497 !! end
2499 !! test
2500 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2501 !! options
2502 parsoid
2503 !! wikitext
2504 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2505 !! html
2506 <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>
2507 !! end
2509 !! test
2510 Templates: Don't escape already nowiki-escaped text in template parameters
2511 !! options
2512 parsoid=html2wt,wt2wt
2513 !! wikitext
2514 {{echo|foo<nowiki>|</nowiki>bar}}
2515 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2516 {{echo|<nowiki></nowiki>}}
2517 !! html
2518 <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>
2519 <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>
2520 <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>
2521 </p>
2522 !! end
2524 ## Bug 52824
2525 !! test
2526 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2527 !! options
2528 parsoid=html2wt,wt2wt
2529 !! wikitext
2530 {{echo|{{echo|1=bar}}}}
2531 !! html
2532 <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>
2533 !! end
2535 ## Bug 56733
2536 !! test
2537 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2538 !! options
2539 parsoid
2540 !! wikitext
2541 {{echo|a : b}}
2542 !! html
2543 <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>
2544 !! end
2546 ## Bug T73412
2547 !! test
2548 Templates: Preserve blank parameter names
2549 !! wikitext
2550 {{echo|=foo}}
2551 !! html/php
2552 <p>{{{1}}}
2553 </p>
2554 !! html/parsoid
2555 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2556 !! end
2559 ### Parsoid-centric tests for testing RT edge cases for pre
2562 !!test
2563 1a. Indent-Pre and Comments
2564 !! wikitext
2566 <!--a-->
2568 !! html
2569 <pre>a
2570 </pre>
2571 <p>c
2572 </p>
2573 !!end
2575 !!test
2576 1b. Indent-Pre and Comments
2577 !! wikitext
2579  <!--a-->
2581 !! html
2582 <pre>a
2583 </pre>
2584 <p>c
2585 </p>
2586 !!end
2588 !!test
2589 1c. Indent-Pre and Comments
2590 !! wikitext
2591 <!--a-->  a
2593  <!--a--> a
2594 !! html
2595 <pre> a
2596 </pre>
2597 <pre> a
2598 </pre>
2599 !!end
2601 !!test
2602 1d. Indent-Pre and Comments
2603 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2604 !! wikitext
2605 <!--a--> a
2607  <!--b-->b
2608 !! html
2609 <pre>a
2610 </pre>
2611 <pre>b
2612 </pre>
2613 !!end
2615 !!test
2616 2a. Indent-Pre and tables
2617 !! wikitext
2618  {|
2619  |-
2620  !h1!!h2
2621  |foo||bar
2622  |}
2623 !! html
2624 <table>
2626 <tr>
2627 <th>h1</th>
2628 <th>h2
2629 </th>
2630 <td>foo</td>
2631 <td>bar
2632 </td></tr></table>
2634 !!end
2636 !!test
2637 2b. Indent-Pre and tables
2638 !! wikitext
2639   {|
2640  |-
2641 |foo
2643 !! html
2644 <table>
2646 <tr>
2647 <td>foo
2648 </td></tr></table>
2650 !!end
2652 !!test
2653 2c. Indent-Pre and tables (bug 42252)
2654 !! wikitext
2656  |+ foo
2657  !  | bar
2659 !! html
2660 <table>
2661 <caption> foo
2662 </caption>
2663 <tr>
2664 <th> bar
2665 </th></tr></table>
2667 !!end
2669 !!test
2670 2d. Indent-Pre and tables
2671 !! wikitext
2673  {|
2674  | b
2675  |}
2676 !! html/php
2677 <pre>a
2678 </pre>
2679 <table>
2680 <tr>
2681 <td> b
2682 </td></tr></table>
2684 !! html/parsoid
2685 <pre>a</pre>
2686  <table>
2687  <tbody><tr><td> b</td></tr>
2688  </tbody></table>
2689 !!end
2691 !!test
2692 2e. Indent-Pre and table-line syntax
2693 !! wikitext
2695  | b
2696  | c
2697 !! html/php
2698 <pre>a
2699 | b
2700 | c
2701 </pre>
2702 !!end
2704 !!test
2705 2f. Indent-pre started by table-line syntax
2706 !! wikitext
2708  | b
2709  | c
2710 !! html/php
2711 <p>a
2712 </p>
2713 <pre>| b
2714 | c
2715 </pre>
2716 !! html/parsoid
2717 <p>a</p>
2718 <pre>
2719 | b
2720 | c</pre>
2721 !!end
2723 !!test
2724 3a. Indent-Pre and block tags (single-line html)
2725 !! wikitext
2726  a <p> foo </p>
2727  b <div> foo </div>
2728  c <blockquote> foo </blockquote>
2729  <span> foo </span>
2730 !! html
2731  a <p> foo </p>
2732  b <div> foo </div>
2733  c <blockquote> foo </blockquote>
2734 <pre><span> foo </span>
2735 </pre>
2736 !! html/parsoid
2737  <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2738  <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2739  <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2740 <pre><span> foo </span>
2741 </pre>
2742 !! html+tidy
2743 <p>a</p>
2744 <p>foo</p>
2745 <p>b</p>
2746 <div>foo</div>
2747 <p>c</p>
2748 <blockquote>
2749 <p>foo</p>
2750 </blockquote>
2751 <pre>
2752 <span> foo </span>
2753 </pre>
2754 !! end
2756 !!test
2757 3b. Indent-Pre and block tags (multi-line html)
2758 !! wikitext
2759  a <span>foo</span>
2760  b <div> foo </div>
2761 !! html
2762 <pre>a <span>foo</span>
2763 </pre>
2764  b <div> foo </div>
2766 !! html/parsoid
2767 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2768  b <div data-parsoid='{"stx":"html"}'> foo </div>
2769 !! html+tidy
2770 <pre>
2771 a <span>foo</span>
2772 </pre>
2773 <p>b</p>
2774 <div>foo</div>
2775 !!end
2777 !!test
2778 3c. Indent-Pre and block tags (pre-content on separate line)
2779 !! wikitext
2781  foo
2782 </p>
2784 <div>
2785  foo
2786 </div>
2788 <center>
2789  foo
2790 </center>
2792 <blockquote>
2793  foo
2794 </blockquote>
2796 <blockquote>
2797 <pre>
2799 </pre>
2800 </blockquote>
2802 <table><tr><td>
2803  foo
2804 </td></tr></table>
2806 <ul><li>
2807   foo
2808 </li></ul>
2810 !! html
2812  foo
2813 </p>
2814 <div>
2815 <pre>foo
2816 </pre>
2817 </div>
2818 <center>
2819 <pre>foo
2820 </pre>
2821 </center>
2822 <blockquote>
2823 <p> foo
2824 </p>
2825 </blockquote>
2826 <blockquote>
2827 <pre>
2829 </pre>
2830 </blockquote>
2831 <table><tr><td>
2832 <pre>foo
2833 </pre>
2834 </td></tr></table>
2835 <ul><li>
2836   foo
2837 </li></ul>
2839 !!end
2841 !!test
2842 4. Indent-Pre and extension tags
2843 !! wikitext
2844  a <gallery>
2845 File:foobar.jpg
2846 </gallery>
2847 !! html
2848  a <ul class="gallery mw-gallery-traditional">
2849                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2850                         <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>
2851                         <div class="gallerytext">
2852                         </div>
2853                 </div></li>
2854 </ul>
2856 !! html+tidy
2857 <p>a</p>
2858 <ul class="gallery mw-gallery-traditional">
2859 <li class="gallerybox" style="width: 155px">
2860 <div style="width: 155px">
2861 <div class="thumb" style="width: 150px;">
2862 <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>
2863 </div>
2864 <div class="gallerytext"></div>
2865 </div>
2866 </li>
2867 </ul>
2868 !!end
2870 !! test
2871 Table wikitext syntax outside wiki-tables
2872 !! wikitext
2874 ! not a table heading
2875 |- not a table row
2876 | not a table cell
2877 | class="foo bar" | baz
2882 !! html
2883 <p>a
2884 ! not a table heading
2885 |- not a table row
2886 | not a table cell
2887 | class="foo bar" | baz
2892 </p>
2893 !! end
2895 !!test
2896 Render paragraphs when indent-pre is suppressed in blocklevels
2897 !! wikitext
2898 <blockquote>
2899  foo
2901  bar
2902 </blockquote>
2903 !! html
2904 <blockquote>
2905 <p> foo
2906 </p><p> bar
2907 </p>
2908 </blockquote>
2910 !!end
2912 !!test
2913 4. Multiple spaces at start-of-line
2914 !! wikitext
2915     <p> foo </p>
2916     foo
2917         {|
2918 |foo
2920 !! html
2921     <p> foo </p>
2922 <pre>   foo
2923 </pre>
2924 <table>
2925 <tr>
2926 <td>foo
2927 </td></tr></table>
2929 !!end
2931 ## NOTE: the leading white-space chars on empty line are significant
2932 !! test
2933 5a. White-space in indent-pre
2934 !! wikitext
2935  a<br />
2938 !! html
2939 <pre>a<br />
2942 </pre>
2943 !! end
2945 ## NOTE: the leading white-space chars on empty line are significant
2946 !! test
2947 5b. White-space in indent-pre
2948 !! wikitext
2955 !! html
2956 <pre>a
2962 </pre>
2963 !! end
2965 !! test
2966 5c. White-space in indent-pre
2967 !! wikitext
2968  ''a''
2969   ''b''
2970    ''c''
2971 !! html
2972 <pre><i>a</i>
2973  <i>b</i>
2974   <i>c</i>
2975 </pre>
2976 !! end
2978 !! test
2979 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2980 !! wikitext
2983  <!-- continue -->
2989 !! html
2990 <pre>a
2993 </pre>
2994 <pre>c
2996 </pre>
2997 <p>d
2998 </p>
2999 !! end
3001 !! test
3002 7a. Indent-pre and category links
3003 !! options
3004 parsoid=wt2html,wt2wt
3005 !! wikitext
3006  [[Category:foo]] <!-- No pre-wrapping -->
3007 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3008 !! html
3009  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
3010 <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 -->
3011 !! end
3013 !! test
3014 7b. Indent-pre and category links
3015 !! options
3016 parsoid=wt2html,wt2wt
3017 !! wikitext
3018  [[Category:foo]] a
3019  [[Category:foo]] {{echo|b}}
3020 !! html
3021 <pre>
3022 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
3023 <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>
3024 !! end
3027 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3030 !!test
3031 HTML-pre: 1. embedded newlines
3032 !! wikitext
3033 <pre>foo</pre>
3035 <pre>
3037 </pre>
3039 <pre>
3042 </pre>
3044 <pre>
3048 </pre>
3049 !! html
3050 <pre>foo</pre>
3051 <pre>
3053 </pre>
3054 <pre>
3057 </pre>
3058 <pre>
3062 </pre>
3064 !! html/parsoid
3065 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3067 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3069 </pre>
3071 <pre data-parsoid='{"stx":"html"}'>
3074 </pre>
3076 <pre data-parsoid='{"stx":"html"}'>
3080 </pre>
3081 !!end
3083 !! test
3084 HTML-pre: big spaces
3085 !! wikitext
3086 <pre>
3091 haha
3096 haha
3101 </pre>
3102 !! html
3103 <pre>
3108 haha
3113 haha
3118 </pre>
3120 !! html/parsoid
3121 <pre data-parsoid='{"stx":"html"}'>
3126 haha
3131 haha
3136 </pre>
3137 !! end
3139 !!test
3140 HTML-pre: 2: indented text
3141 !! wikitext
3142 <pre>
3143  foo
3144 </pre>
3145 !! html
3146 <pre>
3147  foo
3148 </pre>
3150 !!end
3152 !!test
3153 HTML-pre: 3: other wikitext
3154 !! wikitext
3155 <pre>
3156 * foo
3157 # bar
3158 = no-h =
3159 '' no-italic ''
3160 [[ NoLink ]]
3161 </pre>
3162 !! html
3163 <pre>
3164 * foo
3165 # bar
3166 = no-h =
3167 '' no-italic ''
3168 [[ NoLink ]]
3169 </pre>
3171 !!end
3174 ### Definition lists
3176 !! test
3177 Simple definition
3178 !! wikitext
3179 ; name : Definition
3180 !! html
3181 <dl><dt> name&#160;</dt>
3182 <dd> Definition</dd></dl>
3184 !! end
3186 !! test
3187 Definition list for indentation only
3188 !! wikitext
3189 : Indented text
3190 !! html
3191 <dl><dd> Indented text</dd></dl>
3193 !! end
3195 !! test
3196 Definition list with no space
3197 !! wikitext
3198 ;name:Definition
3199 !! html
3200 <dl><dt>name</dt>
3201 <dd>Definition</dd></dl>
3203 !!end
3205 !! test
3206 Definition list with URL link
3207 !! wikitext
3208 ; http://example.com/ : definition
3209 !! html
3210 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3211 <dd> definition</dd></dl>
3213 !! end
3215 !! test
3216 Definition list with bracketed URL link
3217 !! wikitext
3218 ;[http://www.example.com/ Example]:Something about it
3219 !! html
3220 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3221 <dd>Something about it</dd></dl>
3223 !! end
3225 !! test
3226 Definition list with wikilink containing colon
3227 !! wikitext
3228 ; [[Help:FAQ]]: The least-read page on Wikipedia
3229 !! html
3230 <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>
3231 <dd> The least-read page on Wikipedia</dd></dl>
3233 !! end
3235 # At Brion's and JeLuF's insistence... :)
3236 !! test
3237 Definition list with news link containing colon
3238 !! wikitext
3239 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
3240 !! html/php
3241 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3242 <dd> This isn't even a real newsgroup!</dd></dl>
3244 !! html/parsoid
3245 <dl><dt>  <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3246 !! end
3248 !! test
3249 Malformed definition list with colon
3250 !! wikitext
3251 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3252 !! html
3253 <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>
3255 !! end
3257 !! test
3258 Definition lists: colon in external link text
3259 !! wikitext
3260 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3261 !! html
3262 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3263 <dd> OK, I made that up</dd></dl>
3265 !! end
3267 !! test
3268 Definition lists: colon in HTML attribute
3269 !! wikitext
3270 ;<b style="display: inline">bold</b>
3271 !! html
3272 <dl><dt><b style="display: inline">bold</b></dt></dl>
3274 !! end
3276 !! test
3277 Definition lists: self-closed tag
3278 !! wikitext
3279 ;one<br/>two : two-line fun
3280 !! html
3281 <dl><dt>one<br />two&#160;</dt>
3282 <dd> two-line fun</dd></dl>
3284 !! end
3286 !! test
3287 Bug 11748: Literal closing tags
3288 !! wikitext
3289 <dl>
3290 <dt>test 1</dt>
3291 <dd>test test test test test</dd>
3292 <dt>test 2</dt>
3293 <dd>test test test test test</dd>
3294 </dl>
3295 !! html
3296 <dl>
3297 <dt>test 1</dt>
3298 <dd>test test test test test</dd>
3299 <dt>test 2</dt>
3300 <dd>test test test test test</dd>
3301 </dl>
3303 !! end
3305 !! test
3306 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3307 !! wikitext
3308 <ul><li>
3309 ; term : description
3310 * unordered
3311 </li></ul>
3312 !! html
3313 <ul><li>
3314 <dl><dt> term&#160;</dt>
3315 <dd> description</dd></dl>
3316 <ul><li> unordered</li></ul>
3317 </li></ul>
3319 !! end
3321 !! test
3323 Definition list with empty definition and following paragraph
3324 !! wikitext
3325 ; term:
3326 Paragraph text
3327 !! html
3328 <dl><dt> term</dt>
3329 <dd></dd></dl>
3330 <p>Paragraph text
3331 </p>
3332 !! end
3334 !! test
3335 Nested definition lists using html syntax
3336 !! wikitext
3337 <dl><dt>x</dt>
3338 <dd>a</dd>
3339 <dd>b</dd></dl>
3341 !! end
3343 !! test
3344 Definition Lists: No nesting: Multiple dd's
3345 !! wikitext
3349 !! html
3350 <dl><dt>x</dt>
3351 <dd>a</dd>
3352 <dd>b</dd></dl>
3354 !! end
3356 !! test
3357 Definition Lists: Indentation: Regular
3358 !! wikitext
3360 ::i2
3361 :::i3
3362 !! html
3363 <dl><dd>i1
3364 <dl><dd>i2
3365 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3367 !! end
3369 !! test
3370 Definition Lists: Indentation: Missing 1st level
3371 !! wikitext
3372 ::i2
3373 :::i3
3374 !! html
3375 <dl><dd><dl><dd>i2
3376 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3378 !! end
3380 !! test
3381 Definition Lists: Indentation: Multi-level indent
3382 !! wikitext
3383 :::i3
3384 !! html
3385 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3387 !! end
3389 !! test
3390 Definition Lists: Hacky use to indent tables
3391 !! wikitext
3392 ::{|
3393 |foo
3394 |bar
3396 this text
3397 should be left alone
3398 !! html
3399 <dl><dd><dl><dd><table>
3400 <tr>
3401 <td>foo
3402 </td>
3403 <td>bar
3404 </td></tr></table></dd></dl></dd></dl>
3405 <p>this text
3406 should be left alone
3407 </p>
3408 !! end
3410 !! test
3411 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3412 !! wikitext
3413 <!-- foo -->
3414 ::{|
3415 |foo
3416 |bar
3417 |}<!-- bar -->
3418 this text
3419 should be left alone
3420 !! html/parsoid
3421 <!-- foo -->
3422 <dl><dd><dl><dd><table><tr>
3423 <td>foo</td>
3424 <td>bar</td>
3425 </tr></table><!-- bar --></dd></dl></dd></dl>
3426 <p>this text
3427 should be left alone</p>
3428 !! end
3430 !! test
3431 Definition Lists: Hacky use to indent tables, with comment before table
3432 !! wikitext
3433 ::<!-- foo -->{|
3434 |foo
3436 !! html/parsoid
3437 <dl><dd><dl><dd><!-- foo --><table><tr>
3438 <td>foo</td>
3439 </tr></table></dd></dl></dd></dl>
3440 !! end
3442 # Bug 52473
3443 !! test
3444 Definition Lists: Hacky use to indent tables (WS-insensitive)
3445 !! options
3446 parsoid
3447 !! wikitext
3448 : {|
3450 |} 
3451 !! html
3452 <dl>
3453 <dd> <table><tr><td>a</td></tr></table> </dd>
3454 </dl>
3455 !! end
3456 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3457 ## as an empty dt item.  It also ignores all but the last ";" when followed
3458 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3459 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3460 ## ";"s.
3462 ## Ex: ";;t2 ::d2" is transformed into:
3464 ## <dl>
3465 ##   <dt>t2 </dt>
3466 ##   <dd>
3467 ##     <dl>
3468 ##       <dt></dt>
3469 ##       <dd>d2</dd>
3470 ##     </dl>
3471 ##   </dd>
3472 ## </dl>
3474 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3475 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3477 ## <dl>
3478 ##   <dt>
3479 ##     <dl>
3480 ##       <dt>t2 </dt>
3481 ##       <dd>:d2</dd>
3482 ##     </dl>
3483 ##    </dt>
3484 ## </dl>
3486 ## All Parsoid only definition list tests have this difference.
3488 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3489 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3491 !! test
3492 Table / list interaction: indented table with lists in table contents
3493 !! wikitext
3496 | a
3497 * b
3499 | c
3500 * d
3502 !! html
3503 <dl><dd><table>
3505 <tr>
3506 <td> a
3507 <ul><li> b</li></ul>
3508 </td></tr>
3509 <tr>
3510 <td> c
3511 <ul><li> d</li></ul>
3512 </td></tr></table></dd></dl>
3514 !! end
3516 !!test
3517 Table / list interaction: lists nested in tables nested in indented lists
3518 !! wikitext
3530 !! html
3531 <dl><dd><table>
3532 <tr>
3533 <td>
3534 <dl><dd>a</dd>
3535 <dd>b</dd></dl>
3536 </td>
3537 <td>
3538 <ul><li>c</li>
3539 <li>d</li></ul>
3540 </td></tr></table></dd></dl>
3541 <ul><li>e</li>
3542 <li>f</li></ul>
3544 !!end
3546 !! test
3547 Definition Lists: Nesting: Multi-level (Parsoid only)
3548 !! options
3549 parsoid
3550 !! wikitext
3551 ;t1 :d1
3552 ;;t2 ::d2
3553 ;;;t3 :::d3
3554 !! html
3555 <dl>
3556   <dt>t1 </dt>
3557   <dd>d1</dd>
3558   <dt>
3559     <dl>
3560       <dt>t2 </dt>
3561       <dd>:d2</dd>
3562       <dt>
3563         <dl>
3564           <dt>t3 </dt>
3565           <dd>::d3</dd>
3566         </dl>
3567       </dt>
3568     </dl>
3569   </dt>
3570 </dl>
3573 !! end
3576 !! test
3577 Definition Lists: Nesting: Test 2 (Parsoid only)
3578 !! options
3579 parsoid
3580 !! wikitext
3582 ::d2
3583 !! html
3584 <dl>
3585   <dt>t1</dt>
3586   <dd>
3587     <dl>
3588       <dd>d2</dd>
3589     </dl>
3590   </dd>
3591 </dl>
3593 !! end
3596 !! test
3597 Definition Lists: Nesting: Test 3 (Parsoid only)
3598 !! options
3599 parsoid
3600 !! wikitext
3601 :;t1
3602 ::::d2
3603 !! html
3604 <dl>
3605   <dd>
3606     <dl>
3607       <dt>t1</dt>
3608       <dd>
3609         <dl>
3610           <dd>
3611             <dl>
3612               <dd>d2</dd>
3613             </dl>
3614           </dd>
3615         </dl>
3616       </dd>
3617     </dl>
3618   </dd>
3619 </dl>
3621 !! end
3624 !! test
3625 Definition Lists: Nesting: Test 4
3626 !! wikitext
3627 ::;t3
3628 :::d3
3629 !! html
3630 <dl><dd><dl><dd><dl><dt>t3</dt>
3631 <dd>d3</dd></dl></dd></dl></dd></dl>
3633 !! end
3636 ## The Parsoid team believes the following three test exposes a
3637 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
3638 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3639 ## It also exposes a "misfeature" in tidy, which doesn't like
3640 ## <dl> tags with a single <dt> child; it converts the <dt> into
3641 ## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
3642 !! test
3643 Definition Lists: Mixed Lists: Test 1
3644 !! wikitext
3645 :;* foo
3646 ::* bar
3647 :; baz
3648 !! html/php
3649 <dl><dd><dl><dt><ul><li> foo</li>
3650 <li> bar</li></ul></dt></dl>
3651 <dl><dt> baz</dt></dl></dd></dl>
3653 !! html/php+tidy
3654 <dl>
3655 <dd>
3656 <dl>
3657 <dd>
3658 <ul>
3659 <li>foo</li>
3660 <li>bar</li>
3661 </ul>
3662 </dd>
3663 </dl>
3664 <dl>
3665 <dt>baz</dt>
3666 </dl>
3667 </dd>
3668 </dl>
3669 !! html/parsoid
3670 <dl>
3671 <dd><dl>
3672 <dt><ul>
3673 <li> foo
3674 </li>
3675 </ul></dt>
3676 <dd><ul>
3677 <li> bar
3678 </li>
3679 </ul></dd>
3680 <dt> baz</dt>
3681 </dl></dd>
3682 </dl>
3683 !! end
3685 !! test
3686 Definition Lists: Mixed Lists: Test 2
3687 !! wikitext
3688 *: d1
3689 *: d2
3690 !! html
3691 <ul><li><dl><dd> d1</dd>
3692 <dd> d2</dd></dl></li></ul>
3694 !! end
3697 !! test
3698 Definition Lists: Mixed Lists: Test 3
3699 !! wikitext
3700 *::: d1
3701 *::: d2
3702 !! html
3703 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3704 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3706 !! end
3709 !! test
3710 Definition Lists: Mixed Lists: Test 4
3711 !! wikitext
3712 *;d1 :d2
3713 *;d3 :d4
3714 !! html
3715 <ul><li><dl><dt>d1&#160;</dt>
3716 <dd>d2</dd>
3717 <dt>d3&#160;</dt>
3718 <dd>d4</dd></dl></li></ul>
3720 !! end
3723 !! test
3724 Definition Lists: Mixed Lists: Test 5
3725 !! wikitext
3726 *:d1
3727 *:: d2
3728 !! html
3729 <ul><li><dl><dd>d1
3730 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3732 !! end
3735 !! test
3736 Definition Lists: Mixed Lists: Test 6
3737 !! wikitext
3738 #*:d1
3739 #*::: d3
3740 !! html
3741 <ol><li><ul><li><dl><dd>d1
3742 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3744 !! end
3747 !! test
3748 Definition Lists: Mixed Lists: Test 7
3749 !! wikitext
3750 :* d1
3751 :* d2
3752 !! html
3753 <dl><dd><ul><li> d1</li>
3754 <li> d2</li></ul></dd></dl>
3756 !! end
3759 !! test
3760 Definition Lists: Mixed Lists: Test 8
3761 !! wikitext
3762 :* d1
3763 ::* d2
3764 !! html
3765 <dl><dd><ul><li> d1</li></ul>
3766 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3768 !! end
3771 !! test
3772 Definition Lists: Mixed Lists: Test 9
3773 !! wikitext
3774 *;foo :bar
3775 !! html
3776 <ul><li><dl><dt>foo&#160;</dt>
3777 <dd>bar</dd></dl></li></ul>
3779 !! end
3782 !! test
3783 Definition Lists: Mixed Lists: Test 10
3784 !! wikitext
3785 *#;foo :bar
3786 !! html
3787 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3788 <dd>bar</dd></dl></li></ol></li></ul>
3790 !! end
3792 # The Parsoid team disagrees with the PHP parser's seemingly-random
3793 # rules regarding dd/dt on the next two tests.  Parsoid is more
3794 # consistent, and recognizes the shared nesting and keeps the
3795 # still-open tags around until the nesting is complete.
3796 # (And tidy again converts <dt> to <dd> before 'bar'.)
3798 !! test
3799 Definition Lists: Mixed Lists: Test 11
3800 !! wikitext
3801 *#*#;*;;foo :bar
3802 *#*#;boo :baz
3803 !! html/php
3804 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3805 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3806 <dl><dt>boo&#160;</dt>
3807 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3809 !! html/php+tidy
3810 <ul>
3811 <li>
3812 <ol>
3813 <li>
3814 <ul>
3815 <li>
3816 <ol>
3817 <li>
3818 <dl>
3819 <dt>foo&#160;</dt>
3820 <dd>
3821 <ul>
3822 <li>
3823 <dl>
3824 <dd>
3825 <dl>
3826 <dt>bar</dt>
3827 </dl>
3828 </dd>
3829 </dl>
3830 </li>
3831 </ul>
3832 </dd>
3833 </dl>
3834 <dl>
3835 <dt>boo&#160;</dt>
3836 <dd>baz</dd>
3837 </dl>
3838 </li>
3839 </ol>
3840 </li>
3841 </ul>
3842 </li>
3843 </ol>
3844 </li>
3845 </ul>
3846 !! html/parsoid
3847 <ul>
3848 <li>
3849 <ol>
3850 <li>
3851 <ul>
3852 <li>
3853 <ol>
3854 <li>
3855 <dl>
3856 <dt>
3857 <ul>
3858 <li>
3859 <dl>
3860 <dt>
3861 <dl>
3862 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3863 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3864 </dl></dt>
3865 </dl></li>
3866 </ul></dt>
3867 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3868 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3869 </dl></li>
3870 </ol></li>
3871 </ul></li>
3872 </ol></li>
3873 </ul>
3874 !! end
3877 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3878 !! test
3879 Definition Lists: Weird Ones: Test 1
3880 !! wikitext
3881 *#;*::;; foo : bar (who uses this?)
3882 !! html/php
3883 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3884 <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>
3886 !! html/php+tidy
3887 <ul>
3888 <li>
3889 <ol>
3890 <li>
3891 <dl>
3892 <dt>foo&#160;</dt>
3893 <dd>
3894 <ul>
3895 <li>
3896 <dl>
3897 <dd>
3898 <dl>
3899 <dd>
3900 <dl>
3901 <dd>
3902 <dl>
3903 <dt>bar (who uses this?)</dt>
3904 </dl>
3905 </dd>
3906 </dl>
3907 </dd>
3908 </dl>
3909 </dd>
3910 </dl>
3911 </li>
3912 </ul>
3913 </dd>
3914 </dl>
3915 </li>
3916 </ol>
3917 </li>
3918 </ul>
3919 !! html/parsoid
3920 <ul>
3921 <li>
3922 <ol>
3923 <li>
3924 <dl>
3925 <dt>
3926 <ul>
3927 <li>
3928 <dl>
3929 <dd>
3930 <dl>
3931 <dd>
3932 <dl>
3933 <dt>
3934 <dl>
3935 <dt> foo<span typeof="mw:Placeholder">&nbsp;</span></dt>
3936 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3937 </dl></dt>
3938 </dl></dd>
3939 </dl></dd>
3940 </dl></li>
3941 </ul></dt>
3942 </dl></li>
3943 </ol></li>
3944 </ul>
3945 !! end
3947 !! test
3948 Definition Lists: colons occurring in tags
3949 !! wikitext
3950 ;a:b
3951 ;'''a:b'''
3952 ;<i>a:b</i>
3953 ;<span>a:b</span>
3954 ;<div>a:b</div>
3955 ;{{echo|a:b}}
3956 ;{{echo|''a:b''}}
3957 !! html
3958 <dl><dt>a</dt>
3959 <dd>b</dd>
3960 <dt><b>a:b</b></dt>
3961 <dt><i>a:b</i></dt>
3962 <dt><span>a:b</span></dt>
3963 <dt><div>a:b</div></dt>
3964 <dt>a</dt>
3965 <dd>b</dd>
3966 <dt><i>a:b</i></dt></dl>
3968 !! end
3970 !! test
3971 Definition Lists: colons and tables 1
3972 !! wikitext
3974 | x
3977 | y
3979 !! html
3980 <dl><dd><table>
3981 <tr>
3982 <td> x
3983 </td></tr></table></dd></dl>
3984 <dl><dd><table>
3985 <tr>
3986 <td> y
3987 </td></tr></table></dd></dl>
3989 !! end
3991 # Parsoid's output (as documented below) differs from php's in this case.
3992 # This is probably a bug. If we fixup parsoid to match php's output, the
3993 # above test should pass and the below test case can be removed. It is
3994 # unclear which output is more desirable.
3996 !! test
3997 Definition Lists: colons and tables 2
3998 !! wikitext
4000 | x
4003 | y
4005 !! html/parsoid
4006 <dl><dd><table>
4007 <tr>
4008 <td> x
4009 </td></tr></table></dd>
4010 <dd><table>
4011 <tr>
4012 <td> y
4013 </td></tr></table></dd></dl>
4014 !! end
4018 ### External links
4020 !! test
4021 External links: non-bracketed
4022 !! wikitext
4023 Non-bracketed: http://example.com
4024 !! html
4025 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4026 </p>
4027 !! end
4029 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4030 !! test
4031 External links: numbered
4032 !! wikitext
4033 Numbered: [http://example.com]
4034 Numbered: [http://example.net]
4035 Numbered: [http://example.com]
4036 !! html/php
4037 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4038 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4039 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4040 </p>
4041 !! html/parsoid
4042 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4043 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4044 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4045 !!end
4047 !! test
4048 External links: specified text
4049 !! wikitext
4050 Specified text: [http://example.com link]
4051 !! html
4052 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4053 </p>
4054 !!end
4056 !! test
4057 External links: trail
4058 !! wikitext
4059 Linktrails should not work for external links: [http://example.com link]s
4060 !! html
4061 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4062 </p>
4063 !! end
4065 !! test
4066 External links: dollar sign in URL
4067 !! wikitext
4068 http://example.com/1$2345
4069 !! html
4070 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4071 </p>
4072 !! end
4074 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4075 !! test
4076 External links: dollar sign in URL (autonumber)
4077 !! wikitext
4078 [http://example.com/1$2345]
4079 !! html/php
4080 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4081 </p>
4082 !! html/parsoid
4083 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4084 !!end
4086 !! test
4087 External links: open square bracket forbidden in URL (bug 4377)
4088 !! options
4089 parsoid=wt2html,wt2wt,html2html
4090 !! wikitext
4091 http://example.com/1[2345
4092 !! html/php
4093 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4094 </p>
4095 !! html/parsoid
4096 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4097 !! end
4099 !! test
4100 External links: open square bracket forbidden in URL (named) (bug 4377)
4101 !! options
4102 parsoid=wt2html,html2html
4103 !! wikitext
4104 [http://example.com/1[2345]
4105 !! html/php
4106 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4107 </p>
4108 !! html/parsoid
4109 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4110 !!end
4112 # parsoid adds a space before the link name
4113 !! test
4114 External links: open square bracket forbidden in URL (named) (bug 4377)
4115 Parsoid variant.
4116 !! wikitext
4117 [http://example.com/1 [2345]
4118 !! html
4119 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4120 </p>
4121 !!end
4123 !! test
4124 External links: nowiki in URL link text (bug 6230)
4125 !! wikitext
4126 [http://example.com/ <nowiki>''example site''</nowiki>]
4127 !! html
4128 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4129 </p>
4130 !! end
4132 !! test
4133 External links: newline forbidden in text (bug 6230 regression check)
4134 !! wikitext
4135 [http://example.com/ first
4136 second]
4137 !! html
4138 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4139 second]
4140 </p>
4141 !!end
4143 !! test
4144 External links: Pipe char between url and text
4145 !! wikitext
4146 [http://example.com | link]
4147 !! html
4148 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4149 </p>
4150 !!end
4152 !! test
4153 External links: protocol-relative URL in brackets
4154 !! wikitext
4155 [//example.com/ Test]
4156 !! html
4157 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4158 </p>
4159 !! end
4161 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4162 !! test
4163 External links: protocol-relative URL in brackets without text
4164 !! wikitext
4165 [//example.com]
4166 !! html/php
4167 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4168 </p>
4169 !! html/parsoid
4170 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4171 !! end
4173 !! test
4174 External links: protocol-relative URL in free text is left alone
4175 !! wikitext
4176 //example.com/Foo
4177 !! html
4178 <p>//example.com/Foo
4179 </p>
4180 !!end
4182 !! test
4183 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4184 !! wikitext
4185 foo//example.com/Foo
4186 !! html
4187 <p>foo//example.com/Foo
4188 </p>
4189 !! end
4191 !! test
4192 External links: with no contents
4193 !! wikitext
4194 [http://en.wikipedia.org/wiki/Foo]
4196 [[wikipedia:Foo|Bar]]
4198 [[wikipedia:Foo|<span>Bar</span>]]
4199 !! html/php
4200 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4201 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4202 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4203 </p>
4204 !! html/parsoid
4205 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4206 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4207 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4208 !! end
4210 !! test
4211 External links: Free with trailing punctuation
4212 !! wikitext
4213 http://example.com,
4214 http://example.com;
4215 http://example.com\
4216 http://example.com.
4217 http://example.com:
4218 http://example.com!
4219 http://example.com?
4220 http://example.com)
4221 http://example.com/url_with_(brackets)
4222 (http://example.com/url_without_brackets)
4223 http://example.com/url_with_entity&nbsp;
4224 http://example.com/url_with_entity&#xA0;
4225 http://example.com/url_with_entity&#160;
4226 http://example.com/url_with_entity&lt;
4227 http://example.com/url_with_entity&#x3C;
4228 http://example.com/url_with_entity&#60;
4229 !! html/php
4230 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4231 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4232 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4233 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4234 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4235 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4236 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4237 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4238 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4239 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4240 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4241 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4242 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4243 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4244 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4245 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4246 </p>
4247 !! html/parsoid
4248 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4249 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4250 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4251 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4252 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4253 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4254 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4255 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4256 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4257 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4258 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4259 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4260 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4261 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4262 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4263 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4264 !! end
4266 !! test
4267 External links: No preceding word characters allowed (bug 65278)
4268 !! wikitext
4269 NOPEhttp://example.com
4270 N0http://example.com
4271 ok:http://example.com
4272 ok-http://example.com
4273 !! html
4274 <p>NOPEhttp://example.com
4275 N0http://example.com
4276 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4277 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4278 </p>
4279 !! end
4281 !! test
4282 External image
4283 !! wikitext
4284 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4285 !! html
4286 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4287 </p>
4288 !! end
4290 !! test
4291 External image from https
4292 !! wikitext
4293 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4294 !! html
4295 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4296 </p>
4297 !! end
4299 !! test
4300 External image (when not allowed)
4301 !! options
4302 wgAllowExternalImages=0
4303 !! wikitext
4304 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4305 !! html
4306 <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>
4307 </p>
4308 !! end
4310 !! test
4311 Link to non-http image, no img tag
4312 !! wikitext
4313 Link to non-http image, no img tag: ftp://example.com/test.jpg
4314 !! html
4315 <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>
4316 </p>
4317 !! end
4319 !! test
4320 External links: terminating separator
4321 !! wikitext
4322 Terminating separator: http://example.com/thing,
4323 !! html
4324 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4325 </p>
4326 !! end
4328 !! test
4329 External links: intervening separator
4330 !! wikitext
4331 Intervening separator: http://example.com/1,2,3
4332 !! html
4333 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4334 </p>
4335 !! end
4337 !! test
4338 External links: old bug with URL in query
4339 !! wikitext
4340 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4341 !! html
4342 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4343 </p>
4344 !! end
4346 !! test
4347 External links: old URL-in-URL bug, mixed protocols
4348 !! wikitext
4349 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4350 !! html
4351 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4352 </p>
4353 !!end
4355 !! test
4356 External links: URL in text
4357 !! wikitext
4358 URL in text: [http://example.com http://example.com]
4359 !! html
4360 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4361 </p>
4362 !! end
4364 !! test
4365 External links: Clickable images
4366 !! wikitext
4367 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4368 !! html/php
4369 <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>
4370 </p>
4371 !! html/parsoid
4372 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4373 !! end
4375 !! test
4376 External links: raw ampersand
4377 !! wikitext
4378 Old &amp; use: http://x&y
4379 !! html
4380 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4381 </p>
4382 !! end
4384 !! test
4385 External links: encoded ampersand
4386 !! wikitext
4387 Old &amp; use: http://x&amp;y
4388 !! html/php
4389 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4390 </p>
4391 !! html/parsoid
4392 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4393 !! end
4395 !! test
4396 External links: encoded equals (bug 6102)
4397 !! wikitext
4398 http://example.com/?foo&#61;bar
4399 !! html/php
4400 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4401 </p>
4402 !! html/parsoid
4403 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4404 !! end
4407 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4408 ## does it number them.  As discussed in bug 53505, we can identify
4409 ## autonumbered links via CSS.
4412 !! test
4413 External links: [raw ampersand]
4414 !! wikitext
4415 Old &amp; use: [http://x&y]
4416 !! html/php
4417 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4418 </p>
4419 !! html/parsoid
4420 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4421 !! end
4423 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4424 # mode will return the [raw ampersand] wikitext
4425 !! test
4426 External links: [encoded ampersand]
4427 !! options
4428 parsoid=wt2html,wt2wt,html2html
4429 !! wikitext
4430 Old &amp; use: [http://x&amp;y]
4431 !! html/php
4432 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4433 </p>
4434 !! html/parsoid
4435 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4436 !! end
4438 !! test
4439 External links: [raw equals]
4440 !! wikitext
4441 [http://example.com/?foo=bar]
4442 !! html/php
4443 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4447 !! end
4449 # note that parsoid html is identical to [raw equals] case; so html2wt
4450 # mode will return the [raw equals] wikitext
4451 !! test
4452 External links: [encoded equals] (bug 6102)
4453 !! options
4454 parsoid=wt2html,wt2wt,html2html
4455 !! wikitext
4456 [http://example.com/?foo&#61;bar]
4457 !! html/php
4458 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4459 </p>
4460 !! html/parsoid
4461 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4462 !! end
4464 # xxx parsoid strips the IDN character, so the round-trip tests will
4465 #     obviously fail and are disabled. --cscott
4466 !! test
4467 External links: [IDN ignored character reference in hostname; strip it right off]
4468 !! options
4469 parsoid=wt2html,wt2wt,html2html
4470 !! wikitext
4471 [http://e&zwnj;xample.com/]
4472 !! html/php
4473 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4474 </p>
4475 !! html/parsoid
4476 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4477 !! end
4479 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4480 # Where an external link could easily circumvent the sanitization of the text of
4481 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4482 # test demands a higher standard. That's a bit strange.
4484 # Example:
4486 # http://e‌xample.com -> [http://example.com|http://example.com]
4487 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4489 # The first example is sanitized, but the second is not. Any security benefits
4490 # from this production are trivial to circumvent. Either remove this test and
4491 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4492 # the test accordingly.
4494 # All our love,
4495 # The Parsoid team.
4496 # xxx parsoid strips the IDN character, so the round-trip tests will
4497 #     obviously fail and are disabled. --cscott
4498 !! test
4499 External links: IDN ignored character reference in hostname; strip it right off
4500 !! options
4501 parsoid=wt2html,html2html
4502 !! wikitext
4503 http://e&zwnj;xample.com/
4504 !! html/php
4505 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4506 </p>
4507 !! html/parsoid
4508 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4509 !! end
4511 !! test
4512 External links: www.jpeg.org (bug 554)
4513 !! wikitext
4514 http://www.jpeg.org
4515 !! html
4516 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4517 </p>
4518 !! end
4520 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4521 !! test
4522 External links: URL within URL (original bug 2)
4523 !! wikitext
4524 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4525 !! html/php
4526 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4530 !! end
4532 !! test
4533 BUG 361: URL inside bracketed URL
4534 !! wikitext
4535 [http://www.example.com/foo http://www.example.com/bar]
4536 !! html
4537 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4538 </p>
4539 !! end
4541 !! test
4542 BUG 361: URL within URL, not bracketed
4543 !! wikitext
4544 http://www.example.com/foo?=http://www.example.com/bar
4545 !! html
4546 <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>
4547 </p>
4548 !! end
4550 !! test
4551 BUG 289: ">"-token in URL-tail
4552 !! wikitext
4553 http://www.example.com/<hello>
4554 !! html
4555 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4556 </p>
4557 !!end
4559 !! test
4560 BUG 289: literal ">"-token in URL-tail
4561 !! wikitext
4562 http://www.example.com/<b>html</b>
4563 !! html/php
4564 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4565 </p>
4566 !! html/parsoid
4567 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4568 !! end
4570 !! test
4571 BUG 289: ">"-token in bracketed URL
4572 !! wikitext
4573 [http://www.example.com/<hello> stuff]
4574 !! html
4575 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4576 </p>
4577 !!end
4579 !! test
4580 BUG 289: literal ">"-token in bracketed URL
4581 !! wikitext
4582 [http://www.example.com/<b>html</b> stuff]
4583 !! html
4584 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4585 </p>
4586 !!end
4588 !! test
4589 BUG 289: literal double quote at end of URL
4590 !! wikitext
4591 http://www.example.com/"hello"
4592 !! html
4593 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4594 </p>
4595 !!end
4597 !! test
4598 BUG 289: literal double quote in bracketed URL
4599 !! wikitext
4600 [http://www.example.com/"hello" stuff]
4601 !! html
4602 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4603 </p>
4604 !!end
4606 !! test
4607 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4608 !! wikitext
4609 [http://www.example.com  test]
4610 !! html
4611 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4612 </p>
4613 !! end
4615 !! test
4616 External links: link text with spaces
4617 !! wikitext
4618 [http://www.example.com a b c]
4619 [http://www.example.com ''a'' ''b'']
4620 !! html
4621 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4622 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4623 </p>
4624 !! end
4626 !! test
4627 External links: wiki links within external link (Bug 3695)
4628 !! wikitext
4629 [http://example.com [[wikilink]] embedded in ext link]
4630 !! html/php
4631 <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>
4632 </p>
4633 !! html/parsoid
4634 <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>
4635 !! end
4637 !! test
4638 BUG 787: Links with one slash after the url protocol are invalid
4639 !! wikitext
4640 http:/example.com
4642 [http:/example.com title]
4643 !! html
4644 <p>http:/example.com
4645 </p><p>[http:/example.com title]
4646 </p>
4647 !! end
4649 !! test
4650 Bracketed external links with template-generated invalid target
4651 !! wikitext
4652 [{{echo|http:/example.com}} title]
4653 !! html
4654 <p>[http:/example.com title]
4655 </p>
4656 !! end
4658 !! test
4659 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4660 !! wikitext
4661 ''[http://example.com text'']
4662 [http://example.com '''text]'''
4663 ''Something [http://example.com in italic'']
4664 ''Something [http://example.com mixed''''', even bold]'''
4665 '''''Now [http://example.com both''''']
4666 !! html
4667 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4668 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4669 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4670 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4671 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4672 </p>
4673 !! end
4676 !! test
4677 Bug 4781: %26 in URL
4678 !! wikitext
4679 http://www.example.com/?title=AT%26T
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4682 </p>
4683 !! html/parsoid
4684 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4685 !! end
4687 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
4688 # % is actually legal in HTML5. Any change in output would need testing though.
4689 !! test
4690 Bug 4781, 5267: %25 in URL
4691 !! wikitext
4692 http://www.example.com/?title=100%25_Bran
4693 !! html/php
4694 <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>
4695 </p>
4696 !! html/parsoid
4697 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4698 !! end
4700 !! test
4701 Bug 4781, 5267: %28, %29 in URL
4702 !! wikitext
4703 http://www.example.com/?title=Ben-Hur_%281959_film%29
4704 !! html/php
4705 <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>
4706 </p>
4707 !! html/parsoid
4708 <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>
4709 !! end
4712 !! test
4713 Bug 4781: %26 in autonumber URL
4714 !! wikitext
4715 [http://www.example.com/?title=AT%26T]
4716 !! html/php
4717 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4718 </p>
4719 !! html/parsoid
4720 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4721 !! end
4723 !! test
4724 Bug 4781, 5267: %26 in autonumber URL
4725 !! wikitext
4726 [http://www.example.com/?title=100%25_Bran]
4727 !! html/php
4728 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4729 </p>
4730 !! html/parsoid
4731 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4732 !! end
4734 !! test
4735 Bug 4781, 5267: %28, %29 in autonumber URL
4736 !! wikitext
4737 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4738 !! html/php
4739 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4740 </p>
4741 !! html/parsoid
4742 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4743 !! end
4746 !! test
4747 Bug 4781: %26 in bracketed URL
4748 !! wikitext
4749 [http://www.example.com/?title=AT%26T link]
4750 !! html/php
4751 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4752 </p>
4753 !! html/parsoid
4754 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4755 !! end
4757 !! test
4758 Bug 4781, 5267: %25 in bracketed URL
4759 !! wikitext
4760 [http://www.example.com/?title=100%25_Bran link]
4761 !! html
4762 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4763 </p>
4764 !! end
4766 !! test
4767 Bug 4781, 5267: %28, %29 in bracketed URL
4768 !! wikitext
4769 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4770 !! html/php
4771 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4772 </p>
4773 !! html/parsoid
4774 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4775 !! end
4777 !! test
4778 External link containing a period in the anchor. (bug 63947)
4779 !! wikitext
4780 [//foo.org/bar#baz. bang]
4782 [//foo.org/bar. bang]
4783 !! html/php
4784 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4785 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4786 </p>
4787 !! html/parsoid
4788 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4789 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4790 !! end
4792 !! test
4793 External link containing a single quote. (bug 63947)
4794 !! wikitext
4795 [//foo.org/bar'baz]
4797 [//foo.org/bar'baz bang]
4798 !! html/php
4799 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4800 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4801 </p>
4802 !! html/parsoid
4803 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4804 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4805 !! end
4808 !! test
4809 External link containing a period in the anchor. (bug 63947)
4810 !! wikitext
4811 [//foo.org/bar#baz. bang]
4813 [//foo.org/bar. bang]
4814 !! html/php
4815 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4816 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4817 </p>
4818 !! html/parsoid
4819 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4820 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4821 !! end
4823 !! test
4824 External link containing a single quote. (bug 63947)
4825 !! wikitext
4826 [//foo.org/bar'baz]
4828 [//foo.org/bar'baz bang]
4829 !! html/php
4830 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4831 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4832 </p>
4833 !! html/parsoid
4834 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4835 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4836 !! end
4839 !! test
4840 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4841 !! wikitext
4842 Some [http://example.com/ pretty ''italics'' and stuff]!
4843 !! html
4844 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4845 </p>
4846 !! end
4848 !! test
4849 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4850 !! wikitext
4851 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4852 !! html
4853 <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>
4854 </p>
4855 !! end
4857 !! test
4858 External link containing double-single-quotes with no space separating the url from text in italics
4859 !! wikitext
4860 [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]].]
4861 !! html/php
4862 <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>
4863 </p>
4864 !! html/php+tidy
4865 <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>
4866 !! html/parsoid
4867 <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>
4868 !! end
4870 !! test
4871 External link with comments in link text
4872 !! wikitext
4873 [http://www.google.com Google <!-- comment -->]
4874 !! html
4875 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4876 </p>
4877 !! end
4879 !! test
4880 URL-encoding in URL functions (single parameter)
4881 !! wikitext
4882 {{localurl:Some page|amp=&}}
4883 !! html
4884 <p>/index.php?title=Some_page&amp;amp=&amp;
4885 </p>
4886 !! end
4888 !! test
4889 URL-encoding in URL functions (multiple parameters)
4890 !! wikitext
4891 {{localurl:Some page|q=?&amp=&}}
4892 !! html
4893 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4894 </p>
4895 !! end
4897 !! test
4898 Brackets in urls
4899 !! wikitext
4900 http://example.com/index.php?foozoid%5B%5D=bar
4902 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4903 !! html/php
4904 <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>
4905 </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>
4906 </p>
4907 !! html/parsoid
4908 <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>
4910 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4911 !! end
4913 !! test
4914 IPv6 urls (bug 21261)
4915 !! options
4916 disabled
4917 !! wikitext
4918 http://[2404:130:0:1000::187:2]/index.php
4919 !! html
4920 <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>
4921 </p>
4922 !! end
4924 !! test
4925 Non-extlinks in brackets
4926 !! wikitext
4927 [foo]
4928 [foo bar]
4929 [foo ''bar'']
4930 [fool's] errand
4931 [fool's errand]
4932 [{{echo|foo}}]
4933 [{{echo|foo}} bar]
4934 [{{echo|foo}} ''bar'']
4935 [{{echo|foo}}l's] errand
4936 [{{echo|foo}}l's errand]
4937 [url={{echo|foo}}]
4938 [url=http://example.com]
4939 !! html
4940 <p>[foo]
4941 [foo bar]
4942 [foo <i>bar</i>]
4943 [fool's] errand
4944 [fool's errand]
4945 [foo]
4946 [foo bar]
4947 [foo <i>bar</i>]
4948 [fool's] errand
4949 [fool's errand]
4950 [url=foo]
4951 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4952 </p>
4953 !! end
4955 !! test
4956 Percent encoding in external links
4957 !! wikitext
4958 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4959 !! html/php
4960 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4961 </p>
4962 !! html/parsoid
4963 <p><a rel="mw:ExtLink"
4964 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4965 !! end
4967 !! test
4968 Use url link syntax for links where the content is equal the link target
4969 !! wikitext
4970 http://example.com
4971 !! html/php
4972 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4973 </p>
4974 !! html/parsoid
4975 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4976 !! end
4978 !! test
4979 Parenthesis in external links, especially URL links
4980 !! wikitext
4981 http://example.com)
4983 http://example.com/test)
4985 http://example.com/(test)
4987 http://example.com/((test)
4989 (http://example.com/(test))
4991 (http://example.com/(test)))))
4993 http://example.com/a)b
4995 [http://example.com) foo]
4996 !! html/php
4997 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4998 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4999 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5000 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5001 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5002 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5003 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5004 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5005 </p>
5006 !! html/parsoid
5007 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5008 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5009 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5010 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5011 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5012 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5013 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5014 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5015 !! end
5017 !! test
5018 Parenthesis in external links, w/ transclusion or comment
5019 !! wikitext
5020 (http://example.com/{{echo|hi}})
5022 (http://example.com<!-- hi -->)
5023 !! html/php
5024 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5025 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5026 </p>
5027 !! html/parsoid
5028 <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>
5030 <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>
5031 !! end
5033 !! test
5034 Replace invalid link targets when serializing
5035 !! options
5036 parsoid=html2wt
5037 !! html
5038 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
5039 !! wikitext
5040 [[MediaWiki:Badtitletext|Manual]]
5041 !! end
5044 ### Quotes
5047 !! test
5048 Quotes
5049 !! wikitext
5050 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5052 Normal text. '''''Bold italic text.''''' Normal text.
5053 !! html
5054 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5055 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5056 </p>
5057 !! end
5060 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5061 # parser strips. The wikitext contains just the first half of the bold
5062 # quote pair.
5063 !! test
5064 Unclosed and unmatched quotes
5065 !! wikitext
5066 '''''Bold italic text '''with bold deactivated''' in between.'''''
5068 '''''Bold italic text ''with italic deactivated'' in between.'''''
5070 '''Bold text..
5072 ..spanning two paragraphs (should not work).'''
5074 '''Bold tag left open
5076 ''Italic tag left open
5078 Normal text.
5080 <!-- Unmatching number of opening, closing tags: -->
5081 '''This year''''s election ''should'' beat '''last year''''s.
5083 ''Tom'''s car is bigger than ''Susan'''s.
5085 Plain ''italic'''s plain
5086 !! html/php
5087 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5088 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5089 </p><p><b>Bold text..</b>
5090 </p><p>..spanning two paragraphs (should not work).
5091 </p><p><b>Bold tag left open</b>
5092 </p><p><i>Italic tag left open</i>
5093 </p><p>Normal text.
5094 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5095 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5096 </p><p>Plain <i>italic'</i>s plain
5097 </p>
5098 !! html/parsoid
5099 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5100 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5101 </p><p><b>Bold text..</b>
5102 </p><p>..spanning two paragraphs (should not work).<b></b>
5103 </p><p><b>Bold tag left open</b>
5104 </p><p><i>Italic tag left open</i>
5105 </p><p>Normal text.
5106 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5107 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5108 </p><p>Plain <i>italic'</i>s plain
5109 </p>
5110 !! end
5113 ### Tables
5115 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5118 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5119 # is the bare minimum required by the spec, see:
5120 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5121 # Parsoid team replies: empty table tags are legal in HTML5
5122 !! test
5123 A table with no data.
5124 !! options
5125 parsoid=wt2html
5126 !! wikitext
5127 {||}
5128 !! html/php
5130 !! html/parsoid
5131 <table></table>
5133 !! end
5135 !! test
5136 A table with stray table end tags on start tag line (wt2html)
5137 !! options
5138 parsoid=wt2html
5139 !! wikitext
5140 {|style="color: red;"|}
5142 {|style="color: red;" |}
5143 |foo
5146 {|style="color: red;"|} id="foo"
5147 |foo
5150 {|style="color: red;" |} id="foo"
5151 |foo
5153 !! html
5154 <table style="color: red;"></table>
5156 <table style="color: red;">
5157 <tbody><tr>
5158 <td>foo</td>
5159 </tr></tbody>
5160 </table>
5162 <table style="color: red;" id="foo">
5163 <tbody><tr>
5164 <td>foo</td>
5165 </tr></tbody>
5166 </table>
5168 <table style="color: red;" id="foo">
5169 <tbody><tr>
5170 <td>foo</td>
5171 </tr></tbody>
5172 </table>
5174 !! end
5176 !! test
5177 A table with no data (take 2)
5178 !! wikitext
5181 !! html/parsoid
5182 <table></table>
5183 !! end
5185 # A table with nothing but a caption is invalid XHTML, we might want to render
5186 # this as <p>caption</p>
5187 # Parsoid team replies: table with only a caption is legal in HTML5
5188 !! test
5189 A table with nothing but a caption
5190 !! wikitext
5192 |+ caption
5194 !! html/php
5195 <table>
5196 <caption> caption
5197 </caption><tr><td></td></tr></table>
5199 !! html/parsoid
5200 <table><caption> caption</caption></table>
5201 !! end
5203 !! test
5204 A table with caption with default-spaced attributes and a table row
5205 !! wikitext
5207 |+ style="color: red;" | caption1
5209 | foo
5211 !! html
5212 <table>
5213 <caption style="color: red;"> caption1
5214 </caption>
5215 <tr>
5216 <td> foo
5217 </td></tr></table>
5219 !! end
5221 !! test
5222 A table with captions with non-default spaced attributes and a table row
5223 !! wikitext
5225 |+style="color: red;"|caption2
5226 |+ style="color: red;"| caption3
5228 | foo
5230 !! html
5231 <table>
5232 <caption style="color: red;">caption2
5233 </caption>
5234 <caption style="color: red;"> caption3
5235 </caption>
5236 <tr>
5237 <td> foo
5238 </td></tr></table>
5240 !! end
5242 !! test
5243 Table td-cell syntax variations
5244 !! wikitext
5246 | foo bar foo | baz
5247 | foo bar foo || baz
5248 | style='color:red;' | baz
5249 | style='color:red;' || baz
5251 !! html
5252 <table>
5253 <tr>
5254 <td> baz
5255 </td>
5256 <td> foo bar foo </td>
5257 <td> baz
5258 </td>
5259 <td style="color:red;"> baz
5260 </td>
5261 <td> style='color:red;' </td>
5262 <td> baz
5263 </td></tr></table>
5265 !! end
5267 !! test
5268 Simple table
5269 !! wikitext
5271 | 1 || 2
5273 | 3 || 4
5275 !! html
5276 <table>
5277 <tr>
5278 <td> 1 </td>
5279 <td> 2
5280 </td></tr>
5281 <tr>
5282 <td> 3 </td>
5283 <td> 4
5284 </td></tr></table>
5286 !! end
5288 !! test
5289 Simple table but with multiple dashes for row wikitext
5290 !! wikitext
5292 | foo
5293 |-----
5294 | bar
5296 !! html
5297 <table>
5298 <tr>
5299 <td> foo
5300 </td></tr>
5301 <tr>
5302 <td> bar
5303 </td></tr></table>
5305 !! end
5306 !! test
5307 Multiplication table
5308 !! wikitext
5309 {| border="1" cellpadding="2"
5310 |+Multiplication table
5312 ! &times; !! 1 !! 2 !! 3
5314 ! 1
5315 | 1 || 2 || 3
5317 ! 2
5318 | 2 || 4 || 6
5320 ! 3
5321 | 3 || 6 || 9
5323 ! 4
5324 | 4 || 8 || 12
5326 ! 5
5327 | 5 || 10 || 15
5329 !! html
5330 <table border="1" cellpadding="2">
5331 <caption>Multiplication table
5332 </caption>
5333 <tr>
5334 <th> &#215; </th>
5335 <th> 1 </th>
5336 <th> 2 </th>
5337 <th> 3
5338 </th></tr>
5339 <tr>
5340 <th> 1
5341 </th>
5342 <td> 1 </td>
5343 <td> 2 </td>
5344 <td> 3
5345 </td></tr>
5346 <tr>
5347 <th> 2
5348 </th>
5349 <td> 2 </td>
5350 <td> 4 </td>
5351 <td> 6
5352 </td></tr>
5353 <tr>
5354 <th> 3
5355 </th>
5356 <td> 3 </td>
5357 <td> 6 </td>
5358 <td> 9
5359 </td></tr>
5360 <tr>
5361 <th> 4
5362 </th>
5363 <td> 4 </td>
5364 <td> 8 </td>
5365 <td> 12
5366 </td></tr>
5367 <tr>
5368 <th> 5
5369 </th>
5370 <td> 5 </td>
5371 <td> 10 </td>
5372 <td> 15
5373 </td></tr></table>
5375 !! end
5377 !! test
5378 Accept "||" in table headings
5379 !! wikitext
5381 !h1 || h2
5383 !! html
5384 <table>
5385 <tr>
5386 <th>h1 </th>
5387 <th> h2
5388 </th></tr></table>
5390 !! end
5392 !! test
5393 Accept "!!" in table data
5394 !! wikitext
5396 | Foo!! ||
5398 !! html
5399 <table>
5400 <tr>
5401 <td> Foo!! </td>
5402 <td>
5403 </td></tr></table>
5405 !! html/parsoid
5406 <table>
5407 <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>
5408 </tbody></table>
5409 !! end
5411 !! test
5412 Accept "||" in indented table headings
5413 !! wikitext
5415 !h1 || h2
5417 !! html
5418 <dl><dd><table>
5419 <tr>
5420 <th>h1 </th>
5421 <th> h2
5422 </th></tr></table></dd></dl>
5424 !! end
5426 !! test
5427 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5428 !! wikitext
5430 !| h1
5431 || a
5433 !! html
5434 <table>
5435 <tr>
5436 <th> h1
5437 </th>
5438 <td> a
5439 </td></tr></table>
5441 !! end
5443 !!test
5444 Accept "| !" at start of line in tables (ignore !-attribute)
5445 !! wikitext
5448 | !style="color:red" | bar
5450 !! html
5451 <table>
5453 <tr>
5454 <td> bar
5455 </td></tr></table>
5457 !!end
5459 !!test
5460 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 +/- 
5461 !! wikitext
5464 |style='color:red;'|+1
5465 |style='color:blue;'|-1
5467 | 1 || 2 || 3
5468 | 1 ||+2 ||-3
5470 | +1
5471 | -1
5473 !! html
5474 <table>
5476 <tr>
5477 <td style="color:red;">+1
5478 </td>
5479 <td style="color:blue;">-1
5480 </td></tr>
5481 <tr>
5482 <td> 1 </td>
5483 <td> 2 </td>
5484 <td> 3
5485 </td>
5486 <td> 1 </td>
5487 <td>+2 </td>
5488 <td>-3
5489 </td></tr>
5490 <tr>
5491 <td> +1
5492 </td>
5493 <td> -1
5494 </td></tr></table>
5496 !!end
5498 !! test
5499 Table rowspan
5500 !! wikitext
5501 {| border=1
5502 | Cell 1, row 1
5503 |rowspan=2| Cell 2, row 1 (and 2)
5504 | Cell 3, row 1
5506 | Cell 1, row 2
5507 | Cell 3, row 2
5509 !! html
5510 <table border="1">
5511 <tr>
5512 <td> Cell 1, row 1
5513 </td>
5514 <td rowspan="2"> Cell 2, row 1 (and 2)
5515 </td>
5516 <td> Cell 3, row 1
5517 </td></tr>
5518 <tr>
5519 <td> Cell 1, row 2
5520 </td>
5521 <td> Cell 3, row 2
5522 </td></tr></table>
5524 !! end
5526 !! test
5527 Nested table
5528 !! wikitext
5529 {| border=1
5530 | &alpha;
5532 {| bgcolor=#ABCDEF border=2
5533 |nested
5535 |table
5537 |the original table again
5539 !! html
5540 <table border="1">
5541 <tr>
5542 <td> &#945;
5543 </td>
5544 <td>
5545 <table bgcolor="#ABCDEF" border="2">
5546 <tr>
5547 <td>nested
5548 </td></tr>
5549 <tr>
5550 <td>table
5551 </td></tr></table>
5552 </td>
5553 <td>the original table again
5554 </td></tr></table>
5556 !! end
5558 !! test
5559 Invalid attributes in table cell (bug 1830)
5560 !! wikitext
5562 |Cell:|broken
5564 !! html
5565 <table>
5566 <tr>
5567 <td>broken
5568 </td></tr></table>
5570 !! end
5572 # The "|}" to close the table is missing from the input, so parsoid's
5573 # *2wt modes will fail.
5574 !! test
5575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5576 !! options
5577 parsoid=wt2html,html2html
5578 !! wikitext
5580 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5581 !! html/php
5582 <table>
5583 <tr>
5584 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5585 <td>]" onmouseover="alert(document.cookie)"&gt;test
5586 </td>
5587 </tr>
5588 </table>
5590 !! html/parsoid
5591 <table><tbody>
5592 <tr>
5593 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5594 !! end
5596 # FIXME: The php output is broken.
5597 !! test
5598 ! and || in td attributes should not be parsed as <th>/<td>
5599 !! wikitext
5601 | style="color: red !important;" data-contrived="put this here ||" | foo
5603 !! html/php
5604 <table>
5605 <tr>
5606 <td> style="color: red !important;" data-contrived="put this here </td>
5607 <td> foo
5608 </td></tr></table>
5610 !! html/parsoid
5611 <table>
5612 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
5613 </tbody></table>
5614 !! end
5616 !! test
5617 Indented table markup mixed with indented pre content (proposed in bug 6200)
5618 !! wikitext
5619  <table>
5620  <tr>
5621  <td>
5622  Text that should be rendered preformatted
5623  </td>
5624  </tr>
5625  </table>
5626 !! html
5627  <table>
5628  <tr>
5629  <td>
5630 <pre>Text that should be rendered preformatted
5631 </pre>
5632  </td>
5633  </tr>
5634  </table>
5636 !! end
5638 !! test
5639 Template-generated table cell attributes and cell content
5640 !! wikitext
5642 |{{table_attribs}}
5643 | {{table_attribs}}
5644 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5645 |align=center {{table_attribs}}
5646 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5648 !! html
5649 <table>
5650 <tr>
5651 <td style="color: red"> Foo
5652 </td>
5653 <td style="color: red"> Foo
5654 </td>
5655 <td style="color: red"> Foo
5656 </td>
5657 <td align="center" style="color: red"> Foo
5658 </td>
5659 <td align="center" style="color: red"> Foo
5660 </td></tr></table>
5662 !! end
5664 !! test
5665 Template-generated table cell attributes and cell content (2)
5666 !! wikitext
5668 |align=center {{table_cells}}
5670 !! html
5671 <table>
5672 <tr>
5673 <td align="center" style="color: red"> Foo </td>
5674 <td> Bar </td>
5675 <td> Baz
5676 </td></tr></table>
5678 !! end
5680 !! test
5681 Table with row followed by newlines and table heading
5682 !! wikitext
5686 ! foo
5688 !! html
5689 <table>
5692 <tr>
5693 <th> foo
5694 </th></tr></table>
5696 !! end
5698 !! test
5699 Table with empty line following the start tag
5700 !! wikitext
5704 | foo
5706 !! html
5707 <table>
5710 <tr>
5711 <td> foo
5712 </td></tr></table>
5714 !! end
5716 # FIXME: Preserve the attribute properly (with an empty string as value) in
5717 # the PHP parser. Parsoid implements the behavior below.
5718 !! test
5719 Table attributes with empty value
5720 !! wikitext
5722 | style=| hello
5724 !! html/parsoid
5725 <table>
5726 <tbody>
5727 <tr>
5728 <td style=""> hello
5729 </td></tr></tbody></table>
5731 !! end
5733 !! test
5734 Wikitext table with a lot of comments
5735 !! wikitext
5737 <!-- c0 -->
5738 | foo
5739 <!-- c1 -->
5740 |- <!-- c2 -->
5741 <!-- c3 -->
5742 |<!-- c4 -->
5743 <!-- c5 -->
5745 !! html
5746 <table>
5747 <tr>
5748 <td> foo
5749 </td></tr>
5750 <tr>
5751 <td>
5752 </td></tr></table>
5754 !! end
5756 !! test
5757 Wikitext table with double-line table cell
5758 !! wikitext
5763 !! html
5764 <table>
5765 <tr>
5766 <td>a
5767 <p>b
5768 </p>
5769 </td></tr></table>
5771 !! end
5773 !! test
5774 Table cell with a single comment
5775 !! wikitext
5777 | <!-- c1 -->
5778 | a
5780 !! html
5781 <table>
5782 <tr>
5783 <td>
5784 </td>
5785 <td> a
5786 </td></tr></table>
5788 !! end
5790 !! test
5791 Table-cell after a comment-only-empty-line
5792 !! wikitext
5795 <!--c1-->
5796 <!--c2-->| b
5798 !! html
5799 <table>
5800 <tr>
5801 <td>a
5802 </td>
5803 <td> b
5804 </td></tr></table>
5806 !! html/parsoid
5807 <table>
5808 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5809 <!--c1-->
5810 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5811 </tbody></table>
5813 !! end
5815 !! test
5816 Build table with {{!}}
5817 !! wikitext
5818 {{{!}} class="wikitable"
5819 ! header
5820 ! second header
5821 {{!}}- style="color:red;"
5822 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5823 {{!}}}
5824 !! html
5825 <table class="wikitable">
5826 <tr>
5827 <th> header
5828 </th>
5829 <th> second header
5830 </th></tr>
5831 <tr style="color:red;">
5832 <td> data </td>
5833 <td style="color:red;"> second data
5834 </td></tr></table>
5836 !! end
5838 !! test
5839 Build table with pipe as data
5840 !! wikitext
5841 {| class="wikitable"
5842 ! header
5843 ! second header
5844 |- style="color:red;"
5845 | data || style="color:red;" | second data
5847 | style="color:red;" | data with | || style="color:red;" | second data with |
5849 || data with | ||| second data with |
5851 !! html
5852 <table class="wikitable">
5853 <tr>
5854 <th> header
5855 </th>
5856 <th> second header
5857 </th></tr>
5858 <tr style="color:red;">
5859 <td> data </td>
5860 <td style="color:red;"> second data
5861 </td></tr>
5862 <tr>
5863 <td style="color:red;"> data with | </td>
5864 <td style="color:red;"> second data with |
5865 </td></tr>
5866 <tr>
5867 <td> data with | </td>
5868 <td> second data with |
5869 </td></tr></table>
5871 !! end
5873 !! test
5874 Build table with wikilink
5875 !! wikitext
5876 {| class="wikitable"
5877 ! header || second header
5878 |- style="color:red;"
5879 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5881 | data || second data [[Main Page|link|text with pipe]]
5883 !! html
5884 <table class="wikitable">
5885 <tr>
5886 <th> header </th>
5887 <th> second header
5888 </th></tr>
5889 <tr style="color:red;">
5890 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5891 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5892 </td></tr>
5893 <tr>
5894 <td> data </td>
5895 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5896 </td></tr></table>
5898 !! end
5900 # The expected HTML structure in this test is debatable. The PHP parser does
5901 # not parse this kind of table at all. The main focus for Parsoid is on
5902 # round-tripping, so this output is ok for now. TODO: revisit!
5903 !! test
5904 Wikitext table with html-syntax row
5905 !! wikitext
5908 <td>foo</td>
5910 !! html/parsoid
5911 <table>
5912 <tbody>
5913 <tr>
5914 <td>foo</td></tr></tbody></table>
5915 !! end
5917 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5918 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5919 ## PHP parser, which tidy then compounds by fostering the content
5920 ## entirely out of the table.  Parsoid recognizes the table context
5921 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
5922 ## depends on PHP's treatment of broken table markup!
5923 !! test
5924 Implicit <td> after a |-
5925 !! options
5926 parsoid=wt2html,html2html
5927 !! wikitext
5932 !! html/php
5933 <table>
5936 </table>
5938 !! html/php+tidy
5939 <p>a</p>
5940 !! html/parsoid
5941 <table>
5942 <tr><td>a</td></tr>
5943 </table>
5944 !! end
5946 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5947 !! test
5948 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5949 !! options
5950 parsoid=wt2html,html2html
5951 !! wikitext
5959 !! html/php
5960 <table>
5962 <tr>
5963 <td>
5964 <pre>a
5965 </pre>
5966 </td></tr>
5968 </table>
5970 !! html/php+tidy
5971 <p>b</p>
5972 <table>
5973 <tr>
5974 <td>
5975 <pre>
5977 </pre></td>
5978 </tr>
5979 </table>
5980 !! html/parsoid
5981 <table>
5982 <tbody>
5983 <tr><td><pre>a</pre></td></tr>
5984 <tr><td> b</td></tr>
5985 </tbody>
5986 </table>
5987 !! end
5989 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5990 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5991 !! test
5992 Lists should be recognized in an implicit <td> context
5993 !! options
5994 parsoid=wt2html,html2html
5995 !! wikitext
6000 !! html/php
6001 <table>
6003 <ul><li>a</li></ul>
6004 </table>
6006 !! html/php+tidy
6007 <ul>
6008 <li>a</li>
6009 </ul>
6010 !! html/parsoid
6011 <table>
6012 <tr>
6013 <td><ul>
6014 <li>a</li>
6015 </ul></td>
6016 </tr>
6017 </table>
6018 !! end
6020 !! test
6021 Parsoid: Round-trip tables directly followed by content (bug 51219)
6022 !! options
6023 parsoid=wt2html,wt2wt
6024 !! wikitext
6026 |foo
6027 |} bar
6030 |baz
6031 |}<b>quux</b>
6032 !! html+tidy
6033 <table>
6034 <tr>
6035 <td>foo</td>
6036 </tr>
6037 </table>
6038 <p>bar</p>
6039 <table>
6040 <tr>
6041 <td>baz</td>
6042 </tr>
6043 </table>
6044 <p><b>quux</b></p>
6045 !! end
6047 !! test
6048 Parsoid: Default to a newline after tables in new content (bug 51219)
6049 !! options
6050 parsoid=html2wt
6051 !! html
6052 <table><tbody>
6053 <tr><td>foo</td></tr></tbody></table> bar
6054 <table><tbody>
6055 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6056 !! wikitext
6058 |foo
6060 <nowiki> </nowiki>bar
6062 |baz
6064 '''quux'''
6065 !! end
6067 !! test
6068 Parsoid: newline inducing block nodes don't suppress <nowiki>
6069 !! options
6070 parsoid=html2wt
6071 !! html
6072  a<h1>foo</h1>
6073 !! wikitext
6074 <nowiki> </nowiki>a
6076 = foo =
6077 !! end
6079 !! test
6080 Parsoid: Row-syntax table headings followed by comment & table cells
6081 !! options
6082 parsoid=wt2html,wt2wt
6083 !! wikitext
6085 ! foo || bar
6086 <!-- foo -->  || baz || quux
6088 !! html/php
6089 <table>
6090 <tr>
6091 <th> foo </th>
6092 <th> bar
6093 </th>
6094 <td> baz </td>
6095 <td> quux
6096 </td></tr></table>
6098 !! html/parsoid
6099 <table>
6100 <tbody><tr><th> foo </th><th> bar
6101 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
6102 </tbody></table>
6103 !! end
6106 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6107 # preserves it.
6108 !!test
6109 Parsoid: Recover better from broken table attributes
6110 !!options
6111 parsoid=wt2html
6112 !!wikitext
6113 {| class="foo
6114 | class="bar" |
6117 !!html/php+tidy
6118 <table>
6119 <tr>
6120 <td class="bar">
6121 <p>foo</p>
6122 </td>
6123 </tr>
6124 </table>
6125 !!html/parsoid
6126 <table class="foo">
6127 <tr>
6128 <td class="bar">
6129 <p>foo</p></td></tr>
6130 </tbody></table>
6131 !!end
6133 !! test
6134 Strip unsupported table tags
6135 !! options
6136 parsoid=html2wt
6137 !! html
6138 <table>
6139 <thead>
6140 <tr>
6141 <th>Month</th>
6142 <th>Savings</th>
6143 </tr>
6144 </thead>
6145 <tbody>
6146 <tr>
6147 <td>January</td>
6148 <td>$100</td>
6149 </tr>
6150 <tr>
6151 <td>February</td>
6152 <td>$80</td>
6153 </tr>
6154 </tbody>
6155 <tfoot>
6156 <tr>
6157 <td>Sum</td>
6158 <td>$180</td>
6159 </tr>
6160 </tfoot>
6161 </table>
6162 !! wikitext
6165 !Month
6166 !Savings
6168 |January
6169 |$100
6172 |February
6173 |$80
6175 |Sum
6176 |$180
6179 !! end
6182 ### Internal links
6184 !! test
6185 Plain link, capitalized
6186 !! wikitext
6187 [[Main Page]]
6188 !! html
6189 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6190 </p>
6191 !! end
6193 !! test
6194 Plain link, uncapitalized
6195 !! wikitext
6196 [[main Page]]
6197 !! html
6198 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6199 </p>
6200 !! end
6202 !! test
6203 Piped link
6204 !! wikitext
6205 [[Main Page|The Main Page]]
6206 !! html
6207 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6208 </p>
6209 !! end
6211 !! test
6212 Piped link with comment in link text
6213 !! wikitext
6214 [[Main Page|The Main<!--front--> Page]]
6215 !! html
6216 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6217 </p>
6218 !! end
6220 !! test
6221 Piped link with multiple pipe characters in link text
6222 !! wikitext
6223 [[Main Page||The|Main|Page|]]
6224 !! html/php
6225 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6226 </p>
6227 !! html/parsoid
6228 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6229 !! end
6231 !! test
6232 Broken link
6233 !! wikitext
6234 [[Zigzagzogzagzig]]
6235 !! html
6236 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6237 </p>
6238 !! end
6240 !! test
6241 Broken link with fragment
6242 !! wikitext
6243 [[Zigzagzogzagzig#zug]]
6244 !! html
6245 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6246 </p>
6247 !! end
6249 !! test
6250 Special page link with fragment
6251 !! wikitext
6252 [[Special:Version#anchor]]
6253 !! html
6254 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6255 </p>
6256 !! end
6258 !! test
6259 Nonexistent special page link with fragment
6260 !! wikitext
6261 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6262 !! html
6263 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6264 </p>
6265 !! end
6267 !! test
6268 Link with prefix
6269 !! wikitext
6270 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6271 !! html
6272 <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>
6273 </p>
6274 !! end
6276 !! test
6277 Link with suffix
6278 !! wikitext
6279 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6280 !! html
6281 <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>!!!
6282 </p>
6283 !! end
6285 !! article
6286 prefixed article
6287 !! text
6288 Some text
6289 !! endarticle
6291 !! test
6292 Bug 43661: Piped links with identical prefixes
6293 !! wikitext
6294 [[prefixed article|prefixed articles with spaces]]
6296 [[prefixed article|prefixed articlesaoeu]]
6298 [[Main Page|Main Page test]]
6299 !! html
6300 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6301 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6302 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6303 </p>
6304 !! end
6307 !! test
6308 Link with HTML entity in suffix / tail
6309 !! wikitext
6310 [[Main Page]]&quot;, [[Main Page]]&#97;
6311 !! html/php
6312 <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;
6313 </p>
6314 !! html/parsoid
6315 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
6316 !! end
6318 !! test
6319 Link with 3 brackets
6320 !! wikitext
6321 [[[Main Page]]]
6322 !! html
6323 <p>[[[Main Page]]]
6324 </p>
6325 !! end
6327 !! test
6328 Link with 4 brackets
6329 !! wikitext
6330 [[[[Main Page]]]]
6331 !! html
6332 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6333 </p>
6334 !! end
6336 !! test
6337 Piped link with 3 brackets
6338 !! wikitext
6339 [[[main page|the main page]]]
6340 !! html
6341 <p>[[[main page|the main page]]]
6342 </p>
6343 !! end
6345 !! test
6346 Piped link with extlink-like text
6347 !! wikitext
6348 [[Main Page|[bar]]]
6349 [[Main Page|This is a [bar]]]
6350 !! html/php
6351 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6352 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6353 </p>
6354 !! html/parsoid
6355 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6356 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6357 !! end
6359 !! test
6360 Link with multiple pipes
6361 !! wikitext
6362 [[Main Page|The|Main|Page]]
6363 !! html
6364 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6365 </p>
6366 !! end
6368 # Note that parsoid does not munge anchor text; all non-space
6369 # characters are valid in HTML5 ids.
6370 !! test
6371 Anchor containing a #. (bug 63430)
6372 !! wikitext
6373 [[Main Page#And#Link]]
6374 !! html/php
6375 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6376 </p>
6377 !! html/parsoid
6378 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6379 !! end
6381 !! test
6382 Link to namespaces
6383 !! wikitext
6384 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6385 !! html
6386 <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>
6387 </p>
6388 !! end
6390 !! test
6391 Link with space in namespace
6392 !! wikitext
6393 [[User talk:Foo bar]]
6394 !! html
6395 <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>
6396 </p>
6397 !! end
6399 !! article
6400 MemoryAlpha:AlphaTest
6401 !! text
6402 This is an article in the MemoryAlpha namespace
6403 (which shadows the memoryalpha interwiki link).
6404 !! endarticle
6406 !! test
6407 Namespace takes precedence over interwiki link (bug 51680)
6408 !! wikitext
6409 [[MemoryAlpha:AlphaTest]]
6410 !! html
6411 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6412 </p>
6413 !! end
6415 # The previous test doesn't work correctly in html2*, due to not recognizing the
6416 # link as an internal one. This one checks for the correct behavior.
6417 !! test
6418 Link to namespace preferred over interwiki with correct rel attribute
6419 !! options
6420 parsoid=html2wt,html2html
6421 !! html
6422 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6423 !! wikitext
6424 [[MemoryAlpha:AlphaTest]]
6425 !! end
6427 !! test
6428 Piped link to namespace
6429 !! wikitext
6430 [[Meta:Disclaimers|The disclaimers]]
6431 !! html
6432 <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>
6433 </p>
6434 !! end
6436 !! test
6437 Link containing }
6438 !! wikitext
6439 [[Usually caused by a typo (oops}]]
6440 !! html
6441 <p>[[Usually caused by a typo (oops}]]
6442 </p>
6443 !! end
6445 !! article
6446 7% Solution
6447 !! text
6448 Just a test of an article title containing a percent.
6449 !! endarticle
6451 !! test
6452 Link containing % (not as a hex sequence)
6453 !! wikitext
6454 [[7% Solution]]
6455 !! html/php
6456 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6457 </p>
6458 !! html/parsoid
6459 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6460 !! end
6462 # note that the parsoid HTML is identical to the previous test output,
6463 # so the previous test ensures that the html2wt mode will generate the
6464 # "not as a hex sequence" wikitext.
6465 !! test
6466 Link containing % as a single hex sequence interpreted to char
6467 !! options
6468 parsoid=wt2wt,wt2html,html2html
6469 !! wikitext
6470 [[7%25 Solution]]
6471 !! html/php
6472 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6473 </p>
6474 !! html/parsoid
6475 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6476 !!end
6478 !! test
6479 Link containing % as a double hex sequence interpreted to hex sequence
6480 !! wikitext
6481 [[7%2525 Solution]]
6482 !! html
6483 <p>[[7%2525 Solution]]
6484 </p>
6485 !!end
6487 # note that parsoid does not munge anchor text; all non-space
6488 # characters are valid in HTML5 anchors.
6489 !! test
6490 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6491 Example for such a section: == < ==
6492 !! wikitext
6493 [[%23%3c]][[%23%3e]]
6494 !! html/php
6495 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6496 </p>
6497 !! html/parsoid
6498 <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>
6499 !! end
6501 !! test
6502 Link containing "<#" and ">#" as a hex sequences
6503 !! wikitext
6504 [[%3c%23]][[%3e%23]]
6505 !! html
6506 <p>[[%3c%23]][[%3e%23]]
6507 </p>
6508 !! end
6510 !! test
6511 Link containing an equals sign
6512 !! wikitext
6513 [[Special:BookSources/isbn=4-00-026157-6]]
6514 !! html/php
6515 <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>
6516 </p>
6517 !! html/parsoid
6518 <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>
6519 !! end
6521 !! article
6522 Foo~bar
6523 !! text
6524 Just a test of an article title containing a tilde.
6525 !! endarticle
6527 # note that links containing signatures, like [[Foo~~~~]], are
6528 # massaged by the pre-save transform (PST) and so the tildes are never
6529 # seen by the parser.
6530 !! test
6531 Link containing a tilde
6532 !! wikitext
6533 [[Foo~bar]]
6534 !! html/php
6535 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6536 </p>
6537 !! html/parsoid
6538 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6539 !! end
6541 !! test
6542 Link containing double-single-quotes '' (bug 4598)
6543 !! wikitext
6544 [[Lista d''e paise d''o munno]]
6545 !! html/php
6546 <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>
6547 </p>
6548 !! html/parsoid
6549 <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>
6550 !! end
6552 !! test
6553 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6554 !! wikitext
6555 Some [[Link|pretty ''italics'' and stuff]]!
6556 !! html/php
6557 <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>!
6558 </p>
6559 !! html/parsoid
6560 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6561 !! end
6563 !! test
6564 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6565 !! wikitext
6566 ''Some [[Link|pretty ''italics'' and stuff]]!''
6567 !! html
6568 <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>
6569 </p>
6570 !! end
6572 !! test
6573 Link with double quotes in title part (literal) and alternate part (interpreted)
6574 !! wikitext
6575 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6577 [[''Pentecoste'']]
6579 [[''Pentecoste''|Pentecoste]]
6581 [[''Pentecoste''|''Pentecoste'']]
6582 !! html/php
6583 <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>
6584 </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>
6585 </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>
6586 </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>
6587 </p>
6588 !! html/parsoid
6589 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
6590 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6591 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6592 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6593 !! end
6595 !! test
6596 Broken image links with HTML captions (bug 39700)
6597 !! wikitext
6598 [[File:Nonexistent|<script></script>]]
6599 [[File:Nonexistent|100x100px|<script></script>]]
6600 [[File:Nonexistent|&lt;]]
6601 [[File:Nonexistent|a<i>b</i>c]]
6602 !! html/php
6603 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6604 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6605 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6606 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6607 </p>
6608 !! html/parsoid
6609 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6610 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
6611 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6612 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6613 !! end
6615 !! test
6616 Plain link to URL
6617 !! wikitext
6618 [[http://www.example.com]]
6619 !! html/php
6620 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6621 </p>
6622 !! html/parsoid
6623 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6624 !! end
6626 !! test
6627 Plain link to URL with link text
6628 !! wikitext
6629 [[http://www.example.com Link text]]
6630 !! html
6631 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6632 </p>
6633 !! end
6635 !! test
6636 Plain link to protocol-relative URL
6637 !! wikitext
6638 [[//www.example.com]]
6639 !! html/php
6640 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6641 </p>
6642 !! html/parsoid
6643 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6644 !! end
6646 !! test
6647 Plain link to protocol-relative URL with link text
6648 !! wikitext
6649 [[//www.example.com Link text]]
6650 !! html
6651 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6652 </p>
6653 !! end
6655 !! test
6656 Plain link to page with question mark in title
6657 !! wikitext
6658 [[A?b]]
6660 [[A?b|Baz]]
6661 !! html
6662 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6663 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6664 </p>
6665 !! end
6668 # I'm fairly sure the expected result here is wrong.
6669 # We want these to be URL links, not pseudo-pages with URLs for titles....
6670 # However the current output is also pretty screwy.
6672 # ----
6673 # I'm changing it to match the current output--it arguably makes more
6674 # sense in the light of the test above. Old expected result was:
6675 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6676 #</p>
6677 # But I think this test is bordering on "garbage in, garbage out" anyway.
6678 # -- wtm
6679 !! test
6680 Piped link to URL
6681 !! wikitext
6682 Piped link to URL: [[http://www.example.com|an example URL]]
6683 !! html/php
6684 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6685 </p>
6686 !! html/parsoid
6687 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6688 !! end
6690 !! test
6691 BUG 2: [[page|http://url/]] should link to page, not http://url/
6692 !! wikitext
6693 [[Main Page|http://url/]]
6694 !! html/php
6695 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6696 </p>
6697 !! html/parsoid
6698 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6699 !! end
6701 # Parsoid does not mark self-links, by design.
6702 !! test
6703 BUG 337: Escaped self-links should be bold
6704 !! options
6705 title=[[Bug462]]
6706 !! wikitext
6707 [[Bu&#103;462]] [[Bug462]]
6708 !! html/php
6709 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6710 </p>
6711 !! html/php+tidy
6712 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6713 !! html/parsoid
6714 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6715 !! end
6717 !! test
6718 Self-link to section should not be bold
6719 !! options
6720 title=[[Main Page]]
6721 !! wikitext
6722 [[Main Page#section]]
6723 !! html
6724 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6725 </p>
6726 !! end
6728 !! article
6730 !! text
6731 This is 00.
6732 !! endarticle
6734 !!test
6735 Self-link to numeric title
6736 !!options
6737 title=[[0]]
6738 !! wikitext
6739 [[0]]
6740 !! html
6741 <p><strong class="selflink">0</strong>
6742 </p>
6743 !!end
6745 !!test
6746 Link to numeric-equivalent title
6747 !!options
6748 title=[[0]]
6749 !! wikitext
6750 [[00]]
6751 !! html
6752 <p><a href="/wiki/00" title="00">00</a>
6753 </p>
6754 !!end
6756 !! test
6757 <nowiki> inside a link
6758 !! wikitext
6759 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6760 !! html
6761 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6762 </p>
6763 !! end
6765 !! test
6766 Non-breaking spaces in title
6767 !! wikitext
6768 [[&nbsp; Main &nbsp; Page &nbsp;]]
6769 !! html
6770 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6771 </p>
6772 !!end
6774 !! test
6775 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6776 !! options
6777 language=ca
6778 !! wikitext
6779 '''[[Main Page]]'''
6780 !! html
6781 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6782 </p>
6783 !! end
6785 !! test
6786 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6787 !! options
6788 language=ca
6789 !! wikitext
6790 ''[[Main Page]]''
6791 !! html
6792 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6793 </p>
6794 !! end
6796 !! test
6797 Internal link with en linktrail: no apostrophes (bug 27473)
6798 !! options
6799 language=en
6800 !! wikitext
6801 [[Something]]'nice
6802 !! html
6803 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6804 </p>
6805 !! end
6807 !! test
6808 Internal link with ca linktrail with apostrophes (bug 27473)
6809 !! options
6810 language=ca
6811 !! wikitext
6812 [[Something]]'nice
6813 !! html
6814 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6815 </p>
6816 !! end
6818 !! test
6819 Internal link with kaa linktrail with apostrophes (bug 27473)
6820 !! options
6821 language=kaa
6822 !! wikitext
6823 [[Something]]'nice
6824 !! html
6825 <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>
6826 </p>
6827 !! end
6829 !! test
6830 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6831 !! wikitext
6832 [[User:Foo/Test/63636:Bar|Test]]
6833 !! html/php
6834 <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>
6835 </p>
6836 !! html/parsoid
6837 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6838 !! end
6840 !! test
6841 Purely hash wikilink
6842 !! options
6843 title=[[User:test/123]]
6844 !! wikitext
6845 [[#a|b]]
6846 !! html/php
6847 <p><a href="#a">b</a>
6848 </p>
6849 !! html/parsoid
6850 <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>
6851 !! end
6853 !! test
6854 1. Interaction of linktrail and template encapsulation
6855 !! options
6856 parsoid
6857 !! wikitext
6858 {{echo|[[Foo]]}}l
6859 !! html
6860 <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>
6861 !! end
6863 !! test
6864 2. Interaction of linktrail and template encapsulation
6865 !! options
6866 parsoid
6867 !! wikitext
6868 {{echo|Some [[Fool]]}}s
6869 !! html
6870 <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>
6871 !! end
6873 !! test
6874 3. Interaction of linktrail and template encapsulation
6875 !! options
6876 parsoid
6877 !! wikitext
6878 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6879 !! html
6880 <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>
6881 !! end
6883 !! article
6884 Söfnuður
6885 !! text
6886 Test.
6887 !! endarticle
6889 !! test
6890 Internal link with is link prefix
6891 !! options
6892 language=is
6893 !! wikitext
6894 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6895 !! html
6896 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6897 </p>
6898 !! end
6900 !! article
6901 Mótmælendatrú
6902 !! text
6903 Test.
6904 !! endarticle
6906 !! test
6907 Internal link with is link trail and link prefix
6908 !! options
6909 language=is
6910 !! wikitext
6911 [[mótmælendatrú|xxx]]ar
6912 [[mótmælendatrú]]ar
6913 mótmælenda[[söfnuður]]
6914 mótmælenda[[söfnuður|söfnuðir]]
6915 mótmælenda[[söfnuður|söfnuðir]]xxx
6916 !! html
6917 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6918 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6919 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6920 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6921 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6922 </p>
6923 !! end
6925 !! test
6926 Parsoid link trail escaping
6927 !! options
6928 parsoid=html2wt,html2html
6929 !! html
6930 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6931 !! wikitext
6932 [[apple]]<nowiki/>s
6933 !! end
6935 !! test
6936 Parsoid link prefix escaping
6937 !! options
6938 language=is
6939 parsoid=html2wt,html2html
6940 !! html
6941 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6942 !! wikitext
6943 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6944 !! end
6946 !! test
6947 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6948 !! wikitext
6949 [[Foo|  bar]]
6951 [[Foo|  ''bar'']]
6953 [http://wp.org   foo]
6955 [http://wp.org   ''foo'']
6956 !! html
6957 <p><a href="/wiki/Foo" title="Foo">  bar</a>
6958 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
6959 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6960 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6961 </p>
6962 !! end
6964 !! test
6965 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6966 !! options
6967 parsoid
6968 !! wikitext
6969 [[Foo|{{echo|a}} b {{echo|c}}]]
6970 !! html
6971 <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>
6972 !! end
6974 !! test
6975 Link with angle bracket after anchor
6976 !! wikitext
6977 [[Foo#<bar>]]
6978 !! html/php
6979 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6980 </p>
6981 !! html/parsoid
6982 <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>
6983 !! end
6986 ### Interwiki links (see maintenance/interwiki.sql)
6989 !! test
6990 Inline interwiki link
6991 !! options
6992 parsoid=wt2html,wt2wt,html2html
6993 !! wikitext
6994 [[MeatBall:SoftSecurity]]
6995 !! html/php
6996 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6997 </p>
6998 !! html/parsoid
6999 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7000 !! end
7002 !! test
7003 Inline interwiki link with empty title (bug 2372)
7004 !! options
7005 parsoid=wt2html,wt2wt,html2html
7006 !! wikitext
7007 [[MeatBall:]]
7008 !! html/php
7009 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7010 </p>
7011 !! html/parsoid
7012 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7013 !! end
7015 !! test
7016 Interwiki link encoding conversion (bug 1636)
7017 !! wikitext
7018 *[[Wikipedia:ro:Olteni&#0355;a]]
7019 *[[Wikipedia:ro:Olteni&#355;a]]
7020 !! html
7021 <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>
7022 <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>
7024 !! html+tidy
7025 <ul>
7026 <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>
7027 <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>
7028 </ul>
7029 !! end
7031 !! test
7032 Interwiki link with fragment (bug 2130)
7033 !! wikitext
7034 [[MeatBall:SoftSecurity#foo]]
7035 !! html
7036 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7037 </p>
7038 !! end
7040 # Ideally the wikipedia: prefix here should be proto-relative too
7041 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7042 # define the 'en' prefix, and originally the test used 'wikipedia',
7043 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7044 # article.
7045 !! test
7046 Different interwiki prefixes mapping to the same URL
7047 !! wikitext
7048 [[:en:Foo]]
7050 [[:en:Foo|Foo]]
7052 [[wikipedia:Foo]]
7054 [[:wikipedia:Foo|Foo]]
7056 [[wikipedia:en:Foo]]
7058 [[:wikipedia:en:Foo]]
7060 [[  wikiPEdia :Foo]]
7061 !! html/parsoid
7062 <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>
7064 <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>
7066 <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>
7068 <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>
7070 <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>
7072 <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>
7074 <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>
7075 !! end
7077 !! test
7078 Interwiki links that cannot be represented in wiki syntax
7079 !! wikitext
7080 [[meatball:ok]]
7081 [[meatball:ok#foo|ok with fragment]]
7082 [[meatball:ok_as_well?|ok ending with ? mark]]
7083 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7084 [http://de.wikipedia.org/wiki/#foo is just fragment]
7086 !! html/php
7087 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7088 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7089 <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>
7090 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7091 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7092 </p>
7093 !! html/parsoid
7094 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7095 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7096 <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>
7097 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7098 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7099 !! end
7101 !! test
7102 Interwiki links: trail
7103 !! wikitext
7104 [[wikipedia:Foo|Ba]]r
7105 !! html/php
7106 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7107 </p>
7108 !! html/parsoid
7109 <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>
7110 !! end
7112 !! test
7113 Local interwiki link
7114 !! options
7115 parsoid=wt2html,wt2wt,html2html
7116 !! wikitext
7117 [[local:Template:Foo]]
7118 !! html/php
7119 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7120 </p>
7121 !! html/parsoid
7122 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7123 !! end
7125 # Parsoid does not mark self-links, by design.
7126 !! test
7127 Local interwiki link: self-link to current page
7128 !! options
7129 title=[[Main Page]]
7130 parsoid=wt2html,wt2wt,html2html
7131 !! wikitext
7132 [[local:Main Page]]
7133 !! html/php
7134 <p><strong class="selflink">local:Main Page</strong>
7135 </p>
7136 !! html/parsoid
7137 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7138 !! end
7140 !! test
7141 Local interwiki link: prefix only (bug 64167)
7142 !! options
7143 parsoid=wt2html,wt2wt,html2html
7144 !! wikitext
7145 [[local:]]
7146 !! html/php
7147 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7148 </p>
7149 !! html/parsoid
7150 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7151 !! end
7153 !! test
7154 Local interwiki link: with additional interwiki prefix (bug 61357)
7155 !! options
7156 parsoid=wt2html,wt2wt,html2html
7157 !! wikitext
7158 [[local:meatball:Hello]]
7159 !! html/php
7160 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7161 </p>
7162 !! html/parsoid
7163 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7164 !! end
7166 !! test
7167 Multiple local interwiki link prefixes
7168 !! wikitext
7169 [[local:local:local:local:mi:local:Foo]]
7170 !! options
7171 parsoid=wt2html,wt2wt,html2html
7172 !! html/php
7173 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7174 </p>
7175 !! html/parsoid
7176 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7177 !! end
7180 ### Interlanguage links
7181 ### Language links (so that searching for '### language' matches..)
7184 !! test
7185 Interlanguage link
7186 !! options
7187 parsoid=wt2html,wt2wt,html2html
7188 !! wikitext
7189 Blah blah blah
7190 [[zh:Chinese]]
7191 !! html/php
7192 <p>Blah blah blah
7193 </p>
7194 !! html/parsoid
7195 <p>Blah blah blah</p>
7196 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7197 !! end
7199 !! test
7200 Interlanguage link with spacing
7201 !! options
7202 parsoid=wt2html,wt2wt,html2html
7203 !! wikitext
7204 Blah blah blah
7205 [[   zh  :    Chinese     ]]
7206 !! html/php
7207 <p>Blah blah blah
7208 </p>
7209 !! html/parsoid
7210 <p>Blah blah blah</p>
7211 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7212 !! end
7214 !! test
7215 Double interlanguage link
7216 !! options
7217 parsoid=wt2html,wt2wt,html2html
7218 !! wikitext
7219 Blah blah blah
7220 [[es:Spanish]]
7221 [[zh:Chinese]]
7222 !! html/php
7223 <p>Blah blah blah
7224 </p>
7225 !! html/parsoid
7226 <p>Blah blah blah</p>
7227 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7228 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7229 !! end
7231 !! test
7232 Interlanguage link variations
7233 !! options
7234 parsoid=wt2html,wt2wt,html2html
7235 !! wikitext
7236 Blah blah blah
7237 [[   es :Spanish]]
7238 [[ ZH :Chinese]]
7239 [[es:Foo_bar]]
7240 [[es:Foo bar]]
7241 !! html/php
7242 <p>Blah blah blah
7243 </p>
7244 !! html/parsoid
7245 <p>Blah blah blah</p>
7246 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7247 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7248 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7249 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7250 !! end
7252 !! test
7253 Interlanguage link, with prefix links
7254 !! options
7255 language=ln
7256 !! wikitext
7257 Blah blah blah
7258 [[zh:Chinese]]
7259 !! html/php
7260 <p>Blah blah blah
7261 </p>
7262 !! html/parsoid
7263 <p>Blah blah blah</p>
7264 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7265 !! end
7267 !! test
7268 Double interlanguage link, with prefix links (bug 8897)
7269 !! options
7270 language=ln
7271 !! wikitext
7272 Blah blah blah
7273 [[es:Spanish]]
7274 [[zh:Chinese]]
7275 !! html/php
7276 <p>Blah blah blah
7277 </p>
7278 !! html/parsoid
7279 <p>Blah blah blah</p>
7280 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7281 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7282 !! end
7284 !! test
7285 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7286 !! wikitext
7287 Blah blah blah
7288 [[mul:Article]]
7289 !! html/php
7290 <p>Blah blah blah
7291 </p>
7292 !! html/parsoid
7293 <p>Blah blah blah</p>
7294 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7295 !! end
7297 !! test
7298 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7299 !! options
7300 language=ln
7301 !! wikitext
7302 [[WW&nbsp;II]]
7303 !! html
7304 <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>
7305 </p>
7306 !! end
7308 !! test
7309 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7310 !! options
7311 parsoid=html2wt
7312 !! html
7313 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7314 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7315 !! wikitext
7316 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7318 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7319 !! end
7321 !! test
7322 Parsoid: handle constructor well
7323 !! wikitext
7324 [[constructor]]
7326 [[constructor:foo]]
7327 !! html/php
7328 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7329 </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>
7330 </p>
7331 !! html/parsoid
7332 <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>
7334 <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>
7335 !! end
7337 !! article
7339 !! text
7340 Test.
7341 !! endarticle
7343 # Note that `ko` isn't a known interlanguage prefix
7344 !! test
7345 Parsoid: recognize interlanguage links without a target page
7346 !! options
7348 !! wikitext
7349 [[es:]]
7351 [[ko:]]
7352 !! html/php
7354 !! html/parsoid
7355 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7357 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7358 !! end
7360 # Note that `ko` isn't a known interwiki prefix
7361 !! test
7362 Parsoid: recognize interwiki links without a target page
7363 !! options
7364 parsoid=wt2html,wt2wt,html2html
7365 !! wikitext
7366 [[:es:]]
7368 [[:ko:]]
7369 !! html/php
7370 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7371 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7372 </p>
7373 !! html/parsoid
7374 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7375 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7376 !! end
7378 !! test
7379 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7380 !! wikitext
7381 [[mi:Foo]]
7382 !! html/php
7383 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7384 </p>
7385 !! html/parsoid
7386 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7387 !! end
7389 !! test
7390 Interlanguage link with preceding local interwiki link (bug 68085)
7391 !! options
7392 parsoid=wt2html,wt2wt,html2html
7393 !! wikitext
7394 Blah blah blah
7395 [[local:es:Spanish]]
7396 !! html/php
7397 <p>Blah blah blah
7398 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7399 </p>
7400 !! html/parsoid
7401 <p>Blah blah blah
7402 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7403 !! end
7405 !! test
7406 Looks like an interlanguage link, but is actually a local interwiki
7407 !! options
7408 parsoid=wt2html,wt2wt,html2html
7409 !! wikitext
7410 Blah blah blah
7411 [[mi:Template:Foo]]
7412 !! html/php
7413 <p>Blah blah blah
7414 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7415 </p>
7416 !! html/parsoid
7417 <p>Blah blah blah
7418 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7419 !! end
7422 ### Redirects, Parsoid-only
7424 !! test
7425 1. Simple redirect to page
7426 !! options
7427 parsoid
7428 !! wikitext
7429 #REDIRECT [[Main Page]]
7430 !! html
7431 <link rel="mw:PageProp/redirect" href="./Main_Page">
7432 !! end
7434 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7435 !! test
7436 2. Other redirect variants
7437 !! options
7438 parsoid=wt2html,wt2wt
7439 !! wikitext
7440 #REDIRECT [[Main_Page]]
7441 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7442 !! html/parsoid
7443 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7444 !! end
7446 !! test
7447 Empty redirect
7448 !! options
7449 parsoid=wt2html,wt2wt
7450 !! wikitext
7451 #REDIRECT [[]]
7452 !! html
7453 <ol>
7454 <li>REDIRECT [[]]</li></ol>
7455 !! end
7457 !! test
7458 Optional colon in #REDIRECT
7459 !! options
7460 # the colon is archaic syntax.  we support it for wt2html, but we
7461 # don't care that it roundtrips back to the modern syntax.
7462 parsoid=wt2html,html2html
7463 !! wikitext
7464 #REDIRECT:[[Main Page]]
7465 !! html
7466 <link rel="mw:PageProp/redirect" href="./Main_Page">
7467 !! end
7469 !! test
7470 Whitespace in #REDIRECT with optional colon
7471 !! options
7472 # the colon and gratuitous whitespace is archaic syntax.  we support
7473 # it for wt2html, but we don't care that it roundtrips back to the
7474 # modern syntax (without extra whitespace)
7475 parsoid=wt2html,html2html
7476 !! wikitext
7478  #REDIRECT 
7480 [[Main Page]]
7481 !! html
7482 <link rel="mw:PageProp/redirect" href="./Main_Page">
7483 !! end
7485 !! test
7486 Piped link in #REDIRECT
7487 !! options
7488 # content after piped link is ignored.  we support this syntax,
7489 # but don't care that the piped link is lost when we roundtrip this.
7490 parsoid=wt2html
7491 !! wikitext
7492 #REDIRECT [[Main Page|bar]]
7493 !! html
7494 <link rel="mw:PageProp/redirect" href="./Main_Page">
7495 !! end
7497 !! test
7498 Redirect to category
7499 !! options
7500 parsoid=wt2html
7501 !! wikitext
7502 #REDIRECT [[Category:Foo]]
7503 !! html
7504 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7505 !! end
7507 !! test
7508 Redirect to category with URL encoding
7509 !! options
7510 parsoid=wt2html
7511 !! wikitext
7512 #REDIRECT [[Category%3AFoo]]
7513 !! html
7514 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7515 !! end
7517 !! test
7518 Redirect to category page
7519 !! options
7520 parsoid=wt2html,html2html
7521 !! wikitext
7522 #REDIRECT [[:Category:Foo]]
7523 !! html
7524 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7525 !! end
7527 !! test
7528 Redirect to image page (1)
7529 !! options
7530 parsoid
7531 !! wikitext
7532 #REDIRECT [[File:Wiki.png]]
7533 !! html
7534 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7535 !! end
7537 !! test
7538 Redirect to image page (2)
7539 !! options
7540 parsoid
7541 !! wikitext
7542 #REDIRECT [[Image:Wiki.png]]
7543 !! html
7544 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7545 !! end
7547 !! test
7548 Redirect to language
7549 !! options
7550 parsoid
7551 !! wikitext
7552 #REDIRECT [[en:File:Wiki.png]]
7553 !! html
7554 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7555 !! end
7557 !! test
7558 Redirect to interwiki
7559 !! options
7560 parsoid
7561 !! wikitext
7562 #REDIRECT [[meatball:File:Wiki.png]]
7563 !! html
7564 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7565 !! end
7567 !! test
7568 Non-English #REDIRECT
7569 !! options
7570 parsoid
7571 language=is
7572 !! wikitext
7573 #TILVÍSUN [[Main Page]]
7574 !! html
7575 <link rel="mw:PageProp/redirect" href="./Main_Page">
7576 !! end
7578 !! test
7579 New redirect
7580 !! options
7581 parsoid=html2wt
7582 !! html
7583 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7584 !! wikitext
7586 #REDIRECT [[Foo]]
7587 !! end
7590 ## XHTML tidiness
7593 !! test
7594 <br> to <br />
7595 !! wikitext
7596 1<br>2<br />3
7597 !! html
7598 <p>1<br />2<br />3
7599 </p>
7600 !! end
7602 !! test
7603 Broken br tag sanitization
7604 !! wikitext
7605 </br>
7606 !! html/php
7607 <p>&lt;/br&gt;
7608 </p>
7609 !! end
7611 # TODO: Fix html2html mode (bug 51055)!
7612 # This </br> handling was added as part of bug 50831; but it
7613 # differs from how PHP+tidy handles this.  We should investigate
7614 # this.
7615 !! test
7616 Parsoid: Broken br tag recognition
7617 !! options
7618 parsoid=wt2html
7619 !! wikitext
7620 </br>
7622 <br/ >
7623 !! html/php+tidy
7624 <p>&lt;/br&gt;</p>
7625 <p><br /></p>
7626 !! html/parsoid
7627 <p><br></p>
7628 <p><br/></p>
7629 !! end
7631 !! test
7632 Incorrecly removing closing slashes from correctly formed XHTML
7633 !! wikitext
7634 <br style="clear:both;" />
7635 !! html
7636 <p><br style="clear:both;" />
7637 </p>
7638 !! end
7640 !! test
7641 Failing to transform badly formed HTML into correct XHTML
7642 !! wikitext
7643 <br style="clear: left;">
7644 <br style="clear: right;">
7645 <br style="clear: both;">
7646 !! html
7647 <p><br style="clear: left;" />
7648 <br style="clear: right;" />
7649 <br style="clear: both;" />
7650 </p>
7651 !!end
7653 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7654 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7655 !! test
7656 Handling html with a div self-closing tag
7657 !! wikitext
7658 <div title />
7659 <div title/>
7660 <div title/ >
7661 <div title=bar />
7662 <div title=bar/>
7663 <div title=bar/ >
7664 !! html/php
7665 <p>&lt;div title /&gt;
7666 &lt;div title/&gt;
7667 </p>
7668 <div>
7669 <p>&lt;div title=bar /&gt;
7670 &lt;div title=bar/&gt;
7671 </p>
7672 <div title="bar/"></div>
7673 </div>
7675 !! html/parsoid
7676 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7677 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7678 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7679 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7680 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7681 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7682 !! end
7684 !! test
7685 Handling html with a br self-closing tag
7686 !! wikitext
7687 <br title />
7688 <br title/>
7689 <br title/ >
7690 <br title=bar />
7691 <br title=bar/>
7692 <br title=bar/ >
7693 !! html/php
7694 <p><br title="title" />
7695 <br title="title" />
7696 <br />
7697 <br title="bar" />
7698 <br title="bar" />
7699 <br title="bar/" />
7700 </p>
7701 !! html/parsoid
7702 <p><br title="" />
7703 <br title="" />
7704 <br title="" />
7705 <br title="bar" />
7706 <br title="bar" />
7707 <br title="bar/" />
7708 </p>
7709 !! end
7711 !! test
7712 Horizontal ruler (should it add that extra space?)
7713 !! wikitext
7714 <hr>
7715 <hr >
7716 foo <hr
7717 > bar
7718 !! html+tidy
7719 <hr />
7720 <hr />
7721 <p>foo</p>
7722 <hr />
7723 <p>bar</p>
7724 !! end
7726 !! test
7727 Horizontal ruler -- 4+ dashes render hr
7728 !! wikitext
7729 ----
7730 !! html
7731 <hr />
7733 !! end
7735 !! test
7736 Horizontal ruler -- eats additional dashes on the same line
7737 !! wikitext
7738 ---------
7739 !! html
7740 <hr />
7742 !! end
7744 !! test
7745 Horizontal ruler -- does not collapse dashes on consecutive lines
7746 !! wikitext
7747 ----
7748 ----
7749 !! html
7750 <hr />
7751 <hr />
7753 !! end
7755 !! test
7756 Horizontal ruler -- <4 dashes render as plain text
7757 !! wikitext
7759 !! html
7760 <p>---
7761 </p>
7762 !! end
7764 !! test
7765 Horizontal ruler -- Supports content following dashes on same line
7766 !! wikitext
7767 ---- Foo
7768 !! html
7769 <hr /> Foo
7771 !! html+tidy
7772 <hr />
7773 <p>Foo</p>
7774 !! end
7777 ### Block-level elements
7779 !! test
7780 Common list
7781 !! wikitext
7782 *Common list
7783 * item 2
7784 *item 3
7785 !! html
7786 <ul><li>Common list</li>
7787 <li> item 2</li>
7788 <li>item 3</li></ul>
7790 !! end
7792 !! test
7793 Numbered list
7794 !! wikitext
7795 #Numbered list
7796 #item 2
7797 # item 3
7798 !! html
7799 <ol><li>Numbered list</li>
7800 <li>item 2</li>
7801 <li> item 3</li></ol>
7803 !! end
7805 !! test
7806 Mixed list
7807 !! wikitext
7808 *Mixed list
7809 *# with numbers
7810 ** and bullets
7811 *# and numbers
7812 *bullets again
7813 **bullet level 2
7814 ***bullet level 3
7815 ***#Number on level 4
7816 **bullet level 2
7817 **#Number on level 3
7818 **#Number on level 3
7819 *#number level 2
7820 *Level 1
7821 *** Level 3
7822 #** Level 3, but ordered
7823 !! html
7824 <ul><li>Mixed list
7825 <ol><li> with numbers</li></ol>
7826 <ul><li> and bullets</li></ul>
7827 <ol><li> and numbers</li></ol></li>
7828 <li>bullets again
7829 <ul><li>bullet level 2
7830 <ul><li>bullet level 3
7831 <ol><li>Number on level 4</li></ol></li></ul></li>
7832 <li>bullet level 2
7833 <ol><li>Number on level 3</li>
7834 <li>Number on level 3</li></ol></li></ul>
7835 <ol><li>number level 2</li></ol></li>
7836 <li>Level 1
7837 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7838 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7840 !! end
7842 !! test
7843 Nested lists 1
7844 !! wikitext
7845 *foo
7846 **bar
7847 !! html
7848 <ul><li>foo
7849 <ul><li>bar</li></ul></li></ul>
7851 !! end
7853 !! test
7854 Nested lists 2
7855 !! wikitext
7856 **foo
7857 *bar
7858 !! html
7859 <ul><li><ul><li>foo</li></ul></li>
7860 <li>bar</li></ul>
7862 !! end
7864 !! test
7865 Nested lists 3 (first element empty)
7866 !! wikitext
7868 **bar
7869 !! html
7870 <ul><li>
7871 <ul><li>bar</li></ul></li></ul>
7873 !! end
7875 !! test
7876 Nested lists 4 (first element empty)
7877 !! wikitext
7879 *bar
7880 !! html
7881 <ul><li><ul><li></li></ul></li>
7882 <li>bar</li></ul>
7884 !! end
7886 !! test
7887 Nested lists 5 (both elements empty)
7888 !! wikitext
7891 !! html
7892 <ul><li><ul><li></li></ul></li>
7893 <li></li></ul>
7895 !! end
7897 !! test
7898 Nested lists 6 (both elements empty)
7899 !! wikitext
7902 !! html
7903 <ul><li>
7904 <ul><li></li></ul></li></ul>
7906 !! end
7908 !! test
7909 Nested lists 7 (skip initial nesting levels)
7910 !! wikitext
7911 *** foo
7912 !! html
7913 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7915 !! end
7917 !! test
7918 Nested lists 8 (multiple nesting transitions)
7919 !! wikitext
7920 * foo
7921 *** bar
7922 ** baz
7923 * boo
7924 !! html
7925 <ul><li> foo
7926 <ul><li><ul><li> bar</li></ul></li>
7927 <li> baz</li></ul></li>
7928 <li> boo</li></ul>
7930 !! end
7932 !! test
7933 1. Lists with start-of-line-transparent tokens before bullets: Comments
7934 !! wikitext
7935 *foo
7936 *<!--cmt-->bar
7937 <!--cmt-->*baz
7938 !! html
7939 <ul><li>foo</li>
7940 <li>bar</li>
7941 <li>baz</li></ul>
7943 !! end
7945 !! test
7946 2. Lists with start-of-line-transparent tokens before bullets: Template close
7947 !! wikitext
7948 *foo {{echo|bar
7949 }}*baz
7950 !! html
7951 <ul><li>foo bar</li>
7952 <li>baz</li></ul>
7954 !! end
7956 !! test
7957 List items are not parsed correctly following a <pre> block (bug 785)
7958 !! wikitext
7959 * <pre>foo</pre>
7960 * <pre>bar</pre>
7961 * zar
7962 !! html
7963 <ul><li> <pre>foo</pre></li>
7964 <li> <pre>bar</pre></li>
7965 <li> zar</li></ul>
7967 !! end
7969 !! test
7970 List items from template
7971 !! wikitext
7973 {{inner list}}
7974 * item 2
7976 * item 0
7977 {{inner list}}
7978 * item 2
7980 * item 0
7981 * notSOL{{inner list}}
7982 * item 2
7983 !! html
7984 <ul><li> item 1</li>
7985 <li> item 2</li></ul>
7986 <ul><li> item 0</li>
7987 <li> item 1</li>
7988 <li> item 2</li></ul>
7989 <ul><li> item 0</li>
7990 <li> notSOL</li>
7991 <li> item 1</li>
7992 <li> item 2</li></ul>
7994 !! end
7996 !! test
7997 List interrupted by empty line or heading
7998 !! wikitext
7999 * foo
8001 ** bar
8002 == A heading ==
8003 * Another list item
8004 !! html
8005 <ul><li> foo</li></ul>
8006 <ul><li><ul><li> bar</li></ul></li></ul>
8007 <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>
8008 <ul><li> Another list item</li></ul>
8010 !!end
8012 !!test
8013 Multiple list tags generated by templates
8014 !! wikitext
8015 {{echo|<li>}}a
8016 {{echo|<li>}}b
8017 {{echo|<li>}}c
8018 !! html
8019 <li>a
8020 <li>b
8021 <li>c</li>
8022 </li>
8023 </li>
8025 !! html+tidy
8026 <ul>
8027 <li>a</li>
8028 <li>b</li>
8029 <li>c</li>
8030 </ul>
8031 !!end
8033 !!test
8034 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8035 !! wikitext
8037 <!--This line will NOT split the list-->
8039  <!--This line will NOT split the list either-->
8041  <!--foo--> <!----> <!--This line NOT split the list either--> 
8043 !! html
8044 <ul><li>a</li>
8045 <li>b</li>
8046 <li>c</li>
8047 <li>d</li></ul>
8049 !!end
8051 !!test
8052 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8053 !! wikitext
8055 <!--This line will NOT split the list-->        
8057         <!--This line will NOT split the list either-->         
8059         <!--foo--> <!---->      <!--This line NOT split the list
8060         either-->        
8062 !! html
8063 <ul><li>a</li>
8064 <li>b</li>
8065 <li>c</li>
8066 <li>d</li></ul>
8068 !!end
8070 !!test
8071 Test the li-hack
8072 (The PHP parser relies on Tidy for the hack)
8073 !!options
8074 parsoid=wt2html,wt2wt
8075 !! wikitext
8076 * foo
8077 * <li>li-hack
8078 * {{echo|<li>templated li-hack}}
8079 * <!--foo--> <li> unsupported li-hack with preceding comments
8081 <ul>
8082 <li><li>not a li-hack
8083 </li>
8084 </ul>
8085 !! html+tidy
8086 <ul>
8087 <li>foo</li>
8088 <li>li-hack</li>
8089 <li>templated li-hack</li>
8090 <li>unsupported li-hack with preceding comments</li>
8091 </ul>
8092 <ul>
8093 <li>not a li-hack</li>
8094 </ul>
8095 !!end
8097 !! test
8098 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8099 !! options
8100 parsoid
8101 !! wikitext
8102 # foo
8103 ## bar
8104 * foo
8105 ** bar
8106 : foo
8107 :: bar
8108 !! html
8109 <ol>
8110 <li> foo<ol>
8111 <li> bar</li>
8112 </ol></li>
8113 </ol><ul>
8114 <li> foo<ul>
8115 <li> bar</li>
8116 </ul></li>
8117 </ul><dl>
8118 <dd> foo<dl>
8119 <dd> bar</dd>
8120 </dl></dd>
8121 </dl>
8122 !! end
8124 !! test
8125 Parsoid: Test of whitespace serialization with Templated bullets
8126 !! options
8127 parsoid
8128 !! wikitext
8129 * {{bullet}}
8130 !! html
8131 <ul>
8132 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8133 </ul>
8134 !! end
8136 # ------------------------------------------------------------------------
8137 # The next set of tests are about Parsoid's ability to handle badly nested
8138 # tags (parse, minimize scope of fixup, and roundtrip back)
8139 # ------------------------------------------------------------------------
8141 !! test
8142 Unbalanced closing block tags break a list
8143 (php parser relies on Tidy to fix up)
8144 !! wikitext
8145 <div>
8146 *a</div><div>
8147 *b</div>
8148 !! html+tidy
8149 <div>
8150 <ul>
8151 <li>a</li>
8152 </ul>
8153 </div>
8154 <div>
8155 <ul>
8156 <li>b</li>
8157 </ul>
8158 </div>
8159 !! end
8161 # Parsoid fails this test, but it might be tricky to support properly.
8162 # See bug 68395.
8163 !! test
8164 Unbalanced closing non-block tags don't break a list
8165 (php parser relies on Tidy to fix up)
8166 !! wikitext
8167 <span>
8168 *a</span><span>
8169 *b</span>
8170 !! html/php+tidy
8171 <ul>
8172 <li><span>a</span></li>
8173 <li><span>b</span></li>
8174 </ul>
8175 !! html/parsoid
8176 <span>
8177 <ul>
8178 <li>a<span></span>
8179 </li>
8180 <li>b
8181 </li>
8182 </ul>
8183 </span>
8184 !! end
8186 !! test
8187 Unclosed formatting tags that straddle lists are closed and reopened
8188 (php parser relies on Tidy to fix up)
8189 !! options
8190 parsoid=wt2html,wt2wt,html2html
8191 !! wikitext
8192 # <s> a
8193 # b </s>
8194 !! html/php+tidy
8195 <ol>
8196 <li><s>a</s></li>
8197 <li><s>b</s></li>
8198 </ol>
8199 !! html/parsoid
8200 <ol><li> <s> a</s></li>
8201 <li><s> b </s></li></ol>
8202 !! end
8204 # Parsoid fails this test, but it might be tricky to support properly.
8205 # See bug 68395.
8206 !!test
8207 List embedded in a non-block tag
8208 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8209 !! wikitext
8210 <small>
8211 * foo
8212 </small>
8213 !! html/php+tidy
8214 <ul>
8215 <li><small>foo</small></li>
8216 </ul>
8217 !! html/parsoid
8218 <small>
8219 <ul>
8220 <li> foo</li>
8221 </ul>
8222 </small>
8223 !!end
8225 # This is a bug in the PHP parser + tidy combination.
8226 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8227 # and then fostered out of the table by tidy.)
8228 # We believe the Parsoid output to be correct.
8229 !! test
8230 Table with missing opening <tr> tag
8231 !! options
8232 parsoid=wt2html,wt2wt
8233 !! wikitext
8234 <table>
8235 <td>foo</td>
8236 </tr>
8237 </table>
8238 !! html/php+tidy
8239 <p>&lt;/tr&gt;</p>
8240 <table>
8241 <tr>
8242 <td>foo</td>
8243 </tr>
8244 </table>
8245 !! html/parsoid
8246 <table>
8247 <tr>
8248 <td>foo</td>
8249 </tr>
8250 </table>
8251 !! end
8254 ### Magic Words
8257 # Note that the current date is hard-coded as
8258 #   1970-01-01T00:02:03Z (a Thursday)
8259 # when running parser tests.  The timezone is also fixed to GMT, so
8260 # local date will be identical to current date.
8262 !! test
8263 Magic Word: {{CURRENTDAY}}
8264 !! wikitext
8265 {{CURRENTDAY}}
8266 !! html
8267 <p>1
8268 </p>
8269 !! end
8271 !! test
8272 Magic Word: {{CURRENTDAY2}}
8273 !! wikitext
8274 {{CURRENTDAY2}}
8275 !! html
8276 <p>01
8277 </p>
8278 !! end
8280 !! test
8281 Magic Word: {{CURRENTDAYNAME}}
8282 !! wikitext
8283 {{CURRENTDAYNAME}}
8284 !! html
8285 <p>Thursday
8286 </p>
8287 !! end
8289 !! test
8290 Magic Word: {{CURRENTDOW}}
8291 !! wikitext
8292 {{CURRENTDOW}}
8293 !! html
8294 <p>4
8295 </p>
8296 !! end
8298 !! test
8299 Magic Word: {{CURRENTMONTH}}
8300 !! wikitext
8301 {{CURRENTMONTH}}
8302 !! html
8303 <p>01
8304 </p>
8305 !! end
8307 !! test
8308 Magic Word: {{CURRENTMONTH1}}
8309 !! wikitext
8310 {{CURRENTMONTH1}}
8311 !! html
8312 <p>1
8313 </p>
8314 !! end
8316 !! test
8317 Magic Word: {{CURRENTMONTHABBREV}}
8318 !! wikitext
8319 {{CURRENTMONTHABBREV}}
8320 !! html
8321 <p>Jan
8322 </p>
8323 !! end
8325 !! test
8326 Magic Word: {{CURRENTMONTHNAME}}
8327 !! wikitext
8328 {{CURRENTMONTHNAME}}
8329 !! html
8330 <p>January
8331 </p>
8332 !! end
8334 !! test
8335 Magic Word: {{CURRENTMONTHNAMEGEN}}
8336 !! wikitext
8337 {{CURRENTMONTHNAMEGEN}}
8338 !! html
8339 <p>January
8340 </p>
8341 !! end
8343 !! test
8344 Magic Word: {{CURRENTTIME}}
8345 !! wikitext
8346 {{CURRENTTIME}}
8347 !! html
8348 <p>00:02
8349 </p>
8350 !! end
8352 !! test
8353 Magic Word: {{CURRENTHOUR}}
8354 !! wikitext
8355 {{CURRENTHOUR}}
8356 !! html
8357 <p>00
8358 </p>
8359 !! end
8361 !! test
8362 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8363 !! wikitext
8364 {{CURRENTWEEK}}
8365 !! html
8366 <p>1
8367 </p>
8368 !! end
8370 !! test
8371 Magic Word: {{CURRENTYEAR}}
8372 !! wikitext
8373 {{CURRENTYEAR}}
8374 !! html
8375 <p>1970
8376 </p>
8377 !! end
8379 !! test
8380 Magic Word: {{CURRENTTIMESTAMP}}
8381 !! wikitext
8382 {{CURRENTTIMESTAMP}}
8383 !! html
8384 <p>19700101000203
8385 </p>
8386 !! end
8388 !! test
8389 Magic Words LOCAL (UTC)
8390 !! wikitext
8391 * {{LOCALMONTH}}
8392 * {{LOCALMONTH1}}
8393 * {{LOCALMONTHNAME}}
8394 * {{LOCALMONTHNAMEGEN}}
8395 * {{LOCALMONTHABBREV}}
8396 * {{LOCALDAY}}
8397 * {{LOCALDAY2}}
8398 * {{LOCALDAYNAME}}
8399 * {{LOCALYEAR}}
8400 * {{LOCALTIME}}
8401 * {{LOCALHOUR}}
8402 * {{LOCALWEEK}}
8403 * {{LOCALDOW}}
8404 * {{LOCALTIMESTAMP}}
8405 !! html
8406 <ul><li> 01</li>
8407 <li> 1</li>
8408 <li> January</li>
8409 <li> January</li>
8410 <li> Jan</li>
8411 <li> 1</li>
8412 <li> 01</li>
8413 <li> Thursday</li>
8414 <li> 1970</li>
8415 <li> 00:02</li>
8416 <li> 00</li>
8417 <li> 1</li>
8418 <li> 4</li>
8419 <li> 19700101000203</li></ul>
8421 !! end
8423 !! test
8424 Magic Word: {{FULLPAGENAME}}
8425 !! options
8426 title=[[User:Ævar Arnfjörð Bjarmason]]
8427 !! wikitext
8428 {{FULLPAGENAME}}
8429 !! html
8430 <p>User:Ævar Arnfjörð Bjarmason
8431 </p>
8432 !! end
8434 !! test
8435 Magic Word: {{FULLPAGENAMEE}}
8436 !! options
8437 title=[[User:Ævar Arnfjörð Bjarmason]]
8438 !! wikitext
8439 {{FULLPAGENAMEE}}
8440 !! html
8441 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8442 </p>
8443 !! end
8445 !! test
8446 Magic Word: {{TALKSPACE}}
8447 !! options
8448 title=[[User:Ævar Arnfjörð Bjarmason]]
8449 !! wikitext
8450 {{TALKSPACE}}
8451 !! html
8452 <p>User talk
8453 </p>
8454 !! end
8456 !! test
8457 Magic Word: {{TALKSPACE}}, same namespace
8458 !! options
8459 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8460 !! wikitext
8461 {{TALKSPACE}}
8462 !! html
8463 <p>User talk
8464 </p>
8465 !! end
8467 !! test
8468 Magic Word: {{TALKSPACE}}, main namespace
8469 !! options
8470 title=[[Parser Test]]
8471 !! wikitext
8472 {{TALKSPACE}}
8473 !! html
8474 <p>Talk
8475 </p>
8476 !! end
8478 !! test
8479 Magic Word: {{TALKSPACEE}}
8480 !! options
8481 title=[[User:Ævar Arnfjörð Bjarmason]]
8482 !! wikitext
8483 {{TALKSPACEE}}
8484 !! html
8485 <p>User_talk
8486 </p>
8487 !! end
8489 !! test
8490 Magic Word: {{SUBJECTSPACE}}
8491 !! options
8492 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8493 !! wikitext
8494 {{SUBJECTSPACE}}
8495 !! html
8496 <p>User
8497 </p>
8498 !! end
8500 !! test
8501 Magic Word: {{SUBJECTSPACE}}, same namespace
8502 !! options
8503 title=[[User:Ævar Arnfjörð Bjarmason]]
8504 !! wikitext
8505 {{SUBJECTSPACE}}
8506 !! html
8507 <p>User
8508 </p>
8509 !! end
8511 !! test
8512 Magic Word: {{SUBJECTSPACE}}, main namespace
8513 !! options
8514 title=[[Parser Test]]
8515 !! wikitext
8516 {{SUBJECTSPACE}}
8517 !! html
8519 !! end
8521 !! test
8522 Magic Word: {{SUBJECTSPACEE}}
8523 !! options
8524 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8525 !! wikitext
8526 {{SUBJECTSPACEE}}
8527 !! html
8528 <p>User
8529 </p>
8530 !! end
8532 !! test
8533 Magic Word: {{NAMESPACE}}
8534 !! options
8535 title=[[User:Ævar Arnfjörð Bjarmason]]
8536 !! wikitext
8537 {{NAMESPACE}}
8538 !! html
8539 <p>User
8540 </p>
8541 !! end
8543 !! test
8544 Magic Word: {{NAMESPACEE}}
8545 !! options
8546 title=[[User:Ævar Arnfjörð Bjarmason]]
8547 !! wikitext
8548 {{NAMESPACEE}}
8549 !! html
8550 <p>User
8551 </p>
8552 !! end
8554 !! test
8555 Magic Word: {{NAMESPACENUMBER}}
8556 !! options
8557 title=[[User:Ævar Arnfjörð Bjarmason]]
8558 !! wikitext
8559 {{NAMESPACENUMBER}}
8560 !! html
8561 <p>2
8562 </p>
8563 !! end
8565 !! test
8566 Magic Word: {{SUBPAGENAME}}
8567 !! options
8568 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8569 !! wikitext
8570 {{SUBPAGENAME}}
8571 !! html
8572 <p>sub ö
8573 </p>
8574 !! end
8576 !! test
8577 Magic Word: {{SUBPAGENAMEE}}
8578 !! options
8579 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8580 !! wikitext
8581 {{SUBPAGENAMEE}}
8582 !! html
8583 <p>sub_%C3%B6
8584 </p>
8585 !! end
8587 !! test
8588 Magic Word: {{ROOTPAGENAME}}
8589 !! options
8590 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8591 !! wikitext
8592 {{ROOTPAGENAME}}
8593 !! html
8594 <p>Ævar Arnfjörð Bjarmason
8595 </p>
8596 !! end
8598 !! test
8599 Magic Word: {{ROOTPAGENAMEE}}
8600 !! options
8601 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8602 !! wikitext
8603 {{ROOTPAGENAMEE}}
8604 !! html
8605 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8606 </p>
8607 !! end
8609 !! test
8610 Magic Word: {{BASEPAGENAME}}
8611 !! options
8612 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8613 !! wikitext
8614 {{BASEPAGENAME}}
8615 !! html
8616 <p>Ævar Arnfjörð Bjarmason
8617 </p>
8618 !! end
8620 !! test
8621 Magic Word: {{BASEPAGENAMEE}}
8622 !! options
8623 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8624 !! wikitext
8625 {{BASEPAGENAMEE}}
8626 !! html
8627 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8628 </p>
8629 !! end
8631 !! test
8632 Magic Word: {{TALKPAGENAME}}
8633 !! options
8634 title=[[User:Ævar Arnfjörð Bjarmason]]
8635 !! wikitext
8636 {{TALKPAGENAME}}
8637 !! html
8638 <p>User talk:Ævar Arnfjörð Bjarmason
8639 </p>
8640 !! end
8642 !! test
8643 Magic Word: {{TALKPAGENAMEE}}
8644 !! options
8645 title=[[User:Ævar Arnfjörð Bjarmason]]
8646 !! wikitext
8647 {{TALKPAGENAMEE}}
8648 !! html
8649 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8650 </p>
8651 !! end
8653 !! test
8654 Magic Word: {{SUBJECTPAGENAME}}
8655 !! options
8656 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8657 !! wikitext
8658 {{SUBJECTPAGENAME}}
8659 !! html
8660 <p>User:Ævar Arnfjörð Bjarmason
8661 </p>
8662 !! end
8664 !! test
8665 Magic Word: {{SUBJECTPAGENAMEE}}
8666 !! options
8667 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8668 !! wikitext
8669 {{SUBJECTPAGENAMEE}}
8670 !! html
8671 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8672 </p>
8673 !! end
8675 !! test
8676 Magic Word: {{NUMBEROFFILES}}
8677 !! wikitext
8678 {{NUMBEROFFILES}}
8679 !! html
8680 <p>5
8681 </p>
8682 !! end
8684 !! test
8685 Magic Word: {{PAGENAME}}
8686 !! options
8687 title=[[User:Ævar Arnfjörð Bjarmason]]
8688 !! wikitext
8689 {{PAGENAME}}
8690 !! html
8691 <p>Ævar Arnfjörð Bjarmason
8692 </p>
8693 !! end
8695 !! test
8696 Magic Word: {{PAGENAME}} with metacharacters
8697 !! options
8698 title=[['foo & bar = baz']]
8699 !! wikitext
8700 ''{{PAGENAME}}''
8701 !! html/php
8702 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8703 </p>
8704 !! html+tidy
8705 <p><i>'foo &amp; bar = baz'</i></p>
8706 !! end
8708 !! test
8709 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8710 !! options
8711 title=[[*RFC 1234 http://example.com/]]
8712 !! wikitext
8713 {{PAGENAME}}
8714 !! html/php
8715 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8716 </p>
8717 !! html+tidy
8718 <p>*RFC 1234 http://example.com/</p>
8719 !! end
8721 !! test
8722 Magic Word: {{PAGENAMEE}}
8723 !! options
8724 title=[[User:Ævar Arnfjörð Bjarmason]]
8725 !! wikitext
8726 {{PAGENAMEE}}
8727 !! html
8728 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8729 </p>
8730 !! end
8732 !! test
8733 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8734 !! options
8735 title=[[*RFC 1234 http://example.com/]]
8736 !! wikitext
8737 {{PAGENAMEE}}
8738 !! html/php
8739 <p>&#42;RFC_1234_http&#58;//example.com/
8740 </p>
8741 !! html+tidy
8742 <p>*RFC_1234_http://example.com/</p>
8743 !! end
8745 !! test
8746 Magic Word: {{REVISIONID}}
8747 !! wikitext
8748 {{REVISIONID}}
8749 !! html
8750 <p>1337
8751 </p>
8752 !! end
8754 !! test
8755 Magic Word: {{SCRIPTPATH}}
8756 !! wikitext
8757 {{SCRIPTPATH}}
8758 !! html
8759 <p>/
8760 </p>
8761 !! end
8763 !! test
8764 Magic Word: {{STYLEPATH}}
8765 !! wikitext
8766 {{STYLEPATH}}
8767 !! html
8768 <p>/skins
8769 </p>
8770 !! end
8772 !! test
8773 Magic Word: {{SERVER}}
8774 !! wikitext
8775 {{SERVER}}
8776 !! html
8777 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8778 </p>
8779 !! end
8781 !! test
8782 Magic Word: {{SERVERNAME}}
8783 !! wikitext
8784 {{SERVERNAME}}
8785 !! html
8786 <p>example.org
8787 </p>
8788 !! end
8790 !! test
8791 Magic Word: {{SITENAME}}
8792 !! wikitext
8793 {{SITENAME}}
8794 !! html
8795 <p>MediaWiki
8796 </p>
8797 !! end
8799 !! test
8800 Case-sensitive magic words, when cased differently, should just be template transclusions
8801 !! wikitext
8802 {{CurrentMonth}}
8803 {{currentday}}
8804 {{cURreNTweEK}}
8805 {{currentHour}}
8806 !! html
8807 <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>
8808 <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>
8809 <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>
8810 <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>
8811 </p>
8812 !! end
8814 !! test
8815 Case-insensitive magic words should still work with weird casing.
8816 !! wikitext
8817 {{sErVeRNaMe}}
8818 {{LCFirst:AOEU}}
8819 {{ucFIRST:aoeu}}
8820 {{SERver}}
8821 !! html
8822 <p>example.org
8823 aOEU
8824 Aoeu
8825 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8826 </p>
8827 !! end
8829 # From plwiki:PLOS_ONE
8830 !! test
8831 Parsoid: Page property magic word with magic word contents
8832 !! options
8833 parsoid
8834 !! wikitext
8835 {{DISPLAYTITLE:''{{PAGENAME}}''}}
8836 !! html
8837 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,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;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
8838 !! end
8840 !! test
8841 Namespace 1 {{ns:1}}
8842 !! wikitext
8843 {{ns:1}}
8844 !! html
8845 <p>Talk
8846 </p>
8847 !! end
8849 !! test
8850 Namespace 1 {{ns:01}}
8851 !! wikitext
8852 {{ns:01}}
8853 !! html
8854 <p>Talk
8855 </p>
8856 !! end
8858 !! test
8859 Namespace 0 {{ns:0}} (bug 4783)
8860 !! wikitext
8861 {{ns:0}}
8862 !! html
8864 !! end
8866 !! test
8867 Namespace 0 {{ns:00}} (bug 4783)
8868 !! wikitext
8869 {{ns:00}}
8870 !! html
8872 !! end
8874 !! test
8875 Namespace -1 {{ns:-1}}
8876 !! wikitext
8877 {{ns:-1}}
8878 !! html
8879 <p>Special
8880 </p>
8881 !! end
8883 !! test
8884 Namespace User {{ns:User}}
8885 !! wikitext
8886 {{ns:User}}
8887 !! html
8888 <p>User
8889 </p>
8890 !! end
8892 !! test
8893 Namespace User talk {{ns:User_talk}}
8894 !! wikitext
8895 {{ns:User_talk}}
8896 !! html
8897 <p>User talk
8898 </p>
8899 !! end
8901 !! test
8902 Namespace User talk {{ns:uSeR tAlK}}
8903 !! wikitext
8904 {{ns:uSeR tAlK}}
8905 !! html
8906 <p>User talk
8907 </p>
8908 !! end
8910 !! test
8911 Namespace File {{ns:File}}
8912 !! wikitext
8913 {{ns:File}}
8914 !! html
8915 <p>File
8916 </p>
8917 !! end
8919 !! test
8920 Namespace File {{ns:Image}}
8921 !! wikitext
8922 {{ns:Image}}
8923 !! html
8924 <p>File
8925 </p>
8926 !! end
8928 !! test
8929 Namespace (lang=de) Benutzer {{ns:User}}
8930 !! options
8931 language=de
8932 !! wikitext
8933 {{ns:User}}
8934 !! html
8935 <p>Benutzer
8936 </p>
8937 !! end
8939 !! test
8940 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8941 !! options
8942 language=de
8943 !! wikitext
8944 {{ns:3}}
8945 !! html
8946 <p>Benutzer Diskussion
8947 </p>
8948 !! end
8951 !! test
8952 Urlencode
8953 !! wikitext
8954 {{urlencode:hi world?!}}
8955 {{urlencode:hi world?!|WIKI}}
8956 {{urlencode:hi world?!|PATH}}
8957 {{urlencode:hi world?!|QUERY}}
8958 !! html
8959 <p>hi+world%3F%21
8960 hi_world%3F!
8961 hi%20world%3F%21
8962 hi+world%3F%21
8963 </p>
8964 !! end
8966 !! test
8967 Magic Word: prioritize type info over data-parsoid
8968 !! options
8969 parsoid=html2wt
8970 !! html
8971 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
8972 !! wikitext
8973 __FORCETOC__
8974 !! end
8976 !! test
8977 Magic Word: serialize on separate line (parsoid)
8978 !! options
8979 parsoid=wt2wt,html2wt
8980 !! wikitext
8982 __NOTOC__
8984 !! html
8985 foo<meta property="mw:PageProp/notoc"/>bar
8986 !! end
8988 !! test
8989 Magic Word: rt non-english wikis
8990 !! options
8991 parsoid=wt2wt
8992 language=de
8993 !! wikitext
8994 __NOEDITSECTION__
8995 !! html
8996 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
8997 !! end
9000 ### Magic links
9002 !! test
9003 Magic links: internal link to RFC (bug 479)
9004 !! wikitext
9005 [[RFC 123]]
9006 !! html
9007 <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>
9008 </p>
9009 !! end
9011 !! test
9012 Magic links: RFC (bug 479)
9013 !! wikitext
9014 RFC 822
9015 !! html
9016 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9017 </p>
9018 !! end
9020 !! test
9021 Magic links: RFC (bug 65278)
9022 !! wikitext
9023 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9024 !! html
9025 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9026 </p>
9027 !! end
9029 !! test
9030 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9031 !! wikitext
9032 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9035 !! html
9036 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9039 </p>
9040 !! end
9042 !! test
9043 Magic links: ISBN (bug 1937)
9044 !! wikitext
9045 ISBN 0-306-40615-2
9046 !! html
9047 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9048 </p>
9049 !! end
9051 !! test
9052 Magic links: ISBN (bug 65278)
9053 !! wikitext
9054 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9055 !! html/php
9056 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9057 </p>
9058 !! html/parsoid
9059 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9060 !! end
9062 !! test
9063 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9064 !! wikitext
9065 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9066 ISBN
9067 9780316098113
9068 ISBN 978
9069 0316098113
9070 !! html
9071 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9072 ISBN
9073 9780316098113
9074 ISBN 978
9075 0316098113
9076 </p>
9077 !! end
9079 !! test
9080 Magic links: PMID incorrectly converts space to underscore
9081 !! wikitext
9082 PMID 1234
9083 !! html
9084 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9085 </p>
9086 !! end
9088 !! test
9089 Magic links: PMID (bug 65278)
9090 !! wikitext
9091 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9092 !! html
9093 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9094 </p>
9095 !! end
9097 !! test
9098 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9099 !! wikitext
9100 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9101 PMID
9102 1234
9103 !! html
9104 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9105 PMID
9106 1234
9107 </p>
9108 !! end
9111 ### Templates
9112 ####
9114 !! test
9115 Nonexistent template
9116 !! wikitext
9117 {{thistemplatedoesnotexist}}
9118 !! html
9119 <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>
9120 </p>
9121 !! end
9123 !! test
9124 Template with invalid target containing tags
9125 !! wikitext
9126 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9127 !! html
9128 <p>{{a<b>b</b>|foo|a=b|a = b}}
9129 </p>
9130 !! end
9132 !! test
9133 Template with invalid target containing unclosed tag
9134 !! wikitext
9135 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9136 !! html
9137 <p>{{a<b>|foo|a=b|a = b}}</b>
9138 </p>
9139 !! end
9141 !! test
9142 Template with invalid target containing wikilink
9143 !! wikitext
9144 {{[[Main Page]]}}
9145 !! html/php
9146 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9147 </p>
9148 !! html/parsoid
9149 <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>
9150 !! end
9152 !! test
9153 Template with just whitespace in it, bug #68421
9154 !! wikitext
9155 {{echo|{{ }}}}
9156 !! html/parsoid
9157 <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>
9158 !! end
9160 !! article
9161 Template:test
9162 !! text
9163 This is a test template
9164 !! endarticle
9166 !! test
9167 Simple template
9168 !! wikitext
9169 {{test}}
9170 !! html
9171 <p>This is a test template
9172 </p>
9173 !! end
9175 !! test
9176 Template with explicit namespace
9177 !! wikitext
9178 {{Template:test}}
9179 !! html
9180 <p>This is a test template
9181 </p>
9182 !! end
9185 !! article
9186 Template:paramtest
9187 !! text
9188 This is a test template with parameter {{{param}}}
9189 !! endarticle
9191 !! test
9192 Template parameter
9193 !! wikitext
9194 {{paramtest|param=foo}}
9195 !! html
9196 <p>This is a test template with parameter foo
9197 </p>
9198 !! end
9200 !! article
9201 Template:paramtestnum
9202 !! text
9203 [[{{{1}}}|{{{2}}}]]
9204 !! endarticle
9206 !! test
9207 Template unnamed parameter
9208 !! wikitext
9209 {{paramtestnum|Main Page|the main page}}
9210 !! html
9211 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9212 </p>
9213 !! end
9215 !! article
9216 Template:templatesimple
9217 !! text
9218 (test)
9219 !! endarticle
9221 !! article
9222 Template:templateredirect
9223 !! text
9224 #redirect [[Template:templatesimple]]
9225 !! endarticle
9227 !! article
9228 Template:templateasargtestnum
9229 !! text
9230 {{{{{1}}}}}
9231 !! endarticle
9233 !! article
9234 Template:templateasargtest
9235 !! text
9236 {{template{{{templ}}}}}
9237 !! endarticle
9239 !! article
9240 Template:templateasargtest2
9241 !! text
9242 {{{{{templ}}}}}
9243 !! endarticle
9245 !! test
9246 Template with template name as unnamed argument
9247 !! wikitext
9248 {{templateasargtestnum|templatesimple}}
9249 !! html
9250 <p>(test)
9251 </p>
9252 !! end
9254 !! test
9255 Template with template name as argument
9256 !! wikitext
9257 {{templateasargtest|templ=simple}}
9258 !! html
9259 <p>(test)
9260 </p>
9261 !! end
9263 !! test
9264 Template with template name as argument (2)
9265 !! wikitext
9266 {{templateasargtest2|templ=templatesimple}}
9267 !! html
9268 <p>(test)
9269 </p>
9270 !! end
9272 !! article
9273 Template:templateasargtestdefault
9274 !! text
9275 {{{{{templ|templatesimple}}}}}
9276 !! endarticle
9278 !! article
9279 Template:templa
9280 !! text
9281 '''templ'''
9282 !! endarticle
9284 !! test
9285 Template with default value
9286 !! wikitext
9287 {{templateasargtestdefault}}
9288 !! html
9289 <p>(test)
9290 </p>
9291 !! end
9293 !! test
9294 Template with default value (value set)
9295 !! wikitext
9296 {{templateasargtestdefault|templ=templa}}
9297 !! html
9298 <p><b>templ</b>
9299 </p>
9300 !! end
9302 !! test
9303 Template redirect
9304 !! wikitext
9305 {{templateredirect}}
9306 !! html
9307 <p>(test)
9308 </p>
9309 !! end
9311 !! test
9312 Template with argument in separate line
9313 !! wikitext
9314 {{ templateasargtest  |
9315  templ = simple }}
9316 !! html
9317 <p>(test)
9318 </p>
9319 !! end
9321 !! test
9322 Template with complex template as argument
9323 !! wikitext
9324 {{paramtest|
9325   param ={{ templateasargtest  |
9326  templ = simple }}}}
9327 !! html
9328 <p>This is a test template with parameter (test)
9329 </p>
9330 !! end
9332 !! test
9333 Template with thumb image (with link in description)
9334 !! wikitext
9335 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9336 !! html/php
9337 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>
9339 !! html+tidy
9340 <p>This is a test template with parameter</p>
9341 <div class="thumb tright">
9342 <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>
9343 <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>
9344 </div>
9345 </div>
9346 !! html/parsoid
9347 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
9348 !! end
9350 !! article
9351 Template:complextemplate
9352 !! text
9353 {{{1}}} {{paramtest|
9354   param ={{{param}}}}}
9355 !! endarticle
9357 !! test
9358 Template with complex arguments
9359 !! wikitext
9360 {{complextemplate|
9361   param ={{ templateasargtest  |
9362  templ = simple }}|[[Template:complextemplate|link]]}}
9363 !! html
9364 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9365 </p>
9366 !! end
9368 !! test
9369 BUG 553: link with two variables in a piped link
9370 !! wikitext
9372 |[[{{{1}}}|{{{2}}}]]
9374 !! html
9375 <table>
9376 <tr>
9377 <td>[[{{{1}}}|{{{2}}}]]
9378 </td></tr></table>
9380 !! end
9382 !! test
9383 Magic variable as template parameter
9384 !! wikitext
9385 {{paramtest|param={{SITENAME}}}}
9386 !! html
9387 <p>This is a test template with parameter MediaWiki
9388 </p>
9389 !! end
9391 !! article
9392 Template:linktest
9393 !! text
9394 [[{{{param}}}|link]]
9395 !! endarticle
9397 !! test
9398 Template parameter as link source
9399 !! wikitext
9400 {{linktest|param=Main Page}}
9401 !! html
9402 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9403 </p>
9404 !! end
9406 !!article
9407 Template:paramtest2
9408 !! text
9409 including another template, {{paramtest|param={{{arg}}}}}
9410 !! endarticle
9412 !! test
9413 Template passing argument to another template
9414 !! wikitext
9415 {{paramtest2|arg='hmm'}}
9416 !! html
9417 <p>including another template, This is a test template with parameter 'hmm'
9418 </p>
9419 !! end
9421 !! article
9422 Template:Linktest2
9423 !! text
9424 Main Page
9425 !! endarticle
9427 !! test
9428 Template as link source
9429 !! wikitext
9430 [[{{linktest2}}]]
9432 [[{{linktest2}}|Main Page]]
9434 [[{{linktest2}}]]Page
9435 !! html
9436 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9437 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9438 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9439 </p>
9440 !! end
9443 !! article
9444 Template:loop1
9445 !! text
9446 {{loop2}}
9447 !! endarticle
9449 !! article
9450 Template:loop2
9451 !! text
9452 {{loop1}}
9453 !! endarticle
9455 !! test
9456 Template infinite loop
9457 !! wikitext
9458 {{loop1}}
9459 !! html
9460 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9461 </p>
9462 !! end
9464 !! test
9465 Template from main namespace
9466 !! wikitext
9467 {{:Main Page}}
9468 !! html
9469 <p>blah blah
9470 </p>
9471 !! end
9473 !! article
9474 Template:table
9475 !! text
9477 | 1 || 2
9479 | 3 || 4
9481 !! endarticle
9483 !! test
9484 BUG 529: Template with table, not included at beginning of line
9485 !! wikitext
9486 foo {{table}}
9487 !! html
9488 <p>foo 
9489 </p>
9490 <table>
9491 <tr>
9492 <td> 1 </td>
9493 <td> 2
9494 </td></tr>
9495 <tr>
9496 <td> 3 </td>
9497 <td> 4
9498 </td></tr></table>
9500 !! end
9502 !! test
9503 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9504 !! wikitext
9506 {{table}}
9507 !! html
9508 <p>foo
9509 </p>
9510 <table>
9511 <tr>
9512 <td> 1 </td>
9513 <td> 2
9514 </td></tr>
9515 <tr>
9516 <td> 3 </td>
9517 <td> 4
9518 </td></tr></table>
9520 !! end
9522 !! test
9523 BUG 41: Template parameters shown as broken links
9524 !! wikitext
9525 {{{parameter}}}
9526 !! html
9527 <p>{{{parameter}}}
9528 </p>
9529 !! end
9531 !! test
9532 Template with targets containing wikilinks
9533 !! wikitext
9534 {{[[foo]]}}
9536 {{[[{{echo|foo}}]]}}
9538 {{{{echo|[[foo}}]]}}
9539 !! html
9540 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9541 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9542 </p><p>{{[[foo}}]]
9543 </p>
9544 !! end
9546 !! article
9547 Template:MSGNW test
9548 !! text
9549 ''None'' of '''this''' should be 
9550 * interpreted
9551  but rather passed unmodified
9552 {{test}}
9553 <gallery>
9554 File:Foobar.jpg
9555 </gallery>
9556 !! endarticle
9558 # hmm, fix this or just deprecate msgnw and document its behavior?
9559 !! test
9560 msgnw keyword
9561 !! wikitext
9562 {{msgnw:MSGNW test}}
9563 !! html
9564 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
9565 &#42; interpreted
9566 &#32;but rather passed unmodified
9567 &#123;&#123;test&#125;&#125;
9568 &#60;gallery&#62;
9569 File:Foobar.jpg
9570 &#60;/gallery&#62;
9571 </p>
9572 !! end
9574 !! test
9575 int keyword
9576 !! wikitext
9577 {{int:youhavenewmessages|lots of money|not!}}
9578 !! html
9579 <p>You have lots of money (not!).
9580 </p>
9581 !! end
9583 !! article
9584 Template:Includes
9585 !! text
9586 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9587 !! endarticle
9589 !! test
9590 <includeonly> and <noinclude> being included
9591 !! wikitext
9592 {{Includes}}
9593 !! html
9594 <p>Foobar
9595 </p>
9596 !! end
9598 !! article
9599 Template:Includes2
9600 !! text
9601 <onlyinclude>Foo</onlyinclude>bar
9602 !! endarticle
9604 !! test
9605 <onlyinclude> being included
9606 !! wikitext
9607 {{Includes2}}
9608 !! html
9609 <p>Foo
9610 </p>
9611 !! end
9614 !! article
9615 Template:Includes3
9616 !! text
9617 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9618 !! endarticle
9620 !! test
9621 <onlyinclude> and <includeonly> being included
9622 !! wikitext
9623 {{Includes3}}
9624 !! html
9625 <p>Foo
9626 </p>
9627 !! end
9629 !! test
9630 <includeonly> and <noinclude> on a page
9631 !! wikitext
9632 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9633 !! html
9634 <p>Foozar
9635 </p>
9636 !! end
9638 !! test
9639 Un-closed <noinclude>
9640 !! wikitext
9641 <noinclude>
9642 !! html
9643 !! end
9645 !! test
9646 <onlyinclude> on a page
9647 !! wikitext
9648 <onlyinclude>Foo</onlyinclude>bar
9649 !! html
9650 <p>Foobar
9651 </p>
9652 !! end
9654 !! test
9655 Un-closed <onlyinclude>
9656 !! wikitext
9657 <onlyinclude>
9658 !! html
9659 !! end
9661 !!test
9662 Self-closed noinclude, includeonly, onlyinclude tags
9663 !! wikitext
9664 <noinclude />
9665 <includeonly />
9666 <onlyinclude />
9667 !! html
9668 <p><br />
9669 </p>
9670 !!end
9672 !!test
9673 Unbalanced includeonly and noinclude tags
9674 !! wikitext
9676 |a</noinclude>
9677 |b</noinclude></noinclude>
9678 |c</noinclude></includeonly>
9679 |d</includeonly></includeonly>
9681 !! html
9682 <table>
9683 <tr>
9684 <td>a
9685 </td>
9686 <td>b
9687 </td>
9688 <td>c&lt;/includeonly&gt;
9689 </td>
9690 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9691 </td></tr></table>
9693 !!end
9695 !! article
9696 Template:Includeonly section
9697 !! text
9698 <includeonly>
9699 ==Includeonly section==
9700 </includeonly>
9701 ==Section T-1==
9702 !!endarticle
9704 !! test
9705 Bug 6563: Edit link generation for section shown by <includeonly>
9706 !! wikitext
9707 {{includeonly section}}
9708 !! html
9709 <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>
9710 <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>
9712 !! end
9714 # Uses same input as the contents of [[Template:Includeonly section]]
9715 !! test
9716 Bug 6563: Section extraction for section shown by <includeonly>
9717 !! options
9718 section=T-2
9719 !! wikitext
9720 <includeonly>
9721 ==Includeonly section==
9722 </includeonly>
9723 ==Section T-2==
9724 !! html
9725 ==Section T-2==
9726 !! end
9728 !! test
9729 Bug 6563: Edit link generation for section suppressed by <includeonly>
9730 !! wikitext
9731 <includeonly>
9732 ==Includeonly section==
9733 </includeonly>
9734 ==Section 1==
9735 !! html
9736 <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>
9738 !! end
9740 !! test
9741 Bug 6563: Section extraction for section suppressed by <includeonly>
9742 !! options
9743 section=1
9744 !! wikitext
9745 <includeonly>
9746 ==Includeonly section==
9747 </includeonly>
9748 ==Section 1==
9749 !! html
9750 ==Section 1==
9751 !! end
9753 !! test
9754 Un-closed <includeonly>
9755 !! wikitext
9756 <includeonly>
9757 !! html
9758 !! end
9760 !! test
9761 Includes and comments at SOL
9762 !! wikitext
9763 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9765 <noinclude>
9766 some
9767 </noinclude>* stuff
9768 * here
9770 <includeonly>can have stuff</includeonly>=== here ===
9772 !! html/php
9773 <h2><span class="mw-headline" id="hu">hu</span></h2>
9774 <p>some
9775 </p>
9776 <ul><li> stuff</li>
9777 <li> here</li></ul>
9778 <h3><span class="mw-headline" id="here">here</span></h3>
9780 !! html/parsoid
9781 <!-- 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>
9783 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9784 <p>some</p>
9785 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9786 <li> here</li></ul>
9788 <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>
9790 !! end
9792 # TODO: test with DOM fragment reuse!
9793 !! test
9794 Parsoid: DOM fragment reuse
9795 !! options
9796 parsoid=wt2wt,wt2html
9797 !! wikitext
9798 a{{echo|b<table></table>c}}d
9800 a{{echo|b
9801 <table></table>
9802 c}}d
9804 {{echo|a
9806 <table></table>
9809 !! html
9810 <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>
9812 <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">
9813 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9814 </span><p about="#mwt2">cd</p>
9816 <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">
9818 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9820 </span><p about="#mwt3">b</p>
9821 !! end
9823 !! test
9824 Parsoid: Merge double tds (bug 50603)
9825 !! options
9826 parsoid
9827 !! wikitext
9829 |{{echo|{{!}} foo}}
9831 !! html
9832 <table><tbody>
9833 <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>
9834 </tbody></table>
9835 !! end
9837 !! test
9838 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9839 !! options
9840 parsoid
9841 !! wikitext
9842 {{echo|<div>}}
9844 |{{echo|{{!}} foo}}
9846 {{echo|</div>}}
9847 !! html
9848 <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}}]}'>
9849 <table><tbody>
9850 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9851 </tbody></table>
9852 </div>
9853 !! end
9856 ### <includeonly> and <noinclude> in attributes
9858 !!test
9859 0. includeonly around the entire attribute
9860 !! wikitext
9861 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9862 !! html
9863 <p><span id="v2">bar</span>
9864 </p>
9865 !!end
9867 !!test
9868 1. includeonly in html attr key
9869 !! wikitext
9870 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9871 !! html
9872 <p><span id="foo">bar</span>
9873 </p>
9874 !!end
9876 !!test
9877 2. includeonly in html attr value
9878 !! wikitext
9879 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9880 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9881 !! html
9882 <p><span id="v1">bar</span>
9883 <span id="v1">bar</span>
9884 </p>
9885 !!end
9887 !!test
9888 3. includeonly in part of an attr value
9889 !! wikitext
9890 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9891 !! html
9892 <p><span style="color:red;">bar</span>
9893 </p>
9894 !!end
9896 !!test
9897 4. includeonly in table attributes
9898 !! wikitext
9900 |- <noinclude>
9903 </noinclude>
9904 |- <includeonly>
9907 </includeonly>
9909 !! html
9910 <table>
9913 <tr>
9914 <td>a
9915 </td></tr>
9916 </table>
9918 !!end
9921 ### Token Stream Patcher tests
9923 ### These tests won't always pass wt2wt and other modes because
9924 ### on serialization, the table will be output on a new line.
9925 ### For now, we are blacklisting them, and using this to test selser.
9928 !!test
9929 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9930 !!options
9931 parsoid=wt2html,wt2wt
9932 !!wikitext
9933 {{echo|}}{| width = '100%'
9934 |foo
9936 !!html/parsoid
9937 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9938 <tbody><tr><td>foo</td></tr>
9939 </tbody></table>
9940 !!end
9942 !!test
9943 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9944 !!options
9945 parsoid=wt2html,wt2wt
9946 !!wikitext
9947 <includeonly>a</includeonly>{| {{{b}}}
9950 !!html/parsoid
9951 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><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}}}":""}}'>
9952 <tbody><tr><td>c</td></tr>
9953 </tbody></table>
9955 !!end
9958 ### Testing parsing of templates where a template arg
9959 ### has the same name as the template itself.
9962 !! article
9963 Template:quote
9964 !! text
9965 {{{quote|{{{1}}}}}}
9966 !! endarticle
9968 !!test
9969 Templates: Template Name/Arg clash: 1. Use of positional param
9970 !! wikitext
9971 {{quote|foo}}
9972 !! html
9973 <p>foo
9974 </p>
9975 !!end
9977 !!test
9978 Templates: Template Name/Arg clash: 2. Use of named param
9979 !! wikitext
9980 {{quote|quote=foo}}
9981 !! html
9982 <p>foo
9983 </p>
9984 !!end
9986 !!test
9987 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9988 !! wikitext
9989 {{quote|quote}}
9990 !! html
9991 <p>quote
9992 </p>
9993 !!end
9996 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9999 !!test
10000 Templates: 1. Simple use
10001 !! wikitext
10002 {{echo|Foo}}
10003 !! html
10004 <p>Foo
10005 </p>
10006 !!end
10008 !!test
10009 Templates: 2. Inside a block tag
10010 !! wikitext
10011 <div>{{echo|Foo}}</div>
10012 <blockquote>{{echo|Foo}}</blockquote>
10013 !! html
10014 <div>Foo</div>
10015 <blockquote>Foo</blockquote>
10017 !! html+tidy
10018 <div>Foo</div>
10019 <blockquote>
10020 <p>Foo</p>
10021 </blockquote>
10022 !!end
10024 !!test
10025 Templates: P-wrapping: 1a. Templates on consecutive lines
10026 !! wikitext
10027 {{echo|Foo}}
10028 {{echo|bar}}
10029 !! html
10030 <p>Foo
10032 </p>
10033 !!end
10035 !!test
10036 Templates: P-wrapping: 1b. Templates on consecutive lines
10037 !! wikitext
10040 {{echo|bar}}
10041 {{echo|baz}}
10042 !! html
10043 <p>Foo
10044 </p><p>bar
10046 </p>
10047 !!end
10049 !!test
10050 Templates: P-wrapping: 1c. Templates on consecutive lines
10051 !! wikitext
10052 {{echo|Foo}}
10053 {{echo|bar}} <div>baz</div>
10054 !! html
10055 <p>Foo
10056 </p>
10057 bar <div>baz</div>
10059 !! html+tidy
10060 <p>Foo</p>
10061 <p>bar</p>
10062 <div>baz</div>
10063 !! end
10065 !!test
10066 Templates: P-wrapping: 1d. Template preceded by comment-only line
10067 !!options
10068 parsoid
10069 !! wikitext
10070 <!-- foo -->
10071 {{echo|Bar}}
10072 !! html
10073 <!-- foo -->
10075 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10076 !!end
10078 !!test
10079 Templates: Inline Text: 1. Multiple template uses
10080 !! wikitext
10081 {{echo|Foo}}bar{{echo|baz}}
10082 !! html
10083 <p>Foobarbaz
10084 </p>
10085 !!end
10087 !!test
10088 Templates: Inline Text: 2. Back-to-back template uses
10089 !! wikitext
10090 {{echo|Foo}}{{echo|bar}}
10091 !! html
10092 <p>Foobar
10093 </p>
10094 !!end
10096 !!test
10097 Templates: Block Tags: 1. Multiple template uses
10098 !! wikitext
10099 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10100 !! html
10101 <div>Foo</div><div>bar</div><div>baz</div>
10103 !!end
10105 !!test
10106 Templates: Block Tags: 2. Back-to-back template uses
10107 !! wikitext
10108 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10109 !! html
10110 <div>Foo</div><div>bar</div>
10112 !!end
10114 # This is an edge case relating to paragraph wrapping.
10115 !!test
10116 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10117 !! wikitext
10118 {{echo|a
10119 b</p>}}
10120 !! html/parsoid
10121 <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
10122 b</p>
10123 !!end
10125 !!test
10126 Templates: Links: 1. Simple example
10127 !! wikitext
10128 {{echo|[[Foo|bar]]}}
10129 !! html
10130 <p><a href="/wiki/Foo" title="Foo">bar</a>
10131 </p>
10132 !!end
10134 !!test
10135 Templates: Links: 2. Generation of link href
10136 !! wikitext
10137 [[{{echo|Foo}}|bar]]
10138 !! html
10139 <p><a href="/wiki/Foo" title="Foo">bar</a>
10140 </p>
10141 !!end
10143 !!test
10144 Templates: Links: 3. Generation of part of a link href
10145 !! wikitext
10146 [[Fo{{echo|o}}|bar]]
10148 [[Foo{{echo|bar}}]]
10150 [[Foo{{echo|bar}}baz]]
10152 [[Foo{{echo|bar}}|bar]]
10154 [[:Foo{{echo|bar}}]]
10156 [[:Foo{{echo|bar}}|bar]]
10157 !! html
10158 <p><a href="/wiki/Foo" title="Foo">bar</a>
10159 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10160 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10161 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10162 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10163 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10164 </p>
10165 !!end
10167 !!test
10168 Templates: Links: 4. Multiple templates generating link href
10169 !! wikitext
10170 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10171 !! html
10172 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10173 </p>
10174 !!end
10176 !!test
10177 Templates: Links: 5. Generation of link text
10178 !! wikitext
10179 [[Foo|{{echo|bar}}]]
10180 !! html
10181 <p><a href="/wiki/Foo" title="Foo">bar</a>
10182 </p>
10183 !!end
10185 !!test
10186 Templates: Links: 5. Nested templates (only outermost template should be marked)
10187 !! wikitext
10188 {{echo|[[{{echo|Foo}}|bar]]}}
10189 !! html
10190 <p><a href="/wiki/Foo" title="Foo">bar</a>
10191 </p>
10192 !!end
10194 !!test
10195 Templates: HTML Tag: 1. Generation of HTML attr. key
10196 !! wikitext
10197 <div {{echo|style}}="color:red;">foo</div>
10198 !! html
10199 <div style="color:red;">foo</div>
10201 !!end
10203 !!test
10204 Templates: HTML Tag: 2. Generation of HTML attr. value
10205 !! wikitext
10206 <div style={{echo|'color:red;'}}>foo</div>
10207 !! html
10208 <div style="color:red;">foo</div>
10210 !!end
10212 !!test
10213 Templates: HTML Tag: 3. Generation of HTML attr key and value
10214 !! wikitext
10215 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10216 !! html
10217 <div style="color:red;">foo</div>
10219 !!end
10221 !!test
10222 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10223 !! wikitext
10224 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10225 !! html
10226 <div title="This is a long title with just one piece templated">foo</div>
10228 !!end
10230 !!test
10231 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10232 !! wikitext
10233 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10234 !! html
10235 <div title="This is a long title with just one piece templated">foo</div>
10237 !!end
10239 !!test
10240 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10241 !! wikitext
10242 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10243 !! html
10244 <div title="This is a long title with just one piece templated">foo</div>
10246 !!end
10248 # SSS FIXME: While it is great we added support for all this,
10249 # do we want to make this part of the spec? Maybe we want to
10250 # deprecate this kind of usage in the future?
10251 !!test
10252 Templates: HTML Tag: 7. Generation of partial attribute key string
10253 !! wikitext
10254 <div st{{echo|yle}}="color:red;">foo</div>
10255 !! html
10256 <div style="color:red;">foo</div>
10258 !!end
10260 !! test
10261 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10262 !! wikitext
10263 <div {{echo|1=id="v1"}}>bar</div>
10264 !! html
10265 <div id="v1">bar</div>
10267 !!end
10269 !! test
10270 Templates: HTML Tag: 9. Multiple template-generated attributes
10271 !! wikitext
10272 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10273 !! html
10274 <div id="v1" title="foo">bar</div>
10276 !!end
10278 !! test
10279 Templates: Support for templates generating attributes and content
10280 !! wikitext
10281 {| {{mixed_attr_content_template}}
10283 |bar
10285 !! html/php
10286 <table style="color:red;" title="T48811">
10288 <tr>
10289 <td>foo
10290 </td></tr>
10291 <tr>
10292 <td>bar
10293 </td></tr></table>
10295 !! html/parsoid
10296 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
10297 <tbody><tr>
10298 <td>foo</td></tr>
10299 <tr>
10300 <td>bar</td></tr>
10301 </tbody></table>
10302 !!end
10304 !!test
10305 Templates: HTML Tables: 1. Generating start of a HTML table
10306 !! wikitext
10307 {{echo|<table><tr><td>foo</td>}}</tr></table>
10308 !! html
10309 <table><tr><td>foo</td></tr></table>
10311 !!end
10313 !!test
10314 Templates: HTML Tables: 2a. Generating middle of a HTML table
10315 !! wikitext
10316 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10317 !! html
10318 <table><tr><td>foo</td></tr></table>
10320 !!end
10322 !!test
10323 Templates: HTML Tables: 2b. Generating middle of a HTML table
10324 !! wikitext
10325 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10326 !! html
10327 <table><tr><td>foo</td></tr></table>
10329 !!end
10331 !!test
10332 Templates: HTML Tables: 3. Generating end of a HTML table
10333 !! wikitext
10334 <table><tr>{{echo|<td>foo</td></tr></table>}}
10335 !! html
10336 <table><tr><td>foo</td></tr></table>
10338 !!end
10340 !!test
10341 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10342 !! wikitext
10343 {{echo|<table>}}<tr><td>foo</td></tr></table>
10344 !! html
10345 <table><tr><td>foo</td></tr></table>
10347 !!end
10349 !!test
10350 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10351 !! wikitext
10352 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10353 !! html
10354 <table><tr><td>foo</td></tr></table>
10356 !!end
10358 !!test
10359 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10360 !! wikitext
10361 <table><tr>{{echo|<td>}}foo</td></tr></table>
10362 !! html
10363 <table><tr><td>foo</td></tr></table>
10365 !!end
10367 !!test
10368 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10369 !! wikitext
10370 <table><tr><td>foo{{echo|</td>}}</tr></table>
10371 !! html
10372 <table><tr><td>foo</td></tr></table>
10374 !!end
10376 !!test
10377 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10378 !! wikitext
10379 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10380 !! html
10381 <table><tr><td>foo</td></tr></table>
10383 !!end
10385 !!test
10386 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10387 !! wikitext
10388 <table><tr><td>foo</td></tr>{{echo|</table>}}
10389 !! html
10390 <table><tr><td>foo</td></tr></table>
10392 !!end
10394 !!test
10395 Templates: HTML Tables: 5. Proper fostering of categories from inside
10396 !!options
10397 parsoid=wt2html,wt2wt
10398 !! wikitext
10399 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10400 <!--Two categories (Bug 50330)-->
10401 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10402 !! html
10403 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10404 <!--Two categories (Bug 50330)-->
10405 <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>
10406 !!end
10408 !!test
10409 Templates: Wiki Tables: 1a. Fostering of entire template content
10410 !! wikitext
10412 {{echo|a}}
10414 !! html
10415 <table>
10417 <tr><td></td></tr></table>
10419 !! html+tidy
10420 <p>a</p>
10421 <table>
10422 <tr>
10423 <td></td>
10424 </tr>
10425 </table>
10426 !! end
10428 !!test
10429 Templates: Wiki Tables: 1b. Fostering of entire template content
10430 !! wikitext
10432 {{echo|<div>}}
10434 {{echo|</div>}}
10436 !! html
10437 <table>
10438 <div>
10439 <p>foo
10440 </p>
10441 </div>
10442 <tr><td></td></tr></table>
10444 !! html+tidy
10445 <div>
10446 <p>foo</p>
10447 </div>
10448 <table>
10449 <tr>
10450 <td></td>
10451 </tr>
10452 </table>
10453 !! end
10455 !!test
10456 Templates: Wiki Tables: 2. Fostering of partial template content
10457 !! wikitext
10459 {{echo|a
10460 <div>b</div>}}
10462 !! html
10463 <table>
10465 <div>b</div>
10466 <tr><td></td></tr></table>
10468 !! html+tidy
10469 <p>a</p>
10470 <div>b</div>
10471 <table>
10472 <tr>
10473 <td></td>
10474 </tr>
10475 </table>
10476 !! end
10478 !!test
10479 Templates: Wiki Tables: 3. td-content via multiple templates
10480 !! wikitext
10482 {{echo|{{pipe}}a}}{{echo|b}}
10484 !! html
10485 <table>
10486 <tr>
10487 <td>ab
10488 </td></tr></table>
10490 !!end
10492 !!test
10493 Templates: Wiki Tables: 4. Templated tags, no content
10494 !! wikitext
10495 {{tbl-start}}
10496 {{tbl-end}}
10497 !! html
10498 <table>
10499 <tr><td></td></tr></table>
10501 !!end
10503 !!test
10504 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10505 !! wikitext
10506 {{tbl-start}}
10507 |foo
10508 {{tbl-end}}
10509 !! html
10510 <table>
10511 <tr>
10512 <td>foo
10513 </td></tr></table>
10515 !!end
10517 !!test
10518 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10519 !! wikitext
10520 {{tbl-start}}
10521 {{!}}foo
10522 {{tbl-end}}
10523 !! html
10524 <table>
10525 <tr>
10526 <td>foo
10527 </td></tr></table>
10529 !!end
10531 !!test
10532 Templates: Lists: Multi-line list-items via templates
10533 !! wikitext
10534 *{{echo|a {{nonexistent|
10535 unused}}}}
10536 *{{echo|b {{nonexistent|
10537 unused}}}}
10538 !! html
10539 <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>
10540 <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>
10542 !!end
10544 !!test
10545 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10546 !! wikitext
10547 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10548 !! html
10549 <p><i>ab</i>c<i>d</i>e
10550 </p>
10551 !!end
10553 !!test
10554 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10555 (PHP parser generates misnested html)
10556 !! wikitext
10557 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10558 !! html/parsoid
10559 <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>
10560 !!end
10562 !!test
10563 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10564 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10565 !! options
10566 parsoid=wt2html,wt2wt
10567 !! wikitext
10568 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10569 !! html
10570 <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>
10571 <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>
10572 <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>
10573 !!end
10575 !!test
10576 Templates: Ugly nesting: 4. Divs opened/closed across templates
10577 !! wikitext
10578 a<div>b{{echo|c</div>d}}e
10579 !! html
10580 a<div>bc</div>de
10582 !! html+tidy
10583 <p>a</p>
10584 <div>bc</div>
10585 <p>de</p>
10586 !! end
10588 !!test
10589 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10590 (Parsoid-centric)
10591 !! options
10592 parsoid
10593 !! wikitext
10595 |{{echo|foo</table>}}
10596 |bar
10598 !! html
10599 <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|}"]}'>
10601 <tbody>
10602 <tr>
10603 <td>foo</td></tr></tbody></table><span about="#mwt1">
10604 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10605 |}</span>
10606 !!end
10608 !!test
10609 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10610 (Parsoid-centric)
10611 !! options
10612 parsoid
10613 !! wikitext
10614 <table>
10615   <tr>
10616     <td>
10617     <table>
10618       <tr>
10619         <td>1. {{echo|foo </table>}}</td>
10620         <td> bar </td>
10621         <td>2. {{echo|baz </table>}}</td>
10622       </tr>
10623       <tr>
10624         <td>abc</td>
10625       </tr>
10626     </table>
10627     </td>
10628   </tr>
10629   <tr>
10630     <td>xyz</td>
10631   </tr>
10632 </table>
10633 !! html
10634 <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>"]}'>
10635   <tbody><tr>
10636     <td>
10637     <table>
10638       <tbody><tr>
10639         <td>1. foo </td></tr></tbody></table></td>
10640         <td> bar </td>
10641         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10642       </span><span about="#mwt2">
10643       </span><span about="#mwt2">
10644         </span><span about="#mwt2">abc</span><span about="#mwt2">
10645       </span><span about="#mwt2">
10646     </span><span about="#mwt2">
10647     </span><span about="#mwt2">
10648   </span><span about="#mwt2">
10649   </span><span about="#mwt2">
10650     </span><span about="#mwt2">xyz</span><span about="#mwt2">
10651   </span><span about="#mwt2">
10652 </span>
10653 !!end
10655 !! test
10656 Templates: Ugly templates: 3. newline-only template parameter
10657 !! wikitext
10658 foo {{echo|
10660 !! html
10661 <p>foo 
10662 </p>
10663 !! end
10665 # This looks like a bug: a single newline triggers p/br for some reason.
10666 !! test
10667 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10668 !! wikitext
10669 {{echo|
10671 !! html
10672 <p><br />
10673 </p>
10674 !! end
10676 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10677 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10678 !! test
10679 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10680 !! wikitext
10681 {{echo|<table>}}
10682 {{echo|<div>foo}}
10683 {{echo|</table>}}
10684 !! html/parsoid
10685 <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
10686 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10687 </table>
10688 !! end
10690 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10691 # that are "identical" and generate nesting cycles in the algorithm
10692 !! test
10693 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10694 !! wikitext
10695 {{echo|<table><tr><td><table>}}
10696 {{echo|<div>}}
10697 {{echo|</div>}}
10698 !! html/parsoid
10699 <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"}'>
10700 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10701 </table></td></tr></tbody></table>
10702 !! end
10704 !!test
10705 Parser Functions: 1. Simple example
10706 !! wikitext
10707 {{uc:foo}}
10708 !! html
10709 <p>FOO
10710 </p>
10711 !!end
10713 !!test
10714 Parser Functions: 2. Nested use (only outermost should be marked up)
10715 !! wikitext
10716 {{uc:{{lc:FOO}}}}
10717 !! html
10718 <p>FOO
10719 </p>
10720 !!end
10723 ### Pre-save transform tests
10725 !! test
10726 pre-save transform: subst:
10727 !! options
10729 !! wikitext
10730 {{subst:test}}
10731 !! html
10732 This is a test template
10733 !! end
10735 !! test
10736 pre-save transform: normal template
10737 !! options
10739 !! wikitext
10740 {{test}}
10741 !! html
10742 {{test}}
10743 !! end
10745 !! test
10746 pre-save transform: nonexistent template
10747 !! options
10749 !! wikitext
10750 {{thistemplatedoesnotexist}}
10751 !! html
10752 {{thistemplatedoesnotexist}}
10753 !! end
10756 !! test
10757 pre-save transform: subst magic variables
10758 !! options
10760 !! wikitext
10761 {{subst:SITENAME}}
10762 !! html
10763 MediaWiki
10764 !! end
10766 # This is bug 89, which I fixed. -- wtm
10767 !! test
10768 pre-save transform: subst: templates with parameters
10769 !! options
10771 !! wikitext
10772 {{subst:paramtest|param="something else"}}
10773 !! html
10774 This is a test template with parameter "something else"
10775 !! end
10777 !! article
10778 Template:nowikitest
10779 !! text
10780 <nowiki>'''not wiki'''</nowiki>
10781 !! endarticle
10783 !! test
10784 pre-save transform: nowiki in subst (bug 1188)
10785 !! options
10787 !! wikitext
10788 {{subst:nowikitest}}
10789 !! html
10790 <nowiki>'''not wiki'''</nowiki>
10791 !! end
10794 !! article
10795 Template:commenttest
10796 !! text
10797 This template has <!-- a comment --> in it.
10798 !! endarticle
10800 !! test
10801 pre-save transform: comment in subst (bug 1936)
10802 !! options
10804 !! wikitext
10805 {{subst:commenttest}}
10806 !! html
10807 This template has <!-- a comment --> in it.
10808 !! end
10810 !! test
10811 pre-save transform: unclosed tag
10812 !! options
10813 pst noxml
10814 !! wikitext
10815 <nowiki>'''not wiki'''
10816 !! html
10817 <nowiki>'''not wiki'''
10818 !! end
10820 !! test
10821 pre-save transform: mixed tag case
10822 !! options
10823 pst noxml
10824 !! wikitext
10825 <NOwiki>'''not wiki'''</noWIKI>
10826 !! html
10827 <NOwiki>'''not wiki'''</noWIKI>
10828 !! end
10830 !! test
10831 pre-save transform: unclosed comment in <nowiki>
10832 !! options
10833 pst noxml
10834 !! wikitext
10835 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10836 !! html
10837 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10838 !!end
10840 # Leading @ in this template definition works around a limitation
10841 # in parsoid's parserTests which otherwise strips the <span> from the
10842 # result (confusing it for a template wrapper)
10843 !! article
10844 Template:dangerous
10845 !!text
10846 @<span onmouseover="alert('crap')">Oh no</span>
10847 !!endarticle
10849 !!test
10850 (confirming safety of fix for subst bug 1936)
10851 !! wikitext
10852 {{Template:dangerous}}
10853 !! html
10854 <p>@<span>Oh no</span>
10855 </p>
10856 !! end
10858 !! test
10859 pre-save transform: comment containing gallery (bug 5024)
10860 !! options
10862 !! wikitext
10863 <!-- <gallery>data</gallery> -->
10864 !! html
10865 <!-- <gallery>data</gallery> -->
10866 !!end
10868 !! test
10869 pre-save transform: comment containing extension
10870 !! options
10872 !! wikitext
10873 <!-- <tag>data</tag> -->
10874 !! html
10875 <!-- <tag>data</tag> -->
10876 !!end
10878 !! test
10879 pre-save transform: comment containing nowiki
10880 !! options
10882 !! wikitext
10883 <!-- <nowiki>data</nowiki> -->
10884 !! html
10885 <!-- <nowiki>data</nowiki> -->
10886 !!end
10888 !! test
10889 pre-save transform: <noinclude> in subst (bug 3298)
10890 !! options
10892 !! wikitext
10893 {{subst:Includes}}
10894 !! html
10895 Foobar
10896 !! end
10898 !! test
10899 pre-save transform: <onlyinclude> in subst (bug 3298)
10900 !! options
10902 !! wikitext
10903 {{subst:Includes2}}
10904 !! html
10906 !! end
10908 !! article
10909 Template:SubstTest
10910 !!text
10911 {{<includeonly>subst:</includeonly>Includes}}
10912 !! endarticle
10914 !! article
10915 Template:SafeSubstTest
10916 !! text
10917 {{<includeonly>safesubst:</includeonly>Includes}}
10918 !! endarticle
10920 !! test
10921 bug 22297: safesubst: works during PST
10922 !! options
10924 !! wikitext
10925 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10926 !! html
10927 FoobarFoobar
10928 !! end
10930 !! test
10931 bug 22297: safesubst: works during normal parse
10932 !! wikitext
10933 {{SafeSubstTest}}
10934 !! html
10935 <p>Foobar
10936 </p>
10937 !! end
10939 !! test
10940 subst: does not work during normal parse
10941 !! wikitext
10942 {{SubstTest}}
10943 !! html
10944 <p>{{subst:Includes}}
10945 </p>
10946 !! end
10948 !! test
10949 pre-save transform: context links ("pipe trick")
10950 !! options
10952 !! wikitext
10953 [[Article (context)|]]
10954 [[Bar:Article|]]
10955 [[:Bar:Article|]]
10956 [[Bar:Article (context)|]]
10957 [[:Bar:Article (context)|]]
10958 [[|Article]]
10959 [[|Article (context)]]
10960 [[Bar:X (Y) Z|]]
10961 [[:Bar:X (Y) Z|]]
10962 !! html
10963 [[Article (context)|Article]]
10964 [[Bar:Article|Article]]
10965 [[:Bar:Article|Article]]
10966 [[Bar:Article (context)|Article]]
10967 [[:Bar:Article (context)|Article]]
10968 [[Article]]
10969 [[Article (context)]]
10970 [[Bar:X (Y) Z|X (Y) Z]]
10971 [[:Bar:X (Y) Z|X (Y) Z]]
10972 !! end
10974 !! test
10975 pre-save transform: context links ("pipe trick") with interwiki prefix
10976 !! options
10978 !! wikitext
10979 [[interwiki:Article|]]
10980 [[:interwiki:Article|]]
10981 [[interwiki:Bar:Article|]]
10982 [[:interwiki:Bar:Article|]]
10983 !! html
10984 [[interwiki:Article|Article]]
10985 [[:interwiki:Article|Article]]
10986 [[interwiki:Bar:Article|Bar:Article]]
10987 [[:interwiki:Bar:Article|Bar:Article]]
10988 !! end
10990 !! test
10991 pre-save transform: context links ("pipe trick") with parens in title
10992 !! options
10993 pst title=[[Somearticle (context)]]
10994 !! wikitext
10995 [[|Article]]
10996 !! html
10997 [[Article (context)|Article]]
10998 !! end
11000 !! test
11001 pre-save transform: context links ("pipe trick") with comma in title
11002 !! options
11003 pst title=[[Someplace, Somewhere]]
11004 !! wikitext
11005 [[|Otherplace]]
11006 [[Otherplace, Elsewhere|]]
11007 [[Otherplace, Elsewhere, Anywhere|]]
11008 !! html
11009 [[Otherplace, Somewhere|Otherplace]]
11010 [[Otherplace, Elsewhere|Otherplace]]
11011 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11012 !! end
11014 !! test
11015 pre-save transform: context links ("pipe trick") with parens and comma
11016 !! options
11017 pst title=[[Someplace (IGNORED), Somewhere]]
11018 !! wikitext
11019 [[|Otherplace]]
11020 [[Otherplace (place), Elsewhere|]]
11021 !! html
11022 [[Otherplace, Somewhere|Otherplace]]
11023 [[Otherplace (place), Elsewhere|Otherplace]]
11024 !! end
11026 !! test
11027 pre-save transform: context links ("pipe trick") with comma and parens
11028 !! options
11029 pst title=[[Who, me? (context)]]
11030 !! wikitext
11031 [[|Yes, you.]]
11032 [[Me, Myself, and I (1937 song)|]]
11033 !! html
11034 [[Yes, you. (context)|Yes, you.]]
11035 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11036 !! end
11038 !! test
11039 pre-save transform: context links ("pipe trick") with namespace
11040 !! options
11041 pst title=[[Ns:Somearticle]]
11042 !! wikitext
11043 [[|Article]]
11044 !! html
11045 [[Ns:Article|Article]]
11046 !! end
11048 !! test
11049 pre-save transform: context links ("pipe trick") with namespace and parens
11050 !! options
11051 pst title=[[Ns:Somearticle (context)]]
11052 !! wikitext
11053 [[|Article]]
11054 !! html
11055 [[Ns:Article (context)|Article]]
11056 !! end
11058 !! test
11059 pre-save transform: context links ("pipe trick") with namespace and comma
11060 !! options
11061 pst title=[[Ns:Somearticle, Context, Whatever]]
11062 !! wikitext
11063 [[|Article]]
11064 !! html
11065 [[Ns:Article, Context, Whatever|Article]]
11066 !! end
11068 !! test
11069 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11070 !! options
11071 pst title=[[Ns:Somearticle, Context (context)]]
11072 !! wikitext
11073 [[|Article]]
11074 !! html
11075 [[Ns:Article (context)|Article]]
11076 !! end
11078 !! test
11079 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11080 !! options
11081 pst title=[[Ns:Somearticle (IGNORED), Context]]
11082 !! wikitext
11083 [[|Article]]
11084 !! html
11085 [[Ns:Article, Context|Article]]
11086 !! end
11088 !! test
11089 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11090 !! options
11092 !! wikitext
11093 [[Article(context)|]]
11094 [[Bar:Article(context)|]]
11095 [[:Bar:Article(context)|]]
11096 [[|Article(context)]]
11097 [[Bar:X(Y)Z|]]
11098 [[:Bar:X(Y)Z|]]
11099 !! html
11100 [[Article(context)|Article]]
11101 [[Bar:Article(context)|Article]]
11102 [[:Bar:Article(context)|Article]]
11103 [[Article(context)]]
11104 [[Bar:X(Y)Z|X(Y)Z]]
11105 [[:Bar:X(Y)Z|X(Y)Z]]
11106 !! end
11108 !! test
11109 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11110 !! options
11112 !! wikitext
11113 [[Article (context)|]]
11114 [[Bar:Article (context)|]]
11115 [[:Bar:Article (context)|]]
11116 [[|Article (context)]]
11117 [[Bar:X (Y) Z|]]
11118 [[:Bar:X (Y) Z|]]
11119 !! html
11120 [[Article (context)|Article]]
11121 [[Bar:Article (context)|Article]]
11122 [[:Bar:Article (context)|Article]]
11123 [[Article (context)]]
11124 [[Bar:X (Y) Z|X (Y) Z]]
11125 [[:Bar:X (Y) Z|X (Y) Z]]
11126 !! end
11128 !! test
11129 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11130 !! options
11132 !! wikitext
11133 [[Article(context)|]]
11134 [[Bar:Article(context)|]]
11135 [[:Bar:Article(context)|]]
11136 [[|Article(context)]]
11137 [[Bar:X(Y)Z|]]
11138 [[:Bar:X(Y)Z|]]
11139 !! html
11140 [[Article(context)|Article]]
11141 [[Bar:Article(context)|Article]]
11142 [[:Bar:Article(context)|Article]]
11143 [[Article(context)]]
11144 [[Bar:X(Y)Z|X(Y)Z]]
11145 [[:Bar:X(Y)Z|X(Y)Z]]
11146 !! end
11148 !! test
11149 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11150 !! options
11152 !! wikitext
11153 [[Article (context), context|]]
11154 [[Article (context),context|]]
11155 [[Bar:Article (context), context|]]
11156 [[Bar:Article (context),context|]]
11157 [[:Bar:Article (context), context|]]
11158 [[:Bar:Article (context),context|]]
11159 !! html
11160 [[Article (context), context|Article]]
11161 [[Article (context),context|Article]]
11162 [[Bar:Article (context), context|Article]]
11163 [[Bar:Article (context),context|Article]]
11164 [[:Bar:Article (context), context|Article]]
11165 [[:Bar:Article (context),context|Article]]
11166 !! end
11168 !! test
11169 pre-save transform: trim trailing empty lines
11170 !! options
11172 !! wikitext
11173 Empty lines are trimmed
11178 !! html
11179 Empty lines are trimmed
11180 !! end
11182 !! test
11183 pre-save transform: Signature expansion
11184 !! options
11186 !! wikitext
11187 * ~~~
11188 * <noinclude>~~~</noinclude>
11189 * <includeonly>~~~</includeonly>
11190 * <onlyinclude>~~~</onlyinclude>
11191 !! html
11192 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11193 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11194 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11195 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11196 !! end
11199 !! test
11200 pre-save transform: Signature expansion in nowiki tags (bug 93)
11201 !! options
11202 pst disabled
11203 !! wikitext
11204 Shall not expand:
11206 <nowiki>~~~~</nowiki>
11208 <includeonly><nowiki>~~~~</nowiki></includeonly>
11210 <noinclude><nowiki>~~~~</nowiki></noinclude>
11212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11214 {{subst:Foo}} shall be converted to FOO
11216 As well as inside noinclude/onlyinclude
11217 <noinclude>{{subst:Foo}}</noinclude>
11218 <onlyinclude>{{subst:Foo}}</onlyinclude>
11220 But not inside includeonly
11221 <includeonly>{{subst:Foo}}</includeonly>
11222 !! html
11223 Shall not expand:
11225 <nowiki>~~~~</nowiki>
11227 <includeonly><nowiki>~~~~</nowiki></includeonly>
11229 <noinclude><nowiki>~~~~</nowiki></noinclude>
11231 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11233 FOO shall be converted to FOO
11235 As well as inside noinclude/onlyinclude
11236 <noinclude>FOO</noinclude>
11237 <onlyinclude>FOO</onlyinclude>
11239 But not inside includeonly
11240 <includeonly>{{subst:Foo}}</includeonly>
11241 !! end
11243 !! test
11244 Parsoid: Recognize nowiki with trailing space in tags
11245 !! options
11246 parsoid=wt2html
11247 !! wikitext
11248 <nowiki ><div>[[foo]]</nowiki >
11250 a<nowiki / >b
11252 c<nowiki />d
11254 e<nowiki/ >f
11255 !! html
11256 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11257 <p>ab</p>
11258 <p>cd</p>
11259 <p>ef</p>
11260 !! end
11262 !! test
11263 Parsoid: Recognize nowiki with odd capitalization
11264 !! options
11265 parsoid=wt2html
11266 !! wikitext
11267 <noWikI ><div>[[foo]]</Nowiki >
11268 !! html
11269 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11270 !! end
11273 !! test
11274 Parsoid: Escape nowiki with trailing space in tags
11275 !! options
11276 parsoid=html2wt
11277 !! html
11278 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11279 <p>a&lt;nowiki /&gt;b</p>
11280 <p>c&lt;nowiki/ &gt;d</p>
11281 !! wikitext
11282 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11284 a&lt;nowiki /&gt;b
11286 c&lt;nowiki/ &gt;d
11287 !! end
11289 !! test
11290 Parsoid: Escape weird noWikI capitalizations
11291 !! options
11292 parsoid=html2wt
11293 !! html
11294 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11295 !! wikitext
11296 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11297 !! end
11300 ### Message transform tests
11302 !! test
11303 message transform: magic variables
11304 !! options
11306 !! wikitext
11307 {{SITENAME}}
11308 !! html
11309 MediaWiki
11310 !! end
11312 !! test
11313 message transform: should not transform wiki markup
11314 !! options
11316 !! wikitext
11317 ''test''
11318 !! html
11319 ''test''
11320 !! end
11322 !! test
11323 message transform: <noinclude> in transcluded template (bug 4926)
11324 !! options
11326 !! wikitext
11327 {{Includes}}
11328 !! html
11329 Foobar
11330 !! end
11332 !! test
11333 message transform: <onlyinclude> in transcluded template (bug 4926)
11334 !! options
11336 !! wikitext
11337 {{Includes2}}
11338 !! html
11340 !! end
11342 !! test
11343 {{#special:}} page name, known
11344 !! options
11346 !! wikitext
11347 {{#special:Recentchanges}}
11348 !! html
11349 Special:RecentChanges
11350 !! end
11352 !! test
11353 {{#special:}} page name with subpage, known
11354 !! options
11356 !! wikitext
11357 {{#special:Recentchanges/param}}
11358 !! html
11359 Special:RecentChanges/param
11360 !! end
11362 !! test
11363 {{#special:}} page name, unknown
11364 !! options
11366 !! wikitext
11367 {{#special:foobar nonexistent}}
11368 !! html
11369 Special:Foobar nonexistent
11370 !! end
11372 !! test
11373 {{#speciale:}} page name, known
11374 !! options
11376 !! wikitext
11377 {{#speciale:Recentchanges}}
11378 !! html
11379 Special:RecentChanges
11380 !! end
11382 !! test
11383 {{#speciale:}} page name with subpage, known
11384 !! options
11386 !! wikitext
11387 {{#speciale:Recentchanges/param}}
11388 !! html
11389 Special:RecentChanges/param
11390 !! end
11392 !! test
11393 {{#speciale:}} page name, unknown
11394 !! options
11396 !! wikitext
11397 {{#speciale:foobar nonexistent}}
11398 !! html
11399 Special:Foobar_nonexistent
11400 !! end
11403 ### Images
11405 ### For Parsoid-specific tests, see
11406 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11408 !! test
11409 Simple image
11410 !! options
11411 parsoid=wt2html,wt2wt,html2html
11412 !! wikitext
11413 [[Image:foobar.jpg]]
11414 !! html/php
11415 <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>
11416 </p>
11417 !! html/parsoid
11418 <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>
11419 !! end
11421 !! test
11422 Simple image (using File: namespace, now canonical)
11423 !! wikitext
11424 [[File:Foobar.jpg]]
11425 !! html/php
11426 <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>
11427 </p>
11428 !! html/parsoid
11429 <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>
11430 !! end
11432 !! test
11433 Right-aligned image
11434 !! wikitext
11435 [[File:Foobar.jpg|right]]
11436 !! html/php
11437 <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>
11439 !! html/parsoid
11440 <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>
11441 !! end
11443 !! test
11444 Image with caption
11445 !! wikitext
11446 [[File:Foobar.jpg|right|Caption text]]
11447 !! html/php
11448 <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>
11450 !! html/parsoid
11451 <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>
11452 !! end
11454 !! test
11455 Image with caption, bug 53312 #1
11456 !! wikitext
11457 [[File:Foobar.jpg|right|Caption page stuff]]
11458 !! html/php
11459 <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>
11461 !! html/parsoid
11462 <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>
11463 !! end
11465 !! test
11466 Image with caption, bug 53312 #2
11467 !! wikitext
11468 [[File:Foobar.jpg|right|Caption page=]]
11469 !! html/php
11470 <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>
11472 !! html/parsoid
11473 <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>
11474 !! end
11476 !! test
11477 Image with caption, bug 53312 #3
11478 !! wikitext
11479 [[File:Foobar.jpg|right|Caption page=stuff]]
11480 !! html/php
11481 <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>
11483 !! html/parsoid
11484 <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>
11485 !! end
11487 !! test
11488 Allow empty links in image captions (Bug 60753)
11489 !! options
11490 thumbsize=220
11491 !! wikitext
11492 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11493 [[]]
11494 [[Link2]]
11496 !! html/php
11497 <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>
11499 !! html/parsoid
11500 <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>
11501 [[]]
11502 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11503 </figcaption></figure>
11504 !! end
11506 !! test
11507 Titles in unlinked images (T23454)
11508 !! wikitext
11509 [[File:Foobar.jpg|link=|stuff]]
11510 !! html/php
11511 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11512 </p>
11513 !! end
11515 !! test
11516 Link with empty target
11517 !! wikitext
11518 [[]]
11519 !! html
11520 <p>[[]]
11521 </p>
11522 !! end
11524 !! test
11525 Image with link trail
11526 !! wikitext
11527 Linktrails should not work for images: [[File:Foobar.jpg]]s
11528 !! html/php
11529 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
11530 </p>
11531 !! html/parsoid
11532 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span>s</p>
11533 !! end
11535 !! test
11536 Image with empty attribute
11537 !! options
11538 parsoid=wt2html,wt2wt,html2html
11539 !! wikitext
11540 [[File:Foobar.jpg|right||Caption text]]
11541 !! html/php
11542 <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>
11544 !! html/parsoid
11545 <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>
11546 !! end
11548 !! test
11549 1. Block image with individual attributes from templates
11550 !! wikitext
11551 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11552 !! html/php
11553 <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>
11555 !! html/parsoid
11556 <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>
11557 !! end
11559 !! test
11560 2. Block Image with individual attributes from templates
11561 !! wikitext
11562 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11563 !! html/php
11564 <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>
11566 !! html/parsoid
11567 <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>
11568 !! end
11570 !! test
11571 3. Inline image with individual attributes from templates
11572 !! wikitext
11573 [[File:Foobar.jpg|{{echo|50px}}]]
11574 !! html/php
11575 <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>
11576 </p>
11577 !! html/parsoid
11578 <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>
11579 !! end
11581 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11582 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11583 !! test
11584 Image with multiple attributes from the same template
11585 !! wikitext
11586 [[File:Foobar.jpg|{{image_attribs}}]]
11587 !! html/php
11588 <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>
11590 !! html/parsoid
11591 <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>
11592 !! end
11594 !! test
11595 Image with link tails
11596 !! options
11597 thumbsize=220
11598 !! wikitext
11599 123[[File:Foobar.jpg]]456
11600 123[[File:Foobar.jpg|right]]456
11601 123[[File:Foobar.jpg|thumb]]456
11602 !! html/php
11603 <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
11604 </p>
11605 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
11606 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
11608 !! html/php+tidy
11609 <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>
11610 <p>123</p>
11611 <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>
11612 <p>456 123</p>
11613 <div class="thumb tright">
11614 <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>
11615 <div class="thumbcaption">
11616 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11617 </div>
11618 </div>
11619 </div>
11620 <p>456</p>
11621 !! html/parsoid
11622 <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>
11623 <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>
11624 <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>
11625 !! end
11627 !! test
11628 Image with multiple captions -- only last one is accepted
11629 !! wikitext
11630 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11631 !! html/php
11632 <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>
11634 !! html/parsoid
11635 <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>
11636 !! end
11638 !! test
11639 Image with multiple widths -- use last
11640 !! wikitext
11641 [[File:Foobar.jpg|200px|300px|caption]]
11642 !! html/php
11643 <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>
11644 </p>
11645 !! html/parsoid
11646 <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>
11647 !! end
11649 !! test
11650 Image with multiple alignments -- use first (bug 48664)
11651 !! options
11652 thumbsize=220
11653 !! wikitext
11654 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11656 [[File:Foobar.jpg|middle|text-top|caption]]
11657 !! html/php
11658 <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>
11659 <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>
11660 </p>
11661 !! html/parsoid
11662 <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>
11663 <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>
11664 !! end
11666 !! test
11667 Image with width attribute at different positions
11668 !! wikitext
11669 [[File:Foobar.jpg|200px|right|Caption]]
11670 [[File:Foobar.jpg|right|200px|Caption]]
11671 [[File:Foobar.jpg|right|Caption|200px]]
11672 !! html/php
11673 <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>
11674 <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>
11675 <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>
11677 !! html/parsoid
11678 <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>
11679 <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>
11680 <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>
11681 !! end
11683 # a sad bit of backward-compatibility
11684 !! test
11685 Image with size specified with pxpx (bug 13500, 51628)
11686 !! options
11687 parsoid=wt2html,wt2wt,html2html
11688 !! wikitext
11689 [[File:Foobar.jpg|20pxpx]]
11690 [[File:Foobar.jpg|200x20pxpx]]
11691 !! html/php
11692 <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>
11693 <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>
11694 </p>
11695 !! html/parsoid
11696 <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>
11697 !! end
11699 !! test
11700 Image with link parameter, wiki target
11701 !! wikitext
11702 [[File:Foobar.jpg|link=Main Page]]
11703 !! html/php
11704 <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>
11705 </p>
11706 !! html/parsoid
11707 <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>
11708 !! end
11710 # parsoid bug 49293 (part 1)
11711 !! test
11712 Image with link parameter, URL target
11713 !! wikitext
11714 [[File:Foobar.jpg|link=http://example.com/]]
11715 !! html/php
11716 <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>
11717 </p>
11718 !! html/parsoid
11719 <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>
11720 !! end
11722 # parsoid bug 49293 (part 2)
11723 !! test
11724 Image with link parameter, protocol-less URL target
11725 !! wikitext
11726 [[File:Foobar.jpg|link=//example.com/]]
11727 !! html/php
11728 <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>
11729 </p>
11730 !! html/parsoid
11731 <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>
11732 !! end
11734 !! test
11735 Image with link parameter, wgExternalLinkTarget
11736 !! wikitext
11737 [[Image:foobar.jpg|link=http://example.com/]]
11738 !! config
11739 wgExternalLinkTarget='foobar'
11740 !! html
11741 <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>
11742 </p>
11743 !! end
11745 !! test
11746 Image with link parameter, wgNoFollowLinks set to false
11747 !! wikitext
11748 [[Image:foobar.jpg|link=http://example.com/]]
11749 !! config
11750 wgNoFollowLinks=false
11751 !! html
11752 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11753 </p>
11754 !! end
11756 !! test
11757 Image with link parameter, wgNoFollowDomainExceptions
11758 !! wikitext
11759 [[Image:foobar.jpg|link=http://example.com/]]
11760 !! config
11761 wgNoFollowDomainExceptions='example.com'
11762 !! html
11763 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11764 </p>
11765 !! end
11767 !! test
11768 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11769 !! wikitext
11770 [[Image:foobar.jpg|link=http://example.com/|Title]]
11771 !! config
11772 wgExternalLinkTarget='foobar'
11773 !! html
11774 <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>
11775 </p>
11776 !! end
11778 !! test
11779 Image with empty link parameter
11780 !! wikitext
11781 [[File:Foobar.jpg|link=]]
11782 !! html/php
11783 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11784 </p>
11785 !! html/parsoid
11786 <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>
11787 !! end
11789 !! test
11790 Image with link parameter (wiki target) and unnamed parameter
11791 !! wikitext
11792 [[File:Foobar.jpg|link=Main_Page|Title]]
11793 !! html/php
11794 <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>
11795 </p>
11796 !! html/parsoid
11797 <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>
11798 !! end
11800 !! test
11801 Image with link parameter (URL target) and unnamed parameter
11802 !! wikitext
11803 [[File:Foobar.jpg|link=http://example.com/|Title]]
11804 !! html/php
11805 <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>
11806 </p>
11807 !! html/parsoid
11808 <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>
11809 !! end
11811 !! test
11812 Thumbnail image with link parameter
11813 !! options
11814 thumbsize=220
11815 parsoid=wt2html,wt2wt,html2html
11816 !! wikitext
11817 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11818 !! html/php
11819 <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>
11821 !! html/parsoid
11822 <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>
11823 !! end
11825 !! test
11826 Manually-specified thumbnail image
11827 !! options
11828 thumbsize=220
11829 !! wikitext
11830 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11831 !! html/php
11832 <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>
11834 !! html/parsoid
11835 <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>
11836 !! end
11838 !! test
11839 Manually-specified thumbnail image with explicit link to wiki page
11840 !! options
11841 thumbsize=220
11842 parsoid=wt2html,wt2wt,html2html
11843 !! wikitext
11844 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11845 !! html/php
11846 <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>
11848 !! html/parsoid
11849 <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>
11850 !! end
11852 !! test
11853 Manually-specified thumbnail image with explicit link to url
11854 !! options
11855 thumbsize=220
11856 parsoid=wt2html,wt2wt,html2html
11857 !! wikitext
11858 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11859 !! html/php
11860 <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>
11862 !! html/parsoid
11863 <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>
11864 !! end
11866 !! test
11867 Manually-specified thumbnail image with explicit no link
11868 !! options
11869 thumbsize=220
11870 parsoid=wt2html,wt2wt,html2html
11871 !! wikitext
11872 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11873 !! html/php
11874 <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>
11876 !! html/parsoid
11877 <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>
11878 !! end
11880 !! test
11881 Manually-specified thumbnail image with explicit link and alt text
11882 !! options
11883 thumbsize=220
11884 parsoid=wt2html,wt2wt,html2html
11885 !! wikitext
11886 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11887 !! html/php
11888 <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>
11890 !! html/parsoid
11891 <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>
11892 !! end
11894 !! test
11895 Image with frame and link
11896 !! options
11897 parsoid=wt2html,wt2wt,html2html
11898 !! wikitext
11899 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11900 !! html/php
11901 <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>
11903 !! html/parsoid
11904 <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>
11905 !! end
11907 !! test
11908 Image with frame and link and explicit alt
11909 !! options
11910 parsoid=wt2html,wt2wt,html2html
11911 !! wikitext
11912 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11913 !! html/php
11914 <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>
11916 !! html/parsoid
11917 <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>
11918 !! end
11920 !! test
11921 Image with wiki markup in implicit alt
11922 !! options
11923 parsoid=wt2html,wt2wt,html2html
11924 !! wikitext
11925 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11927 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11928 !! html/php
11929 <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>
11930 </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>
11931 </p>
11932 !! html/parsoid
11933 <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>
11934 <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>
11935 !! end
11937 ###################
11938 # Conflicting image format options.
11939 # First option specified should 'win'.
11940 # All three cases in each test should be identical.
11942 !! test
11943 Image with 'frameless' first.
11944 !! options
11945 parsoid=wt2html,wt2wt,html2html
11946 !! wikitext
11947 [[File:Foobar.jpg|frameless|caption]]
11949 [[File:Foobar.jpg|frameless|frame|caption]]
11951 [[File:Foobar.jpg|frameless|thumb|caption]]
11952 !! html/php
11953 <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>
11954 </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>
11955 </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>
11956 </p>
11957 !! html/parsoid
11958 <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>
11959 <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>
11960 <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>
11961 !! end
11963 !! test
11964 Image with 'frame' first.
11965 !! options
11966 parsoid=wt2html,wt2wt,html2html
11967 !! wikitext
11968 [[File:Foobar.jpg|frame|caption]]
11969 [[File:Foobar.jpg|frame|frameless|caption]]
11970 [[File:Foobar.jpg|frame|thumb|caption]]
11971 !! html/php
11972 <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>
11973 <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>
11974 <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>
11976 !! html/parsoid
11977 <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>
11978 <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>
11979 <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>
11980 !! end
11982 !! test
11983 Image with 'thumb' first.
11984 !! options
11985 parsoid=wt2html,wt2wt,html2html
11986 !! wikitext
11987 [[File:Foobar.jpg|thumb|caption]]
11988 [[File:Foobar.jpg|thumb|frameless|caption]]
11989 [[File:Foobar.jpg|thumb|frame|caption]]
11990 !! html/php
11991 <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>
11992 <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>
11993 <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>
11995 !! html/parsoid
11996 <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>
11997 <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>
11998 <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>
11999 !! end
12001 ###################
12002 # Image sizing.
12003 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12004 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12005 # Foobar has actual size of 1941x220
12006 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12007 #    a scalable format.
12008 # 2. Framed images always ignore size options; always render at default size.
12009 # 3. "Unspecified format" and border are the only types which can be
12010 #    enlarged.
12012 !! test
12013 Image: "unspecified format" and border enlarge
12014 !! options
12015 parsoid=wt2html,wt2wt,html2html
12016 !! wikitext
12017 [[File:Foobar.jpg|2000px]]
12019 [[File:Foobar.jpg|border|2000px]]
12020 !! html/php
12021 <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>
12022 </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>
12023 </p>
12024 !! html/parsoid
12025 <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>
12026 <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>
12027 !! end
12029 !! test
12030 Image: "unspecified format" and border reduce
12031 !! options
12032 parsoid=wt2html,wt2wt,html2html
12033 !! wikitext
12034 [[File:Foobar.jpg|1000px]]
12036 [[File:Foobar.jpg|border|1000px]]
12037 !! html/php
12038 <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>
12039 </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>
12040 </p>
12041 !! html/parsoid
12042 <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>
12043 <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>
12044 !! end
12046 !! test
12047 Image: thumbs reduce
12048 !! options
12049 parsoid=wt2html,wt2wt,html2html
12050 !! wikitext
12051 [[File:Foobar.jpg|thumb|50px]]
12052 !! html/php
12053 <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>
12055 !! html/parsoid
12056 <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>
12057 !! end
12059 !! test
12060 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12061 !! options
12062 parsoid=wt2html,wt2wt,html2html
12063 !! wikitext
12064 [[File:Foobar.jpg|thumb|2000px]]
12066 [[File:Foobar.svg|thumb|2000px]]
12067 !! html/php
12068 <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>
12069 <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>
12071 !! html/parsoid
12072 <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>
12073 <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>
12074 !! end
12076 !! test
12077 Image: frameless can reduce in size
12078 !! options
12079 parsoid=wt2html,wt2wt,html2html
12080 !! wikitext
12081 [[File:Foobar.jpg|frameless|50px]]
12082 !! html/php
12083 <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>
12084 </p>
12085 !! html/parsoid
12086 <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>
12087 !! end
12089 !! test
12090 Image: bitmap frameless can't be enlarged past original size, but vector can
12091 !! options
12092 parsoid=wt2html,wt2wt,html2html
12093 !! wikitext
12094 [[File:Foobar.jpg|frameless|2000px]]
12096 [[File:Foobar.svg|frameless|2000px]]
12097 !! html/php
12098 <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>
12099 </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>
12100 </p>
12101 !! html/parsoid
12102 <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>
12103 <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>
12104 !! end
12106 !! test
12107 Image: framed images are always unscaled.
12108 !! options
12109 parsoid=wt2html,wt2wt,html2html
12110 !! wikitext
12111 [[File:Foobar.jpg|frame]]
12113 [[File:Foobar.jpg|frame|50px]]
12115 [[File:Foobar.jpg|frame|50x50px]]
12117 [[File:Foobar.jpg|frame|2000px]]
12118 !! html/php
12119 <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>
12120 <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>
12121 <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>
12122 <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>
12124 !! html/parsoid
12125 <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>
12126 <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>
12127 <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>
12128 <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>
12129 !! end
12131 ###################
12133 !! test
12134 Link to image page- image page normally doesn't exists, hence edit link
12135 Add test with existing image page
12136 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12137 !! wikitext
12138 [[:Image:test]]
12139 !! html
12140 <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>
12141 </p>
12142 !! end
12144 !! test
12145 bug 18784  Link to non-existent image page with caption should use caption as link text
12146 !! wikitext
12147 [[:Image:test|caption]]
12148 !! html
12149 <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>
12150 </p>
12151 !! end
12153 !! test
12154 Frameless image caption with a free URL
12155 !! wikitext
12156 [[File:Foobar.jpg|http://example.com]]
12157 !! html/php
12158 <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>
12159 </p>
12160 !! html/parsoid
12161 <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>
12162 !! end
12164 !! test
12165 Thumbnail image caption with a free URL
12166 !! options
12167 thumbsize=220
12168 !! wikitext
12169 [[File:Foobar.jpg|thumb|http://example.com]]
12170 !! html/php
12171 <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>
12173 !! html/parsoid
12174 <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>
12175 !! end
12177 !! test
12178 Thumbnail image caption with a free URL and explicit alt
12179 !! options
12180 thumbsize=220
12181 parsoid=wt2html,wt2wt,html2html
12182 !! wikitext
12183 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12184 !! html/php
12185 <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>
12187 !! html/parsoid
12188 <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>
12189 !! end
12191 !! test
12192 SVG thumbnails with no language set
12193 !! options
12194 !! wikitext
12195 [[File:Foobar.svg|thumb|caption]]
12196 !! html/php
12197 <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>
12199 !! html/parsoid
12200 <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>
12201 !! end
12203 !! test
12204 SVG thumbnails with language de
12205 !! options
12206 parsoid=wt2html,wt2wt,html2html
12207 !! wikitext
12208 [[File:Foobar.svg|thumb|caption|lang=de]]
12209 !! html/php
12210 <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>
12212 !! html/parsoid
12213 <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>
12214 !! end
12216 !! test
12217 SVG thumbnails with invalid language code
12218 !! options
12219 parsoid=wt2html,wt2wt,html2html
12220 !! wikitext
12221 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12222 !! html/php
12223 <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>
12225 !! html/parsoid
12226 <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>
12227 !! end
12229 !! test
12230 BUG 1887: A ISBN with a thumbnail
12231 !! wikitext
12232 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12233 !! html/php
12234 <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>
12236 !! html/parsoid
12237 <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>
12238 !! end
12240 !! test
12241 BUG 1887: A RFC with a thumbnail
12242 !! wikitext
12243 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12244 !! html/php
12245 <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>
12247 !! html/parsoid
12248 <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>
12249 !! end
12251 !! test
12252 BUG 1887: A mailto link with a thumbnail
12253 !! wikitext
12254 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12255 !! html/php
12256 <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>
12258 !! html/parsoid
12259 <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>
12260 !! end
12262 # Pending resolution to bug 368
12263 !! test
12264 BUG 648: Frameless image caption with a link
12265 !! wikitext
12266 [[File:Foobar.jpg|text with a [[link]] in it]]
12267 !! html/php
12268 <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>
12269 </p>
12270 !! html/parsoid
12271 <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>
12272 !! end
12274 !! test
12275 BUG 648: Frameless image caption with a link (suffix)
12276 !! wikitext
12277 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12278 !! html/php
12279 <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>
12280 </p>
12281 !! html/parsoid
12282 <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>
12283 !! end
12285 !! test
12286 BUG 648: Frameless image caption with an interwiki link
12287 !! wikitext
12288 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12289 !! html/php
12290 <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>
12291 </p>
12292 !! html/parsoid
12293 <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>
12294 !! end
12296 !! test
12297 BUG 648: Frameless image caption with a piped interwiki link
12298 !! wikitext
12299 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12300 !! html/php
12301 <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>
12302 </p>
12303 !! html/parsoid
12304 <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>
12305 !! end
12307 !! test
12308 Escape HTML special chars in image alt text
12309 !! wikitext
12310 [[File:Foobar.jpg|& < > "]]
12311 !! html/php
12312 <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>
12313 </p>
12314 !! html/parsoid
12315 <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>
12316 !! end
12318 !! test
12319 BUG 499: Alt text should have &#1234;, not &amp;1234;
12320 !! wikitext
12321 [[File:Foobar.jpg|&#9792;]]
12322 !! html/php
12323 <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>
12324 </p>
12325 !! html/parsoid
12326 <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>
12327 !! end
12329 !! test
12330 Broken image caption with link
12331 !! options
12332 parsoid=wt2html,wt2wt,html2html
12333 !! wikitext
12334 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12335 !! html/php
12336 <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.
12337 </p>
12338 !! html/parsoid
12339 <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>
12340 !! end
12342 !! test
12343 Image caption containing another image
12344 !! wikitext
12345 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12346 !! html/php
12347 <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>
12349 !! html/parsoid
12350 <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>
12351 !! end
12353 !! test
12354 Image: caption containing a newline
12355 !! wikitext
12356 [[File:Foobar.jpg|This
12357 *is some text]]
12358 !! html/php
12359 <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>
12360 </p>
12361 !! html/parsoid
12362 <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>
12363 !!end
12365 !!test
12366 Image: caption containing leading space
12367 (The leading space should not trigger nowiki escaping in wt2wt mode)
12368 !! wikitext
12369 [[File:Foobar.jpg|thumb| bar]]
12370 !! html/php
12371 <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>
12373 !! html/parsoid
12374 <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>
12375 !!end
12377 !! test
12378 Image: caption containing a table
12379 !! options
12380 parsoid=wt2html,wt2wt,html2html
12381 !! wikitext
12382 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12384 ! Foo !! Bar
12386 | Foo1 || Bar1
12388 and some more text.]]
12389 !! html/php
12390 <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>
12392 !! html/parsoid
12393 <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
12394 <table>
12395 <tbody>
12396 <tr><th>Foo </th><th>Bar</th></tr>
12397 <tr>
12398 <td>Foo1 </td>
12399 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12400 !! end
12402 !! test
12403 Bug 3090: External links other than http: in image captions
12404 !! wikitext
12405 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12406 !! html/php
12407 <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>
12409 !! html/parsoid
12410 <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>
12411 !! end
12413 !! test
12414 Custom class
12415 !! options
12416 parsoid=wt2html,wt2wt,html2html
12417 !! wikitext
12418 [[Image:foobar.jpg|a|class=b]]
12419 !! html/php
12420 <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>
12421 </p>
12422 !! html/parsoid
12423 <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>
12424 !! end
12426 !! test
12427 Localized image handling (1).
12428 !! options
12429 parsoid=wt2html,wt2wt,html2html
12430 language=es
12431 !! wikitext
12432 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12433 !! html/php
12434 <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>
12436 !! html/parsoid
12437 <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>
12438 !! end
12440 !! test
12441 Localized image handling (2).
12442 !! options
12443 thumbsize=220
12444 parsoid=wt2html,wt2wt,html2html
12445 language=es
12446 !! wikitext
12447 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12448 !! html/php
12449 <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>
12451 !! html/parsoid
12452 <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>
12453 !! end
12455 !! test
12456 "border", "frameless" and "class" attributes on an image.
12457 !! options
12458 thumbsize=220
12459 parsoid=wt2html,wt2wt,html2html
12460 !! wikitext
12461 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12462 !! html/php
12463 <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>
12464 </p>
12465 !! html/parsoid
12466 <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>
12467 !! end
12469 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12470 !! test
12471 Invalid image attributes (bug 62500)
12472 !! options
12473 thumbsize=220
12474 parsoid=wt2html,wt2wt,html2html
12475 !! wikitext
12476 [[File:Foobar.jpg|thumb|float|left|caption]]
12478 [[File:Foobar.jpg|thumb|righ|caption]]
12480 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12481 !! html/php
12482 <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>
12483 <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>
12484 <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>
12486 !! html/parsoid
12487 <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>
12488 <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>
12489 <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>
12490 !! end
12492 !! article
12493 File:Barfoo.jpg
12494 !! text
12495 #REDIRECT [[File:Barfoo.jpg]]
12496 !! endarticle
12498 # FIXME: Parsoid should run this test -- but we'd need to teach the
12499 # mockAPI about the redirected Barfoo.jpg image.
12500 !! test
12501 Redirected image
12502 !! wikitext
12503 [[Image:Barfoo.jpg]]
12504 !! html/php
12505 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12506 </p>
12507 !! end
12509 !! test
12510 Missing image with uploads disabled
12511 !! options
12512 wgEnableUploads=0
12513 !! wikitext
12514 [[File:Foobaz.jpg]]
12515 !! html/php
12516 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12517 </p>
12518 !! html/parsoid
12519 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
12520 !! end
12522 # Parsoid-specific testing for images
12523 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12524 # Currently imperfect due to a flaw in the Parsoid testrunner
12525 # Work in progress
12526 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12527 # image tests.
12529 !! test
12530 Parsoid-specific image handling - simple image with size and middle alignment
12531 !! wikitext
12532 [[File:Foobar.jpg|middle|50px]]
12533 !! html/parsoid
12534 <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>
12535 !! end
12537 !! test
12538 Parsoid-specific image handling - simple image with size, middle alignment,
12539 non-standard namespace alias
12540 !! options
12541 parsoid=wt2wt,wt2html,html2html
12542 !! wikitext
12543 [[Image:Foobar.jpg|middle|50px]]
12544 !! html/parsoid
12545 <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>
12546 !! end
12548 !! test
12549 Parsoid-specific image handling - simple image with size and middle alignment
12550 (existing content)
12551 !! wikitext
12552 [[File:Foobar.jpg|50px|middle]]
12553 !! html/parsoid
12554 <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>
12555 !! end
12557 !! test
12558 Parsoid-specific image handling - simple image with size and middle alignment
12559 and non-standard namespace name
12560 !! options
12561 parsoid=wt2html,wt2wt,html2html
12562 !! wikitext
12563 [[Image:Foobar.jpg|50px|middle]]
12564 !! html/parsoid
12565 <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>
12566 !! end
12568 !! test
12569 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12570 !! wikitext
12571 [[File:Foobar.jpg|500x10px|baseline|caption]]
12572 !! html/parsoid
12573 <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>
12574 !! end
12576 !! test
12577 Parsoid-specific image handling - simple image with border and size spec
12578 !! wikitext
12579 [[File:Foobar.jpg|50px|border|caption]]
12580 !! html/parsoid
12581 <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>
12582 !! end
12584 !! test
12585 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12586 !! wikitext
12587 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12588 !! html/parsoid
12589 <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>
12590 !! end
12592 !! test
12593 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12594 (existing content)
12595 !! wikitext
12596 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12597 !! html/parsoid
12598 <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>
12599 !! end
12601 !! test
12602 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12603 !! wikitext
12604 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12605 !! html/parsoid
12606 <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>
12607 !! end
12609 !! test
12610 Parsoid-specific image handling - thumbnail with specific size, halign,
12611 valign, and caption (existing content)
12612 !! wikitext
12613 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12614 !! html/parsoid
12615 <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>
12616 !! end
12618 !! test
12619 Parsoid-specific image handling - framed image with specific size and caption
12620 (size is ignored)
12621 !! options
12622 parsoid=wt2html,wt2wt,html2html
12623 !! wikitext
12624 [[File:Foobar.jpg|frame|500x50px|caption]]
12625 !! html/parsoid
12626 <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>
12627 !! end
12629 !! test
12630 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12631 (size is ignored)
12632 !! options
12633 parsoid=wt2html,wt2wt,html2html
12634 !! wikitext
12635 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12636 !! html/parsoid
12637 <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>
12638 !! end
12640 !! test
12641 Parsoid-specific image handling - frameless image with specific size, border, and caption
12642 !! wikitext
12643 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12644 !! html/parsoid
12645 <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>
12646 !! end
12648 !! test
12649 Parsoid-specific image handling - simple image with a formatted caption
12650 !! wikitext
12651 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12652 !! html/parsoid
12653 <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>
12654 !! end
12656 !! test
12657 Parsoid-specific image handling - caption with a template in it
12658 !! wikitext
12659 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12660 !! html/parsoid
12661 <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>
12662 !! end
12664 !! test
12665 Parsoid-specific image handling - caption with unbalanced tags in it
12666 !! options
12667 parsoid=wt2html,wt2wt,html2html
12668 !! wikitext
12670 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12672 !! html/parsoid
12673 <p>foo</p>
12674 <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>
12675 <p>bar</p>
12676 !! end
12678 !! test
12679 Parsoid-specific image handling - empty caption (1)
12680 !! options
12681 parsoid=wt2html,wt2wt
12682 !! wikitext
12683 [[File:Foobar.jpg|thumb|]]
12684 !! html/parsoid
12685 <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>
12686 !! end
12688 # empty captions don't get serialized unless we're in the "round trip" case
12689 !! test
12690 Parsoid-specific image handling - empty caption (2)
12691 !! options
12692 parsoid=html2wt
12693 !! html/parsoid
12694 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12695   <a href="File:Foobar.jpg">
12696     <img resource="./File:Foobar.jpg"
12697          src="//example.com/images/3/3a/Foobar.jpg"
12698          height="25" width="220"/>
12699   </a>
12700   <figcaption></figcaption>
12701 </figure>
12702 !! wikitext
12703 [[File:Foobar.jpg|thumb]]
12704 !! end
12706 !! test
12707 Parsoid-specific image handling - whitespace caption
12708 !! wikitext
12709 [[File:Foobar.jpg|thumb| ]]
12710 !! html/parsoid
12711 <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>
12712 !! end
12714 !! test
12715 Parsoid-specific image handling - lang option
12716 !! wikitext
12718 [[File:Foobar.svg|lang=de|caption]]
12720 !! html/parsoid
12721 <p>foo
12722 <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>
12723 bar</p>
12724 !! end
12728 ### Subpages
12730 !! article
12731 Subpage test/subpage
12732 !! text
12734 !! endarticle
12736 !! test
12737 Subpage link
12738 !! options
12739 subpage title=[[Subpage test]]
12740 !! wikitext
12741 [[/subpage]]
12742 !! html
12743 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12744 </p>
12745 !! end
12747 !! test
12748 Subpage noslash link
12749 !! options
12750 subpage title=[[Subpage test]]
12751 !! wikitext
12752 [[/subpage/]]
12753 !! html
12754 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12755 </p>
12756 !! end
12758 !! article
12759 Subpage test/1/2/subpage
12760 !! text
12761 blah
12762 !! endarticle
12764 !! test
12765 Relative subpage noslash link
12766 !! options
12767 parsoid=wt2wt,wt2html,html2html
12768 subpage title=[[Subpage test/1/2/3/4]]
12769 !! wikitext
12770 [[../../subpage/]]
12772 [[../../subpage]]
12773 !! html/php
12774 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12775 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12776 </p>
12777 !! html/parsoid
12778 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12779 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12780 !! end
12782 !! test
12783 Parsoid: dot-slash prefixed wikilinks
12784 !! wikitext
12785 [[./foo]]
12787 [[././bar]]
12789 [[././baz/]]
12790 !! html/php
12791 <p>[[./foo]]
12792 </p><p>[[././bar]]
12793 </p><p>[[././baz/]]
12794 </p>
12795 !! html/parsoid
12796 <p>[[./foo]]
12797 </p><p>[[././bar]]
12798 </p><p>[[././baz/]]
12799 </p>
12800 !! end
12802 !! test
12803 Render invalid page names as plain text (bug 51090)
12804 !! wikitext
12805 [[./../foo|bar]]
12806 [[foo�|bar]]
12807 [[foo/.|bar]]
12808 [[foo/..|bar]]
12809 [[foo~~~bar]]
12810 [[foo>bar]]
12811 [[foo[bar]]
12812 [[.]]
12813 [[..]]
12814 [[foo././bar]]
12816 [[{{echo|./../foo}}|bar]]
12817 [[{{echo|foo/.}}|bar]]
12818 [[{{echo|foo/..}}|bar]]
12819 [[{{echo|foo~~~~bar}}]]
12820 [[{{echo|foo>bar}}]]
12821 [[{{echo|foo././bar}}]]
12822 [[{{echo|foo{bar}}]]
12823 [[{{echo|foo}bar}}]]
12824 [[{{echo|foo[bar}}]]
12825 [[{{echo|foo]bar}}]]
12826 [[{{echo|foo<bar}}]]
12827 !!html/php
12828 <p>[[./../foo|bar]]
12829 [[foo�|bar]]
12830 [[foo/.|bar]]
12831 [[foo/..|bar]]
12832 [[foo~~~bar]]
12833 [[foo&gt;bar]]
12834 [[foo[bar]]
12835 [[.]]
12836 [[..]]
12837 [[foo././bar]]
12838 </p><p>[[./../foo|bar]]
12839 [[foo/.|bar]]
12840 [[foo/..|bar]]
12841 [[foo~~~~bar]]
12842 [[foo&gt;bar]]
12843 [[foo././bar]]
12844 [[foo{bar]]
12845 [[foo}bar]]
12846 [[foo[bar]]
12847 [[foo]bar]]
12848 [[foo&lt;bar]]
12849 </p>
12850 !!html/parsoid
12851 <p>[[./../foo|bar]]
12852 [[foo�|bar]]
12853 [[foo/.|bar]]
12854 [[foo/..|bar]]
12855 [[foo~~~bar]]
12856 [[foo>bar]]
12857 [[foo[bar]]
12858 [[.]]
12859 [[..]]
12860 [[foo././bar]]</p>
12862 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12863 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12864 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12865 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12866 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12867 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12868 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12869 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12870 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12871 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12872 [[<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>
12873 !!end
12875 !! test
12876 Disabled subpages
12877 !! wikitext
12878 [[/subpage]]
12879 !! html
12880 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12881 </p>
12882 !! end
12884 !! test
12885 BUG 561: {{/Subpage}}
12886 !! options
12887 subpage title=[[Page]]
12888 !! wikitext
12889 {{/Subpage}}
12890 !! html
12891 <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>
12892 </p>
12893 !! end
12896 ### Categories
12898 !! article
12899 Category:MediaWiki User's Guide
12900 !! text
12901 blah
12902 !! endarticle
12904 !! test
12905 Link to category
12906 !! wikitext
12907 [[:Category:MediaWiki User's Guide]]
12908 !! html
12909 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12910 </p>
12911 !! end
12913 !! test
12914 Simple category
12915 !! options
12917 !! wikitext
12918 [[Category:MediaWiki User's Guide]]
12919 !! html
12920 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12921 !! end
12923 !! test
12924 PAGESINCATEGORY invalid title fatal (r33546 fix)
12925 !! wikitext
12926 {{PAGESINCATEGORY:<bogus>}}
12927 !! html
12928 <p>0
12929 </p>
12930 !! end
12932 !! test
12933 Category with different sort key
12934 !! options
12936 !! wikitext
12937 [[Category:MediaWiki User's Guide|Foo]]
12938 !! html
12939 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12940 !! end
12942 !! test
12943 Category with identical sort key
12944 !! options
12946 !! wikitext
12947 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12948 !! html
12949 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12950 !! end
12952 !! test
12953 Category with empty sort key
12954 !! options
12957 !! wikitext
12958 [[Category:MediaWiki User's Guide|]]
12959 !! html
12960 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12961 !! end
12963 !! test
12964 Category with empty sort key and parentheses
12965 !! options
12968 !! wikitext
12969 [[Category:Foo (bar)|]]
12970 !! html
12971 [[Category:Foo (bar)|Foo]]
12972 !! end
12974 !! test
12975 Category with link tail
12976 !! options
12979 !! wikitext
12980 123[[Category:Foo]]456
12981 !! html
12982 123[[Category:Foo]]456
12983 !! end
12985 !! test
12986 Category with template
12987 !! options
12990 !! wikitext
12991 [[Category:{{echo|Foo}}]]
12992 !! html
12993 [[Category:{{echo|Foo}}]]
12994 !! end
12996 !! test
12997 Category with template in sort key
12998 !! options
13001 !! wikitext
13002 [[Category:Foo|{{echo|Bar}}]]
13003 !! html
13004 [[Category:Foo|{{echo|Bar}}]]
13005 !! end
13007 !! test
13008 Category with template in sort key and title
13009 !! options
13012 !! wikitext
13013 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13014 !! html
13015 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13016 !! end
13018 !! test
13019 Category / paragraph interactions
13020 !! wikitext
13021 Foo [[Category:Baz]] Bar
13023 Foo [[Category:Baz]]
13027 [[Category:Baz]]
13031 [[Category:Baz]] Bar
13034 [[Category:Baz]]
13035  [[Category:Baz]]
13036 [[Category:Baz]]
13039 [[Category:Baz]]
13040  [[Category:Baz]]
13041 [[Category:Baz]]
13043 [[Category:Baz]]
13044  {{echo|[[Category:Baz]]}}
13045 [[Category:Baz]]
13046 !! html
13047 <p>Foo Bar
13048 </p><p>Foo
13050 </p><p>Foo
13052 </p><p>Foo Bar
13053 </p><p>Foo
13055 </p>
13056 !! end
13058 !! test
13059 Parsoid: Serialize link to category page with colon escape
13060 !! options
13061 parsoid
13062 !! wikitext
13064 [[:Category:Foo]]
13065 [[:Category:Foo|Bar]]
13066 !! html
13068 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13069 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13070 </p>
13071 !! end
13073 !! test
13074 Parsoid: Link prefix/suffixes aren't applied to category links
13075 !! options
13076 parsoid=wt2html,wt2wt,html2html
13077 language=is
13078 !! wikitext
13079 x[[Category:Foo]]y
13080 !! html
13081 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
13082 !! end
13084 !! test
13085 Parsoid: Serialize link to file page with colon escape
13086 !! options
13087 parsoid
13088 !! wikitext
13090 [[:File:Foo.png]]
13091 [[:File:Foo.png|Bar]]
13092 !! html
13094 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
13095 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
13096 </p>
13097 !! end
13099 !! test
13100 Parsoid: Serialize a genuine category link without colon escape
13101 !! options
13102 parsoid
13103 !! wikitext
13104 [[Category:Foo]]
13105 [[Category:Foo|Bar]]
13106 !! html
13107 <link rel="mw:PageProp/Category" href="Category:Foo">
13108 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
13109 !! end
13111 !! test
13112 Normalize hrefs properly before testing for invalid link targets (bug 70894)
13113 !! options
13114 parsoid=html2wt
13115 !! html
13116 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
13117 !! wikitext
13118 [[Category:Toxine bactérienne]]
13119 !! end
13121 !! test
13122 Parsoid: Defaultsort
13123 !! options
13124 parsoid
13125 !! wikitext
13126 {{DEFAULTSORT:Foo}}
13127 !! html
13128 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
13129 !! end
13132 ### Inter-language links
13134 !! test
13135 Interlanguage links
13136 !! options
13138 !! wikitext
13139 [[es:Alimento]]
13140 [[fr:Nourriture]]
13141 [[zh:食品]]
13142 !! html/php
13143 es:Alimento fr:Nourriture zh:食品
13144 !! html/parsoid
13145 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13146 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13147 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13148 !! end
13150 !! test
13151 Duplicate interlanguage links (bug 24502)
13152 !! options
13154 !! wikitext
13155 [[es:1]]
13156 [[es:2]]
13157 [[fr:1]]
13158 [[fr:2]]
13159 !! html/php
13160 es:1 fr:1
13161 !! html/parsoid
13162 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13163 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13164 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13165 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13166 !! end
13169 ### Sections
13171 !! test
13172 Basic section headings
13173 !! wikitext
13174 == Headline 1 ==
13175 Some text
13177 ==Headline 2==
13178 More
13179 ===Smaller headline===
13180 Blah blah
13181 !! html
13182 <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>
13183 <p>Some text
13184 </p>
13185 <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>
13186 <p>More
13187 </p>
13188 <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>
13189 <p>Blah blah
13190 </p>
13191 !! end
13193 !! test
13194 Section headings with TOC
13195 !! wikitext
13196 == Headline 1 ==
13197 === Subheadline 1 ===
13198 ===== Skipping a level =====
13199 ====== Skipping a level ======
13201 == Headline 2 ==
13202 Some text
13203 ===Another headline===
13204 !! html
13205 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13206 <ul>
13207 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13208 <ul>
13209 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13210 <ul>
13211 <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>
13212 <ul>
13213 <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>
13214 </ul>
13215 </li>
13216 </ul>
13217 </li>
13218 </ul>
13219 </li>
13220 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13221 <ul>
13222 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13223 </ul>
13224 </li>
13225 </ul>
13226 </div>
13228 <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>
13229 <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>
13230 <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>
13231 <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>
13232 <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>
13233 <p>Some text
13234 </p>
13235 <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>
13237 !! end
13239 !! test
13240 TOC anchors don't collide
13241 !! wikitext
13242 __FORCETOC__
13243 == Headline 2 ==
13244 == Headline ==
13245 == Headline 2 ==
13246 == Headline ==
13247 !! html
13248 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13249 <ul>
13250 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
13251 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
13252 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
13253 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
13254 </ul>
13255 </div>
13257 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13258 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13259 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13260 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13262 !! end
13264 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13265 !! test
13266 Handling of sections up to level 6 and beyond
13267 !! wikitext
13268 = Level 1 Heading=
13269 == Level 2 Heading==
13270 === Level 3 Heading===
13271 ==== Level 4 Heading====
13272 ===== Level 5 Heading=====
13273 ====== Level 6 Heading======
13274 ======= Level 7 Heading=======
13275 ======== Level 8 Heading========
13276 ========= Level 9 Heading=========
13277 ========== Level 10 Heading==========
13278 !! html
13279 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13280 <ul>
13281 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13282 <ul>
13283 <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>
13284 <ul>
13285 <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>
13286 <ul>
13287 <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>
13288 <ul>
13289 <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>
13290 <ul>
13291 <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>
13292 <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>
13293 <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>
13294 <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>
13295 <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>
13296 </ul>
13297 </li>
13298 </ul>
13299 </li>
13300 </ul>
13301 </li>
13302 </ul>
13303 </li>
13304 </ul>
13305 </li>
13306 </ul>
13307 </div>
13309 <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>
13310 <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>
13311 <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>
13312 <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>
13313 <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>
13314 <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>
13315 <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>
13316 <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>
13317 <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>
13318 <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>
13320 !! end
13322 !! test
13323 TOC regression (bug 9764)
13324 !! wikitext
13325 == title 1 ==
13326 === title 1.1 ===
13327 ==== title 1.1.1 ====
13328 === title 1.2 ===
13329 == title 2 ==
13330 === title 2.1 ===
13331 !! html
13332 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13333 <ul>
13334 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13335 <ul>
13336 <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>
13337 <ul>
13338 <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>
13339 </ul>
13340 </li>
13341 <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>
13342 </ul>
13343 </li>
13344 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13345 <ul>
13346 <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>
13347 </ul>
13348 </li>
13349 </ul>
13350 </div>
13352 <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>
13353 <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>
13354 <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>
13355 <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>
13356 <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>
13357 <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>
13359 !! end
13361 !! test
13362 TOC with wgMaxTocLevel=3 (bug 6204)
13363 !! options
13364 wgMaxTocLevel=3
13365 !! wikitext
13366 == title 1 ==
13367 === title 1.1 ===
13368 ==== title 1.1.1 ====
13369 === title 1.2 ===
13370 == title 2 ==
13371 === title 2.1 ===
13372 !! html
13373 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13374 <ul>
13375 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13376 <ul>
13377 <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>
13378 <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>
13379 </ul>
13380 </li>
13381 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13382 <ul>
13383 <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>
13384 </ul>
13385 </li>
13386 </ul>
13387 </div>
13389 <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>
13390 <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>
13391 <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>
13392 <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>
13393 <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>
13394 <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>
13396 !! end
13398 !! test
13399 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13400 !! options
13401 wgMaxTocLevel=3
13402 !! wikitext
13403 ==Section 1==
13404 ===Section 1.1===
13405 ====Section 1.1.1====
13406 ====Section 1.1.1.1====
13407 ==Section 2==
13408 !! html
13409 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13410 <ul>
13411 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13412 <ul>
13413 <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>
13414 </ul>
13415 </li>
13416 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13417 </ul>
13418 </div>
13420 <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>
13421 <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>
13422 <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>
13423 <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>
13424 <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>
13426 !! end
13429 !! test
13430 Resolving duplicate section names
13431 !! wikitext
13432 == Foo bar ==
13433 == Foo bar ==
13434 !! html
13435 <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>
13436 <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>
13438 !! end
13440 !! test
13441 Resolving duplicate section names with differing case (bug 10721)
13442 !! wikitext
13443 == Foo bar ==
13444 == Foo Bar ==
13445 !! html
13446 <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>
13447 <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>
13449 !! end
13451 !! article
13452 Template:sections
13453 !! text
13454 ===Section 1===
13455 ==Section 2==
13456 !! endarticle
13458 !! test
13459 Template with sections, __NOTOC__
13460 !! wikitext
13461 __NOTOC__
13462 ==Section 0==
13463 {{sections}}
13464 ==Section 4==
13465 !! html
13466 <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>
13467 <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>
13468 <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>
13469 <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>
13471 !! end
13473 !! test
13474 __NOEDITSECTION__ keyword
13475 !! wikitext
13476 __NOEDITSECTION__
13477 ==Section 1==
13478 ==Section 2==
13479 !! html
13480 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13481 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13483 !! end
13485 !! test
13486 Link inside a section heading
13487 !! wikitext
13488 ==Section with a [[Main Page|link]] in it==
13489 !! html
13490 <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>
13492 !! end
13494 !! test
13495 TOC regression (bug 12077)
13496 !! wikitext
13497 __TOC__
13498 == title 1 ==
13499 === title 1.1 ===
13500 == title 2 ==
13501 !! html
13502 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13503 <ul>
13504 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13505 <ul>
13506 <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>
13507 </ul>
13508 </li>
13509 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13510 </ul>
13511 </div>
13513 <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>
13514 <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>
13515 <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>
13517 !! end
13519 !! test
13520 BUG 1219 URL next to image (good)
13521 !! wikitext
13522 http://example.com [[File:Foobar.jpg]]
13523 !! html/php
13524 <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>
13525 </p>
13526 !! html/parsoid
13527 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
13528 !!end
13530 !! test
13531 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13532 !! wikitext
13533 === 
13534 The line above must have a trailing space!
13535 === <!--
13536 --> <!-- -->
13537 But just in case it doesn't...
13538 !! html
13539 <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>
13540 <p>The line above must have a trailing space!
13541 </p>
13542 <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>
13543 <p>But just in case it doesn't...
13544 </p>
13545 !! end
13547 !! test
13548 Header with special characters (bug 25462)
13549 !! wikitext
13550 The tooltips shall not show entities to the user (ie. be double escaped)
13552 == text > text ==
13553 section 1
13555 == text < text ==
13556 section 2
13558 == text & text ==
13559 section 3
13561 == text ' text ==
13562 section 4
13564 == text " text ==
13565 section 5
13566 !! html
13567 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13568 </p>
13569 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13570 <ul>
13571 <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>
13572 <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>
13573 <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>
13574 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13575 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13576 </ul>
13577 </div>
13579 <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>
13580 <p>section 1
13581 </p>
13582 <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>
13583 <p>section 2
13584 </p>
13585 <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>
13586 <p>section 3
13587 </p>
13588 <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>
13589 <p>section 4
13590 </p>
13591 <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>
13592 <p>section 5
13593 </p>
13594 !! end
13596 !! test
13597 Header with space, plus and underscore as entity
13598 !! wikitext
13599 Id should not contain + for spaces
13601 == Space between Text ==
13602 section 1
13604 == Space-Entity&#32;between&#32;Text ==
13605 section 2
13607 == Plus+between+Text ==
13608 section 3
13610 == Plus-Entity&#43;between&#43;Text ==
13611 section 4
13613 == Underscore_between_Text ==
13614 section 5
13616 == Underscore-Entity&#95;between&#95;Text ==
13617 section 6
13619 [[#Space between Text]]
13620 [[#Space-Entity&#32;between&#32;Text]]
13621 [[#Plus+between+Text]]
13622 [[#Plus-Entity&#43;between&#43;Text]]
13623 [[#Underscore_between_Text]]
13624 [[#Underscore-Entity&#95;between&#95;Text]]
13625 !! html
13626 <p>Id should not contain + for spaces
13627 </p>
13628 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13629 <ul>
13630 <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>
13631 <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>
13632 <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>
13633 <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>
13634 <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>
13635 <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>
13636 </ul>
13637 </div>
13639 <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>
13640 <p>section 1
13641 </p>
13642 <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>
13643 <p>section 2
13644 </p>
13645 <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>
13646 <p>section 3
13647 </p>
13648 <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>
13649 <p>section 4
13650 </p>
13651 <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>
13652 <p>section 5
13653 </p>
13654 <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>
13655 <p>section 6
13656 </p><p><a href="#Space_between_Text">#Space between Text</a>
13657 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13658 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13659 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13660 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13661 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13662 </p>
13663 !! end
13665 !! test
13666 Headers with excess '=' characters
13667 (Are similar tests necessary beyond the 1st level?)
13668 !! wikitext
13669 =foo==
13670 ==foo=
13671 =''italic'' heading==
13672 ==''italic'' heading=
13673 !! html
13674 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13675 <ul>
13676 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13677 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13678 <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>
13679 <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>
13680 </ul>
13681 </div>
13683 <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>
13684 <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>
13685 <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>
13686 <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>
13688 !! end
13690 !! test
13691 HTML headers vs TOC (bug 23393)
13692 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13693 !! wikitext
13694 <h1>Header 1</h1>
13695 == Header 1.1 ==
13696 == Header 1.2 ==
13698 <h1>Header 2
13699 </h1>
13700 == Header 2.1 ==
13701 == Header 2.2 ==
13702 __NOEDITSECTION__
13703 !! html
13704 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13705 <ul>
13706 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13707 <ul>
13708 <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>
13709 <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>
13710 </ul>
13711 </li>
13712 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13713 <ul>
13714 <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>
13715 <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>
13716 </ul>
13717 </li>
13718 </ul>
13719 </div>
13721 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13722 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13723 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13724 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13725 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13726 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13728 !! end
13730 !! test
13731 Single-line or multiline-comments can follow headings
13732 !! options
13733 parsoid=wt2html,wt2wt
13734 !! wikitext
13735 ==foo==<!---->
13736 ==bar==<!--c1-->
13737 ==baz==<!--
13739 c3-->
13740 !! html
13741 <h2><span class="mw-headline" id="foo">foo</span></h2>
13742 <h2><span class="mw-headline" id="bar">bar</span></h2>
13743 <h2><span class="mw-headline" id="baz">baz</span></h2>
13745 !! end
13747 !! test
13748 BUG 1219 URL next to image (broken)
13749 !! wikitext
13750 http://example.com[[File:Foobar.jpg]]
13751 !! html/php
13752 <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>
13753 </p>
13754 !! html/parsoid
13755 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
13756 !!end
13758 !! test
13759 Bug 1186 news: in the middle of text
13760 !! wikitext
13761 http://en.wikinews.org/wiki/Wikinews:Workplace
13762 !! html
13763 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13764 </p>
13765 !!end
13768 !! test
13769 Namespaced link must have a title
13770 !! wikitext
13771 [[Project:]]
13772 !! html
13773 <p>[[Project:]]
13774 </p>
13775 !!end
13777 !! test
13778 Namespaced link must have a title (bad fragment version)
13779 !! wikitext
13780 [[Project:#fragment]]
13781 !! html
13782 <p>[[Project:#fragment]]
13783 </p>
13784 !!end
13788 ### HTML tags and HTML attributes
13791 !! test
13792 div with no attributes
13793 !! wikitext
13794 <div>HTML rocks</div>
13795 !! html
13796 <div>HTML rocks</div>
13798 !! end
13800 !! test
13801 div with double-quoted attribute
13802 !! wikitext
13803 <div id="rock">HTML rocks</div>
13804 !! html
13805 <div id="rock">HTML rocks</div>
13807 !! end
13809 !! test
13810 div with single-quoted attribute
13811 !! wikitext
13812 <div id='rock'>HTML rocks</div>
13813 !! html
13814 <div id="rock">HTML rocks</div>
13816 !! end
13818 !! test
13819 div with unquoted attribute
13820 !! wikitext
13821 <div id=rock>HTML rocks</div>
13822 !! html
13823 <div id="rock">HTML rocks</div>
13825 !! end
13827 !! test
13828 div with illegal double attributes
13829 !! wikitext
13830 <div id="a" id="b">HTML rocks</div>
13831 !! html
13832 <div id="b">HTML rocks</div>
13834 !!end
13836 # FIXME: produce empty string instead of "class" in the PHP parser, following
13837 # the HTML5 spec.
13838 !! test
13839 div with empty attribute value, space before equals
13840 !! options
13841 parsoid
13842 !! wikitext
13843 <div class =>HTML rocks</div>
13844 !! html
13845 <div class="">HTML rocks</div>
13847 !! end
13849 !! test
13850 div with multiple empty attribute values
13851 !! options
13852 parsoid
13853 !! wikitext
13854 <div id= title=>HTML rocks</div>
13855 !! html
13856 <div id="" title="">HTML rocks</div>
13858 !! end
13860 !! test
13861 table with multiple empty attribute values
13862 !! options
13863 parsoid
13864 !! wikitext
13865 {| title= id=
13866 | hi
13868 !! html
13869 <table title="" id="">
13870 <tbody><tr><td> hi</td></tr>
13871 </tbody></table>
13872 !! end
13874 !! test
13875 div with braces in attribute value
13876 !! wikitext
13877 <div title="{}">Foo</div>
13878 !! html/php
13879 <div title="&#123;}">Foo</div>
13881 !! html/parsoid
13882 <div title="{}">Foo</div>
13883 !! end
13885 # This it very inconsistent in the PHP parser: it returns 
13886 # class="class" if there is a space between the name and the equal sign (see
13887 # 'div with empty attribute value, space before equals'), but strips the
13888 # attribute completely if the space is missing. We hope that not much content
13889 # depends on this, so are implementing the behavior below in Parsoid for
13890 # consistencies' sake.
13891 # FIXME: fix this behavior in the PHP parser?
13892 !! test
13893 div with empty attribute value, no space before equals
13894 !! options
13895 parsoid=wt2html,html2html
13896 !! wikitext
13897 <div class=>HTML rocks</div>
13898 !! html/php
13899 <div>HTML rocks</div>
13901 !! html/parsoid
13902 <div class="">HTML rocks</div>
13903 !! end
13905 !! test
13906 HTML multiple attributes correction
13907 !! wikitext
13908 <p class="error" class="awesome">Awesome!</p>
13909 !! html
13910 <p class="awesome">Awesome!</p>
13912 !!end
13914 !! test
13915 Table multiple attributes correction
13916 !! wikitext
13918 !+ class="error" class="awesome"| status
13920 !! html
13921 <table>
13922 <tr>
13923 <th class="awesome"> status
13924 </th></tr></table>
13926 !!end
13928 !! test
13929 DIV IN UPPERCASE
13930 !! wikitext
13931 <DIV ID="x">HTML ROCKS</DIV>
13932 !! html
13933 <div id="x">HTML ROCKS</div>
13935 !!end
13937 !! test
13938 Non-ASCII pseudo-tags are rendered as text
13939 !! wikitext
13940 <khyô>
13941 !! html
13942 <p>&lt;khyô&gt;
13943 </p>
13944 !! end
13946 !! test
13947 Pseudo-tag with URL 'name' renders as url link
13948 !! wikitext
13949 <http://example.com/>
13950 !! html
13951 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13952 </p>
13953 !! end
13955 !! test
13956 text with amp in the middle of nowhere
13957 !! wikitext
13958 Remember AT&T?
13959 !! html
13960 <p>Remember AT&amp;T?
13961 </p>
13962 !! end
13964 !! test
13965 text with character entity: eacute
13966 !! wikitext
13967 I always thought &eacute; was a cute letter.
13968 !! html
13969 <p>I always thought &#233; was a cute letter.
13970 </p>
13971 !! html+tidy
13972 <p>I always thought é was a cute letter.</p>
13973 !! end
13975 !! test
13976 text with entity-escaped character entity-like string: eacute
13977 !! wikitext
13978 I always thought &amp;eacute; was a cute letter.
13979 !! html
13980 <p>I always thought &amp;eacute; was a cute letter.
13981 </p>
13982 !! end
13984 !! test
13985 text with undefined character entity: xacute
13986 !! wikitext
13987 I always thought &xacute; was a cute letter.
13988 !! html
13989 <p>I always thought &amp;xacute; was a cute letter.
13990 </p>
13991 !! end
13993 # TODO: generalize to PHP parser?
13994 !! test
13995 HTML5 tags
13996 !! options
13997 parsoid
13998 !! wikitext
13999 <data value="5">five</data>
14000 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14001 <mark>This highlighted text</mark>
14002 !! html
14003 <p><data value="5">five</data>
14004 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14005 <mark>This highlighted text</mark></p>
14006 !! end
14008 !! test
14009 HTML tag with leading space is parsed as text
14010 !! wikitext
14011 < div>foo< /div>
14012 !! html
14013 <p>&lt; div&gt;foo&lt; /div&gt;
14014 </p>
14015 !! end
14018 ### Nesting tests (see bug 41545, 50604, 51081)
14021 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14022 # Note that html2wt is considerably more difficult if we use <b> in
14023 # the test case, instead of <big>
14024 !! test
14025 Ensure that HTML adoption agency algorithm is properly implemented.
14026 !! wikitext
14027 <big>X<big>Y</big>Z</big>
14028 !! html
14029 <p><big>X<big>Y</big>Z</big>
14030 </p>
14031 !! end
14033 # This was bug 41545 in the PHP parser.
14034 # Note that tidy doesn't handle this correctly.
14035 !! test
14036 Nesting of <kbd>
14037 !! wikitext
14038 <kbd>X<kbd>Y</kbd>Z</kbd>
14039 !! html
14040 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14041 </p>
14042 !! end
14044 # The following cases were bug 51081 in the PHP parser.
14045 # Note that there are some other nestable tags (b, i, etc) which are
14046 # not covered; see bug 51081 for discussion.
14048 # Note that tidy doesn't handle this correctly.
14049 !! test
14050 Nesting of <em>
14051 !! wikitext
14052 <em>X<em>Y</em>Z</em>
14053 !! html
14054 <p><em>X<em>Y</em>Z</em>
14055 </p>
14056 !! end
14058 # Note that tidy doesn't handle this correctly.
14059 !! test
14060 Nesting of <strong>
14061 !! wikitext
14062 <strong>X<strong>Y</strong>Z</strong>
14063 !! html
14064 <p><strong>X<strong>Y</strong>Z</strong>
14065 </p>
14066 !! end
14068 !! test
14069 Nesting of <q>
14070 !! wikitext
14071 <q>X<q>Y</q>Z</q>
14072 !! html+tidy
14073 <p><q>X<q>Y</q>Z</q></p>
14074 !! end
14076 # Note that tidy doesn't handle this correctly.
14077 !! test
14078 Nesting of <ruby>
14079 !! wikitext
14080 <ruby>X<ruby>Y</ruby>Z</ruby>
14081 !! html
14082 <p><ruby>X<ruby>Y</ruby>Z</ruby>
14083 </p>
14084 !! end
14086 # Note that tidy doesn't handle this correctly.
14087 !! test
14088 Nesting of <bdo>
14089 !! wikitext
14090 <bdo>X<bdo>Y</bdo>Z</bdo>
14091 !! html
14092 <p><bdo>X<bdo>Y</bdo>Z</bdo>
14093 </p>
14094 !! end
14098 ### Media links
14101 !! test
14102 Media link
14103 !! wikitext
14104 [[Media:Foobar.jpg]]
14105 !! html
14106 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
14107 </p>
14108 !! end
14110 !! test
14111 Media link with text
14112 !! wikitext
14113 [[Media:Foobar.jpg|A neat file to look at]]
14114 !! html
14115 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
14116 </p>
14117 !! end
14119 # FIXME: this is still bad HTML tag nesting
14120 !! test
14121 Media link with nasty text
14122 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
14123 !! wikitext
14124 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
14125 !! html
14126 <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>
14128 !! html+tidy
14129 <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>
14130 !! end
14132 !! test
14133 Media link to nonexistent file (bug 1702)
14134 !! wikitext
14135 [[Media:No such.jpg]]
14136 !! html
14137 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
14138 </p>
14139 !! end
14141 !! test
14142 Image link to nonexistent file (bug 1850 - good)
14143 !! wikitext
14144 [[File:No_such.jpg]]
14145 !! html/php
14146 <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>
14147 </p>
14148 !! html/parsoid
14149 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
14150 !! end
14152 !! test
14153 :Image link to nonexistent file (bug 1850 - bad)
14154 !! wikitext
14155 [[:Image:No such.jpg]]
14156 !! html/php
14157 <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>
14158 </p>
14159 !! html/parsoid
14160 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
14161 !! end
14165 !! test
14166 Character reference normalization in link text (bug 1938)
14167 !! wikitext
14168 [[Main Page|this&that]]
14169 !! html
14170 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
14171 </p>
14172 !!end
14174 !! article
14175 אַ
14176 !! text
14177 Test for unicode normalization
14179 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14180 !! endarticle
14182 !! test
14183 (bug 19451) Links should refer to the normalized form.
14184 !! wikitext
14185 [[&#xFB2E;]]
14186 [[&#x5d0;&#x5b7;]]
14187 [[&#x5d0;ַ]]
14188 [[א&#x5b7;]]
14189 [[אַ]]
14190 !! html
14191 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14192 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14193 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14194 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14195 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14196 </p>
14197 !! end
14199 !! test
14200 Empty attribute crash test (bug 2067)
14201 !! wikitext
14202 <font color="">foo</font>
14203 !! html
14204 <p><font color="">foo</font>
14205 </p>
14206 !! end
14208 !! test
14209 Empty attribute crash test single-quotes (bug 2067)
14210 !! wikitext
14211 <font color=''>foo</font>
14212 !! html
14213 <p><font color="">foo</font>
14214 </p>
14215 !! end
14217 !! test
14218 Attribute test: equals, then nothing
14219 !! wikitext
14220 <font color=>foo</font>
14221 !! html
14222 <p><font>foo</font>
14223 </p>
14224 !! end
14226 !! test
14227 Attribute test: unquoted value
14228 !! wikitext
14229 <font color=x>foo</font>
14230 !! html
14231 <p><font color="x">foo</font>
14232 </p>
14233 !! end
14235 !! test
14236 Attribute test: unquoted but illegal value (hash)
14237 !! wikitext
14238 <font color=#x>foo</font>
14239 !! html
14240 <p><font color="#x">foo</font>
14241 </p>
14242 !! end
14244 !! test
14245 Attribute test: no value
14246 !! wikitext
14247 <font color>foo</font>
14248 !! html
14249 <p><font color="color">foo</font>
14250 </p>
14251 !! end
14253 !! test
14254 Bug 2095: link with three closing brackets
14255 !! wikitext
14256 [[Main Page]]]
14257 !! html/php
14258 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14259 </p>
14260 !! html/parsoid
14261 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14262 !! end
14264 !! test
14265 Bug 2095: link with pipe and three closing brackets
14266 !! wikitext
14267 [[Main Page|link]]]
14268 !! html/php
14269 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14270 </p>
14271 !! html/parsoid
14272 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14273 !! end
14275 !! test
14276 Bug 2095: link with pipe and three closing brackets, version 2
14277 !! wikitext
14278 [[Main Page|[http://example.com/]]]
14279 !! html/php
14280 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14281 </p>
14282 !! html/parsoid
14283 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14284 !! end
14288 ### Safety
14291 !! article
14292 Template:Dangerous attribute
14293 !! text
14294 " onmouseover="alert(document.cookie)
14295 !! endarticle
14297 !! article
14298 Template:Dangerous style attribute
14299 !! text
14300 border-size: expression(alert(document.cookie))
14301 !! endarticle
14303 !! article
14304 Template:Div style
14305 !! text
14306 <div style="float: right; {{{1}}}">Magic div</div>
14307 !! endarticle
14309 !! test
14310 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14311 !! wikitext
14312 <div title="{{test}}"></div>
14313 !! html
14314 <div title="This is a test template"></div>
14316 !! end
14318 # Parsoid has enough context to handle this case
14319 !! test
14320 Bug 2304: HTML attribute safety (dangerous template; 2309)
14321 !! wikitext
14322 <div title="{{dangerous attribute}}"></div>
14323 !! html/php
14324 <div title=""></div>
14326 !! html/parsoid
14327 <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>
14328 !! end
14330 !! test
14331 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14332 !! wikitext
14333 <div style="{{dangerous style attribute}}"></div>
14334 !! html
14335 <div style="/* insecure input */"></div>
14337 !! end
14339 !! test
14340 Bug 2304: HTML attribute safety (safe parameter; 2309)
14341 !! wikitext
14342 {{div style|width: 200px}}
14343 !! html
14344 <div style="float: right; width: 200px">Magic div</div>
14346 !! end
14348 !! test
14349 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14350 !! wikitext
14351 {{div style|width: expression(alert(document.cookie))}}
14352 !! html
14353 <div style="/* insecure input */">Magic div</div>
14355 !! end
14357 !! test
14358 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14359 !! wikitext
14360 {{div style|"><script>alert(document.cookie)</script>}}
14361 !! html
14362 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14364 !! end
14366 !! test
14367 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14368 !! wikitext
14369 {{div style|" ><script>alert(document.cookie)</script>}}
14370 !! html
14371 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14373 !! end
14375 !! test
14376 Bug 2304: HTML attribute safety (link)
14377 !! wikitext
14378 <div title="[[Main Page]]"></div>
14379 !! html
14380 <div title="&#91;&#91;Main Page]]"></div>
14382 !! end
14384 !! test
14385 Bug 2304: HTML attribute safety (italics)
14386 !! wikitext
14387 <div title="''foobar''"></div>
14388 !! html
14389 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14391 !! end
14393 !! test
14394 Bug 2304: HTML attribute safety (bold)
14395 !! wikitext
14396 <div title="'''foobar'''"></div>
14397 !! html
14398 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14400 !! end
14403 !! test
14404 Bug 2304: HTML attribute safety (ISBN)
14405 !! wikitext
14406 <div title="ISBN 1234567890"></div>
14407 !! html
14408 <div title="&#73;SBN 1234567890"></div>
14410 !! end
14412 !! test
14413 Bug 2304: HTML attribute safety (RFC)
14414 !! wikitext
14415 <div title="RFC 1234"></div>
14416 !! html
14417 <div title="&#82;FC 1234"></div>
14419 !! end
14421 !! test
14422 Bug 2304: HTML attribute safety (PMID)
14423 !! wikitext
14424 <div title="PMID 1234567890"></div>
14425 !! html
14426 <div title="&#80;MID 1234567890"></div>
14428 !! end
14430 !! test
14431 Bug 2304: HTML attribute safety (web link)
14432 !! wikitext
14433 <div title="http://example.com/"></div>
14434 !! html
14435 <div title="http&#58;//example.com/"></div>
14437 !! end
14439 !! test
14440 Bug 2304: HTML attribute safety (named web link)
14441 !! wikitext
14442 <div title="[http://example.com/ link]"></div>
14443 !! html
14444 <div title="&#91;http&#58;//example.com/ link]"></div>
14446 !! end
14448 !! test
14449 Bug 3244: HTML attribute safety (extension; safe)
14450 !! wikitext
14451 <div style="<nowiki>background:blue</nowiki>"></div>
14452 !! html
14453 <div style="background:blue"></div>
14455 !! end
14457 !! test
14458 Bug 3244: HTML attribute safety (extension; unsafe)
14459 !! wikitext
14460 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14461 !! html
14462 <div style="/* insecure input */"></div>
14464 !! end
14466 # More MSIE fun discovered by Tom Gilder
14468 !! test
14469 MSIE CSS safety test: spurious slash
14470 !! wikitext
14471 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14472 !! html
14473 <div style="/* insecure input */">evil</div>
14475 !! end
14477 !! test
14478 MSIE CSS safety test: hex code
14479 !! wikitext
14480 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14481 !! html
14482 <div style="/* insecure input */">evil</div>
14484 !! end
14486 !! test
14487 MSIE CSS safety test: comment in url
14488 !! wikitext
14489 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14490 !! html
14491 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14493 !! end
14495 !! test
14496 MSIE CSS safety test: comment in expression
14497 !! wikitext
14498 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14499 !! html
14500 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14502 !! end
14504 !! test
14505 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14506 !! wikitext
14507 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14508 !! html
14509 <p style="/* invalid control char */">A</p>
14511 !! end
14513 !! test
14514 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14515 !! wikitext
14516 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14517 <div style="top:EXPRESSION(alert())">B</div>
14518 !! html
14519 <p style="/* insecure input */">A</p>
14520 <div style="/* insecure input */">B</div>
14522 !! end
14524 !! test
14525 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14526 !! wikitext
14527 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14528 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14529 !! html
14530 <div style="/* insecure input */">A</div>
14531 <p style="/* insecure input */">B</p>
14533 !! end
14535 !! test
14536 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14537 !! wikitext
14538 <div style="background-image:url⁽javascript:alert())">A</div>
14539 <div style="background-image:url₍javascript:alert())">B</div>
14540 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14541 !! html
14542 <div style="/* insecure input */">A</div>
14543 <div style="/* insecure input */">B</div>
14544 <p style="/* insecure input */">C</p>
14546 !! end
14548 !! test
14549 Opera -o-link CSS
14550 !! wikitext
14551 <div
14552 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;"
14553 style="-o-link:attr(title);-o-link-source:current">X</div>
14554 !! html
14555 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14557 !! end
14559 !! test
14560 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14561 !! wikitext
14562 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14563 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14564 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14565 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14566 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14567 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14568 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14569 !! html
14570 <p style="/* insecure input */">A</p>
14571 <p style="/* insecure input */">B</p>
14572 <p style="/* insecure input */">C</p>
14573 <p style="/* insecure input */">D</p>
14574 <p style="/* insecure input */">E</p>
14575 <p style="/* insecure input */">F</p>
14576 <p style="/* insecure input */">G</p>
14578 !! end
14580 !! test
14581 Table attribute legitimate extension
14582 !! wikitext
14584 !+ style="<nowiki>color:blue</nowiki>"| status
14586 !! html
14587 <table>
14588 <tr>
14589 <th style="color:blue"> status
14590 </th></tr></table>
14592 !!end
14594 !! test
14595 Table attribute safety
14596 !! wikitext
14598 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14600 !! html
14601 <table>
14602 <tr>
14603 <th style="/* insecure input */"> status
14604 </th></tr></table>
14606 !! end
14608 !! test
14609 CSS line continuation 1
14610 !! wikitext
14611 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14612 !! html
14613 <div style="/* insecure input */"></div>
14615 !! end
14617 !! test
14618 CSS line continuation 2
14619 !! wikitext
14620 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14621 !! html
14622 <div style="/* insecure input */"></div>
14624 !! end
14626 !! article
14627 Template:Identity
14628 !! text
14629 {{{1}}}
14630 !! endarticle
14632 !! test
14633 Expansion of multi-line templates in attribute values (bug 6255)
14634 !! wikitext
14635 <div style="background: {{identity|#00FF00}}">-</div>
14636 !! html
14637 <div style="background: #00FF00">-</div>
14639 !! end
14642 !! test
14643 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14644 !! wikitext
14645 <div style="background: 
14646 #00FF00">-</div>
14647 !! html/php
14648 <div style="background: #00FF00">-</div>
14650 !! html/parsoid
14651 <div style="background: 
14652 #00FF00">-</div>
14653 !! end
14655 !! test
14656 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14657 !! wikitext
14658 <div style="background: &#10;#00FF00">-</div>
14659 !! html
14660 <div style="background: &#10;#00FF00">-</div>
14662 !! end
14664 !! test
14665 evil <math>-wiki-tags without Extension:Math enabled
14666 !! wikitext
14667 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14668 !! html+tidy
14669 <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>
14670 !! end
14673 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14675 !! test
14676 Parser hook: empty input
14677 !! wikitext
14678 <tag></tag>
14679 !! html
14680 <pre>
14682 array (
14684 </pre>
14686 !! end
14688 !! test
14689 Parser hook: empty input using terminated empty elements
14690 !! wikitext
14691 <tag/>
14692 !! html
14693 <pre>
14694 NULL
14695 array (
14697 </pre>
14699 !! end
14701 !! test
14702 Parser hook: empty input using terminated empty elements (space before)
14703 !! wikitext
14704 <tag />
14705 !! html
14706 <pre>
14707 NULL
14708 array (
14710 </pre>
14712 !! end
14714 !! test
14715 Parser hook: basic input
14716 !! wikitext
14717 <tag>input</tag>
14718 !! html
14719 <pre>
14720 'input'
14721 array (
14723 </pre>
14725 !! end
14728 !! test
14729 Parser hook: case insensitive
14730 !! wikitext
14731 <TAG>input</TAG>
14732 !! html
14733 <pre>
14734 'input'
14735 array (
14737 </pre>
14739 !! end
14742 !! test
14743 Parser hook: case insensitive, redux
14744 !! wikitext
14745 <TaG>input</TAg>
14746 !! html
14747 <pre>
14748 'input'
14749 array (
14751 </pre>
14753 !! end
14755 !! test
14756 Parser hook: nested tags
14757 !! options
14758 noxml
14759 !! wikitext
14760 <tag><tag></tag></tag>
14761 !! html
14762 <pre>
14763 '<tag>'
14764 array (
14766 </pre>&lt;/tag&gt;
14768 !! end
14770 !! test
14771 Parser hook: basic arguments
14772 !! wikitext
14773 <tag width=200 height = "100" depth = '50' square></tag>
14774 !! html
14775 <pre>
14777 array (
14778   'width' => '200',
14779   'height' => '100',
14780   'depth' => '50',
14781   'square' => 'square',
14783 </pre>
14785 !! end
14787 !! test
14788 Parser hook: argument containing a forward slash (bug 5344)
14789 !! wikitext
14790 <tag filename='/tmp/bla'></tag>
14791 !! html
14792 <pre>
14794 array (
14795   'filename' => '/tmp/bla',
14797 </pre>
14799 !! end
14801 !! test
14802 Parser hook: empty input using terminated empty elements (bug 2374)
14803 !! wikitext
14804 <tag foo=bar/>text
14805 !! html
14806 <pre>
14807 NULL
14808 array (
14809   'foo' => 'bar',
14811 </pre>text
14813 !! end
14815 # </tag> should be output literally since there is no matching tag that begins it
14816 !! test
14817 Parser hook: basic arguments using terminated empty elements (bug 2374)
14818 !! wikitext
14819 <tag width=200 height = "100" depth = '50' square/>
14820 other stuff
14821 </tag>
14822 !! html
14823 <pre>
14824 NULL
14825 array (
14826   'width' => '200',
14827   'height' => '100',
14828   'depth' => '50',
14829   'square' => 'square',
14831 </pre>
14832 <p>other stuff
14833 &lt;/tag&gt;
14834 </p>
14835 !! end
14838 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14841 !! test
14842 Parser hook: static parser hook not inside a comment
14843 !! wikitext
14844 <statictag>hello, world</statictag>
14845 <statictag action=flush/>
14846 !! html
14847 <p>hello, world
14848 </p>
14849 !! end
14852 !! test
14853 Parser hook: static parser hook inside a comment
14854 !! wikitext
14855 <!-- <statictag>hello, world</statictag> -->
14856 <statictag action=flush/>
14857 !! html
14858 <p><br />
14859 </p>
14860 !! end
14862 # Nested template calls; this case was broken by Parser.php rev 1.506,
14863 # since reverted.
14865 !! article
14866 Template:One-parameter
14867 !! text
14868 (My parameter is: {{{1}}})
14869 !! endarticle
14871 !! article
14872 Template:Map-one-parameter
14873 !! text
14874 {{{{{1}}}|{{{2}}}}}
14875 !! endarticle
14877 !! test
14878 Nested template calls
14879 !! wikitext
14880 {{Map-one-parameter|One-parameter|param}}
14881 !! html
14882 <p>(My parameter is: param)
14883 </p>
14884 !! end
14888 ### Sanitizer
14891 # HTML+Tidy effectively strips out the empty tags completely
14892 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14893 # which Tidy would have done for the PHP parser had there been content inside it.
14894 !! test
14895 Sanitizer: Closing of open tags
14896 !! wikitext
14897 <s></s><table></table>
14898 !! html
14899 <s></s><table></table>
14901 !! html/parsoid
14902 <p><s></s></p><table></table>
14903 !! end
14905 !! test
14906 Sanitizer: Closing of open but not closed tags
14907 !! wikitext
14908 <s>foo
14909 !! html
14910 <p><s>foo</s>
14911 </p>
14912 !! end
14914 !! test
14915 Sanitizer: Closing of closed but not open tags
14916 !! wikitext
14917 </s>
14918 !! html
14919 <p>&lt;/s&gt;
14920 </p>
14921 !! end
14923 !! test
14924 Sanitizer: Closing of closed but not open table tags
14925 !! wikitext
14926 Table not started</td></tr></table>
14927 !! html
14928 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14929 </p>
14930 !! end
14932 !! test
14933 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14934 !! wikitext
14935 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14936 !! html
14937 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14938 </p>
14939 !! end
14941 # In HTML5, the restrictions are that id must contain at least one character,
14942 # and must not contain any space characters.
14943 !! test
14944 Sanitizer: Validating the contents of the id attribute (bug 4515)
14945 !! options
14946 disabled
14947 !! wikitext
14948 <br id="" /><br id="a space" />
14949 !! html
14950 Something ...
14951 !! end
14953 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14954 !! test
14955 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14956 !! options
14957 disabled
14958 !! wikitext
14959 <br id="foo" /><br id="foo" />
14960 !! html
14961 Something need to be done. foo-2 ? 
14962 !! end
14964 !! test
14965 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14966 !! wikitext
14967 <div itemscope>
14968         <meta itemprop="hello" content="world">
14969         <meta http-equiv="refresh" content="5">
14970         <meta itemprop="hello" http-equiv="refresh" content="5">
14971         <link itemprop="hello" href="{{SERVER}}">
14972         <link rel="stylesheet" href="{{SERVER}}">
14973         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14974 </div>
14975 !! html
14976 <div itemscope="itemscope">
14977 <p>     <meta itemprop="hello" content="world" />
14978         &lt;meta http-equiv="refresh" content="5"&gt;
14979         <meta itemprop="hello" content="5" />
14980 </p>
14981         <link itemprop="hello" href="http&#58;//example.org" />
14982         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14983         <link itemprop="hello" href="http&#58;//example.org" />
14984 </div>
14986 !! end
14988 !! test
14989 Language converter: output gets cut off unexpectedly (bug 5757)
14990 !! options
14991 language=zh
14992 !! wikitext
14993 this bit is safe: }-
14995 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14997 then we get cut off here: }-
14999 all additional text is vanished
15000 !! html
15001 <p>this bit is safe: }-
15002 </p><p>but if we add a conversion instance: xxx
15003 </p><p>then we get cut off here: }-
15004 </p><p>all additional text is vanished
15005 </p>
15006 !! end
15008 !! test
15009 Self closed html pairs (bug 5487)
15010 !! options
15011 !! wikitext
15012 <center><font id="bug" />Centered text</center>
15013 <div><font id="bug2" />In div text</div>
15014 !! html
15015 <center>&lt;font id="bug" /&gt;Centered text</center>
15016 <div>&lt;font id="bug2" /&gt;In div text</div>
15018 !! end
15024 !! test
15025 Punctuation: nbsp before exclamation
15026 !! wikitext
15027 C'est grave !
15028 !! html
15029 <p>C'est grave&#160;!
15030 </p>
15031 !! end
15033 !! test
15034 Punctuation: CSS !important (bug 11874)
15035 !! wikitext
15036 <div style="width:50% !important">important</div>
15037 !! html
15038 <div style="width:50% !important">important</div>
15040 !!end
15042 !! test
15043 Punctuation: CSS ! important (bug 11874; with space after)
15044 !! wikitext
15045 <div style="width:50% ! important">important</div>
15046 !! html
15047 <div style="width:50% ! important">important</div>
15049 !!end
15051 !! test
15052 HTML bullet list, closed tags (bug 5497)
15053 !! wikitext
15054 <ul>
15055 <li>One</li>
15056 <li>Two</li>
15057 </ul>
15058 !! html/php
15059 <ul>
15060 <li>One</li>
15061 <li>Two</li>
15062 </ul>
15064 !! html/parsoid
15065 <ul data-parsoid='{"stx":"html"}'>
15066 <li data-parsoid='{"stx":"html"}'>One</li>
15067 <li data-parsoid='{"stx":"html"}'>Two</li>
15068 </ul>
15070 !! end
15072 !! test
15073 HTML bullet list, unclosed tags (bug 5497)
15074 !! wikitext
15075 <ul>
15076 <li>One
15077 <li>Two
15078 </ul>
15079 !! html/php+tidy
15080 <ul>
15081 <li>One</li>
15082 <li>Two</li>
15083 </ul>
15084 !! html/parsoid
15085 <ul data-parsoid='{"stx":"html"}'>
15086 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15087 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15088 </ul>
15090 !! end
15092 !! test
15093 HTML ordered list, closed tags (bug 5497)
15094 !! wikitext
15095 <ol>
15096 <li>One</li>
15097 <li>Two</li>
15098 </ol>
15099 !! html/php
15100 <ol>
15101 <li>One</li>
15102 <li>Two</li>
15103 </ol>
15105 !! html/parsoid
15106 <ol data-parsoid='{"stx":"html"}'>
15107 <li data-parsoid='{"stx":"html"}'>One</li>
15108 <li data-parsoid='{"stx":"html"}'>Two</li>
15109 </ol>
15111 !! end
15113 !! test
15114 HTML ordered list, unclosed tags (bug 5497)
15115 !! options
15116 !! wikitext
15117 <ol>
15118 <li>One
15119 <li>Two
15120 </ol>
15121 !! html/php+tidy
15122 <ol>
15123 <li>One</li>
15124 <li>Two</li>
15125 </ol>
15126 !! html/parsoid
15127 <ol data-parsoid='{"stx":"html"}'>
15128 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
15129 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
15130 </ol>
15132 !! end
15134 !! test
15135 HTML nested bullet list, closed tags (bug 5497)
15136 !! wikitext
15137 <ul>
15138 <li>One</li>
15139 <li>Two:
15140 <ul>
15141 <li>Sub-one</li>
15142 <li>Sub-two</li>
15143 </ul>
15144 </li>
15145 </ul>
15146 !! html
15147 <ul>
15148 <li>One</li>
15149 <li>Two:
15150 <ul>
15151 <li>Sub-one</li>
15152 <li>Sub-two</li>
15153 </ul>
15154 </li>
15155 </ul>
15157 !! end
15159 !! test
15160 HTML nested bullet list, open tags (bug 5497)
15161 !! wikitext
15162 <ul>
15163 <li>One
15164 <li>Two:
15165 <ul>
15166 <li>Sub-one
15167 <li>Sub-two
15168 </ul>
15169 </ul>
15170 !! html/php+tidy
15171 <ul>
15172 <li>One</li>
15173 <li>Two:
15174 <ul>
15175 <li>Sub-one</li>
15176 <li>Sub-two</li>
15177 </ul>
15178 </li>
15179 </ul>
15180 !! html/parsoid
15181 <ul>
15182 <li>One
15183 </li>
15184 <li>Two:
15185 <ul>
15186 <li>Sub-one
15187 </li>
15188 <li>Sub-two
15189 </li>
15190 </ul>
15191 </li>
15192 </ul>
15194 !! end
15196 !! test
15197 HTML nested ordered list, closed tags (bug 5497)
15198 !! wikitext
15199 <ol>
15200 <li>One</li>
15201 <li>Two:
15202 <ol>
15203 <li>Sub-one</li>
15204 <li>Sub-two</li>
15205 </ol>
15206 </li>
15207 </ol>
15208 !! html
15209 <ol>
15210 <li>One</li>
15211 <li>Two:
15212 <ol>
15213 <li>Sub-one</li>
15214 <li>Sub-two</li>
15215 </ol>
15216 </li>
15217 </ol>
15219 !! end
15221 !! test
15222 HTML nested ordered list, open tags (bug 5497)
15223 !! wikitext
15224 <ol>
15225 <li>One
15226 <li>Two:
15227 <ol>
15228 <li>Sub-one
15229 <li>Sub-two
15230 </ol>
15231 </ol>
15232 !! html/php
15233 <ol>
15234 <li>One
15235 <li>Two:
15236 <ol>
15237 <li>Sub-one
15238 <li>Sub-two
15239 </ol>
15240 </ol>
15242 !! html/parsoid
15243 <ol>
15244 <li>One
15245 </li>
15246 <li>Two:
15247 <ol>
15248 <li>Sub-one
15249 </li>
15250 <li>Sub-two
15251 </li>
15252 </ol>
15253 </li>
15254 </ol>
15256 !! end
15258 !! test
15259 HTML ordered list item with parameters oddity
15260 !! wikitext
15261 <ol><li id="fragment">One</li>
15262 </ol>
15263 !! html
15264 <ol><li id="fragment">One</li>
15265 </ol>
15267 !! end
15269 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15270 !!test
15271 bug 5918: autonumbering
15272 !! wikitext
15273 [http://first/] [http://second] [ftp://ftp]
15275 ftp://inlineftp
15277 [mailto:enclosed@mail.tld With target]
15279 [mailto:enclosed@mail.tld]
15281 mailto:inline@mail.tld
15282 !! html/php
15283 <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>
15284 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15285 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15286 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15287 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15288 </p>
15289 !! html/parsoid
15290 <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>
15291 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15292 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15293 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15294 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15295 !! end
15299 # Security and HTML correctness
15300 # From Nick Jenkins' fuzz testing
15303 !! test
15304 Fuzz testing: Parser13
15305 !! wikitext
15306 {| 
15307 | http://a|
15308 !! html
15309 <table>
15310 <tr>
15311 <td>
15312 </td>
15313 </tr>
15314 </table>
15316 !! end
15318 !! test
15319 Fuzz testing: Parser14
15320 !! wikitext
15321 == onmouseover= ==
15322 http://__TOC__
15323 !! html
15324 <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>
15325 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15326 <ul>
15327 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15328 </ul>
15329 </div>
15332 !! html+tidy
15333 <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>
15334 <p>http://</p>
15335 <div id="toc" class="toc">
15336 <div id="toctitle">
15337 <h2>Contents</h2>
15338 </div>
15339 <ul>
15340 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15341 </ul>
15342 </div>
15343 !! end
15345 !! test
15346 Fuzz testing: Parser14-table
15347 !! wikitext
15348 ==a==
15349 {| STYLE=__TOC__
15350 !! html
15351 <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>
15352 <table style="&#95;_TOC&#95;_">
15353 <tr><td></td></tr>
15354 </table>
15356 !! html+tidy
15357 <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>
15358 <table style="__TOC__">
15359 <tr>
15360 <td></td>
15361 </tr>
15362 </table>
15363 !! end
15365 # Known to produce bogus xml (extra </td>)
15366 !! test
15367 Fuzz testing: Parser16
15368 !! options
15369 noxml
15370 !! wikitext
15372 !https://||||||
15373 !! html
15374 <table>
15375 <tr>
15376 <th>https://</th>
15377 <th></th>
15378 <th></th>
15379 <th>
15380 </td>
15381 </tr>
15382 </table>
15384 !! html+tidy
15385 <table>
15386 <tr>
15387 <th>https://</th>
15388 <th></th>
15389 <th></th>
15390 <th></th>
15391 </tr>
15392 </table>
15393 !! end
15395 !! test
15396 Fuzz testing: Parser21
15397 !! wikitext
15399 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15401 !! html
15402 <table>
15403 <tr>
15404 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15405 </th>
15406 <td>
15407 </td>
15408 </tr>
15409 </table>
15411 !! end
15413 !! test
15414 Fuzz testing: Parser22
15415 !! wikitext
15416 http://===r:::https://b
15419 !! html
15420 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15421 </p>
15422 <table>
15423 <tr><td></td></tr>
15424 </table>
15426 !! end
15428 # Known to produce bad XML for now
15429 !! test
15430 Fuzz testing: Parser24
15431 !! options
15432 noxml
15433 !! wikitext
15435 {{{|
15436 <u CLASS=
15437 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15438 <br style="onmouseover='alert(document.cookie);' " />
15440 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15442 !! html
15443 <table>
15444 {{{|
15445 <u class="&#124;">}}}} &gt;
15446 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15448 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15449 <tr>
15450 <td></u>
15451 </td>
15452 </tr>
15453 </table>
15455 !! end
15457 # Note: the current result listed for this is not what the original one was,
15458 # but the original bug was JavaScript injection, which is fixed in any case.
15459 # It's not clear that the original result listed was any more correct than the
15460 # current one.  Original result:
15461 # <p>{{{| 
15462 # </p>
15463 # <li class="&#124;&#124;">
15464 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15465 !!test
15466 Fuzz testing: Parser25 (bug 6055)
15467 !! wikitext
15470 <LI CLASS=||
15472 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15473 !! html
15474 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15475 </p>
15476 !! end
15478 !!test
15479 Fuzz testing: URL adjacent extension (with space, clean)
15480 !! wikitext
15481 http://example.com <nowiki>junk</nowiki>
15482 !! html/php
15483 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15484 </p>
15485 !! html/parsoid
15486 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
15487 !! end
15489 !!test
15490 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15491 !! wikitext
15492 http://example.com<nowiki>junk</nowiki>
15493 !! html/php
15494 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15495 </p>
15496 !! html/parsoid
15497 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
15498 !! end
15500 !!test
15501 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15502 !! wikitext
15503 http://example.com<pre>junk</pre>
15504 !! html/php
15505 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15507 !! html/php+tidy
15508 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15509 <pre>
15510 junk
15511 </pre>
15512 !! html/parsoid
15513 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
15514 !!end
15516 !!test
15517 Fuzz testing: image with bogus manual thumbnail
15518 !! wikitext
15519 [[Image:foobar.jpg|thumbnail= ]]
15520 !! html/php
15521 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
15523 !! html/parsoid
15524 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
15525 !!end
15527 !! test
15528 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15529 !! wikitext
15530 <pre dir="&#10;"></pre>
15531 !! html
15532 <pre dir="&#10;"></pre>
15534 !! end
15536 !! test
15537 Parsing optional HTML elements (Bug 6171)
15538 !! options
15539 !! wikitext
15540 <table>
15541   <tr>
15542     <td> Some tabular data</td>
15543     <td> More tabular data ...
15544     <td> And yet som tabular data</td>
15545   </tr>
15546 </table>
15547 !! html
15548 <table>
15549   <tr>
15550     <td> Some tabular data</td>
15551     <td> More tabular data ...
15552     </td><td> And yet som tabular data</td>
15553   </tr>
15554 </table>
15556 !! end
15558 !! test
15559 Correct handling of <td>, <tr> (Bug 6171)
15560 !! options
15561 !! wikitext
15562 <table>
15563   <tr>
15564     <td> Some tabular data</td>
15565     <td> More tabular data ...</td>
15566     <td> And yet som tabular data</td>
15567   </tr>
15568 </table>
15569 !! html
15570 <table>
15571   <tr>
15572     <td> Some tabular data</td>
15573     <td> More tabular data ...</td>
15574     <td> And yet som tabular data</td>
15575   </tr>
15576 </table>
15578 !! end
15581 !! test
15582 Parsing crashing regression (fr:JavaScript)
15583 !! wikitext
15584 </body></x>
15585 !! html
15586 <p>&lt;/body&gt;&lt;/x&gt;
15587 </p>
15588 !! end
15590 !! test
15591 Inline wiki vs wiki block nesting
15592 !! wikitext
15593 '''Bold paragraph
15595 New wiki paragraph
15596 !! html
15597 <p><b>Bold paragraph</b>
15598 </p><p>New wiki paragraph
15599 </p>
15600 !! end
15602 # FIXME: The current php output is documented
15603 # and desired output is the parsoid target.
15604 !! test
15605 Inline HTML vs wiki block nesting
15606 !! wikitext
15607 <b>Bold paragraph
15609 New wiki paragraph
15610 !! html/php
15611 <p><b>Bold paragraph
15612 </p><p>New wiki paragraph</b>
15613 </p>
15614 !! html/parsoid
15615 <p><b>Bold paragraph</b>
15616 </p><p>New wiki paragraph
15617 </p>
15618 !! end
15620 # Original result was this:
15621 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15622 # </p>
15623 # While that might be marginally more intuitive, maybe, the six-apostrophe
15624 # construct is clearly pathological and the result stated here (which is what
15625 # the parser actually does) is about as reasonable as anything.
15626 !!test
15627 Mixing markup for italics and bold
15628 !! options
15629 !! wikitext
15630 '''bold''''''bold''bolditalics'''''
15631 !! html
15632 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15633 </p>
15634 !! end
15637 !! article
15638 Xyzzyx
15639 !! text
15640 Article for special page transclusion test
15641 !! endarticle
15643 !! test
15644 Special page transclusion
15645 !! options
15646 !! wikitext
15647 {{Special:Prefixindex/Xyzzyx}}
15648 !! html
15649 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15651 !! end
15653 !! test
15654 Special page transclusion twice (bug 5021)
15655 !! options
15656 !! wikitext
15657 {{Special:Prefixindex/Xyzzyx}}
15658 {{Special:Prefixindex/Xyzzyx}}
15659 !! html
15660 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15661 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15663 !! end
15665 !! test
15666 Transclusion of default MediaWiki message
15667 !! wikitext
15668 {{MediaWiki:Mainpage}}
15669 !! html
15670 <p>Main Page
15671 </p>
15672 !! end
15674 !! test
15675 Transclusion of nonexistent MediaWiki message
15676 !! wikitext
15677 {{MediaWiki:Mainpagexxx}}
15678 !! html
15679 <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>
15680 </p>
15681 !! end
15683 !! test
15684 Transclusion of MediaWiki message with underscore
15685 !! wikitext
15686 {{MediaWiki:history_short}}
15687 !! html
15688 <p>History
15689 </p>
15690 !! end
15692 !! test
15693 Transclusion of MediaWiki message with space
15694 !! wikitext
15695 {{MediaWiki:history short}}
15696 !! html
15697 <p>History
15698 </p>
15699 !! end
15701 !! test
15702 Invalid header with following text
15703 !! wikitext
15704 = x = y
15705 !! html
15706 <p>= x = y
15707 </p>
15708 !! end
15711 !! test
15712 Section extraction test (section 0)
15713 !! options
15714 section=0
15715 !! wikitext
15716 start
15717 ==a==
15718 ===aa===
15719 ====aaa====
15720 ==b==
15721 ===ba===
15722 ===bb===
15723 ====bba====
15724 ===bc===
15725 ==c==
15726 ===ca===
15727 !! html
15728 start
15729 !! end
15731 !! test
15732 Section extraction test (section 1)
15733 !! options
15734 section=1
15735 !! wikitext
15736 start
15737 ==a==
15738 ===aa===
15739 ====aaa====
15740 ==b==
15741 ===ba===
15742 ===bb===
15743 ====bba====
15744 ===bc===
15745 ==c==
15746 ===ca===
15747 !! html
15748 ==a==
15749 ===aa===
15750 ====aaa====
15751 !! end
15753 !! test
15754 Section extraction test (section 2)
15755 !! options
15756 section=2
15757 !! wikitext
15758 start
15759 ==a==
15760 ===aa===
15761 ====aaa====
15762 ==b==
15763 ===ba===
15764 ===bb===
15765 ====bba====
15766 ===bc===
15767 ==c==
15768 ===ca===
15769 !! html
15770 ===aa===
15771 ====aaa====
15772 !! end
15774 !! test
15775 Section extraction test (section 3)
15776 !! options
15777 section=3
15778 !! wikitext
15779 start
15780 ==a==
15781 ===aa===
15782 ====aaa====
15783 ==b==
15784 ===ba===
15785 ===bb===
15786 ====bba====
15787 ===bc===
15788 ==c==
15789 ===ca===
15790 !! html
15791 ====aaa====
15792 !! end
15794 !! test
15795 Section extraction test (section 4)
15796 !! options
15797 section=4
15798 !! wikitext
15799 start
15800 ==a==
15801 ===aa===
15802 ====aaa====
15803 ==b==
15804 ===ba===
15805 ===bb===
15806 ====bba====
15807 ===bc===
15808 ==c==
15809 ===ca===
15810 !! html
15811 ==b==
15812 ===ba===
15813 ===bb===
15814 ====bba====
15815 ===bc===
15816 !! end
15818 !! test
15819 Section extraction test (section 5)
15820 !! options
15821 section=5
15822 !! wikitext
15823 start
15824 ==a==
15825 ===aa===
15826 ====aaa====
15827 ==b==
15828 ===ba===
15829 ===bb===
15830 ====bba====
15831 ===bc===
15832 ==c==
15833 ===ca===
15834 !! html
15835 ===ba===
15836 !! end
15838 !! test
15839 Section extraction test (section 6)
15840 !! options
15841 section=6
15842 !! wikitext
15843 start
15844 ==a==
15845 ===aa===
15846 ====aaa====
15847 ==b==
15848 ===ba===
15849 ===bb===
15850 ====bba====
15851 ===bc===
15852 ==c==
15853 ===ca===
15854 !! html
15855 ===bb===
15856 ====bba====
15857 !! end
15859 !! test
15860 Section extraction test (section 7)
15861 !! options
15862 section=7
15863 !! wikitext
15864 start
15865 ==a==
15866 ===aa===
15867 ====aaa====
15868 ==b==
15869 ===ba===
15870 ===bb===
15871 ====bba====
15872 ===bc===
15873 ==c==
15874 ===ca===
15875 !! html
15876 ====bba====
15877 !! end
15879 !! test
15880 Section extraction test (section 8)
15881 !! options
15882 section=8
15883 !! wikitext
15884 start
15885 ==a==
15886 ===aa===
15887 ====aaa====
15888 ==b==
15889 ===ba===
15890 ===bb===
15891 ====bba====
15892 ===bc===
15893 ==c==
15894 ===ca===
15895 !! html
15896 ===bc===
15897 !! end
15899 !! test
15900 Section extraction test (section 9)
15901 !! options
15902 section=9
15903 !! wikitext
15904 start
15905 ==a==
15906 ===aa===
15907 ====aaa====
15908 ==b==
15909 ===ba===
15910 ===bb===
15911 ====bba====
15912 ===bc===
15913 ==c==
15914 ===ca===
15915 !! html
15916 ==c==
15917 ===ca===
15918 !! end
15920 !! test
15921 Section extraction test (section 10)
15922 !! options
15923 section=10
15924 !! wikitext
15925 start
15926 ==a==
15927 ===aa===
15928 ====aaa====
15929 ==b==
15930 ===ba===
15931 ===bb===
15932 ====bba====
15933 ===bc===
15934 ==c==
15935 ===ca===
15936 !! html
15937 ===ca===
15938 !! end
15940 !! test
15941 Section extraction test (nonexistent section 11)
15942 !! options
15943 section=11
15944 !! wikitext
15945 start
15946 ==a==
15947 ===aa===
15948 ====aaa====
15949 ==b==
15950 ===ba===
15951 ===bb===
15952 ====bba====
15953 ===bc===
15954 ==c==
15955 ===ca===
15956 !! html
15957 !! end
15959 !! test
15960 Section extraction test with bogus heading (section 1)
15961 !! options
15962 section=1
15963 !! wikitext
15964 ==a==
15965 ==bogus== not a legal section
15966 ==b==
15967 !! html
15968 ==a==
15969 ==bogus== not a legal section
15970 !! end
15972 !! test
15973 Section extraction test with bogus heading (section 2)
15974 !! options
15975 section=2
15976 !! wikitext
15977 ==a==
15978 ==bogus== not a legal section
15979 ==b==
15980 !! html
15981 ==b==
15982 !! end
15984 !! test
15985 Section extraction test with comment after heading (section 1)
15986 !! options
15987 section=1
15988 !! wikitext
15989 ==a==
15990 ==b== <!-- -->
15991 ==c==
15992 !! html
15993 ==a==
15994 !! end
15996 !! test
15997 Section extraction test with comment after heading (section 2)
15998 !! options
15999 section=2
16000 !! wikitext
16001 ==a==
16002 ==b== <!-- -->
16003 ==c==
16004 !! html
16005 ==b== <!-- -->
16006 !! end
16008 !! test
16009 Section extraction test with bogus <nowiki> heading (section 1)
16010 !! options
16011 section=1
16012 !! wikitext
16013 ==a==
16014 ==bogus== <nowiki>not a legal section</nowiki>
16015 ==b==
16016 !! html
16017 ==a==
16018 ==bogus== <nowiki>not a legal section</nowiki>
16019 !! end
16021 !! test
16022 Section extraction test with bogus <nowiki> heading (section 2)
16023 !! options
16024 section=2
16025 !! wikitext
16026 ==a==
16027 ==bogus== <nowiki>not a legal section</nowiki>
16028 ==b==
16029 !! html
16030 ==b==
16031 !! end
16034 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16035 # instead of respecting commented sections
16036 !! test
16037 Section extraction prefixed by comment (section 1)
16038 !! options
16039 section=1
16040 !! wikitext
16041 <!-- -->==sec1==
16042 ==sec2==
16043 !! html
16044 ==sec2==
16045 !!end
16047 !! test
16048 Section extraction prefixed by comment (section 2)
16049 !! options
16050 section=2
16051 !! wikitext
16052 <!-- -->==sec1==
16053 ==sec2==
16054 !! html
16056 !!end
16059 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
16060 # instead of respecting HTML-style headings
16061 !! test
16062 Section extraction, mixed wiki and html (section 1)
16063 !! options
16064 section=1
16065 !! wikitext
16066 <h2>unmarked</h2>
16067 unmarked
16068 ==1==
16070 ==2==
16072 !! html
16073 ==1==
16075 !! end
16077 !! test
16078 Section extraction, mixed wiki and html (section 2)
16079 !! options
16080 section=2
16081 !! wikitext
16082 <h2>unmarked</h2>
16083 unmarked
16084 ==1==
16086 ==2==
16088 !! html
16089 ==2==
16091 !! end
16094 # Formerly testing for bug 3342
16095 !! test
16096 Section extraction, heading surrounded by <noinclude>
16097 !! options
16098 section=1
16099 !! wikitext
16100 <noinclude>==unmarked==</noinclude>
16101 ==marked==
16102 !! html
16103 ==marked==
16104 !!end
16106 # Test behavior of bug 19910
16107 !! test
16108 Sectiion with all-equals
16109 !! options
16110 section=2
16111 !! wikitext
16112 === 
16113 The line above must have a trailing space
16114 === <!--
16115 --> <!-- -->
16116 But just in case it doesn't...
16117 !! html
16118 === <!--
16119 --> <!-- -->
16120 But just in case it doesn't...
16121 !! end
16123 !! test
16124 Section replacement test (section 0)
16125 !! options
16126 replace=0,"xxx"
16127 !! wikitext
16128 start
16129 ==a==
16130 ===aa===
16131 ====aaa====
16132 ==b==
16133 ===ba===
16134 ===bb===
16135 ====bba====
16136 ===bc===
16137 ==c==
16138 ===ca===
16139 !! html
16142 ==a==
16143 ===aa===
16144 ====aaa====
16145 ==b==
16146 ===ba===
16147 ===bb===
16148 ====bba====
16149 ===bc===
16150 ==c==
16151 ===ca===
16152 !! end
16154 !! test
16155 Section replacement test (section 1)
16156 !! options
16157 replace=1,"xxx"
16158 !! wikitext
16159 start
16160 ==a==
16161 ===aa===
16162 ====aaa====
16163 ==b==
16164 ===ba===
16165 ===bb===
16166 ====bba====
16167 ===bc===
16168 ==c==
16169 ===ca===
16170 !! html
16171 start
16174 ==b==
16175 ===ba===
16176 ===bb===
16177 ====bba====
16178 ===bc===
16179 ==c==
16180 ===ca===
16181 !! end
16183 !! test
16184 Section replacement test (section 2)
16185 !! options
16186 replace=2,"xxx"
16187 !! wikitext
16188 start
16189 ==a==
16190 ===aa===
16191 ====aaa====
16192 ==b==
16193 ===ba===
16194 ===bb===
16195 ====bba====
16196 ===bc===
16197 ==c==
16198 ===ca===
16199 !! html
16200 start
16201 ==a==
16204 ==b==
16205 ===ba===
16206 ===bb===
16207 ====bba====
16208 ===bc===
16209 ==c==
16210 ===ca===
16211 !! end
16213 !! test
16214 Section replacement test (section 3)
16215 !! options
16216 replace=3,"xxx"
16217 !! wikitext
16218 start
16219 ==a==
16220 ===aa===
16221 ====aaa====
16222 ==b==
16223 ===ba===
16224 ===bb===
16225 ====bba====
16226 ===bc===
16227 ==c==
16228 ===ca===
16229 !! html
16230 start
16231 ==a==
16232 ===aa===
16235 ==b==
16236 ===ba===
16237 ===bb===
16238 ====bba====
16239 ===bc===
16240 ==c==
16241 ===ca===
16242 !! end
16244 !! test
16245 Section replacement test (section 4)
16246 !! options
16247 replace=4,"xxx"
16248 !! wikitext
16249 start
16250 ==a==
16251 ===aa===
16252 ====aaa====
16253 ==b==
16254 ===ba===
16255 ===bb===
16256 ====bba====
16257 ===bc===
16258 ==c==
16259 ===ca===
16260 !! html
16261 start
16262 ==a==
16263 ===aa===
16264 ====aaa====
16267 ==c==
16268 ===ca===
16269 !! end
16271 !! test
16272 Section replacement test (section 5)
16273 !! options
16274 replace=5,"xxx"
16275 !! wikitext
16276 start
16277 ==a==
16278 ===aa===
16279 ====aaa====
16280 ==b==
16281 ===ba===
16282 ===bb===
16283 ====bba====
16284 ===bc===
16285 ==c==
16286 ===ca===
16287 !! html
16288 start
16289 ==a==
16290 ===aa===
16291 ====aaa====
16292 ==b==
16295 ===bb===
16296 ====bba====
16297 ===bc===
16298 ==c==
16299 ===ca===
16300 !! end
16302 !! test
16303 Section replacement test (section 6)
16304 !! options
16305 replace=6,"xxx"
16306 !! wikitext
16307 start
16308 ==a==
16309 ===aa===
16310 ====aaa====
16311 ==b==
16312 ===ba===
16313 ===bb===
16314 ====bba====
16315 ===bc===
16316 ==c==
16317 ===ca===
16318 !! html
16319 start
16320 ==a==
16321 ===aa===
16322 ====aaa====
16323 ==b==
16324 ===ba===
16327 ===bc===
16328 ==c==
16329 ===ca===
16330 !! end
16332 !! test
16333 Section replacement test (section 7)
16334 !! options
16335 replace=7,"xxx"
16336 !! wikitext
16337 start
16338 ==a==
16339 ===aa===
16340 ====aaa====
16341 ==b==
16342 ===ba===
16343 ===bb===
16344 ====bba====
16345 ===bc===
16346 ==c==
16347 ===ca===
16348 !! html
16349 start
16350 ==a==
16351 ===aa===
16352 ====aaa====
16353 ==b==
16354 ===ba===
16355 ===bb===
16358 ===bc===
16359 ==c==
16360 ===ca===
16361 !! end
16363 !! test
16364 Section replacement test (section 8)
16365 !! options
16366 replace=8,"xxx"
16367 !! wikitext
16368 start
16369 ==a==
16370 ===aa===
16371 ====aaa====
16372 ==b==
16373 ===ba===
16374 ===bb===
16375 ====bba====
16376 ===bc===
16377 ==c==
16378 ===ca===
16379 !! html
16380 start
16381 ==a==
16382 ===aa===
16383 ====aaa====
16384 ==b==
16385 ===ba===
16386 ===bb===
16387 ====bba====
16390 ==c==
16391 ===ca===
16392 !!end
16394 !! test
16395 Section replacement test (section 9)
16396 !! options
16397 replace=9,"xxx"
16398 !! wikitext
16399 start
16400 ==a==
16401 ===aa===
16402 ====aaa====
16403 ==b==
16404 ===ba===
16405 ===bb===
16406 ====bba====
16407 ===bc===
16408 ==c==
16409 ===ca===
16410 !! html
16411 start
16412 ==a==
16413 ===aa===
16414 ====aaa====
16415 ==b==
16416 ===ba===
16417 ===bb===
16418 ====bba====
16419 ===bc===
16421 !! end
16423 !! test
16424 Section replacement test (section 10)
16425 !! options
16426 replace=10,"xxx"
16427 !! wikitext
16428 start
16429 ==a==
16430 ===aa===
16431 ====aaa====
16432 ==b==
16433 ===ba===
16434 ===bb===
16435 ====bba====
16436 ===bc===
16437 ==c==
16438 ===ca===
16439 !! html
16440 start
16441 ==a==
16442 ===aa===
16443 ====aaa====
16444 ==b==
16445 ===ba===
16446 ===bb===
16447 ====bba====
16448 ===bc===
16449 ==c==
16451 !! end
16453 !! test
16454 Section replacement test with initial whitespace (bug 13728)
16455 !! options
16456 replace=2,"xxx"
16457 !! wikitext
16458  Preformatted initial line
16459 ==a==
16460 ===a===
16461 !! html
16462  Preformatted initial line
16463 ==a==
16465 !! end
16468 !! test
16469 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16470 !! options
16471 section=1
16472 !! wikitext
16473 ==a==
16474                     a
16475 !! html
16476 ==a==
16477                     a
16478 !! end
16480 !! test
16481 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16482 !! options
16483 section=1
16484 !! wikitext
16485 ==a==
16486                    a
16487 !! html
16488 ==a==
16489                    a
16490 !! end
16493 !! test
16494 Section extraction, <pre> around bogus header (bug 10309)
16495 !! options
16496 noxml section=2
16497 !! wikitext
16498 == Section One ==
16499 <pre>
16500 =======
16501 </pre>
16503 == Section Two ==
16504 stuff
16505 !! html
16506 == Section Two ==
16507 stuff
16508 !! end
16510 !! test
16511 Section replacement, <pre> around bogus header (bug 10309)
16512 !! options
16513 noxml replace=2,"xxx"
16514 !! wikitext
16515 == Section One ==
16516 <pre>
16517 =======
16518 </pre>
16520 == Section Two ==
16521 stuff
16522 !! html
16523 == Section One ==
16524 <pre>
16525 =======
16526 </pre>
16529 !! end
16533 !! test
16534 Handling of &#x0A; in URLs
16535 !! wikitext
16536 ** irc://&#x0A;a
16537 !! html/php
16538 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16540 !! html/parsoid
16541 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16542 a">irc://
16543 a</a></li></ul></li></ul>
16544 !! end
16546 !! test
16547 Handling of %0A in URLs
16548 !! wikitext
16549 ** irc://%0Aa
16550 !! html/php
16551 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16553 !! html/parsoid
16554 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16555 !! end
16558 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16559 !! test
16560 5 quotes, code coverage +1 line
16561 !! options
16562 parsoid=wt2html
16563 !! wikitext
16564 '''''
16565 !! html/php
16566 !! html/parsoid
16567 <p><b><i></i></b></p>
16568 !! end
16570 # same html as previous, but wikitext adjusted to match parsoid html2wt
16571 # note that wt2html and html2html will put the <i> before the <b>
16572 !! test
16573 5 quotes, code coverage +1 line w/ nowiki (1)
16574 !! options
16575 parsoid=wt2wt,html2wt
16576 !! wikitext
16577 '''''<nowiki/>'''''
16578 !! html/php
16579 <p><i></i>
16580 </p>
16581 !! html/parsoid
16582 <p><b><i></i></b></p>
16583 !! end
16585 # same as previous, just swapping the <i> and <b>
16586 !! test
16587 5 quotes, code coverage +1 line w/ nowiki (2)
16588 !! wikitext
16589 '''''<nowiki/>'''''
16590 !! html/php
16591 <p><i></i>
16592 </p>
16593 !! html/parsoid
16594 <p><i><b></b></i></p>
16595 !! end
16597 !! test
16598 Special:Search page linking.
16599 !! wikitext
16600 {{Special:search}}
16601 !! html
16602 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16603 </p>
16604 !! end
16606 !! test
16607 {{!}} is a magic word
16608 !! wikitext
16609 {{!}} is a magic word there and {{!}} is still a magic word here
16610 !! html/php
16611 <p>| is a magic word there and | is still a magic word here
16612 </p>
16613 !! html/parsoid
16614 <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>
16615 !! end
16617 !! test
16618 Say the magic word
16619 !! options
16620 title=[[Parser test]]
16621 !! wikitext
16622 * {{PAGENAME}}
16623 * {{PAGENAMEE}}
16624 * {{FULLPAGENAME}}
16625 * {{FULLPAGENAMEE}}
16626 * {{BASEPAGENAME}}
16627 * {{BASEPAGENAMEE}}
16628 * {{SUBPAGENAME}}
16629 * {{SUBPAGENAMEE}}
16630 * {{ROOTPAGENAME}}
16631 * {{ROOTPAGENAMEE}}
16632 * {{TALKPAGENAME}}
16633 * {{TALKPAGENAMEE}}
16634 * {{SUBJECTPAGENAME}}
16635 * {{SUBJECTPAGENAMEE}}
16636 * {{NAMESPACEE}}
16637 * {{NAMESPACE}}
16638 * {{NAMESPACENUMBER}}
16639 * {{TALKSPACE}}
16640 * {{TALKSPACEE}}
16641 * {{SUBJECTSPACE}}
16642 * {{SUBJECTSPACEE}}
16643 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16644 !! html
16645 <ul><li> Parser test</li>
16646 <li> Parser_test</li>
16647 <li> Parser test</li>
16648 <li> Parser_test</li>
16649 <li> Parser test</li>
16650 <li> Parser_test</li>
16651 <li> Parser test</li>
16652 <li> Parser_test</li>
16653 <li> Parser test</li>
16654 <li> Parser_test</li>
16655 <li> Talk:Parser test</li>
16656 <li> Talk:Parser_test</li>
16657 <li> Parser test</li>
16658 <li> Parser_test</li>
16659 <li> </li>
16660 <li> </li>
16661 <li> 0</li>
16662 <li> Talk</li>
16663 <li> Talk</li>
16664 <li> </li>
16665 <li> </li>
16666 <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>
16668 !! end
16669 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16671 !! test
16672 Gallery
16673 !! wikitext
16674 <gallery>
16675 image1.png |
16676 image2.gif|||||
16678 image3|
16679 image4    |300px| centre
16680  image5.svg| http://///////
16681 [[x|xx]]]]
16682 * image6
16683 </gallery>
16684 !! html
16685 <ul class="gallery mw-gallery-traditional">
16686                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16687                         <div class="thumb" style="height: 150px;">Image1.png</div>
16688                         <div class="gallerytext">
16689                         </div>
16690                 </div></li>
16691                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16692                         <div class="thumb" style="height: 150px;">Image2.gif</div>
16693                         <div class="gallerytext">
16694 <p>||||
16695 </p>
16696                         </div>
16697                 </div></li>
16698                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16699                         <div class="thumb" style="height: 150px;">Image3</div>
16700                         <div class="gallerytext">
16701                         </div>
16702                 </div></li>
16703                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16704                         <div class="thumb" style="height: 150px;">Image4</div>
16705                         <div class="gallerytext">
16706 <p>300px| centre
16707 </p>
16708                         </div>
16709                 </div></li>
16710                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16711                         <div class="thumb" style="height: 150px;">Image5.svg</div>
16712                         <div class="gallerytext">
16713 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16714 </p>
16715                         </div>
16716                 </div></li>
16717                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16718                         <div class="thumb" style="height: 150px;">* image6</div>
16719                         <div class="gallerytext">
16720                         </div>
16721                 </div></li>
16722 </ul>
16724 !! end
16726 !! test
16727 Gallery (with options)
16728 !! wikitext
16729 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16730 File:Nonexistent.jpg|caption
16731 File:Nonexistent.jpg
16732 image:foobar.jpg|some '''caption''' [[Main Page]]
16733 image:foobar.jpg
16734 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16735 </gallery>
16736 !! html
16737 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16738         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16739                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16740                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16741                         <div class="gallerytext">
16742 <p>caption
16743 </p>
16744                         </div>
16745                 </div></li>
16746                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16747                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16748                         <div class="gallerytext">
16749                         </div>
16750                 </div></li>
16751                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16752                         <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>
16753                         <div class="gallerytext">
16754 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16755 </p>
16756                         </div>
16757                 </div></li>
16758                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16759                         <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>
16760                         <div class="gallerytext">
16761                         </div>
16762                 </div></li>
16763                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16764                         <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>
16765                         <div class="gallerytext">
16766 <p>Blabla|blabla.
16767 </p>
16768                         </div>
16769                 </div></li>
16770 </ul>
16772 !! end
16774 !! test
16775 Gallery with link that has fragment
16776 !! wikitext
16777 <gallery>
16778 image:foobar.jpg|link=Main_Page
16779 image:foobar.jpg|link=Main_Page#section
16780 image:foobar.jpg|link=Main Page#section|caption
16781 </gallery>
16782 !! html
16783 <ul class="gallery mw-gallery-traditional">
16784                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16785                         <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>
16786                         <div class="gallerytext">
16787                         </div>
16788                 </div></li>
16789                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16790                         <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>
16791                         <div class="gallerytext">
16792                         </div>
16793                 </div></li>
16794                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16795                         <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>
16796                         <div class="gallerytext">
16797 <p>caption
16798 </p>
16799                         </div>
16800                 </div></li>
16801 </ul>
16803 !! end
16805 !! test
16806 Gallery with wikitext inside caption
16807 !! wikitext
16808 <gallery>
16809 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16810 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16811 </gallery>
16812 !! html
16813 <ul class="gallery mw-gallery-traditional">
16814                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16815                         <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>
16816                         <div class="gallerytext">
16817 <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>
16818 </p>
16819                         </div>
16820                 </div></li>
16821                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16822                         <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>
16823                         <div class="gallerytext">
16824 <p>This is a test template
16825 </p>
16826                         </div>
16827                 </div></li>
16828 </ul>
16830 !! end
16832 !! test
16833 gallery (with showfilename option)
16834 !! wikitext
16835 <gallery showfilename>
16836 File:Nonexistent.jpg|caption
16837 File:Nonexistent.jpg
16838 image:foobar.jpg|some '''caption''' [[Main Page]]
16839 File:Foobar.jpg
16840 </gallery>
16841 !! html
16842 <ul class="gallery mw-gallery-traditional">
16843                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16844                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16845                         <div class="gallerytext">
16846 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16847 caption
16848 </p>
16849                         </div>
16850                 </div></li>
16851                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16852                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16853                         <div class="gallerytext">
16854 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16855 </p>
16856                         </div>
16857                 </div></li>
16858                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16859                         <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>
16860                         <div class="gallerytext">
16861 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16862 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16863 </p>
16864                         </div>
16865                 </div></li>
16866                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16867                         <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>
16868                         <div class="gallerytext">
16869 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16870 </p>
16871                         </div>
16872                 </div></li>
16873 </ul>
16875 !! end
16877 !! test
16878 Gallery (with namespace-less filenames)
16879 !! wikitext
16880 <gallery>
16881 File:Nonexistent.jpg
16882 Nonexistent.jpg
16883 image:foobar.jpg
16884 foobar.jpg
16885 </gallery>
16886 !! html
16887 <ul class="gallery mw-gallery-traditional">
16888                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16889                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16890                         <div class="gallerytext">
16891                         </div>
16892                 </div></li>
16893                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16894                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16895                         <div class="gallerytext">
16896                         </div>
16897                 </div></li>
16898                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16899                         <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>
16900                         <div class="gallerytext">
16901                         </div>
16902                 </div></li>
16903                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16904                         <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>
16905                         <div class="gallerytext">
16906                         </div>
16907                 </div></li>
16908 </ul>
16910 !! end
16912 !! test
16913 HTML Hex character encoding (spells the word "JavaScript")
16914 !! options
16915 parsoid=wt2html,wt2wt,html2html
16916 !! wikitext
16917 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16918 !! html/php
16919 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16920 </p>
16921 !! html/php+tidy
16922 <p>JavaScript</p>
16923 !! html/parsoid
16924 <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>
16925 !! end
16927 !! test
16928 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16929 !! wikitext
16930 &#xsee;&#XSEE;
16931 !! html/php
16932 <p>&amp;#xsee;&amp;#XSEE;
16933 </p>
16934 !! html/parsoid
16935 <p>&amp;#xsee;&amp;#XSEE;</p>
16936 !! end
16938 !! test
16939 HTML Hex character encoding mixed case
16940 !! options
16941 parsoid=wt2html,wt2wt,html2html
16942 !! wikitext
16943 &#xEE;&#Xee;
16944 !! html/php
16945 <p>&#xee;&#xee;
16946 </p>
16947 !! html/php+tidy
16948 <p>îî</p>
16949 !! html/parsoid
16950 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16951 !! end
16953 !! test
16954 __FORCETOC__ override
16955 !! wikitext
16956 __NEWSECTIONLINK__
16957 __FORCETOC__
16958 !! html
16959 <p><br />
16960 </p>
16961 !! end
16963 !! test
16964 ISBN code coverage
16965 !! wikitext
16966 ISBN  978-0-1234-56&#x20;789
16967 !! html
16968 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16969 </p>
16970 !! html+tidy
16971 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16972 !! html/parsoid
16973 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
16974 !! end
16976 !! test
16977 ISBN followed by 5 spaces
16978 !! wikitext
16979 ISBN    
16980 !! html
16981 <p>ISBN    
16982 </p>
16983 !! end
16985 !! test
16986 Double ISBN
16987 !! wikitext
16988 ISBN ISBN 1234567890
16989 !! html/php
16990 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16991 </p>
16992 !! html/parsoid
16993 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
16994 !! end
16996 !! test
16997 ISBN with an X
16998 !! wikitext
16999 ISBN 3-462-04561-X
17000 ISBN 080442957X
17001 ISBN 978080442957X
17002 !! html/php
17003 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17004 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17005 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17006 </p>
17007 !! html/parsoid
17008 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17009 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17010 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17011 !! end
17013 !! test
17014 ISBN with empty prefix (parsoid test)
17015 !! wikitext
17016 ISBN 1234567890
17017 !! html/php
17018 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17019 </p>
17020 !! html/parsoid
17021 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17022 !! end
17024 !! test
17025 Bug 22905: <abbr> followed by ISBN followed by </a>
17026 !! wikitext
17027 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17028 !! html/php
17029 <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>
17030 </p>
17031 !! html/parsoid
17032 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
17033 !! end
17035 !! test
17036 Double RFC
17037 !! wikitext
17038 RFC RFC 1234
17039 !! html
17040 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17041 </p>
17042 !! end
17044 !! test
17045 Double RFC with a wiki link
17046 !! wikitext
17047 RFC [[RFC 1234]]
17048 !! html
17049 <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>
17050 </p>
17051 !! end
17053 !! test
17054 RFC code coverage
17055 !! wikitext
17056 RFC   983&#x20;987
17057 !! html
17058 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
17059 </p>
17060 !! html+tidy
17061 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
17062 !! end
17064 !! test
17065 Centre-aligned image
17066 !! wikitext
17067 [[Image:foobar.jpg|centre]]
17068 !! html
17069 <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>
17071 !!end
17073 !! test
17074 None-aligned image
17075 !! wikitext
17076 [[Image:foobar.jpg|none]]
17077 !! html
17078 <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>
17080 !!end
17082 !! test
17083 Width + Height sized image (using px) (height is ignored)
17084 !! wikitext
17085 [[Image:foobar.jpg|640x480px]]
17086 !! html
17087 <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>
17088 </p>
17089 !!end
17091 !! test
17092 Width-sized image (using px, no following whitespace)
17093 !! wikitext
17094 [[Image:foobar.jpg|640px]]
17095 !! html
17096 <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>
17097 </p>
17098 !!end
17100 !! test
17101 Width-sized image (using px, with following whitespace - test regression from r39467)
17102 !! wikitext
17103 [[Image:foobar.jpg|640px ]]
17104 !! html
17105 <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>
17106 </p>
17107 !!end
17109 !! test
17110 Width-sized image (using px, with preceding whitespace - test regression from r39467)
17111 !! wikitext
17112 [[Image:foobar.jpg| 640px]]
17113 !! html
17114 <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>
17115 </p>
17116 !!end
17118 !! test
17119 Image with page parameter
17120 !! options
17121 djvu
17122 !! wikitext
17123 [[File:LoremIpsum.djvu|page=2]]
17124 !! html/php
17125 <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>
17126 </p>
17127 !! html/parsoid
17128 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
17129 !! end
17131 !! test
17132 Another italics / bold test
17133 !! wikitext
17134  ''' ''x'
17135 !! html
17136 <pre>'<i> </i>x'
17137 </pre>
17138 !!end
17140 # FIXME: The php output seems broken. It's interleaving some open/close tags.
17141 !! test
17142 dt/dd/dl test
17143 !! wikitext
17144 :;;;::
17145 !! html/php
17146 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
17148 !! html/parsoid
17149 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
17151 !!end
17154 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
17155 !! test
17156 Images with the "|" character in the comment
17157 !! wikitext
17158 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
17159 !! html/php
17160 <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>
17162 !! html/parsoid
17163 <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>
17164 !! end
17166 !! test
17167 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
17168 !! wikitext
17169 <html><script>alert(1);</script></html>
17170 !! html
17171 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
17172 </p>
17173 !! end
17175 !! test
17176 HTML with raw HTML ($wgRawHtml==true)
17177 !! options
17178 wgRawHtml=1
17179 !! wikitext
17180 <html><script>alert(1);</script></html>
17181 !! html
17182 <p><script>alert(1);</script>
17183 </p>
17184 !! end
17186 !! test
17187 Parents of subpages, one level up
17188 !! options
17189 subpage title=[[Subpage test/L1/L2/L3]]
17190 !! wikitext
17191 [[../|L2]]
17192 !! html
17193 <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>
17194 </p>
17195 !! end
17198 !! test
17199 Parents of subpages, one level up, not named
17200 !! options
17201 subpage title=[[Subpage test/L1/L2/L3]]
17202 !! wikitext
17203 [[../]]
17204 !! html
17205 <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>
17206 </p>
17207 !! end
17211 !! test
17212 Parents of subpages, two levels up
17213 !! options
17214 subpage title=[[Subpage test/L1/L2/L3]]
17215 !! wikitext
17216 [[../../|L1]]2
17218 [[../../|L1]]l
17219 !! html
17220 <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
17221 </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>
17222 </p>
17223 !! end
17225 !! test
17226 Parents of subpages, two levels up, without trailing slash or name.
17227 !! options
17228 subpage title=[[Subpage test/L1/L2/L3]]
17229 !! wikitext
17230 [[../..]]
17231 !! html
17232 <p>[[../..]]
17233 </p>
17234 !! end
17236 !! test
17237 Parents of subpages, two levels up, with lots of extra trailing slashes.
17238 !! options
17239 subpage title=[[Subpage test/L1/L2/L3]]
17240 !! wikitext
17241 [[../../////]]
17242 !! html
17243 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
17244 </p>
17245 !! end
17247 !! article
17248 Subpage test/L1/L2/L3Sibling
17249 !! text
17250 Sibling article
17251 !! endarticle
17253 !! test
17254 Transclusion of a sibling page (one level up)
17255 !! options
17256 subpage title=[[Subpage test/L1/L2/L3]]
17257 !! wikitext
17258 {{../L3Sibling}}
17259 !! html
17260 <p>Sibling article
17261 </p>
17262 !! end
17264 !! test
17265 Transclusion of a child page
17266 !! options
17267 subpage title=[[Subpage test/L1/L2]]
17268 !! wikitext
17269 {{/L3Sibling}}
17270 !! html
17271 <p>Sibling article
17272 </p>
17273 !! end
17275 !! test
17276 Non-transclusion because of too many up levels
17277 !! options
17278 subpage title=[[Subpage test/L1/L2/L3]]
17279 !! wikitext
17280 {{../../../../More than parent}}
17281 !! html
17282 <p>{{../../../../More than parent}}
17283 </p>
17284 !! end
17286 !! test
17287 Definition list code coverage
17288 !! wikitext
17289 ; title   : def
17290 ; title : def
17291 ;title: def
17292 !! html/php
17293 <dl><dt> title  &#160;</dt>
17294 <dd> def</dd>
17295 <dt> title&#160;</dt>
17296 <dd> def</dd>
17297 <dt>title</dt>
17298 <dd> def</dd></dl>
17300 !! html/parsoid
17301 <dl><dt> title  <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17302 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17303 <dt>title</dt><dd> def</dd></dl>
17304 !! end
17306 !! test
17307 Don't fall for the self-closing div
17308 !! wikitext
17309 <div>hello world</div/>
17310 !! html
17311 <div>hello world</div>
17313 !! end
17315 !! test
17316 MSGNW magic word
17317 !! wikitext
17318 {{MSGNW:msg}}
17319 !! html
17320 <p>&#91;&#91;:Template:Msg&#93;&#93;
17321 </p>
17322 !! end
17324 !! test
17325 RAW magic word
17326 !! wikitext
17327 {{RAW:QUERTY}}
17328 !! html
17329 <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>
17330 </p>
17331 !! end
17333 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17334 !! test
17335 Always escape literal '>' in output, not just after '<'
17336 !! wikitext
17338 !! html
17339 <p>&gt;&lt;&gt;
17340 </p>
17341 !! end
17343 !! test
17344 Template caching
17345 !! wikitext
17346 {{Test}}
17347 {{Test}}
17348 !! html
17349 <p>This is a test template
17350 This is a test template
17351 </p>
17352 !! end
17355 !! article
17356 MediaWiki:Fake
17357 !! text
17358 ==header==
17359 !! endarticle
17361 !! test
17362 Inclusion of !userCanEdit() content
17363 !! wikitext
17364 {{MediaWiki:Fake}}
17365 !! html
17366 <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>
17368 !! end
17371 !! test
17372 Out-of-order TOC heading levels
17373 !! wikitext
17374 ==2==
17375 ======6======
17376 ===3===
17378 =====5=====
17379 ==2==
17380 !! html
17381 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17382 <ul>
17383 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17384 <ul>
17385 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17386 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17387 </ul>
17388 </li>
17389 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17390 <ul>
17391 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17392 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17393 </ul>
17394 </li>
17395 </ul>
17396 </div>
17398 <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>
17399 <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>
17400 <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>
17401 <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>
17402 <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>
17403 <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>
17405 !! end
17408 !! test
17409 ISBN with a dummy number
17410 !! wikitext
17411 ISBN ---
17412 !! html
17413 <p>ISBN ---
17414 </p>
17415 !! end
17418 !! test
17419 ISBN with space-delimited number
17420 !! wikitext
17421 ISBN 92 9017 032 8
17422 !! html
17423 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17424 </p>
17425 !! end
17428 !! test
17429 ISBN with multiple spaces, no number
17430 !! wikitext
17431 ISBN  foo
17432 !! html
17433 <p>ISBN  foo
17434 </p>
17435 !! end
17438 !! test
17439 ISBN length
17440 !! wikitext
17441 ISBN 123456789
17443 ISBN 1234567890
17445 ISBN 12345678901
17446 !! html
17447 <p>ISBN 123456789
17448 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17449 </p><p>ISBN 12345678901
17450 </p>
17451 !! end
17454 !! test
17455 ISBN with trailing year (bug 8110)
17456 !! wikitext
17457 ISBN 1-234-56789-0 - 2006
17459 ISBN 1 234 56789 0 - 2006
17460 !! html
17461 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17462 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17463 </p>
17464 !! end
17467 !! test
17468 anchorencode
17469 !! wikitext
17470 {{anchorencode:foo bar©#%n}}
17471 !! html
17472 <p>foo_bar.C2.A9.23.25n
17473 </p>
17474 !! end
17476 !! test
17477 anchorencode trims spaces
17478 !! wikitext
17479 {{anchorencode: __pretty__please__}}
17480 !! html
17481 <p>pretty_please
17482 </p>
17483 !! end
17485 !! test
17486 anchorencode deals with links
17487 !! wikitext
17488 {{anchorencode: [[hello|world]] [[hi]]}}
17489 !! html
17490 <p>world_hi
17491 </p>
17492 !! end
17494 !! test
17495 anchorencode deals with templates
17496 !! wikitext
17497 {{anchorencode: {{Foo}} }}
17498 !! html
17499 <p>FOO
17500 </p>
17501 !! end
17503 !! test
17504 anchorencode encodes like the TOC generator: (bug 18431)
17505 !! wikitext
17506 === _ +:.3A%3A&&amp;]] ===
17507 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17508 __NOEDITSECTION__
17509 !! html
17510 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17511 <p>.2B:.3A.253A.26.26.5D.5D
17512 </p>
17513 !! end
17515 !! test
17516 Bug 6200: blockquotes and paragraph formatting
17517 !! wikitext
17518 <blockquote>
17520 </blockquote>
17524  baz
17525 !! html
17526 <blockquote>
17527 <p>foo
17528 </p>
17529 </blockquote>
17530 <p>bar
17531 </p>
17532 <pre>baz
17533 </pre>
17534 !! end
17536 !! test
17537 Bug 8293: Use of center tag ruins paragraph formatting
17538 !! wikitext
17539 <center>
17541 </center>
17545  baz
17546 !! html
17547 <center>
17548 <p>foo
17549 </p>
17550 </center>
17551 <p>bar
17552 </p>
17553 <pre>baz
17554 </pre>
17555 !! end
17557 !!test
17558 Parsing of overlapping (improperly nested) inline html tags
17559 !! wikitext
17560 <span><s>x</span></s>
17561 !! html/php
17562 <p><span><s>x&lt;/span&gt;</s></span>
17563 </p>
17564 !! html/parsoid
17565 <p><span><s>x</s></span>
17566 </p>
17567 !!end
17570 ### Language variants related tests
17572 !! test
17573 Self-link in language variants
17574 !! options
17575 title=[[Dunav]] language=sr
17576 !! wikitext
17577 Both [[Dunav]] and [[Дунав]] are names for this river.
17578 !! html
17579 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17580 </p>
17581 !!end
17583 !! article
17584 Дуна
17585 !! text
17586 content
17587 !! endarticle
17589 !! test
17590 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17591 !! options
17592 title=[[Duna]] language=sr
17593 !! wikitext
17594 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17595 !! html
17596 <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.
17597 </p>
17598 !! end
17600 !! test
17601 Link to a section of a variant of this title shouldn't be parsed as self-link
17602 !! options
17603 title=[[Duna]] language=sr
17604 !! wikitext
17605 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17606 !! html
17607 <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.
17608 </p>
17609 !! end
17611 !! test
17612 Link to pages in language variants
17613 !! options
17614 language=sr
17615 !! wikitext
17616 Main Page can be written as [[Маин Паге]]
17617 !! html
17618 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17619 </p>
17620 !!end
17623 !! test
17624 Multiple links to pages in language variants
17625 !! options
17626 language=sr
17627 !! wikitext
17628 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17629 !! html
17630 <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>.
17631 </p>
17632 !!end
17635 !! test
17636 Simple template in language variants
17637 !! options
17638 language=sr
17639 !! wikitext
17640 {{тест}}
17641 !! html
17642 <p>This is a test template
17643 </p>
17644 !! end
17647 !! test
17648 Template with explicit namespace in language variants
17649 !! options
17650 language=sr
17651 !! wikitext
17652 {{Template:тест}}
17653 !! html
17654 <p>This is a test template
17655 </p>
17656 !! end
17659 !! test
17660 Basic test for template parameter in language variants
17661 !! options
17662 language=sr
17663 !! wikitext
17664 {{парамтест|param=foo}}
17665 !! html
17666 <p>This is a test template with parameter foo
17667 </p>
17668 !! end
17671 !! test
17672 Simple category in language variants
17673 !! options
17674 language=sr cat
17675 !! wikitext
17676 [[Category:МедиаWики Усер'с Гуиде]]
17677 !! html
17678 <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>
17679 !! end
17682 !! article
17683 Category:分类
17684 !! text
17685 blah
17686 !! endarticle
17688 !! article
17689 Category:分類
17690 !! text
17691 blah
17692 !! endarticle
17694 !! test
17695 Don't convert blue categorylinks to another variant (bug 33210)
17696 !! options
17697 language=zh cat
17698 !! wikitext
17699 [[A]][[Category:分类]]
17700 !! html
17701 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17702 !! end
17705 !! test
17706 Stripping -{}- tags (language variants)
17707 !! options
17708 language=sr
17709 !! wikitext
17710 Latin proverb: -{Ne nuntium necare}-
17711 !! html
17712 <p>Latin proverb: Ne nuntium necare
17713 </p>
17714 !! end
17717 !! test
17718 Prevent conversion with -{}- tags (language variants)
17719 !! options
17720 language=sr variant=sr-ec
17721 !! wikitext
17722 Latinski: -{Ne nuntium necare}-
17723 !! html
17724 <p>Латински: Ne nuntium necare
17725 </p>
17726 !! end
17729 !! test
17730 Prevent conversion of text with -{}- tags (language variants)
17731 !! options
17732 language=sr variant=sr-ec
17733 !! wikitext
17734 Latinski: -{Ne nuntium necare}-
17735 !! html
17736 <p>Латински: Ne nuntium necare
17737 </p>
17738 !! end
17741 !! test
17742 Prevent conversion of links with -{}- tags (language variants)
17743 !! options
17744 language=sr variant=sr-ec
17745 !! wikitext
17746 -{[[Main Page]]}-
17747 !! html
17748 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17749 </p>
17750 !! end
17753 !! test
17754 -{}- tags within headlines (within html for parserConvert())
17755 !! options
17756 language=sr variant=sr-ec
17757 !! wikitext
17758 == -{Naslov}- ==
17759 !! html
17760 <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>
17762 !! end
17765 !! test
17766 Explicit definition of language variant alternatives
17767 !! options
17768 language=zh variant=zh-tw
17769 !! wikitext
17770 -{zh:China;zh-tw:Taiwan}-, not China
17771 !! html
17772 <p>Taiwan, not China
17773 </p>
17774 !! end
17777 !! test
17778 Conversion around HTML tags
17779 !! options
17780 language=sr variant=sr-ec
17781 !! wikitext
17782 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17783 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17784 !! html
17786 <span title="ЛаCтин">ски</span>
17787 </p>
17788 !! end
17791 !! test
17792 Explicit session-wise language variant mapping (A flag and - flag)
17793 !! options
17794 language=zh variant=zh-tw
17795 !! wikitext
17796 Taiwan is not China.
17797 But -{A|zh:China;zh-tw:Taiwan}- is China,
17798 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17799 and -{China}- is China.
17800 !! html
17801 <p>Taiwan is not China.
17802 But Taiwan is Taiwan,
17803 (This should be stripped!)
17804 and China is China.
17805 </p>
17806 !! end
17808 !! test
17809 Explicit session-wise language variant mapping (H flag for hide)
17810 !! options
17811 language=zh variant=zh-tw
17812 !! wikitext
17813 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17814 Taiwan is China.
17815 !! html
17816 <p>(This should be stripped!)
17817 Taiwan is Taiwan.
17818 </p>
17819 !! end
17821 !! test
17822 Adding explicit conversion rule for title (T flag)
17823 !! options
17824 language=zh variant=zh-tw showtitle
17825 !! wikitext
17826 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17827 !! html
17828 Taiwan
17829 <p>Should be stripped!
17830 </p>
17831 !! end
17833 !! test
17834 Testing that changing the language variant here in the tests actually works
17835 !! options
17836 language=zh variant=zh showtitle
17837 !! wikitext
17838 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17839 !! html
17840 China
17841 <p>Should be stripped!
17842 </p>
17843 !! end
17845 !! test
17846 Recursive conversion of alt and title attrs shouldn't clear converter state
17847 !! options
17848 language=zh variant=zh-cn showtitle
17849 !! wikitext
17850 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17851 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17852 !! html
17853 China
17855 Should be stripped<span title="Exclamation">!</span>
17856 </p>
17857 !! end
17859 !! test
17860 Bug 24072: more test on conversion rule for title
17861 !! options
17862 language=zh variant=zh-tw showtitle
17863 !! wikitext
17864 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17865 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17866 !! html
17867 Taiwan
17868 <p>This should be stripped!
17869 This won't take interferes with the title rule.
17870 </p>
17871 !! end
17873 !! test
17874 Partly disable title conversion if variant == main language code
17875 !! options
17876 language=zh variant=zh title=[[ZH]] showtitle
17877 !! wikitext
17878 -{T|zh-cn:CN;zh-tw:TW}-
17879 !! html
17882 </p>
17883 !! end
17885 !! test
17886 Partly disable title conversion if variant == main language code, more
17887 !! options
17888 language=zh variant=zh title=[[ZH]] showtitle
17889 !! wikitext
17890 -{T|TW}-
17891 !! html
17894 </p>
17895 !! end
17897 !! test
17898 Raw output of variant escape tags (R flag)
17899 !! options
17900 language=zh variant=zh-tw
17901 !! wikitext
17902 Raw: -{R|zh:China;zh-tw:Taiwan}-
17903 !! html
17904 <p>Raw: zh:China;zh-tw:Taiwan
17905 </p>
17906 !! end
17908 !! test
17909 Nested using of manual convert syntax
17910 !! options
17911 language=zh variant=zh-hk
17912 !! wikitext
17913 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17914 !! html
17915 <p>Nested: Hello Hong Kong!
17916 </p>
17917 !! end
17919 !! test
17920 Proper conversion of text in external links
17921 !! options
17922 language=sr variant=sr-ec
17923 !! wikitext
17924 http://www.google.com
17925 gopher://www.google.com
17926 [http://www.google.com http://www.google.com]
17927 [gopher://www.google.com gopher://www.google.com]
17928 [https://www.google.com irc://www.google.com]
17929 [ftp://www.google.com www.google.com/ftp://dir]
17930 [//www.google.com www.google.com]
17931 !! html
17932 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17933 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17934 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17935 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17936 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17937 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17938 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17939 </p>
17940 !! end
17942 !! test
17943 Do not convert roman numbers to language variants
17944 !! options
17945 language=sr variant=sr-ec
17946 !! wikitext
17947 Fridrih IV je car.
17948 !! html
17949 <p>Фридрих IV је цар.
17950 </p>
17951 !! end
17953 !! test
17954 Unclosed language converter markup "-{"
17955 !! options
17956 language=sr
17957 !! wikitext
17958 -{T|hello
17959 !! html
17960 <p>-{T|hello
17961 </p>
17962 !! end
17964 !! test
17965 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17966 !! options
17967 language=sr
17968 !! wikitext
17969 -{R|=&gt;}-
17970 !! html
17971 <p>=&gt;
17972 </p>
17973 !!end
17975 !! test
17976 Don't break link parsing if language converter markup is in the caption.
17977 !! options
17978 language=sr variant=sr-ec
17979 !! wikitext
17980 [[Main Page|-{R|main page}-]]
17981 !! html
17982 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17983 </p>
17984 !! end
17986 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17987 !! test
17988 Don't break image parsing if language converter markup is in the caption.
17989 !! options
17990 language=sr
17991 !! wikitext
17992 [[File:Foobar.jpg|-{R|caption}-]]
17993 !! html/parsoid
17994 <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>
17995 </p>
17996 !! end
17998 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17999 !! test
18000 Don't break list handling if language converter markup is in the item.
18001 !! options
18002 language=zh variant=zh-cn
18003 !! wikitext
18004 ;-{zh-cn:AAA;zh-tw:BBB}-
18005 !! html/php
18006 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
18008 !! html/parsoid
18009 <dl><dt>AAA
18010 </dt></dl>
18011 !! end
18013 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18014 !! test
18015 Don't break table handling if language converter markup is in the cell.
18016 !! options
18017 language=sr variant=sr-ec
18018 !! wikitext
18021 | -{R|B}-
18023 !! html/php
18024 <table>
18026 <tr>
18027 <td>Б}-
18028 </td></tr></table>
18030 !! html/parsoid
18031 <table>
18033 <tr>
18034 <td> B
18035 </td></tr></table>
18037 !! end
18039 !! test
18040 Bug 529: Uncovered bullet
18041 !! wikitext
18042 * Foo {{bullet}}
18043 !! html
18044 <ul><li> Foo </li>
18045 <li> Bar</li></ul>
18047 !! end
18049 # Plain MediaWiki does not remove empty lists, but tidy actually does.
18050 # Templates in Wikipedia rely on this behavior, as tidy has always been
18051 # enabled there. These tests are normally run *without* tidy, so specify the
18052 # full output here. 
18053 # To test realistic parsing behavior, apply a tidy-like transformation to both
18054 # the expected output and your parser's output.
18055 !! test
18056 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
18057 !! wikitext
18058 ******* Foo {{bullet}}
18059 !! html
18060 <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>
18061 <li> Bar</li></ul>
18063 !! end
18065 !! test
18066 Bug 529: Uncovered table already at line-start
18067 !! wikitext
18070 {{table}}
18072 !! html
18073 <p>x
18074 </p>
18075 <table>
18076 <tr>
18077 <td> 1 </td>
18078 <td> 2
18079 </td></tr>
18080 <tr>
18081 <td> 3 </td>
18082 <td> 4
18083 </td></tr></table>
18084 <p>y
18085 </p>
18086 !! end
18088 !! test
18089 Bug 529: Uncovered bullet in parser function result
18090 !! wikitext
18091 * Foo {{lc:{{bullet}} }}
18092 !! html
18093 <ul><li> Foo </li>
18094 <li> bar</li></ul>
18096 !! end
18098 !! test
18099 Bug 5678: Double-parsed template argument
18100 !! wikitext
18101 {{lc:{{{1}}}|hello}}
18102 !! html
18103 <p>{{{1}}}
18104 </p>
18105 !! end
18107 !! test
18108 Bug 5678: Double-parsed template invocation
18109 !! wikitext
18110 {{lc:{{paramtest {{!}} param = hello }} }}
18111 !! html
18112 <p>{{paramtest | param = hello }}
18113 </p>
18114 !! end
18116 !! test
18117 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
18118 !! options
18119 language=cs
18120 title=[[Main Page]]
18121 !! wikitext
18122 {{PRVNÍVELKÉ:ěščř}}
18123 {{prvnívelké:ěščř}}
18124 {{PRVNÍMALÉ:ěščř}}
18125 {{prvnímalé:ěščř}}
18126 {{MALÁ:ěščř}}
18127 {{malá:ěščř}}
18128 {{VELKÁ:ěščř}}
18129 {{velká:ěščř}}
18130 !! html
18131 <p>Ěščř
18132 Ěščř
18133 ěščř
18134 ěščř
18135 ěščř
18136 ěščř
18137 ĚŠČŘ
18138 ĚŠČŘ
18139 </p>
18140 !! end
18142 !! test
18143 Morwen/13: Unclosed link followed by heading
18144 !! wikitext
18145 [[link
18146 ==heading==
18147 !! html
18148 <p>[[link
18149 </p>
18150 <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>
18152 !! end
18154 !! test
18155 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
18156 !! wikitext
18157 {{foo|
18158 =heading=
18159 !! html
18160 <p>{{foo|
18161 </p>
18162 <h1><span class="mw-headline" id="heading">heading</span></h1>
18164 !! end
18166 !! test
18167 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
18168 !! wikitext
18169 {{foo|
18170 ==heading==
18171 !! html
18172 <p>{{foo|
18173 </p>
18174 <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>
18176 !! end
18178 !! test
18179 Tildes in comments
18180 !! options
18182 !! wikitext
18183 <!-- ~~~~ -->
18184 !! html
18185 <!-- ~~~~ -->
18186 !! end
18188 !! test
18189 Paragraphs inside divs (no extra line breaks)
18190 !! wikitext
18191 <div>Line one
18193 Line two</div>
18194 !! html
18195 <div>Line one
18196 Line two</div>
18198 !! end
18200 !! test
18201 Paragraphs inside divs (extra line break on open)
18202 !! wikitext
18203 <div>
18204 Line one
18206 Line two</div>
18207 !! html
18208 <div>
18209 <p>Line one
18210 </p>
18211 Line two</div>
18213 !! end
18215 !! test
18216 Paragraphs inside divs (extra line break on close)
18217 !! wikitext
18218 <div>Line one
18220 Line two
18221 </div>
18222 !! html
18223 <div>Line one
18224 <p>Line two
18225 </p>
18226 </div>
18228 !! end
18230 !! test
18231 Paragraphs inside divs (extra line break on open and close)
18232 !! wikitext
18233 <div>
18234 Line one
18236 Line two
18237 </div>
18238 !! html
18239 <div>
18240 <p>Line one
18241 </p><p>Line two
18242 </p>
18243 </div>
18245 !! end
18247 !! test
18248 Nesting tags, paragraphs on lines which begin with <div>
18249 !! wikitext
18250 <div></div><strong>A
18251 B</strong>
18252 !! html/php+tidy
18253 <p><strong>A</strong></p>
18254 <p><strong>B</strong></p>
18255 !! html/parsoid
18256 <div></div>
18257 <p><strong>A
18258 B</strong>
18259 </p>
18260 !! end
18262 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18263 !! test
18264 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18265 !! wikitext
18266 <blockquote>Line one
18268 Line two</blockquote>
18269 !! html
18270 <blockquote>Line one
18271 Line two</blockquote>
18273 !! html+tidy
18274 <blockquote>
18275 <p>Line one Line two</p>
18276 </blockquote>
18277 !! end
18279 !! test
18280 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18281 !! wikitext
18282 <blockquote>
18283 Line one
18285 Line two</blockquote>
18286 !! html
18287 <blockquote>
18288 <p>Line one
18289 </p>
18290 Line two</blockquote>
18292 !! html+tidy
18293 <blockquote>
18294 <p>Line one</p>
18295 Line two</blockquote>
18296 !! end
18298 !! test
18299 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18300 !! wikitext
18301 <blockquote>Line one
18303 Line two
18304 </blockquote>
18305 !! html
18306 <blockquote>Line one
18307 <p>Line two
18308 </p>
18309 </blockquote>
18311 !! html+tidy
18312 <blockquote>
18313 <p>Line one</p>
18314 <p>Line two</p>
18315 </blockquote>
18316 !! end
18318 !! test
18319 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18320 !! wikitext
18321 <blockquote>
18322 Line one
18324 Line two
18325 </blockquote>
18326 !! html
18327 <blockquote>
18328 <p>Line one
18329 </p><p>Line two
18330 </p>
18331 </blockquote>
18333 !! html+tidy
18334 <blockquote>
18335 <p>Line one</p>
18336 <p>Line two</p>
18337 </blockquote>
18338 !! end
18340 !! test
18341 Paragraphs inside blockquotes/divs (no extra line breaks)
18342 !! wikitext
18343 <blockquote><div>Line one
18345 Line two</div></blockquote>
18346 !! html
18347 <blockquote><div>Line one
18348 Line two</div></blockquote>
18350 !! end
18352 !! test
18353 Paragraphs inside blockquotes/divs (extra line break on open)
18354 !! wikitext
18355 <blockquote><div>
18356 Line one
18358 Line two</div></blockquote>
18359 !! html
18360 <blockquote><div>
18361 <p>Line one
18362 </p>
18363 Line two</div></blockquote>
18365 !! end
18367 !! test
18368 Paragraphs inside blockquotes/divs (extra line break on close)
18369 !! wikitext
18370 <blockquote><div>Line one
18372 Line two
18373 </div></blockquote>
18374 !! html
18375 <blockquote><div>Line one
18376 <p>Line two
18377 </p>
18378 </div></blockquote>
18380 !! end
18382 !! test
18383 Paragraphs inside blockquotes/divs (extra line break on open and close)
18384 !! wikitext
18385 <blockquote><div>
18386 Line one
18388 Line two
18389 </div></blockquote>
18390 !! html
18391 <blockquote><div>
18392 <p>Line one
18393 </p><p>Line two
18394 </p>
18395 </div></blockquote>
18397 !! end
18399 !! test
18400 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18401 !! options
18402 wgLinkHolderBatchSize=0
18403 !! wikitext
18404 [[meatball:1]]
18405 [[meatball:2]]
18406 [[meatball:3]]
18407 !! html
18408 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18409 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18410 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18411 </p>
18412 !! end
18414 !! test
18415 Free external link invading image caption
18416 !! wikitext
18417 [[Image:Foobar.jpg|thumb|http://x|hello]]
18418 !! html
18419 <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>
18421 !! end
18423 !! test
18424 Bug 15196: localised external link numbers
18425 !! options
18426 language=fa
18427 !! wikitext
18428 [http://en.wikipedia.org/]
18429 !! html/php
18430 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18431 </p>
18432 !! html/parsoid
18433 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18434 !! end
18436 !! test
18437 Multibyte character in padleft
18438 !! wikitext
18439 {{padleft:-Hello|7|Æ}}
18440 !! html
18441 <p>Æ-Hello
18442 </p>
18443 !! end
18445 !! test
18446 Multibyte character in padright
18447 !! wikitext
18448 {{padright:Hello-|7|Æ}}
18449 !! html
18450 <p>Hello-Æ
18451 </p>
18452 !! end
18454 !!test
18455 formatdate parser function
18456 !! wikitext
18457 {{#formatdate:2009-03-24}}
18458 !! html
18459 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18460 </p>
18461 !! end
18463 !!test
18464 formatdate parser function, with default format
18465 !! wikitext
18466 {{#formatdate:2009-03-24|mdy}}
18467 !! html
18468 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18469 </p>
18470 !! end
18472 !! test
18473 Spacing of numbers in formatted dates
18474 !! wikitext
18475 {{#formatdate:January 15}}
18476 !! html
18477 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18478 </p>
18479 !! end
18481 !! test
18482 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
18483 !! options
18484 language=nl title=[[MediaWiki:Common.css]]
18485 !! wikitext
18486 {{#formatdate:2009-03-24|dmy}}
18487 !! html
18488 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18489 </p>
18490 !! end
18497 # Edit comments
18500 !! test
18501 Edit comment with link
18502 !! options
18503 comment
18504 !! wikitext
18505 I like the [[Main Page]] a lot
18506 !! html
18507 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18508 !!end
18510 !! test
18511 Edit comment with link and link text
18512 !! options
18513 comment
18514 !! wikitext
18515 I like the [[Main Page|best pages]] a lot
18516 !! html
18517 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18518 !!end
18520 !! test
18521 Edit comment with link and link text with suffix
18522 !! options
18523 comment
18524 !! wikitext
18525 I like the [[Main Page|best page]]s a lot
18526 !! html
18527 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18528 !!end
18530 !! test
18531 Edit comment with section link (non-local, eg in history list)
18532 !! options
18533 comment title=[[Main Page]]
18534 !! wikitext
18535 /* External links */ removed bogus entries
18536 !! html
18537 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18538 !!end
18540 !! test
18541 Edit comment with section link and text before it (non-local, eg in history list)
18542 !! options
18543 comment title=[[Main Page]]
18544 !! wikitext
18545 pre-comment text /* External links */ removed bogus entries
18546 !! html
18547 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>
18548 !!end
18550 !! test
18551 Edit comment with section link (local, eg in diff view)
18552 !! options
18553 comment local title=[[Main Page]]
18554 !! wikitext
18555 /* External links */ removed bogus entries
18556 !! html
18557 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18558 !!end
18560 !! test
18561 Edit comment with subpage link (bug 14080)
18562 !! options
18563 comment
18564 subpage
18565 title=[[Subpage test]]
18566 !! wikitext
18567 Poked at a [[/subpage]] here...
18568 !! html
18569 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18570 !!end
18572 !! test
18573 Edit comment with subpage link and link text (bug 14080)
18574 !! options
18575 comment
18576 subpage
18577 title=[[Subpage test]]
18578 !! wikitext
18579 Poked at a [[/subpage|neat little page]] here...
18580 !! html
18581 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18582 !!end
18584 !! test
18585 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18586 !! options
18587 comment
18588 title=[[Subpage test]]
18589 !! wikitext
18590 Poked at a [[/subpage]] here...
18591 !! html
18592 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...
18593 !!end
18595 !! test
18596 Edit comment with bare anchor link (local, as on diff)
18597 !! options
18598 comment
18599 local
18600 title=[[Main Page]]
18601 !! wikitext
18602 [[#section]]
18603 !! html
18604 <a href="#section">#section</a>
18605 !! end
18607 !! test
18608 Edit comment with bare anchor link (non-local, as on history)
18609 !! options
18610 comment
18611 title=[[Main Page]]
18612 !! wikitext
18613 [[#section]]
18614 !! html
18615 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18616 !! end
18618 !! test
18619 Anchor starting with underscore
18620 !! wikitext
18621 [[#_ref|One]]
18622 !! html
18623 <p><a href="#_ref">One</a>
18624 </p>
18625 !! end
18627 !! test
18628 Id starting with underscore
18629 !! wikitext
18630 <div id="_ref"></div>
18631 !! html
18632 <div id="_ref"></div>
18634 !! end
18636 !! test
18637 Space normalisation on autocomment (bug 22784)
18638 !! options
18639 comment
18640 title=[[Main Page]]
18641 !! wikitext
18642 /* __hello__world__ */
18643 !! html
18644 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18645 !! end
18647 !! test
18648 percent-encoding and + signs in comments (Bug 26410)
18649 !! options
18650 comment
18651 !! wikitext
18652 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18653 !! html
18654 <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>
18655 !! end
18657 # Parsoid doesn't support this yet: see bug 73581
18658 # but it *should* omit the 'src' attribute if the image is bad.
18659 # PHP side of tests was disabled in
18660 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18661 # because of issues in the PHP parserTests infrastructure
18662 # (but the output below is indeed what the PHP side emits)
18663 !! test
18664 Bad images - basic functionality
18665 !! wikitext
18666 [[File:Bad.jpg]]
18667 !! DISABLED/html/php
18668 !! html/parsoid
18669 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
18670 !! end
18672 !! test
18673 Bad images - bug 16039: text after bad image disappears
18674 !! wikitext
18675 Foo bar
18676 [[File:Bad.jpg]]
18677 Bar foo
18678 !! DISABLED/html/php
18679 <p>Foo bar
18680 </p><p>Bar foo
18681 </p>
18682 !! html/parsoid
18683 <p>Foo bar
18684 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
18685 Bar foo</p>
18686 !! end
18688 !! test
18689 Verify that displaytitle works (bug #22501) no displaytitle
18690 !! options
18691 showtitle
18692 !! config
18693 wgAllowDisplayTitle=true
18694 wgRestrictDisplayTitle=false
18695 !! wikitext
18696 this is not the the title
18697 !! html
18698 Parser test
18699 <p>this is not the the title
18700 </p>
18701 !! end
18703 !! test
18704 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18705 !! options
18706 showtitle
18707 title=[[Screen]]
18708 !! config
18709 wgAllowDisplayTitle=true
18710 wgRestrictDisplayTitle=false
18711 !! wikitext
18712 this is not the the title
18713 {{DISPLAYTITLE:whatever}}
18714 !! html
18715 whatever
18716 <p>this is not the the title
18717 </p>
18718 !! end
18720 !! test
18721 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18722 !! options
18723 showtitle
18724 title=[[Screen]]
18725 !! config
18726 wgAllowDisplayTitle=true
18727 wgRestrictDisplayTitle=true
18728 !! wikitext
18729 this is not the the title
18730 {{DISPLAYTITLE:whatever}}
18731 !! html
18732 Screen
18733 <p>this is not the the title
18734 </p>
18735 !! end
18737 !! test
18738 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18739 !! options
18740 showtitle
18741 title=[[Screen]]
18742 !! config
18743 wgAllowDisplayTitle=true
18744 wgRestrictDisplayTitle=true
18745 !! wikitext
18746 this is not the the title
18747 {{DISPLAYTITLE:screen}}
18748 !! html
18749 screen
18750 <p>this is not the the title
18751 </p>
18752 !! end
18754 !! test
18755 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18756 !! options
18757 showtitle
18758 title=[[Screen]]
18759 !! config
18760 wgAllowDisplayTitle=false
18761 !! wikitext
18762 this is not the the title
18763 {{DISPLAYTITLE:screen}}
18764 !! html
18765 Screen
18766 <p>this is not the the title
18767 <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>
18768 </p>
18769 !! end
18771 !! test
18772 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18773 !! options
18774 showtitle
18775 title=[[Screen]]
18776 !! config
18777 wgAllowDisplayTitle=false
18778 !! wikitext
18779 this is not the the title
18780 !! html
18781 Screen
18782 <p>this is not the the title
18783 </p>
18784 !! end
18786 !! test
18787 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18788 !! options
18789 showtitle
18790 title=[[Screen]]
18791 !! config
18792 wgAllowDisplayTitle=true
18793 wgRestrictDisplayTitle=true
18794 !! wikitext
18795 this is not the the title
18796 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18797 !! html
18798 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18799 <p>this is not the the title
18800 </p>
18801 !! end
18803 !! test
18804 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18805 !! options
18806 showtitle
18807 title=[[Screen]]
18808 !! config
18809 wgAllowDisplayTitle=true
18810 wgRestrictDisplayTitle=true
18811 !! wikitext
18812 this is not the the title
18813 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18814 !! html
18815 <span style="color: red;">s</span>creen
18816 <p>this is not the the title
18817 </p>
18818 !! end
18820 !! test
18821 preload: check <noinclude> and <includeonly>
18822 !! options
18823 preload
18824 !! wikitext
18825 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18826 !! html
18827 Hello kind world.
18828 !! end
18830 !! test
18831 preload: check <onlyinclude>
18832 !! options
18833 preload
18834 !! wikitext
18835 Goodbye <onlyinclude>Hello world</onlyinclude>
18836 !! html
18837 Hello world
18838 !! end
18840 !! test
18841 preload: can pass tags through if we want to
18842 !! options
18843 preload
18844 !! wikitext
18845 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18846 !! html
18847 <includeonly>Hello world</includeonly>
18848 !! end
18850 !! test
18851 preload: check that it doesn't try to do tricks
18852 !! options
18853 preload
18854 !! wikitext
18855 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18856 !! html
18857 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18858 !! end
18860 !! test
18861 Play a bit with r67090 and bug 3158
18862 !! wikitext
18863 <div style="width:50% !important">&nbsp;</div>
18864 <div style="width:50%&nbsp;!important">&nbsp;</div>
18865 <div style="width:50%&#160;!important">&nbsp;</div>
18866 <div style="border : solid;">&nbsp;</div>
18867 !! html/php
18868 <div style="width:50% !important">&#160;</div>
18869 <div style="width:50% !important">&#160;</div>
18870 <div style="width:50% !important">&#160;</div>
18871 <div style="border&#160;: solid;">&#160;</div>
18873 !! html/parsoid
18874 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18875 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18876 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18877 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
18879 !! end
18881 !! test
18882 HTML5 data attributes
18883 !! wikitext
18884 <span data-foo="bar">Baz</span>
18885 <p data-abc-def_hij="">Quuz</p>
18886 !! html
18887 <p><span data-foo="bar">Baz</span>
18888 </p>
18889 <p data-abc-def_hij="">Quuz</p>
18891 !! end
18893 !! test
18894 percent-encoding and + signs in internal links (Bug 26410)
18895 !! wikitext
18896 [[User:+%]] [[Page+title%]]
18897 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18898 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18899 [[%33%45]] [[%33%45+]]
18900 !! html/php
18901 <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>
18902 <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>
18903 <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>
18904 <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>
18905 </p>
18906 !! html/parsoid
18907 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
18908 !! end
18910 !! test
18911 Special characters in embedded file links (bug 27679)
18912 !! wikitext
18913 [[File:Contains & ampersand.jpg]]
18914 [[File:Does not exist.jpg|Title with & ampersand]]
18915 !! html/php
18916 <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>
18917 <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>
18918 </p>
18919 !! html/parsoid
18920 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
18921 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp; ampersand"}'><a href="File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
18922 !! end
18924 !! test
18925 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18926 !! wikitext
18927 Text&apos;s been normalized?
18928 !! html
18929 <p>Text&#39;s been normalized?
18930 </p>
18931 !! end
18933 !! test
18934 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18935 !! wikitext
18936 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18937 !! html
18938 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18939 </p>
18940 !! end
18942 !! test
18943 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18944 !! wikitext
18945 [http://www.example.org/ ideograms]
18946 !! html
18947 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18948 </p>
18949 !! end
18951 !! test
18952 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18953 !! wikitext
18954 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18955 !! html
18956 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18957 </p>
18958 !! end
18960 !! article
18961 Mediawiki:loop1
18962 !! text
18963 {{Identical|A}}
18964 !! endarticle
18966 !! article
18967 Mediawiki:loop2
18968 !! text
18969 {{Identical|B}}
18970 !! endarticle
18972 !! article
18973 Template:Identical
18974 !! text
18975 {{int:loop1}}
18976 {{int:loop2}}
18977 !! endarticle
18979 !! test
18980 Bug 31098 Template which includes system messages which includes the template
18981 !! wikitext
18982 {{Identical}}
18983 !! html
18984 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18985 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18986 </p>
18987 !! end
18989 !! test
18990 Bug31490 Turkish: ucfirst 'blah'
18991 !! options
18992 language=tr
18993 !! wikitext
18994 {{ucfirst:blah}}
18995 !! html
18996 <p>Blah
18997 </p>
18998 !! end
19000 !! test
19001 Bug31490 Turkish: ucfirst 'ix'
19002 !! options
19003 language=tr
19004 !! wikitext
19005 {{ucfirst:ix}}
19006 !! html
19007 <p>İx
19008 </p>
19009 !! end
19011 !! test
19012 Bug31490 Turkish: lcfirst 'BLAH'
19013 !! options
19014 language=tr
19015 !! wikitext
19016 {{lcfirst:BLAH}}
19017 !! html
19018 <p>bLAH
19019 </p>
19020 !! end
19022 !! test
19023 Bug31490 Turkish: ucfırst (with a dotless i)
19024 !! options
19025 language=tr
19026 !! wikitext
19027 {{ucfırst:blah}}
19028 !! html
19029 <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>
19030 </p>
19031 !! end
19033 !! test
19034 Bug31490 ucfırst (with a dotless i) with English language
19035 !! options
19036 language=en
19037 !! wikitext
19038 {{ucfırst:blah}}
19039 !! html
19040 <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>
19041 </p>
19042 !! end
19044 !! test
19045 Bug 26375: TOC with italics
19046 !! options
19047 title=[[Main Page]]
19048 !! wikitext
19049 __TOC__
19050 == ''Lost'' episodes ==
19051 !! html
19052 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19053 <ul>
19054 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
19055 </ul>
19056 </div>
19058 <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>
19060 !! end
19062 !! test
19063 Bug 26375: TOC with bold
19064 !! options
19065 title=[[Main Page]]
19066 !! wikitext
19067 __TOC__
19068 == '''should be bold''' then normal text ==
19069 !! html
19070 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19071 <ul>
19072 <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>
19073 </ul>
19074 </div>
19076 <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>
19078 !! end
19080 !! test
19081 Bug 33845: Headings become cursive in TOC when they contain an image
19082 !! options
19083 title=[[Main Page]]
19084 !! wikitext
19085 __TOC__
19086 == Image [[Image:foobar.jpg]] ==
19087 !! html
19088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19089 <ul>
19090 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
19091 </ul>
19092 </div>
19094 <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>
19096 !! end
19098 !! test
19099 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
19100 !! options
19101 title=[[Main Page]]
19102 !! wikitext
19103 __TOC__
19104 == <blockquote>Quote</blockquote> ==
19105 !! html
19106 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19107 <ul>
19108 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19109 </ul>
19110 </div>
19112 <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>
19114 !! html+tidy
19115 <div id="toc" class="toc">
19116 <div id="toctitle">
19117 <h2>Contents</h2>
19118 </div>
19119 <ul>
19120 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
19121 </ul>
19122 </div>
19123 <h2><span class="mw-headline" id="Quote"></span></h2>
19124 <blockquote>
19125 <p><span class="mw-headline" id="Quote">Quote</span></p>
19126 </blockquote>
19127 <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>
19128 !! end
19130 !! test
19131 Unclosed tags in TOC
19132 !! options
19133 title=[[Main Page]]
19134 !! wikitext
19135 __TOC__
19136 == Proof: 2 < 3 ==
19137 <small>Hanc marginis exiguitas non caperet.</small>
19139 !! html
19140 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19141 <ul>
19142 <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>
19143 </ul>
19144 </div>
19146 <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>
19147 <p><small>Hanc marginis exiguitas non caperet.</small>
19149 </p>
19150 !! end
19152 !! test
19153 Multiple tags in TOC
19154 !! wikitext
19155 __TOC__
19156 == <i>Foo</i> <b>Bar</b> ==
19158 == <i>Foo</i> <blockquote>Bar</blockquote> ==
19159 !! html
19160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19161 <ul>
19162 <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>
19163 <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>
19164 </ul>
19165 </div>
19167 <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>
19168 <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>
19170 !! html+tidy
19171 <div id="toc" class="toc">
19172 <div id="toctitle">
19173 <h2>Contents</h2>
19174 </div>
19175 <ul>
19176 <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>
19177 <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>
19178 </ul>
19179 </div>
19180 <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>
19181 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
19182 <blockquote>
19183 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
19184 </blockquote>
19185 <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>
19186 !! end
19188 !! test
19189 Tags with parameters in TOC
19190 !! wikitext
19191 __TOC__
19192 == <sup class="in-h2">Hello</sup> ==
19194 == <sup class="a > b">Evilbye</sup> ==
19195 !! html
19196 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19197 <ul>
19198 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19199 <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>
19200 </ul>
19201 </div>
19203 <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>
19204 <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>
19206 !! end
19208 !! test
19209 span tags with directionality in TOC
19210 !! wikitext
19211 __TOC__
19212 == <span dir="ltr">C++</span> ==
19214 == <span dir="rtl">זבנג!</span> ==
19216 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19218 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19220 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19221 !! html
19222 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19223 <ul>
19224 <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>
19225 <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>
19226 <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>
19227 <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>
19228 <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>
19229 </ul>
19230 </div>
19232 <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>
19233 <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>
19234 <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>
19235 <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>
19236 <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>
19238 !! end
19240 !! test
19241 Bug 72884: bdi element in ToC
19242 !! wikitext
19243 __TOC__
19244 == <bdi>test</bdi> ==
19245 !! html
19246 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19247 <ul>
19248 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19249 </ul>
19250 </div>
19252 <h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19254 !! end
19256 !! article
19257 MediaWiki:Bug32057
19258 !! text
19259 == {{int:headline_sample}} ==
19260 !! endarticle
19262 !! test
19263 Bug 32057: Title needed when expanding <h> nodes.
19264 !! options
19265 title=[[Main Page]]
19266 !! wikitext
19267 {{int:Bug32057}}
19268 !! html
19269 <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>
19271 !! end
19273 !! test
19274 Strip marker in urlencode
19275 !! wikitext
19276 {{urlencode:x<nowiki/>y}}
19277 {{urlencode:x<nowiki/>y|wiki}}
19278 {{urlencode:x<nowiki/>y|path}}
19279 !! html
19280 <p>xy
19283 </p>
19284 !! end
19286 !! test
19287 Strip marker in lc
19288 !! wikitext
19289 {{lc:x<nowiki/>y}}
19290 !! html
19291 <p>xy
19292 </p>
19293 !! end
19295 !! test
19296 Strip marker in uc
19297 !! wikitext
19298 {{uc:x<nowiki/>y}}
19299 !! html
19300 <p>XY
19301 </p>
19302 !! end
19304 !! test
19305 Strip marker in formatNum
19306 !! wikitext
19307 {{formatnum:1<nowiki/>2}}
19308 {{formatnum:1<nowiki/>2|R}}
19309 !! html
19310 <p>12
19312 </p>
19313 !! end
19315 !! test
19316 Check noCommafy in formatNum
19317 !! options
19318 language=be-tarask
19319 !! wikitext
19320 {{formatnum:123456.78}}
19321 {{formatnum:123456.78|NOSEP}}
19322 !! html
19323 <p>123 456,78
19324 123456.78
19325 </p>
19326 !! end
19328 !! test
19329 Wrong option for formatNum (bug 56199)
19330 !! wikitext
19331 {{formatnum:1,234.56|Random}}
19332 {{formatnum:1,234.56|EVERYTHING}}
19333 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19334 !! html
19335 <p>1,234.56
19336 1,234.56
19337 1,234.56
19338 </p>
19339 !! end
19341 !! test
19342 Strip marker in grammar
19343 !! options
19344 language=fi
19345 !! wikitext
19346 {{grammar:elative|foo<nowiki/>bar}}
19347 !! html
19348 <p>foobarista
19349 </p>
19350 !! end
19352 !! test
19353 Strip marker in padleft
19354 !! wikitext
19355 {{padleft:|2|x<nowiki/>y}}
19356 !! html
19357 <p>xy
19358 </p>
19359 !! end
19361 !! test
19362 Strip marker in padright
19363 !! wikitext
19364 {{padright:|2|x<nowiki/>y}}
19365 !! html
19366 <p>xy
19367 </p>
19368 !! end
19370 !! test
19371 Strip marker in anchorencode
19372 !! wikitext
19373 {{anchorencode:x<nowiki/>y}}
19374 !! html
19375 <p>xy
19376 </p>
19377 !! end
19379 !! test
19380 nowiki inside link inside heading (bug 18295)
19381 !! wikitext
19382 ==[[foo|x<nowiki>y</nowiki>z]]==
19383 !! html
19384 <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>
19386 !! end
19388 !! test
19389 new support for bdi element (bug 31817)
19390 !! wikitext
19391 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19392 !! html
19393 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19395 !!end
19397 !! test
19398 Ignore pipe between table row attributes
19399 !! wikitext
19401 | quux
19402 |- id=foo | style='color: red'
19403 | bar
19405 !! html
19406 <table>
19407 <tr>
19408 <td> quux
19409 </td></tr>
19410 <tr id="foo" style="color: red">
19411 <td> bar
19412 </td></tr></table>
19414 !! end
19416 !!test
19417 Gallery override link with WikiLink (bug 34852)
19418 !! wikitext
19419 <gallery>
19420 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19421 </gallery>
19422 !! html
19423 <ul class="gallery mw-gallery-traditional">
19424                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19425                         <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>
19426                         <div class="gallerytext">
19427 <p>caption
19428 </p>
19429                         </div>
19430                 </div></li>
19431 </ul>
19433 !! end
19435 !!test
19436 Gallery override link with absolute external link (bug 34852)
19437 !! wikitext
19438 <gallery>
19439 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19440 </gallery>
19441 !! html
19442 <ul class="gallery mw-gallery-traditional">
19443                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19444                         <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>
19445                         <div class="gallerytext">
19446 <p>caption
19447 </p>
19448                         </div>
19449                 </div></li>
19450 </ul>
19452 !! end
19454 !!test
19455 Gallery override link with malicious javascript (bug 34852)
19456 !! wikitext
19457 <gallery>
19458 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19459 </gallery>
19460 !! html
19461 <ul class="gallery mw-gallery-traditional">
19462                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19463                         <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>
19464                         <div class="gallerytext">
19465 <p>caption
19466 </p>
19467                         </div>
19468                 </div></li>
19469 </ul>
19471 !! end
19473 !!test
19474 Gallery with invalid title as link (bug 43964)
19475 !! wikitext
19476 <gallery>
19477 File:foobar.jpg|link=<
19478 </gallery>
19479 !! html
19480 <ul class="gallery mw-gallery-traditional">
19481                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19482                         <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>
19483                         <div class="gallerytext">
19484                         </div>
19485                 </div></li>
19486 </ul>
19488 !! end
19490 !!test
19491 Language parser function
19492 !! wikitext
19493 {{#language:ar}}
19494 !! html
19495 <p>العربية
19496 </p>
19497 !! end
19499 !!test
19500 Padleft and padright as substr
19501 !! wikitext
19502 {{padleft:|3|abcde}}
19503 {{padright:|3|abcde}}
19504 !! html
19505 <p>abc
19507 </p>
19508 !! end
19510 !!test
19511 Special parser function
19512 !! wikitext
19513 {{#special:RandomPage}}
19514 {{#special:BaDtItLe}}
19515 {{#special:Foobar}}
19516 !! html
19517 <p>Special:Random
19518 Special:Badtitle
19519 Special:Foobar
19520 </p>
19521 !! end
19523 !!test
19524 Bug 34939 - Case insensitive link parsing ([HttP://])
19525 !! wikitext
19526 [HttP://MediaWiki.Org/]
19527 !! html/php
19528 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19529 </p>
19530 !! html/parsoid
19531 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19532 !! end
19534 !!test
19535 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19536 !! wikitext
19537 [HttP://MediaWiki.Org/ MediaWiki]
19538 !! html
19539 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19540 </p>
19541 !! end
19543 !!test
19544 Bug 34939 - Case insensitive link parsing (HttP://)
19545 !! wikitext
19546 HttP://MediaWiki.Org/
19547 !! html/php
19548 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19549 </p>
19550 !! html/parsoid
19551 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19552 !! end
19554 !!test
19555 Disable TOC
19556 !! options
19557 notoc
19558 !! wikitext
19559 Lead
19560 == Section 1 ==
19561 == Section 2 ==
19562 == Section 3 ==
19563 == Section 4 ==
19564 == Section 5 ==
19565 !! html
19566 <p>Lead
19567 </p>
19569 <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>
19570 <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>
19571 <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>
19572 <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>
19573 <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>
19575 !! end
19579 ### Parsoid-specific tests
19580 ### Parsoid-PHP parser incompatibilities
19582 !!test
19583 1. SOL-sensitive wikitext tokens as template-args
19584 !!options
19585 parsoid=wt2html,wt2wt
19586 !! wikitext
19587 {{echo|*a}}
19588 {{echo|#a}}
19589 {{echo|:a}}
19590 !! html
19591 <span about="#mwt1" typeof="mw:Transclusion">
19592 </span><ul about="#mwt1"><li>a</li>
19593 </ul>
19594 <span about="#mwt2" typeof="mw:Transclusion">
19595 </span><ol about="#mwt2"><li>a</li>
19596 </ol>
19597 <span about="#mwt3" typeof="mw:Transclusion">
19598 </span><dl about="#mwt3"><dd>a</dd>
19599 </dl>
19600 !!end
19602 #### -----------------------------------------------------------------
19603 #### Parsoid-specific functionality tests
19604 #### -----------------------------------------------------------------
19606 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19607 # We know wt2wt will fail, but we expect selser to pass.
19608 # Due to the nature of our testing, wt2wt and selser tests will enter the
19609 # blacklist and we'll catch selser regressions based on changes to the
19610 # blacklist entries for selser tests.
19611 !! test
19612 1. Bad treebuilder fixup of formatting elt is cleaned up
19613 !! options
19614 parsoid=wt2html,wt2wt
19615 !! wikitext
19618 <small>
19619 [[Image:Foobar.jpg|right|Test]]
19620 </small>
19622 !! html/parsoid
19623 <table>
19624 <tbody><tr><td>
19625 <small>
19626 <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>
19627 </small>
19628 </td></tr>
19629 </tbody></table>
19630 !! end
19632 !! test
19633 2. Bad treebuilder fixup of formatting elt is cleaned up
19634 !! options
19635 parsoid=wt2html,wt2wt
19636 !! wikitext
19637 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19639 <small>[[Image:Foobar.jpg|right|300px]]</small>
19640 !! html/parsoid
19641 <p><b>foo</b></p>
19642 <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>
19643 <p><b>bar</b></p>
19644 <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>
19645 !! end
19647 #### ----------------------------------------------------------------
19648 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19649 #### tags. Parsoid's output for these tags differs from that of the
19650 #### PHP parser.
19651 #### ----------------------------------------------------------------
19653 !!test
19654 Ref: 1. ref-location should be replaced with an index span
19655 !!options
19656 parsoid
19657 !! wikitext
19658 A <ref>foo</ref>
19659 B <ref name="x">foo</ref>
19660 C <ref name="y" />
19661 !! html
19662 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19663 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>
19664 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>
19665 !!end
19667 !!test
19668 Ref: 2. ref-tags with identical names should all get the same index
19669 !!options
19670 parsoid
19671 !! wikitext
19672 A <ref name="x">foo</ref>
19673 B <ref name="x" />
19674 !! html
19675 <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>
19676 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>
19677 !!end
19679 !!test
19680 Ref: 3. spaces in ref-names should be ignored
19681 !!options
19682 parsoid
19683 !! wikitext
19684 A <ref name="x">foo</ref>
19685 B <ref name=" x " />
19686 C <ref name= x  />
19687 !! html
19688 <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>
19689 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>
19690 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>
19691 !!end
19693 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19694 !!test
19695 Ref: 4. 'constructor' should be accepted as a valid ref-name
19696 !!options
19697 parsoid
19698 !! wikitext
19699 A <ref name="constructor">foo</ref>
19700 !! html
19701 <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>
19702 !!end
19704 !!test
19705 Ref: 5. body should accept generic wikitext
19706 !!options
19707 parsoid
19708 !! wikitext
19709 A <ref>
19710  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19711 </ref>
19713 <references />
19714 !! html
19715 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19717 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19718 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</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>
19719 </li>
19720 </ol>
19721 !!end
19723 !!test
19724 Ref: 6. indent-pres should not be output in ref-body
19725 !!options
19726 parsoid
19727 !! wikitext
19728 A <ref>
19729  foo
19730  bar
19731  baz
19732 </ref>
19734 <references />
19735 !! html
19736 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19738 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19739 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19740  bar
19741  baz
19742 </li>
19743 </ol>
19744 !!end
19746 !!test
19747 Ref: 7. No p-wrapping in ref-body
19748 !!options
19749 parsoid
19750 !! wikitext
19751 A <ref>
19761 booz
19762 </ref>
19764 <references />
19765 !! html
19766 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19768 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19769 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo
19778 booz
19779 </li>
19780 </ol>
19781 !!end
19783 !!test
19784 Ref: 8. transclusion wikitext has lower precedence
19785 !!options
19786 parsoid
19787 !! wikitext
19788 A <ref> foo {{echo|</ref> B C}}
19790 <references />
19791 !! html
19792 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19793 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19794 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19795 </ol>
19796 !!end
19798 !!test
19799 Ref: 9. unclosed comments should not leak out of ref-body
19800 !!options
19801 parsoid
19802 !! wikitext
19803 A <ref> foo <!--</ref> B C
19804 <references />
19805 !! html
19806 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19807 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19808 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo <!----></li>
19809 </ol>
19810 !!end
19812 !!test
19813 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19814 !!options
19815 parsoid
19816 !! wikitext
19817 A <ref> <b> foo </ref> B C
19819 <references />
19820 !! html
19821 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19824 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19825 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19826 </ol>
19827 !!end
19829 !!test
19830 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19831 !!options
19832 parsoid
19833 !! wikitext
19834 A <ref>foo</ref> B
19835 C <ref>bar</ref> D
19836 !! html
19837 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19838 C <span about="#mwt4" class="reference" id="cite_ref-2" 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>
19839 !!end
19841 !!test
19842 Ref: 12. ref-tags act as trailing newline migration barrier
19843 !!options
19844 parsoid
19845 !! wikitext
19846 <!--the newline at the end of this line moves out of the p-tag-->a
19848 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19849 <ref />
19852 !! html
19853 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19856 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19857 <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
19859 <p>c</p>
19860 !!end
19862 !!test
19863 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19864 !!options
19865 parsoid
19866 !! wikitext
19867 <ref>foo</ref> A
19868 <ref>bar
19869 </ref> B
19870 !! html
19871 <p><span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19872 <span about="#mwt4" class="reference" id="cite_ref-2" 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>
19873 !!end
19875 !!test
19876 Ref: 14. A nested ref-tag should be emitted as plain text
19877 !!options
19878 parsoid
19879 !! wikitext
19880 <ref>foo <ref>bar</ref> baz</ref>
19882 <references />
19883 !! html
19884 <p><span about="#mwt2" class="reference" id="cite_ref-1" 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>
19886 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19887 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19888 </ol>
19889 !!end
19891 !!test
19892 Ref: 15. ref-tags with identical names should get identical indexes
19893 !!options
19894 parsoid
19895 !! wikitext
19896 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19897 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19899 <references />
19900 !! html
19901 <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>
19902 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>
19904 <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>
19905 </ol>
19906 !!end
19908 ## We don't bother wt2wt-ing non-standard whitespace
19909 !!test
19910 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19911 !!options
19912 parsoid=wt2html
19913 !! wikitext
19914 A <ref >foo</ref >
19916 <references />
19917 !! html
19918 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19920 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19921 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
19922 !!end
19924 !!test
19925 Ref: 17. Generate valid HTML5 id/about attributes
19926 !!options
19927 parsoid
19928 !!wikitext
19929 <ref name="a b">foo</ref>
19931 <references />
19932 !!html
19933 <p><span class="reference" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
19934 </p>
19936 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19937 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b_1-0">↑</a></span> foo</li>
19938 !!end
19940 !!test
19941 Ref: 18. T58916: Extension attributes should be parsed as plain text
19942 !!options
19943 parsoid
19944 !!wikitext
19945 <ref name="{{echo|a}}">foo</ref>
19947 <references />
19948 !!html
19949 <p><span class="reference" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1">[1]</a></span>
19950 </p>
19952 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19953 <li id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><span rel="mw:referencedBy"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0">↑</a></span> foo</li>
19954 !!end
19956 !!test
19957 Ref: 19. ref-tags with identical name encodings should get identical indexes
19958 !!options
19959 parsoid
19960 !! wikitext
19961 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
19963 <references />
19964 !! html
19965 <p>1 <span about="#mwt3" class="reference" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span> 2 <span about="#mwt4" class="reference" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1">[1]</a></span>
19967 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a_.26_b_1-0">1.0</a> <a href="#cite_ref-a_.26_b_1-1">1.1</a></span> foo</li>
19968 </ol>
19969 !!end
19971 !!test
19972 References: 1. references tag without any refs should be handled properly
19973 !!options
19974 parsoid
19975 !! wikitext
19976 <references />
19977 !! html
19978 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19979 !!end
19981 !!test
19982 References: 2. references tag with group only outputs references from that group
19983 !!options
19984 parsoid
19985 !! wikitext
19986 A <ref group="a">foo</ref>
19987 B <ref group="b">bar</ref>
19989 <references group="a" />
19990 !! html
19991 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
19992 B <span about="#mwt4" class="reference" id="cite_ref-2" 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>
19994 <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">↑</a></span> foo</li>
19995 </ol>
19996 !!end
19998 !!test
19999 References: 3. ref list should be cleared after processing references
20000 !!options
20001 parsoid
20002 !! wikitext
20003 A <ref>foo</ref>
20005 <references />
20007 B <ref>bar</ref>
20009 <references />
20010 !! html
20011 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20013 <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">↑</a></span> foo</li>
20014 </ol>
20016 <p>B <span about="#mwt6" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20018 <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">↑</a></span> bar</li>
20019 </ol>
20020 !!end
20022 !!test
20023 References: 4. only referenced group should be cleared after processing references
20024 !!options
20025 parsoid
20026 !! wikitext
20027 A <ref group="a">afoo</ref>
20028 B <ref>bfoo</ref>
20030 <references group="a" />
20032 C <ref>cfoo</ref>
20034 <references />
20035 !! html
20036 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
20037 B <span about="#mwt4" class="reference" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
20039 <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">↑</a></span> afoo</li>
20040 </ol>
20042 <p>C <span about="#mwt8" class="reference" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
20044 <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">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3">↑</a></span> cfoo</li>
20045 </ol>
20046 !!end
20048 !!test
20049 References: 5. ref tags in references should be processed while ignoring all other content
20050 !!options
20051 parsoid
20052 !! wikitext
20053 A <ref name="a" />
20054 B <ref name="b">bar</ref>
20056 <references>
20057 <ref name="a">foo</ref>
20058 This should just get lost.
20059 </references>
20060 !! html
20061 <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>
20062 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>
20065 <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>
20066 </ol>
20067 !!end
20069 !!test
20070 References: 6. <references /> from a transclusion
20071 !!options
20072 parsoid
20073 !! wikitext
20074 <ref>Foo</ref> {{echo|<references />}}
20075 !! html
20076 <p><span about="#mwt3" class="reference" id="cite_ref-1" 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">↑</a></span> Foo</li></ol>
20077 !!end
20079 !! test
20080 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
20081 !! options
20082 parsoid
20083 !! wikitext
20084 A <ref>foo bar for a</ref>
20085 B <ref group="X" name="b" />
20087 <references />
20089 <references group="X">
20090 <ref name="b">foo</ref>
20091 </references>
20092 !! html
20093 <p>A <span about="#mwt2" class="reference" id="cite_ref-1" 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>
20094 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>
20096 <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">↑</a></span> foo bar for a</li></ol>
20098 <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>
20099 !! end
20101 !! test
20102 Entities in ref name
20103 !! options
20104 parsoid
20105 !! wikitext
20106 <ref name="test &amp; me">hi</ref>
20107 !! html
20108 <p><span about="#mwt2" class="reference" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1">[1]</a></span></p>
20109 !! end
20111 # This test is wt2html only because we're permitting the serializer to produce
20112 # dirty diffs, normalizing the unclosed references to the self-closed version.
20113 !! test
20114 Generate references for unclosed references tag
20115 !! options
20116 parsoid=wt2html
20117 !! wikitext
20118 a<ref>foo</ref>
20120 <references>
20121 !! html
20122 <p>a<span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
20125 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20126 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> foo</li></ol>
20127 !! end
20129 !! test
20130 New reference serializes on its own line
20131 !! options
20132 parsoid=wt2wt,html2wt
20133 !! wikitext
20135 <references />
20136 !! html
20137 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
20138 !! end
20140 #--------- Test stripping of empty nodes in template content ----------
20141 !!test
20142 Empty LI and TR nodes should be stripped from template content
20143 !!wikitext
20144 {{EmptyLITest}}
20145 {{EmptyTRTest}}
20146 !!html/parsoid
20147 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
20148 <li>a</li>
20149 <li>b</li>
20150 </ul>
20151 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
20152 <tbody>
20153 <tr>
20154 <td>foo</td>
20155 </tr>
20156 <tr>
20157 <td>bar</td>
20158 </tr>
20159 </tbody>
20160 </table>
20161 !!end
20163 !!test
20164 Empty LI and TR nodes should not be stripped from top-level content
20165 !!wikitext
20166 * a
20168 * b
20172 |foo
20174 !!html/parsoid
20175 <ul>
20176 <li> a</li>
20177 <li></li>
20178 <li> b</li>
20179 </ul>
20180 <table>
20181 <tbody>
20182 <tr></tr>
20183 <tr>
20184 <td>foo</td>
20185 </tr>
20186 </tbody>
20187 </table>
20188 !!end
20190 !!test
20191 Empty TR nodes should not be stripped if they have any attributes set
20192 !!wikitext
20193 {{EmptyTRWithHTMLAttrTest}}
20194 !!html/parsoid
20195 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
20196 <tr align="center"></tr>
20197 <tr><td>foo</td></tr>
20198 <tr align="center"></tr>
20199 <tr><td>bar</td></tr>
20200 </table>
20201 !!end
20203 #### ----------------------------------------------------------------
20204 #### The following section of tests are primarily to test
20205 #### wikitext escaping capabilities of Parsoid.  Given that
20206 #### escaping can be done any number of ways, the wikitext (input)
20207 #### is always adjusted to reflect how Parsoid adds nowiki
20208 #### escape tags.
20209 ####
20210 #### We are marking several tests as parsoid-only since the
20211 #### HTML in the result section is different from what the
20212 #### PHP parser generates for it.
20213 #### ----------------------------------------------------------------
20216 #### --------------- Headings ---------------
20217 #### 0. Unnested
20218 #### 1. Nested inside html <h1>=foo=</h1>
20219 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
20220 #### 3. Nested inside html with wikitext split by html tags
20221 #### 4. No escape needed
20222 #### 5. Empty headings <h1></h1>
20223 #### 6. Heading chars in SOL context
20224 #### ----------------------------------------
20225 !! test
20226 Headings: 0. Unnested
20227 !! options
20228 parsoid
20229 !! wikitext
20230 <nowiki>=foo=</nowiki>
20232 <nowiki> =foo= </nowiki>
20233 <!--cmt-->
20234 <nowiki>=foo=</nowiki>
20236 =foo''a''<nowiki>=</nowiki>
20237 !! html
20238 <p><span typeof="mw:Nowiki">=foo=</span></p>
20240 <p><span typeof="mw:Nowiki"> =foo= </span>
20241 <!--cmt-->
20242 <span typeof="mw:Nowiki">=foo=</span></p>
20244 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20245 !!end
20247 # New headings and existing headings are handled differently
20248 !! test
20249 Headings: 1. Nested inside html
20250 !! options
20251 parsoid=html2wt
20252 !! html
20253 <h1>=foo=</h1>
20254 <h2>=foo=</h2>
20255 <h3>=foo=</h3>
20257 <h1 data-parsoid=''>=foo=</h1>
20258 <h2 data-parsoid=''>=foo=</h2>
20259 <h3 data-parsoid=''>=foo=</h3>
20260 <h4 data-parsoid=''>=foo=</h4>
20261 <h5 data-parsoid=''>=foo=</h5>
20262 <h6 data-parsoid=''>=foo=</h6>
20263 !! wikitext
20264 = =foo= =
20266 == =foo= ==
20268 === =foo= ===
20270 =<nowiki>=foo=</nowiki>=
20271 ==<nowiki>=foo=</nowiki>==
20272 ===<nowiki>=foo=</nowiki>===
20273 ====<nowiki>=foo=</nowiki>====
20274 =====<nowiki>=foo=</nowiki>=====
20275 ======<nowiki>=foo=</nowiki>======
20277 !!end
20279 !! test
20280 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20281 !! options
20282 parsoid=html2wt
20283 !! html
20284 <h1>foo</h1>*bar
20285 <h1>foo</h1>=bar
20286 <h1>foo</h1>=bar=
20287 !! wikitext
20288 = foo =
20289 <nowiki>*</nowiki>bar
20291 = foo =
20292 =bar
20294 = foo =
20295 <nowiki>=bar=</nowiki>
20296 !!end
20298 !! test
20299 Headings: 3. Nested inside html with wikitext split by html tags
20300 !! options
20301 parsoid=html2wt,wt2wt
20302 !! wikitext
20303 = ='''bold'''<nowiki>foo=</nowiki> =
20304 !! html/parsoid
20305 <h1>=<b>bold</b>foo=</h1>
20306 !!end
20308 !! test
20309 Headings: 4a. No escaping needed (testing just h1 and h2)
20310 !! wikitext
20311 = =foo =
20313 = foo= =
20315 = =foo= =
20317 = =foo= bar =
20319 == =foo ==
20321 == foo= ==
20323 = = =
20325 = ''=''foo= =
20326 !! html/parsoid
20327 <h1>=foo</h1>
20328 <h1>foo=</h1>
20329 <h1> =foo= </h1>
20330 <h1>=foo= bar</h1>
20331 <h2>=foo</h2>
20332 <h2>foo=</h2>
20333 <h1>=</h1>
20334 <h1><i>=</i>foo=</h1>
20335 !!end
20337 !! test
20338 Headings: 4b. No escaping needed (inside p-tags)
20339 !! options
20340 parsoid=html2wt
20341 !! html
20342 <p>===
20343 =foo= x
20344 =foo= <s></s>
20345 </p>
20346 !! wikitext
20348 =foo= x
20349 =foo= <s></s>
20350 !!end
20352 !! test
20353 Headings: 5. Empty headings
20354 !! options
20355 parsoid
20356 !! wikitext
20357 =<nowiki/>=
20359 ==<nowiki/>==
20361 ===<nowiki/>===
20363 ====<nowiki/>====
20365 =====<nowiki/>=====
20367 ======<nowiki/>======
20368 !! html
20369 <h1></h1>
20370 <h2></h2>
20371 <h3></h3>
20372 <h4></h4>
20373 <h5></h5>
20374 <h6></h6>
20375 !!end
20377 !! test
20378 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20379 !! options
20380 parsoid
20381 !! wikitext
20382 <nowiki>=a=</nowiki>
20384 <nowiki>=a=</nowiki> 
20386 <nowiki>=a=</nowiki>    
20388 <nowiki>=a=</nowiki>    
20389 !! html
20390 <p>=a=</p>
20391 <p>=a= </p>
20392 <p>=a=  </p>
20393 <p>=a=  </p>
20394 !!end
20396 !! test
20397 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20398 !! options
20399 parsoid
20400 !! wikitext
20401 <nowiki>=a=
20402 b</nowiki>
20404 <nowiki>=a= 
20405 b</nowiki>
20407 <nowiki>=a=     
20408 b</nowiki>
20410 <nowiki>=a=      
20411 b</nowiki>
20412 !! html
20413 <p>=a=
20414 b</p>
20415 <p>=a= 
20416 b</p>
20417 <p>=a=  
20418 b</p>
20419 <p>=a=   
20420 b</p>
20421 </p>
20422 !!end
20424 !! test
20425 Headings: 6c. Heading chars in SOL context (leading newline break)
20426 !! options
20427 parsoid
20428 !! wikitext
20430 <nowiki>=b=</nowiki>
20431 !! html
20432 <p>a
20433 =b=</p>
20434 !!end
20436 !! test
20437 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20438 !! options
20439 parsoid
20440 !! wikitext
20441 <!--c0--><nowiki>=a=</nowiki>
20443 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
20444 !! html
20445 <p><!--c0-->=a=</p>
20446 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
20447 !!end
20449 !! test
20450 Headings: 6d. Heading chars in SOL context (No escaping needed)
20451 !! options
20452 parsoid=html2wt
20453 !! html
20454 =a=<div>b</div>
20455 !! wikitext
20456 =a=<div>b</div>
20457 !!end
20459 !! test
20460 Headings: 7. Insert a newline between new content and headings
20461 !! options
20462 parsoid=html2wt
20463 !! html
20464 <h2>NEW</h2>
20465 <p>new</p>
20466 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
20467 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
20468 !! wikitext
20469 == NEW ==
20472 ==A==
20475 !! end
20477 #### --------------- Lists ---------------
20478 #### 0. Outside nests (*foo, etc.)
20479 #### 1. Nested inside html <ul><li>*foo</li></ul>
20480 #### 2. Inside definition lists
20481 #### 3. Only bullets at start should be escaped
20482 #### 4. No escapes needed
20483 #### 5. No unnecessary escapes
20484 #### 6. Escape bullets in SOL position
20485 #### 7. Escape bullets in a multi-line context
20486 #### ----------------------------------------
20488 !! test
20489 Lists: 0. Outside nests
20490 !! wikitext
20491 <nowiki>*</nowiki>foo
20493 <nowiki>#</nowiki>foo
20495 <nowiki>;Foo:</nowiki>bar
20496 !! html
20497 <p>*foo
20498 </p><p>#foo
20499 </p><p>;Foo:bar
20500 </p>
20501 !!end
20503 !! test
20504 Lists: 1. Nested inside html
20505 !! wikitext
20506 *<nowiki>*foo</nowiki>
20508 *<nowiki>#foo</nowiki>
20510 *<nowiki>:foo</nowiki>
20512 *<nowiki>;foo</nowiki>
20514 #<nowiki>*foo</nowiki>
20516 #<nowiki>#foo</nowiki>
20518 #<nowiki>:foo</nowiki>
20520 #<nowiki>;foo</nowiki>
20521 !! html
20522 <ul><li>*foo</li></ul>
20523 <ul><li>#foo</li></ul>
20524 <ul><li>:foo</li></ul>
20525 <ul><li>;foo</li></ul>
20526 <ol><li>*foo</li></ol>
20527 <ol><li>#foo</li></ol>
20528 <ol><li>:foo</li></ol>
20529 <ol><li>;foo</li></ol>
20531 !!end
20533 !! test
20534 Lists: 2. Inside definition lists
20535 !! wikitext
20536 ;<nowiki>;foo</nowiki>
20538 ;<nowiki>:foo</nowiki>
20540 ;<nowiki>:foo</nowiki>
20541 :bar
20543 :<nowiki>:foo</nowiki>
20544 !! html
20545 <dl><dt>;foo</dt></dl>
20546 <dl><dt>:foo</dt></dl>
20547 <dl><dt>:foo</dt>
20548 <dd>bar</dd></dl>
20549 <dl><dd>:foo</dd></dl>
20551 !!end
20553 !! test
20554 Lists: 3. Only bullets at start of text should be escaped
20555 !! wikitext
20556 *<nowiki>*foo*bar</nowiki>
20558 *<nowiki>*foo</nowiki>''it''*bar
20559 !! html
20560 <ul><li>*foo*bar</li></ul>
20561 <ul><li>*foo<i>it</i>*bar</li></ul>
20563 !!end
20565 !! test
20566 Lists: 4. No escapes needed
20567 !! options
20568 parsoid
20569 !! wikitext
20570 *foo*bar
20572 *''foo''*bar
20574 *[[Foo]]: bar
20576 *[[Foo]]*bar
20577 !! html
20578 <ul>
20579 <li>foo*bar
20580 </li>
20581 </ul>
20582 <ul>
20583 <li><i>foo</i>*bar
20584 </li>
20585 </ul>
20586 <ul>
20587 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20588 </li>
20589 </ul>
20590 <ul>
20591 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20592 </li>
20593 </ul>
20594 !!end
20596 !! test
20597 Lists: 5. No unnecessary escapes
20598 !! wikitext
20599 * bar <span><nowiki>[[foo]]</nowiki></span>
20601 * =bar <span><nowiki>[[foo]]</nowiki></span>
20603 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20605 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20607 * =bar <span>foo]]</span>=
20609 * <s></s>: a
20611 * ''* foo''
20612 !! html
20613 <ul><li> bar <span>[[foo]]</span></li></ul>
20614 <ul><li> =bar <span>[[foo]]</span></li></ul>
20615 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20616 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20617 <ul><li> =bar <span>foo]]</span>=</li></ul>
20618 <ul><li> <s></s>: a</li></ul>
20619 <ul><li> <i>* foo</i></li></ul>
20621 !!end
20623 !! test
20624 Lists: 6. Escape bullets in SOL position
20625 !! options
20626 parsoid=html2wt
20627 !! html
20628 <p><!--cmt-->*foo</p>
20629 !! wikitext
20630 <!--cmt--><nowiki>*</nowiki>foo
20631 !!end
20633 !! test
20634 Lists: 7. Escape bullets in a multi-line context
20635 !! wikitext
20637 <nowiki>*</nowiki>b
20638 !! html
20639 <p>a
20641 </p>
20642 !!end
20644 !! test
20645 Lists: 8. Escape colons only if not present in tags
20646 !! options
20647 parsoid=html2wt
20648 !! html
20649 <dl><dt>a:b<i>c:d</i></dt></dl>
20650 !! wikitext
20651 ; <nowiki>a:b</nowiki>''c:d''
20652 !! end
20654 #### --------------- HRs ---------------
20655 #### 1. Single line
20656 #### -----------------------------------
20658 !! test
20659 HRs: 1. Single line
20660 !! wikitext
20661 ----<nowiki>----</nowiki>
20662 ----=foo=
20663 ----*foo
20664 !! html+tidy
20665 <hr />
20666 <p>----</p>
20667 <hr />
20668 <p>=foo=</p>
20669 <hr />
20670 <p>*foo</p>
20671 !! end
20673 #### --------------- Tables ---------------
20674 #### 1a. Simple example
20675 #### 1b. No escaping needed (!foo)
20676 #### 1c. No escaping needed (|foo)
20677 #### 1d. No escaping needed (|}foo)
20678 ####
20679 #### 2a. Nested in td (<td>foo|bar</td>)
20680 #### 2b. Nested in td (<td>foo||bar</td>)
20681 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20682 ####
20683 #### 3a. Nested in th (<th>foo!bar</th>)
20684 #### 3b. Nested in th (<th>foo!!bar</th>)
20685 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20686 ####
20687 #### 4a. Escape -
20688 #### 4b. Escape +
20689 #### 4c. No escaping needed
20690 #### --------------------------------------
20692 !! test
20693 Tables: 1a. Simple example
20694 !! wikitext
20695 <nowiki>{|
20696 |}</nowiki>
20697 !! html
20698 <p>{|
20700 </p>
20701 !! end
20703 !! test
20704 Tables: 1b. No escaping needed
20705 !! wikitext
20706 !foo
20707 !! html
20708 <p>!foo
20709 </p>
20710 !! end
20712 !! test
20713 Tables: 1c. No escaping needed
20714 !! wikitext
20715 |foo
20716 !! html
20717 <p>|foo
20718 </p>
20719 !! end
20721 !! test
20722 Tables: 1d. No escaping needed
20723 !! wikitext
20724 |}foo
20725 !! html
20726 <p>|}foo
20727 </p>
20728 !! end
20730 !! test
20731 Tables: 2a. Nested in td
20732 !! options
20733 parsoid=html2wt
20734 !! html/parsoid
20735 <table><tbody><tr>
20736 <td>foo|bar</td></tr>
20737 <tr><td>x<div>a|b</div></td>
20738 </tbody></table>
20739 !! wikitext
20741 |<nowiki>foo|bar</nowiki>
20743 |x<div><nowiki>a|b</nowiki></div>
20745 !! html/php+tidy
20746 <table>
20747 <tr>
20748 <td>foo|bar</td>
20749 </tr>
20750 <tr>
20751 <td>x
20752 <div>a|b</div>
20753 </td>
20754 </tr>
20755 </table>
20756 !! end
20758 !! test
20759 Tables: 2b. Nested in td
20760 !! options
20761 parsoid=html2wt
20762 !! html/parsoid
20763 <table><tbody><tr>
20764 <td>foo||bar</td>
20765 <td>a<i>b||c</i></td>
20766 <td>a<i><div>b||c</div></i></td>
20767 </tr></tbody></table>
20768 !! wikitext
20770 |<nowiki>foo||bar</nowiki>
20771 |a''<nowiki>b||c</nowiki>''
20772 |a''<div><nowiki>b||c</nowiki></div>''
20774 !! html/php
20775 <table>
20776 <tr>
20777 <td>foo||bar
20778 </td>
20779 <td>a<i>b||c</i>
20780 </td>
20781 <td>a<i><div>b||c</div></i>
20782 </td></tr></table>
20784 !! end
20786 !! test
20787 Tables: 2c. Nested in td -- no escaping needed
20788 !! wikitext
20791 |foo!!bar
20793 !! html/*
20794 <table>
20796 <tr>
20797 <td>foo!!bar
20798 </td></tr></table>
20800 !! end
20802 !! test
20803 Tables: 3a. Nested in th
20804 !! wikitext
20807 !foo!bar
20809 !! html/*
20810 <table>
20812 <tr>
20813 <th>foo!bar
20814 </th></tr></table>
20816 !! end
20818 !! test
20819 Tables: 3b. Nested in th
20820 !! options
20821 parsoid=html2wt
20822 !! html/parsoid
20823 <table><tbody>
20824 <tr><th>foo!!bar</th>
20825 <th><i>foo|bar</i></th>
20826 <th><i>foo!!bar</i></th>
20827 <th><i><span>foo!!bar</span></i></th>
20828 </tr></tbody></table>
20829 !! wikitext
20831 !<nowiki>foo!!bar</nowiki>
20832 !''<nowiki>foo|bar</nowiki>''
20833 !''<nowiki>foo!!bar</nowiki>''
20834 !''<span><nowiki>foo!!bar</nowiki></span>''
20836 !! html/php
20837 <table>
20838 <tr>
20839 <th>foo!!bar
20840 </th>
20841 <th><i>foo|bar</i>
20842 </th>
20843 <th><i>foo!!bar</i>
20844 </th>
20845 <th><i><span>foo!!bar</span></i>
20846 </th></tr></table>
20848 !! end
20850 !! test
20851 Tables: 3c. Nested in th
20852 !! options
20853 parsoid=html2wt
20854 !! html/parsoid
20855 <table><tbody>
20856 <tr><th>foo||bar</th>
20857 <th><span typeof="mw:Nowiki">foo||bar</span></th>
20858 </tr></tbody></table>
20859 !! wikitext
20861 !<nowiki>foo||bar</nowiki>
20862 !<nowiki>foo||bar</nowiki>
20864 !! html/php
20865 <table>
20866 <tr>
20867 <th>foo||bar
20868 </th>
20869 <th>foo||bar
20870 </th></tr></table>
20872 !! end
20874 !! test
20875 Tables: 4a. Escape -
20876 !! options
20877 parsoid=html2wt
20878 !! html/*
20879 <table>
20881 <tr>
20882 <th>-bar
20883 </th></tr>
20884 <tr>
20885 <td>-bar
20886 </td></tr></table>
20888 !! wikitext
20891 !-bar
20894 |<nowiki>-bar</nowiki>
20896 !! end
20898 !! test
20899 Tables: 4b. Escape +
20900 !! options
20901 parsoid=html2wt
20902 !! html/*
20903 <table>
20905 <tr>
20906 <th>+bar
20907 </th></tr>
20908 <tr>
20909 <td>+bar
20910 </td></tr></table>
20912 !! wikitext
20915 !+bar
20918 |<nowiki>+bar</nowiki>
20920 !! end
20922 !! test
20923 Tables: 4c. No escaping needed
20924 !! wikitext
20926 |foo-bar
20927 |foo+bar
20929 |''foo''-bar
20930 |''foo''+bar
20932 |foo
20933 bar|baz
20934 +bar
20935 -bar
20938 <div>a|b</div>
20940 !! html/php
20941 <table>
20942 <tr>
20943 <td>foo-bar
20944 </td>
20945 <td>foo+bar
20946 </td></tr>
20947 <tr>
20948 <td><i>foo</i>-bar
20949 </td>
20950 <td><i>foo</i>+bar
20951 </td></tr>
20952 <tr>
20953 <td>foo
20954 <p>bar|baz
20955 +bar
20956 -bar
20957 </p>
20958 </td></tr>
20959 <tr>
20960 <td>x
20961 <div>a|b</div>
20962 </td></tr></table>
20964 !! html/parsoid
20965 <table><tbody>
20966 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20967 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20968 <tr><td>foo
20969 <p>bar|baz
20970 +bar
20971 -bar</p></td></tr>
20972 <tr><td>x
20973 <div>a|b</div></td>
20974 </tbody></table>
20975 !! end
20977 !! test
20978 Tables: 4d. No escaping needed
20979 !! wikitext
20981 |[[Foo]]-bar
20982 ||+1
20983 ||-2
20985 !! html/php
20986 <table>
20987 <tr>
20988 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
20989 </td>
20990 <td>+1
20991 </td>
20992 <td>-2
20993 </td></tr></table>
20995 !! html/parsoid
20996 <table>
20997 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20998 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20999 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
21000 </tbody></table>
21001 !! end
21003 !! test
21004 Tables: Digest broken attributes on table and tr tag
21005 !! options
21006 parsoid=wt2html
21007 !! wikitext
21008 {| || |} ++
21009 |- || || ++ --
21010 |- > [
21012 !! html
21013 <table>
21014 <tbody>
21015 <tr></tr>
21016 <tr></tr>
21017 </tbody></table>
21018 !! end
21020 #### --------------- Links ----------------
21021 #### 1. Quote marks in link text
21022 #### 2. Wikilinks: Escapes needed
21023 #### 3. Wikilinks: No escapes needed
21024 #### 4. Extlinks: Escapes needed
21025 #### 5. Extlinks: No escapes needed
21026 #### --------------------------------------
21027 !! test
21028 Links 1. WikiLinks: No escapes needed
21029 !! wikitext
21030 [[Foo|Foo''boo'']]
21031 [[Foo|[Foobar]]]
21032 [[Foo|x [Foobar] x]]
21033 !! html/php
21034 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
21035 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
21036 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
21037 </p>
21038 !! html/parsoid
21039 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
21040 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
21041 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
21042 !! end
21044 !! test
21045 Links 2. WikiLinks: Escapes needed
21046 !! options
21047 parsoid=html2wt
21048 !! html/parsoid
21049 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
21050 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
21051 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
21052 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
21053 <a href="Foo" rel="mw:WikiLink">|Bar</a>
21054 <a href="Foo" rel="mw:WikiLink">]]bar</a>
21055 <a href="Foo" rel="mw:WikiLink">[[bar</a>
21056 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
21057 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
21058 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
21059 !! wikitext
21060 [[Foo|<nowiki>Foobar]</nowiki>]]
21061 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
21062 [[Foo|<nowiki>[[Bar]]</nowiki>]]
21063 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
21064 [[Foo|<nowiki>|Bar</nowiki>]]
21065 [[Foo|<nowiki>]]bar</nowiki>]]
21066 [[Foo|<nowiki>[[bar</nowiki>]]
21067 [[Foo|<nowiki>x [[ y</nowiki>]]
21068 [[Foo|<nowiki>x ]] y</nowiki>]]
21069 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
21070 !! html/php
21071 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
21072 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
21073 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
21074 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
21075 <a href="/wiki/Foo" title="Foo">|Bar</a>
21076 <a href="/wiki/Foo" title="Foo">]]bar</a>
21077 <a href="/wiki/Foo" title="Foo">[[bar</a>
21078 <a href="/wiki/Foo" title="Foo">x [[ y</a>
21079 <a href="/wiki/Foo" title="Foo">x ]] y</a>
21080 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
21081 </p>
21082 !! end
21084 !! test
21085 Links 3. WikiLinks: No escapes needed
21086 !! wikitext
21087 [[Foo|[Foobar]]
21088 [[Foo|foo|bar]]
21089 !! html/php
21090 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
21091 <a href="/wiki/Foo" title="Foo">foo|bar</a>
21092 </p>
21093 !! html/parsoid
21094 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
21095 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
21096 !! end
21098 !! test
21099 Links 4. ExtLinks: Escapes needed
21100 !! options
21101 parsoid=html2wt
21102 !! html/parsoid
21103 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
21104 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
21105 <p>[http://google.com]</p>
21106 <p>[http://google.com google]</p>
21107 !! wikitext
21108 [http://google.com <nowiki>[google]</nowiki>]
21109 [http://google.com <nowiki>google]</nowiki>]
21111 <nowiki>[http://google.com]</nowiki>
21113 <nowiki>[http://google.com google]</nowiki>
21115 !! html/php
21116 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
21117 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
21118 </p><p>[http://google.com]
21119 </p><p>[http://google.com google]
21120 </p>
21121 !! end
21123 !! test
21124 Links 5. ExtLinks: No escapes needed
21125 !! wikitext
21126 [http://google.com [google]
21127 !! html/php
21128 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
21129 </p>
21130 !! html/parsoid
21131 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
21132 !! end
21134 !! test
21135 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
21136 !! html/parsoid
21137 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
21138 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
21139 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
21140 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
21141 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
21142 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
21143 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21144 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
21145 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
21146 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
21147 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
21148 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
21149 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
21150 </p>
21151 !! wikitext
21152 x<nowiki/>http://example.com<nowiki/>y
21153 http://example.com<nowiki/>?x
21154 http://example.com<nowiki/>&x
21155 http://example.com<nowiki/>'x
21156 http://example.com<nowiki/>,x
21157 http://example.com<nowiki/>.x
21158 http://example.com<nowiki/>;x
21159 http://example.com<nowiki/>:x
21160 http://example.com<nowiki/>;x
21161 http://example.com<nowiki/>!x
21162 http://example.com<nowiki/>=x
21163 http://example.com<nowiki/>(x)
21164 http://example.com(x<nowiki/>)
21165 !! end
21167 !! test
21168 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21169 !! html/parsoid
21170 <p>x
21171 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
21173 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
21174 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
21175 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
21176 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
21177 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
21178 </p>
21179 !! wikitext
21181 http://example.com
21183 "http://example.com"
21184 (http://example.com)
21185 (http://example.com) foo
21186 http://example.com,
21187 http://example.com, foo
21188 !! html/php
21189 <p>x
21190 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
21192 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
21193 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
21194 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
21195 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
21196 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
21197 </p>
21198 !! end
21200 !! test
21201 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
21202 !! html/parsoid
21203 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
21204 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
21205 !! wikitext
21206 http://example.com.,;:!?\
21207 -http://example.com:
21208 !! html/php
21209 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
21210 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
21211 </p>
21212 !! end
21214 !! test
21215 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
21216 !! html/parsoid
21217 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
21218 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
21219 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
21220 !! wikitext
21221 RFC 123<nowiki/>4
21222 RFC 123<nowiki/>y
21223 X<nowiki/>RFC 123<nowiki/>y
21224 !! end
21226 !! test
21227 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
21228 !! html/parsoid
21229 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
21230 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
21231 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
21232 </p>
21233 !! wikitext
21234 RFC 123?foo
21235 RFC 123&foo
21236 -RFC 123-
21237 !! html/php
21238 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
21239 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
21240 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
21241 </p>
21242 !! end
21244 !! test
21245 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
21246 !! html/parsoid
21247 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
21248 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21249 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
21250 !! wikitext
21251 PMID 123<nowiki/>4
21252 PMID 123<nowiki/>y
21253 X<nowiki/>PMID 123<nowiki/>y
21254 !! end
21256 !! test
21257 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
21258 !! html/parsoid
21259 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
21260 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
21261 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
21262 </p>
21263 !! wikitext
21264 PMID 123?foo
21265 PMID 123&foo
21266 -PMID 123-
21267 !! html/php
21268 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
21269 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
21270 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
21271 </p>
21272 !! end
21274 !! test
21275 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
21276 !! html/parsoid
21277 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
21278 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
21279 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
21280 </p>
21281 !! wikitext
21282 ISBN 1234567890<nowiki/>1
21283 ISBN 1234567890<nowiki/>x
21284 a<nowiki/>ISBN 1234567890<nowiki/>b
21285 !! end
21287 !! test
21288 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21289 !! html/parsoid
21290 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21291 !! wikitext
21292 -ISBN 1234567890's
21293 !! html/php
21294 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
21295 </p>
21296 !! end
21298 !! test
21299 Links 14. Protect link-like plain text. (Parsoid bug T78425)
21300 !! options
21301 parsoid=html2wt
21302 !! html/*
21303 <p>this is not a link: http://example.com
21304 </p>
21305 !! wikitext
21306 this is not a link: <nowiki>http://example.com</nowiki>
21307 !! end
21309 !! test
21310 Links 15. Link trails can't become link prefixes.
21311 !! options
21312 language=is
21313 !! wikitext
21314 [[Söfnuður]]-[[00]]
21315 !! html/php
21316 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
21317 </p>
21318 !! html/parsoid
21319 <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
21320 !! end
21322 #### --------------- Quotes ---------------
21323 #### 1. Quotes inside <b> and <i>
21324 #### 2. Link fragments separated by <i> and <b> tags
21325 #### 3. Link fragments inside <i> and <b>
21326 #### 4. No escaping needed
21327 #### --------------------------------------
21328 !! test
21329 1a. Quotes inside <b> and <i>
21330 !! options
21331 parsoid=html2wt,wt2wt
21332 !! wikitext
21333 ''<nowiki/>'foo'''
21334 ''<nowiki>''foo''</nowiki>''
21335 ''<nowiki>'''foo'''</nowiki>''
21336 ''foo''<nowiki/>'s
21337 '''<nowiki/>'foo''''
21338 '''<nowiki>''foo''</nowiki>'''
21339 '''<nowiki>'''foo'''</nowiki>'''
21340 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21341 '''foo'''<nowiki/>'s
21342 '''foo''
21343 ''foo''<nowiki/>'
21344 ''foo'''<nowiki/>'
21345 '''foo''<nowiki/>'
21346 ''''foo'''
21347 '''foo'''<nowiki/>'
21348 ''''foo'''<nowiki/>'
21349 ''fools'<span> errand</span>''
21350 ''<span>fool</span>'s errand''
21351 '<nowiki/>''foo'' bar '''baz''
21352 a|!*#-:;+-~[]{}b'''x''
21353 !! html/*
21354 <p><i>'foo'</i>
21355 <i>''foo''</i>
21356 <i>'''foo'''</i>
21357 <i>foo</i>'s
21358 <b>'foo'</b>
21359 <b>''foo''</b>
21360 <b>'''foo'''</b>
21361 <b>foo'<i>bar'</i>baz</b>
21362 <b>foo</b>'s
21363 '<i>foo</i>
21364 <i>foo</i>'
21365 <i>foo'</i>'
21366 '<i>foo</i>'
21367 '<b>foo</b>
21368 <b>foo</b>'
21369 '<b>foo</b>'
21370 <i>fools'<span> errand</span></i>
21371 <i><span>fool</span>'s errand</i>
21372 '<i>foo</i> bar '<i>baz</i>
21373 a|!*#-:;+-~[]{}b'<i>x</i>
21374 </p>
21375 !! end
21377 !! test
21378 1b. Quotes inside <b> and <i> with other tags on same line
21379 !! options
21380 parsoid=html2wt,wt2wt
21381 !! wikitext
21382 '''a'' foo ''[[bar]]''
21383 ''a''' foo ''[[bar]]''
21384 ''a''' foo '''{{echo|[[bar]]}}'''
21385 [[foo]] x'''[[bar]]''
21386 '''foo'' <ref>test</ref>
21387 '''foo'' <div title="name">test</div>
21388 '''foo'' and <br> bar
21389 !! html
21390 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21391 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21392 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
21393 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21394 '<i>foo</i> <span class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"test"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
21395 '<i>foo</i> <div title="name">test</div>
21396 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
21397 !! end
21399 !! test
21400 2. Link fragments separated by <i> and <b> tags
21401 !! wikitext
21402 [[''foo''<nowiki>hello]]</nowiki>
21404 [['''foo'''<nowiki>hello]]</nowiki>
21405 !! html
21406 <p>[[<i>foo</i>hello]]
21407 </p><p>[[<b>foo</b>hello]]
21408 </p>
21409 !! end
21411 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21412 #        this is one of the shortcomings of this format
21413 !! test
21414 3. Link fragments inside <i> and <b>
21415 !! wikitext
21416 ''[[foo''<nowiki>]]</nowiki>
21418 '''[[foo'''<nowiki>]]</nowiki>
21419 !! html
21420 <p><i>[[foo</i>]]
21421 </p><p><b>[[foo</b>]]
21422 </p>
21423 !! end
21425 !! test
21426 4. No escaping needed
21427 !! wikitext
21428 '<span>''bar''</span>'
21429 '<span>'''bar'''</span>'
21430 'a:b'foo
21431 !! html
21432 <p>'<span><i>bar</i></span>'
21433 '<span><b>bar</b></span>'
21434 'a:b'foo
21435 </p>
21436 !! end
21438 #### ----------- Paragraphs ---------------
21439 #### 1. No unnecessary escapes
21440 #### --------------------------------------
21442 !! test
21443 1. No unnecessary escapes
21444 !! wikitext
21445 bar <span><nowiki>[[foo]]</nowiki></span>
21447 =bar <span><nowiki>[[foo]]</nowiki></span>
21449 [[bar <span><nowiki>[[foo]]</nowiki></span>
21451 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21453 =bar <span>foo]]</span><nowiki>=</nowiki>
21454 !! html
21455 <p>bar <span>[[foo]]</span>
21456 </p><p>=bar <span>[[foo]]</span>
21457 </p><p>[[bar <span>[[foo]]</span>
21458 </p><p>]]bar <span>[[foo]]</span>
21459 </p><p>=bar <span>foo]]</span>=
21460 </p>
21461 !!end
21463 #### ----------------------- PRE --------------------------
21464 #### 1. Leading whitespace in SOL context should be escaped
21465 #### ------------------------------------------------------
21466 !! test
21467 1. Leading whitespace in SOL context should be escaped
21468 !! options
21469 parsoid
21470 !! wikitext
21471 <nowiki> </nowiki>a
21473 <nowiki> </nowiki> a
21475 <nowiki>        </nowiki>a(tab)
21477 <nowiki> </nowiki>      a
21478 <!--cmt-->
21479 <nowiki> </nowiki> a
21482 <nowiki> </nowiki>b
21485 <nowiki>        </nowiki>b
21488 <nowiki>        </nowiki> b
21489 !! html
21490 <p> a</p>
21491 <p>  a</p>
21492 <p>     a(tab)</p>
21493 <p>     a</p>
21494 <p><!--cmt-->  a</p>
21495 <p>a
21496  b</p>
21497 <p>a
21498         b</p>
21499 <p>a
21500          b</p>
21501 !! end
21503 !! test
21504 2. Leading whitespace in non-indent-pre contexts should not be escaped
21505 !! options
21506 parsoid
21507 !! wikitext
21508 foo <ref>''a''
21509  b</ref>
21510 !! html
21511 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1" 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>
21512 !! end
21514 !! test
21515 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21516 !! options
21517 parsoid
21518 !! wikitext
21519 <blockquote>
21521  <span>b</span>
21523 </blockquote>
21524 !! html
21525 <blockquote>
21528  <span>b</span>
21529  c</p>
21530 </blockquote>
21531 !! end
21533 !! test
21534 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21535 !! options
21536 parsoid
21537 !! wikitext
21538  [[File:Foobar.jpg|thumb|caption]]
21539 !! html
21540 !! html/parsoid
21541  <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>
21542 !! end
21544 !! test
21545 5. Nowiki escaping should account for indent-pres
21546 !! options
21547 parsoid=html2wt
21548 !! html
21549 <pre>==foo==</pre>
21550 !! wikitext
21551  ==foo==
21552 !! end
21554 #### --------------- Behavior Switches --------------------
21555 !! test
21556 1. Valid behavior switches should be escaped
21557 !! options
21558 parsoid=html2wt
21559 !! html
21560 __TOC__
21561 <i>__TOC__</i>
21562 !! wikitext
21563 <nowiki>__TOC__</nowiki>
21564 ''<nowiki>__TOC__</nowiki>''
21565 !! end
21567 !! test
21568 2. Invalid behavior switches should not be escaped
21569 !! options
21570 parsoid=html2wt
21571 !! html
21572 __TOO__
21573 __|__
21574 !! wikitext
21575 __TOO__
21576 __|__
21577 !! end
21579 #### --------------- HTML tags ---------------
21580 #### 1. a tags
21581 #### 2. other tags
21582 #### 3. multi-line html tag
21583 #### 4. extension tags
21584 #### -----------------------------------------
21585 !! test
21586 1. a tags
21587 !! options
21588 parsoid
21589 !! wikitext
21590 <a href="http://google.com">google</a>
21591 !! html
21592 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21593 !! end
21595 !! test
21596 2. other tags
21597 !! wikitext
21598 <nowiki><div>foo</div>
21599 <div style="color:red">foo</div></nowiki>
21600 !! html
21601 <p>&lt;div&gt;foo&lt;/div&gt;
21602 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21603 </p>
21604 !! end
21606 !! test
21607 3. multi-line html tag
21608 !! wikitext
21609 <nowiki><div
21610 >foo</div
21611 ></nowiki>
21612 !! html
21613 <p>&lt;div
21614 &gt;foo&lt;/div
21615 &gt;
21616 </p>
21617 !! end
21619 !! test
21620 4. extension tags
21621 !! wikitext
21622 <nowiki><ref>foo</ref></nowiki>
21624 <nowiki><ref>bar</nowiki>
21626 baz<nowiki></ref></nowiki>
21627 !! html
21628 <p>&lt;ref&gt;foo&lt;/ref&gt;
21629 </p><p>&lt;ref&gt;bar
21630 </p><p>baz&lt;/ref&gt;
21631 </p>
21632 !! end
21634 #### --------------- Others ---------------
21635 !! test
21636 Escaping nowikis
21637 !! wikitext
21638 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21639 !! html
21640 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21641 </p>
21642 !! end
21644 ## The quote-char in the input is necessary for triggering the bug
21645 !! test
21646 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21647 !! options
21648 parsoid=wt2wt,html2wt
21649 !! wikitext
21650 foo's bar :
21651 !! html
21652 <p>foo's bar :</p>
21653 !! end
21655 !! test
21657 Tag-like HTML structures are passed through as text
21658 !! wikitext
21659 <x y>
21661 <x.y>
21663 <x-y>
21671 1<d e>f
21672 !! html
21673 <p>&lt;x y&gt;
21674 </p><p>&lt;x.y&gt;
21675 </p><p>&lt;x-y&gt;
21676 </p><p>1&gt;2
21677 </p><p>x&lt;y
21678 </p><p>a&gt;b
21679 </p><p>1&lt;d e&gt;f
21680 </p>
21681 !! end
21684 # This was a bug in the PHP parser (see bug 17663 and its dups,
21685 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21686 !! test
21687 Tag names followed by punctuation should not be recognized as tags
21688 !! wikitext
21689 <s.ome> text
21690 !! html
21691 <p>&lt;s.ome&gt; text
21692 </p>
21693 !! end
21695 !! test
21696 HTML tag with necessary entities in attributes
21697 !! wikitext
21698 <span title="&amp;amp;">foo</span>
21699 !! html
21700 <p><span title="&amp;amp;">foo</span>
21701 </p>
21702 !! end
21704 !! test
21705 HTML tag with 'unnecessary' entity encoding in attributes
21706 !! wikitext
21707 <span title="&amp;">foo</span>
21708 !! html
21709 <p><span title="&amp;">foo</span>
21710 </p>
21711 !! end
21713 !! test
21714 HTML tag with broken attribute value quoting
21715 !! wikitext
21716 <span title="Hello world>Foo</span>
21717 !! html/php
21718 <p><span>Foo</span>
21719 </p>
21720 !! html/parsoid
21721 <p><span title="Hello world">Foo</span>
21722 </p>
21723 !! end
21725 !! test
21726 Parsoid-only: HTML tag with broken attribute value quoting
21727 !! options
21728 parsoid
21729 !! wikitext
21730 <span title="Hello world>Foo</span>
21731 !! html
21732 <p><span title="Hello world">Foo</span>
21733 </p>
21734 !! end
21736 !! test
21737 Table with broken attribute value quoting
21738 !! wikitext
21740 | title="Hello world|Foo
21742 !! html/php
21743 <table>
21744 <tr>
21745 <td>Foo
21746 </td></tr></table>
21748 !! html/parsoid
21749 <table>
21750 <tr>
21751 <td title="Hello world">Foo
21752 </td></tr></table>
21754 !! end
21756 !! test
21757 Table with broken attribute value quoting on consecutive lines
21758 !! wikitext
21760 | title="Hello world|Foo
21761 | style="color:red|Bar
21763 !! html/php
21764 <table>
21765 <tr>
21766 <td>Foo
21767 </td>
21768 <td>Bar
21769 </td></tr></table>
21771 !! html/parsoid
21772 <table><tbody>
21773 <tr>
21774 <td title="Hello world">Foo
21775 </td><td style="color: red">Bar
21776 </td></tr></tbody></table>
21778 !! end
21780 !! test
21781 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21782 !! options
21783 parsoid
21784 !! wikitext
21785 {{}}
21786 !! html
21787 {{}}
21788 !! end
21790 !! test
21791 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21792 !! options
21793 parsoid
21794 !! wikitext
21795 }}{{
21796 !! html
21797 }}{{
21798 !! end
21800 !!test
21801 Accept empty td cell attribute
21802 !! wikitext
21804 | align="center" | foo ||  |
21806 !! html
21807 <table>
21808 <tr>
21809 <td align="center"> foo </td>
21810 <td>
21811 </td></tr></table>
21813 !!end
21815 !!test
21816 Non-empty attributes in th-cells
21817 !! wikitext
21819 ! Foo !! style="color: red" | Bar
21821 !! html
21822 <table>
21823 <tr>
21824 <th> Foo </th>
21825 <th style="color: red"> Bar
21826 </th></tr></table>
21828 !!end
21830 !!test
21831 Accept empty attributes in th-cells
21832 !! wikitext
21834 !| foo !!| bar
21836 !! html
21837 <table>
21838 <tr>
21839 <th> foo </th>
21840 <th> bar
21841 </th></tr></table>
21843 !!end
21845 !!test
21846 Empty table rows go away
21847 !! wikitext
21849 | Hello
21850 | there
21851 |- class="foo"
21854 !! html
21855 <table>
21856 <tr>
21857 <td> Hello
21858 </td>
21859 <td> there
21860 </td></tr>
21862 </table>
21864 !! end
21867 ### Parsoid-centric tests for testing RTing of inter-element separators
21868 ### Edge cases not tested by existing parser tests and specific to
21869 ### Parsoid-specific serialization strategies.
21872 !!test
21873 RT-ed inter-element separators should be valid separators
21874 !! wikitext
21876 |- [[foo]]
21878 !! html
21879 <table>
21881 </table>
21883 !!end
21885 # Parsoid-only since PHP parser relies on Tidy for correct output
21886 !!test
21887 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21888 !!options
21889 parsoid
21890 !! wikitext
21892 |<small>foo
21897 |<small>foo<small>
21899 !! html
21900 <table>
21901 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21902 <p>bar</p></small></td></tr>
21903 </tbody></table>
21905 <table>
21906 <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>
21907 </tbody></table>
21908 !!end
21910 !!test
21911 Empty TD followed by TD with tpl-generated attribute
21912 !! wikitext
21916 |{{echo|style='color:red'}}|foo
21918 !! html
21919 <table>
21921 <tr>
21922 <td>
21923 </td>
21924 <td>foo
21925 </td></tr></table>
21927 !!end
21929 !!test
21930 Indented table with an empty td
21931 !! wikitext
21932  {|
21933  |-
21935  |foo
21936  |}
21937 !! html
21938 <table>
21940 <tr>
21941 <td>
21942 </td>
21943 <td>foo
21944 </td></tr></table>
21946 !!end
21948 ## We have some newline diffs RT-ing this edge case
21949 ## and it is not important enough -- we seem to be emitting
21950 ## at most 2 newlines after a </tr> and this is unrelated to
21951 ## the issue from T85627 that this is testing.
21952 !!test
21953 Indented table with blank lines in between (T85627)
21954 !! options
21955 parsoid=wt2html
21956 !! wikitext
21957  {|
21958  |foo
21961  |}
21962 !! html
21963 <table>
21965 <tr>
21966 <td>foo
21967 </td></tr></table>
21969 !!end
21971 !!test
21972 Indented block & table
21973 !! wikitext
21974  <div>foo</div>
21975  {|
21976  |foo
21977  |}
21978 !! html/php
21979  <div>foo</div>
21980 <table>
21981 <tr>
21982 <td>foo
21983 </td></tr></table>
21985 !! html/parsoid
21986  <div data-parsoid='{"stx":"html"}'>foo</div>
21987  <table><tbody>
21988  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21989  </tbody></table>
21990 !!end
21992 !! test
21993 Indent and comment before table row
21994 !! wikitext
21996  <!--hi-->|-
21997  | there
21999 !! html/php
22000 <table>
22002 <tr>
22003 <td> there
22004 </td></tr></table>
22006 !! html/parsoid
22007 <table>
22008  <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
22009  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
22010 </tbody></table>
22011 !! end
22013 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
22014 !!test
22015 Empty TR followed by a template-generated TR
22016 !!options
22017 parsoid
22018 !! wikitext
22021 {{echo|<tr><td>foo</td></tr>}}
22023 !! html
22024 <table>
22025 <tbody>
22026 <tr></tr>
22027 <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}}]}'>
22028 <td>foo</td></tr>
22029 </tbody></table>
22030 !!end
22032 ## PHP and parsoid output differ for this, and since this is primarily
22033 ## for testing Parsoid's serializer, marking this Parsoid only
22034 !!test
22035 Empty TR followed by mixed-ws-comment line should RT correctly
22036 !!options
22037 parsoid
22038 !! wikitext
22041  <!--c-->
22043 <!--c--> <!--d-->
22045 !! html
22046 <table>
22047 <tbody>
22048 <tr></tr>
22049  <!--c-->
22050 <tr>
22051 <!--c--> </tr><!--d-->
22052 </tbody></table>
22054 !!end
22056 !!test
22057 Multi-line image caption generated by templates with/without trailing newlines
22058 !! wikitext
22059 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
22060 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
22061 !! html/parsoid
22062 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
22063 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
22064 !!end
22066 !! test
22067 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
22068 !! options
22069 parsoid=html2wt
22070 !! html
22071 <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>
22073 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
22074 !! wikitext
22075 <includeonly>foo</includeonly>
22076 new para
22078 [[./Category:Foo]]
22080 = new heading =
22081 !! end
22083 ## PHP emits broken html for this, and since this is primarily
22084 ## a Parsoid serializer test, marking this Parsoid only
22085 !!test
22086 Improperly nested inline or quotes tags with whitespace in between
22087 !!options
22088 parsoid
22089 !! wikitext
22090 <span> <s>x</span> </s>
22091 ''' ''x''' ''
22092 !! html
22093 <p><span> <s>x</s></span><s> </s>
22094 <b> <i>x</i></b><i> </i>
22095 </p>
22096 !!end
22098 !!test
22099 Encapsulate protected attributes from wt
22100 !!options
22101 parsoid
22102 !! wikitext
22103 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
22104 !! html
22105 <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>
22106 </body>
22107 !!end
22109 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
22110 ## Having nested or stray pre tags results in the attempt to add duplicates,
22111 ## causing an assertion fail. This test tries to prevent that situation.
22112 !!test
22113 Ensure ParagraphWrapper can deal with stray closing pre tags
22114 !!options
22115 parsoid=wt2html
22116 !! wikitext
22117 plain text</pre>
22118 !! html
22119 plain text
22120 !!end
22122 !!test
22123 1. Ensure fostered text content is wrapped in element nodes
22124 !!options
22125 parsoid=wt2html
22126 !! wikitext
22127 <table>hi</table><table>ho</table>
22128 !! html
22129 <p>hi</p>
22130 <table></table>
22131 <p>ho</p>
22132 <table></table>
22133 !!end
22135 !!test
22136 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
22137 !!options
22138 parsoid=wt2html,wt2wt
22139 !! wikitext
22140 <table>
22141 <tr> || ||
22142 <td> a
22143 </table>
22144 !! html
22145 <p> || ||
22146 </p><table>
22147 <tbody><tr><td> a</td></tr>
22148 </tbody></table>
22149 !!end
22151 !!test
22152 Encapsulation properly handles null DSR information from foster box
22153 !!options
22154 parsoid=wt2html,wt2wt
22155 !! wikitext
22156 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
22157 !! html
22158 <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>
22159 !!end
22161 !!test
22162 1. Encapsulate foster-parented transclusion content
22163 !!options
22164 parsoid=wt2wt,wt2html
22165 !! wikitext
22166 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
22167 !! html
22168 <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>
22169 <tbody>
22170 <tr>
22171 <td>bar</td>
22172 </tr>
22173 </tbody>
22174 </table>
22175 !!end
22177 !!test
22178 2. Encapsulate foster-parented transclusion content
22179 !!options
22180 parsoid=wt2wt,wt2html
22181 !! wikitext
22182 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
22183 !! html
22184 <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>
22185 <table>
22186 <tbody>
22187 <tr>
22188 <td>bar</td>
22189 </tr>
22190 </tbody>
22191 </table>
22192 !!end
22194 !!test
22195 3. Encapsulate foster-parented transclusion content
22196 !!options
22197 parsoid=wt2wt,wt2html
22198 !! wikitext
22199 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22200 !! html
22201 <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;]}">
22202 <p>foo</p>
22203 </div>
22204 <table>
22205 <tbody>
22206 <tr>
22207 <td>bar</td>
22208 </tr>
22209 </tbody>
22210 </table>
22211 !!end
22213 !!test
22214 4. Encapsulate foster-parented transclusion content
22215 !!options
22216 parsoid=wt2wt,wt2html
22217 !! wikitext
22218 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
22219 !! html
22220 <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;]}">
22221 <p>foo</p>
22222 </div>
22223 <table>
22224 <tbody>
22225 <tr>
22226 <td>bar</td>
22227 </tr>
22228 </tbody>
22229 </table>
22230 !!end
22232 !!test
22233 5. Encapsulate foster-parented transclusion content
22234 !!options
22235 parsoid=wt2wt,wt2html
22236 !! wikitext
22237 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
22238 !! html
22239 <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>
22240 <table>
22241 <tbody>
22242 <tr>
22243 <td>
22244 <div>
22245 <p>foo</p>
22246 </div>
22247 </td>
22248 </tr>
22249 </tbody>
22250 </table>
22251 !!end
22253 !!test
22254 6. Encapsulate foster-parented transclusion content
22255 !!options
22256 parsoid=wt2wt,wt2html
22257 !! wikitext
22258 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
22259 !! html
22260 <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>
22261 <table>
22262 <tbody>
22263 <tr>
22264 <td>
22265 <div>
22266 <p>foo</p>
22267 </div>
22268 </td>
22269 </tr>
22270 </tbody>
22271 </table>
22272 <p>ok</p>
22273 !!end
22275 !!test
22276 7. Encapsulate foster-parented transclusion content
22277 !!options
22278 parsoid=wt2wt,wt2html
22279 !! wikitext
22280 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
22281 !! html
22282 <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>
22283 <table>
22284 <tbody>
22285 <tr>
22286 <td>bar</td>
22287 </tr>
22288 </tbody>
22289 </table>
22290 !!end
22292 !!test
22293 8. Encapsulate foster-parented transclusion content
22294 !!options
22295 parsoid=wt2wt,wt2html
22296 !! wikitext
22297 {{echo|a
22298 }}{|{{echo|style='color:red'}}
22302 !! html
22303 <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>
22304 <tbody>
22305 <tr>
22306 <td>b</td>
22307 </tr>
22308 </tbody>
22309 </table>
22310 !!end
22312 !!test
22313 9. Encapsulate foster-parented transclusion content
22314 !!options
22315 parsoid=wt2wt,wt2html
22316 !! wikitext
22317 <table>{{echo|hi</table>hello}}
22318 !! html
22319 <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>
22320 !!end
22322 !!test
22323 Table in fosterable position
22324 !!options
22325 parsoid=wt2html,wt2wt
22326 !! wikitext
22327 {{OpenTable}}
22328 <div>
22331 </div>
22333 !! html
22334 <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">
22335 </span>
22336 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22338 <table>
22339 </table>
22340 !!end
22342 # Parsoid only for bug 64747
22343 !! test
22344 Properly encapsulate empty-content transclusions in fosterable positions
22345 !! wikitext
22346 <table>
22347 {{#if:|
22348 <td>foo</td>
22350 </table>
22351 !! html/parsoid
22352 <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":["","","",""]}]]}'>
22354 </table>
22355 !! end
22357 !!test
22358 Support <object> element with .data attribute
22359 !!options
22360 parsoid=html2wt
22361 !! html
22362 <object data="test.swf"></object>
22363 !! wikitext
22364 <object data="test.swf"></object>
22365 !!end
22367 !! test
22368 Don't block XML namespace declaration
22369 !! wikitext
22370 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22371 !! html/php
22372 <p><span>MediaWiki</span>
22373 </p>
22374 !! html/parsoid
22375 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22376 !! end
22378 # -----------------------------------------------------------------
22379 # The following section of tests are primarily to spec requirements
22380 # around serialization of new/edited content.
22382 # All these tests are marked Parsoid html2wt and html2html only
22383 # ----------------------------------------------------------------
22385 # 'mi' is a localinterwiki prefix as well as a language
22386 !! test
22387 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22388 !! options
22389 parsoid=html2wt
22390 !! html
22391 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22392 !! wikitext
22393 [[Foo]]
22394 !! end
22396 !! test
22397 New wiki links (href variations)
22398 !! options
22399 parsoid=html2wt
22400 !! html
22401 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22402 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22403 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22404 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22405 !! wikitext
22406 [[Foo_bar]]
22407 [[Foo_bar]]
22408 [[Foo_bar]]
22409 [[Toxine bactérienne]]
22410 !! end
22412 !! test
22413 New wiki links (content string variations)
22414 !! options
22415 parsoid=html2wt
22416 !! html
22417 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22418 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22419 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22420 !! wikitext
22421 [[Foo_bar]]
22422 [[Foo bar]]
22423 [[Foo_bar|./Foo_bar]]
22424 !! end
22426 !! test
22427 New category links (href variations)
22428 !! options
22429 parsoid=html2wt
22430 !! html
22431 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22432 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22433 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22434 !! wikitext
22435 [[Category:Toxine bactérienne]]
22436 [[Category:Toxine bactérienne]]
22437 [[Category:Toxine bactérienne]]
22438 !! end
22440 !! test
22441 New interlanguage links (href variations)
22442 !! options
22443 parsoid=html2wt
22444 !! html
22445 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22446 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22447 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22448 !! wikitext
22449 [[es:Toxine bactérienne]]
22450 [[es:Toxine_bactérienne]]
22451 [[es:Toxine_bactérienne]]
22452 !! end
22454 !! test
22455 Image: Modifying size of an image (1)
22456 !! options
22457 parsoid={
22458   "modes": ["wt2wt"],
22459   "changes": [
22460     ["img[height]", "attr", "height", "22"],
22461     ["img[width]", "attr", "width", "200"]
22462   ]
22464 !! wikitext
22465 [[Image:Foobar.jpg|230x230px]]
22466 !! wikitext/edited
22467 [[Image:Foobar.jpg|200x200px]]
22468 !!end
22470 !! test
22471 Image: Modifying size of an image (2)
22472 !! options
22473 parsoid={
22474   "modes": ["wt2wt"],
22475   "changes": [
22476     ["img[height]", "attr", "height", "100"],
22477     ["img[width]", "attr", "width", "500"]
22478   ]
22480 !! wikitext
22481 [[Image:Foobar.jpg|230x230px]]
22482 !! wikitext/edited
22483 [[Image:Foobar.jpg|500x500px]]
22484 !!end
22486 # Change in size is ignored so long as class='mw-default-size'
22487 !! test
22488 Image: Modifying size of an image (3)
22489 !! options
22490 parsoid={
22491   "modes": ["wt2wt"],
22492   "changes": [
22493     ["figure[class]", "removeClass", "mw-default-size"],
22494     ["figure img", "attr", "height", "19"],
22495     ["figure img", "attr", "width", "170"]
22496   ]
22498 !! wikitext
22499 [[Image:Foobar.jpg|thumb]]
22500 !! wikitext/edited
22501 [[Image:Foobar.jpg|thumb|170x170px]]
22502 !!end
22504 !! test
22505 Image: Modifying alignment of an image (bug 48665)
22506 !! options
22507 parsoid={
22508   "modes": ["wt2wt"],
22509   "changes": [
22510     ["figure[class]", "removeClass", "mw-halign-right"],
22511     ["figure[class]", "addClass", "mw-halign-left"]
22512   ]
22514 !! wikitext
22515 [[Image:Foobar.jpg|thumb|caption|right]]
22516 !! wikitext/edited
22517 [[Image:Foobar.jpg|thumb|caption|left]]
22518 !! end
22520 !! test
22521 Image: Modifying mw-default-size of an frameless image (bug 62805)
22522 !! options
22523 parsoid={
22524   "modes": ["wt2wt"],
22525   "changes": [
22526     ["figure.mw-default-size", "removeClass", "mw-default-size"]
22527   ]
22529 !! wikitext
22530 [[Image:Foobar.jpg|frameless|right]]
22531 !! wikitext/edited
22532 [[Image:Foobar.jpg|frameless|right|220x220px]]
22533 !! end
22535 !! test
22536 Image: Modifying valign of an image (bug 49221)
22537 !! options
22538 parsoid={
22539   "modes": ["wt2wt"],
22540   "changes": [
22541     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22542     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22543   ]
22545 !! wikitext
22546 [[File:Foobar.jpg|20px|middle]]
22547 !! wikitext/edited
22548 [[File:Foobar.jpg|20px|text-top]]
22549 !! end
22551 !! test
22552 Image: Modifying alt attribute of an image (bug 56400)
22553 !! options
22554 parsoid={
22555   "modes": ["wt2wt"],
22556   "changes": [
22557     ["img[alt]", "attr", "alt", "some alternate edited text"]
22558   ]
22560 !! wikitext
22561 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22562 !! wikitext/edited
22563 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22564 !!end
22566 !! test
22567 Image: Modifying caption of an image
22568 !! options
22569 parsoid={
22570   "modes": ["wt2wt"],
22571   "changes": [
22572     ["figcaption", "text", "new caption"]
22573   ]
22575 !! wikitext
22576 [[Image:Foobar.jpg|thumb|original caption]]
22577 !! wikitext/edited
22578 [[Image:Foobar.jpg|thumb|new caption]]
22579 !!end
22581 !! test
22582 Image: empty alt attribute (bug 48924)
22583 !! options
22584 parsoid
22585 !! wikitext
22586 [[File:Foobar.jpg|thumb|alt=|bar]]
22587 !! html
22588 <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>
22589 !! end
22591 #!! test
22592 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22593 #!! options
22594 #parsoid=html2wt
22595 #language=ar
22596 #!! html
22597 #<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>
22598 #!! wikitext
22599 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22600 #!! end
22602 !! test
22603 Image: Block level image should have \n before and after
22604 !! wikitext
22606 [[File:Foobar.jpg|right|thumb|150x150px]]
22608 !! html/parsoid
22609 <p>123</p>
22610 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="17" width="150"/></a></figure>
22611 <p>456</p>
22612 !!end
22614 !! test
22615 Image: New block level image should have \n before and after (existing content)
22616 !! wikitext
22618 [[File:Foobar.jpg|right|thumb|150x150px]]
22620 !! html/parsoid
22621 <p>123</p>
22622 <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>
22623 <p>456</p>
22624 !!end
22626 !! test
22627 Image: upright option (parsoid)
22628 !! options
22629 parsoid
22630 !! wikitext
22631 [[File:Foobar.jpg|thumb|upright|caption]]
22632 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22633 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22634 !! html
22635 <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>
22636 <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>
22637 <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>
22638 !!end
22640 !! test
22641 Image: upright option is ignored on inline and frame images (parsoid)
22642 !! options
22643 parsoid
22644 !! wikitext
22645 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22646 !! html
22647 <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>
22648 !!end
22650 !! test
22651 Image: from basic HTML (1)
22652 !! options
22653 parsoid=html2wt
22654 !! html/parsoid
22655 <span typeof="mw:Image">
22656   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22657 </span>
22658 !! wikitext
22659 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22660 !! end
22662 !! test
22663 Image: from basic HTML (2)
22664 !! options
22665 parsoid=html2wt
22666 !! html/parsoid
22667 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22668 !! wikitext
22669 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22670 !! end
22672 !! test
22673 Image: from basic HTML (3)
22674 !! options
22675 parsoid=html2wt
22676 !! html/parsoid
22677 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22678 !! wikitext
22679 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22680 !! end
22682 !! test
22683 Image: from basic HTML (4)
22684 !! options
22685 parsoid=html2wt
22686 !! html/parsoid
22687 <img src="File:Foobar.jpg">
22688 !! wikitext
22689 [[File:Foobar.jpg|link=]]
22690 !! end
22692 !! test
22693 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22694 !! options
22695 parsoid=html2wt
22696 !! html
22697 <ul>
22698 <li><p>foo</p></li>
22699 </ul>
22700 !! wikitext
22701 * foo
22702 !! end
22704 !! test
22705 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22706 !! options
22707 parsoid=html2wt
22708 !! html
22709 <ul> <li>foo</li></ul>
22710 !! wikitext
22711 * foo
22712 !! end
22714 !! test
22715 Don't strip leading whitespace when handling indent-pre suppressing tags
22716 !! options
22717 parsoid=html2wt
22718 !! html
22719 <table>
22720   <tr><td> indented row</td></tr>
22721 </table>
22722 <blockquote><p>
22723  <b>This is very bold of you!</b>
22724 </p>
22725 <table><tr><td>
22726  indented cell (no pre-wrapping!)
22727 </td></tr></table>
22728 </blockquote>
22729 <p>foo</p>
22730  <div>bar</div>
22731 !! wikitext
22733   | indented row
22735 <blockquote>
22736  '''This is very bold of you!'''
22740  indented cell (no pre-wrapping!)
22742 </blockquote>
22744  <div>bar</div>
22745 !! end
22747 !! test
22748 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22749 !! options
22750 parsoid=html2wt
22751 !! wikitext
22753 <nowiki> </nowiki><span>bar</span>
22755 <span>foo2
22756 <nowiki> </nowiki></span>bar2
22758 <div>foo</div>
22759 <nowiki> </nowiki><span>bar</span>
22761 <div>
22762 <nowiki> </nowiki><span>foo</span>
22763 </div>
22764 !! html
22765 <p>foo</p>
22766  <span>bar</span>
22768 <span>foo2
22769  </span>bar2
22771 <div>foo</div>
22772  <span>bar</span>
22774 <div>
22775  <span>foo</span>
22776 </div>
22777 !! end
22779 !! test
22780 Lists: Add space after bullets
22781 !! options
22782 parsoid=html2wt
22783 !! html
22784 <ul>
22785 <li>foo</li>
22786 <li> bar</li>
22787 <li><span> baz</span></li>
22788 </ul>
22789 !! wikitext
22790 * foo
22791 * bar
22792 * <span> baz</span>
22793 !! end
22795 !! test
22796 Lists: Dont insert newlines in a serialized list item.
22797 !! options
22798 parsoid=html2wt
22799 !! html
22800 <ul><li>a<br>b</li><li>c</li></ul>
22801 !! wikitext
22802 * a<br>b
22803 * c
22804 !! end
22806 !! test
22807 Headings: Add space before/after == (Bug 51744)
22808 !! options
22809 parsoid=html2wt
22810 !! html
22811 <h2>foo</h2>
22812 <h2> bar</h2>
22813 <h2>baz </h2>
22814 <h2><span> baz</span></h2>
22815 !! wikitext
22816 == foo ==
22818 == bar ==
22820 == baz ==
22822 == <span> baz</span> ==
22823 !! end
22825 !! test
22826 Headings: Force metas to serialize before/after
22827 !! options
22828 parsoid=html2wt
22829 !! html
22830 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
22831 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
22832 !! wikitext
22833 == hello there ==
22834 [[Category:A1]]
22836 [[Category:A2]]
22837 == hi pal ==
22838 !! end
22840 !! test
22841 Parsoid: Serialize positional parameters with = in them as named parameter
22842 !! options
22843 parsoid=html2wt
22844 !! html
22845 <p about="#mwt1" typeof="mw:Transclusion"
22846 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22848 <p about="#mwt1" typeof="mw:Transclusion"
22849 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22851 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22852 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22853 <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>
22854 !! wikitext
22855 {{echo|1 = f=oo}}
22857 {{echo|1 = f=oo|2 = bar}}
22859 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22860 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22861 {{echo|<nowiki>f=oo</nowiki>|bar}}
22862 !! end
22864 !! test
22865 Parsoid: Serialize positional parameters with = in extlink as named parameter
22866 !! options
22867 parsoid=html2wt
22868 !! html
22869 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
22870 !! wikitext
22871 {{echo|1 = http://stuff?is=ok}}
22872 !! end
22874 !! test
22875 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22876 !! options
22877 parsoid=html2wt
22878 !! html
22879 <div>a<p>b</p></div>
22880 <div>a
22881 <p>b</p></div>
22882 <div>
22884 <p>b</p></div>
22885 !! wikitext
22886 <div>a
22888 </div>
22889 <div>a
22891 </div>
22892 <div>
22896 </div>
22897 !! end
22899 !! test
22900 Substrings resembling wikitext in hrefs should not get nowiki escapes
22901 !! options
22902 parsoid=html2wt
22903 !! html
22904 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22905 !! wikitext
22906 [[Foo''bar''baz]]
22907 !! end
22909 #-----------------------------
22910 # I/B quote minimization tests
22911 #-----------------------------
22913 !! test
22914 1. I/B quote minimization: wikitext-only tags should be combined
22915 !! options
22916 parsoid=html2wt
22917 !! html
22918 <p><i>A</i><i>B</i></p>
22919 <p><b>A</b><b>B</b></p>
22920 <p><i>A</i><b><i>B</i></b></p>
22921 <p><b>A</b><i><b>B</b></i></p>
22922 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22923 <p><i><b>A</b></i><i><b>B</b></i></p>
22924 <p><i><b>A</b></i><b><i>B</i></b></p>
22925 <p><b><i>A</i></b><i><b>B</b></i></p>
22926 !! wikitext
22927 ''AB''
22929 '''AB'''
22931 ''A'''B'''''
22933 '''A''B'''''
22935 '''A''BC''D'''
22937 '''''AB'''''
22939 '''''AB'''''
22941 '''''AB'''''
22942 !! end
22944 !! test
22945 2. I/B quote minimization: wikitext and html tags should not be combined
22946 !! options
22947 parsoid=html2wt
22948 !! html
22949 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22950 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22951 !! wikitext
22952 ''A''<i>B</i>
22954 ''A''<nowiki/>'''<i>B</i>'''
22955 !! end
22957 !! test
22958 3. I/B quote minimization: templated content stops minimization
22959 !! options
22960 parsoid=html2wt
22961 !! html
22962 <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>
22963 <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>
22964 !! wikitext
22965 ''A''{{echo|''B''}}
22967 ''A''{{echo|'''''B'''''}}
22968 !! end
22970 !! test
22971 4. I/B quote minimization: new content should be mimimized with adjacent old content
22972 !! options
22973 parsoid=html2wt
22974 !! html
22975 <p><i>A</i><i>B</i></p>
22976 <p><b>A</b><b>B</b></p>
22977 <p><i>A</i><b><i>B</i></b></p>
22978 !! wikitext
22979 ''AB''
22981 '''AB'''
22983 ''A'''B'''''
22984 !! end
22986 !! test
22987 5a. Merge adjacent quote nodes if they've been edited
22988 !! options
22989 parsoid={
22990   "modes": ["wt2wt"],
22991   "changes": [
22992     ["p", "contents", "remove", ":contains('b')"]
22993   ]
22995 !! wikitext
22996 ''a''b''c''
22997 !! wikitext/edited
22998 ''ac''
22999 !! end
23001 !! test
23002 5b. Merge adjacent quote nodes if they've been edited
23003 !! options
23004 parsoid={
23005   "modes": ["wt2wt"],
23006   "changes": [
23007     ["#x", "remove"]
23008   ]
23010 !! wikitext
23011 ''a''<span id="x">b</span>''c''
23012 !! wikitext/edited
23013 ''ac''
23014 !! end
23016 #------------------------------------
23017 # End of I/B quote minimization tests
23018 #------------------------------------
23020 !!test
23021 Bug 54262: New entities
23022 !! options
23023 parsoid=html2wt
23024 !! wikitext
23025 &nbsp;
23026 !! html
23027 <span typeof="mw:Entity">&nbsp;</span>
23028 !! end
23030 ## Note that there is no wikitext output for 'unknownproperty' ##
23031 ## Unknown magic words are silently dropped ##
23033 !! test
23034 Magic words
23035 !! options
23036 parsoid=html2wt
23037 !! html
23038 <meta property='mw:PageProp/toc' />
23039 <meta property='mw:PageProp/notoc' />
23040 <meta property='mw:PageProp/forcetoc' />
23041 <meta property='mw:PageProp/index' />
23042 <meta property='mw:PageProp/noindex' />
23043 <meta property='mw:PageProp/nogallery' />
23044 <meta property='mw:PageProp/noeditsection' />
23045 <meta property='mw:PageProp/notitleconvert' />
23046 <meta property='mw:PageProp/nocontentconvert' />
23047 <meta property='mw:PageProp/unknownproperty' />
23048 !! wikitext
23049 __TOC__
23050 __NOTOC__
23051 __FORCETOC__
23052 __INDEX__
23053 __NOINDEX__
23054 __NOGALLERY__
23055 __NOEDITSECTION__
23056 __NOTITLECONVERT__
23057 __NOCONTENTCONVERT__
23058 !! end
23060 !! test
23061 Consecutive <pre>s should not get merged
23062 !! options
23063 parsoid=html2wt,html2html
23064 !! html
23065 <pre>a</pre><pre>b</pre>
23067 <pre>c
23068 </pre><pre>
23069 d</pre>
23071 <pre>e
23073 </pre><pre>
23075 f</pre>
23076 !! wikitext
23090 !! end
23092 !! test
23093 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
23094 !! options
23095 parsoid=html2wt
23096 !! html
23097 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
23098 !! wikitext
23099 [[Special:BookSources/1234567890|ISBN 1234567895]]
23100 !! end
23102 !! test
23103 Edited RFC links not serializable as RFC links should serialize as extlinks
23104 !! options
23105 parsoid=html2wt
23106 !! html
23107 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
23108 !! wikitext
23109 [//tools.ietf.org/html/rfc123 New RFC]
23110 !! end
23112 !! test
23113 Edited PMID links not serializable as PMID links should serialize as extlinks
23114 !! options
23115 parsoid=html2wt
23116 !! html
23117 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
23118 !! wikitext
23119 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
23120 !! end
23122 !! test
23123 WTS of autolinks with trailing/surrounding context
23124 !! options
23125 parsoid=html2wt
23126 !! html/parsoid
23127 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
23128 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
23129 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
23130 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
23131 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
23132 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
23133 !! wikitext
23134 http://cscott.net<nowiki/>'''foo'''
23136 http://cscott.net<b>foo</b>
23138 '''http://cscott.net<nowiki/>'''
23140 '''http://cscott.net '''
23142 '''http://cscott.net<nowiki/>x'''
23144 http://cscott.net<nowiki/>x
23145 !! end
23147 !! test
23148 WTS of autolinks with nowikis (round-trip)
23149 !! wikitext
23150 x<nowiki/>http://cscott.net<nowiki/>x
23151 !! html/parsoid
23152 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
23153 !! end
23155 # this is the "easy" test because it leaves in place all the
23156 # data-parsoid information indicating this is an autolink
23157 !! test
23158 WTS of autolinks with escapes (editing)
23159 !! options
23160 parsoid={
23161   "modes": ["wt2wt"],
23162   "changes": [
23163     [ "meta", "remove" ]
23164   ]
23166 !! wikitext
23167 x<nowiki/>http://cscott.net<nowiki/>x
23168 !! wikitext/edited
23169 x<nowiki/>http://cscott.net<nowiki/>x
23170 !! end
23172 !! test
23173 Edited Redirect link should emit a non-piped wikitext link
23174 !! options
23175 parsoid=html2wt
23176 !! html
23177 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
23178 !! wikitext
23179 #REDIRECT [[Bar]]
23180 !! end
23182 !! test
23183 T75121: Infer extension name from typeOf if data-mw is not present
23184 !! options
23185 parsoid=html2wt
23186 !! html
23187 <div typeOf="mw:Extension/foo"></div>
23188 !! wikitext
23189 <foo />
23190 !! end
23192 # -----------------------------------------------------------------
23193 # End of section for Parsoid-only html2wt tests for serialization
23194 # of new content
23195 # -----------------------------------------------------------------
23197 TODO:
23198 more images
23199 more tables
23200 character entities
23201 and much more
23202 Try for 100% code coverage