Merge "inputs.less: Use .mw-ui-input-inline for type="number""
[mediawiki.git] / tests / parser / parserTests.txt
blobc90c4f6b77f934e427c05518bb7699d667e0a40e
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
16 # cat           add category links
17 # ill           add inter-language links
18 # subpage       enable subpages (disabled by default)
19 # noxml         don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX  set content language to XXX for this test
22 # variant=XXX   set the variant of language for this test (eg zh-tw)
23 # disabled      do not run test
24 # parsoid       parsoid-specific options (not run by PHP parser unless
25 #                 the test includes an html/php section)
26 # php           php-only test (not run by the parsoid parser unless
27 #                 the test includes an html/parsoid section)
28 # showtitle     make the first line the title
29 # comment       run through Linker::formatComment() instead of main parser
30 # local         format section links in edit comment text as local links
31 # notoc         disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 # You can also set the following parser properties via test options:
35 #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 #  wgLinkHolderBatchSize, wgRawHtml
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
66 !! article
67 Template:pipe
68 !! text
70 !! endarticle
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
84 !! article
85 Template:tbl-start
86 !! text
88 !! endarticle
90 !! article
91 Template:tbl-end
92 !! text
94 !! endarticle
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
140 !! article
142 !! text
143 Weirdo titles!
144 !! endarticle
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
152 !!article
153 Template:OpenTable
154 !!text
156 !!endarticle
159 ### Basic tests
161 !! test
162 Blank input
163 !! wikitext
164 !! html
165 !! end
168 !! test
169 Simple paragraph
170 !! wikitext
171 This is a simple paragraph.
172 !! html
173 <p>This is a simple paragraph.
174 </p>
175 !! end
177 !! test
178 Paragraphs with extra newline spacing
179 !! wikitext
189 booz
190 !! html
191 <p>foo
192 </p><p>bar
193 </p><p><br />
195 </p><p><br />
196 </p><p>booz
197 </p>
198 !! end
200 !! test
201 Paragraphs with newline spacing with comment lines in between
202 !! wikitext
203 ----
205 <!--foo-->
207 ----
209 <!--foo--><!--More than 1 comment, still stripped-->
211 ----
213  <!--foo--> <!----> <!-- bar --> 
215 ----
217 <!--foo-->
220 ----
223 <!--foo-->
225 ----
227 <!--foo-->
231 ----
235 <!--foo-->
237 ----
238 !! html
239 <hr />
240 <p>a
242 </p>
243 <hr />
244 <p>a
246 </p>
247 <hr />
248 <p>a
250 </p>
251 <hr />
252 <p>a
253 </p><p>b
254 </p>
255 <hr />
256 <p>a
257 </p><p>b
258 </p>
259 <hr />
260 <p>a
261 </p><p><br />
263 </p>
264 <hr />
265 <p>a
266 </p><p><br />
268 </p>
269 <hr />
271 !! end
273 !! test
274 Paragraphs with newline spacing with non-empty white-space lines in between
275 !! wikitext
276 ----
280 ----
285 ----
286 !! html
287 <hr />
288 <p>a
289 </p><p>b
290 </p>
291 <hr />
292 <p>a
293 </p><p><br /> 
295 </p>
296 <hr />
298 !! end
300 !! test
301 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
302 !! wikitext
303 ----
305  <!--foo-->
307 ----
309  <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
311 ----
314 <!--foo-->
315  <!--bar-->
317 ----
320  <!--foo-->
321  <!--bar-->
324 ----
325 !! html
326 <hr />
327 <p>a
329 </p>
330 <hr />
331 <p>a
333 </p>
334 <hr />
335 <p>a
336 </p><p>b
337 </p>
338 <hr />
339 <p>a
340 </p><p><br /> 
342 </p>
343 <hr />
345 !! end
347 !! test
348 Extra newlines: More paragraphs with indented comment
349 !! wikitext
352    <!--boo-->
355 !! html
356 <p>a
357 </p><p><br />
359 </p>
360 !!end
362 !! test
363 Extra newlines followed by heading
364 !! wikitext
370 [[a]]
374 !! html
375 <p>a
376 </p><p><br />
377 </p>
378 <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>
379 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
380 </p><p><br />
381 </p>
382 <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>
384 !! end
386 !! test
387 Extra newlines between heading and content are swallowed
388 !! wikitext
393 [[a]]
394 !! html
395 <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>
396 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
397 </p>
398 !! end
400 !! test
401 Parsing an URL
402 !! wikitext
403 http://fr.wikipedia.org/wiki/🍺
404 <!-- EasterEgg we love beer, better be able be able to link to it -->
405 !! html
406 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
407 </p>
408 !! end
410 # Note that the html+tidy output removes the spaces after the <li>,
411 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
412 # This is an issue for all tests with lists.  We intentionally do
413 # *not* add html+tidy clauses for these, as we don't want to
414 # document/test the broken behavior.  (Parsoid matches the non-tidy
415 # output in these cases.)
417 !! test
418 Simple list
419 !! wikitext
420 * Item 1
421 * Item 2
422 !! html
423 <ul><li> Item 1</li>
424 <li> Item 2</li></ul>
426 !! end
428 !! test
429 Italics and bold
430 !! wikitext
431 * plain
432 * plain''italic''plain
433 * plain''italic''plain''italic''plain
434 * plain'''bold'''plain
435 * plain'''bold'''plain'''bold'''plain
436 * plain''italic''plain'''bold'''plain
437 * plain'''bold'''plain''italic''plain
438 * plain''italic'''bold-italic'''italic''plain
439 * plain'''bold''bold-italic''bold'''plain
440 * plain'''''bold-italic'''italic''plain
441 * plain'''''bold-italic''bold'''plain
442 * plain''italic'''bold-italic'''''plain
443 * plain'''bold''bold-italic'''''plain
444 * plain l'''italic''plain
445 * plain l''''bold''' plain
446 !! html
447 <ul><li> plain</li>
448 <li> plain<i>italic</i>plain</li>
449 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
450 <li> plain<b>bold</b>plain</li>
451 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
452 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
453 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
454 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
455 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
456 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
457 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
458 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
459 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
460 <li> plain l'<i>italic</i>plain</li>
461 <li> plain l'<b>bold</b> plain</li></ul>
463 !! end
465 # this example taken from the [[simple:Moon]] article (bug 47326)
466 !! test
467 Italics and possessives (1)
468 !! wikitext
469 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
470 !! html
471 <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
472 </p>
473 !! end
475 # this example taken from [[en:Flaming Pie]] (bug 49926)
476 !! test
477 Italics and possessives (2)
478 !! wikitext
479 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
480 !! html
481 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
482 </p>
483 !! end
485 # this example taken from [[en:Dictionary]] (bug 49926)
486 !! test
487 Italics and possessives (3)
488 !! wikitext
489 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''.
490 !! html
491 <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>.
492 </p>
493 !! end
497 ### 2-quote opening sequence tests
499 !! test
500 Italics and bold: 2-quote opening sequence: (2,2)
501 !! wikitext
502 ''foo''
503 !! html
504 <p><i>foo</i>
505 </p>
506 !!end
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3)
511 !! options
512 parsoid=wt2html
513 !! wikitext
514 ''foo'''
515 !! html/*
516 <p><i>foo'</i>
517 </p>
518 !!end
521 # same html as previous, but wikitext adjusted to match parsoid html2wt
522 !! test
523 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
524 !! wikitext
525 ''<nowiki>foo'</nowiki>''
526 !! html
527 <p><i>foo'</i>
528 </p>
529 !! end
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4)
534 !! options
535 parsoid=wt2html
536 !! wikitext
537 ''foo''''
538 !! html/*
539 <p><i>foo''</i>
540 </p>
541 !!end
544 # same html as previous, but wikitext adjusted to match parsoid html2wt
545 !! test
546 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
547 !! wikitext
548 ''<nowiki>foo''</nowiki>''
549 !! html
550 <p><i>foo''</i>
551 </p>
552 !! end
555 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
556 !! test
557 Italics and bold: 2-quote opening sequence: (2,5)
558 !! options
559 parsoid=wt2html
560 !! wikitext
561 ''foo'''''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !!end
570 # same html as previous, but wikitext adjusted to match parsoid html2wt
571 !! test
572 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
573 !! wikitext
574 ''foo'''''<nowiki/>'''
575 !! html/php
576 <p><i>foo</i>
577 </p>
578 !! html/parsoid
579 <p><i>foo</i><b></b>
580 </p>
581 !! end
585 ### 3-quote opening sequence tests
588 !! test
589 Italics and bold: 3-quote opening sequence: (3,2)
590 !! wikitext
591 '''foo''
592 !! html
593 <p>'<i>foo</i>
594 </p>
595 !!end
598 !! test
599 Italics and bold: 3-quote opening sequence: (3,3)
600 !! wikitext
601 '''foo'''
602 !! html
603 <p><b>foo</b>
604 </p>
605 !!end
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4)
610 !! options
611 parsoid=wt2html
612 !! wikitext
613 '''foo''''
614 !! html/*
615 <p><b>foo'</b>
616 </p>
617 !!end
620 # same html as previous, but wikitext adjusted to match parsoid html2wt
621 !! test
622 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
623 !! wikitext
624 '''<nowiki>foo'</nowiki>'''
625 !! html
626 <p><b>foo'</b>
627 </p>
628 !! end
631 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
632 !! test
633 Italics and bold: 3-quote opening sequence: (3,5)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 '''foo'''''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !!end
646 # same html as previous, but wikitext adjusted to match parsoid html2wt
647 !! test
648 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
649 !! wikitext
650 '''foo'''''<nowiki/>''
651 !! html/php
652 <p><b>foo</b>
653 </p>
654 !! html/parsoid
655 <p><b>foo</b><i></i>
656 </p>
657 !! end
661 ### 4-quote opening sequence tests
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''''foo''
670 !! html/*
671 <p>''<i>foo</i>
672 </p>
673 !!end
676 # same html as previous, but wikitext adjusted to match parsoid html2wt
677 !! test
678 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
679 !! wikitext
680 <nowiki>''</nowiki>''foo''
681 !! html
682 <p>''<i>foo</i>
683 </p>
684 !! end
687 !! test
688 Italics and bold: 4-quote opening sequence: (4,3)
689 !! wikitext
690 ''''foo'''
691 !! html
692 <p>'<b>foo</b>
693 </p>
694 !!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
709 # same html as previous, but wikitext adjusted to match parsoid html2wt
710 !! test
711 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
712 !! wikitext
713 ''''<nowiki>foo'</nowiki>'''
714 !! html
715 <p>'<b>foo'</b>
716 </p>
717 !! end
720 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
721 !! test
722 Italics and bold: 4-quote opening sequence: (4,5)
723 !! options
724 parsoid=wt2html
725 !! wikitext
726 ''''foo'''''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !!end
735 # same html as previous, but wikitext adjusted to match parsoid html2wt
736 !! test
737 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
738 !! wikitext
739 ''''foo'''''<nowiki/>''
740 !! html/php
741 <p>'<b>foo</b>
742 </p>
743 !! html/parsoid
744 <p>'<b>foo</b><i></i>
745 </p>
746 !! end
750 ### 5-quote opening sequence tests
753 !! test
754 Italics and bold: 5-quote opening sequence: (5,2)
755 !! options
756 parsoid=wt2html
757 !! wikitext
758 '''''foo''
759 !! html/*
760 <p><b><i>foo</i></b>
761 </p>
762 !!end
765 # same html as previous, but wikitext adjusted to match parsoid html2wt
766 # skipping wt2html and html2html because it wants to put <i> before <b>
767 !! test
768 Italics and bold: 5-quote opening sequence: (5,2+3)
769 !! options
770 parsoid=wt2wt,html2wt
771 !! wikitext
772 '''''foo'''''
773 !! html
774 <p><b><i>foo</i></b>
775 </p>
776 !! end
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 '''''foo'''
784 !! html/*
785 <p><i><b>foo</b></i>
786 </p>
787 !!end
790 # same html as previous, but wikitext adjusted to match parsoid html2wt
791 !! test
792 Italics and bold: 5-quote opening sequence: (5,3+2)
793 !! wikitext
794 '''''foo'''''
795 !! html
796 <p><i><b>foo</b></i>
797 </p>
798 !! end
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4)
803 !! options
804 parsoid=wt2html
805 !! wikitext
806 '''''foo''''
807 !! html/*
808 <p><i><b>foo'</b></i>
809 </p>
810 !!end
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
816 !! wikitext
817 '''''<nowiki>foo'</nowiki>'''''
818 !! html
819 <p><i><b>foo'</b></i>
820 </p>
821 !! end
824 !! test
825 Italics and bold: 5-quote opening sequence: (5,5)
826 !! wikitext
827 '''''foo'''''
828 !! html
829 <p><i><b>foo</b></i>
830 </p>
831 !!end
834 ### multiple quote sequences in a line
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2)
838 !! options
839 parsoid=wt2html
840 !! wikitext
841 ''foo''''bar''
842 !! html/*
843 <p><i>foo'<b>bar</b></i>
844 </p>
845 !!end
848 # same html as previous, but wikitext adjusted to match parsoid html2wt
849 !! test
850 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
851 !! wikitext
852 ''<nowiki>foo'</nowiki>'''bar'''''
853 !! html
854 <p><i>foo'<b>bar</b></i>
855 </p>
856 !! end
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3)
861 !! options
862 parsoid=wt2html
863 !! wikitext
864 ''foo''''bar'''
865 !! html/*
866 <p><i>foo'<b>bar</b></i>
867 </p>
868 !!end
871 # same html as previous, but wikitext adjusted to match parsoid html2wt
872 !! test
873 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
874 !! wikitext
875 ''<nowiki>foo'</nowiki>'''bar'''''
876 !! html
877 <p><i>foo'<b>bar</b></i>
878 </p>
879 !! end
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4)
884 !! options
885 parsoid=wt2html
886 !! wikitext
887 ''foo''''bar''''
888 !! html/*
889 <p><i>foo'<b>bar'</b></i>
890 </p>
891 !!end
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
897 !! wikitext
898 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
899 !! html
900 <p><i>foo'<b>bar'</b></i>
901 </p>
902 !! end
905 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
906 !! test
907 Italics and bold: multiple quote sequences: (3,4,2)
908 !! options
909 parsoid=wt2html
910 !! wikitext
911 '''foo''''bar''
912 !! html/php
913 <p><b>foo'</b>bar
914 </p>
915 !! html/parsoid
916 <p><b>foo'</b>bar<i></i>
917 </p>
918 !!end
920 # same html as previous, but wikitext adjusted to match parsoid html2wt
921 !! test
922 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
923 !! options
924 parsoid
925 !! wikitext
926 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
927 !! html/php
928 <p><b>foo'</b>bar
929 </p>
930 !! html/parsoid
931 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
932 </p>
933 !! end
936 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
937 !! test
938 Italics and bold: multiple quote sequences: (3,4,3)
939 !! options
940 parsoid=wt2html
941 !! wikitext
942 '''foo''''bar'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b>foo'</b>bar<b></b>
948 </p>
949 !!end
951 # same html as previous, but wikitext adjusted to match parsoid html2wt
952 !! test
953 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
954 !! wikitext
955 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
956 !! html/php
957 <p><b>foo'</b>bar
958 </p>
959 !! html/parsoid
960 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
961 </p>
962 !! end
965 ### other quote tests
967 !! test
968 Italics and bold: other quote tests: (2,3,5)
969 !! wikitext
970 ''this is about '''foo's family'''''
971 !! html
972 <p><i>this is about <b>foo's family</b></i>
973 </p>
974 !!end
977 !! test
978 Italics and bold: other quote tests: (2,(3,3),2)
979 !! wikitext
980 ''this is about '''foo's''' family''
981 !! html
982 <p><i>this is about <b>foo's</b> family</i>
983 </p>
984 !!end
987 !! test
988 Italics and bold: other quote tests: (3,2,3,2)
989 !! options
990 parsoid=wt2html
991 !! wikitext
992 '''this is about ''foo'''s family''
993 !! html/*
994 <p><b>this is about <i>foo</i></b><i>s family</i>
995 </p>
996 !!end
999 # same html as previous, but wikitext adjusted to match parsoid html2wt
1000 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
1001 !! test
1002 Italics and bold: other quote tests: (3,2,3+2+2,2)
1003 !! options
1004 parsoid
1005 !! wikitext
1006 '''this is about ''foo'''''<nowiki/>''s family''
1007 !! html/*
1008 <p><b>this is about <i>foo</i></b><i>s family</i>
1009 </p>
1010 !! end
1013 !! test
1014 Italics and bold: other quote tests: (3,2,3,3)
1015 !! options
1016 !! wikitext
1017 '''this is about ''foo'''s family'''
1018 !! html
1019 <p>'<i>this is about </i>foo<b>s family</b>
1020 </p>
1021 !!end
1024 !! test
1025 Italics and bold: other quote tests: (3,(2,2),3)
1026 !! wikitext
1027 '''this is about ''foo's'' family'''
1028 !! html
1029 <p><b>this is about <i>foo's</i> family</b>
1030 </p>
1031 !!end
1034 !! test
1035 Italicized possessive
1036 !! wikitext
1037 The ''[[Main Page]]'''s talk page.
1038 !! html
1039 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1040 </p>
1041 !! end
1043 !! test
1044 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1045 (Requires tidy for PHP parser output to be fixed up)
1046 !! options
1047 parsoid=wt2html,wt2wt
1048 !! wikitext
1050 !''a!!''b
1051 |''a||''b
1053 !! html/php+tidy
1054 <table>
1055 <tr>
1056 <th><i>a</i></th>
1057 <th><i>b</i></th>
1058 <td><i>a</i></td>
1059 <td><i>b</i></td>
1060 </tr>
1061 </table>
1062 !! html/parsoid
1063 <table>
1064 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1065 <td><i>a</i></td><td><i>b</i></td></tr>
1066 </tbody></table>
1067 !! end
1070 ### Non-html5 tags
1073 !! test
1074 Non-html5 tags should be accepted
1075 !! wikitext
1076 <center>''foo''</center>
1077 <big>''foo''</big>
1078 <font>''foo''</font>
1079 <strike>''foo''</strike>
1080 <tt>''foo''</tt>
1081 !! html
1082 <center><i>foo</i></center>
1083 <p><big><i>foo</i></big>
1084 <font><i>foo</i></font>
1085 <strike><i>foo</i></strike>
1086 <tt><i>foo</i></tt>
1087 </p>
1088 !! end
1090 !! test
1091 <wbr> is valid wikitext (bug 52468)
1092 !! wikitext
1093 <wbr>
1094 !! html
1095 <p><wbr />
1096 </p>
1097 !! end
1099 # <strike> is HTML4, <s> is HTML4/5.
1100 !! test
1101 <s> or <strike> for strikethrough
1102 !! wikitext
1103 <strike>strike</strike>
1105 <s>s</s>
1106 !! html
1107 <p><strike>strike</strike>
1108 </p><p><s>s</s>
1109 </p>
1110 !! end
1112 ## a not permitted
1113 ## i,b,br omitted
1114 !! test
1115 Text-level semantic html elements in wikitext
1116 !! wikitext
1117 <em>text</em>
1118 <strong>text</strong>
1119 <small>text</small>
1120 <s>text</s>
1121 <cite>text</cite>
1122 <q>text</q>
1123 <dfn>text</dfn>
1124 <abbr>text</abbr>
1125 <data>text</data>
1126 <time>text</time>
1127 <code>text</code>
1128 <var>text</var>
1129 <samp>text</samp>
1130 <kbd>text</kbd>
1131 <sub>text</sub>
1132 <u>text</u>
1133 <mark>text</mark>
1134 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1135 <bdi>text</bdi>
1136 <bdo>text</bdo>
1137 <span>text</span>
1138 <wbr />
1139 !! html
1140 <p><em>text</em>
1141 <strong>text</strong>
1142 <small>text</small>
1143 <s>text</s>
1144 <cite>text</cite>
1145 <q>text</q>
1146 <dfn>text</dfn>
1147 <abbr>text</abbr>
1148 <data>text</data>
1149 <time>text</time>
1150 <code>text</code>
1151 <var>text</var>
1152 <samp>text</samp>
1153 <kbd>text</kbd>
1154 <sub>text</sub>
1155 <u>text</u>
1156 <mark>text</mark>
1157 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1158 <bdi>text</bdi>
1159 <bdo>text</bdo>
1160 <span>text</span>
1161 <wbr />
1162 </p>
1163 !! end
1165 # test cases taken from
1166 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1167 !! test
1168 Ruby markup (W3C-style)
1169 !! wikitext
1170 ; Mono-ruby for individual base characters
1171 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1172 ; Group ruby
1173 : <ruby>今日<rt>きょう</rt></ruby>
1174 ; Jukugo ruby
1175 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1176 ; Inline ruby
1177 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1178 ; Double-sided ruby
1179 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1180 <ruby>
1181 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1182 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1183 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1184 </ruby>
1185 !! html
1186 <dl><dt> Mono-ruby for individual base characters</dt>
1187 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1188 <dt> Group ruby</dt>
1189 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1190 <dt> Jukugo ruby</dt>
1191 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1192 <dt> Inline ruby</dt>
1193 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1194 <dt> Double-sided ruby</dt>
1195 <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>
1196 <p><ruby>
1197 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1198 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1199 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1200 </ruby>
1201 </p>
1202 !! end
1204 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1205 !! test
1206 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1207 !! wikitext
1208 <b→> doesn't work! </b→>
1210 <bä> doesn't work! </bä>
1212 <boo> works fine </boo>
1214 <s.foo>s.foo</s.foo>
1216 <sub-ID#1>
1217 !! html
1218 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1219 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1220 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1221 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1222 </p><p>&lt;sub-ID#1&gt;
1223 </p>
1224 !! end
1226 !! test
1227 Isolated close tags should be treated as literal text (bug 52760)
1228 !! wikitext
1229 </b>
1231 <s.foo>s</s>
1232 !! html
1233 <p>&lt;/b&gt;
1234 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1235 </p>
1236 !! end
1239 ### Special characters
1242 !! test
1243 Bare pipe character (bug 52363)
1244 !! wikitext
1246 !! html
1247 <p>|
1248 </p>
1249 !! end
1251 !! test
1252 Bare pipe character from a template (bug 52363)
1253 !! wikitext
1254 {{pipe}}
1255 !! html
1256 <p>|
1257 </p>
1258 !! end
1261 ### <nowiki> test cases
1264 !! test
1265 <nowiki> unordered list
1266 !! wikitext
1267 <nowiki>* This is not an unordered list item.</nowiki>
1268 !! html
1269 <p>* This is not an unordered list item.
1270 </p>
1271 !! end
1273 !! test
1274 <nowiki> spacing
1275 !! wikitext
1276 <nowiki>Lorem ipsum dolor
1278 sed abit.
1279   sed nullum.
1281 :and a colon
1282 </nowiki>
1283 !! html
1284 <p>Lorem ipsum dolor
1286 sed abit.
1287   sed nullum.
1289 :and a colon
1291 </p>
1292 !! end
1294 !! test
1295 nowiki 3
1296 !! wikitext
1297 :There is not nowiki.
1298 :There is <nowiki>nowiki</nowiki>.
1300 #There is not nowiki.
1301 #There is <nowiki>nowiki</nowiki>.
1303 *There is not nowiki.
1304 *There is <nowiki>nowiki</nowiki>.
1305 !! html
1306 <dl><dd>There is not nowiki.</dd>
1307 <dd>There is nowiki.</dd></dl>
1308 <ol><li>There is not nowiki.</li>
1309 <li>There is nowiki.</li></ol>
1310 <ul><li>There is not nowiki.</li>
1311 <li>There is nowiki.</li></ul>
1313 !! end
1315 !! test
1316 Entities inside <nowiki>
1317 !! wikitext
1318 <nowiki>&lt;</nowiki>
1319 !! html
1320 <p>&lt;
1321 </p>
1322 !! end
1324 !! test
1325 Entities inside template parameters
1326 !! options
1327 parsoid
1328 !! wikitext
1329 {{echo|&ndash;}}
1330 !! html
1331 <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>
1332 </p>
1333 !! end
1335 !! test
1336 Properly escape nowiki when combined with other wiki markup
1337 !! options
1338 parsoid=html2wt
1339 !! wikitext
1340 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1341 !! html
1342 <p>* &lt;/nowiki&gt; tag</p>
1343 !! end
1346 ### Comments
1348 !! test
1349 Comments and Indent-Pre
1350 !! wikitext
1351 <!-- comment 1 --> asdf
1353 <!-- comment 1 --> asdf
1354 <!-- comment 2 -->
1356 <!-- comment 1 --> asdf
1357 <!-- comment 2 -->xyz
1359 <!-- comment 1 --> asdf
1360 <!-- comment 2 --> xyz
1361 !! html
1362 <pre>asdf
1363 </pre>
1364 <pre>asdf
1365 </pre>
1366 <pre>asdf
1367 </pre>
1368 <p>xyz
1369 </p>
1370 <pre>asdf
1372 </pre>
1373 !! end
1375 !! test
1376 Comment test 2a
1377 !! wikitext
1378 asdf
1379 <!-- comment 1 -->
1381 !! html
1382 <p>asdf
1384 </p>
1385 !! end
1387 !! test
1388 Comment test 2b
1389 !! wikitext
1390 asdf
1391 <!-- comment 1 -->
1394 !! html
1395 <p>asdf
1396 </p><p>jkl
1397 </p>
1398 !! end
1400 !! test
1401 Comment test 3
1402 !! wikitext
1403 asdf
1404 <!-- comment 1 -->
1405 <!-- comment 2 -->
1407 !! html
1408 <p>asdf
1410 </p>
1411 !! end
1413 !! test
1414 Comment test 4
1415 !! wikitext
1416 asdf<!-- comment 1 -->jkl
1417 !! html
1418 <p>asdfjkl
1419 </p>
1420 !! end
1422 !! test
1423 Comment spacing
1424 !! wikitext
1426  <!-- foo --> b <!-- bar -->
1428 !! html
1429 <p>a
1430 </p>
1431 <pre> b 
1432 </pre>
1433 <p>c
1434 </p>
1435 !! end
1437 !! test
1438 Comment whitespace
1439 !! wikitext
1440 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1441 !! html
1443 !! end
1445 !! test
1446 Comment semantics and delimiters
1447 !! wikitext
1448 <!-- --><!----><!-----><!------>
1449 !! html
1451 !! end
1453 !! test
1454 Comment semantics and delimiters, redux
1455 !! wikitext
1456 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1457 -- foo -- funky huh? ... -->
1458 !! html
1460 !! end
1462 !! test
1463 Comment semantics and delimiters: directors cut
1464 !! wikitext
1465 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1466 everything starting with < followed by !-- until the first -- and > we see,
1467 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1468 -->-->
1469 !! html
1470 <p>--&gt;
1471 </p>
1472 !! end
1474 !! test
1475 Comment semantics: nesting
1476 !! wikitext
1477 <!--<!-- no, we're not going to do anything fancy here -->-->
1478 !! html
1479 <p>--&gt;
1480 </p>
1481 !! end
1483 !! test
1484 Comment semantics: unclosed comment at end
1485 !! wikitext
1486 <!--This comment will run out to the end of the document
1487 !! html
1489 !! end
1491 !! test
1492 Comment in template title
1493 !! wikitext
1494 {{f<!---->oo}}
1495 !! html
1496 <p>FOO
1497 </p>
1498 !! end
1500 !! test
1501 Comment on its own line post-expand
1502 !! wikitext
1504 {{blank}}<!---->
1506 !! html
1507 <p>a
1508 </p><p>b
1509 </p>
1510 !! end
1512 !! test
1513 Comment on its own line post-expand with non-significant whitespace
1514 !! wikitext
1516  {{blank}} <!----> 
1518 !! html
1519 <p>a
1520 </p><p>b
1521 </p>
1522 !! end
1524 !! test
1525 Multiple comments should still parse as SOL-transparent
1526 !! options
1527 parsoid=wt2html,wt2wt
1528 !! wikitext
1529 <!--c1-->*a
1530 <!--c2--><!--c3--><!--c4-->*b
1531 !! html
1532 <ul>
1533 <li>a
1534 </li>
1535 <li>b
1536 </li>
1537 </ul>
1538 !! end
1541 ### paragraph wrapping tests
1543 !! test
1544 No block tags
1545 !! wikitext
1549 !! html
1550 <p>a
1551 </p><p>b
1552 </p>
1553 !! end
1555 !! test
1556 Block tag on one line (<div>)
1557 !! wikitext
1558 a <div>foo</div>
1561 !! html
1562 a <div>foo</div>
1563 <p>b
1564 </p>
1565 !! html+tidy
1566 <p>a</p>
1567 <div>foo</div>
1568 <p>b</p>
1569 !! end
1571 !! test
1572 Block tag on one line (<blockquote>)
1573 !! wikitext
1574 a <blockquote>foo</blockquote>
1577 !! html
1578 a <blockquote>foo</blockquote>
1579 <p>b
1580 </p>
1581 !! html+tidy
1582 <p>a</p>
1583 <blockquote>
1584 <p>foo</p>
1585 </blockquote>
1586 <p>b</p>
1587 !! end
1589 !! test
1590 Block tag on both lines (<div>)
1591 !! wikitext
1592 a <div>foo</div>
1594 b <div>foo</div>
1595 !! html
1596 a <div>foo</div>
1597 b <div>foo</div>
1599 !! html+tidy
1600 <p>a</p>
1601 <div>foo</div>
1602 <p>b</p>
1603 <div>foo</div>
1604 !! end
1606 !! test
1607 Block tag on both lines (<blockquote>)
1608 !! wikitext
1609 a <blockquote>foo</blockquote>
1611 b <blockquote>foo</blockquote>
1612 !! html
1613 a <blockquote>foo</blockquote>
1614 b <blockquote>foo</blockquote>
1616 !! html+tidy
1617 <p>a</p>
1618 <blockquote>
1619 <p>foo</p>
1620 </blockquote>
1621 <p>b</p>
1622 <blockquote>
1623 <p>foo</p>
1624 </blockquote>
1625 !! end
1627 !! test
1628 Multiple lines without block tags
1629 !! wikitext
1630 <div>foo</div> a
1633 d<!--foo--> e
1634 x <div>foo</div> z
1635 !! html
1636 <div>foo</div> a
1637 <p>b
1639 d e
1640 </p>
1641 x <div>foo</div> z
1643 !! html+tidy
1644 <div>foo</div>
1645 <p>a</p>
1646 <p>b c d e</p>
1647 <p>x</p>
1648 <div>foo</div>
1649 <p>z</p>
1650 !! end
1652 !! test
1653 Empty lines between lines with block tags
1654 !! wikitext
1655 <div></div>
1658 <div></div>a
1661 <div>a</div>b
1663 <div>b</div>d
1666 <div>e</div>
1667 !! html
1668 <div></div>
1669 <p><br />
1670 </p>
1671 <div></div>a
1672 <p>b
1673 </p>
1674 <div>a</div>b
1675 <div>b</div>d
1676 <p><br />
1677 </p>
1678 <div>e</div>
1680 !! html+tidy
1681 <p><br /></p>
1682 <p>a</p>
1683 <p>b</p>
1684 <div>a</div>
1685 <p>b</p>
1686 <div>b</div>
1687 <p>d</p>
1688 <p><br /></p>
1689 <div>e</div>
1690 !! end
1692 ## PHP parser emits output which is broken
1693 ## XXX The parsoid output doesn't match the tidy output.
1694 !! test
1695 Unclosed HTML p-tags should be handled properly
1696 !! wikitext
1697 <div><p>foo</div>
1701 !! html/php+tidy
1702 <div>
1703 <p>foo&lt;/div&gt;</p>
1704 <p>a</p>
1705 b</div>
1706 !! html/parsoid
1707 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1708 <p>a</p>
1709 <p>b</p>
1710 !! end
1713 ### Preformatted text
1715 !! test
1716 Preformatted text
1717 !! wikitext
1718  This is some
1719  Preformatted text
1720  With ''italic''
1721  And '''bold'''
1722  And a [[Main Page|link]]
1723 !! html
1724 <pre>This is some
1725 Preformatted text
1726 With <i>italic</i>
1727 And <b>bold</b>
1728 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1729 </pre>
1730 !! end
1732 !! test
1733 Tabs don't trigger preformatted text
1734 !! wikitext
1735         This is not
1736          preformatted text.
1737  This is preformatted text.
1738         So is this.
1739 !! html
1740 <p>     This is not
1741          preformatted text.
1742 </p>
1743 <pre>This is preformatted text.
1744         So is this.
1745 </pre>
1746 !! end
1748 !! test
1749 Ident preformatting with inline content
1750 !! wikitext
1752  ''b''
1753 !! html
1754 <pre>a
1755 <i>b</i>
1756 </pre>
1757 !! end
1759 !! test
1760 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1761 !! wikitext
1762 <pre><nowiki>
1764 <cite>
1765 <em>
1766 </nowiki></pre>
1767 !! html
1768 <pre>
1769 &lt;b&gt;
1770 &lt;cite&gt;
1771 &lt;em&gt;
1772 </pre>
1774 !! end
1776 !! test
1777 Regression with preformatted in <center>
1778 !! wikitext
1779 <center>
1780  Blah
1781 </center>
1782 !! html
1783 <center>
1784 <pre>Blah
1785 </pre>
1786 </center>
1788 !! end
1790 !! test
1791 Bug 52763: Preformatted in <blockquote>
1792 !! wikitext
1793 <blockquote>
1794  Blah
1797  indented cell (no pre-wrapping!)
1799 </blockquote>
1800 !! html
1801 <blockquote>
1802 <p> Blah
1803 </p>
1804 <table>
1805 <tr>
1806 <td>
1807 <p> indented cell (no pre-wrapping!)
1808 </p>
1809 </td></tr></table>
1810 </blockquote>
1812 !! end
1814 !! test
1815 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1816 !! wikitext
1817 <blockquote>
1821 </blockquote>
1822 !! html
1823 <blockquote>
1824 <p>Foo
1825 </p><p>Bar
1826 </p>
1827 </blockquote>
1829 !! end
1831 !! test
1832 Bug 15491: <ins>/<del> in blockquote
1833 !! wikitext
1834 <blockquote>
1835 Foo <del>bar</del> <ins>baz</ins> quux
1836 </blockquote>
1837 !! html
1838 <blockquote>
1839 <p>Foo <del>bar</del> <ins>baz</ins> quux
1840 </p>
1841 </blockquote>
1843 !! end
1845 # Note that the p-wrapping is newline sensitive, which could be
1846 # considered a bug: tidy will wrap only the 'Foo' in the example
1847 # below in a <p> tag. (see comment 23-25 of bug #6200)
1848 !! test
1849 Bug 15491: <ins>/<del> in blockquote (2)
1850 !! wikitext
1851 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1852 </blockquote>
1853 !! html
1854 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1855 </blockquote>
1857 !! html+tidy
1858 <blockquote>
1859 <p>Foo</p>
1860 <del>bar</del> <ins>baz</ins> quux</blockquote>
1861 !! end
1863 !! test
1864 <pre> with attributes (bug 3202)
1865 !! wikitext
1866 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1867 !! html
1868 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1870 !! end
1872 !! test
1873 <pre> with width attribute (bug 3202)
1874 !! wikitext
1875 <pre width="8">Narrow screen goodies</pre>
1876 !! html
1877 <pre width="8">Narrow screen goodies</pre>
1879 !! end
1881 !! test
1882 <pre> with forbidden attribute (bug 3202)
1883 !! wikitext
1884 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1885 !! html
1886 <pre width="8">Narrow screen goodies</pre>
1888 !! end
1890 !! test
1891 Entities inside <pre>
1892 !! wikitext
1893 <pre>&lt;</pre>
1894 !! html
1895 <pre>&lt;</pre>
1897 !! end
1899 !! test
1900 <pre> with forbidden attribute values (bug 3202)
1901 !! wikitext
1902 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1903 !! html
1904 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1906 !! end
1908 !! test
1909 <nowiki> inside <pre> (bug 13238)
1910 !! wikitext
1911 <pre>
1912 <nowiki>
1913 </pre>
1914 <pre>
1915 <nowiki></nowiki>
1916 </pre>
1917 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1918 !! html
1919 <pre>
1920 &lt;nowiki&gt;
1921 </pre>
1922 <pre>
1924 </pre>
1925 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1927 !! end
1929 !! test
1930 <nowiki> and <pre> preference (first one wins)
1931 !! wikitext
1932 <pre>
1933 <nowiki>
1934 </pre>
1935 </nowiki>
1936 </pre>
1938 <nowiki>
1939 <pre>
1940 <nowiki>
1941 </pre>
1942 </nowiki>
1943 </pre>
1945 !! html
1946 <pre>
1947 &lt;nowiki&gt;
1948 </pre>
1949 <p>&lt;/nowiki&gt;
1950 &lt;/pre&gt;
1951 </p><p>
1952 &lt;pre&gt;
1953 &lt;nowiki&gt;
1954 &lt;/pre&gt;
1956 &lt;/pre&gt;
1957 </p>
1958 !! end
1960 !! test
1961 </pre> inside nowiki
1962 !! wikitext
1963 <nowiki></pre></nowiki>
1964 !! html
1965 <p>&lt;/pre&gt;
1966 </p>
1967 !! end
1969 !! test
1970 Empty pre; pre inside other HTML tags (bug 54946)
1971 !! wikitext
1974 <div><pre>
1976 </pre></div>
1977 <pre></pre>
1978 !! html
1979 <p>a
1980 </p>
1981 <div><pre>
1983 </pre></div>
1984 <pre></pre>
1986 !! html+tidy
1987 <p>a</p>
1988 <div>
1989 <pre>
1991 </pre></div>
1992 !! end
1994 !! test
1995 HTML pre followed by indent-pre
1996 !! wikitext
1997 <pre>foo</pre>
1998  bar
1999 !! html
2000 <pre>foo</pre>
2001 <pre>bar
2002 </pre>
2003 !! end
2005 !!test
2006 Block tag pre
2007 !!options
2008 parsoid
2009 !! wikitext
2010 <p><pre>foo</pre></p>
2011 !! html
2012 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2013 !!end
2015 !!test
2016 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2017 !! wikitext
2018  {{echo|}}
2019 !! html
2021 !!end
2023 !!test
2024 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2025 !! wikitext
2026  {{echo|
2027 foo}}
2028 !! html
2029 <p>foo
2030 </p>
2031 !!end
2033 !! test
2034 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2035 !! wikitext
2036  {{echo|a
2038 !! html
2039 <pre>a
2040 </pre>
2041 <p>b
2042 </p>
2043 !!end
2045 !! test
2046 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2047 !! wikitext
2048  {{echo|a
2054 !! html
2055 <pre>a
2056 </pre>
2057 <p>b
2059 </p>
2060 <pre>d
2061 </pre>
2062 <p>e
2063 </p>
2064 !!end
2066 !!test
2067 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2068 !! wikitext
2069 {{echo| foo}}
2071 {{echo| foo}}{{echo| bar}}
2073 {{echo| foo}}
2074 {{echo| bar}}
2076 {{echo|<!--cmt--> foo}}
2078 <!--cmt-->{{echo| foo}}
2080 {{echo|{{echo| }}bar}}
2081 !! html
2082 <pre>foo
2083 </pre>
2084 <pre>foo bar
2085 </pre>
2086 <pre>foo
2088 </pre>
2089 <pre>foo
2090 </pre>
2091 <pre>foo
2092 </pre>
2093 <pre>bar
2094 </pre>
2095 !!end
2097 !! test
2098 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2099 !! wikitext
2100 {{echo| }}a
2102 {{echo|
2103  }}a
2105 {{echo|
2106  b}}
2108 {{echo|a
2109  }}b
2111 {{echo|a
2112 }} b
2113 !! html
2114 <pre>a
2115 </pre>
2116 <p><br />
2117 </p>
2118 <pre>a
2119 </pre>
2120 <p><br />
2121 </p>
2122 <pre>b
2123 </pre>
2124 <p>a
2125 </p>
2126 <pre>b
2127 </pre>
2128 <p>a
2129 </p>
2130 <pre>b
2131 </pre>
2132 !!end
2134 !! test
2135 Things that look like <pre> tags aren't treated as such
2136 !! wikitext
2137 Barack Obama <President> of the United States
2138 <President></President>
2139 !! html
2140 <p>Barack Obama &lt;President&gt; of the United States
2141 &lt;President&gt;&lt;/President&gt;
2142 </p>
2143 !! end
2145 ## PHP parser discards the "<pre " string
2146 !! test
2147 Handle broken pre-like tags (bug 64025)
2148 !! options
2149 parsoid=wt2html
2150 !! wikitext
2151 {{echo|<pre <pre>x</pre>}}
2153 <table><pre </table>
2154 !! html/php
2155 <pre>x</pre>
2156 <table><pre></pre></table>
2158 !! html/parsoid
2159 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
2160 <pre>x</pre>
2162 <span>&lt;pre </span>
2163 <table></table>
2164 !! end
2166 !! test
2167 Parsoid: handle pre with space after attribute
2168 !! options
2169 parsoid=wt2html
2170 !! wikitext
2171 <pre style="width:50%;" >{{echo|foo}}</pre>
2172 !! html
2173 <pre style="width:50%;">{{echo|foo}}</pre>
2174 !! end
2176 # TODO / maybe: fix wt2wt for this
2177 !! test
2178 Parsoid: Don't paragraph-wrap fosterable content
2179 !! options
2180 parsoid=wt2html
2181 !! wikitext
2183 <td></td>
2184 <td></td>
2189 !! html
2190 <table>
2192 <tbody>
2193 <tr>
2194 <td></td>
2196 <td></td></tr>
2200 </tbody></table>
2201 !! end
2203 !! test
2204 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2205 !! options
2206 parsoid=wt2html
2207 !! wikitext
2209 <td>
2210 <td>
2211 </td>
2216 !! html
2217 <table>
2219 <tbody>
2220 <tr>
2221 <td></td>
2223 <td>
2224 </td></tr>
2228 </tbody></table>
2229 !! end
2232 #--------------------------------------------------------------------
2233 # Transclusion parameter whitespace stripping tests
2234 # Behavior is different for positional and named parameters
2235 #--------------------------------------------------------------------
2236 !! test
2237 Templates: Strip leading and trailing whitespace from named-param values
2238 !! wikitext
2239 {{echo|1= a }}
2241 {{echo|1= {{echo|b}} }}
2243 {{echo| 1 =
2244  c }}
2246 {{echo| 1 =
2247 * d
2249 !! html
2250 <p>a
2251 </p><p>b
2252 </p><p>c
2253 </p>
2254 <ul><li> d</li></ul>
2256 !! end
2258 !! test
2259 Templates: Don't strip whitespace from positional-param values
2260 !! wikitext
2261 {{echo|a }}
2263 {{echo|{{echo|b}} }}
2265 {{echo| c 
2268 {{echo| {{echo|d}}
2271 {{echo|
2272  e}}
2274 {{echo|
2275 * f}}
2277 {{echo|
2278  }}g
2279 !! html
2280 <p>a 
2281 </p><p>b 
2282 </p>
2283 <pre>c 
2284 </pre>
2285 <p><br />
2286 </p>
2287 <pre>d
2288 </pre>
2289 <p><br />
2290 </p>
2291 <pre>e
2292 </pre>
2293 <p><br />
2294 </p>
2295 <ul><li> f</li></ul>
2296 <p><br />
2297 </p>
2298 <pre>g
2299 </pre>
2300 !! end
2302 !! test
2303 Templates: Handle empty comment-and-ws-only lines correctly
2304 !! wikitext
2305 {{echo|foo
2306 <!--should be ignored-->
2307  <!--should be ignored as well-->
2308 bar}}
2309 !! html
2310 <p>foo
2312 </p>
2313 !! end
2315 !! test
2316 Templates: Handle comments in the target
2317 !! wikitext
2318 {{echo
2319 <!-- should be ignored -->
2320 |foo}}
2322 {{echo<!-- should be ignored -->
2323 |foo}}
2325 {{echo<!-- should be ignored -->|foo}}
2327 {{<!-- should be ignored -->echo|foo}}
2328 !!html/parsoid
2329 <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>
2331 <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>
2333 <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>
2335 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2336 !!end
2338 #--------------------------------------------------------------------
2339 # Transclusion parameter escaping tests
2340 #--------------------------------------------------------------------
2341 !! test
2342 Templates: Parsoid parameter escaping test 1
2343 !! options
2344 parsoid
2345 !! wikitext
2346 {{echo|[foo]|{{echo|[bar]}}}}
2347 !! html
2348 <p about="#mwt1" typeof="mw:Transclusion"
2349 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2350 !! end
2352 !! test
2353 Parsoid: Pipes in external links in template parameter
2354 !! options
2355 parsoid
2356 !! wikitext
2357 {{echo|[{{echo|http://example.com}} link]}}
2358 !! html
2359 <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>
2360 !! end
2362 !! test
2363 Parsoid: pipe in transclusion parameter
2364 !! options
2365 parsoid
2366 !! wikitext
2367 {{echo|http://foo.com/a&#124;b}}
2368 !! html
2369 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2370 typeof="mw:Transclusion"
2371 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>
2372 !! end
2374 !! test
2375 Parsoid: Pipe in external link target and content in template parameter
2376 !! options
2377 parsoid=html2wt,wt2wt
2378 !! wikitext
2379 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2380 !! html
2381 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2382 typeof="mw:Transclusion"
2383 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2384 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2385 !! end
2387 !! test
2388 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2389 !! options
2390 parsoid
2391 !! wikitext
2392 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2393 !! html
2394 <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>
2395 !! end
2397 !! test
2398 Templates: Don't escape already nowiki-escaped text in template parameters
2399 !! options
2400 parsoid=html2wt,wt2wt
2401 !! wikitext
2402 {{echo|foo<nowiki>|</nowiki>bar}}
2403 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2404 {{echo|<nowiki></nowiki>}}
2405 !! html
2406 <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>
2407 <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>
2408 <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>
2409 </p>
2410 !! end
2412 ## Bug 52824
2413 !! test
2414 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2415 !! options
2416 parsoid=html2wt,wt2wt
2417 !! wikitext
2418 {{echo|{{echo|1=bar}}}}
2419 !! html
2420 <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>
2421 !! end
2423 ## Bug 56733
2424 !! test
2425 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2426 !! options
2427 parsoid
2428 !! wikitext
2429 {{echo|a : b}}
2430 !! html
2431 <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>
2432 !! end
2435 ### Parsoid-centric tests for testing RT edge cases for pre
2438 !!test
2439 1a. Indent-Pre and Comments
2440 !! wikitext
2442 <!--a-->
2444 !! html
2445 <pre>a
2446 </pre>
2447 <p>c
2448 </p>
2449 !!end
2451 !!test
2452 1b. Indent-Pre and Comments
2453 !! wikitext
2455  <!--a-->
2457 !! html
2458 <pre>a
2459 </pre>
2460 <p>c
2461 </p>
2462 !!end
2464 !!test
2465 1c. Indent-Pre and Comments
2466 !! wikitext
2467 <!--a-->  a
2469  <!--a--> a
2470 !! html
2471 <pre> a
2472 </pre>
2473 <pre> a
2474 </pre>
2475 !!end
2477 !!test
2478 1d. Indent-Pre and Comments
2479 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2480 !! wikitext
2481 <!--a--> a
2483  <!--b-->b
2484 !! html
2485 <pre>a
2486 </pre>
2487 <pre>b
2488 </pre>
2489 !!end
2491 !!test
2492 2a. Indent-Pre and tables
2493 !! wikitext
2494  {|
2495  |-
2496  !h1!!h2
2497  |foo||bar
2498  |}
2499 !! html
2500 <table>
2502 <tr>
2503 <th>h1</th>
2504 <th>h2
2505 </th>
2506 <td>foo</td>
2507 <td>bar
2508 </td></tr></table>
2510 !!end
2512 !!test
2513 2b. Indent-Pre and tables
2514 !! wikitext
2515   {|
2516  |-
2517 |foo
2519 !! html
2520 <table>
2522 <tr>
2523 <td>foo
2524 </td></tr></table>
2526 !!end
2528 !!test
2529 2c. Indent-Pre and tables (bug 42252)
2530 !! wikitext
2532  |+ foo
2533  !  | bar
2535 !! html
2536 <table>
2537 <caption> foo
2538 </caption>
2539 <tr>
2540 <th> bar
2541 </th></tr></table>
2543 !!end
2545 !!test
2546 2d. Indent-Pre and tables
2547 !! wikitext
2549  {|
2550  | b
2551  |}
2552 !! html/php
2553 <pre>a
2554 </pre>
2555 <table>
2556 <tr>
2557 <td> b
2558 </td></tr></table>
2560 !! html/parsoid
2561 <pre>a</pre>
2563 <table>
2565 <tbody>
2566 <tr>
2567 <td> b</td></tr>
2568  </tbody></table>
2569 !!end
2571 !!test
2572 2e. Indent-Pre and table-line syntax
2573 !! wikitext
2575  | b
2576  | c
2577 !! html/php
2578 <pre>a
2579 | b
2580 | c
2581 </pre>
2582 !!end
2584 !!test
2585 2f. Indent-pre started by table-line syntax
2586 !! wikitext
2588  | b
2589  | c
2590 !! html/php
2591 <p>a
2592 </p>
2593 <pre>| b
2594 | c
2595 </pre>
2596 !! html/parsoid
2597 <p>a</p>
2598 <pre>
2599 | b
2600 | c</pre>
2601 !!end
2603 !!test
2604 3a. Indent-Pre and block tags (single-line html)
2605 !! wikitext
2606  a <p> foo </p>
2607  b <div> foo </div>
2608  c <blockquote> foo </blockquote>
2609  <span> foo </span>
2610 !! html
2611  a <p> foo </p>
2612  b <div> foo </div>
2613  c <blockquote> foo </blockquote>
2614 <pre><span> foo </span>
2615 </pre>
2616 !! html+tidy
2617 <p>a</p>
2618 <p>foo</p>
2619 <p>b</p>
2620 <div>foo</div>
2621 <p>c</p>
2622 <blockquote>
2623 <p>foo</p>
2624 </blockquote>
2625 <pre>
2626 <span> foo </span>
2627 </pre>
2628 !! end
2630 !!test
2631 3b. Indent-Pre and block tags (multi-line html)
2632 !! wikitext
2633  a <span>foo</span>
2634  b <div> foo </div>
2635 !! html
2636 <pre>a <span>foo</span>
2637 </pre>
2638  b <div> foo </div>
2640 !! html+tidy
2641 <pre>
2642 a <span>foo</span>
2643 </pre>
2644 <p>b</p>
2645 <div>foo</div>
2646 !!end
2648 !!test
2649 3c. Indent-Pre and block tags (pre-content on separate line)
2650 !! wikitext
2652  foo
2653 </p>
2655 <div>
2656  foo
2657 </div>
2659 <center>
2660  foo
2661 </center>
2663 <blockquote>
2664  foo
2665 </blockquote>
2667 <blockquote>
2668 <pre>
2670 </pre>
2671 </blockquote>
2673 <table><tr><td>
2674  foo
2675 </td></tr></table>
2677 <ul><li>
2678   foo
2679 </li></ul>
2681 !! html
2683  foo
2684 </p>
2685 <div>
2686 <pre>foo
2687 </pre>
2688 </div>
2689 <center>
2690 <pre>foo
2691 </pre>
2692 </center>
2693 <blockquote>
2694 <p> foo
2695 </p>
2696 </blockquote>
2697 <blockquote>
2698 <pre>
2700 </pre>
2701 </blockquote>
2702 <table><tr><td>
2703 <pre>foo
2704 </pre>
2705 </td></tr></table>
2706 <ul><li>
2707   foo
2708 </li></ul>
2710 !!end
2712 !!test
2713 4. Indent-Pre and extension tags
2714 !! wikitext
2715  a <gallery>
2716 File:foobar.jpg
2717 </gallery>
2718 !! html
2719  a <ul class="gallery mw-gallery-traditional">
2720                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2721                         <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>
2722                         <div class="gallerytext">
2723                         </div>
2724                 </div></li>
2725 </ul>
2727 !! html+tidy
2728 <p>a</p>
2729 <ul class="gallery mw-gallery-traditional">
2730 <li class="gallerybox" style="width: 155px">
2731 <div style="width: 155px">
2732 <div class="thumb" style="width: 150px;">
2733 <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>
2734 </div>
2735 <div class="gallerytext"></div>
2736 </div>
2737 </li>
2738 </ul>
2739 !!end
2741 !! test
2742 Table wikitext syntax outside wiki-tables
2743 !! wikitext
2745 ! not a table heading
2746 |- not a table row
2747 | not a table cell
2748 | class="foo bar" | baz
2753 !! html
2754 <p>a
2755 ! not a table heading
2756 |- not a table row
2757 | not a table cell
2758 | class="foo bar" | baz
2763 </p>
2764 !! end
2766 !!test
2767 Render paragraphs when indent-pre is suppressed in blocklevels
2768 !! wikitext
2769 <blockquote>
2770  foo
2772  bar
2773 </blockquote>
2774 !! html
2775 <blockquote>
2776 <p> foo
2777 </p><p> bar
2778 </p>
2779 </blockquote>
2781 !!end
2783 !!test
2784 4. Multiple spaces at start-of-line
2785 !! wikitext
2786     <p> foo </p>
2787     foo
2788         {|
2789 |foo
2791 !! html
2792     <p> foo </p>
2793 <pre>   foo
2794 </pre>
2795 <table>
2796 <tr>
2797 <td>foo
2798 </td></tr></table>
2800 !!end
2802 ## NOTE: the leading white-space chars on empty line are significant
2803 !! test
2804 5a. White-space in indent-pre
2805 !! wikitext
2806  a<br />
2809 !! html
2810 <pre>a<br />
2813 </pre>
2814 !! end
2816 ## NOTE: the leading white-space chars on empty line are significant
2817 !! test
2818 5b. White-space in indent-pre
2819 !! wikitext
2826 !! html
2827 <pre>a
2833 </pre>
2834 !! end
2836 !! test
2837 5c. White-space in indent-pre
2838 !! wikitext
2839  ''a''
2840   ''b''
2841    ''c''
2842 !! html
2843 <pre><i>a</i>
2844  <i>b</i>
2845   <i>c</i>
2846 </pre>
2847 !! end
2849 !! test
2850 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2851 !! wikitext
2854  <!-- continue -->
2860 !! html
2861 <pre>a
2864 </pre>
2865 <pre>c
2867 </pre>
2868 <p>d
2869 </p>
2870 !! end
2872 !! test
2873 7a. Indent-pre and category links
2874 !! options
2875 parsoid=wt2html,wt2wt
2876 !! wikitext
2877  [[Category:foo]] <!-- No pre-wrapping -->
2878 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2879 !! html
2880  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2881 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2882 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2883 !! end
2885 !! test
2886 7b. Indent-pre and category links
2887 !! options
2888 parsoid=wt2html,wt2wt
2889 !! wikitext
2890  [[Category:foo]] a
2891  [[Category:foo]] {{echo|b}}
2892 !! html
2893 <pre>
2894 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2896 <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>
2897 !! end
2900 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2903 !!test
2904 HTML-pre: 1. embedded newlines
2905 !! wikitext
2906 <pre>foo</pre>
2908 <pre>
2910 </pre>
2912 <pre>
2915 </pre>
2917 <pre>
2921 </pre>
2922 !! html
2923 <pre>foo</pre>
2924 <pre>
2926 </pre>
2927 <pre>
2930 </pre>
2931 <pre>
2935 </pre>
2937 !! html/parsoid
2938 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2940 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2942 </pre>
2944 <pre data-parsoid='{"stx":"html"}'>
2947 </pre>
2949 <pre data-parsoid='{"stx":"html"}'>
2953 </pre>
2954 !!end
2956 !! test
2957 HTML-pre: big spaces
2958 !! wikitext
2959 <pre>
2964 haha
2969 haha
2974 </pre>
2975 !! html
2976 <pre>
2981 haha
2986 haha
2991 </pre>
2993 !! html/parsoid
2994 <pre data-parsoid='{"stx":"html"}'>
2999 haha
3004 haha
3009 </pre>
3010 !! end
3012 !!test
3013 HTML-pre: 2: indented text
3014 !! wikitext
3015 <pre>
3016  foo
3017 </pre>
3018 !! html
3019 <pre>
3020  foo
3021 </pre>
3023 !!end
3025 !!test
3026 HTML-pre: 3: other wikitext
3027 !! wikitext
3028 <pre>
3029 * foo
3030 # bar
3031 = no-h =
3032 '' no-italic ''
3033 [[ NoLink ]]
3034 </pre>
3035 !! html
3036 <pre>
3037 * foo
3038 # bar
3039 = no-h =
3040 '' no-italic ''
3041 [[ NoLink ]]
3042 </pre>
3044 !!end
3047 ### Definition lists
3049 !! test
3050 Simple definition
3051 !! wikitext
3052 ; name : Definition
3053 !! html
3054 <dl><dt> name&#160;</dt>
3055 <dd> Definition</dd></dl>
3057 !! end
3059 !! test
3060 Definition list for indentation only
3061 !! wikitext
3062 : Indented text
3063 !! html
3064 <dl><dd> Indented text</dd></dl>
3066 !! end
3068 !! test
3069 Definition list with no space
3070 !! wikitext
3071 ;name:Definition
3072 !! html
3073 <dl><dt>name</dt>
3074 <dd>Definition</dd></dl>
3076 !!end
3078 !! test
3079 Definition list with URL link
3080 !! wikitext
3081 ; http://example.com/ : definition
3082 !! html
3083 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3084 <dd> definition</dd></dl>
3086 !! end
3088 !! test
3089 Definition list with bracketed URL link
3090 !! wikitext
3091 ;[http://www.example.com/ Example]:Something about it
3092 !! html
3093 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3094 <dd>Something about it</dd></dl>
3096 !! end
3098 !! test
3099 Definition list with wikilink containing colon
3100 !! wikitext
3101 ; [[Help:FAQ]]: The least-read page on Wikipedia
3102 !! html
3103 <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>
3104 <dd> The least-read page on Wikipedia</dd></dl>
3106 !! end
3108 # At Brion's and JeLuF's insistence... :)
3109 !! test
3110 Definition list with news link containing colon
3111 !! wikitext
3112 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
3113 !! html
3114 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3115 <dd> This isn't even a real newsgroup!</dd></dl>
3117 !! end
3119 !! test
3120 Malformed definition list with colon
3121 !! wikitext
3122 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3123 !! html
3124 <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>
3126 !! end
3128 !! test
3129 Definition lists: colon in external link text
3130 !! wikitext
3131 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3132 !! html
3133 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3134 <dd> OK, I made that up</dd></dl>
3136 !! end
3138 !! test
3139 Definition lists: colon in HTML attribute
3140 !! wikitext
3141 ;<b style="display: inline">bold</b>
3142 !! html
3143 <dl><dt><b style="display: inline">bold</b></dt></dl>
3145 !! end
3147 !! test
3148 Definition lists: self-closed tag
3149 !! wikitext
3150 ;one<br/>two : two-line fun
3151 !! html
3152 <dl><dt>one<br />two&#160;</dt>
3153 <dd> two-line fun</dd></dl>
3155 !! end
3157 !! test
3158 Bug 11748: Literal closing tags
3159 !! wikitext
3160 <dl>
3161 <dt>test 1</dt>
3162 <dd>test test test test test</dd>
3163 <dt>test 2</dt>
3164 <dd>test test test test test</dd>
3165 </dl>
3166 !! html
3167 <dl>
3168 <dt>test 1</dt>
3169 <dd>test test test test test</dd>
3170 <dt>test 2</dt>
3171 <dd>test test test test test</dd>
3172 </dl>
3174 !! end
3176 !! test
3177 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3178 !! wikitext
3179 <ul><li>
3180 ; term : description
3181 * unordered
3182 </li></ul>
3183 !! html
3184 <ul><li>
3185 <dl><dt> term&#160;</dt>
3186 <dd> description</dd></dl>
3187 <ul><li> unordered</li></ul>
3188 </li></ul>
3190 !! end
3192 !! test
3194 Definition list with empty definition and following paragraph
3195 !! wikitext
3196 ; term:
3197 Paragraph text
3198 !! html
3199 <dl><dt> term</dt>
3200 <dd></dd></dl>
3201 <p>Paragraph text
3202 </p>
3203 !! end
3205 !! test
3206 Nested definition lists using html syntax
3207 !! wikitext
3208 <dl><dt>x</dt>
3209 <dd>a</dd>
3210 <dd>b</dd></dl>
3212 !! end
3214 !! test
3215 Definition Lists: No nesting: Multiple dd's
3216 !! wikitext
3220 !! html
3221 <dl><dt>x</dt>
3222 <dd>a</dd>
3223 <dd>b</dd></dl>
3225 !! end
3227 !! test
3228 Definition Lists: Indentation: Regular
3229 !! wikitext
3231 ::i2
3232 :::i3
3233 !! html
3234 <dl><dd>i1
3235 <dl><dd>i2
3236 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3238 !! end
3240 !! test
3241 Definition Lists: Indentation: Missing 1st level
3242 !! wikitext
3243 ::i2
3244 :::i3
3245 !! html
3246 <dl><dd><dl><dd>i2
3247 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3249 !! end
3251 !! test
3252 Definition Lists: Indentation: Multi-level indent
3253 !! wikitext
3254 :::i3
3255 !! html
3256 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3258 !! end
3260 !! test
3261 Definition Lists: Hacky use to indent tables
3262 !! wikitext
3263 ::{|
3264 |foo
3265 |bar
3267 this text
3268 should be left alone
3269 !! html
3270 <dl><dd><dl><dd><table>
3271 <tr>
3272 <td>foo
3273 </td>
3274 <td>bar
3275 </td></tr></table></dd></dl></dd></dl>
3276 <p>this text
3277 should be left alone
3278 </p>
3279 !! end
3281 !! test
3282 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3283 !! wikitext
3284 <!-- foo -->
3285 ::{|
3286 |foo
3287 |bar
3288 |}<!-- bar -->
3289 this text
3290 should be left alone
3291 !! html/parsoid
3292 <!-- foo -->
3293 <dl><dd><dl><dd><table><tr>
3294 <td>foo</td>
3295 <td>bar</td>
3296 </tr></table><!-- bar --></dd></dl></dd></dl>
3297 <p>this text
3298 should be left alone</p>
3299 !! end
3301 !! test
3302 Definition Lists: Hacky use to indent tables, with comment before table
3303 !! wikitext
3304 ::<!-- foo -->{|
3305 |foo
3307 !! html/parsoid
3308 <dl><dd><dl><dd><!-- foo --><table><tr>
3309 <td>foo</td>
3310 </tr></table></dd></dl></dd></dl>
3311 !! end
3313 # Bug 52473
3314 !! test
3315 Definition Lists: Hacky use to indent tables (WS-insensitive)
3316 !! options
3317 parsoid
3318 !! wikitext
3319 : {|
3321 |} 
3322 !! html
3323 <dl>
3324 <dd> <table><tr><td>a</td></tr></table> </dd>
3325 </dl>
3326 !! end
3327 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3328 ## as an empty dt item.  It also ignores all but the last ";" when followed
3329 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3330 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3331 ## ";"s.
3333 ## Ex: ";;t2 ::d2" is transformed into:
3335 ## <dl>
3336 ##   <dt>t2 </dt>
3337 ##   <dd>
3338 ##     <dl>
3339 ##       <dt></dt>
3340 ##       <dd>d2</dd>
3341 ##     </dl>
3342 ##   </dd>
3343 ## </dl>
3345 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3346 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3348 ## <dl>
3349 ##   <dt>
3350 ##     <dl>
3351 ##       <dt>t2 </dt>
3352 ##       <dd>:d2</dd>
3353 ##     </dl>
3354 ##    </dt>
3355 ## </dl>
3357 ## All Parsoid only definition list tests have this difference.
3359 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3360 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3362 !! test
3363 Table / list interaction: indented table with lists in table contents
3364 !! wikitext
3367 | a
3368 * b
3370 | c
3371 * d
3373 !! html
3374 <dl><dd><table>
3376 <tr>
3377 <td> a
3378 <ul><li> b</li></ul>
3379 </td></tr>
3380 <tr>
3381 <td> c
3382 <ul><li> d</li></ul>
3383 </td></tr></table></dd></dl>
3385 !! end
3387 !!test
3388 Table / list interaction: lists nested in tables nested in indented lists
3389 !! wikitext
3401 !! html
3402 <dl><dd><table>
3403 <tr>
3404 <td>
3405 <dl><dd>a</dd>
3406 <dd>b</dd></dl>
3407 </td>
3408 <td>
3409 <ul><li>c</li>
3410 <li>d</li></ul>
3411 </td></tr></table></dd></dl>
3412 <ul><li>e</li>
3413 <li>f</li></ul>
3415 !!end
3417 !! test
3418 Definition Lists: Nesting: Multi-level (Parsoid only)
3419 !! options
3420 parsoid
3421 !! wikitext
3422 ;t1 :d1
3423 ;;t2 ::d2
3424 ;;;t3 :::d3
3425 !! html
3426 <dl>
3427   <dt>t1 </dt>
3428   <dd>d1</dd>
3429   <dt>
3430     <dl>
3431       <dt>t2 </dt>
3432       <dd>:d2</dd>
3433       <dt>
3434         <dl>
3435           <dt>t3 </dt>
3436           <dd>::d3</dd>
3437         </dl>
3438       </dt>
3439     </dl>
3440   </dt>
3441 </dl>
3444 !! end
3447 !! test
3448 Definition Lists: Nesting: Test 2 (Parsoid only)
3449 !! options
3450 parsoid
3451 !! wikitext
3453 ::d2
3454 !! html
3455 <dl>
3456   <dt>t1</dt>
3457   <dd>
3458     <dl>
3459       <dd>d2</dd>
3460     </dl>
3461   </dd>
3462 </dl>
3464 !! end
3467 !! test
3468 Definition Lists: Nesting: Test 3 (Parsoid only)
3469 !! options
3470 parsoid
3471 !! wikitext
3472 :;t1
3473 ::::d2
3474 !! html
3475 <dl>
3476   <dd>
3477     <dl>
3478       <dt>t1</dt>
3479       <dd>
3480         <dl>
3481           <dd>
3482             <dl>
3483               <dd>d2</dd>
3484             </dl>
3485           </dd>
3486         </dl>
3487       </dd>
3488     </dl>
3489   </dd>
3490 </dl>
3492 !! end
3495 !! test
3496 Definition Lists: Nesting: Test 4
3497 !! wikitext
3498 ::;t3
3499 :::d3
3500 !! html
3501 <dl><dd><dl><dd><dl><dt>t3</dt>
3502 <dd>d3</dd></dl></dd></dl></dd></dl>
3504 !! end
3507 ## The Parsoid team believes the following three test exposes a
3508 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
3509 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3510 ## It also exposes a "misfeature" in tidy, which doesn't like
3511 ## <dl> tags with a single <dt> child; it converts the <dt> into
3512 ## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
3513 !! test
3514 Definition Lists: Mixed Lists: Test 1
3515 !! wikitext
3516 :;* foo
3517 ::* bar
3518 :; baz
3519 !! html/php
3520 <dl><dd><dl><dt><ul><li> foo</li>
3521 <li> bar</li></ul></dt></dl>
3522 <dl><dt> baz</dt></dl></dd></dl>
3524 !! html/php+tidy
3525 <dl>
3526 <dd>
3527 <dl>
3528 <dd>
3529 <ul>
3530 <li>foo</li>
3531 <li>bar</li>
3532 </ul>
3533 </dd>
3534 </dl>
3535 <dl>
3536 <dt>baz</dt>
3537 </dl>
3538 </dd>
3539 </dl>
3540 !! html/parsoid
3541 <dl>
3542 <dd><dl>
3543 <dt><ul>
3544 <li> foo
3545 </li>
3546 </ul></dt>
3547 <dd><ul>
3548 <li> bar
3549 </li>
3550 </ul></dd>
3551 <dt> baz</dt>
3552 </dl></dd>
3553 </dl>
3554 !! end
3556 !! test
3557 Definition Lists: Mixed Lists: Test 2
3558 !! wikitext
3559 *: d1
3560 *: d2
3561 !! html
3562 <ul><li><dl><dd> d1</dd>
3563 <dd> d2</dd></dl></li></ul>
3565 !! end
3568 !! test
3569 Definition Lists: Mixed Lists: Test 3
3570 !! wikitext
3571 *::: d1
3572 *::: d2
3573 !! html
3574 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3575 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3577 !! end
3580 !! test
3581 Definition Lists: Mixed Lists: Test 4
3582 !! wikitext
3583 *;d1 :d2
3584 *;d3 :d4
3585 !! html
3586 <ul><li><dl><dt>d1&#160;</dt>
3587 <dd>d2</dd>
3588 <dt>d3&#160;</dt>
3589 <dd>d4</dd></dl></li></ul>
3591 !! end
3594 !! test
3595 Definition Lists: Mixed Lists: Test 5
3596 !! wikitext
3597 *:d1
3598 *:: d2
3599 !! html
3600 <ul><li><dl><dd>d1
3601 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3603 !! end
3606 !! test
3607 Definition Lists: Mixed Lists: Test 6
3608 !! wikitext
3609 #*:d1
3610 #*::: d3
3611 !! html
3612 <ol><li><ul><li><dl><dd>d1
3613 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3615 !! end
3618 !! test
3619 Definition Lists: Mixed Lists: Test 7
3620 !! wikitext
3621 :* d1
3622 :* d2
3623 !! html
3624 <dl><dd><ul><li> d1</li>
3625 <li> d2</li></ul></dd></dl>
3627 !! end
3630 !! test
3631 Definition Lists: Mixed Lists: Test 8
3632 !! wikitext
3633 :* d1
3634 ::* d2
3635 !! html
3636 <dl><dd><ul><li> d1</li></ul>
3637 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3639 !! end
3642 !! test
3643 Definition Lists: Mixed Lists: Test 9
3644 !! wikitext
3645 *;foo :bar
3646 !! html
3647 <ul><li><dl><dt>foo&#160;</dt>
3648 <dd>bar</dd></dl></li></ul>
3650 !! end
3653 !! test
3654 Definition Lists: Mixed Lists: Test 10
3655 !! wikitext
3656 *#;foo :bar
3657 !! html
3658 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3659 <dd>bar</dd></dl></li></ol></li></ul>
3661 !! end
3663 # The Parsoid team disagrees with the PHP parser's seemingly-random
3664 # rules regarding dd/dt on the next two tests.  Parsoid is more
3665 # consistent, and recognizes the shared nesting and keeps the
3666 # still-open tags around until the nesting is complete.
3667 # (And tidy again converts <dt> to <dd> before 'bar'.)
3669 !! test
3670 Definition Lists: Mixed Lists: Test 11
3671 !! wikitext
3672 *#*#;*;;foo :bar
3673 *#*#;boo :baz
3674 !! html/php
3675 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3676 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3677 <dl><dt>boo&#160;</dt>
3678 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3680 !! html/php+tidy
3681 <ul>
3682 <li>
3683 <ol>
3684 <li>
3685 <ul>
3686 <li>
3687 <ol>
3688 <li>
3689 <dl>
3690 <dt>foo&#160;</dt>
3691 <dd>
3692 <ul>
3693 <li>
3694 <dl>
3695 <dd>
3696 <dl>
3697 <dt>bar</dt>
3698 </dl>
3699 </dd>
3700 </dl>
3701 </li>
3702 </ul>
3703 </dd>
3704 </dl>
3705 <dl>
3706 <dt>boo&#160;</dt>
3707 <dd>baz</dd>
3708 </dl>
3709 </li>
3710 </ol>
3711 </li>
3712 </ul>
3713 </li>
3714 </ol>
3715 </li>
3716 </ul>
3717 !! html/parsoid
3718 <ul>
3719 <li>
3720 <ol>
3721 <li>
3722 <ul>
3723 <li>
3724 <ol>
3725 <li>
3726 <dl>
3727 <dt>
3728 <ul>
3729 <li>
3730 <dl>
3731 <dt>
3732 <dl>
3733 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3734 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3735 </dl></dt>
3736 </dl></li>
3737 </ul></dt>
3738 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3739 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3740 </dl></li>
3741 </ol></li>
3742 </ul></li>
3743 </ol></li>
3744 </ul>
3745 !! end
3748 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3749 !! test
3750 Definition Lists: Weird Ones: Test 1
3751 !! wikitext
3752 *#;*::;; foo : bar (who uses this?)
3753 !! html/php
3754 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3755 <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>
3757 !! html/php+tidy
3758 <ul>
3759 <li>
3760 <ol>
3761 <li>
3762 <dl>
3763 <dt>foo&#160;</dt>
3764 <dd>
3765 <ul>
3766 <li>
3767 <dl>
3768 <dd>
3769 <dl>
3770 <dd>
3771 <dl>
3772 <dd>
3773 <dl>
3774 <dt>bar (who uses this?)</dt>
3775 </dl>
3776 </dd>
3777 </dl>
3778 </dd>
3779 </dl>
3780 </dd>
3781 </dl>
3782 </li>
3783 </ul>
3784 </dd>
3785 </dl>
3786 </li>
3787 </ol>
3788 </li>
3789 </ul>
3790 !! html/parsoid
3791 <ul>
3792 <li>
3793 <ol>
3794 <li>
3795 <dl>
3796 <dt>
3797 <ul>
3798 <li>
3799 <dl>
3800 <dd>
3801 <dl>
3802 <dd>
3803 <dl>
3804 <dt>
3805 <dl>
3806 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3807 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3808 </dl></dt>
3809 </dl></dd>
3810 </dl></dd>
3811 </dl></li>
3812 </ul></dt>
3813 </dl></li>
3814 </ol></li>
3815 </ul>
3816 !! end
3819 ### External links
3821 !! test
3822 External links: non-bracketed
3823 !! wikitext
3824 Non-bracketed: http://example.com
3825 !! html
3826 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3827 </p>
3828 !! end
3830 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3831 !! test
3832 External links: numbered
3833 !! wikitext
3834 Numbered: [http://example.com]
3835 Numbered: [http://example.net]
3836 Numbered: [http://example.com]
3837 !! html/php
3838 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3839 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3840 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3841 </p>
3842 !! html/parsoid
3843 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3844 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3845 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3846 !!end
3848 !! test
3849 External links: specified text
3850 !! wikitext
3851 Specified text: [http://example.com link]
3852 !! html
3853 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3854 </p>
3855 !!end
3857 !! test
3858 External links: trail
3859 !! wikitext
3860 Linktrails should not work for external links: [http://example.com link]s
3861 !! html
3862 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3863 </p>
3864 !! end
3866 !! test
3867 External links: dollar sign in URL
3868 !! wikitext
3869 http://example.com/1$2345
3870 !! html
3871 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3872 </p>
3873 !! end
3875 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3876 !! test
3877 External links: dollar sign in URL (autonumber)
3878 !! wikitext
3879 [http://example.com/1$2345]
3880 !! html/php
3881 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3882 </p>
3883 !! html/parsoid
3884 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3885 !!end
3887 !! test
3888 External links: open square bracket forbidden in URL (bug 4377)
3889 !! options
3890 parsoid=wt2html,wt2wt,html2html
3891 !! wikitext
3892 http://example.com/1[2345
3893 !! html/php
3894 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3895 </p>
3896 !! html/parsoid
3897 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3898 !! end
3900 !! test
3901 External links: open square bracket forbidden in URL (named) (bug 4377)
3902 !! options
3903 parsoid=wt2html,html2html
3904 !! wikitext
3905 [http://example.com/1[2345]
3906 !! html/php
3907 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3908 </p>
3909 !! html/parsoid
3910 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3911 !!end
3913 # parsoid adds a space before the link name
3914 !! test
3915 External links: open square bracket forbidden in URL (named) (bug 4377)
3916 Parsoid variant.
3917 !! wikitext
3918 [http://example.com/1 [2345]
3919 !! html
3920 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3921 </p>
3922 !!end
3924 !! test
3925 External links: nowiki in URL link text (bug 6230)
3926 !! wikitext
3927 [http://example.com/ <nowiki>''example site''</nowiki>]
3928 !! html
3929 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3930 </p>
3931 !! end
3933 !! test
3934 External links: newline forbidden in text (bug 6230 regression check)
3935 !! wikitext
3936 [http://example.com/ first
3937 second]
3938 !! html
3939 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3940 second]
3941 </p>
3942 !!end
3944 !! test
3945 External links: Pipe char between url and text
3946 !! wikitext
3947 [http://example.com | link]
3948 !! html
3949 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3950 </p>
3951 !!end
3953 !! test
3954 External links: protocol-relative URL in brackets
3955 !! wikitext
3956 [//example.com/ Test]
3957 !! html
3958 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3959 </p>
3960 !! end
3962 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3963 !! test
3964 External links: protocol-relative URL in brackets without text
3965 !! wikitext
3966 [//example.com]
3967 !! html/php
3968 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3969 </p>
3970 !! html/parsoid
3971 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3972 !! end
3974 !! test
3975 External links: protocol-relative URL in free text is left alone
3976 !! wikitext
3977 //example.com/Foo
3978 !! html
3979 <p>//example.com/Foo
3980 </p>
3981 !!end
3983 !! test
3984 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3985 !! wikitext
3986 foo//example.com/Foo
3987 !! html
3988 <p>foo//example.com/Foo
3989 </p>
3990 !! end
3992 !! test
3993 External links: with no contents
3994 !! wikitext
3995 [http://en.wikipedia.org/wiki/Foo]
3997 [[wikipedia:Foo|Bar]]
3999 [[wikipedia:Foo|<span>Bar</span>]]
4000 !! html/php
4001 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4002 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4003 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4004 </p>
4005 !! html/parsoid
4006 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4007 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
4008 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
4009 !! end
4011 !! test
4012 External image
4013 !! wikitext
4014 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4015 !! html
4016 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4017 </p>
4018 !! end
4020 !! test
4021 External image from https
4022 !! wikitext
4023 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4024 !! html
4025 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4026 </p>
4027 !! end
4029 !! test
4030 External image (when not allowed)
4031 !! options
4032 wgAllowExternalImages=0
4033 !! wikitext
4034 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4035 !! html
4036 <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>
4037 </p>
4038 !! end
4040 !! test
4041 Link to non-http image, no img tag
4042 !! wikitext
4043 Link to non-http image, no img tag: ftp://example.com/test.jpg
4044 !! html
4045 <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>
4046 </p>
4047 !! end
4049 !! test
4050 External links: terminating separator
4051 !! wikitext
4052 Terminating separator: http://example.com/thing,
4053 !! html
4054 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4055 </p>
4056 !! end
4058 !! test
4059 External links: intervening separator
4060 !! wikitext
4061 Intervening separator: http://example.com/1,2,3
4062 !! html
4063 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4064 </p>
4065 !! end
4067 !! test
4068 External links: old bug with URL in query
4069 !! wikitext
4070 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4071 !! html
4072 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4073 </p>
4074 !! end
4076 !! test
4077 External links: old URL-in-URL bug, mixed protocols
4078 !! wikitext
4079 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4080 !! html
4081 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4082 </p>
4083 !!end
4085 !! test
4086 External links: URL in text
4087 !! wikitext
4088 URL in text: [http://example.com http://example.com]
4089 !! html
4090 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4091 </p>
4092 !! end
4094 !! test
4095 External links: Clickable images
4096 !! wikitext
4097 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4098 !! html
4099 <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>
4100 </p>
4101 !!end
4103 !! test
4104 External links: raw ampersand
4105 !! wikitext
4106 Old &amp; use: http://x&y
4107 !! html
4108 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4109 </p>
4110 !! end
4112 !! test
4113 External links: encoded ampersand
4114 !! wikitext
4115 Old &amp; use: http://x&amp;y
4116 !! html/php
4117 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4118 </p>
4119 !! html/parsoid
4120 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4121 !! end
4123 !! test
4124 External links: encoded equals (bug 6102)
4125 !! wikitext
4126 http://example.com/?foo&#61;bar
4127 !! html/php
4128 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4129 </p>
4130 !! html/parsoid
4131 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4132 !! end
4135 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4136 ## does it number them.  As discussed in bug 53505, we can identify
4137 ## autonumbered links via CSS.
4140 !! test
4141 External links: [raw ampersand]
4142 !! wikitext
4143 Old &amp; use: [http://x&y]
4144 !! html/php
4145 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4146 </p>
4147 !! html/parsoid
4148 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4149 !! end
4151 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4152 # mode will return the [raw ampersand] wikitext
4153 !! test
4154 External links: [encoded ampersand]
4155 !! options
4156 parsoid=wt2html,wt2wt,html2html
4157 !! wikitext
4158 Old &amp; use: [http://x&amp;y]
4159 !! html/php
4160 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4161 </p>
4162 !! html/parsoid
4163 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4164 !! end
4166 !! test
4167 External links: [raw equals]
4168 !! wikitext
4169 [http://example.com/?foo=bar]
4170 !! html/php
4171 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4172 </p>
4173 !! html/parsoid
4174 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4175 !! end
4177 # note that parsoid html is identical to [raw equals] case; so html2wt
4178 # mode will return the [raw equals] wikitext
4179 !! test
4180 External links: [encoded equals] (bug 6102)
4181 !! options
4182 parsoid=wt2html,wt2wt,html2html
4183 !! wikitext
4184 [http://example.com/?foo&#61;bar]
4185 !! html/php
4186 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4187 </p>
4188 !! html/parsoid
4189 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4190 !! end
4192 # xxx parsoid strips the IDN character, so the round-trip tests will
4193 #     obviously fail and are disabled. --cscott
4194 !! test
4195 External links: [IDN ignored character reference in hostname; strip it right off]
4196 !! options
4197 parsoid=wt2html,wt2wt,html2html
4198 !! wikitext
4199 [http://e&zwnj;xample.com/]
4200 !! html/php
4201 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4205 !! end
4207 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4208 # Where an external link could easily circumvent the sanitization of the text of
4209 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4210 # test demands a higher standard. That's a bit strange.
4212 # Example:
4214 # http://e‌xample.com -> [http://example.com|http://example.com]
4215 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4217 # The first example is sanitized, but the second is not. Any security benefits
4218 # from this production are trivial to circumvent. Either remove this test and
4219 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4220 # the test accordingly.
4222 # All our love,
4223 # The Parsoid team.
4224 # xxx parsoid strips the IDN character, so the round-trip tests will
4225 #     obviously fail and are disabled. --cscott
4226 !! test
4227 External links: IDN ignored character reference in hostname; strip it right off
4228 !! options
4229 parsoid=wt2html,html2html
4230 !! wikitext
4231 http://e&zwnj;xample.com/
4232 !! html/php
4233 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4234 </p>
4235 !! html/parsoid
4236 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4237 !! end
4239 !! test
4240 External links: www.jpeg.org (bug 554)
4241 !! wikitext
4242 http://www.jpeg.org
4243 !! html
4244 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4245 </p>
4246 !! end
4248 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4249 !! test
4250 External links: URL within URL (original bug 2)
4251 !! wikitext
4252 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4253 !! html/php
4254 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4255 </p>
4256 !! html/parsoid
4257 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4258 !! end
4260 !! test
4261 BUG 361: URL inside bracketed URL
4262 !! wikitext
4263 [http://www.example.com/foo http://www.example.com/bar]
4264 !! html
4265 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4266 </p>
4267 !! end
4269 !! test
4270 BUG 361: URL within URL, not bracketed
4271 !! wikitext
4272 http://www.example.com/foo?=http://www.example.com/bar
4273 !! html
4274 <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>
4275 </p>
4276 !! end
4278 !! test
4279 BUG 289: ">"-token in URL-tail
4280 !! wikitext
4281 http://www.example.com/<hello>
4282 !! html
4283 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4284 </p>
4285 !!end
4287 !! test
4288 BUG 289: literal ">"-token in URL-tail
4289 !! wikitext
4290 http://www.example.com/<b>html</b>
4291 !! html
4292 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4293 </p>
4294 !!end
4296 !! test
4297 BUG 289: ">"-token in bracketed URL
4298 !! wikitext
4299 [http://www.example.com/<hello> stuff]
4300 !! html
4301 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4302 </p>
4303 !!end
4305 !! test
4306 BUG 289: literal ">"-token in bracketed URL
4307 !! wikitext
4308 [http://www.example.com/<b>html</b> stuff]
4309 !! html
4310 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4311 </p>
4312 !!end
4314 !! test
4315 BUG 289: literal double quote at end of URL
4316 !! wikitext
4317 http://www.example.com/"hello"
4318 !! html
4319 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4320 </p>
4321 !!end
4323 !! test
4324 BUG 289: literal double quote in bracketed URL
4325 !! wikitext
4326 [http://www.example.com/"hello" stuff]
4327 !! html
4328 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4329 </p>
4330 !!end
4332 !! test
4333 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4334 !! wikitext
4335 [http://www.example.com  test]
4336 !! html
4337 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4338 </p>
4339 !! end
4341 !! test
4342 External links: link text with spaces
4343 !! wikitext
4344 [http://www.example.com a b c]
4345 [http://www.example.com ''a'' ''b'']
4346 !! html
4347 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4348 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4349 </p>
4350 !! end
4352 !! test
4353 External links: wiki links within external link (Bug 3695)
4354 !! wikitext
4355 [http://example.com [[wikilink]] embedded in ext link]
4356 !! html/php
4357 <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>
4358 </p>
4359 !! html/parsoid
4360 <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>
4361 !! end
4363 !! test
4364 BUG 787: Links with one slash after the url protocol are invalid
4365 !! wikitext
4366 http:/example.com
4368 [http:/example.com title]
4369 !! html
4370 <p>http:/example.com
4371 </p><p>[http:/example.com title]
4372 </p>
4373 !! end
4375 !! test
4376 Bracketed external links with template-generated invalid target
4377 !! wikitext
4378 [{{echo|http:/example.com}} title]
4379 !! html
4380 <p>[http:/example.com title]
4381 </p>
4382 !! end
4384 !! test
4385 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4386 !! wikitext
4387 ''[http://example.com text'']
4388 [http://example.com '''text]'''
4389 ''Something [http://example.com in italic'']
4390 ''Something [http://example.com mixed''''', even bold]'''
4391 '''''Now [http://example.com both''''']
4392 !! html
4393 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4394 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4395 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4396 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4397 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4398 </p>
4399 !! end
4402 !! test
4403 Bug 4781: %26 in URL
4404 !! wikitext
4405 http://www.example.com/?title=AT%26T
4406 !! html/php
4407 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4408 </p>
4409 !! html/parsoid
4410 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4411 !! end
4413 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4414 # % is actually legal in HTML5. Any change in output would need testing though.
4415 !! test
4416 Bug 4781, 5267: %25 in URL
4417 !! wikitext
4418 http://www.example.com/?title=100%25_Bran
4419 !! html/php
4420 <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>
4421 </p>
4422 !! html/parsoid
4423 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4424 !! end
4426 !! test
4427 Bug 4781, 5267: %28, %29 in URL
4428 !! wikitext
4429 http://www.example.com/?title=Ben-Hur_%281959_film%29
4430 !! html/php
4431 <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>
4432 </p>
4433 !! html/parsoid
4434 <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>
4435 !! end
4438 !! test
4439 Bug 4781: %26 in autonumber URL
4440 !! wikitext
4441 [http://www.example.com/?title=AT%26T]
4442 !! html/php
4443 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4444 </p>
4445 !! html/parsoid
4446 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4447 !! end
4449 !! test
4450 Bug 4781, 5267: %26 in autonumber URL
4451 !! wikitext
4452 [http://www.example.com/?title=100%25_Bran]
4453 !! html/php
4454 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4455 </p>
4456 !! html/parsoid
4457 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4458 !! end
4460 !! test
4461 Bug 4781, 5267: %28, %29 in autonumber URL
4462 !! wikitext
4463 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4464 !! html/php
4465 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4466 </p>
4467 !! html/parsoid
4468 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4469 !! end
4472 !! test
4473 Bug 4781: %26 in bracketed URL
4474 !! wikitext
4475 [http://www.example.com/?title=AT%26T link]
4476 !! html/php
4477 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4478 </p>
4479 !! html/parsoid
4480 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4481 !! end
4483 !! test
4484 Bug 4781, 5267: %25 in bracketed URL
4485 !! wikitext
4486 [http://www.example.com/?title=100%25_Bran link]
4487 !! html
4488 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4489 </p>
4490 !! end
4492 !! test
4493 Bug 4781, 5267: %28, %29 in bracketed URL
4494 !! wikitext
4495 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4496 !! html/php
4497 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4498 </p>
4499 !! html/parsoid
4500 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4501 !! end
4503 !! test
4504 External link containing a period in the anchor. (bug 63947)
4505 !! wikitext
4506 [//foo.org/bar#baz. bang]
4508 [//foo.org/bar. bang]
4509 !! html/php
4510 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4511 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4512 </p>
4513 !! html/parsoid
4514 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4515 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4516 !! end
4518 !! test
4519 External link containing a single quote. (bug 63947)
4520 !! wikitext
4521 [//foo.org/bar'baz]
4523 [//foo.org/bar'baz bang]
4524 !! html/php
4525 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4526 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4530 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4531 !! end
4534 !! test
4535 External link containing a period in the anchor. (bug 63947)
4536 !! wikitext
4537 [//foo.org/bar#baz. bang]
4539 [//foo.org/bar. bang]
4540 !! html/php
4541 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4542 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4543 </p>
4544 !! html/parsoid
4545 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4546 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4547 !! end
4549 !! test
4550 External link containing a single quote. (bug 63947)
4551 !! wikitext
4552 [//foo.org/bar'baz]
4554 [//foo.org/bar'baz bang]
4555 !! html/php
4556 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4557 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4558 </p>
4559 !! html/parsoid
4560 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4561 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4562 !! end
4565 !! test
4566 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4567 !! wikitext
4568 Some [http://example.com/ pretty ''italics'' and stuff]!
4569 !! html
4570 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4571 </p>
4572 !! end
4574 !! test
4575 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4576 !! wikitext
4577 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4578 !! html
4579 <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>
4580 </p>
4581 !! end
4583 !! test
4584 External link containing double-single-quotes with no space separating the url from text in italics
4585 !! wikitext
4586 [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]].]
4587 !! html/php
4588 <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>
4589 </p>
4590 !! html/php+tidy
4591 <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>
4592 !! html/parsoid
4593 <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>
4594 !! end
4596 !! test
4597 External link with comments in link text
4598 !! wikitext
4599 [http://www.google.com Google <!-- comment -->]
4600 !! html
4601 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4602 </p>
4603 !! end
4605 !! test
4606 URL-encoding in URL functions (single parameter)
4607 !! wikitext
4608 {{localurl:Some page|amp=&}}
4609 !! html
4610 <p>/index.php?title=Some_page&amp;amp=&amp;
4611 </p>
4612 !! end
4614 !! test
4615 URL-encoding in URL functions (multiple parameters)
4616 !! wikitext
4617 {{localurl:Some page|q=?&amp=&}}
4618 !! html
4619 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4620 </p>
4621 !! end
4623 !! test
4624 Brackets in urls
4625 !! wikitext
4626 http://example.com/index.php?foozoid%5B%5D=bar
4628 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4629 !! html/php
4630 <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>
4631 </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>
4632 </p>
4633 !! html/parsoid
4634 <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>
4636 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4637 !! end
4639 !! test
4640 IPv6 urls (bug 21261)
4641 !! options
4642 disabled
4643 !! wikitext
4644 http://[2404:130:0:1000::187:2]/index.php
4645 !! html
4646 <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>
4647 </p>
4648 !! end
4650 !! test
4651 Non-extlinks in brackets
4652 !! wikitext
4653 [foo]
4654 [foo bar]
4655 [foo ''bar'']
4656 [fool's] errand
4657 [fool's errand]
4658 [{{echo|foo}}]
4659 [{{echo|foo}} bar]
4660 [{{echo|foo}} ''bar'']
4661 [{{echo|foo}}l's] errand
4662 [{{echo|foo}}l's errand]
4663 [url={{echo|foo}}]
4664 [url=http://example.com]
4665 !! html
4666 <p>[foo]
4667 [foo bar]
4668 [foo <i>bar</i>]
4669 [fool's] errand
4670 [fool's errand]
4671 [foo]
4672 [foo bar]
4673 [foo <i>bar</i>]
4674 [fool's] errand
4675 [fool's errand]
4676 [url=foo]
4677 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4678 </p>
4679 !! end
4681 !! test
4682 Percent encoding in external links
4683 !! wikitext
4684 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4685 !! html/php
4686 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4687 </p>
4688 !! html/parsoid
4689 <p><a rel="mw:ExtLink"
4690 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4691 !! end
4693 !! test
4694 Use url link syntax for links where the content is equal the link target
4695 !! wikitext
4696 http://example.com
4697 !! html/php
4698 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4699 </p>
4700 !! html/parsoid
4701 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4702 !! end
4704 !! test
4705 Parenthesis in external links, especially URL links
4706 !! wikitext
4707 http://example.com)
4709 http://example.com/test)
4711 http://example.com/(test)
4713 http://example.com/((test)
4715 (http://example.com/(test))
4717 (http://example.com/(test)))))
4719 http://example.com/a)b
4721 [http://example.com) foo]
4722 !! html/php
4723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4724 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4725 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4726 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4727 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4728 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4729 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4730 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4734 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4735 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4736 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4737 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4738 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4739 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4740 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4741 !! end
4743 !! test
4744 Parenthesis in external links, w/ transclusion or comment
4745 !! wikitext
4746 (http://example.com/{{echo|hi}})
4748 (http://example.com<!-- hi -->)
4749 !! html/php
4750 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4751 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4752 </p>
4753 !! html/parsoid
4754 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">hi&lt;/span>"}]]}' 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}}"}}'>http://example.com/hi</a>)</p>
4756 <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>
4757 !! end
4759 !! test
4760 Replace invalid link targets when serializing
4761 !! options
4762 parsoid=html2wt
4763 !! html
4764 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4765 !! wikitext
4766 [[MediaWiki:Badtitletext|Manual]]
4767 !! end
4770 ### Quotes
4773 !! test
4774 Quotes
4775 !! wikitext
4776 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4778 Normal text. '''''Bold italic text.''''' Normal text.
4779 !! html
4780 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4781 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4782 </p>
4783 !! end
4786 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4787 # parser strips. The wikitext contains just the first half of the bold
4788 # quote pair.
4789 !! test
4790 Unclosed and unmatched quotes
4791 !! wikitext
4792 '''''Bold italic text '''with bold deactivated''' in between.'''''
4794 '''''Bold italic text ''with italic deactivated'' in between.'''''
4796 '''Bold text..
4798 ..spanning two paragraphs (should not work).'''
4800 '''Bold tag left open
4802 ''Italic tag left open
4804 Normal text.
4806 <!-- Unmatching number of opening, closing tags: -->
4807 '''This year''''s election ''should'' beat '''last year''''s.
4809 ''Tom'''s car is bigger than ''Susan'''s.
4811 Plain ''italic'''s plain
4812 !! html/php
4813 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4814 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4815 </p><p><b>Bold text..</b>
4816 </p><p>..spanning two paragraphs (should not work).
4817 </p><p><b>Bold tag left open</b>
4818 </p><p><i>Italic tag left open</i>
4819 </p><p>Normal text.
4820 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4821 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4822 </p><p>Plain <i>italic'</i>s plain
4823 </p>
4824 !! html/parsoid
4825 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4826 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4827 </p><p><b>Bold text..</b>
4828 </p><p>..spanning two paragraphs (should not work).<b></b>
4829 </p><p><b>Bold tag left open</b>
4830 </p><p><i>Italic tag left open</i>
4831 </p><p>Normal text.
4832 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4834 </p><p>Plain <i>italic'</i>s plain
4835 </p>
4836 !! end
4839 ### Tables
4841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4845 # is the bare minimum required by the spec, see:
4846 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4847 # Parsoid team replies: empty table tags are legal in HTML5
4848 !! test
4849 A table with no data.
4850 !! options
4851 parsoid=wt2html
4852 !! wikitext
4853 {||}
4854 !! html/php
4856 !! html/parsoid
4857 <table></table>
4859 !! end
4861 !! test
4862 A table with stray table end tags on start tag line (wt2html)
4863 !! options
4864 parsoid=wt2html
4865 !! wikitext
4866 {|style="color: red;"|}
4868 {|style="color: red;" |}
4869 |foo
4872 {|style="color: red;"|} id="foo"
4873 |foo
4876 {|style="color: red;" |} id="foo"
4877 |foo
4879 !! html
4880 <table style="color: red;"></table>
4882 <table style="color: red;">
4883 <tbody><tr>
4884 <td>foo</td>
4885 </tr></tbody>
4886 </table>
4888 <table style="color: red;" id="foo">
4889 <tbody><tr>
4890 <td>foo</td>
4891 </tr></tbody>
4892 </table>
4894 <table style="color: red;" id="foo">
4895 <tbody><tr>
4896 <td>foo</td>
4897 </tr></tbody>
4898 </table>
4900 !! end
4902 !! test
4903 A table with no data (take 2)
4904 !! wikitext
4907 !! html/parsoid
4908 <table></table>
4909 !! end
4911 # A table with nothing but a caption is invalid XHTML, we might want to render
4912 # this as <p>caption</p>
4913 # Parsoid team replies: table with only a caption is legal in HTML5
4914 !! test
4915 A table with nothing but a caption
4916 !! wikitext
4918 |+ caption
4920 !! html/php
4921 <table>
4922 <caption> caption
4923 </caption><tr><td></td></tr></table>
4925 !! html/parsoid
4926 <table><caption> caption</caption></table>
4927 !! end
4929 !! test
4930 A table with caption with default-spaced attributes and a table row
4931 !! wikitext
4933 |+ style="color: red;" | caption1
4935 | foo
4937 !! html
4938 <table>
4939 <caption style="color: red;"> caption1
4940 </caption>
4941 <tr>
4942 <td> foo
4943 </td></tr></table>
4945 !! end
4947 !! test
4948 A table with captions with non-default spaced attributes and a table row
4949 !! wikitext
4951 |+style="color: red;"|caption2
4952 |+ style="color: red;"| caption3
4954 | foo
4956 !! html
4957 <table>
4958 <caption style="color: red;">caption2
4959 </caption>
4960 <caption style="color: red;"> caption3
4961 </caption>
4962 <tr>
4963 <td> foo
4964 </td></tr></table>
4966 !! end
4968 !! test
4969 Table td-cell syntax variations
4970 !! wikitext
4972 | foo bar foo | baz
4973 | foo bar foo || baz
4974 | style='color:red;' | baz
4975 | style='color:red;' || baz
4977 !! html
4978 <table>
4979 <tr>
4980 <td> baz
4981 </td>
4982 <td> foo bar foo </td>
4983 <td> baz
4984 </td>
4985 <td style="color:red;"> baz
4986 </td>
4987 <td> style='color:red;' </td>
4988 <td> baz
4989 </td></tr></table>
4991 !! end
4993 !! test
4994 Simple table
4995 !! wikitext
4997 | 1 || 2
4999 | 3 || 4
5001 !! html
5002 <table>
5003 <tr>
5004 <td> 1 </td>
5005 <td> 2
5006 </td></tr>
5007 <tr>
5008 <td> 3 </td>
5009 <td> 4
5010 </td></tr></table>
5012 !! end
5014 !! test
5015 Simple table but with multiple dashes for row wikitext
5016 !! wikitext
5018 | foo
5019 |-----
5020 | bar
5022 !! html
5023 <table>
5024 <tr>
5025 <td> foo
5026 </td></tr>
5027 <tr>
5028 <td> bar
5029 </td></tr></table>
5031 !! end
5032 !! test
5033 Multiplication table
5034 !! wikitext
5035 {| border="1" cellpadding="2"
5036 |+Multiplication table
5038 ! &times; !! 1 !! 2 !! 3
5040 ! 1
5041 | 1 || 2 || 3
5043 ! 2
5044 | 2 || 4 || 6
5046 ! 3
5047 | 3 || 6 || 9
5049 ! 4
5050 | 4 || 8 || 12
5052 ! 5
5053 | 5 || 10 || 15
5055 !! html
5056 <table border="1" cellpadding="2">
5057 <caption>Multiplication table
5058 </caption>
5059 <tr>
5060 <th> &#215; </th>
5061 <th> 1 </th>
5062 <th> 2 </th>
5063 <th> 3
5064 </th></tr>
5065 <tr>
5066 <th> 1
5067 </th>
5068 <td> 1 </td>
5069 <td> 2 </td>
5070 <td> 3
5071 </td></tr>
5072 <tr>
5073 <th> 2
5074 </th>
5075 <td> 2 </td>
5076 <td> 4 </td>
5077 <td> 6
5078 </td></tr>
5079 <tr>
5080 <th> 3
5081 </th>
5082 <td> 3 </td>
5083 <td> 6 </td>
5084 <td> 9
5085 </td></tr>
5086 <tr>
5087 <th> 4
5088 </th>
5089 <td> 4 </td>
5090 <td> 8 </td>
5091 <td> 12
5092 </td></tr>
5093 <tr>
5094 <th> 5
5095 </th>
5096 <td> 5 </td>
5097 <td> 10 </td>
5098 <td> 15
5099 </td></tr></table>
5101 !! end
5103 !! test
5104 Accept "||" in table headings
5105 !! wikitext
5107 !h1 || h2
5109 !! html
5110 <table>
5111 <tr>
5112 <th>h1 </th>
5113 <th> h2
5114 </th></tr></table>
5116 !! end
5118 !! test
5119 Accept "!!" in table data
5120 !! wikitext
5122 | Foo!! ||
5124 !! html
5125 <table>
5126 <tr>
5127 <td> Foo!! </td>
5128 <td>
5129 </td></tr></table>
5131 !! html/parsoid
5132 <table data-parsoid='{}'>
5133 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5134 </tbody></table>
5135 !! end
5137 !! test
5138 Accept "||" in indented table headings
5139 !! wikitext
5141 !h1 || h2
5143 !! html
5144 <dl><dd><table>
5145 <tr>
5146 <th>h1 </th>
5147 <th> h2
5148 </th></tr></table></dd></dl>
5150 !! end
5152 !! test
5153 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5154 !! wikitext
5156 !| h1
5157 || a
5159 !! html
5160 <table>
5161 <tr>
5162 <th> h1
5163 </th>
5164 <td> a
5165 </td></tr></table>
5167 !! end
5169 !!test
5170 Accept "| !" at start of line in tables (ignore !-attribute)
5171 !! wikitext
5174 | !style="color:red" | bar
5176 !! html
5177 <table>
5179 <tr>
5180 <td> bar
5181 </td></tr></table>
5183 !!end
5185 !!test
5186 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 +/- 
5187 !! wikitext
5190 |style='color:red;'|+1
5191 |style='color:blue;'|-1
5193 | 1 || 2 || 3
5194 | 1 ||+2 ||-3
5196 | +1
5197 | -1
5199 !! html
5200 <table>
5202 <tr>
5203 <td style="color:red;">+1
5204 </td>
5205 <td style="color:blue;">-1
5206 </td></tr>
5207 <tr>
5208 <td> 1 </td>
5209 <td> 2 </td>
5210 <td> 3
5211 </td>
5212 <td> 1 </td>
5213 <td>+2 </td>
5214 <td>-3
5215 </td></tr>
5216 <tr>
5217 <td> +1
5218 </td>
5219 <td> -1
5220 </td></tr></table>
5222 !!end
5224 !! test
5225 Table rowspan
5226 !! wikitext
5227 {| border=1
5228 | Cell 1, row 1
5229 |rowspan=2| Cell 2, row 1 (and 2)
5230 | Cell 3, row 1
5232 | Cell 1, row 2
5233 | Cell 3, row 2
5235 !! html
5236 <table border="1">
5237 <tr>
5238 <td> Cell 1, row 1
5239 </td>
5240 <td rowspan="2"> Cell 2, row 1 (and 2)
5241 </td>
5242 <td> Cell 3, row 1
5243 </td></tr>
5244 <tr>
5245 <td> Cell 1, row 2
5246 </td>
5247 <td> Cell 3, row 2
5248 </td></tr></table>
5250 !! end
5252 !! test
5253 Nested table
5254 !! wikitext
5255 {| border=1
5256 | &alpha;
5258 {| bgcolor=#ABCDEF border=2
5259 |nested
5261 |table
5263 |the original table again
5265 !! html
5266 <table border="1">
5267 <tr>
5268 <td> &#945;
5269 </td>
5270 <td>
5271 <table bgcolor="#ABCDEF" border="2">
5272 <tr>
5273 <td>nested
5274 </td></tr>
5275 <tr>
5276 <td>table
5277 </td></tr></table>
5278 </td>
5279 <td>the original table again
5280 </td></tr></table>
5282 !! end
5284 !! test
5285 Invalid attributes in table cell (bug 1830)
5286 !! wikitext
5288 |Cell:|broken
5290 !! html
5291 <table>
5292 <tr>
5293 <td>broken
5294 </td></tr></table>
5296 !! end
5299 # The "|}" to close the table is missing from the input, so parsoid's
5300 # *2wt modes will fail.
5301 !! test
5302 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5303 !! options
5304 parsoid=wt2html,html2html
5305 !! wikitext
5307 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5308 !! html/php
5309 <table>
5310 <tr>
5311 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5312 <td>]" onmouseover="alert(document.cookie)"&gt;test
5313 </td>
5314 </tr>
5315 </table>
5317 !! html/parsoid
5318 <table><tbody>
5319 <tr>
5320 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5321 !! end
5324 !! test
5325 Indented table markup mixed with indented pre content (proposed in bug 6200)
5326 !! wikitext
5327  <table>
5328  <tr>
5329  <td>
5330  Text that should be rendered preformatted
5331  </td>
5332  </tr>
5333  </table>
5334 !! html
5335  <table>
5336  <tr>
5337  <td>
5338 <pre>Text that should be rendered preformatted
5339 </pre>
5340  </td>
5341  </tr>
5342  </table>
5344 !! end
5346 !! test
5347 Template-generated table cell attributes and cell content
5348 !! wikitext
5350 |{{table_attribs}}
5351 | {{table_attribs}}
5353 !! html
5354 <table>
5355 <tr>
5356 <td style="color: red"> Foo
5357 </td>
5358 <td style="color: red"> Foo
5359 </td></tr></table>
5361 !! end
5363 !! test
5364 Template-generated table cell attributes and cell content (2)
5365 !! wikitext
5367 |align=center {{table_attribs}}
5369 !! html
5370 <table>
5371 <tr>
5372 <td align="center" style="color: red"> Foo
5373 </td></tr></table>
5375 !! end
5377 !! test
5378 Template-generated table cell attributes and cell content (3)
5379 !! wikitext
5381 |align=center {{table_cells}}
5383 !! html
5384 <table>
5385 <tr>
5386 <td align="center" style="color: red"> Foo </td>
5387 <td> Bar </td>
5388 <td> Baz
5389 </td></tr></table>
5391 !! end
5393 !! test
5394 Table with row followed by newlines and table heading
5395 !! wikitext
5399 ! foo
5401 !! html
5402 <table>
5405 <tr>
5406 <th> foo
5407 </th></tr></table>
5409 !! end
5411 !! test
5412 Table with empty line following the start tag
5413 !! wikitext
5417 | foo
5419 !! html
5420 <table>
5423 <tr>
5424 <td> foo
5425 </td></tr></table>
5427 !! end
5429 # FIXME: Preserve the attribute properly (with an empty string as value) in
5430 # the PHP parser. Parsoid implements the behavior below.
5431 !! test
5432 Table attributes with empty value
5433 !! wikitext
5435 | style=| hello
5437 !! html/parsoid
5438 <table>
5439 <tbody>
5440 <tr>
5441 <td style=""> hello
5442 </td></tr></tbody></table>
5444 !! end
5446 !! test
5447 Wikitext table with a lot of comments
5448 !! wikitext
5450 <!-- c0 -->
5451 | foo
5452 <!-- c1 -->
5453 |- <!-- c2 -->
5454 <!-- c3 -->
5455 |<!-- c4 -->
5456 <!-- c5 -->
5458 !! html
5459 <table>
5460 <tr>
5461 <td> foo
5462 </td></tr>
5463 <tr>
5464 <td>
5465 </td></tr></table>
5467 !! end
5469 !! test
5470 Wikitext table with double-line table cell
5471 !! wikitext
5476 !! html
5477 <table>
5478 <tr>
5479 <td>a
5480 <p>b
5481 </p>
5482 </td></tr></table>
5484 !! end
5486 !! test
5487 Table cell with a single comment
5488 !! wikitext
5490 | <!-- c1 -->
5491 | a
5493 !! html
5494 <table>
5495 <tr>
5496 <td>
5497 </td>
5498 <td> a
5499 </td></tr></table>
5501 !! end
5503 !! test
5504 Table-cell after a comment-only-empty-line
5505 !! wikitext
5508 <!--c1-->
5509 <!--c2-->| b
5511 !! html
5512 <table>
5513 <tr>
5514 <td>a
5515 </td>
5516 <td> b
5517 </td></tr></table>
5519 !! html/parsoid
5520 <table>
5521 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5522 <!--c1-->
5523 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5524 </tbody></table>
5526 !! end
5528 !! test
5529 Build table with {{!}}
5530 !! wikitext
5531 {{{!}} class="wikitable"
5532 ! header
5533 ! second header
5534 {{!}}- style="color:red;"
5535 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5536 {{!}}}
5537 !! html
5538 <table class="wikitable">
5539 <tr>
5540 <th> header
5541 </th>
5542 <th> second header
5543 </th></tr>
5544 <tr style="color:red;">
5545 <td> data </td>
5546 <td style="color:red;"> second data
5547 </td></tr></table>
5549 !! end
5551 # The expected HTML structure in this test is debatable. The PHP parser does
5552 # not parse this kind of table at all. The main focus for Parsoid is on
5553 # round-tripping, so this output is ok for now. TODO: revisit!
5554 !! test
5555 Wikitext table with html-syntax row
5556 !! wikitext
5559 <td>foo</td>
5561 !! html/parsoid
5562 <table>
5563 <tbody>
5564 <tr>
5565 <td>foo</td></tr></tbody></table>
5566 !! end
5568 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5569 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5570 ## PHP parser, which tidy then compounds by fostering the content
5571 ## entirely out of the table.  Parsoid recognizes the table context
5572 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
5573 ## depends on PHP's treatment of broken table markup!
5574 !! test
5575 Implicit <td> after a |-
5576 !! options
5577 parsoid=wt2html,wt2wt
5578 !! wikitext
5583 !! html/php
5584 <table>
5587 </table>
5589 !! html/php+tidy
5590 <p>a</p>
5591 !! html/parsoid
5592 <table>
5593 <tr><td>a</td></tr>
5594 </table>
5595 !! end
5597 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5598 !! test
5599 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5600 !! options
5601 parsoid=wt2html,wt2wt
5602 !! wikitext
5610 !! html/php
5611 <table>
5613 <tr>
5614 <td>
5615 <pre>a
5616 </pre>
5617 </td></tr>
5619 </table>
5621 !! html/php+tidy
5622 <p>b</p>
5623 <table>
5624 <tr>
5625 <td>
5626 <pre>
5628 </pre></td>
5629 </tr>
5630 </table>
5631 !! html/parsoid
5632 <table>
5633 <tbody>
5634 <tr><td><pre>a</pre></td></tr>
5635 <tr><td> b</td></tr>
5636 </tbody>
5637 </table>
5638 !! end
5640 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5641 !! test
5642 Lists should be recognized in an implicit <td> context
5643 !! options
5644 parsoid=wt2html,wt2wt
5645 !! wikitext
5650 !! html/php
5651 <table>
5653 <ul><li>a</li></ul>
5654 </table>
5656 !! html/php+tidy
5657 <ul>
5658 <li>a</li>
5659 </ul>
5660 !! html/parsoid
5661 <table>
5662 <tr>
5663 <td><ul>
5664 <li>a</li>
5665 </ul></td>
5666 </tr>
5667 </table>
5668 !! end
5670 !! test
5671 Parsoid: Round-trip tables directly followed by content (bug 51219)
5672 !! options
5673 parsoid=wt2html,wt2wt
5674 !! wikitext
5676 |foo
5677 |} bar
5680 |baz
5681 |}<b>quux</b>
5682 !! html
5683 <table><tbody>
5684 <tr>
5685 <td>foo</td></tr></tbody></table> bar
5686 <table>
5687 <tbody>
5688 <tr>
5689 <td>baz</td></tr></tbody></table><b>quux</b>
5690 !! end
5692 !! test
5693 Parsoid: Default to a newline after tables in new content (bug 51219)
5694 !! options
5695 parsoid=html2wt
5696 !! wikitext
5698 |foo
5700 <nowiki> </nowiki>bar
5702 |baz
5704 '''quux'''
5705 !! html
5706 <table><tbody>
5707 <tr><td>foo</td></tr></tbody></table> bar
5708 <table><tbody>
5709 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5710 !! end
5712 !! test
5713 Parsoid: newline inducing block nodes don't suppress <nowiki>
5714 !! options
5715 parsoid=html2wt
5716 !! wikitext
5717 <nowiki> </nowiki>a
5719 = foo =
5720 !! html
5721  a<h1>foo</h1>
5722 !! end
5724 !! test
5725 Parsoid: Row-syntax table headings followed by comment & table cells
5726 !! options
5727 parsoid=wt2html,wt2wt
5728 !! wikitext
5730 ! foo || bar
5731 <!-- foo -->  || baz || quux
5733 !! html/php
5734 <table>
5735 <tr>
5736 <th> foo </th>
5737 <th> bar
5738 </th>
5739 <td> baz </td>
5740 <td> quux
5741 </td></tr></table>
5743 !! html/parsoid
5744 <table>
5745 <tbody><tr><th> foo </th><th> bar
5746 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
5747 </tbody></table>
5748 !! end
5751 # PHP throws away the (semi-broken) "foo" class here; Parsoid
5752 # preserves it.
5753 !!test
5754 Parsoid: Recover better from broken table attributes
5755 !!options
5756 parsoid=wt2html
5757 !!wikitext
5758 {| class="foo
5759 | class="bar" |
5762 !!html/php+tidy
5763 <table>
5764 <tr>
5765 <td class="bar">
5766 <p>foo</p>
5767 </td>
5768 </tr>
5769 </table>
5770 !!html/parsoid
5771 <table class="foo">
5772 <tr>
5773 <td class="bar">
5774 <p>foo</p></td></tr>
5775 </tbody></table>
5776 !!end
5778 !! test
5779 Strip unsupported table tags
5780 !! options
5781 parsoid=html2wt
5782 !! html
5783 <table>
5784 <thead>
5785 <tr>
5786 <th>Month</th>
5787 <th>Savings</th>
5788 </tr>
5789 </thead>
5790 <tbody>
5791 <tr>
5792 <td>January</td>
5793 <td>$100</td>
5794 </tr>
5795 <tr>
5796 <td>February</td>
5797 <td>$80</td>
5798 </tr>
5799 </tbody>
5800 <tfoot>
5801 <tr>
5802 <td>Sum</td>
5803 <td>$180</td>
5804 </tr>
5805 </tfoot>
5806 </table>
5807 !! wikitext
5810 !Month
5811 !Savings
5813 |January
5814 |$100
5817 |February
5818 |$80
5820 |Sum
5821 |$180
5824 !! end
5827 ### Internal links
5829 !! test
5830 Plain link, capitalized
5831 !! wikitext
5832 [[Main Page]]
5833 !! html
5834 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5835 </p>
5836 !! end
5838 !! test
5839 Plain link, uncapitalized
5840 !! wikitext
5841 [[main Page]]
5842 !! html
5843 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5844 </p>
5845 !! end
5847 !! test
5848 Piped link
5849 !! wikitext
5850 [[Main Page|The Main Page]]
5851 !! html
5852 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5853 </p>
5854 !! end
5856 !! test
5857 Piped link with comment in link text
5858 !! wikitext
5859 [[Main Page|The Main<!--front--> Page]]
5860 !! html
5861 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5862 </p>
5863 !! end
5865 !! test
5866 Piped link with multiple pipe characters in link text
5867 !! wikitext
5868 [[Main Page||The|Main|Page|]]
5869 !! html/php
5870 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5871 </p>
5872 !! html/parsoid
5873 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
5874 !! end
5876 !! test
5877 Broken link
5878 !! wikitext
5879 [[Zigzagzogzagzig]]
5880 !! html
5881 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5882 </p>
5883 !! end
5885 !! test
5886 Broken link with fragment
5887 !! wikitext
5888 [[Zigzagzogzagzig#zug]]
5889 !! html
5890 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5891 </p>
5892 !! end
5894 !! test
5895 Special page link with fragment
5896 !! wikitext
5897 [[Special:Version#anchor]]
5898 !! html
5899 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5900 </p>
5901 !! end
5903 !! test
5904 Nonexistent special page link with fragment
5905 !! wikitext
5906 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5907 !! html
5908 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5909 </p>
5910 !! end
5912 !! test
5913 Link with prefix
5914 !! wikitext
5915 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5916 !! html
5917 <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>
5918 </p>
5919 !! end
5921 !! test
5922 Link with suffix
5923 !! wikitext
5924 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5925 !! html
5926 <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>!!!
5927 </p>
5928 !! end
5930 !! article
5931 prefixed article
5932 !! text
5933 Some text
5934 !! endarticle
5936 !! test
5937 Bug 43661: Piped links with identical prefixes
5938 !! wikitext
5939 [[prefixed article|prefixed articles with spaces]]
5941 [[prefixed article|prefixed articlesaoeu]]
5943 [[Main Page|Main Page test]]
5944 !! html
5945 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5946 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5947 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5948 </p>
5949 !! end
5952 !! test
5953 Link with HTML entity in suffix / tail
5954 !! wikitext
5955 [[Main Page]]&quot;, [[Main Page]]&#97;
5956 !! html
5957 <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;
5958 </p>
5959 !! end
5961 !! test
5962 Link with 3 brackets
5963 !! wikitext
5964 [[[Main Page]]]
5965 !! html
5966 <p>[[[Main Page]]]
5967 </p>
5968 !! end
5970 !! test
5971 Link with 4 brackets
5972 !! wikitext
5973 [[[[Main Page]]]]
5974 !! html
5975 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5976 </p>
5977 !! end
5979 !! test
5980 Piped link with 3 brackets
5981 !! wikitext
5982 [[[main page|the main page]]]
5983 !! html
5984 <p>[[[main page|the main page]]]
5985 </p>
5986 !! end
5988 !! test
5989 Piped link with extlink-like text
5990 !! wikitext
5991 [[Main Page|[bar]]]
5992 [[Main Page|This is a [bar]]]
5993 !! html
5994 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5995 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5996 </p>
5997 !! end
5999 !! test
6000 Link with multiple pipes
6001 !! wikitext
6002 [[Main Page|The|Main|Page]]
6003 !! html
6004 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6005 </p>
6006 !! end
6008 # Note that parsoid does not munge anchor text; all non-space
6009 # characters are valid in HTML5 ids.
6010 !! test
6011 Anchor containing a #. (bug 63430)
6012 !! wikitext
6013 [[Main Page#And#Link]]
6014 !! html/php
6015 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6016 </p>
6017 !! html/parsoid
6018 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6019 !! end
6021 !! test
6022 Link to namespaces
6023 !! wikitext
6024 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6025 !! html
6026 <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>
6027 </p>
6028 !! end
6030 !! test
6031 Link with space in namespace
6032 !! wikitext
6033 [[User talk:Foo bar]]
6034 !! html
6035 <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>
6036 </p>
6037 !! end
6039 !! article
6040 MemoryAlpha:AlphaTest
6041 !! text
6042 This is an article in the MemoryAlpha namespace
6043 (which shadows the memoryalpha interwiki link).
6044 !! endarticle
6046 !! test
6047 Namespace takes precedence over interwiki link (bug 51680)
6048 !! wikitext
6049 [[MemoryAlpha:AlphaTest]]
6050 !! html
6051 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6052 </p>
6053 !! end
6055 # The previous test doesn't work correctly in html2*, due to not recognizing the
6056 # link as an internal one. This one checks for the correct behavior.
6057 !! test
6058 Link to namespace preferred over interwiki with correct rel attribute
6059 !! options
6060 parsoid=html2wt,html2html
6061 !! wikitext
6062 [[MemoryAlpha:AlphaTest]]
6063 !! html
6064 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6065 </p>
6066 !! end
6068 !! test
6069 Piped link to namespace
6070 !! wikitext
6071 [[Meta:Disclaimers|The disclaimers]]
6072 !! html
6073 <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>
6074 </p>
6075 !! end
6077 !! test
6078 Link containing }
6079 !! wikitext
6080 [[Usually caused by a typo (oops}]]
6081 !! html
6082 <p>[[Usually caused by a typo (oops}]]
6083 </p>
6084 !! end
6086 !! article
6087 7% Solution
6088 !! text
6089 Just a test of an article title containing a percent.
6090 !! endarticle
6092 !! test
6093 Link containing % (not as a hex sequence)
6094 !! wikitext
6095 [[7% Solution]]
6096 !! html/php
6097 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6098 </p>
6099 !! html/parsoid
6100 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6101 !! end
6103 # note that the parsoid HTML is identical to the previous test output,
6104 # so the previous test ensures that the html2wt mode will generate the
6105 # "not as a hex sequence" wikitext.
6106 !! test
6107 Link containing % as a single hex sequence interpreted to char
6108 !! options
6109 parsoid=wt2wt,wt2html,html2html
6110 !! wikitext
6111 [[7%25 Solution]]
6112 !! html/php
6113 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6114 </p>
6115 !! html/parsoid
6116 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6117 !!end
6119 !! test
6120 Link containing % as a double hex sequence interpreted to hex sequence
6121 !! wikitext
6122 [[7%2525 Solution]]
6123 !! html
6124 <p>[[7%2525 Solution]]
6125 </p>
6126 !!end
6128 # note that parsoid does not munge anchor text; all non-space
6129 # characters are valid in HTML5 anchors.
6130 !! test
6131 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6132 Example for such a section: == < ==
6133 !! wikitext
6134 [[%23%3c]][[%23%3e]]
6135 !! html/php
6136 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6137 </p>
6138 !! html/parsoid
6139 <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>
6140 !! end
6142 !! test
6143 Link containing "<#" and ">#" as a hex sequences
6144 !! wikitext
6145 [[%3c%23]][[%3e%23]]
6146 !! html
6147 <p>[[%3c%23]][[%3e%23]]
6148 </p>
6149 !! end
6151 !! test
6152 Link containing an equals sign
6153 !! wikitext
6154 [[Special:BookSources/isbn=4-00-026157-6]]
6155 !! html/php
6156 <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>
6157 </p>
6158 !! html/parsoid
6159 <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>
6160 !! end
6162 !! article
6163 Foo~bar
6164 !! text
6165 Just a test of an article title containing a tilde.
6166 !! endarticle
6168 # note that links containing signatures, like [[Foo~~~~]], are
6169 # massaged by the pre-save transform (PST) and so the tildes are never
6170 # seen by the parser.
6171 !! test
6172 Link containing a tilde
6173 !! wikitext
6174 [[Foo~bar]]
6175 !! html/php
6176 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6177 </p>
6178 !! html/parsoid
6179 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6180 !! end
6182 !! test
6183 Link containing double-single-quotes '' (bug 4598)
6184 !! wikitext
6185 [[Lista d''e paise d''o munno]]
6186 !! html/php
6187 <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>
6188 </p>
6189 !! html/parsoid
6190 <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>
6191 !! end
6193 !! test
6194 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6195 !! wikitext
6196 Some [[Link|pretty ''italics'' and stuff]]!
6197 !! html/php
6198 <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>!
6199 </p>
6200 !! html/parsoid
6201 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6202 !! end
6204 !! test
6205 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6206 !! wikitext
6207 ''Some [[Link|pretty ''italics'' and stuff]]!''
6208 !! html
6209 <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>
6210 </p>
6211 !! end
6213 !! test
6214 Link with double quotes in title part (literal) and alternate part (interpreted)
6215 !! wikitext
6216 [[File:Denys Savchenko ''Pentecoste''.jpg]]
6218 [[''Pentecoste'']]
6220 [[''Pentecoste''|Pentecoste]]
6222 [[''Pentecoste''|''Pentecoste'']]
6223 !! html/php
6224 <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>
6225 </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>
6226 </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>
6227 </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>
6228 </p>
6229 !! html/parsoid
6230 <meta typeof="mw:Placeholder"/>
6231 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6232 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6233 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6234 !! end
6236 !! test
6237 Broken image links with HTML captions (bug 39700)
6238 !! wikitext
6239 [[File:Nonexistent|<script></script>]]
6240 [[File:Nonexistent|100px|<script></script>]]
6241 [[File:Nonexistent|&lt;]]
6242 [[File:Nonexistent|a<i>b</i>c]]
6243 !! html
6244 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6245 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6246 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6247 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6248 </p>
6249 !! end
6251 !! test
6252 Plain link to URL
6253 !! wikitext
6254 [[http://www.example.com]]
6255 !! html/php
6256 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6257 </p>
6258 !! html/parsoid
6259 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6260 !! end
6262 !! test
6263 Plain link to URL with link text
6264 !! wikitext
6265 [[http://www.example.com Link text]]
6266 !! html
6267 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6268 </p>
6269 !! end
6271 !! test
6272 Plain link to protocol-relative URL
6273 !! wikitext
6274 [[//www.example.com]]
6275 !! html/php
6276 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6277 </p>
6278 !! html/parsoid
6279 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6280 !! end
6282 !! test
6283 Plain link to protocol-relative URL with link text
6284 !! wikitext
6285 [[//www.example.com Link text]]
6286 !! html
6287 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6288 </p>
6289 !! end
6291 !! test
6292 Plain link to page with question mark in title
6293 !! wikitext
6294 [[A?b]]
6296 [[A?b|Baz]]
6297 !! html
6298 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6299 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6300 </p>
6301 !! end
6304 # I'm fairly sure the expected result here is wrong.
6305 # We want these to be URL links, not pseudo-pages with URLs for titles....
6306 # However the current output is also pretty screwy.
6308 # ----
6309 # I'm changing it to match the current output--it arguably makes more
6310 # sense in the light of the test above. Old expected result was:
6311 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6312 #</p>
6313 # But I think this test is bordering on "garbage in, garbage out" anyway.
6314 # -- wtm
6315 !! test
6316 Piped link to URL
6317 !! wikitext
6318 Piped link to URL: [[http://www.example.com|an example URL]]
6319 !! html/php
6320 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6321 </p>
6322 !! html/parsoid
6323 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6324 !! end
6326 !! test
6327 BUG 2: [[page|http://url/]] should link to page, not http://url/
6328 !! wikitext
6329 [[Main Page|http://url/]]
6330 !! html/php
6331 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6332 </p>
6333 !! html/parsoid
6334 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6335 !! end
6337 # Parsoid does not mark self-links, by design.
6338 !! test
6339 BUG 337: Escaped self-links should be bold
6340 !! options
6341 title=[[Bug462]]
6342 !! wikitext
6343 [[Bu&#103;462]] [[Bug462]]
6344 !! html/php
6345 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6346 </p>
6347 !! html/php+tidy
6348 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6349 !! html/parsoid
6350 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6351 !! end
6353 !! test
6354 Self-link to section should not be bold
6355 !! options
6356 title=[[Main Page]]
6357 !! wikitext
6358 [[Main Page#section]]
6359 !! html
6360 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6361 </p>
6362 !! end
6364 !! article
6366 !! text
6367 This is 00.
6368 !! endarticle
6370 !!test
6371 Self-link to numeric title
6372 !!options
6373 title=[[0]]
6374 !! wikitext
6375 [[0]]
6376 !! html
6377 <p><strong class="selflink">0</strong>
6378 </p>
6379 !!end
6381 !!test
6382 Link to numeric-equivalent title
6383 !!options
6384 title=[[0]]
6385 !! wikitext
6386 [[00]]
6387 !! html
6388 <p><a href="/wiki/00" title="00">00</a>
6389 </p>
6390 !!end
6392 !! test
6393 <nowiki> inside a link
6394 !! wikitext
6395 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6396 !! html
6397 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6398 </p>
6399 !! end
6401 !! test
6402 Non-breaking spaces in title
6403 !! wikitext
6404 [[&nbsp; Main &nbsp; Page &nbsp;]]
6405 !! html
6406 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6407 </p>
6408 !!end
6410 !! test
6411 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6412 !! options
6413 language=ca
6414 !! wikitext
6415 '''[[Main Page]]'''
6416 !! html
6417 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6418 </p>
6419 !! end
6421 !! test
6422 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6423 !! options
6424 language=ca
6425 !! wikitext
6426 ''[[Main Page]]''
6427 !! html
6428 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6429 </p>
6430 !! end
6432 !! test
6433 Internal link with en linktrail: no apostrophes (bug 27473)
6434 !! options
6435 language=en
6436 !! wikitext
6437 [[Something]]'nice
6438 !! html
6439 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6440 </p>
6441 !! end
6443 !! test
6444 Internal link with ca linktrail with apostrophes (bug 27473)
6445 !! options
6446 language=ca
6447 !! wikitext
6448 [[Something]]'nice
6449 !! html
6450 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6451 </p>
6452 !! end
6454 !! test
6455 Internal link with kaa linktrail with apostrophes (bug 27473)
6456 !! options
6457 language=kaa
6458 !! wikitext
6459 [[Something]]'nice
6460 !! html
6461 <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>
6462 </p>
6463 !! end
6465 !! test
6466 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6467 !! wikitext
6468 [[User:Foo/Test/63636:Bar|Test]]
6469 !! html/php
6470 <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>
6471 </p>
6472 !! html/parsoid
6473 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6474 !! end
6476 !! test
6477 Purely hash wikilink
6478 !! options
6479 title=[[User:test/123]]
6480 !! wikitext
6481 [[#a|b]]
6482 !! html/php
6483 <p><a href="#a">b</a>
6484 </p>
6485 !! html/parsoid
6486 <p data-parsoid='{}'><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>
6487 !! end
6489 !! test
6490 1. Interaction of linktrail and template encapsulation
6491 !! options
6492 parsoid
6493 !! wikitext
6494 {{echo|[[Foo]]}}l
6495 !! html
6496 <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>
6497 !! end
6499 !! test
6500 2. Interaction of linktrail and template encapsulation
6501 !! options
6502 parsoid
6503 !! wikitext
6504 {{echo|Some [[Fool]]}}s
6505 !! html
6506 <p data-parsoid='{}'><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>
6507 !! end
6509 !! test
6510 3. Interaction of linktrail and template encapsulation
6511 !! options
6512 parsoid
6513 !! wikitext
6514 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6515 !! html
6516 <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 data-parsoid="{}">bold and foolish</b></p>
6517 !! end
6519 !! article
6520 Söfnuður
6521 !! text
6522 Test.
6523 !! endarticle
6525 !! test
6526 Internal link with is link prefix
6527 !! options
6528 language=is
6529 !! wikitext
6530 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6531 !! html
6532 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6533 </p>
6534 !! end
6536 !! article
6537 Mótmælendatrú
6538 !! text
6539 Test.
6540 !! endarticle
6542 !! test
6543 Internal link with is link trail and link prefix
6544 !! options
6545 language=is
6546 !! wikitext
6547 [[mótmælendatrú|xxx]]ar
6548 [[mótmælendatrú]]ar
6549 mótmælenda[[söfnuður]]
6550 mótmælenda[[söfnuður|söfnuðir]]
6551 mótmælenda[[söfnuður|söfnuðir]]xxx
6552 !! html
6553 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6554 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6555 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6556 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6557 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6558 </p>
6559 !! end
6561 !! test
6562 Parsoid link trail escaping
6563 !! options
6564 parsoid=html2wt,html2html
6565 !! wikitext
6566 [[apple]]<nowiki/>s
6567 !! html
6568 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6569 !! end
6571 !! test
6572 Parsoid link prefix escaping
6573 !! options
6574 language=is
6575 parsoid=html2wt,html2html
6576 !! wikitext
6577 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6578 !! html
6579 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6580 !! end
6582 !! test
6583 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6584 !! wikitext
6585 [[Foo|  bar]]
6587 [[Foo|  ''bar'']]
6589 [http://wp.org   foo]
6591 [http://wp.org   ''foo'']
6592 !! html
6593 <p><a href="/wiki/Foo" title="Foo">  bar</a>
6594 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
6595 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6596 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6597 </p>
6598 !! end
6600 !! test
6601 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6602 !! options
6603 parsoid
6604 !! wikitext
6605 [[Foo|{{echo|a}} b {{echo|c}}]]
6606 !! html
6607 <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>
6608 !! end
6610 !! test
6611 Link with angle bracket after anchor
6612 !! wikitext
6613 [[Foo#<bar>]]
6614 !! html/php
6615 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6616 </p>
6617 !! html/parsoid
6618 <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>
6619 !! end
6622 ### Interwiki links (see maintenance/interwiki.sql)
6625 !! test
6626 Inline interwiki link
6627 !! wikitext
6628 [[MeatBall:SoftSecurity]]
6629 !! html
6630 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6631 </p>
6632 !! end
6634 !! test
6635 Inline interwiki link with empty title (bug 2372)
6636 !! wikitext
6637 [[MeatBall:]]
6638 !! html
6639 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6640 </p>
6641 !! end
6643 !! test
6644 Interwiki link encoding conversion (bug 1636)
6645 !! wikitext
6646 *[[Wikipedia:ro:Olteni&#0355;a]]
6647 *[[Wikipedia:ro:Olteni&#355;a]]
6648 !! html
6649 <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>
6650 <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>
6652 !! html+tidy
6653 <ul>
6654 <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>
6655 <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>
6656 </ul>
6657 !! end
6659 !! test
6660 Interwiki link with fragment (bug 2130)
6661 !! wikitext
6662 [[MeatBall:SoftSecurity#foo]]
6663 !! html
6664 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6665 </p>
6666 !! end
6668 # Ideally the wikipedia: prefix here should be proto-relative too
6669 !! test
6670 Different interwiki prefixes mapping to the same URL
6671 !! wikitext
6672 [[:en:Foo]]
6674 [[:en:Foo|Foo]]
6676 [[wikipedia:Foo]]
6678 [[:wikipedia:Foo|Foo]]
6680 [[wikipedia:en:Foo]]
6682 [[:wikipedia:en:Foo]]
6684 [[  wikiPEdia :Foo]]
6685 !! html/parsoid
6686 <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}'>en:Foo</a></p>
6688 <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}'>Foo</a></p>
6690 <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}'>wikipedia:Foo</a></p>
6692 <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}'>Foo</a></p>
6694 <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}'>wikipedia:en:Foo</a></p>
6696 <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}'>wikipedia:en:Foo</a></p>
6698 <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}'>  wikiPEdia :Foo</a></p>
6699 !! end
6701 !! test
6702 Interwiki links that cannot be represented in wiki syntax
6703 !! wikitext
6704 [[meatball:ok]]
6705 [[meatball:ok#foo|ok with fragment]]
6706 [[meatball:ok_as_well?|ok ending with ? mark]]
6707 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6708 [http://de.wikipedia.org/wiki/#foo is just fragment]
6710 !! html/parsoid
6711 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6712 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6713 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6714 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6715 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6716 !! end
6718 !! test
6719 Interwiki links: trail
6720 !! options
6721 parsoid
6722 !! wikitext
6723 [[wikipedia:Foo|Ba]]r
6724 !! html
6725 <p data-parsoid='{}'><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"}'>Bar</a></p>
6726 !! end
6728 !! test
6729 Local interwiki link
6730 !! wikitext
6731 [[local:Template:Foo]]
6732 !! html
6733 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
6734 </p>
6735 !! end
6737 !! test
6738 Local interwiki link: self-link to current page
6739 !! options
6740 title=[[Main Page]]
6741 !! wikitext
6742 [[local:Main Page]]
6743 !! html
6744 <p><strong class="selflink">local:Main Page</strong>
6745 </p>
6746 !! end
6748 !! test
6749 Local interwiki link: prefix only (bug 64167)
6750 !! wikitext
6751 [[local:]]
6752 !! html
6753 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
6754 </p>
6755 !! end
6757 !! test
6758 Local interwiki link: with additional interwiki prefix (bug 61357)
6759 !! wikitext
6760 [[local:meatball:Hello]]
6761 !! html
6762 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
6763 </p>
6764 !! end
6767 ### Interlanguage links
6768 ### Language links (so that searching for '### language' matches..)
6771 !! test
6772 Interlanguage link
6773 !! wikitext
6774 Blah blah blah
6775 [[zh:Chinese]]
6776 !! html/php
6777 <p>Blah blah blah
6778 </p>
6779 !! html/parsoid
6780 <p>Blah blah blah
6781 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6782 !! end
6784 !! test
6785 Interlanguage link with spacing
6786 !! wikitext
6787 Blah blah blah
6788 [[   zh  :    Chinese     ]]
6789 !! html/php
6790 <p>Blah blah blah
6791 </p>
6792 !! html/parsoid
6793 <p>Blah blah blah
6794 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6795 !! end
6797 !! test
6798 Double interlanguage link
6799 !! wikitext
6800 Blah blah blah
6801 [[es:Spanish]]
6802 [[zh:Chinese]]
6803 !! html/php
6804 <p>Blah blah blah
6805 </p>
6806 !! html/parsoid
6807 <p>Blah blah blah
6808 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6809 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6810 !! end
6812 !! test
6813 Interlanguage link variations
6814 !! wikitext
6815 Blah blah blah
6816 [[   es :Spanish]]
6817 [[ ZH :Chinese]]
6818 !! html/php
6819 <p>Blah blah blah
6820 </p>
6821 !! html/parsoid
6822 <p>Blah blah blah
6823 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish" data-parsoid='{"stx":"simple","a":{"href":"//es.wikipedia.org/wiki/Spanish"},"sa":{"href":"   es :Spanish"}}'/>
6824 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese" data-parsoid='{"stx":"simple","a":{"href":"//zh.wikipedia.org/wiki/Chinese"},"sa":{"href":" ZH :Chinese"}}'/>
6825 !! end
6827 !! test
6828 Interlanguage link, with prefix links
6829 !! options
6830 language=ln
6831 !! wikitext
6832 Blah blah blah
6833 [[zh:Chinese]]
6834 !! html/php
6835 <p>Blah blah blah
6836 </p>
6837 !! html/parsoid
6838 <p>Blah blah blah
6839 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6840 !! end
6842 !! test
6843 Double interlanguage link, with prefix links (bug 8897)
6844 !! options
6845 language=ln
6846 !! wikitext
6847 Blah blah blah
6848 [[es:Spanish]]
6849 [[zh:Chinese]]
6850 !! html/php
6851 <p>Blah blah blah
6852 </p>
6853 !! html/parsoid
6854 <p>Blah blah blah
6855 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6856 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6857 !! end
6859 !! test
6860 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6861 !! wikitext
6862 Blah blah blah
6863 [[mul:Article]]
6864 !! html/php
6865 <p>Blah blah blah
6866 </p>
6867 !! html/parsoid
6868 <p>Blah blah blah
6869 <link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p>
6870 !! end
6872 !! test
6873 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6874 !! options
6875 language=ln
6876 !! wikitext
6877 [[WW&nbsp;II]]
6878 !! html
6879 <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>
6880 </p>
6881 !! end
6883 !! test
6884 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6885 !! options
6886 parsoid=html2wt
6887 !! wikitext
6888 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6890 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6891 !! html
6892 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6893 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6894 !! end
6896 !! test
6897 Parsoid: handle constructor well
6898 !! options
6899 parsoid
6900 !! wikitext
6901 [[constructor]]
6903 [[constructor:foo]]
6904 !! html
6905 <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>
6907 <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>
6908 !! end
6910 !! test
6911 Parsoid: recognize interlanguage links without a target page
6912 !! options
6913 parsoid
6914 !! wikitext
6915 [[ko:]]
6916 !! html
6917 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6918 !! end
6920 !! test
6921 Parsoid: recognize interwiki links without a target page
6922 !! options
6923 parsoid
6924 !! wikitext
6925 [[:ko:]]
6926 !! html
6927 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6928 !! end
6930 !! test
6931 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6932 !! options
6933 parsoid
6934 !! wikitext
6935 [[en:Foo]]
6936 !! html
6937 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6938 !! end
6940 !! test
6941 Interlanguage link with preceding local interwiki link (bug 68085)
6942 !! wikitext
6943 Blah blah blah
6944 [[local:es:Spanish]]
6945 !! html
6946 <p>Blah blah blah
6947 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
6948 </p>
6949 !! end
6951 !! test
6952 Looks like an interlanguage link, but is actually a local interwiki
6953 !! wikitext
6954 Blah blah blah
6955 [[mi:Template:Foo]]
6956 !! html
6957 <p>Blah blah blah
6958 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
6959 </p>
6960 !! end
6963 ### Redirects, Parsoid-only
6965 !! test
6966 1. Simple redirect to page
6967 !! options
6968 parsoid
6969 !! wikitext
6970 #REDIRECT [[Main Page]]
6971 !! html
6972 <link rel="mw:PageProp/redirect" href="./Main_Page">
6973 !! end
6975 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6976 !! test
6977 2. Other redirect variants
6978 !! options
6979 parsoid=wt2html,wt2wt
6980 !! wikitext
6981 #REDIRECT [[Main_Page]]
6982 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6983 !! html
6984 <link rel="mw:PageProp/redirect" href="./Main_Page">
6985 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6986 !! end
6988 !! test
6989 Empty redirect
6990 !! options
6991 parsoid=wt2html,wt2wt
6992 !! wikitext
6993 #REDIRECT [[]]
6994 !! html
6995 <ol>
6996 <li>REDIRECT [[]]</li></ol>
6997 !! end
6999 !! test
7000 Optional colon in #REDIRECT
7001 !! options
7002 # the colon is archaic syntax.  we support it for wt2html, but we
7003 # don't care that it roundtrips back to the modern syntax.
7004 parsoid=wt2html,html2html
7005 !! wikitext
7006 #REDIRECT:[[Main Page]]
7007 !! html
7008 <link rel="mw:PageProp/redirect" href="./Main_Page">
7009 !! end
7011 !! test
7012 Whitespace in #REDIRECT with optional colon
7013 !! options
7014 # the colon and gratuitous whitespace is archaic syntax.  we support
7015 # it for wt2html, but we don't care that it roundtrips back to the
7016 # modern syntax (without extra whitespace)
7017 parsoid=wt2html,html2html
7018 !! wikitext
7020  #REDIRECT 
7022 [[Main Page]]
7023 !! html
7024 <link rel="mw:PageProp/redirect" href="./Main_Page">
7025 !! end
7027 !! test
7028 Piped link in #REDIRECT
7029 !! options
7030 # content after piped link is ignored.  we support this syntax,
7031 # but don't care that the piped link is lost when we roundtrip this.
7032 parsoid=wt2html
7033 !! wikitext
7034 #REDIRECT [[Main Page|bar]]
7035 !! html
7036 <link rel="mw:PageProp/redirect" href="./Main_Page">
7037 !! end
7039 !! test
7040 Redirect to category
7041 !! options
7042 parsoid=wt2html
7043 !! wikitext
7044 #REDIRECT [[Category:Foo]]
7045 !! html
7046 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7047 !! end
7049 !! test
7050 Redirect to category with URL encoding
7051 !! options
7052 parsoid=wt2html
7053 !! wikitext
7054 #REDIRECT [[Category%3AFoo]]
7055 !! html
7056 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7057 !! end
7059 !! test
7060 Redirect to category page
7061 !! options
7062 parsoid=wt2html,html2html
7063 !! wikitext
7064 #REDIRECT [[:Category:Foo]]
7065 !! html
7066 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7067 !! end
7069 !! test
7070 Redirect to image page (1)
7071 !! options
7072 parsoid
7073 !! wikitext
7074 #REDIRECT [[File:Wiki.png]]
7075 !! html
7076 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7077 !! end
7079 !! test
7080 Redirect to image page (2)
7081 !! options
7082 parsoid
7083 !! wikitext
7084 #REDIRECT [[Image:Wiki.png]]
7085 !! html
7086 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7087 !! end
7089 !! test
7090 Redirect to language
7091 !! options
7092 parsoid
7093 !! wikitext
7094 #REDIRECT [[en:File:Wiki.png]]
7095 !! html
7096 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7097 !! end
7099 !! test
7100 Redirect to interwiki
7101 !! options
7102 parsoid
7103 !! wikitext
7104 #REDIRECT [[meatball:File:Wiki.png]]
7105 !! html
7106 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7107 !! end
7109 !! test
7110 Non-English #REDIRECT
7111 !! options
7112 parsoid
7113 language=is
7114 !! wikitext
7115 #TILVÍSUN [[Main Page]]
7116 !! html
7117 <link rel="mw:PageProp/redirect" href="./Main_Page">
7118 !! end
7120 !! test
7121 New redirect
7122 !! options
7123 parsoid=html2wt
7124 !! wikitext
7126 #REDIRECT [[Foo]]
7127 !! html
7128 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7129 !! end
7132 ## XHTML tidiness
7135 !! test
7136 <br> to <br />
7137 !! wikitext
7138 1<br>2<br />3
7139 !! html
7140 <p>1<br />2<br />3
7141 </p>
7142 !! end
7144 !! test
7145 Broken br tag sanitization
7146 !! wikitext
7147 </br>
7148 !! html/php
7149 <p>&lt;/br&gt;
7150 </p>
7151 !! end
7153 # TODO: Fix html2html mode (bug 51055)!
7154 # This </br> handling was added as part of bug 50831; but it
7155 # differs from how PHP+tidy handles this.  We should investigate
7156 # this.
7157 !! test
7158 Parsoid: Broken br tag recognition
7159 !! options
7160 parsoid=wt2html
7161 !! wikitext
7162 </br>
7164 <br/ >
7165 !! html/php+tidy
7166 <p>&lt;/br&gt;</p>
7167 <p><br /></p>
7168 !! html/parsoid
7169 <p><br></p>
7170 <p><br/></p>
7171 !! end
7173 !! test
7174 Incorrecly removing closing slashes from correctly formed XHTML
7175 !! wikitext
7176 <br style="clear:both;" />
7177 !! html
7178 <p><br style="clear:both;" />
7179 </p>
7180 !! end
7182 !! test
7183 Failing to transform badly formed HTML into correct XHTML
7184 !! wikitext
7185 <br style="clear: left;">
7186 <br style="clear: right;">
7187 <br style="clear: both;">
7188 !! html
7189 <p><br style="clear: left;" />
7190 <br style="clear: right;" />
7191 <br style="clear: both;" />
7192 </p>
7193 !!end
7195 !! test
7196 Handling html with a div self-closing tag
7197 !! wikitext
7198 <div title />
7199 <div title/>
7200 <div title/ >
7201 <div title=bar />
7202 <div title=bar/>
7203 <div title=bar/ >
7204 !! html
7205 <p>&lt;div title /&gt;
7206 &lt;div title/&gt;
7207 </p>
7208 <div>
7209 <p>&lt;div title=bar /&gt;
7210 &lt;div title=bar/&gt;
7211 </p>
7212 <div title="bar/"></div>
7213 </div>
7215 !! end
7217 !! test
7218 Handling html with a br self-closing tag
7219 !! wikitext
7220 <br title />
7221 <br title/>
7222 <br title/ >
7223 <br title=bar />
7224 <br title=bar/>
7225 <br title=bar/ >
7226 !! html/php
7227 <p><br title="title" />
7228 <br title="title" />
7229 <br />
7230 <br title="bar" />
7231 <br title="bar" />
7232 <br title="bar/" />
7233 </p>
7234 !! html/parsoid
7235 <p><br title="" />
7236 <br title="" />
7237 <br />
7238 <br title="bar" />
7239 <br title="bar" />
7240 <br title="bar/" />
7241 </p>
7242 !! end
7244 !! test
7245 Horizontal ruler (should it add that extra space?)
7246 !! wikitext
7247 <hr>
7248 <hr >
7249 foo <hr
7250 > bar
7251 !! html
7252 <hr />
7253 <hr />
7254 foo <hr /> bar
7256 !! end
7258 !! test
7259 Horizontal ruler -- 4+ dashes render hr
7260 !! wikitext
7261 ----
7262 !! html
7263 <hr />
7265 !! end
7267 !! test
7268 Horizontal ruler -- eats additional dashes on the same line
7269 !! wikitext
7270 ---------
7271 !! html
7272 <hr />
7274 !! end
7276 !! test
7277 Horizontal ruler -- does not collapse dashes on consecutive lines
7278 !! wikitext
7279 ----
7280 ----
7281 !! html
7282 <hr />
7283 <hr />
7285 !! end
7287 !! test
7288 Horizontal ruler -- <4 dashes render as plain text
7289 !! wikitext
7291 !! html
7292 <p>---
7293 </p>
7294 !! end
7296 !! test
7297 Horizontal ruler -- Supports content following dashes on same line
7298 !! wikitext
7299 ---- Foo
7300 !! html
7301 <hr /> Foo
7303 !! html+tidy
7304 <hr />
7305 <p>Foo</p>
7306 !! end
7309 ### Block-level elements
7311 !! test
7312 Common list
7313 !! wikitext
7314 *Common list
7315 * item 2
7316 *item 3
7317 !! html
7318 <ul><li>Common list</li>
7319 <li> item 2</li>
7320 <li>item 3</li></ul>
7322 !! end
7324 !! test
7325 Numbered list
7326 !! wikitext
7327 #Numbered list
7328 #item 2
7329 # item 3
7330 !! html
7331 <ol><li>Numbered list</li>
7332 <li>item 2</li>
7333 <li> item 3</li></ol>
7335 !! end
7337 !! test
7338 Mixed list
7339 !! wikitext
7340 *Mixed list
7341 *# with numbers
7342 ** and bullets
7343 *# and numbers
7344 *bullets again
7345 **bullet level 2
7346 ***bullet level 3
7347 ***#Number on level 4
7348 **bullet level 2
7349 **#Number on level 3
7350 **#Number on level 3
7351 *#number level 2
7352 *Level 1
7353 *** Level 3
7354 #** Level 3, but ordered
7355 !! html
7356 <ul><li>Mixed list
7357 <ol><li> with numbers</li></ol>
7358 <ul><li> and bullets</li></ul>
7359 <ol><li> and numbers</li></ol></li>
7360 <li>bullets again
7361 <ul><li>bullet level 2
7362 <ul><li>bullet level 3
7363 <ol><li>Number on level 4</li></ol></li></ul></li>
7364 <li>bullet level 2
7365 <ol><li>Number on level 3</li>
7366 <li>Number on level 3</li></ol></li></ul>
7367 <ol><li>number level 2</li></ol></li>
7368 <li>Level 1
7369 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7370 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7372 !! end
7374 !! test
7375 Nested lists 1
7376 !! wikitext
7377 *foo
7378 **bar
7379 !! html
7380 <ul><li>foo
7381 <ul><li>bar</li></ul></li></ul>
7383 !! end
7385 !! test
7386 Nested lists 2
7387 !! wikitext
7388 **foo
7389 *bar
7390 !! html
7391 <ul><li><ul><li>foo</li></ul></li>
7392 <li>bar</li></ul>
7394 !! end
7396 !! test
7397 Nested lists 3 (first element empty)
7398 !! wikitext
7400 **bar
7401 !! html
7402 <ul><li>
7403 <ul><li>bar</li></ul></li></ul>
7405 !! end
7407 !! test
7408 Nested lists 4 (first element empty)
7409 !! wikitext
7411 *bar
7412 !! html
7413 <ul><li><ul><li></li></ul></li>
7414 <li>bar</li></ul>
7416 !! end
7418 !! test
7419 Nested lists 5 (both elements empty)
7420 !! wikitext
7423 !! html
7424 <ul><li><ul><li></li></ul></li>
7425 <li></li></ul>
7427 !! end
7429 !! test
7430 Nested lists 6 (both elements empty)
7431 !! wikitext
7434 !! html
7435 <ul><li>
7436 <ul><li></li></ul></li></ul>
7438 !! end
7440 !! test
7441 Nested lists 7 (skip initial nesting levels)
7442 !! wikitext
7443 *** foo
7444 !! html
7445 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7447 !! end
7449 !! test
7450 Nested lists 8 (multiple nesting transitions)
7451 !! wikitext
7452 * foo
7453 *** bar
7454 ** baz
7455 * boo
7456 !! html
7457 <ul><li> foo
7458 <ul><li><ul><li> bar</li></ul></li>
7459 <li> baz</li></ul></li>
7460 <li> boo</li></ul>
7462 !! end
7464 !! test
7465 1. Lists with start-of-line-transparent tokens before bullets: Comments
7466 !! wikitext
7467 *foo
7468 *<!--cmt-->bar
7469 <!--cmt-->*baz
7470 !! html
7471 <ul><li>foo</li>
7472 <li>bar</li>
7473 <li>baz</li></ul>
7475 !! end
7477 !! test
7478 2. Lists with start-of-line-transparent tokens before bullets: Template close
7479 !! wikitext
7480 *foo {{echo|bar
7481 }}*baz
7482 !! html
7483 <ul><li>foo bar</li>
7484 <li>baz</li></ul>
7486 !! end
7488 !! test
7489 List items are not parsed correctly following a <pre> block (bug 785)
7490 !! wikitext
7491 * <pre>foo</pre>
7492 * <pre>bar</pre>
7493 * zar
7494 !! html
7495 <ul><li> <pre>foo</pre></li>
7496 <li> <pre>bar</pre></li>
7497 <li> zar</li></ul>
7499 !! end
7501 !! test
7502 List items from template
7503 !! wikitext
7505 {{inner list}}
7506 * item 2
7508 * item 0
7509 {{inner list}}
7510 * item 2
7512 * item 0
7513 * notSOL{{inner list}}
7514 * item 2
7515 !! html
7516 <ul><li> item 1</li>
7517 <li> item 2</li></ul>
7518 <ul><li> item 0</li>
7519 <li> item 1</li>
7520 <li> item 2</li></ul>
7521 <ul><li> item 0</li>
7522 <li> notSOL</li>
7523 <li> item 1</li>
7524 <li> item 2</li></ul>
7526 !! end
7528 !! test
7529 List interrupted by empty line or heading
7530 !! wikitext
7531 * foo
7533 ** bar
7534 == A heading ==
7535 * Another list item
7536 !! html
7537 <ul><li> foo</li></ul>
7538 <ul><li><ul><li> bar</li></ul></li></ul>
7539 <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>
7540 <ul><li> Another list item</li></ul>
7542 !!end
7544 !!test
7545 Multiple list tags generated by templates
7546 !! wikitext
7547 {{echo|<li>}}a
7548 {{echo|<li>}}b
7549 {{echo|<li>}}c
7550 !! html
7551 <li>a
7552 <li>b
7553 <li>c</li>
7554 </li>
7555 </li>
7557 !! html+tidy
7558 <ul>
7559 <li>a</li>
7560 <li>b</li>
7561 <li>c</li>
7562 </ul>
7563 !!end
7565 !!test
7566 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7567 !! wikitext
7569 <!--This line will NOT split the list-->
7571  <!--This line will NOT split the list either-->
7573  <!--foo--> <!----> <!--This line NOT split the list either--> 
7575 !! html
7576 <ul><li>a</li>
7577 <li>b</li>
7578 <li>c</li>
7579 <li>d</li></ul>
7581 !!end
7583 !!test
7584 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7585 !! wikitext
7587 <!--This line will NOT split the list-->        
7589         <!--This line will NOT split the list either-->         
7591         <!--foo--> <!---->      <!--This line NOT split the list
7592         either-->        
7594 !! html
7595 <ul><li>a</li>
7596 <li>b</li>
7597 <li>c</li>
7598 <li>d</li></ul>
7600 !!end
7602 !!test
7603 Test the li-hack
7604 (The PHP parser relies on Tidy for the hack)
7605 !!options
7606 parsoid=wt2html,wt2wt
7607 !! wikitext
7608 * foo
7609 * <li>li-hack
7610 * {{echo|<li>templated li-hack}}
7611 * <!--foo--> <li> unsupported li-hack with preceding comments
7613 <ul>
7614 <li><li>not a li-hack
7615 </li>
7616 </ul>
7617 !! html+tidy
7618 <ul>
7619 <li>foo</li>
7620 <li>li-hack</li>
7621 <li>templated li-hack</li>
7622 <li>unsupported li-hack with preceding comments</li>
7623 </ul>
7624 <ul>
7625 <li>not a li-hack</li>
7626 </ul>
7627 !!end
7629 !! test
7630 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7631 !! options
7632 parsoid
7633 !! wikitext
7634 # foo
7635 ## bar
7636 * foo
7637 ** bar
7638 : foo
7639 :: bar
7640 !! html
7641 <ol>
7642 <li> foo<ol>
7643 <li> bar</li>
7644 </ol></li>
7645 </ol><ul>
7646 <li> foo<ul>
7647 <li> bar</li>
7648 </ul></li>
7649 </ul><dl>
7650 <dd> foo<dl>
7651 <dd> bar</dd>
7652 </dl></dd>
7653 </dl>
7654 !! end
7656 !! test
7657 Parsoid: Test of whitespace serialization with Templated bullets
7658 !! options
7659 parsoid
7660 !! wikitext
7661 * {{bullet}}
7662 !! html
7663 <ul>
7664 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7665 </ul>
7666 !! end
7668 # ------------------------------------------------------------------------
7669 # The next set of tests are about Parsoid's ability to handle badly nested
7670 # tags (parse, minimize scope of fixup, and roundtrip back)
7671 # ------------------------------------------------------------------------
7673 !! test
7674 Unbalanced closing block tags break a list
7675 (php parser relies on Tidy to fix up)
7676 !! wikitext
7677 <div>
7678 *a</div><div>
7679 *b</div>
7680 !! html+tidy
7681 <div>
7682 <ul>
7683 <li>a</li>
7684 </ul>
7685 </div>
7686 <div>
7687 <ul>
7688 <li>b</li>
7689 </ul>
7690 </div>
7691 !! end
7693 # Parsoid fails this test, but it might be tricky to support properly.
7694 # See bug 68395.
7695 !! test
7696 Unbalanced closing non-block tags don't break a list
7697 (php parser relies on Tidy to fix up)
7698 !! wikitext
7699 <span>
7700 *a</span><span>
7701 *b</span>
7702 !! html/php+tidy
7703 <ul>
7704 <li><span>a</span></li>
7705 <li><span>b</span></li>
7706 </ul>
7707 !! html/parsoid
7708 <span>
7709 <ul>
7710 <li>a<span></span>
7711 </li>
7712 <li>b
7713 </li>
7714 </ul>
7715 </span>
7716 !! end
7718 !! test
7719 Unclosed formatting tags that straddle lists are closed and reopened
7720 (php parser relies on Tidy to fix up)
7721 !! wikitext
7722 # <s> a
7723 # b </s>
7724 !! html/php+tidy
7725 <ol>
7726 <li><s>a</s></li>
7727 <li><s>b</s></li>
7728 </ol>
7729 !! html/parsoid
7730 <ol>
7731 <li> <s> a </s>
7732 </li>
7733 <li> <s> b </s>
7734 </li>
7735 </ol>
7736 !! end
7738 # Parsoid fails this test, but it might be tricky to support properly.
7739 # See bug 68395.
7740 !!test
7741 List embedded in a non-block tag
7742 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
7743 !! wikitext
7744 <small>
7745 * foo
7746 </small>
7747 !! html/php+tidy
7748 <ul>
7749 <li><small>foo</small></li>
7750 </ul>
7751 !! html/parsoid
7752 <small>
7753 <ul>
7754 <li> foo</li>
7755 </ul>
7756 </small>
7757 !!end
7759 # This is a bug in the PHP parser + tidy combination.
7760 # (The </tr> tag gets parsed as text and html-escaped by PHP,
7761 # and then fostered out of the table by tidy.)
7762 # We believe the Parsoid output to be correct.
7763 !! test
7764 Table with missing opening <tr> tag
7765 !! options
7766 parsoid=wt2html,wt2wt
7767 !! wikitext
7768 <table>
7769 <td>foo</td>
7770 </tr>
7771 </table>
7772 !! html/php+tidy
7773 <p>&lt;/tr&gt;</p>
7774 <table>
7775 <tr>
7776 <td>foo</td>
7777 </tr>
7778 </table>
7779 !! html/parsoid
7780 <table>
7781 <tr>
7782 <td>foo</td>
7783 </tr>
7784 </table>
7785 !! end
7788 ### Magic Words
7791 # Note that the current date is hard-coded as
7792 #   1970-01-01T00:02:03Z (a Thursday)
7793 # when running parser tests.  The timezone is also fixed to GMT, so
7794 # local date will be identical to current date.
7796 !! test
7797 Magic Word: {{CURRENTDAY}}
7798 !! wikitext
7799 {{CURRENTDAY}}
7800 !! html
7801 <p>1
7802 </p>
7803 !! end
7805 !! test
7806 Magic Word: {{CURRENTDAY2}}
7807 !! wikitext
7808 {{CURRENTDAY2}}
7809 !! html
7810 <p>01
7811 </p>
7812 !! end
7814 !! test
7815 Magic Word: {{CURRENTDAYNAME}}
7816 !! wikitext
7817 {{CURRENTDAYNAME}}
7818 !! html
7819 <p>Thursday
7820 </p>
7821 !! end
7823 !! test
7824 Magic Word: {{CURRENTDOW}}
7825 !! wikitext
7826 {{CURRENTDOW}}
7827 !! html
7828 <p>4
7829 </p>
7830 !! end
7832 !! test
7833 Magic Word: {{CURRENTMONTH}}
7834 !! wikitext
7835 {{CURRENTMONTH}}
7836 !! html
7837 <p>01
7838 </p>
7839 !! end
7841 !! test
7842 Magic Word: {{CURRENTMONTH1}}
7843 !! wikitext
7844 {{CURRENTMONTH1}}
7845 !! html
7846 <p>1
7847 </p>
7848 !! end
7850 !! test
7851 Magic Word: {{CURRENTMONTHABBREV}}
7852 !! wikitext
7853 {{CURRENTMONTHABBREV}}
7854 !! html
7855 <p>Jan
7856 </p>
7857 !! end
7859 !! test
7860 Magic Word: {{CURRENTMONTHNAME}}
7861 !! wikitext
7862 {{CURRENTMONTHNAME}}
7863 !! html
7864 <p>January
7865 </p>
7866 !! end
7868 !! test
7869 Magic Word: {{CURRENTMONTHNAMEGEN}}
7870 !! wikitext
7871 {{CURRENTMONTHNAMEGEN}}
7872 !! html
7873 <p>January
7874 </p>
7875 !! end
7877 !! test
7878 Magic Word: {{CURRENTTIME}}
7879 !! wikitext
7880 {{CURRENTTIME}}
7881 !! html
7882 <p>00:02
7883 </p>
7884 !! end
7886 !! test
7887 Magic Word: {{CURRENTHOUR}}
7888 !! wikitext
7889 {{CURRENTHOUR}}
7890 !! html
7891 <p>00
7892 </p>
7893 !! end
7895 !! test
7896 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7897 !! wikitext
7898 {{CURRENTWEEK}}
7899 !! html
7900 <p>1
7901 </p>
7902 !! end
7904 !! test
7905 Magic Word: {{CURRENTYEAR}}
7906 !! wikitext
7907 {{CURRENTYEAR}}
7908 !! html
7909 <p>1970
7910 </p>
7911 !! end
7913 !! test
7914 Magic Word: {{CURRENTTIMESTAMP}}
7915 !! wikitext
7916 {{CURRENTTIMESTAMP}}
7917 !! html
7918 <p>19700101000203
7919 </p>
7920 !! end
7922 !! test
7923 Magic Words LOCAL (UTC)
7924 !! wikitext
7925 * {{LOCALMONTH}}
7926 * {{LOCALMONTH1}}
7927 * {{LOCALMONTHNAME}}
7928 * {{LOCALMONTHNAMEGEN}}
7929 * {{LOCALMONTHABBREV}}
7930 * {{LOCALDAY}}
7931 * {{LOCALDAY2}}
7932 * {{LOCALDAYNAME}}
7933 * {{LOCALYEAR}}
7934 * {{LOCALTIME}}
7935 * {{LOCALHOUR}}
7936 * {{LOCALWEEK}}
7937 * {{LOCALDOW}}
7938 * {{LOCALTIMESTAMP}}
7939 !! html
7940 <ul><li> 01</li>
7941 <li> 1</li>
7942 <li> January</li>
7943 <li> January</li>
7944 <li> Jan</li>
7945 <li> 1</li>
7946 <li> 01</li>
7947 <li> Thursday</li>
7948 <li> 1970</li>
7949 <li> 00:02</li>
7950 <li> 00</li>
7951 <li> 1</li>
7952 <li> 4</li>
7953 <li> 19700101000203</li></ul>
7955 !! end
7957 !! test
7958 Magic Word: {{FULLPAGENAME}}
7959 !! options
7960 title=[[User:Ævar Arnfjörð Bjarmason]]
7961 !! wikitext
7962 {{FULLPAGENAME}}
7963 !! html
7964 <p>User:Ævar Arnfjörð Bjarmason
7965 </p>
7966 !! end
7968 !! test
7969 Magic Word: {{FULLPAGENAMEE}}
7970 !! options
7971 title=[[User:Ævar Arnfjörð Bjarmason]]
7972 !! wikitext
7973 {{FULLPAGENAMEE}}
7974 !! html
7975 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7976 </p>
7977 !! end
7979 !! test
7980 Magic Word: {{TALKSPACE}}
7981 !! options
7982 title=[[User:Ævar Arnfjörð Bjarmason]]
7983 !! wikitext
7984 {{TALKSPACE}}
7985 !! html
7986 <p>User talk
7987 </p>
7988 !! end
7990 !! test
7991 Magic Word: {{TALKSPACE}}, same namespace
7992 !! options
7993 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7994 !! wikitext
7995 {{TALKSPACE}}
7996 !! html
7997 <p>User talk
7998 </p>
7999 !! end
8001 !! test
8002 Magic Word: {{TALKSPACE}}, main namespace
8003 !! options
8004 title=[[Parser Test]]
8005 !! wikitext
8006 {{TALKSPACE}}
8007 !! html
8008 <p>Talk
8009 </p>
8010 !! end
8012 !! test
8013 Magic Word: {{TALKSPACEE}}
8014 !! options
8015 title=[[User:Ævar Arnfjörð Bjarmason]]
8016 !! wikitext
8017 {{TALKSPACEE}}
8018 !! html
8019 <p>User_talk
8020 </p>
8021 !! end
8023 !! test
8024 Magic Word: {{SUBJECTSPACE}}
8025 !! options
8026 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8027 !! wikitext
8028 {{SUBJECTSPACE}}
8029 !! html
8030 <p>User
8031 </p>
8032 !! end
8034 !! test
8035 Magic Word: {{SUBJECTSPACE}}, same namespace
8036 !! options
8037 title=[[User:Ævar Arnfjörð Bjarmason]]
8038 !! wikitext
8039 {{SUBJECTSPACE}}
8040 !! html
8041 <p>User
8042 </p>
8043 !! end
8045 !! test
8046 Magic Word: {{SUBJECTSPACE}}, main namespace
8047 !! options
8048 title=[[Parser Test]]
8049 !! wikitext
8050 {{SUBJECTSPACE}}
8051 !! html
8053 !! end
8055 !! test
8056 Magic Word: {{SUBJECTSPACEE}}
8057 !! options
8058 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8059 !! wikitext
8060 {{SUBJECTSPACEE}}
8061 !! html
8062 <p>User
8063 </p>
8064 !! end
8066 !! test
8067 Magic Word: {{NAMESPACE}}
8068 !! options
8069 title=[[User:Ævar Arnfjörð Bjarmason]]
8070 !! wikitext
8071 {{NAMESPACE}}
8072 !! html
8073 <p>User
8074 </p>
8075 !! end
8077 !! test
8078 Magic Word: {{NAMESPACEE}}
8079 !! options
8080 title=[[User:Ævar Arnfjörð Bjarmason]]
8081 !! wikitext
8082 {{NAMESPACEE}}
8083 !! html
8084 <p>User
8085 </p>
8086 !! end
8088 !! test
8089 Magic Word: {{NAMESPACENUMBER}}
8090 !! options
8091 title=[[User:Ævar Arnfjörð Bjarmason]]
8092 !! wikitext
8093 {{NAMESPACENUMBER}}
8094 !! html
8095 <p>2
8096 </p>
8097 !! end
8099 !! test
8100 Magic Word: {{SUBPAGENAME}}
8101 !! options
8102 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8103 !! wikitext
8104 {{SUBPAGENAME}}
8105 !! html
8106 <p>sub ö
8107 </p>
8108 !! end
8110 !! test
8111 Magic Word: {{SUBPAGENAMEE}}
8112 !! options
8113 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8114 !! wikitext
8115 {{SUBPAGENAMEE}}
8116 !! html
8117 <p>sub_%C3%B6
8118 </p>
8119 !! end
8121 !! test
8122 Magic Word: {{ROOTPAGENAME}}
8123 !! options
8124 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8125 !! wikitext
8126 {{ROOTPAGENAME}}
8127 !! html
8128 <p>Ævar Arnfjörð Bjarmason
8129 </p>
8130 !! end
8132 !! test
8133 Magic Word: {{ROOTPAGENAMEE}}
8134 !! options
8135 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8136 !! wikitext
8137 {{ROOTPAGENAMEE}}
8138 !! html
8139 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8140 </p>
8141 !! end
8143 !! test
8144 Magic Word: {{BASEPAGENAME}}
8145 !! options
8146 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8147 !! wikitext
8148 {{BASEPAGENAME}}
8149 !! html
8150 <p>Ævar Arnfjörð Bjarmason
8151 </p>
8152 !! end
8154 !! test
8155 Magic Word: {{BASEPAGENAMEE}}
8156 !! options
8157 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8158 !! wikitext
8159 {{BASEPAGENAMEE}}
8160 !! html
8161 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8162 </p>
8163 !! end
8165 !! test
8166 Magic Word: {{TALKPAGENAME}}
8167 !! options
8168 title=[[User:Ævar Arnfjörð Bjarmason]]
8169 !! wikitext
8170 {{TALKPAGENAME}}
8171 !! html
8172 <p>User talk:Ævar Arnfjörð Bjarmason
8173 </p>
8174 !! end
8176 !! test
8177 Magic Word: {{TALKPAGENAMEE}}
8178 !! options
8179 title=[[User:Ævar Arnfjörð Bjarmason]]
8180 !! wikitext
8181 {{TALKPAGENAMEE}}
8182 !! html
8183 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8184 </p>
8185 !! end
8187 !! test
8188 Magic Word: {{SUBJECTPAGENAME}}
8189 !! options
8190 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8191 !! wikitext
8192 {{SUBJECTPAGENAME}}
8193 !! html
8194 <p>User:Ævar Arnfjörð Bjarmason
8195 </p>
8196 !! end
8198 !! test
8199 Magic Word: {{SUBJECTPAGENAMEE}}
8200 !! options
8201 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8202 !! wikitext
8203 {{SUBJECTPAGENAMEE}}
8204 !! html
8205 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8206 </p>
8207 !! end
8209 !! test
8210 Magic Word: {{NUMBEROFFILES}}
8211 !! wikitext
8212 {{NUMBEROFFILES}}
8213 !! html
8214 <p>5
8215 </p>
8216 !! end
8218 !! test
8219 Magic Word: {{PAGENAME}}
8220 !! options
8221 title=[[User:Ævar Arnfjörð Bjarmason]]
8222 !! wikitext
8223 {{PAGENAME}}
8224 !! html
8225 <p>Ævar Arnfjörð Bjarmason
8226 </p>
8227 !! end
8229 !! test
8230 Magic Word: {{PAGENAME}} with metacharacters
8231 !! options
8232 title=[['foo & bar = baz']]
8233 !! wikitext
8234 ''{{PAGENAME}}''
8235 !! html/php
8236 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8237 </p>
8238 !! html+tidy
8239 <p><i>'foo &amp; bar = baz'</i></p>
8240 !! end
8242 !! test
8243 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8244 !! options
8245 title=[[*RFC 1234 http://example.com/]]
8246 !! wikitext
8247 {{PAGENAME}}
8248 !! html/php
8249 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8250 </p>
8251 !! html+tidy
8252 <p>*RFC 1234 http://example.com/</p>
8253 !! end
8255 !! test
8256 Magic Word: {{PAGENAMEE}}
8257 !! options
8258 title=[[User:Ævar Arnfjörð Bjarmason]]
8259 !! wikitext
8260 {{PAGENAMEE}}
8261 !! html
8262 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8263 </p>
8264 !! end
8266 !! test
8267 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8268 !! options
8269 title=[[*RFC 1234 http://example.com/]]
8270 !! wikitext
8271 {{PAGENAMEE}}
8272 !! html/php
8273 <p>&#42;RFC_1234_http&#58;//example.com/
8274 </p>
8275 !! html+tidy
8276 <p>*RFC_1234_http://example.com/</p>
8277 !! end
8279 !! test
8280 Magic Word: {{REVISIONID}}
8281 !! wikitext
8282 {{REVISIONID}}
8283 !! html
8284 <p>1337
8285 </p>
8286 !! end
8288 !! test
8289 Magic Word: {{SCRIPTPATH}}
8290 !! wikitext
8291 {{SCRIPTPATH}}
8292 !! html
8293 <p>/
8294 </p>
8295 !! end
8297 !! test
8298 Magic Word: {{STYLEPATH}}
8299 !! wikitext
8300 {{STYLEPATH}}
8301 !! html
8302 <p>/skins
8303 </p>
8304 !! end
8306 !! test
8307 Magic Word: {{SERVER}}
8308 !! wikitext
8309 {{SERVER}}
8310 !! html
8311 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8312 </p>
8313 !! end
8315 !! test
8316 Magic Word: {{SERVERNAME}}
8317 !! wikitext
8318 {{SERVERNAME}}
8319 !! html
8320 <p>example.org
8321 </p>
8322 !! end
8324 !! test
8325 Magic Word: {{SITENAME}}
8326 !! wikitext
8327 {{SITENAME}}
8328 !! html
8329 <p>MediaWiki
8330 </p>
8331 !! end
8333 !! test
8334 Case-sensitive magic words, when cased differently, should just be template transclusions
8335 !! wikitext
8336 {{CurrentMonth}}
8337 {{currentday}}
8338 {{cURreNTweEK}}
8339 {{currentHour}}
8340 !! html
8341 <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>
8342 <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>
8343 <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>
8344 <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>
8345 </p>
8346 !! end
8348 !! test
8349 Case-insensitive magic words should still work with weird casing.
8350 !! wikitext
8351 {{sErVeRNaMe}}
8352 {{LCFirst:AOEU}}
8353 {{ucFIRST:aoeu}}
8354 {{SERver}}
8355 !! html
8356 <p>example.org
8357 aOEU
8358 Aoeu
8359 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8360 </p>
8361 !! end
8363 !! test
8364 Namespace 1 {{ns:1}}
8365 !! wikitext
8366 {{ns:1}}
8367 !! html
8368 <p>Talk
8369 </p>
8370 !! end
8372 !! test
8373 Namespace 1 {{ns:01}}
8374 !! wikitext
8375 {{ns:01}}
8376 !! html
8377 <p>Talk
8378 </p>
8379 !! end
8381 !! test
8382 Namespace 0 {{ns:0}} (bug 4783)
8383 !! wikitext
8384 {{ns:0}}
8385 !! html
8387 !! end
8389 !! test
8390 Namespace 0 {{ns:00}} (bug 4783)
8391 !! wikitext
8392 {{ns:00}}
8393 !! html
8395 !! end
8397 !! test
8398 Namespace -1 {{ns:-1}}
8399 !! wikitext
8400 {{ns:-1}}
8401 !! html
8402 <p>Special
8403 </p>
8404 !! end
8406 !! test
8407 Namespace User {{ns:User}}
8408 !! wikitext
8409 {{ns:User}}
8410 !! html
8411 <p>User
8412 </p>
8413 !! end
8415 !! test
8416 Namespace User talk {{ns:User_talk}}
8417 !! wikitext
8418 {{ns:User_talk}}
8419 !! html
8420 <p>User talk
8421 </p>
8422 !! end
8424 !! test
8425 Namespace User talk {{ns:uSeR tAlK}}
8426 !! wikitext
8427 {{ns:uSeR tAlK}}
8428 !! html
8429 <p>User talk
8430 </p>
8431 !! end
8433 !! test
8434 Namespace File {{ns:File}}
8435 !! wikitext
8436 {{ns:File}}
8437 !! html
8438 <p>File
8439 </p>
8440 !! end
8442 !! test
8443 Namespace File {{ns:Image}}
8444 !! wikitext
8445 {{ns:Image}}
8446 !! html
8447 <p>File
8448 </p>
8449 !! end
8451 !! test
8452 Namespace (lang=de) Benutzer {{ns:User}}
8453 !! options
8454 language=de
8455 !! wikitext
8456 {{ns:User}}
8457 !! html
8458 <p>Benutzer
8459 </p>
8460 !! end
8462 !! test
8463 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8464 !! options
8465 language=de
8466 !! wikitext
8467 {{ns:3}}
8468 !! html
8469 <p>Benutzer Diskussion
8470 </p>
8471 !! end
8474 !! test
8475 Urlencode
8476 !! wikitext
8477 {{urlencode:hi world?!}}
8478 {{urlencode:hi world?!|WIKI}}
8479 {{urlencode:hi world?!|PATH}}
8480 {{urlencode:hi world?!|QUERY}}
8481 !! html
8482 <p>hi+world%3F%21
8483 hi_world%3F!
8484 hi%20world%3F%21
8485 hi+world%3F%21
8486 </p>
8487 !! end
8489 !! test
8490 Magic Word: prioritize type info over data-parsoid
8491 !! options
8492 parsoid=html2wt
8493 !! wikitext
8494 __FORCETOC__
8495 !! html
8496 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8497 !! end
8499 !! test
8500 Magic Word: serialize on separate line (parsoid)
8501 !! options
8502 parsoid=wt2wt,html2wt
8503 !! wikitext
8505 __NOTOC__
8507 !! html
8508 foo<meta property="mw:PageProp/notoc"/>bar
8509 !! end
8511 !! test
8512 Magic Word: rt non-english wikis
8513 !! options
8514 parsoid=wt2wt
8515 language=de
8516 !! wikitext
8517 __NOEDITSECTION__
8518 !! html
8519 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8520 !! end
8523 ### Magic links
8525 !! test
8526 Magic links: internal link to RFC (bug 479)
8527 !! wikitext
8528 [[RFC 123]]
8529 !! html
8530 <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>
8531 </p>
8532 !! end
8534 !! test
8535 Magic links: RFC (bug 479)
8536 !! wikitext
8537 RFC 822
8538 !! html
8539 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8540 </p>
8541 !! end
8543 !! test
8544 Magic links: ISBN (bug 1937)
8545 !! wikitext
8546 ISBN 0-306-40615-2
8547 !! html
8548 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8549 </p>
8550 !! end
8552 !! test
8553 Magic links: PMID incorrectly converts space to underscore
8554 !! wikitext
8555 PMID 1234
8556 !! html
8557 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8558 </p>
8559 !! end
8562 ### Templates
8563 ####
8565 !! test
8566 Nonexistent template
8567 !! wikitext
8568 {{thistemplatedoesnotexist}}
8569 !! html
8570 <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>
8571 </p>
8572 !! end
8574 !! test
8575 Template with invalid target containing tags
8576 !! wikitext
8577 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8578 !! html
8579 <p>{{a<b>b</b>|foo|a=b|a = b}}
8580 </p>
8581 !! end
8583 !! test
8584 Template with invalid target containing unclosed tag
8585 !! wikitext
8586 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8587 !! html
8588 <p>{{a<b>|foo|a=b|a = b}}</b>
8589 </p>
8590 !! end
8592 !! test
8593 Template with invalid target containing wikilink
8594 !! wikitext
8595 {{[[Main Page]]}}
8596 !! html/php
8597 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8598 </p>
8599 !! html/parsoid
8600 <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>
8601 !! end
8603 !! test
8604 Template with just whitespace in it, bug #68421
8605 !! wikitext
8606 {{echo|{{ }}}}
8607 !! html/parsoid
8608 <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>
8609 !! end
8611 !! article
8612 Template:test
8613 !! text
8614 This is a test template
8615 !! endarticle
8617 !! test
8618 Simple template
8619 !! wikitext
8620 {{test}}
8621 !! html
8622 <p>This is a test template
8623 </p>
8624 !! end
8626 !! test
8627 Template with explicit namespace
8628 !! wikitext
8629 {{Template:test}}
8630 !! html
8631 <p>This is a test template
8632 </p>
8633 !! end
8636 !! article
8637 Template:paramtest
8638 !! text
8639 This is a test template with parameter {{{param}}}
8640 !! endarticle
8642 !! test
8643 Template parameter
8644 !! wikitext
8645 {{paramtest|param=foo}}
8646 !! html
8647 <p>This is a test template with parameter foo
8648 </p>
8649 !! end
8651 !! article
8652 Template:paramtestnum
8653 !! text
8654 [[{{{1}}}|{{{2}}}]]
8655 !! endarticle
8657 !! test
8658 Template unnamed parameter
8659 !! wikitext
8660 {{paramtestnum|Main Page|the main page}}
8661 !! html
8662 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8663 </p>
8664 !! end
8666 !! article
8667 Template:templatesimple
8668 !! text
8669 (test)
8670 !! endarticle
8672 !! article
8673 Template:templateredirect
8674 !! text
8675 #redirect [[Template:templatesimple]]
8676 !! endarticle
8678 !! article
8679 Template:templateasargtestnum
8680 !! text
8681 {{{{{1}}}}}
8682 !! endarticle
8684 !! article
8685 Template:templateasargtest
8686 !! text
8687 {{template{{{templ}}}}}
8688 !! endarticle
8690 !! article
8691 Template:templateasargtest2
8692 !! text
8693 {{{{{templ}}}}}
8694 !! endarticle
8696 !! test
8697 Template with template name as unnamed argument
8698 !! wikitext
8699 {{templateasargtestnum|templatesimple}}
8700 !! html
8701 <p>(test)
8702 </p>
8703 !! end
8705 !! test
8706 Template with template name as argument
8707 !! wikitext
8708 {{templateasargtest|templ=simple}}
8709 !! html
8710 <p>(test)
8711 </p>
8712 !! end
8714 !! test
8715 Template with template name as argument (2)
8716 !! wikitext
8717 {{templateasargtest2|templ=templatesimple}}
8718 !! html
8719 <p>(test)
8720 </p>
8721 !! end
8723 !! article
8724 Template:templateasargtestdefault
8725 !! text
8726 {{{{{templ|templatesimple}}}}}
8727 !! endarticle
8729 !! article
8730 Template:templa
8731 !! text
8732 '''templ'''
8733 !! endarticle
8735 !! test
8736 Template with default value
8737 !! wikitext
8738 {{templateasargtestdefault}}
8739 !! html
8740 <p>(test)
8741 </p>
8742 !! end
8744 !! test
8745 Template with default value (value set)
8746 !! wikitext
8747 {{templateasargtestdefault|templ=templa}}
8748 !! html
8749 <p><b>templ</b>
8750 </p>
8751 !! end
8753 !! test
8754 Template redirect
8755 !! wikitext
8756 {{templateredirect}}
8757 !! html
8758 <p>(test)
8759 </p>
8760 !! end
8762 !! test
8763 Template with argument in separate line
8764 !! wikitext
8765 {{ templateasargtest  |
8766  templ = simple }}
8767 !! html
8768 <p>(test)
8769 </p>
8770 !! end
8772 !! test
8773 Template with complex template as argument
8774 !! wikitext
8775 {{paramtest|
8776   param ={{ templateasargtest  |
8777  templ = simple }}}}
8778 !! html
8779 <p>This is a test template with parameter (test)
8780 </p>
8781 !! end
8783 !! test
8784 Template with thumb image (with link in description)
8785 !! wikitext
8786 {{paramtest|
8787   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8788 !! html/php
8789 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>
8791 !! html+tidy
8792 <p>This is a test template with parameter</p>
8793 <div class="thumb tright">
8794 <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>
8795 <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>
8796 </div>
8797 </div>
8798 !! end
8800 !! article
8801 Template:complextemplate
8802 !! text
8803 {{{1}}} {{paramtest|
8804   param ={{{param}}}}}
8805 !! endarticle
8807 !! test
8808 Template with complex arguments
8809 !! wikitext
8810 {{complextemplate|
8811   param ={{ templateasargtest  |
8812  templ = simple }}|[[Template:complextemplate|link]]}}
8813 !! html
8814 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8815 </p>
8816 !! end
8818 !! test
8819 BUG 553: link with two variables in a piped link
8820 !! wikitext
8822 |[[{{{1}}}|{{{2}}}]]
8824 !! html
8825 <table>
8826 <tr>
8827 <td>[[{{{1}}}|{{{2}}}]]
8828 </td></tr></table>
8830 !! end
8832 !! test
8833 Magic variable as template parameter
8834 !! wikitext
8835 {{paramtest|param={{SITENAME}}}}
8836 !! html
8837 <p>This is a test template with parameter MediaWiki
8838 </p>
8839 !! end
8841 !! article
8842 Template:linktest
8843 !! text
8844 [[{{{param}}}|link]]
8845 !! endarticle
8847 !! test
8848 Template parameter as link source
8849 !! wikitext
8850 {{linktest|param=Main Page}}
8851 !! html
8852 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8853 </p>
8854 !! end
8856 !!test
8857 Template-generated attribute string (k='v')
8858 !! wikitext
8859 <span {{attr_str|id|v1}}>bar</span>
8860 !! html
8861 <p><span id="v1">bar</span>
8862 </p>
8863 !!end
8865 !!article
8866 Template:paramtest2
8867 !! text
8868 including another template, {{paramtest|param={{{arg}}}}}
8869 !! endarticle
8871 !! test
8872 Template passing argument to another template
8873 !! wikitext
8874 {{paramtest2|arg='hmm'}}
8875 !! html
8876 <p>including another template, This is a test template with parameter 'hmm'
8877 </p>
8878 !! end
8880 !! article
8881 Template:Linktest2
8882 !! text
8883 Main Page
8884 !! endarticle
8886 !! test
8887 Template as link source
8888 !! wikitext
8889 [[{{linktest2}}]]
8891 [[{{linktest2}}|Main Page]]
8893 [[{{linktest2}}]]Page
8894 !! html
8895 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8896 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8897 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8898 </p>
8899 !! end
8902 !! article
8903 Template:loop1
8904 !! text
8905 {{loop2}}
8906 !! endarticle
8908 !! article
8909 Template:loop2
8910 !! text
8911 {{loop1}}
8912 !! endarticle
8914 !! test
8915 Template infinite loop
8916 !! wikitext
8917 {{loop1}}
8918 !! html
8919 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8920 </p>
8921 !! end
8923 !! test
8924 Template from main namespace
8925 !! wikitext
8926 {{:Main Page}}
8927 !! html
8928 <p>blah blah
8929 </p>
8930 !! end
8932 !! article
8933 Template:table
8934 !! text
8936 | 1 || 2
8938 | 3 || 4
8940 !! endarticle
8942 !! test
8943 BUG 529: Template with table, not included at beginning of line
8944 !! wikitext
8945 foo {{table}}
8946 !! html
8947 <p>foo 
8948 </p>
8949 <table>
8950 <tr>
8951 <td> 1 </td>
8952 <td> 2
8953 </td></tr>
8954 <tr>
8955 <td> 3 </td>
8956 <td> 4
8957 </td></tr></table>
8959 !! end
8961 !! test
8962 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8963 !! wikitext
8965 {{table}}
8966 !! html
8967 <p>foo
8968 </p>
8969 <table>
8970 <tr>
8971 <td> 1 </td>
8972 <td> 2
8973 </td></tr>
8974 <tr>
8975 <td> 3 </td>
8976 <td> 4
8977 </td></tr></table>
8979 !! end
8981 !! test
8982 BUG 41: Template parameters shown as broken links
8983 !! wikitext
8984 {{{parameter}}}
8985 !! html
8986 <p>{{{parameter}}}
8987 </p>
8988 !! end
8990 !! test
8991 Template with targets containing wikilinks
8992 !! wikitext
8993 {{[[foo]]}}
8995 {{[[{{echo|foo}}]]}}
8997 {{{{echo|[[foo}}]]}}
8998 !! html
8999 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9000 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9001 </p><p>{{[[foo}}]]
9002 </p>
9003 !! end
9005 !! article
9006 Template:MSGNW test
9007 !! text
9008 ''None'' of '''this''' should be 
9009 * interpreted
9010  but rather passed unmodified
9011 {{test}}
9012 <gallery>
9013 File:Foobar.jpg
9014 </gallery>
9015 !! endarticle
9017 # hmm, fix this or just deprecate msgnw and document its behavior?
9018 !! test
9019 msgnw keyword
9020 !! wikitext
9021 {{msgnw:MSGNW test}}
9022 !! html
9023 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
9024 &#42; interpreted
9025 &#32;but rather passed unmodified
9026 &#123;&#123;test&#125;&#125;
9027 &#60;gallery&#62;
9028 File:Foobar.jpg
9029 &#60;/gallery&#62;
9030 </p>
9031 !! end
9033 !! test
9034 int keyword
9035 !! wikitext
9036 {{int:youhavenewmessages|lots of money|not!}}
9037 !! html
9038 <p>You have lots of money (not!).
9039 </p>
9040 !! end
9042 !! article
9043 Template:Includes
9044 !! text
9045 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9046 !! endarticle
9048 !! test
9049 <includeonly> and <noinclude> being included
9050 !! wikitext
9051 {{Includes}}
9052 !! html
9053 <p>Foobar
9054 </p>
9055 !! end
9057 !! article
9058 Template:Includes2
9059 !! text
9060 <onlyinclude>Foo</onlyinclude>bar
9061 !! endarticle
9063 !! test
9064 <onlyinclude> being included
9065 !! wikitext
9066 {{Includes2}}
9067 !! html
9068 <p>Foo
9069 </p>
9070 !! end
9073 !! article
9074 Template:Includes3
9075 !! text
9076 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9077 !! endarticle
9079 !! test
9080 <onlyinclude> and <includeonly> being included
9081 !! wikitext
9082 {{Includes3}}
9083 !! html
9084 <p>Foo
9085 </p>
9086 !! end
9088 !! test
9089 <includeonly> and <noinclude> on a page
9090 !! wikitext
9091 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9092 !! html
9093 <p>Foozar
9094 </p>
9095 !! end
9097 !! test
9098 Un-closed <noinclude>
9099 !! wikitext
9100 <noinclude>
9101 !! html
9102 !! end
9104 !! test
9105 <onlyinclude> on a page
9106 !! wikitext
9107 <onlyinclude>Foo</onlyinclude>bar
9108 !! html
9109 <p>Foobar
9110 </p>
9111 !! end
9113 !! test
9114 Un-closed <onlyinclude>
9115 !! wikitext
9116 <onlyinclude>
9117 !! html
9118 !! end
9120 !!test
9121 Self-closed noinclude, includeonly, onlyinclude tags
9122 !! wikitext
9123 <noinclude />
9124 <includeonly />
9125 <onlyinclude />
9126 !! html
9127 <p><br />
9128 </p>
9129 !!end
9131 !!test
9132 Unbalanced includeonly and noinclude tags
9133 !! wikitext
9135 |a</noinclude>
9136 |b</noinclude></noinclude>
9137 |c</noinclude></includeonly>
9138 |d</includeonly></includeonly>
9140 !! html
9141 <table>
9142 <tr>
9143 <td>a
9144 </td>
9145 <td>b
9146 </td>
9147 <td>c&lt;/includeonly&gt;
9148 </td>
9149 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9150 </td></tr></table>
9152 !!end
9154 !! article
9155 Template:Includeonly section
9156 !! text
9157 <includeonly>
9158 ==Includeonly section==
9159 </includeonly>
9160 ==Section T-1==
9161 !!endarticle
9163 !! test
9164 Bug 6563: Edit link generation for section shown by <includeonly>
9165 !! wikitext
9166 {{includeonly section}}
9167 !! html
9168 <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>
9169 <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>
9171 !! end
9173 # Uses same input as the contents of [[Template:Includeonly section]]
9174 !! test
9175 Bug 6563: Section extraction for section shown by <includeonly>
9176 !! options
9177 section=T-2
9178 !! wikitext
9179 <includeonly>
9180 ==Includeonly section==
9181 </includeonly>
9182 ==Section T-2==
9183 !! html
9184 ==Section T-2==
9185 !! end
9187 !! test
9188 Bug 6563: Edit link generation for section suppressed by <includeonly>
9189 !! wikitext
9190 <includeonly>
9191 ==Includeonly section==
9192 </includeonly>
9193 ==Section 1==
9194 !! html
9195 <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>
9197 !! end
9199 !! test
9200 Bug 6563: Section extraction for section suppressed by <includeonly>
9201 !! options
9202 section=1
9203 !! wikitext
9204 <includeonly>
9205 ==Includeonly section==
9206 </includeonly>
9207 ==Section 1==
9208 !! html
9209 ==Section 1==
9210 !! end
9212 !! test
9213 Un-closed <includeonly>
9214 !! wikitext
9215 <includeonly>
9216 !! html
9217 !! end
9219 !! test
9220 Includes and comments at SOL
9221 !! wikitext
9222 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9224 <noinclude>
9225 some
9226 </noinclude>* stuff
9227 * here
9229 <includeonly>can have stuff</includeonly>=== here ===
9231 !! html/php
9232 <h2><span class="mw-headline" id="hu">hu</span></h2>
9233 <p>some
9234 </p>
9235 <ul><li> stuff</li>
9236 <li> here</li></ul>
9237 <h3><span class="mw-headline" id="here">here</span></h3>
9239 !! html/parsoid
9240 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment -->
9241 <h2 data-parsoid='{}'> hu </h2>
9243 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9245 <p data-parsoid='{}'>some</p>
9246 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
9247 <ul data-parsoid='{}'>
9248 <li data-parsoid='{}'> stuff</li>
9250 <li data-parsoid='{}'> here</li></ul>
9252 <h3 data-parsoid='{}'> here </h3>
9253 !! end
9255 # TODO: test with DOM fragment reuse!
9256 !! test
9257 Parsoid: DOM fragment reuse
9258 !! options
9259 parsoid=wt2wt,wt2html
9260 !! wikitext
9261 a{{echo|b<table></table>c}}d
9263 a{{echo|b
9264 <table></table>
9265 c}}d
9267 {{echo|a
9269 <table></table>
9272 !! html
9273 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
9274 <table></table>c"}},"i":0}}]}'>b</span>
9275 <table about="#mwt1"></table><span about="#mwt1">c</span>d
9278 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}'>ab</p><span about="#mwt2">
9279 </span>
9280 <table about="#mwt2"></table><span about="#mwt2">
9281 </span>
9282 <p about="#mwt2">cd</p>
9285 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}'>a</p><span about="#mwt3">
9287 </span>
9288 <table about="#mwt3"></table><span about="#mwt3">
9290 </span>
9291 <p about="#mwt3">b</p>
9292 !! end
9294 !! test
9295 Parsoid: Merge double tds (bug 50603)
9296 !! options
9297 parsoid
9298 !! wikitext
9300 |{{echo|{{!}} foo}}
9302 !! html
9303 <table><tbody>
9304 <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>
9305 </tbody></table>
9306 !! end
9308 !! test
9309 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9310 !! options
9311 parsoid
9312 !! wikitext
9313 {{echo|<div>}}
9315 |{{echo|{{!}} foo}}
9317 {{echo|</div>}}
9318 !! html
9319 <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}}]}'>
9320 <table><tbody>
9321 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9322 </tbody></table>
9323 </div>
9324 !! end
9327 ### <includeonly> and <noinclude> in attributes
9329 !!test
9330 0. includeonly around the entire attribute
9331 !! wikitext
9332 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9333 !! html
9334 <p><span id="v2">bar</span>
9335 </p>
9336 !!end
9338 !!test
9339 1. includeonly in html attr key
9340 !! wikitext
9341 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9342 !! html
9343 <p><span id="foo">bar</span>
9344 </p>
9345 !!end
9347 !!test
9348 2. includeonly in html attr value
9349 !! wikitext
9350 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9351 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9352 !! html
9353 <p><span id="v1">bar</span>
9354 <span id="v1">bar</span>
9355 </p>
9356 !!end
9358 !!test
9359 3. includeonly in part of an attr value
9360 !! wikitext
9361 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9362 !! html
9363 <p><span style="color:red;">bar</span>
9364 </p>
9365 !!end
9367 !!test
9368 4. includeonly in table attributes
9369 !! wikitext
9371 |- <noinclude>
9374 </noinclude>
9375 |- <includeonly>
9378 </includeonly>
9380 !! html
9381 <table>
9384 <tr>
9385 <td>a
9386 </td></tr>
9387 </table>
9389 !!end
9392 ### Token Stream Patcher tests
9394 ### These tests won't always pass wt2wt and other modes because
9395 ### on serialization, the table will be output on a new line.
9396 ### For now, we are blacklisting them, and using this to test selser.
9399 !!test
9400 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9401 !!options
9402 parsoid=wt2html,wt2wt
9403 !!wikitext
9404 {{echo|}}{| width = '100%'
9405 |foo
9407 !!html/parsoid
9408 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
9409 <table width="100%">
9410 <tbody>
9411 <tr>
9412 <td>foo</td></tr></tbody></table>
9413 !!end
9415 !!test
9416 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9417 !!options
9418 parsoid=wt2html,wt2wt
9419 !!wikitext
9420 <includeonly>a</includeonly>{| {{{b}}}
9423 !!html/parsoid
9424 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
9425 <tbody><tr><td>c</td></tr>
9426 </tbody></table>
9428 !!end
9431 ### Testing parsing of templates where a template arg
9432 ### has the same name as the template itself.
9435 !! article
9436 Template:quote
9437 !! text
9438 {{{quote|{{{1}}}}}}
9439 !! endarticle
9441 !!test
9442 Templates: Template Name/Arg clash: 1. Use of positional param
9443 !! wikitext
9444 {{quote|foo}}
9445 !! html
9446 <p>foo
9447 </p>
9448 !!end
9450 !!test
9451 Templates: Template Name/Arg clash: 2. Use of named param
9452 !! wikitext
9453 {{quote|quote=foo}}
9454 !! html
9455 <p>foo
9456 </p>
9457 !!end
9459 !!test
9460 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9461 !! wikitext
9462 {{quote|quote}}
9463 !! html
9464 <p>quote
9465 </p>
9466 !!end
9469 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9472 !!test
9473 Templates: 1. Simple use
9474 !! wikitext
9475 {{echo|Foo}}
9476 !! html
9477 <p>Foo
9478 </p>
9479 !!end
9481 !!test
9482 Templates: 2. Inside a block tag
9483 !! wikitext
9484 <div>{{echo|Foo}}</div>
9485 <blockquote>{{echo|Foo}}</blockquote>
9486 !! html
9487 <div>Foo</div>
9488 <blockquote>Foo</blockquote>
9490 !! html+tidy
9491 <div>Foo</div>
9492 <blockquote>
9493 <p>Foo</p>
9494 </blockquote>
9495 !!end
9497 !!test
9498 Templates: P-wrapping: 1a. Templates on consecutive lines
9499 !! wikitext
9500 {{echo|Foo}}
9501 {{echo|bar}}
9502 !! html
9503 <p>Foo
9505 </p>
9506 !!end
9508 !!test
9509 Templates: P-wrapping: 1b. Templates on consecutive lines
9510 !! wikitext
9513 {{echo|bar}}
9514 {{echo|baz}}
9515 !! html
9516 <p>Foo
9517 </p><p>bar
9519 </p>
9520 !!end
9522 !!test
9523 Templates: P-wrapping: 1c. Templates on consecutive lines
9524 !! wikitext
9525 {{echo|Foo}}
9526 {{echo|bar}} <div>baz</div>
9527 !! html
9528 <p>Foo
9529 </p>
9530 bar <div>baz</div>
9532 !! html+tidy
9533 <p>Foo</p>
9534 <p>bar</p>
9535 <div>baz</div>
9536 !! end
9538 !!test
9539 Templates: P-wrapping: 1d. Template preceded by comment-only line
9540 !!options
9541 parsoid
9542 !! wikitext
9543 <!-- foo -->
9544 {{echo|Bar}}
9545 !! html
9546 <!-- foo -->
9548 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9549 !!end
9551 !!test
9552 Templates: Inline Text: 1. Multiple template uses
9553 !! wikitext
9554 {{echo|Foo}}bar{{echo|baz}}
9555 !! html
9556 <p>Foobarbaz
9557 </p>
9558 !!end
9560 !!test
9561 Templates: Inline Text: 2. Back-to-back template uses
9562 !! wikitext
9563 {{echo|Foo}}{{echo|bar}}
9564 !! html
9565 <p>Foobar
9566 </p>
9567 !!end
9569 !!test
9570 Templates: Block Tags: 1. Multiple template uses
9571 !! wikitext
9572 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9573 !! html
9574 <div>Foo</div><div>bar</div><div>baz</div>
9576 !!end
9578 !!test
9579 Templates: Block Tags: 2. Back-to-back template uses
9580 !! wikitext
9581 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9582 !! html
9583 <div>Foo</div><div>bar</div>
9585 !!end
9587 # This is an edge case relating to paragraph wrapping.
9588 !!test
9589 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
9590 !! wikitext
9591 {{echo|a
9592 b</p>}}
9593 !! html/parsoid
9594 <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
9595 b</p><p></p>
9596 !!end
9598 !!test
9599 Templates: Links: 1. Simple example
9600 !! wikitext
9601 {{echo|[[Foo|bar]]}}
9602 !! html
9603 <p><a href="/wiki/Foo" title="Foo">bar</a>
9604 </p>
9605 !!end
9607 !!test
9608 Templates: Links: 2. Generation of link href
9609 !! wikitext
9610 [[{{echo|Foo}}|bar]]
9611 !! html
9612 <p><a href="/wiki/Foo" title="Foo">bar</a>
9613 </p>
9614 !!end
9616 !!test
9617 Templates: Links: 3. Generation of part of a link href
9618 !! wikitext
9619 [[Fo{{echo|o}}|bar]]
9621 [[Foo{{echo|bar}}]]
9623 [[Foo{{echo|bar}}baz]]
9625 [[Foo{{echo|bar}}|bar]]
9627 [[:Foo{{echo|bar}}]]
9629 [[:Foo{{echo|bar}}|bar]]
9630 !! html
9631 <p><a href="/wiki/Foo" title="Foo">bar</a>
9632 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9633 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9634 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9635 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9636 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9637 </p>
9638 !!end
9640 !!test
9641 Templates: Links: 4. Multiple templates generating link href
9642 !! wikitext
9643 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9644 !! html
9645 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9646 </p>
9647 !!end
9649 !!test
9650 Templates: Links: 5. Generation of link text
9651 !! wikitext
9652 [[Foo|{{echo|bar}}]]
9653 !! html
9654 <p><a href="/wiki/Foo" title="Foo">bar</a>
9655 </p>
9656 !!end
9658 !!test
9659 Templates: Links: 5. Nested templates (only outermost template should be marked)
9660 !! wikitext
9661 {{echo|[[{{echo|Foo}}|bar]]}}
9662 !! html
9663 <p><a href="/wiki/Foo" title="Foo">bar</a>
9664 </p>
9665 !!end
9667 !!test
9668 Templates: HTML Tag: 1. Generation of HTML attr. key
9669 !! wikitext
9670 <div {{echo|style}}="color:red;">foo</div>
9671 !! html
9672 <div style="color:red;">foo</div>
9674 !!end
9676 !!test
9677 Templates: HTML Tag: 2. Generation of HTML attr. value
9678 !! wikitext
9679 <div style={{echo|'color:red;'}}>foo</div>
9680 !! html
9681 <div style="color:red;">foo</div>
9683 !!end
9685 !!test
9686 Templates: HTML Tag: 3. Generation of HTML attr key and value
9687 !! wikitext
9688 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9689 !! html
9690 <div style="color:red;">foo</div>
9692 !!end
9694 !!test
9695 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9696 !! wikitext
9697 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9698 !! html
9699 <div title="This is a long title with just one piece templated">foo</div>
9701 !!end
9703 !!test
9704 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9705 !! wikitext
9706 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9707 !! html
9708 <div title="This is a long title with just one piece templated">foo</div>
9710 !!end
9712 !!test
9713 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9714 !! wikitext
9715 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9716 !! html
9717 <div title="This is a long title with just one piece templated">foo</div>
9719 !!end
9721 !!test
9722 Templates: HTML Tag: 7. Generation of partial attribute key string
9723 !! wikitext
9724 <div st{{echo|yle}}="color:red;">foo</div>
9725 !! html
9726 <div style="color:red;">foo</div>
9728 !!end
9730 !!test
9731 Templates: HTML Tables: 1. Generating start of a HTML table
9732 !! wikitext
9733 {{echo|<table><tr><td>foo</td>}}</tr></table>
9734 !! html
9735 <table><tr><td>foo</td></tr></table>
9737 !!end
9739 !!test
9740 Templates: HTML Tables: 2a. Generating middle of a HTML table
9741 !! wikitext
9742 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9743 !! html
9744 <table><tr><td>foo</td></tr></table>
9746 !!end
9748 !!test
9749 Templates: HTML Tables: 2b. Generating middle of a HTML table
9750 !! wikitext
9751 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9752 !! html
9753 <table><tr><td>foo</td></tr></table>
9755 !!end
9757 !!test
9758 Templates: HTML Tables: 3. Generating end of a HTML table
9759 !! wikitext
9760 <table><tr>{{echo|<td>foo</td></tr></table>}}
9761 !! html
9762 <table><tr><td>foo</td></tr></table>
9764 !!end
9766 !!test
9767 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9768 !! wikitext
9769 {{echo|<table>}}<tr><td>foo</td></tr></table>
9770 !! html
9771 <table><tr><td>foo</td></tr></table>
9773 !!end
9775 !!test
9776 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9777 !! wikitext
9778 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9779 !! html
9780 <table><tr><td>foo</td></tr></table>
9782 !!end
9784 !!test
9785 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9786 !! wikitext
9787 <table><tr>{{echo|<td>}}foo</td></tr></table>
9788 !! html
9789 <table><tr><td>foo</td></tr></table>
9791 !!end
9793 !!test
9794 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9795 !! wikitext
9796 <table><tr><td>foo{{echo|</td>}}</tr></table>
9797 !! html
9798 <table><tr><td>foo</td></tr></table>
9800 !!end
9802 !!test
9803 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9804 !! wikitext
9805 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9806 !! html
9807 <table><tr><td>foo</td></tr></table>
9809 !!end
9811 !!test
9812 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9813 !! wikitext
9814 <table><tr><td>foo</td></tr>{{echo|</table>}}
9815 !! html
9816 <table><tr><td>foo</td></tr></table>
9818 !!end
9820 !!test
9821 Templates: HTML Tables: 5. Proper fostering of categories from inside
9822 !!options
9823 parsoid=wt2html,wt2wt
9824 !! wikitext
9825 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9826 <!--Two categories (Bug 50330)-->
9827 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9828 !! html
9829 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9830 <!--Two categories (Bug 50330)-->
9831 <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>
9832 !!end
9834 !!test
9835 Templates: Wiki Tables: 1a. Fostering of entire template content
9836 !! wikitext
9838 {{echo|a}}
9840 !! html
9841 <table>
9843 <tr><td></td></tr></table>
9845 !! html+tidy
9846 <p>a</p>
9847 <table>
9848 <tr>
9849 <td></td>
9850 </tr>
9851 </table>
9852 !! end
9854 !!test
9855 Templates: Wiki Tables: 1b. Fostering of entire template content
9856 !! wikitext
9858 {{echo|<div>}}
9860 {{echo|</div>}}
9862 !! html
9863 <table>
9864 <div>
9865 <p>foo
9866 </p>
9867 </div>
9868 <tr><td></td></tr></table>
9870 !! html+tidy
9871 <div>
9872 <p>foo</p>
9873 </div>
9874 <table>
9875 <tr>
9876 <td></td>
9877 </tr>
9878 </table>
9879 !! end
9881 !!test
9882 Templates: Wiki Tables: 2. Fostering of partial template content
9883 !! wikitext
9885 {{echo|a
9886 <div>b</div>}}
9888 !! html
9889 <table>
9891 <div>b</div>
9892 <tr><td></td></tr></table>
9894 !! html+tidy
9895 <p>a</p>
9896 <div>b</div>
9897 <table>
9898 <tr>
9899 <td></td>
9900 </tr>
9901 </table>
9902 !! end
9904 !!test
9905 Templates: Wiki Tables: 3. td-content via multiple templates
9906 !! wikitext
9908 {{echo|{{pipe}}a}}{{echo|b}}
9910 !! html
9911 <table>
9912 <tr>
9913 <td>ab
9914 </td></tr></table>
9916 !!end
9918 !!test
9919 Templates: Wiki Tables: 4. Templated tags, no content
9920 !! wikitext
9921 {{tbl-start}}
9922 {{tbl-end}}
9923 !! html
9924 <table>
9925 <tr><td></td></tr></table>
9927 !!end
9929 !!test
9930 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9931 !! wikitext
9932 {{tbl-start}}
9933 |foo
9934 {{tbl-end}}
9935 !! html
9936 <table>
9937 <tr>
9938 <td>foo
9939 </td></tr></table>
9941 !!end
9943 !!test
9944 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9945 !! wikitext
9946 {{tbl-start}}
9947 {{!}}foo
9948 {{tbl-end}}
9949 !! html
9950 <table>
9951 <tr>
9952 <td>foo
9953 </td></tr></table>
9955 !!end
9957 !!test
9958 Templates: Lists: Multi-line list-items via templates
9959 !! wikitext
9960 *{{echo|a {{nonexistent|
9961 unused}}}}
9962 *{{echo|b {{nonexistent|
9963 unused}}}}
9964 !! html
9965 <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>
9966 <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>
9968 !!end
9970 !!test
9971 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9972 !! wikitext
9973 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9974 !! html
9975 <p><i>ab</i>c<i>d</i>e
9976 </p>
9977 !!end
9979 !!test
9980 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9981 (PHP parser generates misnested html)
9982 !! wikitext
9983 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9984 !! html/parsoid
9985 <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>
9986 !!end
9988 !!test
9989 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9990 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9991 !! options
9992 parsoid=wt2html,wt2wt
9993 !! wikitext
9994 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9995 !! html
9996 <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>
9997 <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>
9998 <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>
9999 !!end
10001 !!test
10002 Templates: Ugly nesting: 4. Divs opened/closed across templates
10003 !! wikitext
10004 a<div>b{{echo|c</div>d}}e
10005 !! html
10006 a<div>bc</div>de
10008 !! html+tidy
10009 <p>a</p>
10010 <div>bc</div>
10011 <p>de</p>
10012 !! end
10014 !!test
10015 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10016 (Parsoid-centric)
10017 !! options
10018 parsoid
10019 !! wikitext
10021 |{{echo|foo</table>}}
10022 |bar
10024 !! html
10025 <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|}"]}'>
10027 <tbody>
10028 <tr>
10029 <td>foo</td></tr></tbody></table><span about="#mwt1">
10030 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10031 |}</span>
10032 !!end
10034 !!test
10035 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10036 (Parsoid-centric)
10037 !! options
10038 parsoid
10039 !! wikitext
10040 <table>
10041   <tr>
10042     <td>
10043     <table>
10044       <tr>
10045         <td>1. {{echo|foo </table>}}</td>
10046         <td> bar </td>
10047         <td>2. {{echo|baz </table>}}</td>
10048       </tr>
10049       <tr>
10050         <td>abc</td>
10051       </tr>
10052     </table>
10053     </td>
10054   </tr>
10055   <tr>
10056     <td>xyz</td>
10057   </tr>
10058 </table>
10059 !! html
10060 <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>"]}'>
10061   <tbody><tr>
10062     <td>
10063     <table>
10064       <tbody><tr>
10065         <td>1. foo </td></tr></tbody></table></td>
10066         <td> bar </td>
10067         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10068       </span><span about="#mwt2">
10069       </span><span about="#mwt2">
10070         </span><span about="#mwt2">abc</span><span about="#mwt2">
10071       </span><span about="#mwt2">
10072     </span><span about="#mwt2">
10073     </span><span about="#mwt2">
10074   </span><span about="#mwt2">
10075   </span><span about="#mwt2">
10076     </span><span about="#mwt2">xyz</span><span about="#mwt2">
10077   </span><span about="#mwt2">
10078 </span>
10079 !!end
10081 !! test
10082 Templates: Ugly templates: 3. newline-only template parameter
10083 !! wikitext
10084 foo {{echo|
10086 !! html
10087 <p>foo 
10088 </p>
10089 !! end
10091 # This looks like a bug: a single newline triggers p/br for some reason.
10092 !! test
10093 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10094 !! wikitext
10095 {{echo|
10097 !! html
10098 <p><br />
10099 </p>
10100 !! end
10102 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10103 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10104 !! test
10105 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10106 !! wikitext
10107 {{echo|<table>}}
10108 {{echo|<div>foo}}
10109 {{echo|</table>}}
10110 !! html/parsoid
10111 <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
10112 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10113 </table>
10114 !! end
10116 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10117 # that are "identical" and generate nesting cycles in the algorithm
10118 !! test
10119 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10120 !! wikitext
10121 {{echo|<table><tr><td><table>}}
10122 {{echo|<div>}}
10123 {{echo|</div>}}
10124 !! html/parsoid
10125 <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"}'>
10126 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10127 </table></td></tr></tbody></table>
10128 !! end
10130 !!test
10131 Parser Functions: 1. Simple example
10132 !! wikitext
10133 {{uc:foo}}
10134 !! html
10135 <p>FOO
10136 </p>
10137 !!end
10139 !!test
10140 Parser Functions: 2. Nested use (only outermost should be marked up)
10141 !! wikitext
10142 {{uc:{{lc:FOO}}}}
10143 !! html
10144 <p>FOO
10145 </p>
10146 !!end
10149 ### Pre-save transform tests
10151 !! test
10152 pre-save transform: subst:
10153 !! options
10155 !! wikitext
10156 {{subst:test}}
10157 !! html
10158 This is a test template
10159 !! end
10161 !! test
10162 pre-save transform: normal template
10163 !! options
10165 !! wikitext
10166 {{test}}
10167 !! html
10168 {{test}}
10169 !! end
10171 !! test
10172 pre-save transform: nonexistent template
10173 !! options
10175 !! wikitext
10176 {{thistemplatedoesnotexist}}
10177 !! html
10178 {{thistemplatedoesnotexist}}
10179 !! end
10182 !! test
10183 pre-save transform: subst magic variables
10184 !! options
10186 !! wikitext
10187 {{subst:SITENAME}}
10188 !! html
10189 MediaWiki
10190 !! end
10192 # This is bug 89, which I fixed. -- wtm
10193 !! test
10194 pre-save transform: subst: templates with parameters
10195 !! options
10197 !! wikitext
10198 {{subst:paramtest|param="something else"}}
10199 !! html
10200 This is a test template with parameter "something else"
10201 !! end
10203 !! article
10204 Template:nowikitest
10205 !! text
10206 <nowiki>'''not wiki'''</nowiki>
10207 !! endarticle
10209 !! test
10210 pre-save transform: nowiki in subst (bug 1188)
10211 !! options
10213 !! wikitext
10214 {{subst:nowikitest}}
10215 !! html
10216 <nowiki>'''not wiki'''</nowiki>
10217 !! end
10220 !! article
10221 Template:commenttest
10222 !! text
10223 This template has <!-- a comment --> in it.
10224 !! endarticle
10226 !! test
10227 pre-save transform: comment in subst (bug 1936)
10228 !! options
10230 !! wikitext
10231 {{subst:commenttest}}
10232 !! html
10233 This template has <!-- a comment --> in it.
10234 !! end
10236 !! test
10237 pre-save transform: unclosed tag
10238 !! options
10239 pst noxml
10240 !! wikitext
10241 <nowiki>'''not wiki'''
10242 !! html
10243 <nowiki>'''not wiki'''
10244 !! end
10246 !! test
10247 pre-save transform: mixed tag case
10248 !! options
10249 pst noxml
10250 !! wikitext
10251 <NOwiki>'''not wiki'''</noWIKI>
10252 !! html
10253 <NOwiki>'''not wiki'''</noWIKI>
10254 !! end
10256 !! test
10257 pre-save transform: unclosed comment in <nowiki>
10258 !! options
10259 pst noxml
10260 !! wikitext
10261 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10262 !! html
10263 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10264 !!end
10266 # Leading @ in this template definition works around a limitation
10267 # in parsoid's parserTests which otherwise strips the <span> from the
10268 # result (confusing it for a template wrapper)
10269 !! article
10270 Template:dangerous
10271 !!text
10272 @<span onmouseover="alert('crap')">Oh no</span>
10273 !!endarticle
10275 !!test
10276 (confirming safety of fix for subst bug 1936)
10277 !! wikitext
10278 {{Template:dangerous}}
10279 !! html
10280 <p>@<span>Oh no</span>
10281 </p>
10282 !! end
10284 !! test
10285 pre-save transform: comment containing gallery (bug 5024)
10286 !! options
10288 !! wikitext
10289 <!-- <gallery>data</gallery> -->
10290 !! html
10291 <!-- <gallery>data</gallery> -->
10292 !!end
10294 !! test
10295 pre-save transform: comment containing extension
10296 !! options
10298 !! wikitext
10299 <!-- <tag>data</tag> -->
10300 !! html
10301 <!-- <tag>data</tag> -->
10302 !!end
10304 !! test
10305 pre-save transform: comment containing nowiki
10306 !! options
10308 !! wikitext
10309 <!-- <nowiki>data</nowiki> -->
10310 !! html
10311 <!-- <nowiki>data</nowiki> -->
10312 !!end
10314 !! test
10315 pre-save transform: <noinclude> in subst (bug 3298)
10316 !! options
10318 !! wikitext
10319 {{subst:Includes}}
10320 !! html
10321 Foobar
10322 !! end
10324 !! test
10325 pre-save transform: <onlyinclude> in subst (bug 3298)
10326 !! options
10328 !! wikitext
10329 {{subst:Includes2}}
10330 !! html
10332 !! end
10334 !! article
10335 Template:SubstTest
10336 !!text
10337 {{<includeonly>subst:</includeonly>Includes}}
10338 !! endarticle
10340 !! article
10341 Template:SafeSubstTest
10342 !! text
10343 {{<includeonly>safesubst:</includeonly>Includes}}
10344 !! endarticle
10346 !! test
10347 bug 22297: safesubst: works during PST
10348 !! options
10350 !! wikitext
10351 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10352 !! html
10353 FoobarFoobar
10354 !! end
10356 !! test
10357 bug 22297: safesubst: works during normal parse
10358 !! wikitext
10359 {{SafeSubstTest}}
10360 !! html
10361 <p>Foobar
10362 </p>
10363 !! end
10365 !! test
10366 subst: does not work during normal parse
10367 !! wikitext
10368 {{SubstTest}}
10369 !! html
10370 <p>{{subst:Includes}}
10371 </p>
10372 !! end
10374 !! test
10375 pre-save transform: context links ("pipe trick")
10376 !! options
10378 !! wikitext
10379 [[Article (context)|]]
10380 [[Bar:Article|]]
10381 [[:Bar:Article|]]
10382 [[Bar:Article (context)|]]
10383 [[:Bar:Article (context)|]]
10384 [[|Article]]
10385 [[|Article (context)]]
10386 [[Bar:X (Y) Z|]]
10387 [[:Bar:X (Y) Z|]]
10388 !! html
10389 [[Article (context)|Article]]
10390 [[Bar:Article|Article]]
10391 [[:Bar:Article|Article]]
10392 [[Bar:Article (context)|Article]]
10393 [[:Bar:Article (context)|Article]]
10394 [[Article]]
10395 [[Article (context)]]
10396 [[Bar:X (Y) Z|X (Y) Z]]
10397 [[:Bar:X (Y) Z|X (Y) Z]]
10398 !! end
10400 !! test
10401 pre-save transform: context links ("pipe trick") with interwiki prefix
10402 !! options
10404 !! wikitext
10405 [[interwiki:Article|]]
10406 [[:interwiki:Article|]]
10407 [[interwiki:Bar:Article|]]
10408 [[:interwiki:Bar:Article|]]
10409 !! html
10410 [[interwiki:Article|Article]]
10411 [[:interwiki:Article|Article]]
10412 [[interwiki:Bar:Article|Bar:Article]]
10413 [[:interwiki:Bar:Article|Bar:Article]]
10414 !! end
10416 !! test
10417 pre-save transform: context links ("pipe trick") with parens in title
10418 !! options
10419 pst title=[[Somearticle (context)]]
10420 !! wikitext
10421 [[|Article]]
10422 !! html
10423 [[Article (context)|Article]]
10424 !! end
10426 !! test
10427 pre-save transform: context links ("pipe trick") with comma in title
10428 !! options
10429 pst title=[[Someplace, Somewhere]]
10430 !! wikitext
10431 [[|Otherplace]]
10432 [[Otherplace, Elsewhere|]]
10433 [[Otherplace, Elsewhere, Anywhere|]]
10434 !! html
10435 [[Otherplace, Somewhere|Otherplace]]
10436 [[Otherplace, Elsewhere|Otherplace]]
10437 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10438 !! end
10440 !! test
10441 pre-save transform: context links ("pipe trick") with parens and comma
10442 !! options
10443 pst title=[[Someplace (IGNORED), Somewhere]]
10444 !! wikitext
10445 [[|Otherplace]]
10446 [[Otherplace (place), Elsewhere|]]
10447 !! html
10448 [[Otherplace, Somewhere|Otherplace]]
10449 [[Otherplace (place), Elsewhere|Otherplace]]
10450 !! end
10452 !! test
10453 pre-save transform: context links ("pipe trick") with comma and parens
10454 !! options
10455 pst title=[[Who, me? (context)]]
10456 !! wikitext
10457 [[|Yes, you.]]
10458 [[Me, Myself, and I (1937 song)|]]
10459 !! html
10460 [[Yes, you. (context)|Yes, you.]]
10461 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10462 !! end
10464 !! test
10465 pre-save transform: context links ("pipe trick") with namespace
10466 !! options
10467 pst title=[[Ns:Somearticle]]
10468 !! wikitext
10469 [[|Article]]
10470 !! html
10471 [[Ns:Article|Article]]
10472 !! end
10474 !! test
10475 pre-save transform: context links ("pipe trick") with namespace and parens
10476 !! options
10477 pst title=[[Ns:Somearticle (context)]]
10478 !! wikitext
10479 [[|Article]]
10480 !! html
10481 [[Ns:Article (context)|Article]]
10482 !! end
10484 !! test
10485 pre-save transform: context links ("pipe trick") with namespace and comma
10486 !! options
10487 pst title=[[Ns:Somearticle, Context, Whatever]]
10488 !! wikitext
10489 [[|Article]]
10490 !! html
10491 [[Ns:Article, Context, Whatever|Article]]
10492 !! end
10494 !! test
10495 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10496 !! options
10497 pst title=[[Ns:Somearticle, Context (context)]]
10498 !! wikitext
10499 [[|Article]]
10500 !! html
10501 [[Ns:Article (context)|Article]]
10502 !! end
10504 !! test
10505 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10506 !! options
10507 pst title=[[Ns:Somearticle (IGNORED), Context]]
10508 !! wikitext
10509 [[|Article]]
10510 !! html
10511 [[Ns:Article, Context|Article]]
10512 !! end
10514 !! test
10515 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10516 !! options
10518 !! wikitext
10519 [[Article(context)|]]
10520 [[Bar:Article(context)|]]
10521 [[:Bar:Article(context)|]]
10522 [[|Article(context)]]
10523 [[Bar:X(Y)Z|]]
10524 [[:Bar:X(Y)Z|]]
10525 !! html
10526 [[Article(context)|Article]]
10527 [[Bar:Article(context)|Article]]
10528 [[:Bar:Article(context)|Article]]
10529 [[Article(context)]]
10530 [[Bar:X(Y)Z|X(Y)Z]]
10531 [[:Bar:X(Y)Z|X(Y)Z]]
10532 !! end
10534 !! test
10535 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10536 !! options
10538 !! wikitext
10539 [[Article (context)|]]
10540 [[Bar:Article (context)|]]
10541 [[:Bar:Article (context)|]]
10542 [[|Article (context)]]
10543 [[Bar:X (Y) Z|]]
10544 [[:Bar:X (Y) Z|]]
10545 !! html
10546 [[Article (context)|Article]]
10547 [[Bar:Article (context)|Article]]
10548 [[:Bar:Article (context)|Article]]
10549 [[Article (context)]]
10550 [[Bar:X (Y) Z|X (Y) Z]]
10551 [[:Bar:X (Y) Z|X (Y) Z]]
10552 !! end
10554 !! test
10555 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10556 !! options
10558 !! wikitext
10559 [[Article(context)|]]
10560 [[Bar:Article(context)|]]
10561 [[:Bar:Article(context)|]]
10562 [[|Article(context)]]
10563 [[Bar:X(Y)Z|]]
10564 [[:Bar:X(Y)Z|]]
10565 !! html
10566 [[Article(context)|Article]]
10567 [[Bar:Article(context)|Article]]
10568 [[:Bar:Article(context)|Article]]
10569 [[Article(context)]]
10570 [[Bar:X(Y)Z|X(Y)Z]]
10571 [[:Bar:X(Y)Z|X(Y)Z]]
10572 !! end
10574 !! test
10575 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10576 !! options
10578 !! wikitext
10579 [[Article (context), context|]]
10580 [[Article (context),context|]]
10581 [[Bar:Article (context), context|]]
10582 [[Bar:Article (context),context|]]
10583 [[:Bar:Article (context), context|]]
10584 [[:Bar:Article (context),context|]]
10585 !! html
10586 [[Article (context), context|Article]]
10587 [[Article (context),context|Article]]
10588 [[Bar:Article (context), context|Article]]
10589 [[Bar:Article (context),context|Article]]
10590 [[:Bar:Article (context), context|Article]]
10591 [[:Bar:Article (context),context|Article]]
10592 !! end
10594 !! test
10595 pre-save transform: trim trailing empty lines
10596 !! options
10598 !! wikitext
10599 Empty lines are trimmed
10604 !! html
10605 Empty lines are trimmed
10606 !! end
10608 !! test
10609 pre-save transform: Signature expansion
10610 !! options
10612 !! wikitext
10613 * ~~~
10614 * <noinclude>~~~</noinclude>
10615 * <includeonly>~~~</includeonly>
10616 * <onlyinclude>~~~</onlyinclude>
10617 !! html
10618 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10619 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10620 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10621 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10622 !! end
10625 !! test
10626 pre-save transform: Signature expansion in nowiki tags (bug 93)
10627 !! options
10628 pst disabled
10629 !! wikitext
10630 Shall not expand:
10632 <nowiki>~~~~</nowiki>
10634 <includeonly><nowiki>~~~~</nowiki></includeonly>
10636 <noinclude><nowiki>~~~~</nowiki></noinclude>
10638 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10640 {{subst:Foo}} shall be converted to FOO
10642 As well as inside noinclude/onlyinclude
10643 <noinclude>{{subst:Foo}}</noinclude>
10644 <onlyinclude>{{subst:Foo}}</onlyinclude>
10646 But not inside includeonly
10647 <includeonly>{{subst:Foo}}</includeonly>
10648 !! html
10649 Shall not expand:
10651 <nowiki>~~~~</nowiki>
10653 <includeonly><nowiki>~~~~</nowiki></includeonly>
10655 <noinclude><nowiki>~~~~</nowiki></noinclude>
10657 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10659 FOO shall be converted to FOO
10661 As well as inside noinclude/onlyinclude
10662 <noinclude>FOO</noinclude>
10663 <onlyinclude>FOO</onlyinclude>
10665 But not inside includeonly
10666 <includeonly>{{subst:Foo}}</includeonly>
10667 !! end
10669 !! test
10670 Parsoid: Recognize nowiki with trailing space in tags
10671 !! options
10672 parsoid=wt2html
10673 !! wikitext
10674 <nowiki ><div>[[foo]]</nowiki >
10676 a<nowiki / >b
10678 c<nowiki />d
10680 e<nowiki/ >f
10681 !! html
10682 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10683 <p>ab</p>
10684 <p>cd</p>
10685 <p>ef</p>
10686 !! end
10688 !! test
10689 Parsoid: Recognize nowiki with odd capitalization
10690 !! options
10691 parsoid=wt2html
10692 !! wikitext
10693 <noWikI ><div>[[foo]]</Nowiki >
10694 !! html
10695 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10696 !! end
10699 !! test
10700 Parsoid: Escape nowiki with trailing space in tags
10701 !! options
10702 parsoid=html2wt
10703 !! wikitext
10704 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10706 a&lt;nowiki /&gt;b
10708 c&lt;nowiki/ &gt;d
10709 !! html
10710 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10711 <p>a&lt;nowiki /&gt;b</p>
10712 <p>c&lt;nowiki/ &gt;d</p>
10713 !! end
10715 !! test
10716 Parsoid: Escape weird noWikI capitalizations
10717 !! options
10718 parsoid=html2wt
10719 !! wikitext
10720 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10721 !! html
10722 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10723 !! end
10726 ### Message transform tests
10728 !! test
10729 message transform: magic variables
10730 !! options
10732 !! wikitext
10733 {{SITENAME}}
10734 !! html
10735 MediaWiki
10736 !! end
10738 !! test
10739 message transform: should not transform wiki markup
10740 !! options
10742 !! wikitext
10743 ''test''
10744 !! html
10745 ''test''
10746 !! end
10748 !! test
10749 message transform: <noinclude> in transcluded template (bug 4926)
10750 !! options
10752 !! wikitext
10753 {{Includes}}
10754 !! html
10755 Foobar
10756 !! end
10758 !! test
10759 message transform: <onlyinclude> in transcluded template (bug 4926)
10760 !! options
10762 !! wikitext
10763 {{Includes2}}
10764 !! html
10766 !! end
10768 !! test
10769 {{#special:}} page name, known
10770 !! options
10772 !! wikitext
10773 {{#special:Recentchanges}}
10774 !! html
10775 Special:RecentChanges
10776 !! end
10778 !! test
10779 {{#special:}} page name with subpage, known
10780 !! options
10782 !! wikitext
10783 {{#special:Recentchanges/param}}
10784 !! html
10785 Special:RecentChanges/param
10786 !! end
10788 !! test
10789 {{#special:}} page name, unknown
10790 !! options
10792 !! wikitext
10793 {{#special:foobar nonexistent}}
10794 !! html
10795 Special:Foobar nonexistent
10796 !! end
10798 !! test
10799 {{#speciale:}} page name, known
10800 !! options
10802 !! wikitext
10803 {{#speciale:Recentchanges}}
10804 !! html
10805 Special:RecentChanges
10806 !! end
10808 !! test
10809 {{#speciale:}} page name with subpage, known
10810 !! options
10812 !! wikitext
10813 {{#speciale:Recentchanges/param}}
10814 !! html
10815 Special:RecentChanges/param
10816 !! end
10818 !! test
10819 {{#speciale:}} page name, unknown
10820 !! options
10822 !! wikitext
10823 {{#speciale:foobar nonexistent}}
10824 !! html
10825 Special:Foobar_nonexistent
10826 !! end
10829 ### Images
10831 ### For Parsoid-specific tests, see
10832 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10834 !! test
10835 Simple image
10836 !! options
10837 parsoid=wt2html,wt2wt,html2html
10838 !! wikitext
10839 [[Image:foobar.jpg]]
10840 !! html/php
10841 <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>
10842 </p>
10843 !! html/parsoid
10844 <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>
10845 </p>
10846 !! end
10848 !! test
10849 Simple image (using File: namespace, now canonical)
10850 !! wikitext
10851 [[File:Foobar.jpg]]
10852 !! html/php
10853 <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>
10854 </p>
10855 !! html/parsoid
10856 <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>
10857 </p>
10858 !! end
10860 !! test
10861 Right-aligned image
10862 !! wikitext
10863 [[File:Foobar.jpg|right]]
10864 !! html/php
10865 <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>
10867 !! html/parsoid
10868 <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>
10869 !! end
10871 !! test
10872 Image with caption
10873 !! wikitext
10874 [[File:Foobar.jpg|right|Caption text]]
10875 !! html/php
10876 <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>
10878 !! html/parsoid
10879 <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>
10880 !! end
10882 !! test
10883 Image with caption, bug 53312 #1
10884 !! wikitext
10885 [[File:Foobar.jpg|right|Caption page stuff]]
10886 !! html/php
10887 <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>
10889 !! html/parsoid
10890 <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>
10891 !! end
10893 !! test
10894 Image with caption, bug 53312 #2
10895 !! wikitext
10896 [[File:Foobar.jpg|right|Caption page=]]
10897 !! html/php
10898 <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>
10900 !! html/parsoid
10901 <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>
10902 !! end
10904 !! test
10905 Image with caption, bug 53312 #3
10906 !! wikitext
10907 [[File:Foobar.jpg|right|Caption page=stuff]]
10908 !! html/php
10909 <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>
10911 !! html/parsoid
10912 <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>
10913 !! end
10915 !! test
10916 Allow empty links in image captions (Bug 60753)
10917 !! options
10918 thumbsize=220
10919 !! wikitext
10920 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10921 [[]]
10922 [[Link2]]
10924 !! html/php
10925 <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>
10927 !! html/parsoid
10928 <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"}],"dsr":[0,59,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[2,null,null,null]}'><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 data-parsoid='{"dsr":[null,57,null,null]}'>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
10929 [[]]
10930 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10931 </figcaption></figure>
10932 !! end
10934 !! test
10935 Link with empty target
10936 !! wikitext
10937 [[]]
10938 !! html
10939 <p>[[]]
10940 </p>
10941 !! end
10943 !! test
10944 Image with empty attribute
10945 !! options
10946 parsoid=wt2html,wt2wt,html2html
10947 !! wikitext
10948 [[File:Foobar.jpg|right||Caption text]]
10949 !! html/php
10950 <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>
10952 !! html/parsoid
10953 <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>
10954 !! end
10956 !! test
10957 1. Block image with individual attributes from templates
10958 !! wikitext
10959 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10960 !! html/php
10961 <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>
10963 !! html/parsoid
10964 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10965 !! end
10967 !! test
10968 2. Block Image with individual attributes from templates
10969 !! wikitext
10970 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10971 !! html/php
10972 <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>
10974 !! html/parsoid
10975 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10976 !! end
10978 !! test
10979 3. Inline image with individual attributes from templates
10980 !! wikitext
10981 [[File:Foobar.jpg|{{echo|50px}}]]
10982 !! html/php
10983 <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>
10984 </p>
10985 !! html/parsoid
10986 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" 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]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><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>
10987 !! end
10989 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10990 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10991 !! test
10992 Image with multiple attributes from the same template
10993 !! wikitext
10994 [[File:Foobar.jpg|{{image_attribs}}]]
10995 !! html/php
10996 <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>
10998 !! html/parsoid
10999 <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>
11000 !! end
11002 # Parsoid's output here is broken (incorrect p-wrapping); see bug 64901.
11003 !! test
11004 Image with link tails
11005 !! options
11006 thumbsize=220
11007 !! wikitext
11008 123[[File:Foobar.jpg]]456
11009 123[[File:Foobar.jpg|right]]456
11010 123[[File:Foobar.jpg|thumb]]456
11011 !! html/php
11012 <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
11013 </p>
11014 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
11015 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
11017 !! html/php+tidy
11018 <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>
11019 <p>123</p>
11020 <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>
11021 <p>456 123</p>
11022 <div class="thumb tright">
11023 <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>
11024 <div class="thumbcaption">
11025 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11026 </div>
11027 </div>
11028 </div>
11029 <p>456</p>
11030 !! html/parsoid
11031 <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>
11032 123<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>456
11033 123<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>456
11034 !! end
11036 !! test
11037 Image with multiple captions -- only last one is accepted
11038 !! wikitext
11039 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11040 !! html/php
11041 <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>
11043 !! html/parsoid
11044 <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>
11045 !! end
11047 !! test
11048 Image with multiple widths -- use last
11049 !! wikitext
11050 [[File:Foobar.jpg|200px|300px|caption]]
11051 !! html/php
11052 <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>
11053 </p>
11054 !! html/parsoid
11055 <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>
11056 !! end
11058 !! test
11059 Image with multiple alignments -- use first (bug 48664)
11060 !! options
11061 thumbsize=220
11062 !! wikitext
11063 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11065 [[File:Foobar.jpg|middle|text-top|caption]]
11066 !! html/php
11067 <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>
11068 <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>
11069 </p>
11070 !! html/parsoid
11071 <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>
11072 <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>
11073 !! end
11075 !! test
11076 Image with width attribute at different positions
11077 !! wikitext
11078 [[File:Foobar.jpg|200px|right|Caption]]
11079 [[File:Foobar.jpg|right|200px|Caption]]
11080 [[File:Foobar.jpg|right|Caption|200px]]
11081 !! html/php
11082 <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>
11083 <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>
11084 <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>
11086 !! html/parsoid
11087 <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>
11088 <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>
11089 <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>
11090 !! end
11092 # a sad bit of backward-compatibility
11093 !! test
11094 Image with size specified with pxpx (bug 13500, 51628)
11095 !! options
11096 parsoid=wt2html,wt2wt,html2html
11097 !! wikitext
11098 [[File:Foobar.jpg|20pxpx]]
11099 [[File:Foobar.jpg|200x20pxpx]]
11100 !! html/php
11101 <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>
11102 <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>
11103 </p>
11104 !! html/parsoid
11105 <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>
11106 !! end
11108 !! test
11109 Image with link parameter, wiki target
11110 !! wikitext
11111 [[File:Foobar.jpg|link=Main Page]]
11112 !! html/php
11113 <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>
11114 </p>
11115 !! html/parsoid
11116 <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>
11117 !! end
11119 # parsoid bug 49293 (part 1)
11120 !! test
11121 Image with link parameter, URL target
11122 !! wikitext
11123 [[File:Foobar.jpg|link=http://example.com/]]
11124 !! html/php
11125 <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>
11126 </p>
11127 !! html/parsoid
11128 <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>
11129 !! end
11131 # parsoid bug 49293 (part 2)
11132 !! test
11133 Image with link parameter, protocol-less URL target
11134 !! wikitext
11135 [[File:Foobar.jpg|link=//example.com/]]
11136 !! html/php
11137 <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>
11138 </p>
11139 !! html/parsoid
11140 <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>
11141 !! end
11143 !! test
11144 Image with link parameter, wgExternalLinkTarget
11145 !! wikitext
11146 [[Image:foobar.jpg|link=http://example.com/]]
11147 !! config
11148 wgExternalLinkTarget='foobar'
11149 !! html
11150 <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>
11151 </p>
11152 !! end
11154 !! test
11155 Image with link parameter, wgNoFollowLinks set to false
11156 !! wikitext
11157 [[Image:foobar.jpg|link=http://example.com/]]
11158 !! config
11159 wgNoFollowLinks=false
11160 !! html
11161 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11162 </p>
11163 !! end
11165 !! test
11166 Image with link parameter, wgNoFollowDomainExceptions
11167 !! wikitext
11168 [[Image:foobar.jpg|link=http://example.com/]]
11169 !! config
11170 wgNoFollowDomainExceptions='example.com'
11171 !! html
11172 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11173 </p>
11174 !! end
11176 !! test
11177 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11178 !! wikitext
11179 [[Image:foobar.jpg|link=http://example.com/|Title]]
11180 !! config
11181 wgExternalLinkTarget='foobar'
11182 !! html
11183 <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>
11184 </p>
11185 !! end
11187 !! test
11188 Image with empty link parameter
11189 !! wikitext
11190 [[File:Foobar.jpg|link=]]
11191 !! html/php
11192 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11193 </p>
11194 !! html/parsoid
11195 <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>
11196 !! end
11198 !! test
11199 Image with link parameter (wiki target) and unnamed parameter
11200 !! wikitext
11201 [[File:Foobar.jpg|link=Main_Page|Title]]
11202 !! html/php
11203 <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>
11204 </p>
11205 !! html/parsoid
11206 <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>
11207 !! end
11209 !! test
11210 Image with link parameter (URL target) and unnamed parameter
11211 !! wikitext
11212 [[File:Foobar.jpg|link=http://example.com/|Title]]
11213 !! html/php
11214 <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>
11215 </p>
11216 !! html/parsoid
11217 <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>
11218 !! end
11220 !! test
11221 Thumbnail image with link parameter
11222 !! options
11223 thumbsize=220
11224 parsoid=wt2html,wt2wt,html2html
11225 !! wikitext
11226 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11227 !! html/php
11228 <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>
11230 !! html/parsoid
11231 <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>
11232 !! end
11234 !! test
11235 Manually-specified thumbnail image
11236 !! options
11237 thumbsize=220
11238 !! wikitext
11239 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11240 !! html/php
11241 <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>
11243 !! html/parsoid
11244 <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>
11245 !! end
11247 !! test
11248 Manually-specified thumbnail image with explicit link to wiki page
11249 !! options
11250 thumbsize=220
11251 parsoid=wt2html,wt2wt,html2html
11252 !! wikitext
11253 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11254 !! html/php
11255 <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>
11257 !! html/parsoid
11258 <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>
11259 !! end
11261 !! test
11262 Manually-specified thumbnail image with explicit link to url
11263 !! options
11264 thumbsize=220
11265 parsoid=wt2html,wt2wt,html2html
11266 !! wikitext
11267 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11268 !! html/php
11269 <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>
11271 !! html/parsoid
11272 <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>
11273 !! end
11275 !! test
11276 Manually-specified thumbnail image with explicit no link
11277 !! options
11278 thumbsize=220
11279 parsoid=wt2html,wt2wt,html2html
11280 !! wikitext
11281 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11282 !! html/php
11283 <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>
11285 !! html/parsoid
11286 <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>
11287 !! end
11289 !! test
11290 Manually-specified thumbnail image with explicit link and alt text
11291 !! options
11292 thumbsize=220
11293 parsoid=wt2html,wt2wt,html2html
11294 !! wikitext
11295 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11296 !! html/php
11297 <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>
11299 !! html/parsoid
11300 <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>
11301 !! end
11303 !! test
11304 Image with frame and link
11305 !! options
11306 parsoid=wt2html,wt2wt,html2html
11307 !! wikitext
11308 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11309 !! html/php
11310 <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>
11312 !! html/parsoid
11313 <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>
11314 !! end
11316 !! test
11317 Image with frame and link and explicit alt
11318 !! options
11319 parsoid=wt2html,wt2wt,html2html
11320 !! wikitext
11321 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11322 !! html/php
11323 <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>
11325 !! html/parsoid
11326 <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>
11327 !! end
11329 !! test
11330 Image with wiki markup in implicit alt
11331 !! options
11332 parsoid=wt2html,wt2wt,html2html
11333 !! wikitext
11334 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11336 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11337 !! html/php
11338 <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>
11339 </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>
11340 </p>
11341 !! html/parsoid
11342 <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>
11343 <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>
11344 !! end
11346 ###################
11347 # Conflicting image format options.
11348 # First option specified should 'win'.
11349 # All three cases in each test should be identical.
11351 !! test
11352 Image with 'frameless' first.
11353 !! options
11354 parsoid=wt2html,wt2wt,html2html
11355 !! wikitext
11356 [[File:Foobar.jpg|frameless|caption]]
11358 [[File:Foobar.jpg|frameless|frame|caption]]
11360 [[File:Foobar.jpg|frameless|thumb|caption]]
11361 !! html/php
11362 <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>
11363 </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>
11364 </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>
11365 </p>
11366 !! html/parsoid
11367 <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>
11368 <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>
11369 <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>
11370 !! end
11372 !! test
11373 Image with 'frame' first.
11374 !! options
11375 parsoid=wt2html,wt2wt,html2html
11376 !! wikitext
11377 [[File:Foobar.jpg|frame|caption]]
11378 [[File:Foobar.jpg|frame|frameless|caption]]
11379 [[File:Foobar.jpg|frame|thumb|caption]]
11380 !! html/php
11381 <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>
11382 <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>
11383 <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>
11385 !! html/parsoid
11386 <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><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><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>
11387 !! end
11389 !! test
11390 Image with 'thumb' first.
11391 !! options
11392 parsoid=wt2html,wt2wt,html2html
11393 !! wikitext
11394 [[File:Foobar.jpg|thumb|caption]]
11395 [[File:Foobar.jpg|thumb|frameless|caption]]
11396 [[File:Foobar.jpg|thumb|frame|caption]]
11397 !! html/php
11398 <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>
11399 <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>
11400 <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>
11402 !! html/parsoid
11403 <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><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><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>
11404 !! end
11406 ###################
11407 # Image sizing.
11408 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11409 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11410 # Foobar has actual size of 1941x220
11411 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11412 #    a scalable format.
11413 # 2. Framed images always ignore size options; always render at default size.
11414 # 3. "Unspecified format" and border are the only types which can be
11415 #    enlarged.
11417 !! test
11418 Image: "unspecified format" and border enlarge
11419 !! options
11420 parsoid=wt2html,wt2wt,html2html
11421 !! wikitext
11422 [[File:Foobar.jpg|2000px]]
11424 [[File:Foobar.jpg|border|2000px]]
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="2000" height="227" /></a>
11427 </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>
11428 </p>
11429 !! html/parsoid
11430 <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>
11431 <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>
11432 !! end
11434 !! test
11435 Image: "unspecified format" and border reduce
11436 !! options
11437 parsoid=wt2html,wt2wt,html2html
11438 !! wikitext
11439 [[File:Foobar.jpg|1000px]]
11441 [[File:Foobar.jpg|border|1000px]]
11442 !! html/php
11443 <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>
11444 </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>
11445 </p>
11446 !! html/parsoid
11447 <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>
11448 <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>
11449 !! end
11451 !! test
11452 Image: thumbs reduce
11453 !! options
11454 parsoid=wt2html,wt2wt,html2html
11455 !! wikitext
11456 [[File:Foobar.jpg|thumb|50px]]
11457 !! html/php
11458 <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>
11460 !! html/parsoid
11461 <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>
11462 !! end
11464 !! test
11465 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11466 !! options
11467 parsoid=wt2html,wt2wt,html2html
11468 !! wikitext
11469 [[File:Foobar.jpg|thumb|2000px]]
11471 [[File:Foobar.svg|thumb|2000px]]
11472 !! html/php
11473 <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>
11474 <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>
11476 !! html/parsoid
11477 <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>
11478 <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>
11479 !! end
11481 !! test
11482 Image: frameless can reduce in size
11483 !! options
11484 parsoid=wt2html,wt2wt,html2html
11485 !! wikitext
11486 [[File:Foobar.jpg|frameless|50px]]
11487 !! html/php
11488 <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>
11489 </p>
11490 !! html/parsoid
11491 <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>
11492 !! end
11494 !! test
11495 Image: bitmap frameless can't be enlarged past original size, but vector can
11496 !! options
11497 parsoid=wt2html,wt2wt,html2html
11498 !! wikitext
11499 [[File:Foobar.jpg|frameless|2000px]]
11501 [[File:Foobar.svg|frameless|2000px]]
11502 !! html/php
11503 <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>
11504 </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>
11505 </p>
11506 !! html/parsoid
11507 <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>
11508 <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>
11509 !! end
11511 !! test
11512 Image: framed images are always unscaled.
11513 !! options
11514 parsoid=wt2html,wt2wt,html2html
11515 !! wikitext
11516 [[File:Foobar.jpg|frame]]
11518 [[File:Foobar.jpg|frame|50px]]
11520 [[File:Foobar.jpg|frame|50x50px]]
11522 [[File:Foobar.jpg|frame|2000px]]
11523 !! html/php
11524 <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>
11525 <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>
11526 <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>
11527 <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>
11529 !! html/parsoid
11530 <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><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><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><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>
11531 !! end
11533 ###################
11535 !! test
11536 Link to image page- image page normally doesn't exists, hence edit link
11537 Add test with existing image page
11538 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11539 !! wikitext
11540 [[:Image:test]]
11541 !! html
11542 <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>
11543 </p>
11544 !! end
11546 !! test
11547 bug 18784  Link to non-existent image page with caption should use caption as link text
11548 !! wikitext
11549 [[:Image:test|caption]]
11550 !! html
11551 <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>
11552 </p>
11553 !! end
11555 !! test
11556 Frameless image caption with a free URL
11557 !! wikitext
11558 [[File:Foobar.jpg|http://example.com]]
11559 !! html/php
11560 <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>
11561 </p>
11562 !! html/parsoid
11563 <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>
11564 !! end
11566 !! test
11567 Thumbnail image caption with a free URL
11568 !! options
11569 thumbsize=220
11570 !! wikitext
11571 [[File:Foobar.jpg|thumb|http://example.com]]
11572 !! html/php
11573 <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>
11575 !! html/parsoid
11576 <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>
11577 !! end
11579 !! test
11580 Thumbnail image caption with a free URL and explicit alt
11581 !! options
11582 thumbsize=220
11583 parsoid=wt2html,wt2wt,html2html
11584 !! wikitext
11585 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11586 !! html/php
11587 <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>
11589 !! html/parsoid
11590 <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>
11591 !! end
11593 !! test
11594 SVG thumbnails with no language set
11595 !! options
11596 !! wikitext
11597 [[File:Foobar.svg|thumb|caption]]
11598 !! html/php
11599 <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>
11601 !! html/parsoid
11602 <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>
11603 !! end
11605 !! test
11606 SVG thumbnails with language de
11607 !! options
11608 parsoid=wt2html,wt2wt,html2html
11609 !! wikitext
11610 [[File:Foobar.svg|thumb|caption|lang=de]]
11611 !! html/php
11612 <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>
11614 !! html/parsoid
11615 <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>
11616 !! end
11618 !! test
11619 SVG thumbnails with invalid language code
11620 !! options
11621 parsoid=wt2html,wt2wt,html2html
11622 !! wikitext
11623 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11624 !! html/php
11625 <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>
11627 !! html/parsoid
11628 <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>
11629 !! end
11631 !! test
11632 BUG 1887: A ISBN with a thumbnail
11633 !! wikitext
11634 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11635 !! html/php
11636 <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>
11638 !! html/parsoid
11639 <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>
11640 !! end
11642 !! test
11643 BUG 1887: A RFC with a thumbnail
11644 !! wikitext
11645 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11646 !! html/php
11647 <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>
11649 !! html/parsoid
11650 <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>
11651 !! end
11653 !! test
11654 BUG 1887: A mailto link with a thumbnail
11655 !! wikitext
11656 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11657 !! html/php
11658 <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>
11660 !! html/parsoid
11661 <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>
11662 !! end
11664 # Pending resolution to bug 368
11665 !! test
11666 BUG 648: Frameless image caption with a link
11667 !! wikitext
11668 [[File:Foobar.jpg|text with a [[link]] in it]]
11669 !! html/php
11670 <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>
11671 </p>
11672 !! html/parsoid
11673 <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>
11674 !! end
11676 !! test
11677 BUG 648: Frameless image caption with a link (suffix)
11678 !! wikitext
11679 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11680 !! html/php
11681 <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>
11682 </p>
11683 !! html/parsoid
11684 <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>
11685 !! end
11687 !! test
11688 BUG 648: Frameless image caption with an interwiki link
11689 !! wikitext
11690 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11691 !! html/php
11692 <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>
11693 </p>
11694 !! html/parsoid
11695 <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>
11696 !! end
11698 !! test
11699 BUG 648: Frameless image caption with a piped interwiki link
11700 !! wikitext
11701 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11702 !! html/php
11703 <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>
11704 </p>
11705 !! html/parsoid
11706 <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>
11707 !! end
11709 !! test
11710 Escape HTML special chars in image alt text
11711 !! wikitext
11712 [[File:Foobar.jpg|& < > "]]
11713 !! html/php
11714 <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>
11715 </p>
11716 !! html/parsoid
11717 <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>
11718 !! end
11720 !! test
11721 BUG 499: Alt text should have &#1234;, not &amp;1234;
11722 !! wikitext
11723 [[File:Foobar.jpg|&#9792;]]
11724 !! html/php
11725 <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>
11726 </p>
11727 !! html/parsoid
11728 <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>
11729 !! end
11731 !! test
11732 Broken image caption with link
11733 !! options
11734 parsoid=wt2html,wt2wt,html2html
11735 !! wikitext
11736 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11737 !! html/php
11738 <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.
11739 </p>
11740 !! html/parsoid
11741 <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>
11742 !! end
11744 !! test
11745 Image caption containing another image
11746 !! wikitext
11747 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11748 !! html/php
11749 <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>
11751 !! html/parsoid
11752 <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>
11753 !! end
11755 !! test
11756 Image: caption containing a newline
11757 !! wikitext
11758 [[File:Foobar.jpg|This
11759 *is some text]]
11760 !! html/php
11761 <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>
11762 </p>
11763 !! html/parsoid
11764 <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>
11765 !!end
11767 !!test
11768 Image: caption containing leading space
11769 (The leading space should not trigger nowiki escaping in wt2wt mode)
11770 !! wikitext
11771 [[File:Foobar.jpg|thumb| bar]]
11772 !! html/php
11773 <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>
11775 !! html/parsoid
11776 <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>
11777 !!end
11779 !! test
11780 Image: caption containing a table
11781 !! options
11782 parsoid=wt2html,wt2wt,html2html
11783 !! wikitext
11784 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11786 ! Foo !! Bar
11788 | Foo1 || Bar1
11790 and some more text.]]
11791 !! html/php
11792 <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>
11794 !! html/parsoid
11795 <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
11796 <table>
11797 <tbody>
11798 <tr><th>Foo </th><th>Bar</th></tr>
11799 <tr>
11800 <td>Foo1 </td>
11801 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11802 !! end
11804 !! test
11805 Bug 3090: External links other than http: in image captions
11806 !! wikitext
11807 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11808 !! html/php
11809 <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>
11811 !! html/parsoid
11812 <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>
11813 !! end
11815 !! test
11816 Custom class
11817 !! options
11818 parsoid=wt2html,wt2wt,html2html
11819 !! wikitext
11820 [[Image:foobar.jpg|a|class=b]]
11821 !! html/php
11822 <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>
11823 </p>
11824 !! html/parsoid
11825 <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>
11826 !! end
11828 !! test
11829 Localized image handling (1).
11830 !! options
11831 parsoid=wt2html,wt2wt,html2html
11832 language=es
11833 !! wikitext
11834 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11835 !! html/php
11836 <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>
11838 !! html/parsoid
11839 <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>
11840 !! end
11842 !! test
11843 Localized image handling (2).
11844 !! options
11845 thumbsize=220
11846 parsoid=wt2html,wt2wt,html2html
11847 language=es
11848 !! wikitext
11849 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11850 !! html/php
11851 <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>
11853 !! html/parsoid
11854 <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>
11855 !! end
11857 !! test
11858 "border", "frameless" and "class" attributes on an image.
11859 !! options
11860 thumbsize=220
11861 parsoid=wt2html,wt2wt,html2html
11862 !! wikitext
11863 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11864 !! html/php
11865 <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>
11866 </p>
11867 !! html/parsoid
11868 <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>
11869 !! end
11871 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11872 !! test
11873 Invalid image attributes (bug 62500)
11874 !! options
11875 thumbsize=220
11876 parsoid=wt2html,wt2wt,html2html
11877 !! wikitext
11878 [[File:Foobar.jpg|thumb|float|left|caption]]
11880 [[File:Foobar.jpg|thumb|righ|caption]]
11882 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11883 !! html/php
11884 <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>
11885 <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>
11886 <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>
11888 !! html/parsoid
11889 <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><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><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>
11890 !! end
11892 !! article
11893 File:Barfoo.jpg
11894 !! text
11895 #REDIRECT [[File:Barfoo.jpg]]
11896 !! endarticle
11898 !! test
11899 Redirected image
11900 !! wikitext
11901 [[Image:Barfoo.jpg]]
11902 !! html
11903 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11904 </p>
11905 !! end
11907 !! test
11908 Missing image with uploads disabled
11909 !! options
11910 wgEnableUploads=0
11911 !! wikitext
11912 [[Image:Foobaz.jpg]]
11913 !! html
11914 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11915 </p>
11916 !! end
11918 # Parsoid-specific testing for images
11919 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11920 # Currently imperfect due to a flaw in the Parsoid testrunner
11921 # Work in progress
11922 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11923 # image tests.
11925 !! test
11926 Parsoid-specific image handling - simple image with size and middle alignment
11927 !! wikitext
11928 [[File:Foobar.jpg|middle|50px]]
11929 !! html/parsoid
11930 <p><span class="mw-valign-middle" typeof="mw:Image">
11931 <a href="File:Foobar.jpg">
11932 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11933 </a>
11934 </span>
11935 </p>
11936 !! end
11938 !! test
11939 Parsoid-specific image handling - simple image with size, middle alignment,
11940 non-standard namespace alias
11941 !! options
11942 parsoid=wt2wt,wt2html,html2html
11943 !! wikitext
11944 [[Image:Foobar.jpg|middle|50px]]
11945 !! html/parsoid
11946 <p><span class="mw-valign-middle" typeof="mw:Image">
11947 <a href="File:Foobar.jpg">
11948 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11949 </a>
11950 </span>
11951 </p>
11952 !! end
11954 !! test
11955 Parsoid-specific image handling - simple image with size and middle alignment
11956 (existing content)
11957 !! wikitext
11958 [[File:Foobar.jpg|50px|middle]]
11959 !! html/parsoid
11960 <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>
11961 !! end
11963 !! test
11964 Parsoid-specific image handling - simple image with size and middle alignment
11965 and non-standard namespace name
11966 !! options
11967 parsoid=wt2html,wt2wt,html2html
11968 !! wikitext
11969 [[Image:Foobar.jpg|50px|middle]]
11970 !! html/parsoid
11971 <p><span class="mw-valign-middle" typeof="mw:Image">
11972 <a href="File:Foobar.jpg">
11973 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11974 </a>
11975 </span>
11976 </p>
11977 !! end
11979 !! test
11980 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11981 !! wikitext
11982 [[File:Foobar.jpg|500x10px|baseline|caption]]
11983 !! html/parsoid
11984 <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>
11985 !! end
11987 !! test
11988 Parsoid-specific image handling - simple image with border and size spec
11989 !! wikitext
11990 [[File:Foobar.jpg|50px|border|caption]]
11991 !! html/parsoid
11992 <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>
11993 !! end
11995 !! test
11996 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11997 !! wikitext
11998 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11999 !! html/parsoid
12000 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
12001 <a href="File:Foobar.jpg">
12002 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
12003 </a>
12004 <figcaption>caption content</figcaption>
12005 </figure>
12006 !! end
12008 !! test
12009 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12010 (existing content)
12011 !! wikitext
12012 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12013 !! html/parsoid
12014 <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>
12015 !! end
12017 !! test
12018 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12019 !! wikitext
12020 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12021 !! html/parsoid
12022 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
12023 <a href="File:Foobar.jpg">
12024 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
12025 </a>
12026 <figcaption>caption</figcaption>
12027 </figure>
12028 !! end
12030 !! test
12031 Parsoid-specific image handling - thumbnail with specific size, halign,
12032 valign, and caption (existing content)
12033 !! wikitext
12034 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12035 !! html/parsoid
12036 <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>
12037 !! end
12039 !! test
12040 Parsoid-specific image handling - framed image with specific size and caption
12041 (size is ignored)
12042 !! options
12043 parsoid=wt2html,wt2wt,html2html
12044 !! wikitext
12045 [[File:Foobar.jpg|frame|500x50px|caption]]
12046 !! html/parsoid
12047 <figure typeof="mw:Image/Frame">
12048 <a href="File:Foobar.jpg">
12049 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
12050 </a>
12051 <figcaption>caption</figcaption>
12052 </figure>
12053 !! end
12055 !! test
12056 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12057 (size is ignored)
12058 !! options
12059 parsoid=wt2html,wt2wt,html2html
12060 !! wikitext
12061 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12062 !! html/parsoid
12063 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
12064 <a href="File:Foobar.jpg">
12065 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
12066 </a>
12067 <figcaption>caption</figcaption>
12068 </figure>
12069 !! end
12071 !! test
12072 Parsoid-specific image handling - frameless image with specific size, border, and caption
12073 !! wikitext
12074 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12075 !! html/parsoid
12076 <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>
12077 !! end
12079 !! test
12080 Parsoid-specific image handling - simple image with a formatted caption
12081 !! wikitext
12082 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12083 !! html/parsoid
12084 <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>"}'>
12085 <a href="File:Foobar.jpg">
12086 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
12087 </a></span></p>
12088 !! end
12090 !! test
12091 Parsoid-specific image handling - caption with a template in it
12092 !! wikitext
12093 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12094 !! html/parsoid
12095 <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>
12096 !! end
12098 !! test
12099 Parsoid-specific image handling - caption with unbalanced tags in it
12100 !! options
12101 parsoid=wt2html,wt2wt,html2html
12102 !! wikitext
12104 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12106 !! html/parsoid
12107 <p>foo</p>
12108 <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>
12109 <p>bar</p>
12110 !! end
12112 !! test
12113 Parsoid-specific image handling - empty caption (1)
12114 !! options
12115 parsoid=wt2html,wt2wt
12116 !! wikitext
12117 [[File:Foobar.jpg|thumb|]]
12118 !! html/parsoid
12119 <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>
12120 !! end
12122 # empty captions don't get serialized unless we're in the "round trip" case
12123 !! test
12124 Parsoid-specific image handling - empty caption (2)
12125 !! options
12126 parsoid=html2wt
12127 !! html/parsoid
12128 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12129   <a href="File:Foobar.jpg">
12130     <img resource="./File:Foobar.jpg"
12131          src="//example.com/images/3/3a/Foobar.jpg"
12132          height="25" width="220"/>
12133   </a>
12134   <figcaption></figcaption>
12135 </figure>
12136 !! wikitext
12137 [[File:Foobar.jpg|thumb]]
12138 !! end
12140 !! test
12141 Parsoid-specific image handling - whitespace caption
12142 !! wikitext
12143 [[File:Foobar.jpg|thumb| ]]
12144 !! html/parsoid
12145 <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>
12146 !! end
12148 !! test
12149 Parsoid-specific image handling - lang option
12150 !! wikitext
12152 [[File:Foobar.svg|lang=de|caption]]
12154 !! html/parsoid
12155 <p>foo
12156 <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>
12157 bar</p>
12158 !! end
12162 ### Subpages
12164 !! article
12165 Subpage test/subpage
12166 !! text
12168 !! endarticle
12170 !! test
12171 Subpage link
12172 !! options
12173 subpage title=[[Subpage test]]
12174 !! wikitext
12175 [[/subpage]]
12176 !! html
12177 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12178 </p>
12179 !! end
12181 !! test
12182 Subpage noslash link
12183 !! options
12184 subpage title=[[Subpage test]]
12185 !! wikitext
12186 [[/subpage/]]
12187 !! html
12188 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12189 </p>
12190 !! end
12192 # TODO: make this PHP-parser compatible!
12193 !! test
12194 Relative subpage noslash link
12195 !! options
12196 parsoid=wt2wt,wt2html,html2html
12197 subpage title=[[Subpage test/1/2/3/4]]
12198 !! wikitext
12199 [[../../subpage/]]
12201 [[../../subpage]]
12202 !! html
12203 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/" title="Subpage test/1/2/subpage/">subpage</a></p>
12204 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12205 !! end
12207 !! test
12208 Parsoid: dot-slash prefixed wikilinks
12209 !! wikitext
12210 [[./foo]]
12212 [[././bar]]
12214 [[././baz/]]
12215 !! html/php
12216 <p>[[./foo]]
12217 </p><p>[[././bar]]
12218 </p><p>[[././baz/]]
12219 </p>
12220 !! html/parsoid
12221 <p>[[./foo]]
12222 </p><p>[[././bar]]
12223 </p><p>[[././baz/]]
12224 </p>
12225 !! end
12227 !! test
12228 Render invalid page names as plain text (bug 51090)
12229 !! wikitext
12230 [[./../foo|bar]]
12231 [[foo�|bar]]
12232 [[foo/.|bar]]
12233 [[foo/..|bar]]
12234 [[foo~~~bar]]
12235 [[foo>bar]]
12236 [[foo[bar]]
12237 [[.]]
12238 [[..]]
12239 [[foo././bar]]
12241 [[{{echo|./../foo}}|bar]]
12242 [[{{echo|foo/.}}|bar]]
12243 [[{{echo|foo/..}}|bar]]
12244 [[{{echo|foo~~~~bar}}]]
12245 [[{{echo|foo>bar}}]]
12246 [[{{echo|foo././bar}}]]
12247 [[{{echo|foo{bar}}]]
12248 [[{{echo|foo}bar}}]]
12249 [[{{echo|foo[bar}}]]
12250 [[{{echo|foo]bar}}]]
12251 [[{{echo|foo<bar}}]]
12252 !!html/php
12253 <p>[[./../foo|bar]]
12254 [[foo�|bar]]
12255 [[foo/.|bar]]
12256 [[foo/..|bar]]
12257 [[foo~~~bar]]
12258 [[foo&gt;bar]]
12259 [[foo[bar]]
12260 [[.]]
12261 [[..]]
12262 [[foo././bar]]
12263 </p><p>[[./../foo|bar]]
12264 [[foo/.|bar]]
12265 [[foo/..|bar]]
12266 [[foo~~~~bar]]
12267 [[foo&gt;bar]]
12268 [[foo././bar]]
12269 [[foo{bar]]
12270 [[foo}bar]]
12271 [[foo[bar]]
12272 [[foo]bar]]
12273 [[foo&lt;bar]]
12274 </p>
12275 !!html/parsoid
12276 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
12277 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]][[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]][[<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>
12278 !!end
12280 !! test
12281 Disabled subpages
12282 !! wikitext
12283 [[/subpage]]
12284 !! html
12285 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12286 </p>
12287 !! end
12289 !! test
12290 BUG 561: {{/Subpage}}
12291 !! options
12292 subpage title=[[Page]]
12293 !! wikitext
12294 {{/Subpage}}
12295 !! html
12296 <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>
12297 </p>
12298 !! end
12301 ### Categories
12303 !! article
12304 Category:MediaWiki User's Guide
12305 !! text
12306 blah
12307 !! endarticle
12309 !! test
12310 Link to category
12311 !! wikitext
12312 [[:Category:MediaWiki User's Guide]]
12313 !! html
12314 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12315 </p>
12316 !! end
12318 !! test
12319 Simple category
12320 !! options
12322 !! wikitext
12323 [[Category:MediaWiki User's Guide]]
12324 !! html
12325 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12326 !! end
12328 !! test
12329 PAGESINCATEGORY invalid title fatal (r33546 fix)
12330 !! wikitext
12331 {{PAGESINCATEGORY:<bogus>}}
12332 !! html
12333 <p>0
12334 </p>
12335 !! end
12337 !! test
12338 Category with different sort key
12339 !! options
12341 !! wikitext
12342 [[Category:MediaWiki User's Guide|Foo]]
12343 !! html
12344 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12345 !! end
12347 !! test
12348 Category with identical sort key
12349 !! options
12351 !! wikitext
12352 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12353 !! html
12354 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12355 !! end
12357 !! test
12358 Category with empty sort key
12359 !! options
12362 !! wikitext
12363 [[Category:MediaWiki User's Guide|]]
12364 !! html
12365 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12366 !! end
12368 !! test
12369 Category with empty sort key and parentheses
12370 !! options
12373 !! wikitext
12374 [[Category:Foo (bar)|]]
12375 !! html
12376 [[Category:Foo (bar)|Foo]]
12377 !! end
12379 !! test
12380 Category with link tail
12381 !! options
12384 !! wikitext
12385 123[[Category:Foo]]456
12386 !! html
12387 123[[Category:Foo]]456
12388 !! end
12390 !! test
12391 Category with template
12392 !! options
12395 !! wikitext
12396 [[Category:{{echo|Foo}}]]
12397 !! html
12398 [[Category:{{echo|Foo}}]]
12399 !! end
12401 !! test
12402 Category with template in sort key
12403 !! options
12406 !! wikitext
12407 [[Category:Foo|{{echo|Bar}}]]
12408 !! html
12409 [[Category:Foo|{{echo|Bar}}]]
12410 !! end
12412 !! test
12413 Category with template in sort key and title
12414 !! options
12417 !! wikitext
12418 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12419 !! html
12420 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12421 !! end
12423 !! test
12424 Category / paragraph interactions
12425 !! wikitext
12426 Foo [[Category:Baz]] Bar
12428 Foo [[Category:Baz]]
12432 [[Category:Baz]]
12436 [[Category:Baz]] Bar
12439 [[Category:Baz]]
12440  [[Category:Baz]]
12441 [[Category:Baz]]
12444 [[Category:Baz]]
12445  [[Category:Baz]]
12446 [[Category:Baz]]
12448 [[Category:Baz]]
12449  {{echo|[[Category:Baz]]}}
12450 [[Category:Baz]]
12451 !! html
12452 <p>Foo Bar
12453 </p><p>Foo
12455 </p><p>Foo
12457 </p><p>Foo Bar
12458 </p><p>Foo
12460 </p>
12461 !! end
12463 !! test
12464 Parsoid: Serialize link to category page with colon escape
12465 !! options
12466 parsoid
12467 !! wikitext
12469 [[:Category:Foo]]
12470 [[:Category:Foo|Bar]]
12471 !! html
12473 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12474 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12475 </p>
12476 !! end
12478 !! test
12479 Parsoid: Link prefix/suffixes aren't applied to category links
12480 !! options
12481 parsoid=wt2html,wt2wt,html2html
12482 language=is
12483 !! wikitext
12484 x[[Category:Foo]]y
12485 !! html
12486 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12487 !! end
12489 !! test
12490 Parsoid: Serialize link to file page with colon escape
12491 !! options
12492 parsoid
12493 !! wikitext
12495 [[:File:Foo.png]]
12496 [[:File:Foo.png|Bar]]
12497 !! html
12499 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12500 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12501 </p>
12502 !! end
12504 !! test
12505 Parsoid: Serialize a genuine category link without colon escape
12506 !! options
12507 parsoid
12508 !! wikitext
12509 [[Category:Foo]]
12510 [[Category:Foo|Bar]]
12511 !! html
12512 <link rel="mw:PageProp/Category" href="Category:Foo">
12513 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12514 !! end
12516 !! test
12517 Parsoid: Defaultsort
12518 !! options
12519 parsoid
12520 !! wikitext
12521 {{DEFAULTSORT:Foo}}
12522 !! html
12523 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12524 !! end
12527 ### Inter-language links
12529 !! test
12530 Interlanguage links
12531 !! options
12533 !! wikitext
12534 [[es:Alimento]]
12535 [[fr:Nourriture]]
12536 [[zh:食品]]
12537 !! html/php
12538 es:Alimento fr:Nourriture zh:食品
12539 !! html/parsoid
12540 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/>
12541 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/>
12542 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p>
12543 !! end
12545 !! test
12546 Duplicate interlanguage links (bug 24502)
12547 !! options
12549 !! wikitext
12550 [[es:1]]
12551 [[es:2]]
12552 [[fr:1]]
12553 [[fr:2]]
12554 !! html/php
12555 es:1 fr:1
12556 !! html/parsoid
12557 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/>
12558 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/>
12559 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/>
12560 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p>
12561 !! end
12564 ### Sections
12566 !! test
12567 Basic section headings
12568 !! wikitext
12569 == Headline 1 ==
12570 Some text
12572 ==Headline 2==
12573 More
12574 ===Smaller headline===
12575 Blah blah
12576 !! html
12577 <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>
12578 <p>Some text
12579 </p>
12580 <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>
12581 <p>More
12582 </p>
12583 <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>
12584 <p>Blah blah
12585 </p>
12586 !! end
12588 !! test
12589 Section headings with TOC
12590 !! wikitext
12591 == Headline 1 ==
12592 === Subheadline 1 ===
12593 ===== Skipping a level =====
12594 ====== Skipping a level ======
12596 == Headline 2 ==
12597 Some text
12598 ===Another headline===
12599 !! html
12600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12601 <ul>
12602 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12603 <ul>
12604 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12605 <ul>
12606 <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>
12607 <ul>
12608 <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>
12609 </ul>
12610 </li>
12611 </ul>
12612 </li>
12613 </ul>
12614 </li>
12615 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12616 <ul>
12617 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12618 </ul>
12619 </li>
12620 </ul>
12621 </div>
12623 <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>
12624 <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>
12625 <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>
12626 <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>
12627 <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>
12628 <p>Some text
12629 </p>
12630 <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>
12632 !! end
12634 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12635 !! test
12636 Handling of sections up to level 6 and beyond
12637 !! wikitext
12638 = Level 1 Heading=
12639 == Level 2 Heading==
12640 === Level 3 Heading===
12641 ==== Level 4 Heading====
12642 ===== Level 5 Heading=====
12643 ====== Level 6 Heading======
12644 ======= Level 7 Heading=======
12645 ======== Level 8 Heading========
12646 ========= Level 9 Heading=========
12647 ========== Level 10 Heading==========
12648 !! html
12649 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12650 <ul>
12651 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12652 <ul>
12653 <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>
12654 <ul>
12655 <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>
12656 <ul>
12657 <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>
12658 <ul>
12659 <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>
12660 <ul>
12661 <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>
12662 <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>
12663 <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>
12664 <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>
12665 <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>
12666 </ul>
12667 </li>
12668 </ul>
12669 </li>
12670 </ul>
12671 </li>
12672 </ul>
12673 </li>
12674 </ul>
12675 </li>
12676 </ul>
12677 </div>
12679 <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>
12680 <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>
12681 <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>
12682 <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>
12683 <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>
12684 <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>
12685 <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>
12686 <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>
12687 <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>
12688 <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>
12690 !! end
12692 !! test
12693 TOC regression (bug 9764)
12694 !! wikitext
12695 == title 1 ==
12696 === title 1.1 ===
12697 ==== title 1.1.1 ====
12698 === title 1.2 ===
12699 == title 2 ==
12700 === title 2.1 ===
12701 !! html
12702 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12703 <ul>
12704 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12705 <ul>
12706 <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>
12707 <ul>
12708 <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>
12709 </ul>
12710 </li>
12711 <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>
12712 </ul>
12713 </li>
12714 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12715 <ul>
12716 <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>
12717 </ul>
12718 </li>
12719 </ul>
12720 </div>
12722 <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>
12723 <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>
12724 <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>
12725 <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>
12726 <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>
12727 <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>
12729 !! end
12731 !! test
12732 TOC with wgMaxTocLevel=3 (bug 6204)
12733 !! options
12734 wgMaxTocLevel=3
12735 !! wikitext
12736 == title 1 ==
12737 === title 1.1 ===
12738 ==== title 1.1.1 ====
12739 === title 1.2 ===
12740 == title 2 ==
12741 === title 2.1 ===
12742 !! html
12743 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12744 <ul>
12745 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12746 <ul>
12747 <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>
12748 <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>
12749 </ul>
12750 </li>
12751 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12752 <ul>
12753 <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>
12754 </ul>
12755 </li>
12756 </ul>
12757 </div>
12759 <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>
12760 <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>
12761 <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>
12762 <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>
12763 <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>
12764 <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>
12766 !! end
12768 !! test
12769 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12770 !! options
12771 wgMaxTocLevel=3
12772 !! wikitext
12773 ==Section 1==
12774 ===Section 1.1===
12775 ====Section 1.1.1====
12776 ====Section 1.1.1.1====
12777 ==Section 2==
12778 !! html
12779 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12780 <ul>
12781 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12782 <ul>
12783 <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>
12784 </ul>
12785 </li>
12786 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12787 </ul>
12788 </div>
12790 <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>
12791 <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>
12792 <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>
12793 <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>
12794 <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>
12796 !! end
12799 !! test
12800 Resolving duplicate section names
12801 !! wikitext
12802 == Foo bar ==
12803 == Foo bar ==
12804 !! html
12805 <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>
12806 <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>
12808 !! end
12810 !! test
12811 Resolving duplicate section names with differing case (bug 10721)
12812 !! wikitext
12813 == Foo bar ==
12814 == Foo Bar ==
12815 !! html
12816 <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>
12817 <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>
12819 !! end
12821 !! article
12822 Template:sections
12823 !! text
12824 ===Section 1===
12825 ==Section 2==
12826 !! endarticle
12828 !! test
12829 Template with sections, __NOTOC__
12830 !! wikitext
12831 __NOTOC__
12832 ==Section 0==
12833 {{sections}}
12834 ==Section 4==
12835 !! html
12836 <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>
12837 <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>
12838 <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>
12839 <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>
12841 !! end
12843 !! test
12844 __NOEDITSECTION__ keyword
12845 !! wikitext
12846 __NOEDITSECTION__
12847 ==Section 1==
12848 ==Section 2==
12849 !! html
12850 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12851 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12853 !! end
12855 !! test
12856 Link inside a section heading
12857 !! wikitext
12858 ==Section with a [[Main Page|link]] in it==
12859 !! html
12860 <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>
12862 !! end
12864 !! test
12865 TOC regression (bug 12077)
12866 !! wikitext
12867 __TOC__
12868 == title 1 ==
12869 === title 1.1 ===
12870 == title 2 ==
12871 !! html
12872 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12873 <ul>
12874 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12875 <ul>
12876 <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>
12877 </ul>
12878 </li>
12879 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12880 </ul>
12881 </div>
12883 <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>
12884 <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>
12885 <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>
12887 !! end
12889 !! test
12890 BUG 1219 URL next to image (good)
12891 !! wikitext
12892 http://example.com [[Image:foobar.jpg]]
12893 !! html
12894 <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>
12895 </p>
12896 !!end
12898 !! test
12899 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12900 !! wikitext
12901 === 
12902 The line above must have a trailing space!
12903 === <!--
12904 --> <!-- -->
12905 But just in case it doesn't...
12906 !! html
12907 <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>
12908 <p>The line above must have a trailing space!
12909 </p>
12910 <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>
12911 <p>But just in case it doesn't...
12912 </p>
12913 !! end
12915 !! test
12916 Header with special characters (bug 25462)
12917 !! wikitext
12918 The tooltips shall not show entities to the user (ie. be double escaped)
12920 == text > text ==
12921 section 1
12923 == text < text ==
12924 section 2
12926 == text & text ==
12927 section 3
12929 == text ' text ==
12930 section 4
12932 == text " text ==
12933 section 5
12934 !! html
12935 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12936 </p>
12937 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12938 <ul>
12939 <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>
12940 <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>
12941 <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>
12942 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12943 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12944 </ul>
12945 </div>
12947 <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>
12948 <p>section 1
12949 </p>
12950 <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>
12951 <p>section 2
12952 </p>
12953 <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>
12954 <p>section 3
12955 </p>
12956 <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>
12957 <p>section 4
12958 </p>
12959 <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>
12960 <p>section 5
12961 </p>
12962 !! end
12964 !! test
12965 Header with space, plus and underscore as entity
12966 !! wikitext
12967 Id should not contain + for spaces
12969 == Space between Text ==
12970 section 1
12972 == Space-Entity&#32;between&#32;Text ==
12973 section 2
12975 == Plus+between+Text ==
12976 section 3
12978 == Plus-Entity&#43;between&#43;Text ==
12979 section 4
12981 == Underscore_between_Text ==
12982 section 5
12984 == Underscore-Entity&#95;between&#95;Text ==
12985 section 6
12987 [[#Space between Text]]
12988 [[#Space-Entity&#32;between&#32;Text]]
12989 [[#Plus+between+Text]]
12990 [[#Plus-Entity&#43;between&#43;Text]]
12991 [[#Underscore_between_Text]]
12992 [[#Underscore-Entity&#95;between&#95;Text]]
12993 !! html
12994 <p>Id should not contain + for spaces
12995 </p>
12996 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12997 <ul>
12998 <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>
12999 <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>
13000 <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>
13001 <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>
13002 <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>
13003 <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>
13004 </ul>
13005 </div>
13007 <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>
13008 <p>section 1
13009 </p>
13010 <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>
13011 <p>section 2
13012 </p>
13013 <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>
13014 <p>section 3
13015 </p>
13016 <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>
13017 <p>section 4
13018 </p>
13019 <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>
13020 <p>section 5
13021 </p>
13022 <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>
13023 <p>section 6
13024 </p><p><a href="#Space_between_Text">#Space between Text</a>
13025 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13026 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13027 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13028 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13029 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13030 </p>
13031 !! end
13033 !! test
13034 Headers with excess '=' characters
13035 (Are similar tests necessary beyond the 1st level?)
13036 !! wikitext
13037 =foo==
13038 ==foo=
13039 =''italic'' heading==
13040 ==''italic'' heading=
13041 !! html
13042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13043 <ul>
13044 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13045 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13046 <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>
13047 <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>
13048 </ul>
13049 </div>
13051 <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>
13052 <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>
13053 <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>
13054 <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>
13056 !! end
13058 !! test
13059 HTML headers vs TOC (bug 23393)
13060 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13061 !! wikitext
13062 <h1>Header 1</h1>
13063 == Header 1.1 ==
13064 == Header 1.2 ==
13066 <h1>Header 2
13067 </h1>
13068 == Header 2.1 ==
13069 == Header 2.2 ==
13070 __NOEDITSECTION__
13071 !! html
13072 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13073 <ul>
13074 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13075 <ul>
13076 <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>
13077 <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>
13078 </ul>
13079 </li>
13080 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13081 <ul>
13082 <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>
13083 <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>
13084 </ul>
13085 </li>
13086 </ul>
13087 </div>
13089 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13090 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13091 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13092 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13093 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13094 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13096 !! end
13098 !! test
13099 Single-line or multiline-comments can follow headings
13100 !! options
13101 parsoid=wt2html,wt2wt
13102 !! wikitext
13103 ==foo==<!---->
13104 ==bar==<!--c1-->
13105 ==baz==<!--
13107 c3-->
13108 !! html
13109 <h2><span class="mw-headline" id="foo">foo</span></h2>
13110 <h2><span class="mw-headline" id="bar">bar</span></h2>
13111 <h2><span class="mw-headline" id="baz">baz</span></h2>
13113 !! end
13115 !! test
13116 BUG 1219 URL next to image (broken)
13117 !! wikitext
13118 http://example.com[[Image:foobar.jpg]]
13119 !! html
13120 <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>
13121 </p>
13122 !!end
13124 !! test
13125 Bug 1186 news: in the middle of text
13126 !! wikitext
13127 http://en.wikinews.org/wiki/Wikinews:Workplace
13128 !! html
13129 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13130 </p>
13131 !!end
13134 !! test
13135 Namespaced link must have a title
13136 !! wikitext
13137 [[Project:]]
13138 !! html
13139 <p>[[Project:]]
13140 </p>
13141 !!end
13143 !! test
13144 Namespaced link must have a title (bad fragment version)
13145 !! wikitext
13146 [[Project:#fragment]]
13147 !! html
13148 <p>[[Project:#fragment]]
13149 </p>
13150 !!end
13154 ### HTML tags and HTML attributes
13157 !! test
13158 div with no attributes
13159 !! wikitext
13160 <div>HTML rocks</div>
13161 !! html
13162 <div>HTML rocks</div>
13164 !! end
13166 !! test
13167 div with double-quoted attribute
13168 !! wikitext
13169 <div id="rock">HTML rocks</div>
13170 !! html
13171 <div id="rock">HTML rocks</div>
13173 !! end
13175 !! test
13176 div with single-quoted attribute
13177 !! wikitext
13178 <div id='rock'>HTML rocks</div>
13179 !! html
13180 <div id="rock">HTML rocks</div>
13182 !! end
13184 !! test
13185 div with unquoted attribute
13186 !! wikitext
13187 <div id=rock>HTML rocks</div>
13188 !! html
13189 <div id="rock">HTML rocks</div>
13191 !! end
13193 !! test
13194 div with illegal double attributes
13195 !! wikitext
13196 <div id="a" id="b">HTML rocks</div>
13197 !! html
13198 <div id="b">HTML rocks</div>
13200 !!end
13202 # FIXME: produce empty string instead of "class" in the PHP parser, following
13203 # the HTML5 spec.
13204 !! test
13205 div with empty attribute value, space before equals
13206 !! options
13207 parsoid
13208 !! wikitext
13209 <div class =>HTML rocks</div>
13210 !! html
13211 <div class="">HTML rocks</div>
13213 !! end
13215 !! test
13216 div with multiple empty attribute values
13217 !! options
13218 parsoid
13219 !! wikitext
13220 <div id= title=>HTML rocks</div>
13221 !! html
13222 <div id="" title="">HTML rocks</div>
13224 !! end
13226 !! test
13227 table with multiple empty attribute values
13228 !! options
13229 parsoid
13230 !! wikitext
13231 {| title= id=
13232 | hi
13234 !! html
13235 <table title="" id="">
13236 <tbody><tr><td> hi</td></tr>
13237 </tbody></table>
13238 !! end
13240 # The PHP parser escapes the opening brace to &#123; for some reason, so
13241 # disabled this test for it.
13242 !! test
13243 div with braces in attribute value
13244 !! options
13245 parsoid
13246 !! wikitext
13247 <div title="{}">Foo</div>
13248 !! html
13249 <div title="{}">Foo</div>
13250 !! end
13252 # This it very inconsistent in the PHP parser: it returns 
13253 # class="class" if there is a space between the name and the equal sign (see
13254 # 'div with empty attribute value, space before equals'), but strips the
13255 # attribute completely if the space is missing. We hope that not much content
13256 # depends on this, so are implementing the behavior below in Parsoid for
13257 # consistencies' sake. Disabled for the PHP parser. 
13258 # FIXME: fix this behavior in the PHP parser?
13259 !! test
13260 div with empty attribute value, no space before equals
13261 !! options
13262 parsoid
13263 !! wikitext
13264 <div class=>HTML rocks</div>
13265 !! html
13266 <div class="">HTML rocks</div>
13268 !! end
13270 !! test
13271 HTML multiple attributes correction
13272 !! wikitext
13273 <p class="error" class="awesome">Awesome!</p>
13274 !! html
13275 <p class="awesome">Awesome!</p>
13277 !!end
13279 !! test
13280 Table multiple attributes correction
13281 !! wikitext
13283 !+ class="error" class="awesome"| status
13285 !! html
13286 <table>
13287 <tr>
13288 <th class="awesome"> status
13289 </th></tr></table>
13291 !!end
13293 !! test
13294 DIV IN UPPERCASE
13295 !! wikitext
13296 <DIV ID="x">HTML ROCKS</DIV>
13297 !! html
13298 <div id="x">HTML ROCKS</div>
13300 !!end
13302 !! test
13303 Non-ASCII pseudo-tags are rendered as text
13304 !! wikitext
13305 <khyô>
13306 !! html
13307 <p>&lt;khyô&gt;
13308 </p>
13309 !! end
13311 !! test
13312 Pseudo-tag with URL 'name' renders as url link
13313 !! wikitext
13314 <http://example.com/>
13315 !! html
13316 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13317 </p>
13318 !! end
13320 !! test
13321 text with amp in the middle of nowhere
13322 !! wikitext
13323 Remember AT&T?
13324 !! html
13325 <p>Remember AT&amp;T?
13326 </p>
13327 !! end
13329 !! test
13330 text with character entity: eacute
13331 !! wikitext
13332 I always thought &eacute; was a cute letter.
13333 !! html
13334 <p>I always thought &#233; was a cute letter.
13335 </p>
13336 !! html+tidy
13337 <p>I always thought é was a cute letter.</p>
13338 !! end
13340 !! test
13341 text with entity-escaped character entity-like string: eacute
13342 !! wikitext
13343 I always thought &amp;eacute; was a cute letter.
13344 !! html
13345 <p>I always thought &amp;eacute; was a cute letter.
13346 </p>
13347 !! end
13349 !! test
13350 text with undefined character entity: xacute
13351 !! wikitext
13352 I always thought &xacute; was a cute letter.
13353 !! html
13354 <p>I always thought &amp;xacute; was a cute letter.
13355 </p>
13356 !! end
13358 # TODO: generalize to PHP parser?
13359 !! test
13360 HTML5 tags
13361 !! options
13362 parsoid
13363 !! wikitext
13364 <data value="5">five</data>
13365 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13366 <mark>This highlighted text</mark>
13367 !! html
13368 <p><data value="5">five</data>
13369 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13370 <mark>This highlighted text</mark></p>
13371 !! end
13373 !! test
13374 HTML tag with leading space is parsed as text
13375 !! wikitext
13376 < div>foo< /div>
13377 !! html
13378 <p>&lt; div&gt;foo&lt; /div&gt;
13379 </p>
13380 !! end
13383 ### Nesting tests (see bug 41545, 50604, 51081)
13386 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13387 # Note that html2wt is considerably more difficult if we use <b> in
13388 # the test case, instead of <big>
13389 !! test
13390 Ensure that HTML adoption agency algorithm is properly implemented.
13391 !! wikitext
13392 <big>X<big>Y</big>Z</big>
13393 !! html
13394 <p><big>X<big>Y</big>Z</big>
13395 </p>
13396 !! end
13398 # This was bug 41545 in the PHP parser.
13399 # Note that tidy doesn't handle this correctly.
13400 !! test
13401 Nesting of <kbd>
13402 !! wikitext
13403 <kbd>X<kbd>Y</kbd>Z</kbd>
13404 !! html
13405 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13406 </p>
13407 !! end
13409 # The following cases were bug 51081 in the PHP parser.
13410 # Note that there are some other nestable tags (b, i, etc) which are
13411 # not covered; see bug 51081 for discussion.
13413 # Note that tidy doesn't handle this correctly.
13414 !! test
13415 Nesting of <em>
13416 !! wikitext
13417 <em>X<em>Y</em>Z</em>
13418 !! html
13419 <p><em>X<em>Y</em>Z</em>
13420 </p>
13421 !! end
13423 # Note that tidy doesn't handle this correctly.
13424 !! test
13425 Nesting of <strong>
13426 !! wikitext
13427 <strong>X<strong>Y</strong>Z</strong>
13428 !! html
13429 <p><strong>X<strong>Y</strong>Z</strong>
13430 </p>
13431 !! end
13433 !! test
13434 Nesting of <q>
13435 !! wikitext
13436 <q>X<q>Y</q>Z</q>
13437 !! html+tidy
13438 <p><q>X<q>Y</q>Z</q></p>
13439 !! end
13441 # Note that tidy doesn't handle this correctly.
13442 !! test
13443 Nesting of <ruby>
13444 !! wikitext
13445 <ruby>X<ruby>Y</ruby>Z</ruby>
13446 !! html
13447 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13448 </p>
13449 !! end
13451 # Note that tidy doesn't handle this correctly.
13452 !! test
13453 Nesting of <bdo>
13454 !! wikitext
13455 <bdo>X<bdo>Y</bdo>Z</bdo>
13456 !! html
13457 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13458 </p>
13459 !! end
13463 ### Media links
13466 !! test
13467 Media link
13468 !! wikitext
13469 [[Media:Foobar.jpg]]
13470 !! html
13471 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13472 </p>
13473 !! end
13475 !! test
13476 Media link with text
13477 !! wikitext
13478 [[Media:Foobar.jpg|A neat file to look at]]
13479 !! html
13480 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13481 </p>
13482 !! end
13484 # FIXME: this is still bad HTML tag nesting
13485 !! test
13486 Media link with nasty text
13487 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13488 !! wikitext
13489 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13490 !! html
13491 <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>
13493 !! html+tidy
13494 <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>
13495 !! end
13497 !! test
13498 Media link to nonexistent file (bug 1702)
13499 !! wikitext
13500 [[Media:No such.jpg]]
13501 !! html
13502 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13503 </p>
13504 !! end
13506 !! test
13507 Image link to nonexistent file (bug 1850 - good)
13508 !! wikitext
13509 [[Image:No such.jpg]]
13510 !! html
13511 <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>
13512 </p>
13513 !! end
13515 !! test
13516 :Image link to nonexistent file (bug 1850 - bad)
13517 !! wikitext
13518 [[:Image:No such.jpg]]
13519 !! html
13520 <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>
13521 </p>
13522 !! end
13526 !! test
13527 Character reference normalization in link text (bug 1938)
13528 !! wikitext
13529 [[Main Page|this&that]]
13530 !! html
13531 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13532 </p>
13533 !!end
13535 !! article
13536 אַ
13537 !! text
13538 Test for unicode normalization
13540 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
13541 !! endarticle
13543 !! test
13544 (bug 19451) Links should refer to the normalized form.
13545 !! wikitext
13546 [[&#xFB2E;]]
13547 [[&#x5d0;&#x5b7;]]
13548 [[&#x5d0;ַ]]
13549 [[א&#x5b7;]]
13550 [[אַ]]
13551 !! html
13552 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
13553 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
13554 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
13555 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
13556 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
13557 </p>
13558 !! end
13560 !! test
13561 Empty attribute crash test (bug 2067)
13562 !! wikitext
13563 <font color="">foo</font>
13564 !! html
13565 <p><font color="">foo</font>
13566 </p>
13567 !! end
13569 !! test
13570 Empty attribute crash test single-quotes (bug 2067)
13571 !! wikitext
13572 <font color=''>foo</font>
13573 !! html
13574 <p><font color="">foo</font>
13575 </p>
13576 !! end
13578 !! test
13579 Attribute test: equals, then nothing
13580 !! wikitext
13581 <font color=>foo</font>
13582 !! html
13583 <p><font>foo</font>
13584 </p>
13585 !! end
13587 !! test
13588 Attribute test: unquoted value
13589 !! wikitext
13590 <font color=x>foo</font>
13591 !! html
13592 <p><font color="x">foo</font>
13593 </p>
13594 !! end
13596 !! test
13597 Attribute test: unquoted but illegal value (hash)
13598 !! wikitext
13599 <font color=#x>foo</font>
13600 !! html
13601 <p><font color="#x">foo</font>
13602 </p>
13603 !! end
13605 !! test
13606 Attribute test: no value
13607 !! wikitext
13608 <font color>foo</font>
13609 !! html
13610 <p><font color="color">foo</font>
13611 </p>
13612 !! end
13614 !! test
13615 Bug 2095: link with three closing brackets
13616 !! wikitext
13617 [[Main Page]]]
13618 !! html/php
13619 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
13620 </p>
13621 !! html/parsoid
13622 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
13623 !! end
13625 !! test
13626 Bug 2095: link with pipe and three closing brackets
13627 !! wikitext
13628 [[Main Page|link]]]
13629 !! html/php
13630 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
13631 </p>
13632 !! html/parsoid
13633 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
13634 !! end
13636 !! test
13637 Bug 2095: link with pipe and three closing brackets, version 2
13638 !! wikitext
13639 [[Main Page|[http://example.com/]]]
13640 !! html/php
13641 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
13642 </p>
13643 !! html/parsoid
13644 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
13645 !! end
13649 ### Safety
13652 !! article
13653 Template:Dangerous attribute
13654 !! text
13655 " onmouseover="alert(document.cookie)
13656 !! endarticle
13658 !! article
13659 Template:Dangerous style attribute
13660 !! text
13661 border-size: expression(alert(document.cookie))
13662 !! endarticle
13664 !! article
13665 Template:Div style
13666 !! text
13667 <div style="float: right; {{{1}}}">Magic div</div>
13668 !! endarticle
13670 !! test
13671 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13672 !! wikitext
13673 <div title="{{test}}"></div>
13674 !! html
13675 <div title="This is a test template"></div>
13677 !! end
13679 # Parsoid has enough context to handle this case
13680 !! test
13681 Bug 2304: HTML attribute safety (dangerous template; 2309)
13682 !! wikitext
13683 <div title="{{dangerous attribute}}"></div>
13684 !! html/php
13685 <div title=""></div>
13687 !! html/parsoid
13688 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" 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}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}' data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}'></div>
13689 !! end
13691 !! test
13692 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13693 !! wikitext
13694 <div style="{{dangerous style attribute}}"></div>
13695 !! html
13696 <div style="/* insecure input */"></div>
13698 !! end
13700 !! test
13701 Bug 2304: HTML attribute safety (safe parameter; 2309)
13702 !! wikitext
13703 {{div style|width: 200px}}
13704 !! html
13705 <div style="float: right; width: 200px">Magic div</div>
13707 !! end
13709 !! test
13710 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13711 !! wikitext
13712 {{div style|width: expression(alert(document.cookie))}}
13713 !! html
13714 <div style="/* insecure input */">Magic div</div>
13716 !! end
13718 !! test
13719 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13720 !! wikitext
13721 {{div style|"><script>alert(document.cookie)</script>}}
13722 !! html
13723 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13725 !! end
13727 !! test
13728 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13729 !! wikitext
13730 {{div style|" ><script>alert(document.cookie)</script>}}
13731 !! html
13732 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13734 !! end
13736 !! test
13737 Bug 2304: HTML attribute safety (link)
13738 !! wikitext
13739 <div title="[[Main Page]]"></div>
13740 !! html
13741 <div title="&#91;&#91;Main Page]]"></div>
13743 !! end
13745 !! test
13746 Bug 2304: HTML attribute safety (italics)
13747 !! wikitext
13748 <div title="''foobar''"></div>
13749 !! html
13750 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13752 !! end
13754 !! test
13755 Bug 2304: HTML attribute safety (bold)
13756 !! wikitext
13757 <div title="'''foobar'''"></div>
13758 !! html
13759 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13761 !! end
13764 !! test
13765 Bug 2304: HTML attribute safety (ISBN)
13766 !! wikitext
13767 <div title="ISBN 1234567890"></div>
13768 !! html
13769 <div title="&#73;SBN 1234567890"></div>
13771 !! end
13773 !! test
13774 Bug 2304: HTML attribute safety (RFC)
13775 !! wikitext
13776 <div title="RFC 1234"></div>
13777 !! html
13778 <div title="&#82;FC 1234"></div>
13780 !! end
13782 !! test
13783 Bug 2304: HTML attribute safety (PMID)
13784 !! wikitext
13785 <div title="PMID 1234567890"></div>
13786 !! html
13787 <div title="&#80;MID 1234567890"></div>
13789 !! end
13791 !! test
13792 Bug 2304: HTML attribute safety (web link)
13793 !! wikitext
13794 <div title="http://example.com/"></div>
13795 !! html
13796 <div title="http&#58;//example.com/"></div>
13798 !! end
13800 !! test
13801 Bug 2304: HTML attribute safety (named web link)
13802 !! wikitext
13803 <div title="[http://example.com/ link]"></div>
13804 !! html
13805 <div title="&#91;http&#58;//example.com/ link]"></div>
13807 !! end
13809 !! test
13810 Bug 3244: HTML attribute safety (extension; safe)
13811 !! wikitext
13812 <div style="<nowiki>background:blue</nowiki>"></div>
13813 !! html
13814 <div style="background:blue"></div>
13816 !! end
13818 !! test
13819 Bug 3244: HTML attribute safety (extension; unsafe)
13820 !! wikitext
13821 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13822 !! html
13823 <div style="/* insecure input */"></div>
13825 !! end
13827 # More MSIE fun discovered by Tom Gilder
13829 !! test
13830 MSIE CSS safety test: spurious slash
13831 !! wikitext
13832 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13833 !! html
13834 <div style="/* insecure input */">evil</div>
13836 !! end
13838 !! test
13839 MSIE CSS safety test: hex code
13840 !! wikitext
13841 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13842 !! html
13843 <div style="/* insecure input */">evil</div>
13845 !! end
13847 !! test
13848 MSIE CSS safety test: comment in url
13849 !! wikitext
13850 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13851 !! html
13852 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13854 !! end
13856 !! test
13857 MSIE CSS safety test: comment in expression
13858 !! wikitext
13859 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13860 !! html
13861 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13863 !! end
13865 !! test
13866 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13867 !! wikitext
13868 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13869 !! html
13870 <p style="/* invalid control char */">A</p>
13872 !! end
13874 !! test
13875 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13876 !! wikitext
13877 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13878 <div style="top:EXPRESSION(alert())">B</div>
13879 !! html
13880 <p style="/* insecure input */">A</p>
13881 <div style="/* insecure input */">B</div>
13883 !! end
13885 !! test
13886 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13887 !! wikitext
13888 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13889 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13890 !! html
13891 <div style="/* insecure input */">A</div>
13892 <p style="/* insecure input */">B</p>
13894 !! end
13896 !! test
13897 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13898 !! wikitext
13899 <div style="background-image:url⁽javascript:alert())">A</div>
13900 <div style="background-image:url₍javascript:alert())">B</div>
13901 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13902 !! html
13903 <div style="/* insecure input */">A</div>
13904 <div style="/* insecure input */">B</div>
13905 <p style="/* insecure input */">C</p>
13907 !! end
13909 !! test
13910 Opera -o-link CSS
13911 !! wikitext
13912 <div
13913 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;"
13914 style="-o-link:attr(title);-o-link-source:current">X</div>
13915 !! html
13916 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13918 !! end
13920 !! test
13921 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13922 !! wikitext
13923 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13924 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13925 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13926 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13927 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13928 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13929 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13930 !! html
13931 <p style="/* insecure input */">A</p>
13932 <p style="/* insecure input */">B</p>
13933 <p style="/* insecure input */">C</p>
13934 <p style="/* insecure input */">D</p>
13935 <p style="/* insecure input */">E</p>
13936 <p style="/* insecure input */">F</p>
13937 <p style="/* insecure input */">G</p>
13939 !! end
13941 !! test
13942 Table attribute legitimate extension
13943 !! wikitext
13945 !+ style="<nowiki>color:blue</nowiki>"| status
13947 !! html
13948 <table>
13949 <tr>
13950 <th style="color:blue"> status
13951 </th></tr></table>
13953 !!end
13955 !! test
13956 Table attribute safety
13957 !! wikitext
13959 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13961 !! html
13962 <table>
13963 <tr>
13964 <th style="/* insecure input */"> status
13965 </th></tr></table>
13967 !! end
13969 !! test
13970 CSS line continuation 1
13971 !! wikitext
13972 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13973 !! html
13974 <div style="/* insecure input */"></div>
13976 !! end
13978 !! test
13979 CSS line continuation 2
13980 !! wikitext
13981 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13982 !! html
13983 <div style="/* insecure input */"></div>
13985 !! end
13987 !! article
13988 Template:Identity
13989 !! text
13990 {{{1}}}
13991 !! endarticle
13993 !! test
13994 Expansion of multi-line templates in attribute values (bug 6255)
13995 !! wikitext
13996 <div style="background: {{identity|#00FF00}}">-</div>
13997 !! html
13998 <div style="background: #00FF00">-</div>
14000 !! end
14003 !! test
14004 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14005 !! wikitext
14006 <div style="background: 
14007 #00FF00">-</div>
14008 !! html
14009 <div style="background: #00FF00">-</div>
14011 !! end
14013 !! test
14014 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14015 !! wikitext
14016 <div style="background: &#10;#00FF00">-</div>
14017 !! html
14018 <div style="background: &#10;#00FF00">-</div>
14020 !! end
14022 !! test
14023 evil <math>-wiki-tags without Extension:Math enabled
14024 !! wikitext
14025 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14026 !! html+tidy
14027 <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>
14028 !! end
14031 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14033 !! test
14034 Parser hook: empty input
14035 !! wikitext
14036 <tag></tag>
14037 !! html
14038 <pre>
14040 array (
14042 </pre>
14044 !! end
14046 !! test
14047 Parser hook: empty input using terminated empty elements
14048 !! wikitext
14049 <tag/>
14050 !! html
14051 <pre>
14052 NULL
14053 array (
14055 </pre>
14057 !! end
14059 !! test
14060 Parser hook: empty input using terminated empty elements (space before)
14061 !! wikitext
14062 <tag />
14063 !! html
14064 <pre>
14065 NULL
14066 array (
14068 </pre>
14070 !! end
14072 !! test
14073 Parser hook: basic input
14074 !! wikitext
14075 <tag>input</tag>
14076 !! html
14077 <pre>
14078 'input'
14079 array (
14081 </pre>
14083 !! end
14086 !! test
14087 Parser hook: case insensitive
14088 !! wikitext
14089 <TAG>input</TAG>
14090 !! html
14091 <pre>
14092 'input'
14093 array (
14095 </pre>
14097 !! end
14100 !! test
14101 Parser hook: case insensitive, redux
14102 !! wikitext
14103 <TaG>input</TAg>
14104 !! html
14105 <pre>
14106 'input'
14107 array (
14109 </pre>
14111 !! end
14113 !! test
14114 Parser hook: nested tags
14115 !! options
14116 noxml
14117 !! wikitext
14118 <tag><tag></tag></tag>
14119 !! html
14120 <pre>
14121 '<tag>'
14122 array (
14124 </pre>&lt;/tag&gt;
14126 !! end
14128 !! test
14129 Parser hook: basic arguments
14130 !! wikitext
14131 <tag width=200 height = "100" depth = '50' square></tag>
14132 !! html
14133 <pre>
14135 array (
14136   'width' => '200',
14137   'height' => '100',
14138   'depth' => '50',
14139   'square' => 'square',
14141 </pre>
14143 !! end
14145 !! test
14146 Parser hook: argument containing a forward slash (bug 5344)
14147 !! wikitext
14148 <tag filename='/tmp/bla'></tag>
14149 !! html
14150 <pre>
14152 array (
14153   'filename' => '/tmp/bla',
14155 </pre>
14157 !! end
14159 !! test
14160 Parser hook: empty input using terminated empty elements (bug 2374)
14161 !! wikitext
14162 <tag foo=bar/>text
14163 !! html
14164 <pre>
14165 NULL
14166 array (
14167   'foo' => 'bar',
14169 </pre>text
14171 !! end
14173 # </tag> should be output literally since there is no matching tag that begins it
14174 !! test
14175 Parser hook: basic arguments using terminated empty elements (bug 2374)
14176 !! wikitext
14177 <tag width=200 height = "100" depth = '50' square/>
14178 other stuff
14179 </tag>
14180 !! html
14181 <pre>
14182 NULL
14183 array (
14184   'width' => '200',
14185   'height' => '100',
14186   'depth' => '50',
14187   'square' => 'square',
14189 </pre>
14190 <p>other stuff
14191 &lt;/tag&gt;
14192 </p>
14193 !! end
14196 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14199 !! test
14200 Parser hook: static parser hook not inside a comment
14201 !! wikitext
14202 <statictag>hello, world</statictag>
14203 <statictag action=flush/>
14204 !! html
14205 <p>hello, world
14206 </p>
14207 !! end
14210 !! test
14211 Parser hook: static parser hook inside a comment
14212 !! wikitext
14213 <!-- <statictag>hello, world</statictag> -->
14214 <statictag action=flush/>
14215 !! html
14216 <p><br />
14217 </p>
14218 !! end
14220 # Nested template calls; this case was broken by Parser.php rev 1.506,
14221 # since reverted.
14223 !! article
14224 Template:One-parameter
14225 !! text
14226 (My parameter is: {{{1}}})
14227 !! endarticle
14229 !! article
14230 Template:Map-one-parameter
14231 !! text
14232 {{{{{1}}}|{{{2}}}}}
14233 !! endarticle
14235 !! test
14236 Nested template calls
14237 !! wikitext
14238 {{Map-one-parameter|One-parameter|param}}
14239 !! html
14240 <p>(My parameter is: param)
14241 </p>
14242 !! end
14246 ### Sanitizer
14248 !! test
14249 Sanitizer: Closing of open tags
14250 !! wikitext
14251 <s></s><table></table>
14252 !! html
14253 <s></s><table></table>
14255 !! end
14257 !! test
14258 Sanitizer: Closing of open but not closed tags
14259 !! wikitext
14260 <s>foo
14261 !! html
14262 <p><s>foo</s>
14263 </p>
14264 !! end
14266 !! test
14267 Sanitizer: Closing of closed but not open tags
14268 !! wikitext
14269 </s>
14270 !! html
14271 <p>&lt;/s&gt;
14272 </p>
14273 !! end
14275 !! test
14276 Sanitizer: Closing of closed but not open table tags
14277 !! wikitext
14278 Table not started</td></tr></table>
14279 !! html
14280 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14281 </p>
14282 !! end
14284 !! test
14285 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14286 !! wikitext
14287 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14288 !! html
14289 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14290 </p>
14291 !! end
14293 !! test
14294 Sanitizer: Validating the contents of the id attribute (bug 4515)
14295 !! options
14296 disabled
14297 !! wikitext
14298 <br id=9 />
14299 !! html
14300 Something, but definitely not <br id="9" />...
14301 !! end
14303 !! test
14304 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14305 !! options
14306 disabled
14307 !! wikitext
14308 <br id="foo" /><br id="foo" />
14309 !! html
14310 Something need to be done. foo-2 ? 
14311 !! end
14313 !! test
14314 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14315 !! wikitext
14316 <div itemscope>
14317         <meta itemprop="hello" content="world">
14318         <meta http-equiv="refresh" content="5">
14319         <meta itemprop="hello" http-equiv="refresh" content="5">
14320         <link itemprop="hello" href="{{SERVER}}">
14321         <link rel="stylesheet" href="{{SERVER}}">
14322         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14323 </div>
14324 !! html
14325 <div itemscope="itemscope">
14326 <p>     <meta itemprop="hello" content="world" />
14327         &lt;meta http-equiv="refresh" content="5"&gt;
14328         <meta itemprop="hello" content="5" />
14329 </p>
14330         <link itemprop="hello" href="http&#58;//example.org" />
14331         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14332         <link itemprop="hello" href="http&#58;//example.org" />
14333 </div>
14335 !! end
14337 !! test
14338 Language converter: output gets cut off unexpectedly (bug 5757)
14339 !! options
14340 language=zh
14341 !! wikitext
14342 this bit is safe: }-
14344 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14346 then we get cut off here: }-
14348 all additional text is vanished
14349 !! html
14350 <p>this bit is safe: }-
14351 </p><p>but if we add a conversion instance: xxx
14352 </p><p>then we get cut off here: }-
14353 </p><p>all additional text is vanished
14354 </p>
14355 !! end
14357 !! test
14358 Self closed html pairs (bug 5487)
14359 !! options
14360 !! wikitext
14361 <center><font id="bug" />Centered text</center>
14362 <div><font id="bug2" />In div text</div>
14363 !! html
14364 <center>&lt;font id="bug" /&gt;Centered text</center>
14365 <div>&lt;font id="bug2" /&gt;In div text</div>
14367 !! end
14373 !! test
14374 Punctuation: nbsp before exclamation
14375 !! wikitext
14376 C'est grave !
14377 !! html
14378 <p>C'est grave&#160;!
14379 </p>
14380 !! end
14382 !! test
14383 Punctuation: CSS !important (bug 11874)
14384 !! wikitext
14385 <div style="width:50% !important">important</div>
14386 !! html
14387 <div style="width:50% !important">important</div>
14389 !!end
14391 !! test
14392 Punctuation: CSS ! important (bug 11874; with space after)
14393 !! wikitext
14394 <div style="width:50% ! important">important</div>
14395 !! html
14396 <div style="width:50% ! important">important</div>
14398 !!end
14401 !! test
14402 HTML bullet list, closed tags (bug 5497)
14403 !! wikitext
14404 <ul>
14405 <li>One</li>
14406 <li>Two</li>
14407 </ul>
14408 !! html
14409 <ul>
14410 <li>One</li>
14411 <li>Two</li>
14412 </ul>
14414 !! end
14416 !! test
14417 HTML bullet list, unclosed tags (bug 5497)
14418 !! options
14419 disabled
14420 !! wikitext
14421 <ul>
14422 <li>One
14423 <li>Two
14424 </ul>
14425 !! html
14426 <ul>
14427 <li>One
14428 </li>
14429 <li>Two
14430 </li>
14431 </ul>
14433 !! end
14435 !! test
14436 HTML ordered list, closed tags (bug 5497)
14437 !! wikitext
14438 <ol>
14439 <li>One</li>
14440 <li>Two</li>
14441 </ol>
14442 !! html
14443 <ol>
14444 <li>One</li>
14445 <li>Two</li>
14446 </ol>
14448 !! end
14450 !! test
14451 HTML ordered list, unclosed tags (bug 5497)
14452 !! options
14453 disabled
14454 !! wikitext
14455 <ol>
14456 <li>One
14457 <li>Two
14458 </ol>
14459 !! html
14460 <ol>
14461 <li>One
14462 </li>
14463 <li>Two
14464 </li>
14465 </ol>
14467 !! end
14469 !! test
14470 HTML nested bullet list, closed tags (bug 5497)
14471 !! wikitext
14472 <ul>
14473 <li>One</li>
14474 <li>Two:
14475 <ul>
14476 <li>Sub-one</li>
14477 <li>Sub-two</li>
14478 </ul>
14479 </li>
14480 </ul>
14481 !! html
14482 <ul>
14483 <li>One</li>
14484 <li>Two:
14485 <ul>
14486 <li>Sub-one</li>
14487 <li>Sub-two</li>
14488 </ul>
14489 </li>
14490 </ul>
14492 !! end
14494 !! test
14495 HTML nested bullet list, open tags (bug 5497)
14496 !! options
14497 disabled
14498 !! wikitext
14499 <ul>
14500 <li>One
14501 <li>Two:
14502 <ul>
14503 <li>Sub-one
14504 <li>Sub-two
14505 </ul>
14506 </ul>
14507 !! html
14508 <ul>
14509 <li>One
14510 </li>
14511 <li>Two:
14512 <ul>
14513 <li>Sub-one
14514 </li>
14515 <li>Sub-two
14516 </li>
14517 </ul>
14518 </li>
14519 </ul>
14521 !! end
14523 !! test
14524 HTML nested ordered list, closed tags (bug 5497)
14525 !! wikitext
14526 <ol>
14527 <li>One</li>
14528 <li>Two:
14529 <ol>
14530 <li>Sub-one</li>
14531 <li>Sub-two</li>
14532 </ol>
14533 </li>
14534 </ol>
14535 !! html
14536 <ol>
14537 <li>One</li>
14538 <li>Two:
14539 <ol>
14540 <li>Sub-one</li>
14541 <li>Sub-two</li>
14542 </ol>
14543 </li>
14544 </ol>
14546 !! end
14548 !! test
14549 HTML nested ordered list, open tags (bug 5497)
14550 !! options
14551 disabled
14552 !! wikitext
14553 <ol>
14554 <li>One
14555 <li>Two:
14556 <ol>
14557 <li>Sub-one
14558 <li>Sub-two
14559 </ol>
14560 </ol>
14561 !! html
14562 <ol>
14563 <li>One
14564 </li>
14565 <li>Two:
14566 <ol>
14567 <li>Sub-one
14568 </li>
14569 <li>Sub-two
14570 </li>
14571 </ol>
14572 </li>
14573 </ol>
14575 !! end
14577 !! test
14578 HTML ordered list item with parameters oddity
14579 !! wikitext
14580 <ol><li id="fragment">One</li>
14581 </ol>
14582 !! html
14583 <ol><li id="fragment">One</li>
14584 </ol>
14586 !! end
14588 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
14589 !!test
14590 bug 5918: autonumbering
14591 !! wikitext
14592 [http://first/] [http://second] [ftp://ftp]
14594 ftp://inlineftp
14596 [mailto:enclosed@mail.tld With target]
14598 [mailto:enclosed@mail.tld]
14600 mailto:inline@mail.tld
14601 !! html/php
14602 <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>
14603 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
14604 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
14605 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
14606 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
14607 </p>
14608 !! html/parsoid
14609 <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>
14610 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
14611 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
14612 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
14613 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
14614 !! end
14618 # Security and HTML correctness
14619 # From Nick Jenkins' fuzz testing
14622 !! test
14623 Fuzz testing: Parser13
14624 !! wikitext
14625 {| 
14626 | http://a|
14627 !! html
14628 <table>
14629 <tr>
14630 <td>
14631 </td>
14632 </tr>
14633 </table>
14635 !! end
14637 !! test
14638 Fuzz testing: Parser14
14639 !! wikitext
14640 == onmouseover= ==
14641 http://__TOC__
14642 !! html
14643 <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>
14644 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14645 <ul>
14646 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14647 </ul>
14648 </div>
14651 !! html+tidy
14652 <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>
14653 <p>http://</p>
14654 <div id="toc" class="toc">
14655 <div id="toctitle">
14656 <h2>Contents</h2>
14657 </div>
14658 <ul>
14659 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
14660 </ul>
14661 </div>
14662 !! end
14664 !! test
14665 Fuzz testing: Parser14-table
14666 !! wikitext
14667 ==a==
14668 {| STYLE=__TOC__
14669 !! html
14670 <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>
14671 <table style="&#95;_TOC&#95;_">
14672 <tr><td></td></tr>
14673 </table>
14675 !! html+tidy
14676 <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>
14677 <table style="__TOC__">
14678 <tr>
14679 <td></td>
14680 </tr>
14681 </table>
14682 !! end
14684 # Known to produce bogus xml (extra </td>)
14685 !! test
14686 Fuzz testing: Parser16
14687 !! options
14688 noxml
14689 !! wikitext
14691 !https://||||||
14692 !! html
14693 <table>
14694 <tr>
14695 <th>https://</th>
14696 <th></th>
14697 <th></th>
14698 <th>
14699 </td>
14700 </tr>
14701 </table>
14703 !! html+tidy
14704 <table>
14705 <tr>
14706 <th>https://</th>
14707 <th></th>
14708 <th></th>
14709 <th></th>
14710 </tr>
14711 </table>
14712 !! end
14714 !! test
14715 Fuzz testing: Parser21
14716 !! wikitext
14718 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14720 !! html
14721 <table>
14722 <tr>
14723 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14724 </th>
14725 <td>
14726 </td>
14727 </tr>
14728 </table>
14730 !! end
14732 !! test
14733 Fuzz testing: Parser22
14734 !! wikitext
14735 http://===r:::https://b
14738 !! html
14739 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14740 </p>
14741 <table>
14742 <tr><td></td></tr>
14743 </table>
14745 !! end
14747 # Known to produce bad XML for now
14748 !! test
14749 Fuzz testing: Parser24
14750 !! options
14751 noxml
14752 !! wikitext
14754 {{{|
14755 <u CLASS=
14756 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14757 <br style="onmouseover='alert(document.cookie);' " />
14759 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14761 !! html
14762 <table>
14763 {{{|
14764 <u class="&#124;">}}}} &gt;
14765 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14767 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14768 <tr>
14769 <td></u>
14770 </td>
14771 </tr>
14772 </table>
14774 !! end
14776 # Note: the current result listed for this is not what the original one was,
14777 # but the original bug was JavaScript injection, which is fixed in any case.
14778 # It's not clear that the original result listed was any more correct than the
14779 # current one.  Original result:
14780 # <p>{{{| 
14781 # </p>
14782 # <li class="&#124;&#124;">
14783 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14784 !!test
14785 Fuzz testing: Parser25 (bug 6055)
14786 !! wikitext
14789 <LI CLASS=||
14791 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14792 !! html
14793 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14794 </p>
14795 !! end
14797 !!test
14798 Fuzz testing: URL adjacent extension (with space, clean)
14799 !! wikitext
14800 http://example.com <nowiki>junk</nowiki>
14801 !! html
14802 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14803 </p>
14804 !!end
14806 !!test
14807 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14808 !! wikitext
14809 http://example.com<nowiki>junk</nowiki>
14810 !! html
14811 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14812 </p>
14813 !!end
14815 !!test
14816 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14817 !! wikitext
14818 http://example.com<pre>junk</pre>
14819 !! html
14820 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14822 !! html+tidy
14823 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
14824 <pre>
14825 junk
14826 </pre>
14827 !!end
14829 !!test
14830 Fuzz testing: image with bogus manual thumbnail
14831 !! wikitext
14832 [[Image:foobar.jpg|thumbnail= ]]
14833 !! html/php
14834 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
14836 !! html/parsoid
14837 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14838 !!end
14840 !! test
14841 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14842 !! wikitext
14843 <pre dir="&#10;"></pre>
14844 !! html
14845 <pre dir="&#10;"></pre>
14847 !! end
14849 !! test
14850 Parsing optional HTML elements (Bug 6171)
14851 !! options
14852 !! wikitext
14853 <table>
14854   <tr>
14855     <td> Some tabular data</td>
14856     <td> More tabular data ...
14857     <td> And yet som tabular data</td>
14858   </tr>
14859 </table>
14860 !! html
14861 <table>
14862   <tr>
14863     <td> Some tabular data</td>
14864     <td> More tabular data ...
14865     </td><td> And yet som tabular data</td>
14866   </tr>
14867 </table>
14869 !! end
14871 !! test
14872 Correct handling of <td>, <tr> (Bug 6171)
14873 !! options
14874 !! wikitext
14875 <table>
14876   <tr>
14877     <td> Some tabular data</td>
14878     <td> More tabular data ...</td>
14879     <td> And yet som tabular data</td>
14880   </tr>
14881 </table>
14882 !! html
14883 <table>
14884   <tr>
14885     <td> Some tabular data</td>
14886     <td> More tabular data ...</td>
14887     <td> And yet som tabular data</td>
14888   </tr>
14889 </table>
14891 !! end
14894 !! test
14895 Parsing crashing regression (fr:JavaScript)
14896 !! wikitext
14897 </body></x>
14898 !! html
14899 <p>&lt;/body&gt;&lt;/x&gt;
14900 </p>
14901 !! end
14903 !! test
14904 Inline wiki vs wiki block nesting
14905 !! wikitext
14906 '''Bold paragraph
14908 New wiki paragraph
14909 !! html
14910 <p><b>Bold paragraph</b>
14911 </p><p>New wiki paragraph
14912 </p>
14913 !! end
14915 !! test
14916 Inline HTML vs wiki block nesting
14917 !! options
14918 disabled
14919 !! wikitext
14920 <b>Bold paragraph
14922 New wiki paragraph
14923 !! html
14924 <p><b>Bold paragraph</b>
14925 </p><p>New wiki paragraph
14926 </p>
14927 !! end
14929 # Original result was this:
14930 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14931 # </p>
14932 # While that might be marginally more intuitive, maybe, the six-apostrophe
14933 # construct is clearly pathological and the result stated here (which is what
14934 # the parser actually does) is about as reasonable as anything.
14935 !!test
14936 Mixing markup for italics and bold
14937 !! options
14938 !! wikitext
14939 '''bold''''''bold''bolditalics'''''
14940 !! html
14941 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14942 </p>
14943 !! end
14946 !! article
14947 Xyzzyx
14948 !! text
14949 Article for special page transclusion test
14950 !! endarticle
14952 !! test
14953 Special page transclusion
14954 !! options
14955 !! wikitext
14956 {{Special:Prefixindex/Xyzzyx}}
14957 !! html
14958 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14960 !! end
14962 !! test
14963 Special page transclusion twice (bug 5021)
14964 !! options
14965 !! wikitext
14966 {{Special:Prefixindex/Xyzzyx}}
14967 {{Special:Prefixindex/Xyzzyx}}
14968 !! html
14969 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14970 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14972 !! end
14974 !! test
14975 Transclusion of default MediaWiki message
14976 !! wikitext
14977 {{MediaWiki:Mainpage}}
14978 !! html
14979 <p>Main Page
14980 </p>
14981 !! end
14983 !! test
14984 Transclusion of nonexistent MediaWiki message
14985 !! wikitext
14986 {{MediaWiki:Mainpagexxx}}
14987 !! html
14988 <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>
14989 </p>
14990 !! end
14992 !! test
14993 Transclusion of MediaWiki message with underscore
14994 !! wikitext
14995 {{MediaWiki:history_short}}
14996 !! html
14997 <p>History
14998 </p>
14999 !! end
15001 !! test
15002 Transclusion of MediaWiki message with space
15003 !! wikitext
15004 {{MediaWiki:history short}}
15005 !! html
15006 <p>History
15007 </p>
15008 !! end
15010 !! test
15011 Invalid header with following text
15012 !! wikitext
15013 = x = y
15014 !! html
15015 <p>= x = y
15016 </p>
15017 !! end
15020 !! test
15021 Section extraction test (section 0)
15022 !! options
15023 section=0
15024 !! wikitext
15025 start
15026 ==a==
15027 ===aa===
15028 ====aaa====
15029 ==b==
15030 ===ba===
15031 ===bb===
15032 ====bba====
15033 ===bc===
15034 ==c==
15035 ===ca===
15036 !! html
15037 start
15038 !! end
15040 !! test
15041 Section extraction test (section 1)
15042 !! options
15043 section=1
15044 !! wikitext
15045 start
15046 ==a==
15047 ===aa===
15048 ====aaa====
15049 ==b==
15050 ===ba===
15051 ===bb===
15052 ====bba====
15053 ===bc===
15054 ==c==
15055 ===ca===
15056 !! html
15057 ==a==
15058 ===aa===
15059 ====aaa====
15060 !! end
15062 !! test
15063 Section extraction test (section 2)
15064 !! options
15065 section=2
15066 !! wikitext
15067 start
15068 ==a==
15069 ===aa===
15070 ====aaa====
15071 ==b==
15072 ===ba===
15073 ===bb===
15074 ====bba====
15075 ===bc===
15076 ==c==
15077 ===ca===
15078 !! html
15079 ===aa===
15080 ====aaa====
15081 !! end
15083 !! test
15084 Section extraction test (section 3)
15085 !! options
15086 section=3
15087 !! wikitext
15088 start
15089 ==a==
15090 ===aa===
15091 ====aaa====
15092 ==b==
15093 ===ba===
15094 ===bb===
15095 ====bba====
15096 ===bc===
15097 ==c==
15098 ===ca===
15099 !! html
15100 ====aaa====
15101 !! end
15103 !! test
15104 Section extraction test (section 4)
15105 !! options
15106 section=4
15107 !! wikitext
15108 start
15109 ==a==
15110 ===aa===
15111 ====aaa====
15112 ==b==
15113 ===ba===
15114 ===bb===
15115 ====bba====
15116 ===bc===
15117 ==c==
15118 ===ca===
15119 !! html
15120 ==b==
15121 ===ba===
15122 ===bb===
15123 ====bba====
15124 ===bc===
15125 !! end
15127 !! test
15128 Section extraction test (section 5)
15129 !! options
15130 section=5
15131 !! wikitext
15132 start
15133 ==a==
15134 ===aa===
15135 ====aaa====
15136 ==b==
15137 ===ba===
15138 ===bb===
15139 ====bba====
15140 ===bc===
15141 ==c==
15142 ===ca===
15143 !! html
15144 ===ba===
15145 !! end
15147 !! test
15148 Section extraction test (section 6)
15149 !! options
15150 section=6
15151 !! wikitext
15152 start
15153 ==a==
15154 ===aa===
15155 ====aaa====
15156 ==b==
15157 ===ba===
15158 ===bb===
15159 ====bba====
15160 ===bc===
15161 ==c==
15162 ===ca===
15163 !! html
15164 ===bb===
15165 ====bba====
15166 !! end
15168 !! test
15169 Section extraction test (section 7)
15170 !! options
15171 section=7
15172 !! wikitext
15173 start
15174 ==a==
15175 ===aa===
15176 ====aaa====
15177 ==b==
15178 ===ba===
15179 ===bb===
15180 ====bba====
15181 ===bc===
15182 ==c==
15183 ===ca===
15184 !! html
15185 ====bba====
15186 !! end
15188 !! test
15189 Section extraction test (section 8)
15190 !! options
15191 section=8
15192 !! wikitext
15193 start
15194 ==a==
15195 ===aa===
15196 ====aaa====
15197 ==b==
15198 ===ba===
15199 ===bb===
15200 ====bba====
15201 ===bc===
15202 ==c==
15203 ===ca===
15204 !! html
15205 ===bc===
15206 !! end
15208 !! test
15209 Section extraction test (section 9)
15210 !! options
15211 section=9
15212 !! wikitext
15213 start
15214 ==a==
15215 ===aa===
15216 ====aaa====
15217 ==b==
15218 ===ba===
15219 ===bb===
15220 ====bba====
15221 ===bc===
15222 ==c==
15223 ===ca===
15224 !! html
15225 ==c==
15226 ===ca===
15227 !! end
15229 !! test
15230 Section extraction test (section 10)
15231 !! options
15232 section=10
15233 !! wikitext
15234 start
15235 ==a==
15236 ===aa===
15237 ====aaa====
15238 ==b==
15239 ===ba===
15240 ===bb===
15241 ====bba====
15242 ===bc===
15243 ==c==
15244 ===ca===
15245 !! html
15246 ===ca===
15247 !! end
15249 !! test
15250 Section extraction test (nonexistent section 11)
15251 !! options
15252 section=11
15253 !! wikitext
15254 start
15255 ==a==
15256 ===aa===
15257 ====aaa====
15258 ==b==
15259 ===ba===
15260 ===bb===
15261 ====bba====
15262 ===bc===
15263 ==c==
15264 ===ca===
15265 !! html
15266 !! end
15268 !! test
15269 Section extraction test with bogus heading (section 1)
15270 !! options
15271 section=1
15272 !! wikitext
15273 ==a==
15274 ==bogus== not a legal section
15275 ==b==
15276 !! html
15277 ==a==
15278 ==bogus== not a legal section
15279 !! end
15281 !! test
15282 Section extraction test with bogus heading (section 2)
15283 !! options
15284 section=2
15285 !! wikitext
15286 ==a==
15287 ==bogus== not a legal section
15288 ==b==
15289 !! html
15290 ==b==
15291 !! end
15293 !! test
15294 Section extraction test with comment after heading (section 1)
15295 !! options
15296 section=1
15297 !! wikitext
15298 ==a==
15299 ==b== <!-- -->
15300 ==c==
15301 !! html
15302 ==a==
15303 !! end
15305 !! test
15306 Section extraction test with comment after heading (section 2)
15307 !! options
15308 section=2
15309 !! wikitext
15310 ==a==
15311 ==b== <!-- -->
15312 ==c==
15313 !! html
15314 ==b== <!-- -->
15315 !! end
15317 !! test
15318 Section extraction test with bogus <nowiki> heading (section 1)
15319 !! options
15320 section=1
15321 !! wikitext
15322 ==a==
15323 ==bogus== <nowiki>not a legal section</nowiki>
15324 ==b==
15325 !! html
15326 ==a==
15327 ==bogus== <nowiki>not a legal section</nowiki>
15328 !! end
15330 !! test
15331 Section extraction test with bogus <nowiki> heading (section 2)
15332 !! options
15333 section=2
15334 !! wikitext
15335 ==a==
15336 ==bogus== <nowiki>not a legal section</nowiki>
15337 ==b==
15338 !! html
15339 ==b==
15340 !! end
15343 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15344 # instead of respecting commented sections
15345 !! test
15346 Section extraction prefixed by comment (section 1)
15347 !! options
15348 section=1
15349 !! wikitext
15350 <!-- -->==sec1==
15351 ==sec2==
15352 !! html
15353 ==sec2==
15354 !!end
15356 !! test
15357 Section extraction prefixed by comment (section 2)
15358 !! options
15359 section=2
15360 !! wikitext
15361 <!-- -->==sec1==
15362 ==sec2==
15363 !! html
15365 !!end
15368 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15369 # instead of respecting HTML-style headings
15370 !! test
15371 Section extraction, mixed wiki and html (section 1)
15372 !! options
15373 section=1
15374 !! wikitext
15375 <h2>unmarked</h2>
15376 unmarked
15377 ==1==
15379 ==2==
15381 !! html
15382 ==1==
15384 !! end
15386 !! test
15387 Section extraction, mixed wiki and html (section 2)
15388 !! options
15389 section=2
15390 !! wikitext
15391 <h2>unmarked</h2>
15392 unmarked
15393 ==1==
15395 ==2==
15397 !! html
15398 ==2==
15400 !! end
15403 # Formerly testing for bug 3342
15404 !! test
15405 Section extraction, heading surrounded by <noinclude>
15406 !! options
15407 section=1
15408 !! wikitext
15409 <noinclude>==unmarked==</noinclude>
15410 ==marked==
15411 !! html
15412 ==marked==
15413 !!end
15415 # Test behavior of bug 19910
15416 !! test
15417 Sectiion with all-equals
15418 !! options
15419 section=2
15420 !! wikitext
15421 === 
15422 The line above must have a trailing space
15423 === <!--
15424 --> <!-- -->
15425 But just in case it doesn't...
15426 !! html
15427 === <!--
15428 --> <!-- -->
15429 But just in case it doesn't...
15430 !! end
15432 !! test
15433 Section replacement test (section 0)
15434 !! options
15435 replace=0,"xxx"
15436 !! wikitext
15437 start
15438 ==a==
15439 ===aa===
15440 ====aaa====
15441 ==b==
15442 ===ba===
15443 ===bb===
15444 ====bba====
15445 ===bc===
15446 ==c==
15447 ===ca===
15448 !! html
15451 ==a==
15452 ===aa===
15453 ====aaa====
15454 ==b==
15455 ===ba===
15456 ===bb===
15457 ====bba====
15458 ===bc===
15459 ==c==
15460 ===ca===
15461 !! end
15463 !! test
15464 Section replacement test (section 1)
15465 !! options
15466 replace=1,"xxx"
15467 !! wikitext
15468 start
15469 ==a==
15470 ===aa===
15471 ====aaa====
15472 ==b==
15473 ===ba===
15474 ===bb===
15475 ====bba====
15476 ===bc===
15477 ==c==
15478 ===ca===
15479 !! html
15480 start
15483 ==b==
15484 ===ba===
15485 ===bb===
15486 ====bba====
15487 ===bc===
15488 ==c==
15489 ===ca===
15490 !! end
15492 !! test
15493 Section replacement test (section 2)
15494 !! options
15495 replace=2,"xxx"
15496 !! wikitext
15497 start
15498 ==a==
15499 ===aa===
15500 ====aaa====
15501 ==b==
15502 ===ba===
15503 ===bb===
15504 ====bba====
15505 ===bc===
15506 ==c==
15507 ===ca===
15508 !! html
15509 start
15510 ==a==
15513 ==b==
15514 ===ba===
15515 ===bb===
15516 ====bba====
15517 ===bc===
15518 ==c==
15519 ===ca===
15520 !! end
15522 !! test
15523 Section replacement test (section 3)
15524 !! options
15525 replace=3,"xxx"
15526 !! wikitext
15527 start
15528 ==a==
15529 ===aa===
15530 ====aaa====
15531 ==b==
15532 ===ba===
15533 ===bb===
15534 ====bba====
15535 ===bc===
15536 ==c==
15537 ===ca===
15538 !! html
15539 start
15540 ==a==
15541 ===aa===
15544 ==b==
15545 ===ba===
15546 ===bb===
15547 ====bba====
15548 ===bc===
15549 ==c==
15550 ===ca===
15551 !! end
15553 !! test
15554 Section replacement test (section 4)
15555 !! options
15556 replace=4,"xxx"
15557 !! wikitext
15558 start
15559 ==a==
15560 ===aa===
15561 ====aaa====
15562 ==b==
15563 ===ba===
15564 ===bb===
15565 ====bba====
15566 ===bc===
15567 ==c==
15568 ===ca===
15569 !! html
15570 start
15571 ==a==
15572 ===aa===
15573 ====aaa====
15576 ==c==
15577 ===ca===
15578 !! end
15580 !! test
15581 Section replacement test (section 5)
15582 !! options
15583 replace=5,"xxx"
15584 !! wikitext
15585 start
15586 ==a==
15587 ===aa===
15588 ====aaa====
15589 ==b==
15590 ===ba===
15591 ===bb===
15592 ====bba====
15593 ===bc===
15594 ==c==
15595 ===ca===
15596 !! html
15597 start
15598 ==a==
15599 ===aa===
15600 ====aaa====
15601 ==b==
15604 ===bb===
15605 ====bba====
15606 ===bc===
15607 ==c==
15608 ===ca===
15609 !! end
15611 !! test
15612 Section replacement test (section 6)
15613 !! options
15614 replace=6,"xxx"
15615 !! wikitext
15616 start
15617 ==a==
15618 ===aa===
15619 ====aaa====
15620 ==b==
15621 ===ba===
15622 ===bb===
15623 ====bba====
15624 ===bc===
15625 ==c==
15626 ===ca===
15627 !! html
15628 start
15629 ==a==
15630 ===aa===
15631 ====aaa====
15632 ==b==
15633 ===ba===
15636 ===bc===
15637 ==c==
15638 ===ca===
15639 !! end
15641 !! test
15642 Section replacement test (section 7)
15643 !! options
15644 replace=7,"xxx"
15645 !! wikitext
15646 start
15647 ==a==
15648 ===aa===
15649 ====aaa====
15650 ==b==
15651 ===ba===
15652 ===bb===
15653 ====bba====
15654 ===bc===
15655 ==c==
15656 ===ca===
15657 !! html
15658 start
15659 ==a==
15660 ===aa===
15661 ====aaa====
15662 ==b==
15663 ===ba===
15664 ===bb===
15667 ===bc===
15668 ==c==
15669 ===ca===
15670 !! end
15672 !! test
15673 Section replacement test (section 8)
15674 !! options
15675 replace=8,"xxx"
15676 !! wikitext
15677 start
15678 ==a==
15679 ===aa===
15680 ====aaa====
15681 ==b==
15682 ===ba===
15683 ===bb===
15684 ====bba====
15685 ===bc===
15686 ==c==
15687 ===ca===
15688 !! html
15689 start
15690 ==a==
15691 ===aa===
15692 ====aaa====
15693 ==b==
15694 ===ba===
15695 ===bb===
15696 ====bba====
15699 ==c==
15700 ===ca===
15701 !!end
15703 !! test
15704 Section replacement test (section 9)
15705 !! options
15706 replace=9,"xxx"
15707 !! wikitext
15708 start
15709 ==a==
15710 ===aa===
15711 ====aaa====
15712 ==b==
15713 ===ba===
15714 ===bb===
15715 ====bba====
15716 ===bc===
15717 ==c==
15718 ===ca===
15719 !! html
15720 start
15721 ==a==
15722 ===aa===
15723 ====aaa====
15724 ==b==
15725 ===ba===
15726 ===bb===
15727 ====bba====
15728 ===bc===
15730 !! end
15732 !! test
15733 Section replacement test (section 10)
15734 !! options
15735 replace=10,"xxx"
15736 !! wikitext
15737 start
15738 ==a==
15739 ===aa===
15740 ====aaa====
15741 ==b==
15742 ===ba===
15743 ===bb===
15744 ====bba====
15745 ===bc===
15746 ==c==
15747 ===ca===
15748 !! html
15749 start
15750 ==a==
15751 ===aa===
15752 ====aaa====
15753 ==b==
15754 ===ba===
15755 ===bb===
15756 ====bba====
15757 ===bc===
15758 ==c==
15760 !! end
15762 !! test
15763 Section replacement test with initial whitespace (bug 13728)
15764 !! options
15765 replace=2,"xxx"
15766 !! wikitext
15767  Preformatted initial line
15768 ==a==
15769 ===a===
15770 !! html
15771  Preformatted initial line
15772 ==a==
15774 !! end
15777 !! test
15778 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15779 !! options
15780 section=1
15781 !! wikitext
15782 ==a==
15783                     a
15784 !! html
15785 ==a==
15786                     a
15787 !! end
15789 !! test
15790 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15791 !! options
15792 section=1
15793 !! wikitext
15794 ==a==
15795                    a
15796 !! html
15797 ==a==
15798                    a
15799 !! end
15802 !! test
15803 Section extraction, <pre> around bogus header (bug 10309)
15804 !! options
15805 noxml section=2
15806 !! wikitext
15807 == Section One ==
15808 <pre>
15809 =======
15810 </pre>
15812 == Section Two ==
15813 stuff
15814 !! html
15815 == Section Two ==
15816 stuff
15817 !! end
15819 !! test
15820 Section replacement, <pre> around bogus header (bug 10309)
15821 !! options
15822 noxml replace=2,"xxx"
15823 !! wikitext
15824 == Section One ==
15825 <pre>
15826 =======
15827 </pre>
15829 == Section Two ==
15830 stuff
15831 !! html
15832 == Section One ==
15833 <pre>
15834 =======
15835 </pre>
15838 !! end
15842 !! test
15843 Handling of &#x0A; in URLs
15844 !! wikitext
15845 ** irc://&#x0A;a
15846 !! html/php
15847 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15849 !! html/parsoid
15850 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15851 a">irc://
15852 a</a></li></ul></li></ul>
15853 !! end
15855 !! test
15856 Handling of %0A in URLs
15857 !! wikitext
15858 ** irc://%0Aa
15859 !! html/php
15860 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15862 !! html/parsoid
15863 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15864 !! end
15867 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15868 !! test
15869 5 quotes, code coverage +1 line
15870 !! options
15871 parsoid=wt2html
15872 !! wikitext
15873 '''''
15874 !! html/php
15875 !! html/parsoid
15876 <p><b><i></i></b></p>
15877 !! end
15879 # same html as previous, but wikitext adjusted to match parsoid html2wt
15880 # note that wt2html and html2html will put the <i> before the <b>
15881 !! test
15882 5 quotes, code coverage +1 line w/ nowiki (1)
15883 !! options
15884 parsoid=wt2wt,html2wt
15885 !! wikitext
15886 '''''<nowiki/>'''''
15887 !! html/php
15888 <p><i></i>
15889 </p>
15890 !! html/parsoid
15891 <p><b><i></i></b></p>
15892 !! end
15894 # same as previous, just swapping the <i> and <b>
15895 !! test
15896 5 quotes, code coverage +1 line w/ nowiki (2)
15897 !! wikitext
15898 '''''<nowiki/>'''''
15899 !! html/php
15900 <p><i></i>
15901 </p>
15902 !! html/parsoid
15903 <p><i><b></b></i></p>
15904 !! end
15906 !! test
15907 Special:Search page linking.
15908 !! wikitext
15909 {{Special:search}}
15910 !! html
15911 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15912 </p>
15913 !! end
15915 !! test
15916 Say the magic word
15917 !! options
15918 title=[[Parser test]]
15919 !! wikitext
15920 * {{PAGENAME}}
15921 * {{PAGENAMEE}}
15922 * {{FULLPAGENAME}}
15923 * {{FULLPAGENAMEE}}
15924 * {{BASEPAGENAME}}
15925 * {{BASEPAGENAMEE}}
15926 * {{SUBPAGENAME}}
15927 * {{SUBPAGENAMEE}}
15928 * {{ROOTPAGENAME}}
15929 * {{ROOTPAGENAMEE}}
15930 * {{TALKPAGENAME}}
15931 * {{TALKPAGENAMEE}}
15932 * {{SUBJECTPAGENAME}}
15933 * {{SUBJECTPAGENAMEE}}
15934 * {{NAMESPACEE}}
15935 * {{NAMESPACE}}
15936 * {{NAMESPACENUMBER}}
15937 * {{TALKSPACE}}
15938 * {{TALKSPACEE}}
15939 * {{SUBJECTSPACE}}
15940 * {{SUBJECTSPACEE}}
15941 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15942 !! html
15943 <ul><li> Parser test</li>
15944 <li> Parser_test</li>
15945 <li> Parser test</li>
15946 <li> Parser_test</li>
15947 <li> Parser test</li>
15948 <li> Parser_test</li>
15949 <li> Parser test</li>
15950 <li> Parser_test</li>
15951 <li> Parser test</li>
15952 <li> Parser_test</li>
15953 <li> Talk:Parser test</li>
15954 <li> Talk:Parser_test</li>
15955 <li> Parser test</li>
15956 <li> Parser_test</li>
15957 <li> </li>
15958 <li> </li>
15959 <li> 0</li>
15960 <li> Talk</li>
15961 <li> Talk</li>
15962 <li> </li>
15963 <li> </li>
15964 <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>
15966 !! end
15967 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15969 !! test
15970 Gallery
15971 !! wikitext
15972 <gallery>
15973 image1.png |
15974 image2.gif|||||
15976 image3|
15977 image4    |300px| centre
15978  image5.svg| http://///////
15979 [[x|xx]]]]
15980 * image6
15981 </gallery>
15982 !! html
15983 <ul class="gallery mw-gallery-traditional">
15984                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15985                         <div class="thumb" style="height: 150px;">Image1.png</div>
15986                         <div class="gallerytext">
15987                         </div>
15988                 </div></li>
15989                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15990                         <div class="thumb" style="height: 150px;">Image2.gif</div>
15991                         <div class="gallerytext">
15992 <p>||||
15993 </p>
15994                         </div>
15995                 </div></li>
15996                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15997                         <div class="thumb" style="height: 150px;">Image3</div>
15998                         <div class="gallerytext">
15999                         </div>
16000                 </div></li>
16001                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16002                         <div class="thumb" style="height: 150px;">Image4</div>
16003                         <div class="gallerytext">
16004 <p>300px| centre
16005 </p>
16006                         </div>
16007                 </div></li>
16008                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16009                         <div class="thumb" style="height: 150px;">Image5.svg</div>
16010                         <div class="gallerytext">
16011 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16012 </p>
16013                         </div>
16014                 </div></li>
16015                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16016                         <div class="thumb" style="height: 150px;">* image6</div>
16017                         <div class="gallerytext">
16018                         </div>
16019                 </div></li>
16020 </ul>
16022 !! end
16024 !! test
16025 Gallery (with options)
16026 !! wikitext
16027 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16028 File:Nonexistant.jpg|caption
16029 File:Nonexistant.jpg
16030 image:foobar.jpg|some '''caption''' [[Main Page]]
16031 image:foobar.jpg
16032 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16033 </gallery>
16034 !! html
16035 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16036         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16037                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16038                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16039                         <div class="gallerytext">
16040 <p>caption
16041 </p>
16042                         </div>
16043                 </div></li>
16044                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16045                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
16046                         <div class="gallerytext">
16047                         </div>
16048                 </div></li>
16049                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16050                         <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>
16051                         <div class="gallerytext">
16052 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16053 </p>
16054                         </div>
16055                 </div></li>
16056                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16057                         <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>
16058                         <div class="gallerytext">
16059                         </div>
16060                 </div></li>
16061                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16062                         <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>
16063                         <div class="gallerytext">
16064 <p>Blabla|blabla.
16065 </p>
16066                         </div>
16067                 </div></li>
16068 </ul>
16070 !! end
16072 !! test
16073 Gallery with link that has fragment
16074 !! wikitext
16075 <gallery>
16076 image:foobar.jpg|link=Main_Page
16077 image:foobar.jpg|link=Main_Page#section
16078 image:foobar.jpg|link=Main Page#section|caption
16079 </gallery>
16080 !! html
16081 <ul class="gallery mw-gallery-traditional">
16082                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16083                         <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>
16084                         <div class="gallerytext">
16085                         </div>
16086                 </div></li>
16087                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16088                         <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>
16089                         <div class="gallerytext">
16090                         </div>
16091                 </div></li>
16092                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16093                         <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>
16094                         <div class="gallerytext">
16095 <p>caption
16096 </p>
16097                         </div>
16098                 </div></li>
16099 </ul>
16101 !! end
16103 !! test
16104 Gallery with wikitext inside caption
16105 !! wikitext
16106 <gallery>
16107 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16108 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16109 </gallery>
16110 !! html
16111 <ul class="gallery mw-gallery-traditional">
16112                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16113                         <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>
16114                         <div class="gallerytext">
16115 <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>
16116 </p>
16117                         </div>
16118                 </div></li>
16119                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16120                         <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>
16121                         <div class="gallerytext">
16122 <p>This is a test template
16123 </p>
16124                         </div>
16125                 </div></li>
16126 </ul>
16128 !! end
16130 !! test
16131 gallery (with showfilename option)
16132 !! wikitext
16133 <gallery showfilename>
16134 File:Nonexistant.jpg|caption
16135 File:Nonexistant.jpg
16136 image:foobar.jpg|some '''caption''' [[Main Page]]
16137 File:Foobar.jpg
16138 </gallery>
16139 !! html
16140 <ul class="gallery mw-gallery-traditional">
16141                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16142                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16143                         <div class="gallerytext">
16144 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16145 caption
16146 </p>
16147                         </div>
16148                 </div></li>
16149                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16150                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16151                         <div class="gallerytext">
16152 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
16153 </p>
16154                         </div>
16155                 </div></li>
16156                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16157                         <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>
16158                         <div class="gallerytext">
16159 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16160 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16161 </p>
16162                         </div>
16163                 </div></li>
16164                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16165                         <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>
16166                         <div class="gallerytext">
16167 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16168 </p>
16169                         </div>
16170                 </div></li>
16171 </ul>
16173 !! end
16175 !! test
16176 Gallery (with namespace-less filenames)
16177 !! wikitext
16178 <gallery>
16179 File:Nonexistant.jpg
16180 Nonexistant.jpg
16181 image:foobar.jpg
16182 foobar.jpg
16183 </gallery>
16184 !! html
16185 <ul class="gallery mw-gallery-traditional">
16186                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16187                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16188                         <div class="gallerytext">
16189                         </div>
16190                 </div></li>
16191                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16192                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
16193                         <div class="gallerytext">
16194                         </div>
16195                 </div></li>
16196                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16197                         <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>
16198                         <div class="gallerytext">
16199                         </div>
16200                 </div></li>
16201                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16202                         <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>
16203                         <div class="gallerytext">
16204                         </div>
16205                 </div></li>
16206 </ul>
16208 !! end
16210 !! test
16211 HTML Hex character encoding (spells the word "JavaScript")
16212 !! options
16213 parsoid=wt2html,wt2wt,html2html
16214 !! wikitext
16215 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16216 !! html/php
16217 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16218 </p>
16219 !! html/php+tidy
16220 <p>JavaScript</p>
16221 !! html/parsoid
16222 <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>
16223 !! end
16225 !! test
16226 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16227 !! wikitext
16228 &#xsee;&#XSEE;
16229 !! html/php
16230 <p>&amp;#xsee;&amp;#XSEE;
16231 </p>
16232 !! html/parsoid
16233 <p>&amp;#xsee;&amp;#XSEE;</p>
16234 !! end
16236 !! test
16237 HTML Hex character encoding mixed case
16238 !! options
16239 parsoid=wt2html,wt2wt,html2html
16240 !! wikitext
16241 &#xEE;&#Xee;
16242 !! html/php
16243 <p>&#xee;&#xee;
16244 </p>
16245 !! html/php+tidy
16246 <p>îî</p>
16247 !! html/parsoid
16248 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16249 !! end
16251 !! test
16252 __FORCETOC__ override
16253 !! wikitext
16254 __NEWSECTIONLINK__
16255 __FORCETOC__
16256 !! html
16257 <p><br />
16258 </p>
16259 !! end
16261 !! test
16262 ISBN code coverage
16263 !! wikitext
16264 ISBN  978-0-1234-56&#x20;789
16265 !! html
16266 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16267 </p>
16268 !! html+tidy
16269 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16270 !! end
16272 !! test
16273 ISBN followed by 5 spaces
16274 !! wikitext
16275 ISBN    
16276 !! html
16277 <p>ISBN    
16278 </p>
16279 !! end
16281 !! test
16282 Double ISBN
16283 !! wikitext
16284 ISBN ISBN 1234567890
16285 !! html
16286 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16287 </p>
16288 !! end
16290 !! test
16291 ISBN with an X
16292 !! wikitext
16293 ISBN 3-462-04561-X
16294 !! html
16295 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16296 </p>
16297 !! end
16299 !! test
16300 ISBN with empty prefix (parsoid test)
16301 !! wikitext
16302 ISBN 1234567890
16303 !! html/parsoid
16304 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16305 !! end
16307 !! test
16308 Bug 22905: <abbr> followed by ISBN followed by </a>
16309 !! wikitext
16310 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16311 !! html
16312 <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>
16313 </p>
16314 !! end
16316 !! test
16317 Double RFC
16318 !! wikitext
16319 RFC RFC 1234
16320 !! html
16321 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16322 </p>
16323 !! end
16325 !! test
16326 Double RFC with a wiki link
16327 !! wikitext
16328 RFC [[RFC 1234]]
16329 !! html
16330 <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>
16331 </p>
16332 !! end
16334 !! test
16335 RFC code coverage
16336 !! wikitext
16337 RFC   983&#x20;987
16338 !! html
16339 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16340 </p>
16341 !! html+tidy
16342 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16343 !! end
16345 !! test
16346 Centre-aligned image
16347 !! wikitext
16348 [[Image:foobar.jpg|centre]]
16349 !! html
16350 <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>
16352 !!end
16354 !! test
16355 None-aligned image
16356 !! wikitext
16357 [[Image:foobar.jpg|none]]
16358 !! html
16359 <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>
16361 !!end
16363 !! test
16364 Width + Height sized image (using px) (height is ignored)
16365 !! wikitext
16366 [[Image:foobar.jpg|640x480px]]
16367 !! html
16368 <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>
16369 </p>
16370 !!end
16372 !! test
16373 Width-sized image (using px, no following whitespace)
16374 !! wikitext
16375 [[Image:foobar.jpg|640px]]
16376 !! html
16377 <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>
16378 </p>
16379 !!end
16381 !! test
16382 Width-sized image (using px, with following whitespace - test regression from r39467)
16383 !! wikitext
16384 [[Image:foobar.jpg|640px ]]
16385 !! html
16386 <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>
16387 </p>
16388 !!end
16390 !! test
16391 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16392 !! wikitext
16393 [[Image:foobar.jpg| 640px]]
16394 !! html
16395 <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>
16396 </p>
16397 !!end
16399 !! test
16400 Image with page parameter
16401 !! options
16402 djvu
16403 !! wikitext
16404 [[File:LoremIpsum.djvu|page=2]]
16405 !! html
16406 <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>
16407 </p>
16408 !! end
16410 !! test
16411 Another italics / bold test
16412 !! wikitext
16413  ''' ''x'
16414 !! html
16415 <pre>'<i> </i>x'
16416 </pre>
16417 !!end
16419 # Note the results may be incorrect, as parserTest output included this:
16420 # XML error: Mismatched tag at byte 6120:
16421 # ...<dd> </dt></dl> </dd...
16422 !! test
16423 dt/dd/dl test
16424 !! options
16425 disabled
16426 !! wikitext
16427 :;;;::
16428 !! html
16429 <dl>
16430 <dd><dl>
16431 <dt><dl>
16432 <dt><dl>
16433 <dt><dl>
16434 <dd><dl>
16435 <dd>
16436 </dd>
16437 </dl>
16438 </dd>
16439 </dl>
16440 </dt>
16441 </dl>
16442 </dt>
16443 </dl>
16444 </dt>
16445 </dl>
16446 </dd>
16447 </dl>
16449 !!end
16452 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16453 !! test
16454 Images with the "|" character in the comment
16455 !! wikitext
16456 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16457 !! html/php
16458 <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>
16460 !! html/parsoid
16461 <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>
16462 !! end
16464 !! test
16465 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16466 !! wikitext
16467 <html><script>alert(1);</script></html>
16468 !! html
16469 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16470 </p>
16471 !! end
16473 !! test
16474 HTML with raw HTML ($wgRawHtml==true)
16475 !! options
16476 wgRawHtml=1
16477 !! wikitext
16478 <html><script>alert(1);</script></html>
16479 !! html
16480 <p><script>alert(1);</script>
16481 </p>
16482 !! end
16484 !! test
16485 Parents of subpages, one level up
16486 !! options
16487 subpage title=[[Subpage test/L1/L2/L3]]
16488 !! wikitext
16489 [[../|L2]]
16490 !! html
16491 <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>
16492 </p>
16493 !! end
16496 !! test
16497 Parents of subpages, one level up, not named
16498 !! options
16499 subpage title=[[Subpage test/L1/L2/L3]]
16500 !! wikitext
16501 [[../]]
16502 !! html
16503 <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>
16504 </p>
16505 !! end
16509 !! test
16510 Parents of subpages, two levels up
16511 !! options
16512 subpage title=[[Subpage test/L1/L2/L3]]
16513 !! wikitext
16514 [[../../|L1]]2
16516 [[../../|L1]]l
16517 !! html
16518 <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
16519 </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>
16520 </p>
16521 !! end
16523 !! test
16524 Parents of subpages, two levels up, without trailing slash or name.
16525 !! options
16526 subpage title=[[Subpage test/L1/L2/L3]]
16527 !! wikitext
16528 [[../..]]
16529 !! html
16530 <p>[[../..]]
16531 </p>
16532 !! end
16534 !! test
16535 Parents of subpages, two levels up, with lots of extra trailing slashes.
16536 !! options
16537 subpage title=[[Subpage test/L1/L2/L3]]
16538 !! wikitext
16539 [[../../////]]
16540 !! html
16541 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
16542 </p>
16543 !! end
16545 !! article
16546 Subpage test/L1/L2/L3Sibling
16547 !! text
16548 Sibling article
16549 !! endarticle
16551 !! test
16552 Transclusion of a sibling page (one level up)
16553 !! options
16554 subpage title=[[Subpage test/L1/L2/L3]]
16555 !! wikitext
16556 {{../L3Sibling}}
16557 !! html
16558 <p>Sibling article
16559 </p>
16560 !! end
16562 !! test
16563 Transclusion of a child page
16564 !! options
16565 subpage title=[[Subpage test/L1/L2]]
16566 !! wikitext
16567 {{/L3Sibling}}
16568 !! html
16569 <p>Sibling article
16570 </p>
16571 !! end
16573 !! test
16574 Non-transclusion because of too many up levels
16575 !! options
16576 subpage title=[[Subpage test/L1/L2/L3]]
16577 !! wikitext
16578 {{../../../../More than parent}}
16579 !! html
16580 <p>{{../../../../More than parent}}
16581 </p>
16582 !! end
16584 !! test
16585 Definition list code coverage
16586 !! wikitext
16587 ; title   : def
16588 ; title : def
16589 ;title: def
16590 !! html
16591 <dl><dt> title  &#160;</dt>
16592 <dd> def</dd>
16593 <dt> title&#160;</dt>
16594 <dd> def</dd>
16595 <dt>title</dt>
16596 <dd> def</dd></dl>
16598 !! end
16600 !! test
16601 Don't fall for the self-closing div
16602 !! wikitext
16603 <div>hello world</div/>
16604 !! html
16605 <div>hello world</div>
16607 !! end
16609 !! test
16610 MSGNW magic word
16611 !! wikitext
16612 {{MSGNW:msg}}
16613 !! html
16614 <p>&#91;&#91;:Template:Msg&#93;&#93;
16615 </p>
16616 !! end
16618 !! test
16619 RAW magic word
16620 !! wikitext
16621 {{RAW:QUERTY}}
16622 !! html
16623 <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>
16624 </p>
16625 !! end
16627 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
16628 !! test
16629 Always escape literal '>' in output, not just after '<'
16630 !! wikitext
16632 !! html
16633 <p>&gt;&lt;&gt;
16634 </p>
16635 !! end
16637 !! test
16638 Template caching
16639 !! wikitext
16640 {{Test}}
16641 {{Test}}
16642 !! html
16643 <p>This is a test template
16644 This is a test template
16645 </p>
16646 !! end
16649 !! article
16650 MediaWiki:Fake
16651 !! text
16652 ==header==
16653 !! endarticle
16655 !! test
16656 Inclusion of !userCanEdit() content
16657 !! wikitext
16658 {{MediaWiki:Fake}}
16659 !! html
16660 <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>
16662 !! end
16665 !! test
16666 Out-of-order TOC heading levels
16667 !! wikitext
16668 ==2==
16669 ======6======
16670 ===3===
16672 =====5=====
16673 ==2==
16674 !! html
16675 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16676 <ul>
16677 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
16678 <ul>
16679 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
16680 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
16681 </ul>
16682 </li>
16683 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
16684 <ul>
16685 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
16686 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
16687 </ul>
16688 </li>
16689 </ul>
16690 </div>
16692 <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>
16693 <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>
16694 <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>
16695 <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>
16696 <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>
16697 <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>
16699 !! end
16702 !! test
16703 ISBN with a dummy number
16704 !! wikitext
16705 ISBN ---
16706 !! html
16707 <p>ISBN ---
16708 </p>
16709 !! end
16712 !! test
16713 ISBN with space-delimited number
16714 !! wikitext
16715 ISBN 92 9017 032 8
16716 !! html
16717 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16718 </p>
16719 !! end
16722 !! test
16723 ISBN with multiple spaces, no number
16724 !! wikitext
16725 ISBN  foo
16726 !! html
16727 <p>ISBN  foo
16728 </p>
16729 !! end
16732 !! test
16733 ISBN length
16734 !! wikitext
16735 ISBN 123456789
16737 ISBN 1234567890
16739 ISBN 12345678901
16740 !! html
16741 <p>ISBN 123456789
16742 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16743 </p><p>ISBN 12345678901
16744 </p>
16745 !! end
16748 !! test
16749 ISBN with trailing year (bug 8110)
16750 !! wikitext
16751 ISBN 1-234-56789-0 - 2006
16753 ISBN 1 234 56789 0 - 2006
16754 !! html
16755 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16756 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16757 </p>
16758 !! end
16761 !! test
16762 anchorencode
16763 !! wikitext
16764 {{anchorencode:foo bar©#%n}}
16765 !! html
16766 <p>foo_bar.C2.A9.23.25n
16767 </p>
16768 !! end
16770 !! test
16771 anchorencode trims spaces
16772 !! wikitext
16773 {{anchorencode: __pretty__please__}}
16774 !! html
16775 <p>pretty_please
16776 </p>
16777 !! end
16779 !! test
16780 anchorencode deals with links
16781 !! wikitext
16782 {{anchorencode: [[hello|world]] [[hi]]}}
16783 !! html
16784 <p>world_hi
16785 </p>
16786 !! end
16788 !! test
16789 anchorencode deals with templates
16790 !! wikitext
16791 {{anchorencode: {{Foo}} }}
16792 !! html
16793 <p>FOO
16794 </p>
16795 !! end
16797 !! test
16798 anchorencode encodes like the TOC generator: (bug 18431)
16799 !! wikitext
16800 === _ +:.3A%3A&&amp;]] ===
16801 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16802 __NOEDITSECTION__
16803 !! html
16804 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16805 <p>.2B:.3A.253A.26.26.5D.5D
16806 </p>
16807 !! end
16809 !! test
16810 Bug 6200: blockquotes and paragraph formatting
16811 !! wikitext
16812 <blockquote>
16814 </blockquote>
16818  baz
16819 !! html
16820 <blockquote>
16821 <p>foo
16822 </p>
16823 </blockquote>
16824 <p>bar
16825 </p>
16826 <pre>baz
16827 </pre>
16828 !! end
16830 !! test
16831 Bug 8293: Use of center tag ruins paragraph formatting
16832 !! wikitext
16833 <center>
16835 </center>
16839  baz
16840 !! html
16841 <center>
16842 <p>foo
16843 </p>
16844 </center>
16845 <p>bar
16846 </p>
16847 <pre>baz
16848 </pre>
16849 !! end
16851 !!test
16852 Parsing of overlapping (improperly nested) inline html tags
16853 !! wikitext
16854 <span><s>x</span></s>
16855 !! html/php
16856 <p><span><s>x&lt;/span&gt;</s></span>
16857 </p>
16858 !! html/parsoid
16859 <p><span><s>x</s></span>
16860 </p>
16861 !!end
16864 ### Language variants related tests
16866 !! test
16867 Self-link in language variants
16868 !! options
16869 title=[[Dunav]] language=sr
16870 !! wikitext
16871 Both [[Dunav]] and [[Дунав]] are names for this river.
16872 !! html
16873 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16874 </p>
16875 !!end
16877 !! article
16878 Дуна
16879 !! text
16880 content
16881 !! endarticle
16883 !! test
16884 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16885 !! options
16886 title=[[Duna]] language=sr
16887 !! wikitext
16888 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16889 !! html
16890 <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.
16891 </p>
16892 !! end
16894 !! test
16895 Link to a section of a variant of this title shouldn't be parsed as self-link
16896 !! options
16897 title=[[Duna]] language=sr
16898 !! wikitext
16899 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16900 !! html
16901 <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.
16902 </p>
16903 !! end
16905 !! test
16906 Link to pages in language variants
16907 !! options
16908 language=sr
16909 !! wikitext
16910 Main Page can be written as [[Маин Паге]]
16911 !! html
16912 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16913 </p>
16914 !!end
16917 !! test
16918 Multiple links to pages in language variants
16919 !! options
16920 language=sr
16921 !! wikitext
16922 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16923 !! html
16924 <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>.
16925 </p>
16926 !!end
16929 !! test
16930 Simple template in language variants
16931 !! options
16932 language=sr
16933 !! wikitext
16934 {{тест}}
16935 !! html
16936 <p>This is a test template
16937 </p>
16938 !! end
16941 !! test
16942 Template with explicit namespace in language variants
16943 !! options
16944 language=sr
16945 !! wikitext
16946 {{Template:тест}}
16947 !! html
16948 <p>This is a test template
16949 </p>
16950 !! end
16953 !! test
16954 Basic test for template parameter in language variants
16955 !! options
16956 language=sr
16957 !! wikitext
16958 {{парамтест|param=foo}}
16959 !! html
16960 <p>This is a test template with parameter foo
16961 </p>
16962 !! end
16965 !! test
16966 Simple category in language variants
16967 !! options
16968 language=sr cat
16969 !! wikitext
16970 [[Category:МедиаWики Усер'с Гуиде]]
16971 !! html
16972 <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>
16973 !! end
16976 !! article
16977 Category:分类
16978 !! text
16979 blah
16980 !! endarticle
16982 !! article
16983 Category:分類
16984 !! text
16985 blah
16986 !! endarticle
16988 !! test
16989 Don't convert blue categorylinks to another variant (bug 33210)
16990 !! options
16991 language=zh cat
16992 !! wikitext
16993 [[A]][[Category:分类]]
16994 !! html
16995 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16996 !! end
16999 !! test
17000 Stripping -{}- tags (language variants)
17001 !! options
17002 language=sr
17003 !! wikitext
17004 Latin proverb: -{Ne nuntium necare}-
17005 !! html
17006 <p>Latin proverb: Ne nuntium necare
17007 </p>
17008 !! end
17011 !! test
17012 Prevent conversion with -{}- tags (language variants)
17013 !! options
17014 language=sr variant=sr-ec
17015 !! wikitext
17016 Latinski: -{Ne nuntium necare}-
17017 !! html
17018 <p>Латински: Ne nuntium necare
17019 </p>
17020 !! end
17023 !! test
17024 Prevent conversion of text with -{}- tags (language variants)
17025 !! options
17026 language=sr variant=sr-ec
17027 !! wikitext
17028 Latinski: -{Ne nuntium necare}-
17029 !! html
17030 <p>Латински: Ne nuntium necare
17031 </p>
17032 !! end
17035 !! test
17036 Prevent conversion of links with -{}- tags (language variants)
17037 !! options
17038 language=sr variant=sr-ec
17039 !! wikitext
17040 -{[[Main Page]]}-
17041 !! html
17042 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17043 </p>
17044 !! end
17047 !! test
17048 -{}- tags within headlines (within html for parserConvert())
17049 !! options
17050 language=sr variant=sr-ec
17051 !! wikitext
17052 == -{Naslov}- ==
17053 !! html
17054 <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>
17056 !! end
17059 !! test
17060 Explicit definition of language variant alternatives
17061 !! options
17062 language=zh variant=zh-tw
17063 !! wikitext
17064 -{zh:China;zh-tw:Taiwan}-, not China
17065 !! html
17066 <p>Taiwan, not China
17067 </p>
17068 !! end
17071 !! test
17072 Conversion around HTML tags
17073 !! options
17074 language=sr variant=sr-ec
17075 !! wikitext
17076 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17077 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17078 !! html
17080 <span title="ЛаCтин">ски</span>
17081 </p>
17082 !! end
17085 !! test
17086 Explicit session-wise language variant mapping (A flag and - flag)
17087 !! options
17088 language=zh variant=zh-tw
17089 !! wikitext
17090 Taiwan is not China.
17091 But -{A|zh:China;zh-tw:Taiwan}- is China,
17092 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17093 and -{China}- is China.
17094 !! html
17095 <p>Taiwan is not China.
17096 But Taiwan is Taiwan,
17097 (This should be stripped!)
17098 and China is China.
17099 </p>
17100 !! end
17102 !! test
17103 Explicit session-wise language variant mapping (H flag for hide)
17104 !! options
17105 language=zh variant=zh-tw
17106 !! wikitext
17107 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17108 Taiwan is China.
17109 !! html
17110 <p>(This should be stripped!)
17111 Taiwan is Taiwan.
17112 </p>
17113 !! end
17115 !! test
17116 Adding explicit conversion rule for title (T flag)
17117 !! options
17118 language=zh variant=zh-tw showtitle
17119 !! wikitext
17120 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17121 !! html
17122 Taiwan
17123 <p>Should be stripped!
17124 </p>
17125 !! end
17127 !! test
17128 Testing that changing the language variant here in the tests actually works
17129 !! options
17130 language=zh variant=zh showtitle
17131 !! wikitext
17132 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17133 !! html
17134 China
17135 <p>Should be stripped!
17136 </p>
17137 !! end
17139 !! test
17140 Recursive conversion of alt and title attrs shouldn't clear converter state
17141 !! options
17142 language=zh variant=zh-cn showtitle
17143 !! wikitext
17144 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17145 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17146 !! html
17147 China
17149 Should be stripped<span title="Exclamation">!</span>
17150 </p>
17151 !! end
17153 !! test
17154 Bug 24072: more test on conversion rule for title
17155 !! options
17156 language=zh variant=zh-tw showtitle
17157 !! wikitext
17158 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17159 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17160 !! html
17161 Taiwan
17162 <p>This should be stripped!
17163 This won't take interferes with the title rule.
17164 </p>
17165 !! end
17167 !! test
17168 Partly disable title conversion if variant == main language code
17169 !! options
17170 language=zh variant=zh title=[[ZH]] showtitle
17171 !! wikitext
17172 -{T|zh-cn:CN;zh-tw:TW}-
17173 !! html
17176 </p>
17177 !! end
17179 !! test
17180 Partly disable title conversion if variant == main language code, more
17181 !! options
17182 language=zh variant=zh title=[[ZH]] showtitle
17183 !! wikitext
17184 -{T|TW}-
17185 !! html
17188 </p>
17189 !! end
17191 !! test
17192 Raw output of variant escape tags (R flag)
17193 !! options
17194 language=zh variant=zh-tw
17195 !! wikitext
17196 Raw: -{R|zh:China;zh-tw:Taiwan}-
17197 !! html
17198 <p>Raw: zh:China;zh-tw:Taiwan
17199 </p>
17200 !! end
17202 !! test
17203 Nested using of manual convert syntax
17204 !! options
17205 language=zh variant=zh-hk
17206 !! wikitext
17207 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17208 !! html
17209 <p>Nested: Hello Hong Kong!
17210 </p>
17211 !! end
17213 !! test
17214 Proper conversion of text in external links
17215 !! options
17216 language=sr variant=sr-ec
17217 !! wikitext
17218 http://www.google.com
17219 gopher://www.google.com
17220 [http://www.google.com http://www.google.com]
17221 [gopher://www.google.com gopher://www.google.com]
17222 [https://www.google.com irc://www.google.com]
17223 [ftp://www.google.com www.google.com/ftp://dir]
17224 [//www.google.com www.google.com]
17225 !! html
17226 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17227 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17228 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17229 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17230 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17231 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17232 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17233 </p>
17234 !! end
17236 !! test
17237 Do not convert roman numbers to language variants
17238 !! options
17239 language=sr variant=sr-ec
17240 !! wikitext
17241 Fridrih IV je car.
17242 !! html
17243 <p>Фридрих IV је цар.
17244 </p>
17245 !! end
17247 !! test
17248 Unclosed language converter markup "-{"
17249 !! options
17250 language=sr
17251 !! wikitext
17252 -{T|hello
17253 !! html
17254 <p>-{T|hello
17255 </p>
17256 !! end
17258 !! test
17259 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17260 !! options
17261 language=sr
17262 !! wikitext
17263 -{R|=&gt;}-
17264 !! html
17265 <p>=&gt;
17266 </p>
17267 !!end
17269 !! test
17270 Don't break link parsing if language converter markup is in the caption.
17271 !! options
17272 language=sr variant=sr-ec
17273 !! wikitext
17274 [[Main Page|-{R|main page}-]]
17275 !! html
17276 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17277 </p>
17278 !! end
17280 # This test is currently broken in the PHP parser (bug 52661)
17281 !! test
17282 Don't break image parsing if language converter markup is in the caption.
17283 !! options
17284 language=sr
17285 disabled
17286 !! wikitext
17287 [[File:Foobar.jpg|-{R|caption}-]]
17288 !! html
17289 <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>
17290 </p>
17291 !! end
17293 # This test is currently broken in the PHP parser (bug 52661)
17294 !! test
17295 Don't break list handling if language converter markup is in the item.
17296 !! options
17297 language=zh variant=zh-cn
17298 disabled
17299 !! wikitext
17300 ;-{zh-cn:AAA;zh-tw:BBB}-
17301 !! html
17302 <dl><dt>AAA
17303 </dt></dl>
17305 !! end
17307 # This test is currently broken in the PHP parser (bug 52661)
17308 !! test
17309 Don't break table handling if language converter markup is in the cell.
17310 !! options
17311 language=sr variant=sr-ec
17312 disabled
17313 !! wikitext
17316 | -{R|B}-
17318 !! html
17319 <table>
17321 <tr>
17322 <td> B
17323 </td></tr></table>
17325 !! end
17327 !! test
17328 Bug 529: Uncovered bullet
17329 !! wikitext
17330 * Foo {{bullet}}
17331 !! html
17332 <ul><li> Foo </li>
17333 <li> Bar</li></ul>
17335 !! end
17337 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17338 # Templates in Wikipedia rely on this behavior, as tidy has always been
17339 # enabled there. These tests are normally run *without* tidy, so specify the
17340 # full output here. 
17341 # To test realistic parsing behavior, apply a tidy-like transformation to both
17342 # the expected output and your parser's output.
17343 !! test
17344 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17345 !! wikitext
17346 ******* Foo {{bullet}}
17347 !! html
17348 <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>
17349 <li> Bar</li></ul>
17351 !! end
17353 !! test
17354 Bug 529: Uncovered table already at line-start
17355 !! wikitext
17358 {{table}}
17360 !! html
17361 <p>x
17362 </p>
17363 <table>
17364 <tr>
17365 <td> 1 </td>
17366 <td> 2
17367 </td></tr>
17368 <tr>
17369 <td> 3 </td>
17370 <td> 4
17371 </td></tr></table>
17372 <p>y
17373 </p>
17374 !! end
17376 !! test
17377 Bug 529: Uncovered bullet in parser function result
17378 !! wikitext
17379 * Foo {{lc:{{bullet}} }}
17380 !! html
17381 <ul><li> Foo </li>
17382 <li> bar</li></ul>
17384 !! end
17386 !! test
17387 Bug 5678: Double-parsed template argument
17388 !! wikitext
17389 {{lc:{{{1}}}|hello}}
17390 !! html
17391 <p>{{{1}}}
17392 </p>
17393 !! end
17395 !! test
17396 Bug 5678: Double-parsed template invocation
17397 !! wikitext
17398 {{lc:{{paramtest {{!}} param = hello }} }}
17399 !! html
17400 <p>{{paramtest | param = hello }}
17401 </p>
17402 !! end
17404 !! test
17405 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17406 !! options
17407 language=cs
17408 title=[[Main Page]]
17409 !! wikitext
17410 {{PRVNÍVELKÉ:ěščř}}
17411 {{prvnívelké:ěščř}}
17412 {{PRVNÍMALÉ:ěščř}}
17413 {{prvnímalé:ěščř}}
17414 {{MALÁ:ěščř}}
17415 {{malá:ěščř}}
17416 {{VELKÁ:ěščř}}
17417 {{velká:ěščř}}
17418 !! html
17419 <p>Ěščř
17420 Ěščř
17421 ěščř
17422 ěščř
17423 ěščř
17424 ěščř
17425 ĚŠČŘ
17426 ĚŠČŘ
17427 </p>
17428 !! end
17430 !! test
17431 Morwen/13: Unclosed link followed by heading
17432 !! wikitext
17433 [[link
17434 ==heading==
17435 !! html
17436 <p>[[link
17437 </p>
17438 <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>
17440 !! end
17442 !! test
17443 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17444 !! wikitext
17445 {{foo|
17446 =heading=
17447 !! html
17448 <p>{{foo|
17449 </p>
17450 <h1><span class="mw-headline" id="heading">heading</span></h1>
17452 !! end
17454 !! test
17455 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17456 !! wikitext
17457 {{foo|
17458 ==heading==
17459 !! html
17460 <p>{{foo|
17461 </p>
17462 <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>
17464 !! end
17466 !! test
17467 Tildes in comments
17468 !! options
17470 !! wikitext
17471 <!-- ~~~~ -->
17472 !! html
17473 <!-- ~~~~ -->
17474 !! end
17476 !! test
17477 Paragraphs inside divs (no extra line breaks)
17478 !! wikitext
17479 <div>Line one
17481 Line two</div>
17482 !! html
17483 <div>Line one
17484 Line two</div>
17486 !! end
17488 !! test
17489 Paragraphs inside divs (extra line break on open)
17490 !! wikitext
17491 <div>
17492 Line one
17494 Line two</div>
17495 !! html
17496 <div>
17497 <p>Line one
17498 </p>
17499 Line two</div>
17501 !! end
17503 !! test
17504 Paragraphs inside divs (extra line break on close)
17505 !! wikitext
17506 <div>Line one
17508 Line two
17509 </div>
17510 !! html
17511 <div>Line one
17512 <p>Line two
17513 </p>
17514 </div>
17516 !! end
17518 !! test
17519 Paragraphs inside divs (extra line break on open and close)
17520 !! wikitext
17521 <div>
17522 Line one
17524 Line two
17525 </div>
17526 !! html
17527 <div>
17528 <p>Line one
17529 </p><p>Line two
17530 </p>
17531 </div>
17533 !! end
17535 !! test
17536 Nesting tags, paragraphs on lines which begin with <div>
17537 !! options
17538 disabled
17539 !! wikitext
17540 <div></div><strong>A
17541 B</strong>
17542 !! html
17543 <div></div>
17544 <p><strong>A
17545 B</strong>
17546 </p>
17547 !! end
17549 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
17550 !! test
17551 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
17552 !! wikitext
17553 <blockquote>Line one
17555 Line two</blockquote>
17556 !! html
17557 <blockquote>Line one
17558 Line two</blockquote>
17560 !! html+tidy
17561 <blockquote>
17562 <p>Line one Line two</p>
17563 </blockquote>
17564 !! end
17566 !! test
17567 Bug 6200: paragraphs inside blockquotes (extra line break on open)
17568 !! wikitext
17569 <blockquote>
17570 Line one
17572 Line two</blockquote>
17573 !! html
17574 <blockquote>
17575 <p>Line one
17576 </p>
17577 Line two</blockquote>
17579 !! html+tidy
17580 <blockquote>
17581 <p>Line one</p>
17582 Line two</blockquote>
17583 !! end
17585 !! test
17586 Bug 6200: paragraphs inside blockquotes (extra line break on close)
17587 !! wikitext
17588 <blockquote>Line one
17590 Line two
17591 </blockquote>
17592 !! html
17593 <blockquote>Line one
17594 <p>Line two
17595 </p>
17596 </blockquote>
17598 !! html+tidy
17599 <blockquote>
17600 <p>Line one</p>
17601 <p>Line two</p>
17602 </blockquote>
17603 !! end
17605 !! test
17606 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
17607 !! wikitext
17608 <blockquote>
17609 Line one
17611 Line two
17612 </blockquote>
17613 !! html
17614 <blockquote>
17615 <p>Line one
17616 </p><p>Line two
17617 </p>
17618 </blockquote>
17620 !! html+tidy
17621 <blockquote>
17622 <p>Line one</p>
17623 <p>Line two</p>
17624 </blockquote>
17625 !! end
17627 !! test
17628 Paragraphs inside blockquotes/divs (no extra line breaks)
17629 !! wikitext
17630 <blockquote><div>Line one
17632 Line two</div></blockquote>
17633 !! html
17634 <blockquote><div>Line one
17635 Line two</div></blockquote>
17637 !! end
17639 !! test
17640 Paragraphs inside blockquotes/divs (extra line break on open)
17641 !! wikitext
17642 <blockquote><div>
17643 Line one
17645 Line two</div></blockquote>
17646 !! html
17647 <blockquote><div>
17648 <p>Line one
17649 </p>
17650 Line two</div></blockquote>
17652 !! end
17654 !! test
17655 Paragraphs inside blockquotes/divs (extra line break on close)
17656 !! wikitext
17657 <blockquote><div>Line one
17659 Line two
17660 </div></blockquote>
17661 !! html
17662 <blockquote><div>Line one
17663 <p>Line two
17664 </p>
17665 </div></blockquote>
17667 !! end
17669 !! test
17670 Paragraphs inside blockquotes/divs (extra line break on open and close)
17671 !! wikitext
17672 <blockquote><div>
17673 Line one
17675 Line two
17676 </div></blockquote>
17677 !! html
17678 <blockquote><div>
17679 <p>Line one
17680 </p><p>Line two
17681 </p>
17682 </div></blockquote>
17684 !! end
17686 !! test
17687 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
17688 !! options
17689 wgLinkHolderBatchSize=0
17690 !! wikitext
17691 [[meatball:1]]
17692 [[meatball:2]]
17693 [[meatball:3]]
17694 !! html
17695 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
17696 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
17697 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
17698 </p>
17699 !! end
17701 !! test
17702 Free external link invading image caption
17703 !! wikitext
17704 [[Image:Foobar.jpg|thumb|http://x|hello]]
17705 !! html
17706 <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>
17708 !! end
17710 !! test
17711 Bug 15196: localised external link numbers
17712 !! options
17713 language=fa
17714 !! wikitext
17715 [http://en.wikipedia.org/]
17716 !! html/php
17717 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
17718 </p>
17719 !! html/parsoid
17720 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17721 !! end
17723 !! test
17724 Multibyte character in padleft
17725 !! wikitext
17726 {{padleft:-Hello|7|Æ}}
17727 !! html
17728 <p>Æ-Hello
17729 </p>
17730 !! end
17732 !! test
17733 Multibyte character in padright
17734 !! wikitext
17735 {{padright:Hello-|7|Æ}}
17736 !! html
17737 <p>Hello-Æ
17738 </p>
17739 !! end
17741 !!test
17742 formatdate parser function
17743 !! wikitext
17744 {{#formatdate:2009-03-24}}
17745 !! html
17746 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17747 </p>
17748 !! end
17750 !!test
17751 formatdate parser function, with default format
17752 !! wikitext
17753 {{#formatdate:2009-03-24|mdy}}
17754 !! html
17755 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17756 </p>
17757 !! end
17759 !! test
17760 Spacing of numbers in formatted dates
17761 !! wikitext
17762 {{#formatdate:January 15}}
17763 !! html
17764 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17765 </p>
17766 !! end
17768 !! test
17769 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
17770 !! options
17771 language=nl title=[[MediaWiki:Common.css]]
17772 !! wikitext
17773 {{#formatdate:2009-03-24|dmy}}
17774 !! html
17775 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17776 </p>
17777 !! end
17784 # Edit comments
17787 !! test
17788 Edit comment with link
17789 !! options
17790 comment
17791 !! wikitext
17792 I like the [[Main Page]] a lot
17793 !! html
17794 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17795 !!end
17797 !! test
17798 Edit comment with link and link text
17799 !! options
17800 comment
17801 !! wikitext
17802 I like the [[Main Page|best pages]] a lot
17803 !! html
17804 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17805 !!end
17807 !! test
17808 Edit comment with link and link text with suffix
17809 !! options
17810 comment
17811 !! wikitext
17812 I like the [[Main Page|best page]]s a lot
17813 !! html
17814 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17815 !!end
17817 !! test
17818 Edit comment with section link (non-local, eg in history list)
17819 !! options
17820 comment title=[[Main Page]]
17821 !! wikitext
17822 /* External links */ removed bogus entries
17823 !! html
17824 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17825 !!end
17827 !! test
17828 Edit comment with section link and text before it (non-local, eg in history list)
17829 !! options
17830 comment title=[[Main Page]]
17831 !! wikitext
17832 pre-comment text /* External links */ removed bogus entries
17833 !! html
17834 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>
17835 !!end
17837 !! test
17838 Edit comment with section link (local, eg in diff view)
17839 !! options
17840 comment local title=[[Main Page]]
17841 !! wikitext
17842 /* External links */ removed bogus entries
17843 !! html
17844 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17845 !!end
17847 !! test
17848 Edit comment with subpage link (bug 14080)
17849 !! options
17850 comment
17851 subpage
17852 title=[[Subpage test]]
17853 !! wikitext
17854 Poked at a [[/subpage]] here...
17855 !! html
17856 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17857 !!end
17859 !! test
17860 Edit comment with subpage link and link text (bug 14080)
17861 !! options
17862 comment
17863 subpage
17864 title=[[Subpage test]]
17865 !! wikitext
17866 Poked at a [[/subpage|neat little page]] here...
17867 !! html
17868 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17869 !!end
17871 !! test
17872 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17873 !! options
17874 comment
17875 title=[[Subpage test]]
17876 !! wikitext
17877 Poked at a [[/subpage]] here...
17878 !! html
17879 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...
17880 !!end
17882 !! test
17883 Edit comment with bare anchor link (local, as on diff)
17884 !! options
17885 comment
17886 local
17887 title=[[Main Page]]
17888 !! wikitext
17889 [[#section]]
17890 !! html
17891 <a href="#section">#section</a>
17892 !! end
17894 !! test
17895 Edit comment with bare anchor link (non-local, as on history)
17896 !! options
17897 comment
17898 title=[[Main Page]]
17899 !! wikitext
17900 [[#section]]
17901 !! html
17902 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17903 !! end
17905 !! test
17906 Anchor starting with underscore
17907 !! wikitext
17908 [[#_ref|One]]
17909 !! html
17910 <p><a href="#_ref">One</a>
17911 </p>
17912 !! end
17914 !! test
17915 Id starting with underscore
17916 !! wikitext
17917 <div id="_ref"></div>
17918 !! html
17919 <div id="_ref"></div>
17921 !! end
17923 !! test
17924 Space normalisation on autocomment (bug 22784)
17925 !! options
17926 comment
17927 title=[[Main Page]]
17928 !! wikitext
17929 /* __hello__world__ */
17930 !! html
17931 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17932 !! end
17934 !! test
17935 percent-encoding and + signs in comments (Bug 26410)
17936 !! options
17937 comment
17938 !! wikitext
17939 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17940 !! html
17941 <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>
17942 !! end
17944 !! test
17945 Bad images - basic functionality
17946 !! options
17947 disabled
17948 !! wikitext
17949 [[File:Bad.jpg]]
17950 !! html
17951 !! end
17953 !! test
17954 Bad images - bug 16039: text after bad image disappears
17955 !! options
17956 disabled
17957 !! wikitext
17958 Foo bar
17959 [[File:Bad.jpg]]
17960 Bar foo
17961 !! html
17962 <p>Foo bar
17963 </p><p>Bar foo
17964 </p>
17965 !! end
17967 !! test
17968 Verify that displaytitle works (bug #22501) no displaytitle
17969 !! options
17970 showtitle
17971 !! config
17972 wgAllowDisplayTitle=true
17973 wgRestrictDisplayTitle=false
17974 !! wikitext
17975 this is not the the title
17976 !! html
17977 Parser test
17978 <p>this is not the the title
17979 </p>
17980 !! end
17982 !! test
17983 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17984 !! options
17985 showtitle
17986 title=[[Screen]]
17987 !! config
17988 wgAllowDisplayTitle=true
17989 wgRestrictDisplayTitle=false
17990 !! wikitext
17991 this is not the the title
17992 {{DISPLAYTITLE:whatever}}
17993 !! html
17994 whatever
17995 <p>this is not the the title
17996 </p>
17997 !! end
17999 !! test
18000 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18001 !! options
18002 showtitle
18003 title=[[Screen]]
18004 !! config
18005 wgAllowDisplayTitle=true
18006 wgRestrictDisplayTitle=true
18007 !! wikitext
18008 this is not the the title
18009 {{DISPLAYTITLE:whatever}}
18010 !! html
18011 Screen
18012 <p>this is not the the title
18013 </p>
18014 !! end
18016 !! test
18017 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18018 !! options
18019 showtitle
18020 title=[[Screen]]
18021 !! config
18022 wgAllowDisplayTitle=true
18023 wgRestrictDisplayTitle=true
18024 !! wikitext
18025 this is not the the title
18026 {{DISPLAYTITLE:screen}}
18027 !! html
18028 screen
18029 <p>this is not the the title
18030 </p>
18031 !! end
18033 !! test
18034 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18035 !! options
18036 showtitle
18037 title=[[Screen]]
18038 !! config
18039 wgAllowDisplayTitle=false
18040 !! wikitext
18041 this is not the the title
18042 {{DISPLAYTITLE:screen}}
18043 !! html
18044 Screen
18045 <p>this is not the the title
18046 <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>
18047 </p>
18048 !! end
18050 !! test
18051 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18052 !! options
18053 showtitle
18054 title=[[Screen]]
18055 !! config
18056 wgAllowDisplayTitle=false
18057 !! wikitext
18058 this is not the the title
18059 !! html
18060 Screen
18061 <p>this is not the the title
18062 </p>
18063 !! end
18065 !! test
18066 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18067 !! options
18068 showtitle
18069 title=[[Screen]]
18070 !! config
18071 wgAllowDisplayTitle=true
18072 wgRestrictDisplayTitle=true
18073 !! wikitext
18074 this is not the the title
18075 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18076 !! html
18077 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18078 <p>this is not the the title
18079 </p>
18080 !! end
18082 !! test
18083 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18084 !! options
18085 showtitle
18086 title=[[Screen]]
18087 !! config
18088 wgAllowDisplayTitle=true
18089 wgRestrictDisplayTitle=true
18090 !! wikitext
18091 this is not the the title
18092 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18093 !! html
18094 <span style="color: red;">s</span>creen
18095 <p>this is not the the title
18096 </p>
18097 !! end
18099 !! test
18100 preload: check <noinclude> and <includeonly>
18101 !! options
18102 preload
18103 !! wikitext
18104 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18105 !! html
18106 Hello kind world.
18107 !! end
18109 !! test
18110 preload: check <onlyinclude>
18111 !! options
18112 preload
18113 !! wikitext
18114 Goodbye <onlyinclude>Hello world</onlyinclude>
18115 !! html
18116 Hello world
18117 !! end
18119 !! test
18120 preload: can pass tags through if we want to
18121 !! options
18122 preload
18123 !! wikitext
18124 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18125 !! html
18126 <includeonly>Hello world</includeonly>
18127 !! end
18129 !! test
18130 preload: check that it doesn't try to do tricks
18131 !! options
18132 preload
18133 !! wikitext
18134 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18135 !! html
18136 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18137 !! end
18139 !! test
18140 Play a bit with r67090 and bug 3158
18141 !! options
18142 disabled
18143 !! wikitext
18144 <div style="width:50% !important">&nbsp;</div>
18145 <div style="width:50%&nbsp;!important">&nbsp;</div>
18146 <div style="width:50%&#160;!important">&nbsp;</div>
18147 <div style="border : solid;">&nbsp;</div>
18148 !! html
18149 <div style="width:50% !important">&nbsp;</div>
18150 <div style="width:50% !important">&nbsp;</div>
18151 <div style="width:50% !important">&nbsp;</div>
18152 <div style="border&#160;: solid;">&nbsp;</div>
18154 !! end
18156 !! test
18157 HTML5 data attributes
18158 !! wikitext
18159 <span data-foo="bar">Baz</span>
18160 <p data-abc-def_hij="">Quuz</p>
18161 !! html
18162 <p><span data-foo="bar">Baz</span>
18163 </p>
18164 <p data-abc-def_hij="">Quuz</p>
18166 !! end
18168 !! test
18169 percent-encoding and + signs in internal links (Bug 26410)
18170 !! wikitext
18171 [[User:+%]] [[Page+title%]]
18172 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18173 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
18174 [[%33%45]] [[%33%45+]]
18175 !! html
18176 <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>
18177 <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>
18178 <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>
18179 <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>
18180 </p>
18181 !! end
18183 !! test
18184 Special characters in embedded file links (bug 27679)
18185 !! wikitext
18186 [[File:Contains & ampersand.jpg]]
18187 [[File:Does not exist.jpg|Title with & ampersand]]
18188 !! html
18189 <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>
18190 <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>
18191 </p>
18192 !! end
18195 !! test
18196 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18197 !! wikitext
18198 Text&apos;s been normalized?
18199 !! html
18200 <p>Text&#39;s been normalized?
18201 </p>
18202 !! end
18204 !! test
18205 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18206 !! wikitext
18207 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18208 !! html
18209 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18210 </p>
18211 !! end
18213 !! test
18214 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18215 !! wikitext
18216 [http://www.example.org/ ideograms]
18217 !! html
18218 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18219 </p>
18220 !! end
18222 !! test
18223 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18224 !! wikitext
18225 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18226 !! html
18227 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18228 </p>
18229 !! end
18231 !! article
18232 Mediawiki:loop1
18233 !! text
18234 {{Identical|A}}
18235 !! endarticle
18237 !! article
18238 Mediawiki:loop2
18239 !! text
18240 {{Identical|B}}
18241 !! endarticle
18243 !! article
18244 Template:Identical
18245 !! text
18246 {{int:loop1}}
18247 {{int:loop2}}
18248 !! endarticle
18250 !! test
18251 Bug 31098 Template which includes system messages which includes the template
18252 !! wikitext
18253 {{Identical}}
18254 !! html
18255 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18256 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18257 </p>
18258 !! end
18260 !! test
18261 Bug31490 Turkish: ucfirst 'blah'
18262 !! options
18263 language=tr
18264 !! wikitext
18265 {{ucfirst:blah}}
18266 !! html
18267 <p>Blah
18268 </p>
18269 !! end
18271 !! test
18272 Bug31490 Turkish: ucfirst 'ix'
18273 !! options
18274 language=tr
18275 !! wikitext
18276 {{ucfirst:ix}}
18277 !! html
18278 <p>İx
18279 </p>
18280 !! end
18282 !! test
18283 Bug31490 Turkish: lcfirst 'BLAH'
18284 !! options
18285 language=tr
18286 !! wikitext
18287 {{lcfirst:BLAH}}
18288 !! html
18289 <p>bLAH
18290 </p>
18291 !! end
18293 !! test
18294 Bug31490 Turkish: ucfırst (with a dotless i)
18295 !! options
18296 language=tr
18297 !! wikitext
18298 {{ucfırst:blah}}
18299 !! html
18300 <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>
18301 </p>
18302 !! end
18304 !! test
18305 Bug31490 ucfırst (with a dotless i) with English language
18306 !! options
18307 language=en
18308 !! wikitext
18309 {{ucfırst:blah}}
18310 !! html
18311 <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>
18312 </p>
18313 !! end
18315 !! test
18316 Bug 26375: TOC with italics
18317 !! options
18318 title=[[Main Page]]
18319 !! wikitext
18320 __TOC__
18321 == ''Lost'' episodes ==
18322 !! html
18323 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18324 <ul>
18325 <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>
18326 </ul>
18327 </div>
18329 <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>
18331 !! end
18333 !! test
18334 Bug 26375: TOC with bold
18335 !! options
18336 title=[[Main Page]]
18337 !! wikitext
18338 __TOC__
18339 == '''should be bold''' then normal text ==
18340 !! html
18341 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18342 <ul>
18343 <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>
18344 </ul>
18345 </div>
18347 <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>
18349 !! end
18351 !! test
18352 Bug 33845: Headings become cursive in TOC when they contain an image
18353 !! options
18354 title=[[Main Page]]
18355 !! wikitext
18356 __TOC__
18357 == Image [[Image:foobar.jpg]] ==
18358 !! html
18359 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18360 <ul>
18361 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18362 </ul>
18363 </div>
18365 <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>
18367 !! end
18369 !! test
18370 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18371 !! options
18372 title=[[Main Page]]
18373 !! wikitext
18374 __TOC__
18375 == <blockquote>Quote</blockquote> ==
18376 !! html
18377 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18378 <ul>
18379 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18380 </ul>
18381 </div>
18383 <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>
18385 !! html+tidy
18386 <div id="toc" class="toc">
18387 <div id="toctitle">
18388 <h2>Contents</h2>
18389 </div>
18390 <ul>
18391 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18392 </ul>
18393 </div>
18394 <h2><span class="mw-headline" id="Quote"></span></h2>
18395 <blockquote>
18396 <p><span class="mw-headline" id="Quote">Quote</span></p>
18397 </blockquote>
18398 <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>
18399 !! end
18401 !! test
18402 Unclosed tags in TOC
18403 !! options
18404 title=[[Main Page]]
18405 !! wikitext
18406 __TOC__
18407 == Proof: 2 < 3 ==
18408 <small>Hanc marginis exiguitas non caperet.</small>
18410 !! html
18411 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18412 <ul>
18413 <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>
18414 </ul>
18415 </div>
18417 <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>
18418 <p><small>Hanc marginis exiguitas non caperet.</small>
18420 </p>
18421 !! end
18423 !! test
18424 Multiple tags in TOC
18425 !! wikitext
18426 __TOC__
18427 == <i>Foo</i> <b>Bar</b> ==
18429 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18430 !! html
18431 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18432 <ul>
18433 <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>
18434 <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>
18435 </ul>
18436 </div>
18438 <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>
18439 <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>
18441 !! html+tidy
18442 <div id="toc" class="toc">
18443 <div id="toctitle">
18444 <h2>Contents</h2>
18445 </div>
18446 <ul>
18447 <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>
18448 <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>
18449 </ul>
18450 </div>
18451 <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>
18452 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18453 <blockquote>
18454 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18455 </blockquote>
18456 <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>
18457 !! end
18459 !! test
18460 Tags with parameters in TOC
18461 !! wikitext
18462 __TOC__
18463 == <sup class="in-h2">Hello</sup> ==
18465 == <sup class="a > b">Evilbye</sup> ==
18466 !! html
18467 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18468 <ul>
18469 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
18470 <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>
18471 </ul>
18472 </div>
18474 <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>
18475 <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>
18477 !! end
18479 !! test
18480 span tags with directionality in TOC
18481 !! wikitext
18482 __TOC__
18483 == <span dir="ltr">C++</span> ==
18485 == <span dir="rtl">זבנג!</span> ==
18487 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
18489 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
18491 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
18492 !! html
18493 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18494 <ul>
18495 <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>
18496 <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>
18497 <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>
18498 <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>
18499 <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>
18500 </ul>
18501 </div>
18503 <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>
18504 <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>
18505 <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>
18506 <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>
18507 <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>
18509 !! end
18511 !! article
18512 MediaWiki:Bug32057
18513 !! text
18514 == {{int:headline_sample}} ==
18515 !! endarticle
18517 !! test
18518 Bug 32057: Title needed when expanding <h> nodes.
18519 !! options
18520 title=[[Main Page]]
18521 !! wikitext
18522 {{int:Bug32057}}
18523 !! html
18524 <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>
18526 !! end
18528 !! test
18529 Strip marker in urlencode
18530 !! wikitext
18531 {{urlencode:x<nowiki/>y}}
18532 {{urlencode:x<nowiki/>y|wiki}}
18533 {{urlencode:x<nowiki/>y|path}}
18534 !! html
18535 <p>xy
18538 </p>
18539 !! end
18541 !! test
18542 Strip marker in lc
18543 !! wikitext
18544 {{lc:x<nowiki/>y}}
18545 !! html
18546 <p>xy
18547 </p>
18548 !! end
18550 !! test
18551 Strip marker in uc
18552 !! wikitext
18553 {{uc:x<nowiki/>y}}
18554 !! html
18555 <p>XY
18556 </p>
18557 !! end
18559 !! test
18560 Strip marker in formatNum
18561 !! wikitext
18562 {{formatnum:1<nowiki/>2}}
18563 {{formatnum:1<nowiki/>2|R}}
18564 !! html
18565 <p>12
18567 </p>
18568 !! end
18570 !! test
18571 Check noCommafy in formatNum
18572 !! options
18573 language=be-tarask
18574 !! wikitext
18575 {{formatnum:123456.78}}
18576 {{formatnum:123456.78|NOSEP}}
18577 !! html
18578 <p>123 456,78
18579 123456.78
18580 </p>
18581 !! end
18583 !! test
18584 Wrong option for formatNum (bug 56199)
18585 !! wikitext
18586 {{formatnum:1,234.56|Random}}
18587 {{formatnum:1,234.56|EVERYTHING}}
18588 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
18589 !! html
18590 <p>1,234.56
18591 1,234.56
18592 1,234.56
18593 </p>
18594 !! end
18596 !! test
18597 Strip marker in grammar
18598 !! options
18599 language=fi
18600 !! wikitext
18601 {{grammar:elative|foo<nowiki/>bar}}
18602 !! html
18603 <p>foobarista
18604 </p>
18605 !! end
18607 !! test
18608 Strip marker in padleft
18609 !! wikitext
18610 {{padleft:|2|x<nowiki/>y}}
18611 !! html
18612 <p>xy
18613 </p>
18614 !! end
18616 !! test
18617 Strip marker in padright
18618 !! wikitext
18619 {{padright:|2|x<nowiki/>y}}
18620 !! html
18621 <p>xy
18622 </p>
18623 !! end
18625 !! test
18626 Strip marker in anchorencode
18627 !! wikitext
18628 {{anchorencode:x<nowiki/>y}}
18629 !! html
18630 <p>xy
18631 </p>
18632 !! end
18634 !! test
18635 nowiki inside link inside heading (bug 18295)
18636 !! wikitext
18637 ==[[foo|x<nowiki>y</nowiki>z]]==
18638 !! html
18639 <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>
18641 !! end
18643 !! test
18644 new support for bdi element (bug 31817)
18645 !! wikitext
18646 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18647 !! html
18648 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
18650 !!end
18652 !! test
18653 Ignore pipe between table row attributes
18654 !! wikitext
18656 | quux
18657 |- id=foo | style='color: red'
18658 | bar
18660 !! html
18661 <table>
18662 <tr>
18663 <td> quux
18664 </td></tr>
18665 <tr id="foo" style="color: red">
18666 <td> bar
18667 </td></tr></table>
18669 !! end
18671 !!test
18672 Gallery override link with WikiLink (bug 34852)
18673 !! wikitext
18674 <gallery>
18675 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
18676 </gallery>
18677 !! html
18678 <ul class="gallery mw-gallery-traditional">
18679                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18680                         <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>
18681                         <div class="gallerytext">
18682 <p>caption
18683 </p>
18684                         </div>
18685                 </div></li>
18686 </ul>
18688 !! end
18690 !!test
18691 Gallery override link with absolute external link (bug 34852)
18692 !! wikitext
18693 <gallery>
18694 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
18695 </gallery>
18696 !! html
18697 <ul class="gallery mw-gallery-traditional">
18698                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18699                         <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>
18700                         <div class="gallerytext">
18701 <p>caption
18702 </p>
18703                         </div>
18704                 </div></li>
18705 </ul>
18707 !! end
18709 !!test
18710 Gallery override link with malicious javascript (bug 34852)
18711 !! wikitext
18712 <gallery>
18713 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
18714 </gallery>
18715 !! html
18716 <ul class="gallery mw-gallery-traditional">
18717                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18718                         <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>
18719                         <div class="gallerytext">
18720 <p>caption
18721 </p>
18722                         </div>
18723                 </div></li>
18724 </ul>
18726 !! end
18728 !!test
18729 Gallery with invalid title as link (bug 43964)
18730 !! wikitext
18731 <gallery>
18732 File:foobar.jpg|link=<
18733 </gallery>
18734 !! html
18735 <ul class="gallery mw-gallery-traditional">
18736                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18737                         <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>
18738                         <div class="gallerytext">
18739                         </div>
18740                 </div></li>
18741 </ul>
18743 !! end
18745 !!test
18746 Language parser function
18747 !! wikitext
18748 {{#language:ar}}
18749 !! html
18750 <p>العربية
18751 </p>
18752 !! end
18754 !!test
18755 Padleft and padright as substr
18756 !! wikitext
18757 {{padleft:|3|abcde}}
18758 {{padright:|3|abcde}}
18759 !! html
18760 <p>abc
18762 </p>
18763 !! end
18765 !!test
18766 Special parser function
18767 !! wikitext
18768 {{#special:RandomPage}}
18769 {{#special:BaDtItLe}}
18770 {{#special:Foobar}}
18771 !! html
18772 <p>Special:Random
18773 Special:Badtitle
18774 Special:Foobar
18775 </p>
18776 !! end
18778 !!test
18779 Bug 34939 - Case insensitive link parsing ([HttP://])
18780 !! wikitext
18781 [HttP://MediaWiki.Org/]
18782 !! html/php
18783 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18784 </p>
18785 !! html/parsoid
18786 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18787 !! end
18789 !!test
18790 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18791 !! wikitext
18792 [HttP://MediaWiki.Org/ MediaWiki]
18793 !! html
18794 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18795 </p>
18796 !! end
18798 !!test
18799 Bug 34939 - Case insensitive link parsing (HttP://)
18800 !! wikitext
18801 HttP://MediaWiki.Org/
18802 !! html/php
18803 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18804 </p>
18805 !! html/parsoid
18806 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18807 !! end
18809 !!test
18810 Disable TOC
18811 !! options
18812 notoc
18813 !! wikitext
18814 Lead
18815 == Section 1 ==
18816 == Section 2 ==
18817 == Section 3 ==
18818 == Section 4 ==
18819 == Section 5 ==
18820 !! html
18821 <p>Lead
18822 </p>
18824 <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>
18825 <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>
18826 <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>
18827 <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>
18828 <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>
18830 !! end
18834 ### Parsoid-specific tests
18835 ### Parsoid-PHP parser incompatibilities
18837 !!test
18838 1. SOL-sensitive wikitext tokens as template-args
18839 !!options
18840 parsoid=wt2html,wt2wt
18841 !! wikitext
18842 {{echo|*a}}
18843 {{echo|#a}}
18844 {{echo|:a}}
18845 !! html
18846 <span about="#mwt1" typeof="mw:Transclusion">
18847 </span><ul about="#mwt1"><li>a</li>
18848 </ul>
18849 <span about="#mwt2" typeof="mw:Transclusion">
18850 </span><ol about="#mwt2"><li>a</li>
18851 </ol>
18852 <span about="#mwt3" typeof="mw:Transclusion">
18853 </span><dl about="#mwt3"><dd>a</dd>
18854 </dl>
18855 !!end
18857 #### -----------------------------------------------------------------
18858 #### Parsoid-specific functionality tests
18859 #### -----------------------------------------------------------------
18861 # Bug 63642: Formatting elt fixup is cleaned up.
18862 # We know wt2wt will fail, but we expect selser to pass.
18863 # Due to the nature of our testing, wt2wt and selser tests will enter the
18864 # blacklist and we'll catch selser regressions based on changes to the
18865 # blacklist entries for selser tests.
18866 !! test
18867 Bad treebuilder fixup of formatting elt is cleaned up
18868 !! options
18869 parsoid=wt2html,wt2wt
18870 !! wikitext
18873 <small>
18874 [[Image:Foobar.jpg|right|Test]]
18875 </small>
18877 !! html/parsoid
18878 <table>
18879 <tbody><tr><td>
18880 <p><small></small></p>
18881 <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><small>Test</small></figcaption></figure>
18882 <p></p></td></tr>
18883 </tbody></table>
18884 !! end
18886 #### ----------------------------------------------------------------
18887 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18888 #### tags. Parsoid's output for these tags differs from that of the
18889 #### PHP parser.
18890 #### ----------------------------------------------------------------
18892 !!test
18893 Ref: 1. ref-location should be replaced with an index span
18894 !!options
18895 parsoid
18896 !! wikitext
18897 A <ref>foo</ref>
18898 B <ref name="x">foo</ref>
18899 C <ref name="y" />
18900 !! html
18901 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
18902 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
18903 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
18904 !!end
18906 !!test
18907 Ref: 2. ref-tags with identical names should all get the same index
18908 !!options
18909 parsoid
18910 !! wikitext
18911 A <ref name="x">foo</ref>
18912 B <ref name="x" />
18913 !! html
18914 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18915 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
18916 !!end
18918 !!test
18919 Ref: 3. spaces in ref-names should be ignored
18920 !!options
18921 parsoid
18922 !! wikitext
18923 A <ref name="x">foo</ref>
18924 B <ref name=" x " />
18925 C <ref name= x  />
18926 !! html
18927 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18928 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
18929 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
18930 !!end
18932 !!test
18933 Ref: 4. 'constructor' should be accepted as a valid ref-name
18934 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18935 !!options
18936 parsoid
18937 !! wikitext
18938 A <ref name="constructor">foo</ref>
18939 !! html
18940 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
18941 !!end
18943 !!test
18944 Ref: 5. body should accept generic wikitext
18945 !!options
18946 parsoid
18947 !! wikitext
18948 A <ref>
18949  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18950 </ref>
18952 <references />
18953 !! html
18954 <p>A <span about="#mwt2" class="reference" 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-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39; data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18956 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18957 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
18958 </li>
18959 </ol>
18960 !!end
18962 !!test
18963 Ref: 6. indent-pres should not be output in ref-body
18964 !!options
18965 parsoid
18966 !! wikitext
18967 A <ref>
18968  foo
18969  bar
18970  baz
18971 </ref>
18973 <references />
18974 !! html
18975 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
18977 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18978 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18979  bar
18980  baz
18981 </li>
18982 </ol>
18983 !!end
18985 !!test
18986 Ref: 7. No p-wrapping in ref-body
18987 !!options
18988 parsoid
18989 !! wikitext
18990 A <ref>
19000 booz
19001 </ref>
19003 <references />
19004 !! html
19005 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19007 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19008 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19017 booz
19018 </li>
19019 </ol>
19020 !!end
19022 !!test
19023 Ref: 8. transclusion wikitext has lower precedence
19024 !!options
19025 parsoid
19026 !! wikitext
19027 A <ref> foo {{echo|</ref> B C}}
19029 <references />
19030 !! html
19031 <p>A <span class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo <span typeof=\&quot;mw:Nowiki\&quot; data-parsoid='{\&quot;src\&quot;:\&quot;{{\&quot;,\&quot;dsr\&quot;:[12,14,0,0]}'>{{</span>echo|&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19032 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
19033 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19034 </ol>
19035 !!end
19037 !!test
19038 Ref: 9. unclosed comments should not leak out of ref-body
19039 !!options
19040 parsoid
19041 !! wikitext
19042 A <ref> foo <!--</ref> B C
19043 <references />
19044 !! html
19045 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
19046 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19047 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
19048 </ol>
19049 !!end
19051 !!test
19052 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19053 !!options
19054 parsoid
19055 !! wikitext
19056 A <ref> <b> foo </ref> B C
19058 <references />
19059 !! html
19060 <p>A <span about="#mwt2" class="reference" 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":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref> &lt;b> foo &lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B C</p>
19063 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
19064 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19065 </ol>
19066 !!end
19068 !!test
19069 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19070 !!options
19071 parsoid
19072 !! wikitext
19073 A <ref>foo</ref> B
19074 C <ref>bar</ref> D
19075 !! html
19076 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span> B
19077 C <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>bar&lt;/ref>"}'><a href="#cite_note-2">[2]</a></span> D</p>
19078 !!end
19080 !!test
19081 Ref: 12. ref-tags act as trailing newline migration barrier
19082 !!options
19083 parsoid
19084 !! wikitext
19085 <!--the newline at the end of this line moves out of the p-tag-->a
19087 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19088 <ref />
19091 !! html
19092 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19095 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
19096 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
19099 <p>c</p>
19100 !!end
19102 !!test
19103 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19104 !!options
19105 parsoid
19106 !! wikitext
19107 <ref>foo</ref> A
19108 <ref>bar
19109 </ref> B
19110 !! html
19111 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
19112 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
19113 !!end
19115 !!test
19116 Ref: 14. A nested ref-tag should be emitted as plain text
19117 !!options
19118 parsoid
19119 !! wikitext
19120 <ref>foo <ref>bar</ref> baz</ref>
19122 <references />
19123 !! html
19124 <p><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo &lt;ref>bar&lt;/ref> baz&lt;/ref>"}'><a href="#cite_note-1">[1]</a></span></p>
19126 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
19127 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19128 </ol>
19129 !!end
19131 !!test
19132 Ref: 15. ref-tags with identical names should get identical indexes
19133 !!options
19134 parsoid
19135 !! wikitext
19136 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19137 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19139 <references />
19140 !! html
19141 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
19142 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
19144 <ol about="#mwt10" class="references" typeof="mw:Extension/references" 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>
19145 </ol>
19146 !!end
19148 ## We don't bother wt2wt-ing non-standard whitespace
19149 !!test
19150 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19151 !!options
19152 parsoid=wt2html
19153 !! wikitext
19154 A <ref >foo</ref >
19156 <references />
19157 !! html
19158 <p>A <span class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19160 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19161 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19162 !!end
19164 !!test
19165 References: 1. references tag without any refs should be handled properly
19166 !!options
19167 parsoid
19168 !! wikitext
19169 <references />
19170 !! html
19171 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19172 !!end
19174 !!test
19175 References: 2. references tag with group only outputs references from that group
19176 !!options
19177 parsoid
19178 !! wikitext
19179 A <ref group="a">foo</ref>
19180 B <ref group="b">bar</ref>
19182 <references group="a" />
19183 !! html
19184 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
19185 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[b 1]</a></span></p>
19187 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
19188 </ol>
19189 !!end
19191 !!test
19192 References: 3. ref list should be cleared after processing references
19193 !!options
19194 parsoid
19195 !! wikitext
19196 A <ref>foo</ref>
19198 <references />
19200 B <ref>bar</ref>
19202 <references />
19203 !! html
19204 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19206 <ol about="#mwt4" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
19207 </ol>
19209 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[1]</a></span></p>
19211 <ol about="#mwt8" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bar</li>
19212 </ol>
19213 !!end
19215 !!test
19216 References: 4. only referenced group should be cleared after processing references
19217 !!options
19218 parsoid
19219 !! wikitext
19220 A <ref group="a">afoo</ref>
19221 B <ref>bfoo</ref>
19223 <references group="a" />
19225 C <ref>cfoo</ref>
19227 <references />
19228 !! html
19229 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
19230 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>"}'><a href="#cite_note-2">[1]</a></span></p>
19232 <ol about="#mwt6" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li>
19233 </ol>
19235 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-3">[2]</a></span></p>
19237 <ol about="#mwt10" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3-0">↑</a></span> cfoo</li>
19238 </ol>
19239 !!end
19241 !!test
19242 References: 5. ref tags in references should be processed while ignoring all other content
19243 !!options
19244 parsoid
19245 !! wikitext
19246 A <ref name="a" />
19247 B <ref name="b">bar</ref>
19249 <references>
19250 <ref name="a">foo</ref>
19251 This should just get lost.
19252 </references>
19253 !! html
19254 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"a\" />"}'><a href="#cite_note-a-1">[1]</a></span>
19255 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\">bar&lt;/ref>"}'><a href="#cite_note-b-2">[2]</a></span></p>
19258 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references>\n&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.\n&lt;/references>"}' 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\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'>
19259 <li about="#cite_note-a-1" id="cite_note-a-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li>
19260 <li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
19261 </ol>
19262 !!end
19264 !!test
19265 References: 6. <references /> from a transclusion
19266 !!options
19267 parsoid
19268 !! wikitext
19269 <ref>Foo</ref> {{echo|<references />}}
19270 !! html
19271 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> <ol class="references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> Foo</li></ol>
19272 !!end
19274 !! test
19275 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19276 !! options
19277 parsoid
19278 !! wikitext
19279 A <ref>foo bar for a</ref>
19280 B <ref group="X" name="b" />
19282 <references />
19284 <references group="X">
19285 <ref name="b">foo</ref>
19286 </references>
19287 !! html
19288 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span>
19289 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref group=\"X\" name=\"b\" />"}'><a href="#cite_note-b-2" data-parsoid="{}">[X 1]</a></span></p>
19291 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
19293 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&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" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-2-0" data-parsoid="{}">↑</a></span> foo</li></ol>
19294 !! end
19296 !! test
19297 Entities in ref name
19298 !! options
19299 parsoid
19300 !! wikitext
19301 <ref name="test &amp; me">hi</ref>
19302 !! html
19303 <p data-parsoid='{}'><span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp; me"}}' id="cite_ref-test &amp; me-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"test &amp;amp; me\">hi&lt;/ref>"}'><a href="#cite_note-test &amp; me-1" data-parsoid="{}">[1]</a></span></p>
19304 !! end
19306 # This test is wt2html only because we're permitting the serializer to produce
19307 # dirty diffs, normalizing the unclosed references to the self-closed version.
19308 !! test
19309 Generate references for unclosed references tag
19310 !! options
19311 parsoid=wt2html
19312 !! wikitext
19313 a<ref>foo</ref>
19315 <references>
19316 !! html
19317 <p data-parsoid='{}'>a<span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span></p>
19320 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
19321 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo</li></ol>
19322 !! end
19324 !! test
19325 New reference serializes on its own line
19326 !! options
19327 parsoid=wt2wt,html2wt
19328 !! wikitext
19330 <references />
19331 !! html
19332 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19333 !! end
19335 #### ----------------------------------------------------------------
19336 #### The following section of tests are primarily to test
19337 #### wikitext escaping capabilities of Parsoid.  Given that
19338 #### escaping can be done any number of ways, the wikitext (input)
19339 #### is always adjusted to reflect how Parsoid adds nowiki
19340 #### escape tags.
19341 ####
19342 #### We are marking several tests as parsoid-only since the
19343 #### HTML in the result section is different from what the
19344 #### PHP parser generates for it.
19345 #### ----------------------------------------------------------------
19348 #### --------------- Headings ---------------
19349 #### 0. Unnested
19350 #### 1. Nested inside html <h1>=foo=</h1>
19351 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19352 #### 3. Nested inside html with wikitext split by html tags
19353 #### 4. No escape needed
19354 #### 5. Empty headings <h1></h1>
19355 #### 6. Heading chars in SOL context
19356 #### ----------------------------------------
19357 !! test
19358 Headings: 0. Unnested
19359 !! options
19360 parsoid
19361 !! wikitext
19362 <nowiki>=foo=</nowiki>
19364 <nowiki> =foo= </nowiki>
19365 <!--cmt-->
19366 <nowiki>=foo=</nowiki>
19368 =foo''a''<nowiki>=</nowiki>
19369 !! html
19370 <p><span typeof="mw:Nowiki">=foo=</span></p>
19372 <p><span typeof="mw:Nowiki"> =foo= </span>
19373 <!--cmt-->
19374 <span typeof="mw:Nowiki">=foo=</span></p>
19376 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
19377 !!end
19379 !! test
19380 Headings: 1. Nested inside html
19381 (New headings and existing headings are handled differently)
19382 !! options
19383 parsoid=html2wt
19384 !! wikitext
19385 = =foo= =
19387 == =foo= ==
19389 === =foo= ===
19391 =<nowiki>=foo=</nowiki>=
19392 ==<nowiki>=foo=</nowiki>==
19393 ===<nowiki>=foo=</nowiki>===
19394 ====<nowiki>=foo=</nowiki>====
19395 =====<nowiki>=foo=</nowiki>=====
19396 ======<nowiki>=foo=</nowiki>======
19398 !! html
19399 <h1>=foo=</h1>
19400 <h2>=foo=</h2>
19401 <h3>=foo=</h3>
19403 <h1 data-parsoid='{}'>=foo=</h1>
19404 <h2 data-parsoid='{}'>=foo=</h2>
19405 <h3 data-parsoid='{}'>=foo=</h3>
19406 <h4 data-parsoid='{}'>=foo=</h4>
19407 <h5 data-parsoid='{}'>=foo=</h5>
19408 <h6 data-parsoid='{}'>=foo=</h6>
19409 !!end
19411 !! test
19412 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
19413 !! options
19414 parsoid=html2wt
19415 !! wikitext
19416 = foo =
19417 <nowiki>*</nowiki>bar
19419 = foo =
19420 =bar
19422 = foo =
19423 <nowiki>=bar=</nowiki>
19424 !! html
19425 <h1>foo</h1>*bar
19426 <h1>foo</h1>=bar
19427 <h1>foo</h1>=bar=
19428 !!end
19430 !! test
19431 Headings: 3. Nested inside html with wikitext split by html tags
19432 !! options
19433 parsoid=html2wt
19434 !! wikitext
19435 = ='''bold'''<nowiki>foo=</nowiki> =
19436 !! html
19437 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
19438 !!end
19440 !! test
19441 Headings: 4a. No escaping needed (testing just h1 and h2)
19442 !! options
19443 parsoid=html2wt
19444 !! wikitext
19445 = =foo =
19447 = foo= =
19449 = =foo= =
19451 = =foo= bar =
19453 == =foo ==
19455 == foo= ==
19457 = ''=''foo= =
19459 = <nowiki>=</nowiki> =
19460 !! html
19461 <h1>=foo</h1>
19462 <h1>foo=</h1>
19463 <h1> =foo= </h1>
19464 <h1>=foo= bar</h1>
19465 <h2>=foo</h2>
19466 <h2>foo=</h2>
19467 <h1><i>=</i>foo=</h1>
19468 <h1><span typeof="mw:Nowiki">=</span></h1>
19469 !!end
19471 !! test
19472 Headings: 4b. No escaping needed (inside p-tags)
19473 !! options
19474 parsoid=html2wt
19475 !! wikitext
19477 =foo= x
19478 =foo= <s></s>
19479 !! html
19480 <p>===
19481 =foo= x
19482 =foo= <s></s>
19483 </p>
19484 !!end
19486 !! test
19487 Headings: 5. Empty headings
19488 !! options
19489 parsoid
19490 !! wikitext
19491 =<nowiki/>=
19493 ==<nowiki/>==
19495 ===<nowiki/>===
19497 ====<nowiki/>====
19499 =====<nowiki/>=====
19501 ======<nowiki/>======
19502 !! html
19503 <h1></h1>
19504 <h2></h2>
19505 <h3></h3>
19506 <h4></h4>
19507 <h5></h5>
19508 <h6></h6>
19509 !!end
19511 !! test
19512 Headings: 6a. Heading chars in SOL context (with trailing spaces)
19513 !! options
19514 parsoid
19515 !! wikitext
19516 <nowiki>=a=</nowiki>
19518 <nowiki>=a=</nowiki> 
19520 <nowiki>=a=</nowiki>    
19522 <nowiki>=a=</nowiki>    
19523 !! html
19524 <p>=a=</p>
19525 <p>=a= </p>
19526 <p>=a=  </p>
19527 <p>=a=  </p>
19528 !!end
19530 !! test
19531 Headings: 6b. Heading chars in SOL context (with trailing newlines)
19532 !! options
19533 parsoid
19534 !! wikitext
19535 <nowiki>=a=
19536 b</nowiki>
19538 <nowiki>=a= 
19539 b</nowiki>
19541 <nowiki>=a=     
19542 b</nowiki>
19544 <nowiki>=a=      
19545 b</nowiki>
19546 !! html
19547 <p>=a=
19548 b</p>
19549 <p>=a= 
19550 b</p>
19551 <p>=a=  
19552 b</p>
19553 <p>=a=   
19554 b</p>
19555 </p>
19556 !!end
19558 !! test
19559 Headings: 6c. Heading chars in SOL context (leading newline break)
19560 !! options
19561 parsoid
19562 !! wikitext
19564 <nowiki>=b=</nowiki>
19565 !! html
19566 <p>a
19567 =b=</p>
19568 !!end
19570 !! test
19571 Headings: 6d. Heading chars in SOL context (with interspersed comments)
19572 !! options
19573 parsoid
19574 !! wikitext
19575 <!--c0--><nowiki>=a=</nowiki>
19577 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
19578 !! html
19579 <p><!--c0-->=a=</p>
19580 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
19581 !!end
19583 !! test
19584 Headings: 6d. Heading chars in SOL context (No escaping needed)
19585 !! options
19586 parsoid=html2wt
19587 !! wikitext
19588 =a=<div>b</div>
19589 !! html
19590 =a=<div>b</div>
19591 !!end
19593 #### --------------- Lists ---------------
19594 #### 0. Outside nests (*foo, etc.)
19595 #### 1. Nested inside html <ul><li>*foo</li></ul>
19596 #### 2. Inside definition lists
19597 #### 3. Only bullets at start should be escaped
19598 #### 4. No escapes needed
19599 #### 5. No unnecessary escapes
19600 #### 6. Escape bullets in SOL position
19601 #### 7. Escape bullets in a multi-line context
19602 #### ----------------------------------------
19604 !! test
19605 Lists: 0. Outside nests
19606 !! wikitext
19607 <nowiki>*</nowiki>foo
19609 <nowiki>#</nowiki>foo
19611 <nowiki>;Foo:</nowiki>bar
19612 !! html
19613 <p>*foo
19614 </p><p>#foo
19615 </p><p>;Foo:bar
19616 </p>
19617 !!end
19619 !! test
19620 Lists: 1. Nested inside html
19621 !! wikitext
19622 *<nowiki>*foo</nowiki>
19624 *<nowiki>#foo</nowiki>
19626 *<nowiki>:foo</nowiki>
19628 *<nowiki>;foo</nowiki>
19630 #<nowiki>*foo</nowiki>
19632 #<nowiki>#foo</nowiki>
19634 #<nowiki>:foo</nowiki>
19636 #<nowiki>;foo</nowiki>
19637 !! html
19638 <ul><li>*foo</li></ul>
19639 <ul><li>#foo</li></ul>
19640 <ul><li>:foo</li></ul>
19641 <ul><li>;foo</li></ul>
19642 <ol><li>*foo</li></ol>
19643 <ol><li>#foo</li></ol>
19644 <ol><li>:foo</li></ol>
19645 <ol><li>;foo</li></ol>
19647 !!end
19649 !! test
19650 Lists: 2. Inside definition lists
19651 !! wikitext
19652 ;<nowiki>;foo</nowiki>
19654 ;<nowiki>:foo</nowiki>
19656 ;<nowiki>:foo</nowiki>
19657 :bar
19659 :<nowiki>:foo</nowiki>
19660 !! html
19661 <dl><dt>;foo</dt></dl>
19662 <dl><dt>:foo</dt></dl>
19663 <dl><dt>:foo</dt>
19664 <dd>bar</dd></dl>
19665 <dl><dd>:foo</dd></dl>
19667 !!end
19669 !! test
19670 Lists: 3. Only bullets at start of text should be escaped
19671 !! wikitext
19672 *<nowiki>*foo*bar</nowiki>
19674 *<nowiki>*foo</nowiki>''it''*bar
19675 !! html
19676 <ul><li>*foo*bar</li></ul>
19677 <ul><li>*foo<i>it</i>*bar</li></ul>
19679 !!end
19681 !! test
19682 Lists: 4. No escapes needed
19683 !! options
19684 parsoid
19685 !! wikitext
19686 *foo*bar
19688 *''foo''*bar
19690 *[[Foo]]: bar
19692 *[[Foo]]*bar
19693 !! html
19694 <ul>
19695 <li>foo*bar
19696 </li>
19697 </ul>
19698 <ul>
19699 <li><i>foo</i>*bar
19700 </li>
19701 </ul>
19702 <ul>
19703 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
19704 </li>
19705 </ul>
19706 <ul>
19707 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
19708 </li>
19709 </ul>
19710 !!end
19712 !! test
19713 Lists: 5. No unnecessary escapes
19714 !! wikitext
19715 * bar <span><nowiki>[[foo]]</nowiki></span>
19717 *=bar <span><nowiki>[[foo]]</nowiki></span>
19719 *[[bar <span><nowiki>[[foo]]</nowiki></span>
19721 *]]bar <span><nowiki>[[foo]]</nowiki></span>
19723 *=bar <span>foo]]</span>=
19725 * <s></s>: a
19726 !! html
19727 <ul><li> bar <span>[[foo]]</span></li></ul>
19728 <ul><li>=bar <span>[[foo]]</span></li></ul>
19729 <ul><li>[[bar <span>[[foo]]</span></li></ul>
19730 <ul><li>]]bar <span>[[foo]]</span></li></ul>
19731 <ul><li>=bar <span>foo]]</span>=</li></ul>
19732 <ul><li> <s></s>: a</li></ul>
19734 !!end
19736 !! test
19737 Lists: 6. Escape bullets in SOL position
19738 !! options
19739 parsoid
19740 !! wikitext
19741 <!--cmt--><nowiki>*foo</nowiki>
19742 !! html
19743 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
19744 !!end
19746 !! test
19747 Lists: 7. Escape bullets in a multi-line context
19748 !! wikitext
19750 <nowiki>*</nowiki>b
19751 !! html
19752 <p>a
19754 </p>
19755 !!end
19757 #### --------------- HRs ---------------
19758 #### 1. Single line
19759 #### -----------------------------------
19761 !! test
19762 HRs: 1. Single line
19763 !! options
19764 parsoid
19765 !! wikitext
19766 ----<nowiki>----</nowiki>
19767 ----=foo=
19768 ----*foo
19769 !! html
19770 <hr><span typeof="mw:Nowiki">----</span>
19771 <hr>=foo=
19772 <hr>*foo
19773 !! end
19775 #### --------------- Tables ---------------
19776 #### 1a. Simple example
19777 #### 1b. No escaping needed (!foo)
19778 #### 1c. No escaping needed (|foo)
19779 #### 1d. No escaping needed (|}foo)
19780 ####
19781 #### 2a. Nested in td (<td>foo|bar</td>)
19782 #### 2b. Nested in td (<td>foo||bar</td>)
19783 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19784 ####
19785 #### 3a. Nested in th (<th>foo!bar</th>)
19786 #### 3b. Nested in th (<th>foo!!bar</th>)
19787 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19788 ####
19789 #### 4a. Escape -
19790 #### 4b. Escape +
19791 #### 4c. No escaping needed
19792 #### --------------------------------------
19794 !! test
19795 Tables: 1a. Simple example
19796 !! wikitext
19797 <nowiki>{|
19798 |}</nowiki>
19799 !! html
19800 <p>{|
19802 </p>
19803 !! end
19805 !! test
19806 Tables: 1b. No escaping needed
19807 !! wikitext
19808 !foo
19809 !! html
19810 <p>!foo
19811 </p>
19812 !! end
19814 !! test
19815 Tables: 1c. No escaping needed
19816 !! wikitext
19817 |foo
19818 !! html
19819 <p>|foo
19820 </p>
19821 !! end
19823 !! test
19824 Tables: 1d. No escaping needed
19825 !! wikitext
19826 |}foo
19827 !! html
19828 <p>|}foo
19829 </p>
19830 !! end
19832 !! test
19833 Tables: 2a. Nested in td
19834 !! options
19835 parsoid=html2wt
19836 !! wikitext
19838 |<nowiki>foo|bar</nowiki>
19840 |x<div><nowiki>a|b</nowiki></div>
19842 !! html
19843 <table><tbody><tr>
19844 <td>foo|bar</td></tr>
19845 <tr><td>x<div>a|b</div></td>
19846 </tbody></table>
19847 !! end
19849 !! test
19850 Tables: 2b. Nested in td
19851 !! options
19852 parsoid
19853 !! wikitext
19855 |<nowiki>foo||bar</nowiki>
19856 |''it''<nowiki>foo||bar</nowiki>
19858 !! html
19859 <table><tbody><tr>
19860 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19861 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19862 !! end
19864 !! test
19865 Tables: 2c. Nested in td -- no escaping needed
19866 !! options
19867 parsoid
19868 !! wikitext
19870 |foo!!bar
19872 !! html
19873 <table><tbody><tr><td>foo!!bar
19874 </td></tr></tbody></table>
19876 !! end
19878 !! test
19879 Tables: 3a. Nested in th
19880 !! options
19881 parsoid
19882 !! wikitext
19884 !foo!bar
19886 !! html
19887 <table><tbody><tr><th>foo!bar
19888 </th></tr></tbody></table>
19890 !! end
19892 !! test
19893 Tables: 3b. Nested in th
19894 !! options
19895 parsoid
19896 !! wikitext
19898 !<nowiki>foo!!bar</nowiki>
19900 !! html
19901 <table>
19902 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19903 </tbody></table>
19904 !! end
19906 !! test
19907 Tables: 3c. Nested in th -- no escaping needed
19908 !! options
19909 parsoid
19910 !! wikitext
19912 !<nowiki>foo||bar</nowiki>
19914 !! html
19915 <table><tbody><tr>
19916 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19917 !! end
19919 !! test
19920 Tables: 4a. Escape -
19921 !! options
19922 parsoid
19923 !! wikitext
19925 !-bar
19927 |<nowiki>-bar</nowiki>
19929 !! html
19930 <table><tbody>
19931 <tr><th>-bar</th></tr>
19932 <tr>
19933 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19934 !! end
19936 !! test
19937 Tables: 4b. Escape +
19938 !! options
19939 parsoid
19940 !! wikitext
19942 !+bar
19944 |<nowiki>+bar</nowiki>
19946 !! html
19947 <table><tbody>
19948 <tr><th>+bar</th></tr>
19949 <tr>
19950 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19951 !! end
19953 !! test
19954 Tables: 4c. No escaping needed
19955 !! options
19956 parsoid
19957 !! wikitext
19959 |foo-bar
19960 |foo+bar
19962 |''foo''-bar
19963 |''foo''+bar
19965 |foo
19966 bar|baz
19967 +bar
19968 -bar
19971 <div>a|b</div>
19973 !! html
19974 <table><tbody>
19975 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19976 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19977 <tr><td>foo
19978 <p>bar|baz
19979 +bar
19980 -bar</p></td></tr>
19981 <tr><td>x
19982 <div>a|b</div></td>
19983 </tbody></table>
19984 !! end
19986 !! test
19987 Tables: 4d. No escaping needed
19988 !! options
19989 parsoid
19990 !! wikitext
19992 |[[Foo]]-bar
19993 ||+1
19994 ||-2
19996 !! html
19997 <table>
19998 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
19999 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20000 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20001 </tbody></table>
20002 !! end
20004 !! test
20005 Tables: Digest broken attributes on table and tr tag
20006 !! options
20007 parsoid=wt2html
20008 !! wikitext
20009 {| || |} ++
20010 |- || || ++ --
20011 |- > [
20013 !! html
20014 <table>
20015 <tbody>
20016 <tr></tr>
20017 <tr></tr>
20018 </tbody></table>
20019 !! end
20021 #### --------------- Links ----------------
20022 #### 1. Quote marks in link text
20023 #### 2. Wikilinks: Escapes needed
20024 #### 3. Wikilinks: No escapes needed
20025 #### 4. Extlinks: Escapes needed
20026 #### 5. Extlinks: No escapes needed
20027 #### --------------------------------------
20028 !! test
20029 Links 1. Quote marks in link text
20030 !! options
20031 parsoid
20032 !! wikitext
20033 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20034 !! html
20035 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20036 !! end
20038 !! test
20039 Links 2. WikiLinks: Escapes needed
20040 !! options
20041 parsoid
20042 !! wikitext
20043 [[Foo|[Foobar]]]
20044 [[Foo|<nowiki>Foobar]</nowiki>]]
20045 [[Foo|x [Foobar] x]]
20046 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20047 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20048 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20049 [[Foo|<nowiki>|Bar</nowiki>]]
20050 [[Foo|<nowiki>]]bar</nowiki>]]
20051 [[Foo|<nowiki>[[bar</nowiki>]]
20052 [[Foo|<nowiki>x [[ y</nowiki>]]
20053 [[Foo|<nowiki>x ]] y</nowiki>]]
20054 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20055 !! html
20056 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20057 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20058 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20059 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20060 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20061 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20062 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20063 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20064 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20065 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20066 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20067 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20068 !! end
20070 !! test
20071 Links 3. WikiLinks: No escapes needed
20072 !! options
20073 parsoid
20074 !! wikitext
20075 [[Foo|[Foobar]]
20076 [[Foo|foo|bar]]
20077 !! html
20078 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20079 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20080 !! end
20082 !! test
20083 Links 4. ExtLinks: Escapes needed
20084 !! options
20085 parsoid
20086 !! wikitext
20087 [http://google.com <nowiki>[google]</nowiki>]
20088 [http://google.com <nowiki>google]</nowiki>]
20090 <nowiki>[http://google.com]</nowiki>
20092 <nowiki>[http://google.com google]</nowiki>
20094 !! html
20095 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20096 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20097 <p>[http://google.com]</p>
20098 <p>[http://google.com google]</p>
20099 !! end
20101 !! test
20102 Links 5. ExtLinks: No escapes needed
20103 !! options
20104 parsoid
20105 !! wikitext
20106 [http://google.com [google]
20107 !! html
20108 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20109 !! end
20111 !! test
20112 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20113 !! html/parsoid
20114 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20115 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20116 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20117 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20118 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20119 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20120 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20121 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20122 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20123 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20124 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20125 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20126 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20127 </p>
20128 !! wikitext
20129 x<nowiki/>http://example.com<nowiki/>y
20130 http://example.com<nowiki/>?x
20131 http://example.com<nowiki/>&x
20132 http://example.com<nowiki/>'x
20133 http://example.com<nowiki/>,x
20134 http://example.com<nowiki/>.x
20135 http://example.com<nowiki/>;x
20136 http://example.com<nowiki/>:x
20137 http://example.com<nowiki/>;x
20138 http://example.com<nowiki/>!x
20139 http://example.com<nowiki/>=x
20140 http://example.com<nowiki/>(x)
20141 http://example.com(x<nowiki/>)
20142 !! end
20144 !! test
20145 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20146 !! html/parsoid
20147 <p>x
20148 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20150 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20151 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20152 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20153 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20154 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20155 </p>
20156 !! wikitext
20158 http://example.com
20160 "http://example.com"
20161 (http://example.com)
20162 (http://example.com) foo
20163 http://example.com,
20164 http://example.com, foo
20165 !! end
20167 ## Parsoid currently fails wt2html on this one!
20168 !! test
20169 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20170 !! html/parsoid
20171 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20172 !! wikitext
20173 http://example.com.,;:!?
20174 !! end
20176 !! test
20177 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20178 !! html/parsoid
20179 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20180 !! wikitext
20181 RFC 123<nowiki/>4
20182 !! end
20184 !! test
20185 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20186 !! html/parsoid
20187 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20188 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20189 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20190 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20191 </p>
20192 !! wikitext
20193 xRFC 123y
20194 XRFC 123y
20195 RFC 123?foo
20196 RFC 123&foo
20197 !! end
20199 !! test
20200 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20201 !! html/parsoid
20202 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20203 !! wikitext
20204 PMID 123<nowiki/>4
20205 !! end
20207 !! test
20208 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20209 !! html/parsoid
20210 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20211 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20212 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20213 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20214 </p>
20215 !! wikitext
20216 xPMID 123y
20217 XPMID 123y
20218 PMID 123?foo
20219 PMID 123&foo
20220 !! end
20222 !! test
20223 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20224 !! html/parsoid
20225 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20226 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20227 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20228 </p>
20229 !! wikitext
20230 ISBN 1234567890<nowiki/>1
20231 ISBN 1234567890<nowiki/>x
20232 ISBN 1234567890<nowiki/>b
20233 !! end
20235 !! test
20236 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
20237 !! html/parsoid
20238 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
20239 !! wikitext
20240 ISBN 1234567890's
20241 !! end
20243 #### --------------- Quotes ---------------
20244 #### 1. Quotes inside <b> and <i>
20245 #### 2. Link fragments separated by <i> and <b> tags
20246 #### 3. Link fragments inside <i> and <b>
20247 #### 4. No escaping needed
20248 #### --------------------------------------
20249 !! test
20250 1. Quotes inside <b> and <i>
20251 !! options
20252 parsoid=html2wt,wt2wt
20253 !! wikitext
20254 ''<nowiki>'foo'</nowiki>''
20255 ''<nowiki>''foo''</nowiki>''
20256 ''<nowiki>'''foo'''</nowiki>''
20257 ''foo''<nowiki/>'s
20258 '''<nowiki>'foo'</nowiki>'''
20259 '''<nowiki>''foo''</nowiki>'''
20260 '''<nowiki>'''foo'''</nowiki>'''
20261 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
20262 '''foo'''<nowiki/>'s
20263 '''foo''
20264 ''foo''<nowiki/>'
20265 '<nowiki/>''foo''<nowiki/>'
20266 ''''foo'''
20267 '''foo'''<nowiki/>'
20268 '<nowiki/>'''foo'''<nowiki/>'
20269 ''fools'<span> errand</span>''
20270 ''<span>fool</span>'s errand''
20271 !! html
20272 <p><i>'foo'</i>
20273 <i>''foo''</i>
20274 <i>'''foo'''</i>
20275 <i>foo</i>'s
20276 <b>'foo'</b>
20277 <b>''foo''</b>
20278 <b>'''foo'''</b>
20279 <b>foo'<i>bar'</i>baz</b>
20280 <b>foo</b>'s
20281 '<i>foo</i>
20282 <i>foo</i>'
20283 '<i>foo</i>'
20284 '<b>foo</b>
20285 <b>foo</b>'
20286 '<b>foo</b>'</p>
20287 <i>fools'<span> errand</span></i>
20288 <i><span>fool</span>'s errand</i>
20289 !! end
20291 !! test
20292 2. Link fragments separated by <i> and <b> tags
20293 !! wikitext
20294 [[''foo''<nowiki>hello]]</nowiki>
20296 [['''foo'''<nowiki>hello]]</nowiki>
20297 !! html
20298 <p>[[<i>foo</i>hello]]
20299 </p><p>[[<b>foo</b>hello]]
20300 </p>
20301 !! end
20303 !! test
20304 3. Link fragments inside <i> and <b>
20305 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
20306  this is one of the shortcomings of this format)
20307 !! wikitext
20308 ''[[foo''<nowiki>]]</nowiki>
20310 '''[[foo'''<nowiki>]]</nowiki>
20311 !! html
20312 <p><i>[[foo</i>]]
20313 </p><p><b>[[foo</b>]]
20314 </p>
20315 !! end
20317 !! test
20318 4. No escaping needed
20319 !! wikitext
20320 '<span>''bar''</span>'
20321 '<span>'''bar'''</span>'
20322 !! html
20323 <p>'<span><i>bar</i></span>'
20324 '<span><b>bar</b></span>'
20325 </p>
20326 !! end
20328 #### ----------- Paragraphs ---------------
20329 #### 1. No unnecessary escapes
20330 #### --------------------------------------
20332 !! test
20333 1. No unnecessary escapes
20334 !! wikitext
20335 bar <span><nowiki>[[foo]]</nowiki></span>
20337 =bar <span><nowiki>[[foo]]</nowiki></span>
20339 [[bar <span><nowiki>[[foo]]</nowiki></span>
20341 ]]bar <span><nowiki>[[foo]]</nowiki></span>
20343 =bar <span>foo]]</span><nowiki>=</nowiki>
20344 !! html
20345 <p>bar <span>[[foo]]</span>
20346 </p><p>=bar <span>[[foo]]</span>
20347 </p><p>[[bar <span>[[foo]]</span>
20348 </p><p>]]bar <span>[[foo]]</span>
20349 </p><p>=bar <span>foo]]</span>=
20350 </p>
20351 !!end
20353 #### ----------------------- PRE --------------------------
20354 #### 1. Leading whitespace in SOL context should be escaped
20355 #### ------------------------------------------------------
20356 !! test
20357 1. Leading whitespace in SOL context should be escaped
20358 !! options
20359 parsoid
20360 !! wikitext
20361 <nowiki> </nowiki>a
20363 <nowiki> </nowiki> a
20365 <nowiki>        </nowiki>a(tab)
20367 <nowiki> </nowiki>      a
20368 <!--cmt-->
20369 <nowiki> </nowiki> a
20372 <nowiki> </nowiki>b
20375 <nowiki>        </nowiki>b
20378 <nowiki>        </nowiki> b
20379 !! html
20380 <p> a</p>
20381 <p>  a</p>
20382 <p>     a(tab)</p>
20383 <p>     a</p>
20384 <p><!--cmt-->  a</p>
20385 <p>a
20386  b</p>
20387 <p>a
20388         b</p>
20389 <p>a
20390          b</p>
20391 !! end
20393 !! test
20394 2. Leading whitespace in non-indent-pre contexts should not be escaped
20395 !! options
20396 parsoid
20397 !! wikitext
20398 foo <ref>''a''
20399  b</ref>
20400 !! html
20401 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
20402 !! end
20404 !! test
20405 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
20406 !! options
20407 parsoid
20408 !! wikitext
20409 <blockquote>
20411  <span>b</span>
20413 </blockquote>
20414 !! html
20415 <blockquote>
20418  <span>b</span>
20419  c</p>
20420 </blockquote>
20421 !! end
20423 !! test
20424 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
20425 !! options
20426 parsoid
20427 !! wikitext
20428  [[File:Foobar.jpg|thumb|caption]]
20429 !! html
20430 !! html/parsoid
20431  <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>
20432 !! end
20434 !! test
20435 5. Nowiki escaping should account for indent-pres
20436 !! options
20437 parsoid=html2wt
20438 !! html
20439 <pre>==foo==</pre>
20440 !! wikitext
20441  ==foo==
20442 !! end
20444 #### --------------- Behavior Switches --------------------
20445 !! test
20446 1. Valid behavior switches should be escaped
20447 !! options
20448 parsoid=html2wt
20449 !! wikitext
20450 <nowiki>__TOC__</nowiki>
20451 ''<nowiki>__TOC__</nowiki>''
20452 !! html
20453 __TOC__
20454 <i>__TOC__</i>
20455 !! end
20457 !! test
20458 2. Invalid behavior switches should not be escaped
20459 !! options
20460 parsoid=html2wt
20461 !! wikitext
20462 __TOO__
20463 __|__
20464 !! html
20465 __TOO__
20466 __|__
20467 !! end
20469 #### --------------- HTML tags ---------------
20470 #### 1. a tags
20471 #### 2. other tags
20472 #### 3. multi-line html tag
20473 #### 4. extension tags
20474 #### -----------------------------------------
20475 !! test
20476 1. a tags
20477 !! options
20478 parsoid
20479 !! wikitext
20480 <a href="http://google.com">google</a>
20481 !! html
20482 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
20483 !! end
20485 !! test
20486 2. other tags
20487 !! wikitext
20488 <nowiki><div>foo</div>
20489 <div style="color:red">foo</div></nowiki>
20490 !! html
20491 <p>&lt;div&gt;foo&lt;/div&gt;
20492 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
20493 </p>
20494 !! end
20496 !! test
20497 3. multi-line html tag
20498 !! wikitext
20499 <nowiki><div
20500 >foo</div
20501 ></nowiki>
20502 !! html
20503 <p>&lt;div
20504 &gt;foo&lt;/div
20505 &gt;
20506 </p>
20507 !! end
20509 !! test
20510 4. extension tags
20511 !! wikitext
20512 <nowiki><ref>foo</ref></nowiki>
20514 <nowiki><ref>bar</nowiki>
20516 baz<nowiki></ref></nowiki>
20517 !! html
20518 <p>&lt;ref&gt;foo&lt;/ref&gt;
20519 </p><p>&lt;ref&gt;bar
20520 </p><p>baz&lt;/ref&gt;
20521 </p>
20522 !! end
20524 #### --------------- Others ---------------
20525 !! test
20526 Escaping nowikis
20527 !! wikitext
20528 &lt;nowiki&gt;foo&lt;/nowiki&gt;
20529 !! html
20530 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
20531 </p>
20532 !! end
20534 ## The quote-char in the input is necessary for triggering the bug
20535 !! test
20536 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
20537 !! options
20538 parsoid=wt2wt,html2wt
20539 !! wikitext
20540 foo's bar :
20541 !! html
20542 <p>foo's bar :</p>
20543 !! end
20545 !! test
20547 Tag-like HTML structures are passed through as text
20548 !! wikitext
20549 <x y>
20551 <x.y>
20553 <x-y>
20561 1<d e>f
20562 !! html
20563 <p>&lt;x y&gt;
20564 </p><p>&lt;x.y&gt;
20565 </p><p>&lt;x-y&gt;
20566 </p><p>1&gt;2
20567 </p><p>x&lt;y
20568 </p><p>a&gt;b
20569 </p><p>1&lt;d e&gt;f
20570 </p>
20571 !! end
20574 # This was a bug in the PHP parser (see bug 17663 and its dups,
20575 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
20576 !! test
20577 Tag names followed by punctuation should not be recognized as tags
20578 !! wikitext
20579 <s.ome> text
20580 !! html
20581 <p>&lt;s.ome&gt; text
20582 </p>
20583 !! end
20585 !! test
20586 HTML tag with necessary entities in attributes
20587 !! wikitext
20588 <span title="&amp;amp;">foo</span>
20589 !! html
20590 <p><span title="&amp;amp;">foo</span>
20591 </p>
20592 !! end
20594 !! test
20595 HTML tag with 'unnecessary' entity encoding in attributes
20596 !! wikitext
20597 <span title="&amp;">foo</span>
20598 !! html
20599 <p><span title="&amp;">foo</span>
20600 </p>
20601 !! end
20603 !! test
20604 HTML tag with broken attribute value quoting
20605 !! wikitext
20606 <span title="Hello world>Foo</span>
20607 !! html/php
20608 <p><span>Foo</span>
20609 </p>
20610 !! html/parsoid
20611 <p><span title="Hello world">Foo</span>
20612 </p>
20613 !! end
20615 !! test
20616 Parsoid-only: HTML tag with broken attribute value quoting
20617 !! options
20618 parsoid
20619 !! wikitext
20620 <span title="Hello world>Foo</span>
20621 !! html
20622 <p><span title="Hello world">Foo</span>
20623 </p>
20624 !! end
20626 !! test
20627 Table with broken attribute value quoting
20628 !! wikitext
20630 | title="Hello world|Foo
20632 !! html/php
20633 <table>
20634 <tr>
20635 <td>Foo
20636 </td></tr></table>
20638 !! html/parsoid
20639 <table>
20640 <tr>
20641 <td title="Hello world">Foo
20642 </td></tr></table>
20644 !! end
20646 !! test
20647 Table with broken attribute value quoting on consecutive lines
20648 !! wikitext
20650 | title="Hello world|Foo
20651 | style="color:red|Bar
20653 !! html
20654 <table>
20655 <tr>
20656 <td>Foo
20657 </td>
20658 <td>Bar
20659 </td></tr></table>
20661 !! end
20663 !! test
20664 Parsoid-only: Table with broken attribute value quoting on consecutive lines
20665 !! options
20666 parsoid
20667 !! wikitext
20669 | title="Hello world|Foo
20670 | style="color:red|Bar
20672 !! html
20673 <table><tbody>
20674 <tr>
20675 <td title="Hello world">Foo
20676 </td><td style="color: red">Bar
20677 </td></tr></tbody></table>
20679 !! end
20681 !! test
20682 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20683 !! options
20684 parsoid
20685 !! wikitext
20686 {{}}
20687 !! html
20688 {{}}
20689 !! end
20691 !! test
20692 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
20693 !! options
20694 parsoid
20695 !! wikitext
20696 }}{{
20697 !! html
20698 }}{{
20699 !! end
20701 !!test
20702 Accept empty td cell attribute
20703 !! wikitext
20705 | align="center" | foo ||  |
20707 !! html
20708 <table>
20709 <tr>
20710 <td align="center"> foo </td>
20711 <td>
20712 </td></tr></table>
20714 !!end
20716 !!test
20717 Non-empty attributes in th-cells
20718 !! wikitext
20720 ! Foo !! style="color: red" | Bar
20722 !! html
20723 <table>
20724 <tr>
20725 <th> Foo </th>
20726 <th style="color: red"> Bar
20727 </th></tr></table>
20729 !!end
20731 !!test
20732 Accept empty attributes in th-cells
20733 !! wikitext
20735 !| foo !!| bar
20737 !! html
20738 <table>
20739 <tr>
20740 <th> foo </th>
20741 <th> bar
20742 </th></tr></table>
20744 !!end
20746 !!test
20747 Empty table rows go away
20748 !! wikitext
20750 | Hello
20751 | there
20752 |- class="foo"
20755 !! html
20756 <table>
20757 <tr>
20758 <td> Hello
20759 </td>
20760 <td> there
20761 </td></tr>
20763 </table>
20765 !! end
20768 ### Parsoid-centric tests for testing RTing of inter-element separators
20769 ### Edge cases not tested by existing parser tests and specific to
20770 ### Parsoid-specific serialization strategies.
20773 !!test
20774 RT-ed inter-element separators should be valid separators
20775 !! wikitext
20777 |- [[foo]]
20779 !! html
20780 <table>
20782 </table>
20784 !!end
20786 !!test
20787 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20788 (Parsoid-only since PHP parser relies on Tidy for correct output)
20789 !!options
20790 parsoid
20791 !! wikitext
20793 |<small>foo
20798 |<small>foo<small>
20800 !! html
20801 !!end
20803 !!test
20804 Empty TD followed by TD with tpl-generated attribute
20805 !! wikitext
20809 |{{echo|style='color:red'}}|foo
20811 !! html
20812 <table>
20814 <tr>
20815 <td>
20816 </td>
20817 <td>foo
20818 </td></tr></table>
20820 !!end
20822 !!test
20823 Indented table with an empty td
20824 !! wikitext
20825  {|
20826  |-
20828  |foo
20829  |}
20830 !! html
20831 <table>
20833 <tr>
20834 <td>
20835 </td>
20836 <td>foo
20837 </td></tr></table>
20839 !!end
20841 !!test
20842 Indented block & table
20843 !! wikitext
20844  <div>foo</div>
20845  {|
20846  |foo
20847  |}
20848 !! html/php
20849  <div>foo</div>
20850 <table>
20851 <tr>
20852 <td>foo
20853 </td></tr></table>
20855 !! html/parsoid
20856  <div data-parsoid='{"stx":"html"}'>foo</div>
20857  <table><tbody>
20858  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20859  </tbody></table>
20860 !!end
20862 !! test
20863 Indent and comment before table row
20864 !! wikitext
20866  <!--hi-->|-
20867  | there
20869 !! html/php
20870 <table>
20872 <tr>
20873 <td> there
20874 </td></tr></table>
20876 !! html/parsoid
20877 <table data-parsoid='{}'>
20878  <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20879  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20880 </tbody></table>
20881 !! end
20883 !!test
20884 Empty TR followed by a template-generated TR
20885 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20886 !!options
20887 parsoid
20888 !! wikitext
20891 {{echo|<tr><td>foo</td></tr>}}
20893 !! html
20894 <table>
20895 <tbody>
20896 <tr></tr>
20897 <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}}]}'>
20898 <td>foo</td></tr>
20899 </tbody></table>
20900 !!end
20902 ## PHP and parsoid output differ for this, and since this is primarily
20903 ## for testing Parsoid's serializer, marking this Parsoid only
20904 !!test
20905 Empty TR followed by mixed-ws-comment line should RT correctly
20906 !!options
20907 parsoid
20908 !! wikitext
20911  <!--c-->
20913 <!--c--> <!--d-->
20915 !! html
20916 <table>
20917 <tbody>
20918 <tr></tr>
20919  <!--c-->
20920 <tr>
20921 <!--c--> </tr><!--d-->
20922 </tbody></table>
20924 !!end
20926 !!test
20927 Multi-line image caption generated by templates with/without trailing newlines
20928 !!options
20929 parsoid
20930 !! wikitext
20931 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20932 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20933 !! html
20934 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
20935 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
20937 !!end
20939 !! test
20940 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20941 !! options
20942 parsoid=html2wt
20943 !! wikitext
20944 <includeonly>foo</includeonly>
20945 new para
20947 [[./Category:Foo]]
20949 = new heading =
20950 !! html
20951 <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>
20953 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20954 !! end
20956 ## PHP emits broken html for this, and since this is primarily
20957 ## a Parsoid serializer test, marking this Parsoid only
20958 !!test
20959 Improperly nested inline or quotes tags with whitespace in between
20960 !!options
20961 parsoid
20962 !! wikitext
20963 <span> <s>x</span> </s>
20964 ''' ''x''' ''
20965 !! html
20966 <p><span> <s>x</s></span><s> </s>
20967 <b> <i>x</i></b><i> </i>
20968 </p>
20969 !!end
20971 !!test
20972 Encapsulate protected attributes from wt
20973 !!options
20974 parsoid
20975 !! wikitext
20976 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20977 !! html
20978 <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>
20979 </body>
20980 !!end
20982 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20983 ## Having nested or stray pre tags results in the attempt to add duplicates,
20984 ## causing an assertion fail. This test tries to prevent that situation.
20985 !!test
20986 Ensure ParagraphWrapper can deal with stray closing pre tags
20987 !!options
20988 parsoid=wt2html
20989 !! wikitext
20990 plain text</pre>
20991 !! html
20992 plain text
20993 !!end
20995 !!test
20996 1. Ensure fostered text content is wrapped in spans
20997 !!options
20998 parsoid=wt2html
20999 !! wikitext
21000 <table>hi</table><table>ho</table>
21001 !! html
21002 <span>hi</span>
21003 <table></table>
21004 <span>ho</span>
21005 <table></table>
21006 !!end
21008 !!test
21009 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
21010 !!options
21011 parsoid=wt2html,wt2wt
21012 !! wikitext
21013 <table>
21014 <tr> || ||
21015 <td> a
21016 </table>
21017 !! html
21018 <span> || ||</span>
21019 <table>
21020 <tbody>
21021 <tr>
21022 <td> a</td></tr>
21023 </tbody></table>
21024 !!end
21026 !!test
21027 Encapsulation properly handles null DSR information from foster box
21028 !!options
21029 parsoid=wt2html,wt2wt
21030 !! wikitext
21031 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21032 !! html
21033 <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;
21034 <table>foo
21035 <tr>
21036 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
21037 <table>
21038 <tbody>
21039 <tr>
21040 <td>bar</td></tr></tbody></table>
21041 !!end
21043 !!test
21044 1. Encapsulate foster-parented transclusion content
21045 !!options
21046 parsoid=wt2wt,wt2html
21047 !! wikitext
21048 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21049 !! html
21050 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21051 <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
21052 <tr>
21053 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
21054 <table>
21055 <tbody>
21056 <tr>
21057 <td>bar</td></tr></tbody></table>
21058 !!end
21060 !!test
21061 2. Encapsulate foster-parented transclusion content
21062 !!options
21063 parsoid=wt2wt,wt2html
21064 !! wikitext
21065 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21066 !! html
21067 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21068 <table>
21069 <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>
21070 <tr>
21071 <td>bar</td></tr></table>&quot;]}">foo</div>
21072 <table>
21073 <tbody>
21074 <tr>
21075 <td>bar</td></tr></tbody></table>
21076 !!end
21078 !!test
21079 3. Encapsulate foster-parented transclusion content
21080 !!options
21081 parsoid=wt2wt,wt2html
21082 !! wikitext
21083 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21084 !! html
21085 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21086 <table>
21087 <div>
21088 <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>
21089 <tr>
21090 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21091 <p>foo</p></div>
21092 <table>
21093 <tbody>
21094 <tr>
21095 <td>bar</td></tr></tbody></table>
21096 !!end
21098 !!test
21099 4. Encapsulate foster-parented transclusion content
21100 !!options
21101 parsoid=wt2wt,wt2html
21102 !! wikitext
21103 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21104 !! html
21105 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21106 <table>
21107 <div>
21108 <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>
21109 <tr>
21110 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
21111 <p>foo</p></div>
21112 <table>
21113 <tbody>
21114 <tr>
21115 <td>bar</td></tr></tbody></table>
21116 !!end
21118 !!test
21119 5. Encapsulate foster-parented transclusion content
21120 !!options
21121 parsoid=wt2wt,wt2html
21122 !! wikitext
21123 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21124 !! html
21125 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21126 <table>
21127 <tr>
21128 <td>
21129 <div>
21130 <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</span>
21131 <table>
21132 <tbody>
21133 <tr>
21134 <td>
21135 <div>
21136 <p>foo</p></div></td></tr></tbody></table>
21137 !!end
21139 !!test
21140 6. Encapsulate foster-parented transclusion content
21141 !!options
21142 parsoid=wt2wt,wt2html
21143 !! wikitext
21144 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21145 !! html
21146 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21147 <table>
21148 <tr>
21149 <td>
21150 <div>
21151 <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</span>
21152 <table>
21153 <tbody>
21154 <tr>
21155 <td>
21156 <div>
21157 <p>foo</p></div></td></tr></tbody></table>
21158 <p>ok</p>
21159 !!end
21161 !!test
21162 7. Encapsulate foster-parented transclusion content
21163 !!options
21164 parsoid=wt2wt,wt2html
21165 !! wikitext
21166 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21167 !! html
21168 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
21169 <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;
21170 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
21171 <td>bar</td></table>&quot;]}">foo</p>
21172 <table>
21173 <tbody>
21174 <tr>
21175 <td>bar</td></tr></tbody></table>
21176 !!end
21178 !!test
21179 8. Encapsulate foster-parented transclusion content
21180 !!options
21181 parsoid=wt2wt,wt2html
21182 !! wikitext
21183 {{echo|a
21184 }}{|{{echo|style='color:red'}}
21188 !! html
21189 <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><span 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}}}</span>
21190 <table>
21191 <tbody>
21192 <tr>
21193 <td>b</td></tr></tbody></table>
21194 !!end
21196 !!test
21197 9. Encapsulate foster-parented transclusion content
21198 !!options
21199 parsoid=wt2wt,wt2html
21200 !! wikitext
21201 <table>{{echo|hi</table>hello}}
21202 !! html
21203 <span 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</span>
21204 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
21205 !!end
21207 !!test
21208 Table in fosterable position
21209 !!options
21210 parsoid=wt2html,wt2wt
21211 !! wikitext
21212 {{OpenTable}}
21213 <div>
21216 </div>
21218 !! html
21219 <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" data-parsoid="{}">
21220 </span>
21221 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
21223 <table>
21224 </table>
21225 !!end
21227 # Parsoid only for bug 64747
21228 !! test
21229 Properly encapsulate empty-content transclusions in fosterable positions
21230 !! wikitext
21231 <table>
21232 {{#if:|
21233 <td>foo</td>
21235 </table>
21236 !! html/parsoid
21237 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
21239 </table>
21240 !! end
21242 !!test
21243 Support <object> element with .data attribute
21244 !!options
21245 parsoid=html2wt
21246 !! wikitext
21247 <object data="test.swf"></object>
21248 !! html
21249 <object data="test.swf"></object>
21250 !!end
21252 # -----------------------------------------------------------------
21253 # The following section of tests are primarily to spec requirements
21254 # around serialization of new/edited content.
21256 # All these tests are marked Parsoid html2wt and html2html only
21257 # ----------------------------------------------------------------
21259 !! test
21260 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
21261 !! options
21262 parsoid=html2wt
21263 language=es
21264 !! wikitext
21265 [[Foo]]
21266 !! html
21267 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
21268 !! end
21270 !! test
21271 Image: Modifying size of an image (1)
21272 !! options
21273 parsoid={
21274   "modes": ["wt2wt"],
21275   "changes": [
21276     ["img[height]", "attr", "height", "22"],
21277     ["img[width]", "attr", "width", "200"]
21278   ]
21280 !! wikitext
21281 [[Image:Foobar.jpg|230x230px]]
21282 !! wikitext/edited
21283 [[Image:Foobar.jpg|200x200px]]
21284 !!end
21286 !! test
21287 Image: Modifying size of an image (2)
21288 !! options
21289 parsoid={
21290   "modes": ["wt2wt"],
21291   "changes": [
21292     ["img[height]", "attr", "height", "100"],
21293     ["img[width]", "attr", "width", "500"]
21294   ]
21296 !! wikitext
21297 [[Image:Foobar.jpg|230x230px]]
21298 !! wikitext/edited
21299 [[Image:Foobar.jpg|500x500px]]
21300 !!end
21302 # Change in size is ignored so long as class='mw-default-size'
21303 !! test
21304 Image: Modifying size of an image (3)
21305 !! options
21306 parsoid={
21307   "modes": ["wt2wt"],
21308   "changes": [
21309     ["figure[class]", "removeClass", "mw-default-size"],
21310     ["figure img", "attr", "height", "19"],
21311     ["figure img", "attr", "width", "170"]
21312   ]
21314 !! wikitext
21315 [[Image:Foobar.jpg|thumb]]
21316 !! wikitext/edited
21317 [[Image:Foobar.jpg|thumb|170x170px]]
21318 !!end
21320 !! test
21321 Image: Modifying alignment of an image (bug 48665)
21322 !! options
21323 parsoid={
21324   "modes": ["wt2wt"],
21325   "changes": [
21326     ["figure[class]", "removeClass", "mw-halign-right"],
21327     ["figure[class]", "addClass", "mw-halign-left"]
21328   ]
21330 !! wikitext
21331 [[Image:Foobar.jpg|thumb|caption|right]]
21332 !! wikitext/edited
21333 [[Image:Foobar.jpg|thumb|caption|left]]
21334 !! end
21336 !! test
21337 Image: Modifying mw-default-size of an frameless image (bug 62805)
21338 !! options
21339 parsoid={
21340   "modes": ["wt2wt"],
21341   "changes": [
21342     ["figure.mw-default-size", "removeClass", "mw-default-size"]
21343   ]
21345 !! wikitext
21346 [[Image:Foobar.jpg|frameless|right]]
21347 !! wikitext/edited
21348 [[Image:Foobar.jpg|frameless|right|220x220px]]
21349 !! end
21351 !! test
21352 Image: Modifying valign of an image (bug 49221)
21353 !! options
21354 parsoid={
21355   "modes": ["wt2wt"],
21356   "changes": [
21357     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
21358     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
21359   ]
21361 !! wikitext
21362 [[File:Foobar.jpg|20px|middle]]
21363 !! wikitext/edited
21364 [[File:Foobar.jpg|20px|text-top]]
21365 !! end
21367 !! test
21368 Image: Modifying alt attribute of an image (bug 56400)
21369 !! options
21370 parsoid={
21371   "modes": ["wt2wt"],
21372   "changes": [
21373     ["img[alt]", "attr", "alt", "some alternate edited text"]
21374   ]
21376 !! wikitext
21377 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
21378 !! wikitext/edited
21379 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
21380 !!end
21382 !! test
21383 Image: Modifying caption of an image
21384 !! options
21385 parsoid={
21386   "modes": ["wt2wt"],
21387   "changes": [
21388     ["figcaption", "text", "new caption"]
21389   ]
21391 !! wikitext
21392 [[Image:Foobar.jpg|thumb|original caption]]
21393 !! wikitext/edited
21394 [[Image:Foobar.jpg|thumb|new caption]]
21395 !!end
21397 !! test
21398 Image: empty alt attribute (bug 48924)
21399 !! options
21400 parsoid
21401 !! wikitext
21402 [[File:Foobar.jpg|thumb|alt=|bar]]
21403 !! html
21404 <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>
21405 !! end
21407 #!! test
21408 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
21409 #!! options
21410 #parsoid=html2wt
21411 #language=ar
21412 #!! input
21413 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
21414 #!! result
21415 #<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>
21416 #!! end
21418 !! test
21419 Image: Block level image should have \n before and after
21420 !! options
21421 parsoid
21422 !! wikitext
21424 [[File:Foobar.jpg|right|thumb|150x150px]]
21426 !! html
21427 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Foobar.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Foobar.png/131px-Foobar.png" width="131" height="150" resource="./File:Foobar.png" data-parsoid='{"a":{"resource":"./File:Foobar.png","width":"131"},"sa":{"resource":"File:Foobar.png","width":"150"}}'></a></figure><p>456</p>
21428 !!end
21430 !! test
21431 Image: New block level image should have \n before and after (existing
21432 content)
21433 !! options
21434 parsoid
21435 !! wikitext
21437 [[File:Foobar.jpg|right|thumb|150x150px]]
21439 !! html
21440 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
21441 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}],"dsr":[4,45,2,2]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"dsr":[6,43,null,null]}'><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>
21442 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
21443 !!end
21445 !! test
21446 Image: upright option (parsoid)
21447 !! options
21448 parsoid
21449 !! wikitext
21450 [[File:Foobar.jpg|thumb|upright|caption]]
21451 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
21452 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
21453 !! html
21454 <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><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><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>
21455 !!end
21457 !! test
21458 Image: upright option is ignored on inline and frame images (parsoid)
21459 !! options
21460 parsoid
21461 !! wikitext
21462 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
21463 !! html
21464 <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>
21465 !!end
21467 !! test
21468 Image: from basic HTML (1)
21469 !! options
21470 parsoid=html2wt
21471 !! html/parsoid
21472 <span typeof="mw:Image">
21473   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21474 </span>
21475 !! wikitext
21476 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21477 !! end
21479 !! test
21480 Image: from basic HTML (2)
21481 !! options
21482 parsoid=html2wt
21483 !! html/parsoid
21484 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
21485 !! wikitext
21486 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
21487 !! end
21489 !! test
21490 Image: from basic HTML (3)
21491 !! options
21492 parsoid=html2wt
21493 !! html/parsoid
21494 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
21495 !! wikitext
21496 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
21497 !! end
21499 !! test
21500 Image: from basic HTML (4)
21501 !! options
21502 parsoid=html2wt
21503 !! html/parsoid
21504 <img src="File:Foobar.jpg">
21505 !! wikitext
21506 [[File:Foobar.jpg|link=]]
21507 !! end
21509 !! test
21510 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
21511 !! options
21512 parsoid=html2wt
21513 !! wikitext
21514 * foo
21515 !! html
21516 <ul>
21517 <li><p>foo</p></li>
21518 </ul>
21519 !! end
21521 !! test
21522 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
21523 !! options
21524 parsoid=html2wt
21525 !! wikitext
21526 * foo
21527 !! html
21528 <ul> <li>foo</li></ul>
21529 !! end
21531 !! test
21532 Don't strip leading whitespace when handling indent-pre suppressing tags
21533 !! options
21534 parsoid=html2wt
21535 !! wikitext
21537   | indented row
21539 <blockquote>
21540  '''This is very bold of you!'''
21544  indented cell (no pre-wrapping!)
21546 </blockquote>
21548  <div>bar</div>
21549 !! html
21550 <table>
21551   <tr><td> indented row</td></tr>
21552 </table>
21553 <blockquote><p>
21554  <b>This is very bold of you!</b>
21555 </p>
21556 <table><tr><td>
21557  indented cell (no pre-wrapping!)
21558 </td></tr></table>
21559 </blockquote>
21560 <p>foo</p>
21561  <div>bar</div>
21562 !! end
21564 !! test
21565 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
21566 !! options
21567 parsoid=html2wt
21568 !! wikitext
21570 <nowiki> </nowiki><span>bar</span>
21572 <span>foo2
21573 <nowiki> </nowiki></span>bar2
21575 <div>foo</div>
21576 <nowiki> </nowiki><span>bar</span>
21578 <div>
21579 <nowiki> </nowiki><span>foo</span>
21580 </div>
21581 !! html
21582 <p>foo</p>
21583  <span>bar</span>
21585 <span>foo2
21586  </span>bar2
21588 <div>foo</div>
21589  <span>bar</span>
21591 <div>
21592  <span>foo</span>
21593 </div>
21594 !! end
21596 !! test
21597 Lists: Add space after bullets
21598 !! options
21599 parsoid=html2wt
21600 !! wikitext
21601 * foo
21602 * bar
21603 * <span> baz</span>
21604 !! html
21605 <ul>
21606 <li>foo</li>
21607 <li> bar</li>
21608 <li><span> baz</span></li>
21609 </ul>
21610 !! end
21612 !! test
21613 Lists: Dont insert newlines in a serialized list item.
21614 !! options
21615 parsoid=html2wt
21616 !! wikitext
21617 * a<br>b
21618 * c
21619 !! html
21620 <ul><li>a<br>b</li><li>c</li></ul>
21621 !! end
21623 !! test
21624 Headings: Add space before/after == (Bug 51744)
21625 !! options
21626 parsoid=html2wt
21627 !! wikitext
21628 == foo ==
21630 == bar ==
21632 == baz ==
21634 == <span> baz</span> ==
21635 !! html
21636 <h2>foo</h2>
21637 <h2> bar</h2>
21638 <h2>baz </h2>
21639 <h2><span> baz</span></h2>
21640 !! end
21642 !! test
21643 Parsoid: Serialize positional parameters with = in them as named parameter
21644 !! options
21645 parsoid=html2wt
21646 !! wikitext
21647 {{echo|1 = f=oo}}
21649 {{echo|1 = f=oo|2 = bar}}
21651 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21652 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21653 {{echo|<nowiki>f=oo</nowiki>|bar}}
21654 !! html
21655 <p about="#mwt1" typeof="mw:Transclusion"
21656 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
21658 <p about="#mwt1" typeof="mw:Transclusion"
21659 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
21661 <!--Orig params with data-parsoid has heuristics for handling = chars-->
21662 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
21663 <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>
21664 !! end
21666 !! test
21667 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
21668 !! options
21669 parsoid=html2wt
21670 !! wikitext
21671 <div>a
21673 </div>
21674 <div>a
21676 </div>
21677 <div>
21681 </div>
21682 !! html
21683 <div>a<p>b</p></div>
21684 <div>a
21685 <p>b</p></div>
21686 <div>
21688 <p>b</p></div>
21689 !! end
21691 !! test
21692 Substrings resembling wikitext in hrefs should not get nowiki escapes
21693 !! options
21694 parsoid=html2wt
21695 !! wikitext
21696 [[Foo''bar''baz]]
21697 !! html
21698 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
21699 !! end
21701 #-----------------------------
21702 # I/B quote minimization tests
21703 #-----------------------------
21705 !! test
21706 1. I/B quote minimization: wikitext-only tags should be combined
21707 !! options
21708 parsoid=html2wt
21709 !! wikitext
21710 ''AB''
21712 '''AB'''
21714 ''A'''B'''''
21716 '''A''B'''''
21718 '''A''BC''D'''
21720 '''''AB'''''
21722 '''''AB'''''
21724 '''''AB'''''
21725 !! html
21726 <p><i>A</i><i>B</i></p>
21727 <p><b>A</b><b>B</b></p>
21728 <p><i>A</i><b><i>B</i></b></p>
21729 <p><b>A</b><i><b>B</b></i></p>
21730 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
21731 <p><i><b>A</b></i><i><b>B</b></i></p>
21732 <p><i><b>A</b></i><b><i>B</i></b></p>
21733 <p><b><i>A</i></b><i><b>B</b></i></p>
21734 !! end
21736 !! test
21737 2. I/B quote minimization: wikitext and html tags should not be combined
21738 !! options
21739 parsoid=html2wt
21740 !! wikitext
21741 ''A''<i>B</i>
21743 ''A'''''<i>B</i>'''
21744 !! html
21745 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
21746 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
21747 !! end
21749 !! test
21750 3. I/B quote minimization: templated content stops minimization
21751 !! options
21752 parsoid=html2wt
21753 !! wikitext
21754 ''A''{{echo|''B''}}
21756 ''A''{{echo|'''''B'''''}}
21757 !! html
21758 <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>
21759 <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>
21760 !! end
21762 !! test
21763 4. I/B quote minimization: new content should be mimimized with adjacent old content
21764 !! options
21765 parsoid=html2wt
21766 !! wikitext
21767 ''AB''
21769 '''AB'''
21771 ''A'''B'''''
21772 !! html
21773 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21774 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21775 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21776 !! end
21778 #------------------------------------
21779 # End of I/B quote minimization tests
21780 #------------------------------------
21782 !!test
21783 Bug 54262: New entities
21784 !! options
21785 parsoid=html2wt
21786 !! wikitext
21787 &nbsp;
21788 !! html
21789 <span typeof="mw:Entity">&nbsp;</span>
21790 !! end
21792 ## Note that there is no wikitext output for 'unknownproperty' ##
21793 ## Unknown magic words are silently dropped ##
21795 !! test
21796 Magic words
21797 !! options
21798 parsoid=html2wt
21799 !! wikitext
21800 __TOC__
21801 __NOTOC__
21802 __FORCETOC__
21803 __INDEX__
21804 __NOINDEX__
21805 __NOGALLERY__
21806 __NOEDITSECTION__
21807 __NOTITLECONVERT__
21808 __NOCONTENTCONVERT__
21809 !! html
21810 <meta property='mw:PageProp/toc' />
21811 <meta property='mw:PageProp/notoc' />
21812 <meta property='mw:PageProp/forcetoc' />
21813 <meta property='mw:PageProp/index' />
21814 <meta property='mw:PageProp/noindex' />
21815 <meta property='mw:PageProp/nogallery' />
21816 <meta property='mw:PageProp/noeditsection' />
21817 <meta property='mw:PageProp/notitleconvert' />
21818 <meta property='mw:PageProp/nocontentconvert' />
21819 <meta property='mw:PageProp/unknownproperty' />
21820 !! end
21822 !! test
21823 Consecutive <pre>s should not get merged
21824 !! options
21825 parsoid=html2wt,html2html
21826 !! wikitext
21840 !! html
21841 <pre>a</pre><pre>b</pre>
21843 <pre>c
21844 </pre><pre>
21845 d</pre>
21847 <pre>e
21849 </pre><pre>
21851 f</pre>
21852 !! end
21854 !! test
21855 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21856 !! options
21857 parsoid=html2wt
21858 !! wikitext
21859 [[Special:BookSources/1234567890|ISBN 1234567895]]
21860 !! html
21861 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21862 !! end
21864 !! test
21865 Edited RFC links not serializable as RFC links should serialize as extlinks
21866 !! options
21867 parsoid=html2wt
21868 !! wikitext
21869 [//tools.ietf.org/html/rfc123 New RFC]
21870 !! html
21871 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21872 !! end
21874 !! test
21875 Edited PMID links not serializable as PMID links should serialize as extlinks
21876 !! options
21877 parsoid=html2wt
21878 !! wikitext
21879 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21880 !! html
21881 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21882 !! end
21884 !! test
21885 Edited Redirect link should emit a non-piped wikitext link
21886 !! options
21887 parsoid=html2wt
21888 !! wikitext
21889 #REDIRECT [[Bar]]
21890 !! html
21891 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21892 !! end
21894 # -----------------------------------------------------------------
21895 # End of section for Parsoid-only html2wt tests for serialization
21896 # of new content
21897 # -----------------------------------------------------------------
21899 TODO:
21900 more images
21901 more tables
21902 character entities
21903 and much more
21904 Try for 100% code coverage