Update list item newline handling to follow Parsoid's model
[mediawiki.git] / tests / parser / parserTests.txt
blob941a6a0bfac40d76697a27981d3260237dda2ea4
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 Template:Foo
51 !!text
52 FOO
53 !!endarticle
55 !! article
56 Template:Blank
57 !! text
58 !! endarticle
60 !! article
61 Template:pipe
62 !! text
64 !! endarticle
66 !!article
67 MediaWiki:bad image list
68 !!text
69 * [[File:Bad.jpg]] except [[Nasty page]]
70 !!endarticle
72 !! article
73 Template:inner list
74 !! text
75 * item 1
76 !! endarticle
78 !! article
79 Template:tbl-start
80 !! text
82 !! endarticle
84 !! article
85 Template:tbl-end
86 !! text
88 !! endarticle
90 !! article
91 Template:!
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 !! test
411 Simple list
412 !! wikitext
413 * Item 1
414 * Item 2
415 !! html
416 <ul><li> Item 1</li>
417 <li> Item 2</li></ul>
419 !! end
421 !! test
422 Italics and bold
423 !! wikitext
424 * plain
425 * plain''italic''plain
426 * plain''italic''plain''italic''plain
427 * plain'''bold'''plain
428 * plain'''bold'''plain'''bold'''plain
429 * plain''italic''plain'''bold'''plain
430 * plain'''bold'''plain''italic''plain
431 * plain''italic'''bold-italic'''italic''plain
432 * plain'''bold''bold-italic''bold'''plain
433 * plain'''''bold-italic'''italic''plain
434 * plain'''''bold-italic''bold'''plain
435 * plain''italic'''bold-italic'''''plain
436 * plain'''bold''bold-italic'''''plain
437 * plain l'''italic''plain
438 * plain l''''bold''' plain
439 !! html
440 <ul><li> plain</li>
441 <li> plain<i>italic</i>plain</li>
442 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
443 <li> plain<b>bold</b>plain</li>
444 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
445 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
446 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
447 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
448 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
449 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
450 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
451 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
452 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
453 <li> plain l'<i>italic</i>plain</li>
454 <li> plain l'<b>bold</b> plain</li></ul>
456 !! end
458 # this example taken from the [[simple:Moon]] article (bug 47326)
459 !! test
460 Italics and possessives (1)
461 !! wikitext
462 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
463 !! html
464 <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
465 </p>
466 !! end
468 # this example taken from [[en:Flaming Pie]] (bug 49926)
469 !! test
470 Italics and possessives (2)
471 !! wikitext
472 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
473 !! html
474 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
475 </p>
476 !! end
478 # this example taken from [[en:Dictionary]] (bug 49926)
479 !! test
480 Italics and possessives (3)
481 !! wikitext
482 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''.
483 !! html
484 <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>.
485 </p>
486 !! end
490 ### 2-quote opening sequence tests
492 !! test
493 Italics and bold: 2-quote opening sequence: (2,2)
494 !! wikitext
495 ''foo''
496 !! html
497 <p><i>foo</i>
498 </p>
499 !!end
502 !! test
503 Italics and bold: 2-quote opening sequence: (2,3)
504 !! options
505 parsoid=wt2html
506 !! wikitext
507 ''foo'''
508 !! html/*
509 <p><i>foo'</i>
510 </p>
511 !!end
514 # same html as previous, but wikitext adjusted to match parsoid html2wt
515 !! test
516 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
517 !! wikitext
518 ''<nowiki>foo'</nowiki>''
519 !! html
520 <p><i>foo'</i>
521 </p>
522 !! end
525 !! test
526 Italics and bold: 2-quote opening sequence: (2,4)
527 !! options
528 parsoid=wt2html
529 !! wikitext
530 ''foo''''
531 !! html/*
532 <p><i>foo''</i>
533 </p>
534 !!end
537 # same html as previous, but wikitext adjusted to match parsoid html2wt
538 !! test
539 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
540 !! wikitext
541 ''<nowiki>foo''</nowiki>''
542 !! html
543 <p><i>foo''</i>
544 </p>
545 !! end
548 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
549 !! test
550 Italics and bold: 2-quote opening sequence: (2,5)
551 !! options
552 parsoid=wt2html
553 !! wikitext
554 ''foo'''''
555 !! html/php
556 <p><i>foo</i>
557 </p>
558 !! html/parsoid
559 <p><i>foo</i><b></b>
560 </p>
561 !!end
563 # same html as previous, but wikitext adjusted to match parsoid html2wt
564 !! test
565 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
566 !! wikitext
567 ''foo'''''<nowiki/>'''
568 !! html/php
569 <p><i>foo</i>
570 </p>
571 !! html/parsoid
572 <p><i>foo</i><b></b>
573 </p>
574 !! end
578 ### 3-quote opening sequence tests
581 !! test
582 Italics and bold: 3-quote opening sequence: (3,2)
583 !! wikitext
584 '''foo''
585 !! html
586 <p>'<i>foo</i>
587 </p>
588 !!end
591 !! test
592 Italics and bold: 3-quote opening sequence: (3,3)
593 !! wikitext
594 '''foo'''
595 !! html
596 <p><b>foo</b>
597 </p>
598 !!end
601 !! test
602 Italics and bold: 3-quote opening sequence: (3,4)
603 !! options
604 parsoid=wt2html
605 !! wikitext
606 '''foo''''
607 !! html/*
608 <p><b>foo'</b>
609 </p>
610 !!end
613 # same html as previous, but wikitext adjusted to match parsoid html2wt
614 !! test
615 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
616 !! wikitext
617 '''<nowiki>foo'</nowiki>'''
618 !! html
619 <p><b>foo'</b>
620 </p>
621 !! end
624 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
625 !! test
626 Italics and bold: 3-quote opening sequence: (3,5)
627 !! options
628 parsoid=wt2html
629 !! wikitext
630 '''foo'''''
631 !! html/php
632 <p><b>foo</b>
633 </p>
634 !! html/parsoid
635 <p><b>foo</b><i></i>
636 </p>
637 !!end
639 # same html as previous, but wikitext adjusted to match parsoid html2wt
640 !! test
641 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
642 !! wikitext
643 '''foo'''''<nowiki/>''
644 !! html/php
645 <p><b>foo</b>
646 </p>
647 !! html/parsoid
648 <p><b>foo</b><i></i>
649 </p>
650 !! end
654 ### 4-quote opening sequence tests
657 !! test
658 Italics and bold: 4-quote opening sequence: (4,2)
659 !! options
660 parsoid=wt2html
661 !! wikitext
662 ''''foo''
663 !! html/*
664 <p>''<i>foo</i>
665 </p>
666 !!end
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
672 !! wikitext
673 <nowiki>''</nowiki>''foo''
674 !! html
675 <p>''<i>foo</i>
676 </p>
677 !! end
680 !! test
681 Italics and bold: 4-quote opening sequence: (4,3)
682 !! wikitext
683 ''''foo'''
684 !! html
685 <p>'<b>foo</b>
686 </p>
687 !!end
690 !! test
691 Italics and bold: 4-quote opening sequence: (4,4)
692 !! options
693 parsoid=wt2html
694 !! wikitext
695 ''''foo''''
696 !! html/*
697 <p>'<b>foo'</b>
698 </p>
699 !!end
702 # same html as previous, but wikitext adjusted to match parsoid html2wt
703 !! test
704 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
705 !! wikitext
706 ''''<nowiki>foo'</nowiki>'''
707 !! html
708 <p>'<b>foo'</b>
709 </p>
710 !! end
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 4-quote opening sequence: (4,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 ''''foo'''''
720 !! html/php
721 <p>'<b>foo</b>
722 </p>
723 !! html/parsoid
724 <p>'<b>foo</b><i></i>
725 </p>
726 !!end
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
731 !! wikitext
732 ''''foo'''''<nowiki/>''
733 !! html/php
734 <p>'<b>foo</b>
735 </p>
736 !! html/parsoid
737 <p>'<b>foo</b><i></i>
738 </p>
739 !! end
743 ### 5-quote opening sequence tests
746 !! test
747 Italics and bold: 5-quote opening sequence: (5,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''''foo''
752 !! html/*
753 <p><b><i>foo</i></b>
754 </p>
755 !!end
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 # skipping wt2html and html2html because it wants to put <i> before <b>
760 !! test
761 Italics and bold: 5-quote opening sequence: (5,2+3)
762 !! options
763 parsoid=wt2wt,html2wt
764 !! wikitext
765 '''''foo'''''
766 !! html/*
767 <p><b><i>foo</i></b>
768 </p>
769 !! end
771 !! test
772 Italics and bold: 5-quote opening sequence: (5,3)
773 !! options
774 parsoid=wt2html
775 !! wikitext
776 '''''foo'''
777 !! html/*
778 <p><i><b>foo</b></i>
779 </p>
780 !!end
783 # same html as previous, but wikitext adjusted to match parsoid html2wt
784 !! test
785 Italics and bold: 5-quote opening sequence: (5,3+2)
786 !! wikitext
787 '''''foo'''''
788 !! html
789 <p><i><b>foo</b></i>
790 </p>
791 !! end
794 !! test
795 Italics and bold: 5-quote opening sequence: (5,4)
796 !! options
797 parsoid=wt2html
798 !! wikitext
799 '''''foo''''
800 !! html/*
801 <p><i><b>foo'</b></i>
802 </p>
803 !!end
806 # same html as previous, but wikitext adjusted to match parsoid html2wt
807 !! test
808 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
809 !! wikitext
810 '''''<nowiki>foo'</nowiki>'''''
811 !! html
812 <p><i><b>foo'</b></i>
813 </p>
814 !! end
817 !! test
818 Italics and bold: 5-quote opening sequence: (5,5)
819 !! wikitext
820 '''''foo'''''
821 !! html
822 <p><i><b>foo</b></i>
823 </p>
824 !!end
827 ### multiple quote sequences in a line
829 !! test
830 Italics and bold: multiple quote sequences: (2,4,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 ''foo''''bar''
835 !! html/*
836 <p><i>foo'<b>bar</b></i>
837 </p>
838 !!end
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
844 !! wikitext
845 ''<nowiki>foo'</nowiki>'''bar'''''
846 !! html
847 <p><i>foo'<b>bar</b></i>
848 </p>
849 !! end
852 !! test
853 Italics and bold: multiple quote sequences: (2,4,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 ''foo''''bar'''
858 !! html/*
859 <p><i>foo'<b>bar</b></i>
860 </p>
861 !!end
864 # same html as previous, but wikitext adjusted to match parsoid html2wt
865 !! test
866 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
867 !! wikitext
868 ''<nowiki>foo'</nowiki>'''bar'''''
869 !! html
870 <p><i>foo'<b>bar</b></i>
871 </p>
872 !! end
875 !! test
876 Italics and bold: multiple quote sequences: (2,4,4)
877 !! options
878 parsoid=wt2html
879 !! wikitext
880 ''foo''''bar''''
881 !! html/*
882 <p><i>foo'<b>bar'</b></i>
883 </p>
884 !!end
887 # same html as previous, but wikitext adjusted to match parsoid html2wt
888 !! test
889 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
890 !! wikitext
891 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
892 !! html
893 <p><i>foo'<b>bar'</b></i>
894 </p>
895 !! end
898 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
899 !! test
900 Italics and bold: multiple quote sequences: (3,4,2)
901 !! options
902 parsoid=wt2html
903 !! wikitext
904 '''foo''''bar''
905 !! html/php
906 <p><b>foo'</b>bar
907 </p>
908 !! html/parsoid
909 <p><b>foo'</b>bar<i></i>
910 </p>
911 !!end
913 # same html as previous, but wikitext adjusted to match parsoid html2wt
914 !! test
915 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
916 !! options
917 parsoid
918 !! wikitext
919 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
920 !! html/php
921 <p><b>foo'</b>bar
922 </p>
923 !! html/parsoid
924 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
925 </p>
926 !! end
929 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
930 !! test
931 Italics and bold: multiple quote sequences: (3,4,3)
932 !! options
933 parsoid=wt2html
934 !! wikitext
935 '''foo''''bar'''
936 !! html/php
937 <p><b>foo'</b>bar
938 </p>
939 !! html/parsoid
940 <p><b>foo'</b>bar<b></b>
941 </p>
942 !!end
944 # same html as previous, but wikitext adjusted to match parsoid html2wt
945 !! test
946 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
947 !! wikitext
948 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
949 !! html/php
950 <p><b>foo'</b>bar
951 </p>
952 !! html/parsoid
953 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
954 </p>
955 !! end
958 ### other quote tests
960 !! test
961 Italics and bold: other quote tests: (2,3,5)
962 !! wikitext
963 ''this is about '''foo's family'''''
964 !! html
965 <p><i>this is about <b>foo's family</b></i>
966 </p>
967 !!end
970 !! test
971 Italics and bold: other quote tests: (2,(3,3),2)
972 !! wikitext
973 ''this is about '''foo's''' family''
974 !! html
975 <p><i>this is about <b>foo's</b> family</i>
976 </p>
977 !!end
980 !! test
981 Italics and bold: other quote tests: (3,2,3,2)
982 !! options
983 parsoid=wt2html
984 !! wikitext
985 '''this is about ''foo'''s family''
986 !! html/*
987 <p><b>this is about <i>foo</i></b><i>s family</i>
988 </p>
989 !!end
992 # same html as previous, but wikitext adjusted to match parsoid html2wt
993 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
994 !! test
995 Italics and bold: other quote tests: (3,2,3+2+2,2)
996 !! options
997 parsoid
998 !! wikitext
999 '''this is about ''foo'''''<nowiki/>''s family''
1000 !! html/*
1001 <p><b>this is about <i>foo</i></b><i>s family</i>
1002 </p>
1003 !! end
1006 !! test
1007 Italics and bold: other quote tests: (3,2,3,3)
1008 !! options
1009 !! wikitext
1010 '''this is about ''foo'''s family'''
1011 !! html
1012 <p>'<i>this is about </i>foo<b>s family</b>
1013 </p>
1014 !!end
1017 !! test
1018 Italics and bold: other quote tests: (3,(2,2),3)
1019 !! wikitext
1020 '''this is about ''foo's'' family'''
1021 !! html
1022 <p><b>this is about <i>foo's</i> family</b>
1023 </p>
1024 !!end
1027 !! test
1028 Italicized possessive
1029 !! wikitext
1030 The ''[[Main Page]]'''s talk page.
1031 !! html
1032 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1033 </p>
1034 !! end
1036 !! test
1037 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1038 (Requires tidy for PHP parser output to be fixed up)
1039 !! options
1040 parsoid=wt2html,wt2wt
1041 !! wikitext
1043 !''a!!''b
1044 |''a||''b
1046 !! html
1047 <table>
1048 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1049 <td><i>a</i></td><td><i>b</i></td></tr>
1050 </tbody></table>
1051 !! end
1054 ### Non-html5 tags
1057 !! test
1058 Non-html5 tags should be accepted
1059 !! wikitext
1060 <center>''foo''</center>
1061 <big>''foo''</big>
1062 <font>''foo''</font>
1063 <strike>''foo''</strike>
1064 <tt>''foo''</tt>
1065 !! html
1066 <center><i>foo</i></center>
1067 <p><big><i>foo</i></big>
1068 <font><i>foo</i></font>
1069 <strike><i>foo</i></strike>
1070 <tt><i>foo</i></tt>
1071 </p>
1072 !! end
1074 !! test
1075 <wbr> is valid wikitext (bug 52468)
1076 !! wikitext
1077 <wbr>
1078 !! html
1079 <p><wbr />
1080 </p>
1081 !! end
1083 # <strike> is HTML4, <s> is HTML4/5.
1084 !! test
1085 <s> or <strike> for strikethrough
1086 !! wikitext
1087 <strike>strike</strike>
1089 <s>s</s>
1090 !! html
1091 <p><strike>strike</strike>
1092 </p><p><s>s</s>
1093 </p>
1094 !! end
1096 !! test
1097 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1098 !! wikitext
1099 <b→> doesn't work! </b→>
1101 <bä> doesn't work! </bä>
1103 <boo> works fine </boo>
1105 <s.foo>s.foo</s.foo>
1107 <sub-ID#1>
1108 !! html
1109 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1110 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1111 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1112 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1113 </p><p>&lt;sub-ID#1&gt;
1114 </p>
1115 !! end
1117 !! test
1118 Isolated close tags should be treated as literal text (bug 52760)
1119 !! wikitext
1120 </b>
1122 <s.foo>s</s>
1123 !! html
1124 <p>&lt;/b&gt;
1125 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1126 </p>
1127 !! end
1130 ### Special characters
1133 !! test
1134 Bare pipe character (bug 52363)
1135 !! wikitext
1137 !! html
1138 <p>|
1139 </p>
1140 !! end
1142 !! test
1143 Bare pipe character from a template (bug 52363)
1144 !! wikitext
1145 {{pipe}}
1146 !! html
1147 <p>|
1148 </p>
1149 !! end
1152 ### <nowiki> test cases
1155 !! test
1156 <nowiki> unordered list
1157 !! wikitext
1158 <nowiki>* This is not an unordered list item.</nowiki>
1159 !! html
1160 <p>* This is not an unordered list item.
1161 </p>
1162 !! end
1164 !! test
1165 <nowiki> spacing
1166 !! wikitext
1167 <nowiki>Lorem ipsum dolor
1169 sed abit.
1170   sed nullum.
1172 :and a colon
1173 </nowiki>
1174 !! html
1175 <p>Lorem ipsum dolor
1177 sed abit.
1178   sed nullum.
1180 :and a colon
1182 </p>
1183 !! end
1185 !! test
1186 nowiki 3
1187 !! wikitext
1188 :There is not nowiki.
1189 :There is <nowiki>nowiki</nowiki>.
1191 #There is not nowiki.
1192 #There is <nowiki>nowiki</nowiki>.
1194 *There is not nowiki.
1195 *There is <nowiki>nowiki</nowiki>.
1196 !! html
1197 <dl><dd>There is not nowiki.</dd>
1198 <dd>There is nowiki.</dd></dl>
1199 <ol><li>There is not nowiki.</li>
1200 <li>There is nowiki.</li></ol>
1201 <ul><li>There is not nowiki.</li>
1202 <li>There is nowiki.</li></ul>
1204 !! end
1206 !! test
1207 Entities inside <nowiki>
1208 !! wikitext
1209 <nowiki>&lt;</nowiki>
1210 !! html
1211 <p>&lt;
1212 </p>
1213 !! end
1215 !! test
1216 Entities inside template parameters
1217 !! options
1218 parsoid
1219 !! wikitext
1220 {{echo|&ndash;}}
1221 !! html
1222 <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>
1223 </p>
1224 !! end
1227 ### Comments
1229 !! test
1230 Comments and Indent-Pre
1231 !! wikitext
1232 <!-- comment 1 --> asdf
1234 <!-- comment 1 --> asdf
1235 <!-- comment 2 -->
1237 <!-- comment 1 --> asdf
1238 <!-- comment 2 -->xyz
1240 <!-- comment 1 --> asdf
1241 <!-- comment 2 --> xyz
1242 !! html
1243 <pre>asdf
1244 </pre>
1245 <pre>asdf
1246 </pre>
1247 <pre>asdf
1248 </pre>
1249 <p>xyz
1250 </p>
1251 <pre>asdf
1253 </pre>
1254 !! end
1256 !! test
1257 Comment test 2a
1258 !! wikitext
1259 asdf
1260 <!-- comment 1 -->
1262 !! html
1263 <p>asdf
1265 </p>
1266 !! end
1268 !! test
1269 Comment test 2b
1270 !! wikitext
1271 asdf
1272 <!-- comment 1 -->
1275 !! html
1276 <p>asdf
1277 </p><p>jkl
1278 </p>
1279 !! end
1281 !! test
1282 Comment test 3
1283 !! wikitext
1284 asdf
1285 <!-- comment 1 -->
1286 <!-- comment 2 -->
1288 !! html
1289 <p>asdf
1291 </p>
1292 !! end
1294 !! test
1295 Comment test 4
1296 !! wikitext
1297 asdf<!-- comment 1 -->jkl
1298 !! html
1299 <p>asdfjkl
1300 </p>
1301 !! end
1303 !! test
1304 Comment spacing
1305 !! wikitext
1307  <!-- foo --> b <!-- bar -->
1309 !! html
1310 <p>a
1311 </p>
1312 <pre> b 
1313 </pre>
1314 <p>c
1315 </p>
1316 !! end
1318 !! test
1319 Comment whitespace
1320 !! wikitext
1321 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1322 !! html
1324 !! end
1326 !! test
1327 Comment semantics and delimiters
1328 !! wikitext
1329 <!-- --><!----><!-----><!------>
1330 !! html
1332 !! end
1334 !! test
1335 Comment semantics and delimiters, redux
1336 !! wikitext
1337 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1338 -- foo -- funky huh? ... -->
1339 !! html
1341 !! end
1343 !! test
1344 Comment semantics and delimiters: directors cut
1345 !! wikitext
1346 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1347 everything starting with < followed by !-- until the first -- and > we see,
1348 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1349 -->-->
1350 !! html
1351 <p>--&gt;
1352 </p>
1353 !! end
1355 !! test
1356 Comment semantics: nesting
1357 !! wikitext
1358 <!--<!-- no, we're not going to do anything fancy here -->-->
1359 !! html
1360 <p>--&gt;
1361 </p>
1362 !! end
1364 !! test
1365 Comment semantics: unclosed comment at end
1366 !! wikitext
1367 <!--This comment will run out to the end of the document
1368 !! html
1370 !! end
1372 !! test
1373 Comment in template title
1374 !! wikitext
1375 {{f<!---->oo}}
1376 !! html
1377 <p>FOO
1378 </p>
1379 !! end
1381 !! test
1382 Comment on its own line post-expand
1383 !! wikitext
1385 {{blank}}<!---->
1387 !! html
1388 <p>a
1389 </p><p>b
1390 </p>
1391 !! end
1393 !! test
1394 Comment on its own line post-expand with non-significant whitespace
1395 !! wikitext
1397  {{blank}} <!----> 
1399 !! html
1400 <p>a
1401 </p><p>b
1402 </p>
1403 !! end
1405 !! test
1406 Multiple comments should still parse as SOL-transparent
1407 !! options
1408 parsoid=wt2html,wt2wt
1409 !! wikitext
1410 <!--c1-->*a
1411 <!--c2--><!--c3--><!--c4-->*b
1412 !! html
1413 <ul>
1414 <li>a
1415 </li>
1416 <li>b
1417 </li>
1418 </ul>
1419 !! end
1422 ### paragraph wrapping tests
1424 !! test
1425 No block tags
1426 !! wikitext
1430 !! html
1431 <p>a
1432 </p><p>b
1433 </p>
1434 !! end
1436 !! test
1437 Block tag on one line (<div>)
1438 !! wikitext
1439 a <div>foo</div>
1442 !! html
1443 a <div>foo</div>
1444 <p>b
1445 </p>
1446 !! end
1448 !! test
1449 Block tag on one line (<blockquote>)
1450 !! wikitext
1451 a <blockquote>foo</blockquote>
1454 !! html
1455 a <blockquote>foo</blockquote>
1456 <p>b
1457 </p>
1458 !! end
1460 !! test
1461 Block tag on both lines (<div>)
1462 !! wikitext
1463 a <div>foo</div>
1465 b <div>foo</div>
1466 !! html
1467 a <div>foo</div>
1468 b <div>foo</div>
1470 !! end
1472 !! test
1473 Block tag on both lines (<blockquote>)
1474 !! wikitext
1475 a <blockquote>foo</blockquote>
1477 b <blockquote>foo</blockquote>
1478 !! html
1479 a <blockquote>foo</blockquote>
1480 b <blockquote>foo</blockquote>
1482 !! end
1484 !! test
1485 Multiple lines without block tags
1486 !! wikitext
1487 <div>foo</div> a
1490 d<!--foo--> e
1491 x <div>foo</div> z
1492 !! html
1493 <div>foo</div> a
1494 <p>b
1496 d e
1497 </p>
1498 x <div>foo</div> z
1500 !! end
1502 !! test
1503 Empty lines between lines with block tags
1504 !! wikitext
1505 <div></div>
1508 <div></div>a
1511 <div>a</div>b
1513 <div>b</div>d
1516 <div>e</div>
1517 !! html
1518 <div></div>
1519 <p><br />
1520 </p>
1521 <div></div>a
1522 <p>b
1523 </p>
1524 <div>a</div>b
1525 <div>b</div>d
1526 <p><br />
1527 </p>
1528 <div>e</div>
1530 !! end
1532 ## PHP parser emits output which is broken
1533 !! test
1534 Unclosed HTML p-tags should be handled properly
1535 !! wikitext
1536 <div><p>foo</div>
1540 !! html/parsoid
1541 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1542 <p>a</p>
1543 <p>b</p>
1544 !! end
1547 ### Preformatted text
1549 !! test
1550 Preformatted text
1551 !! wikitext
1552  This is some
1553  Preformatted text
1554  With ''italic''
1555  And '''bold'''
1556  And a [[Main Page|link]]
1557 !! html
1558 <pre>This is some
1559 Preformatted text
1560 With <i>italic</i>
1561 And <b>bold</b>
1562 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1563 </pre>
1564 !! end
1566 !! test
1567 Tabs don't trigger preformatted text
1568 !! wikitext
1569         This is not
1570          preformatted text.
1571  This is preformatted text.
1572         So is this.
1573 !! html
1574 <p>     This is not
1575          preformatted text.
1576 </p>
1577 <pre>This is preformatted text.
1578         So is this.
1579 </pre>
1580 !! end
1582 !! test
1583 Ident preformatting with inline content
1584 !! wikitext
1586  ''b''
1587 !! html
1588 <pre>a
1589 <i>b</i>
1590 </pre>
1591 !! end
1593 !! test
1594 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1595 !! wikitext
1596 <pre><nowiki>
1598 <cite>
1599 <em>
1600 </nowiki></pre>
1601 !! html
1602 <pre>
1603 &lt;b&gt;
1604 &lt;cite&gt;
1605 &lt;em&gt;
1606 </pre>
1608 !! end
1610 !! test
1611 Regression with preformatted in <center>
1612 !! wikitext
1613 <center>
1614  Blah
1615 </center>
1616 !! html
1617 <center>
1618 <pre>Blah
1619 </pre>
1620 </center>
1622 !! end
1624 !! test
1625 Bug 52763: Preformatted in <blockquote>
1626 !! wikitext
1627 <blockquote>
1628  Blah
1631  indented cell (no pre-wrapping!)
1633 </blockquote>
1634 !! html
1635 <blockquote>
1636 <p> Blah
1637 </p>
1638 <table>
1639 <tr>
1640 <td>
1641 <p> indented cell (no pre-wrapping!)
1642 </p>
1643 </td></tr></table>
1644 </blockquote>
1646 !! end
1648 !! test
1649 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1650 !! wikitext
1651 <blockquote>
1655 </blockquote>
1656 !! html
1657 <blockquote>
1658 <p>Foo
1659 </p><p>Bar
1660 </p>
1661 </blockquote>
1663 !! end
1665 !! test
1666 Bug 15491: <ins>/<del> in blockquote
1667 !! wikitext
1668 <blockquote>
1669 Foo <del>bar</del> <ins>baz</ins> quux
1670 </blockquote>
1671 !! html
1672 <blockquote>
1673 <p>Foo <del>bar</del> <ins>baz</ins> quux
1674 </p>
1675 </blockquote>
1677 !! end
1679 # Note that the p-wrapping is newline sensitive, which could be
1680 # considered a bug: tidy will wrap only the 'Foo' in the example
1681 # below in a <p> tag. (see comment 23-25 of bug #6200)
1682 !! test
1683 Bug 15491: <ins>/<del> in blockquote (2)
1684 !! wikitext
1685 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1686 </blockquote>
1687 !! html
1688 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1689 </blockquote>
1691 !! end
1693 !! test
1694 <pre> with attributes (bug 3202)
1695 !! wikitext
1696 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1697 !! html
1698 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1700 !! end
1702 !! test
1703 <pre> with width attribute (bug 3202)
1704 !! wikitext
1705 <pre width="8">Narrow screen goodies</pre>
1706 !! html
1707 <pre width="8">Narrow screen goodies</pre>
1709 !! end
1711 !! test
1712 <pre> with forbidden attribute (bug 3202)
1713 !! wikitext
1714 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1715 !! html
1716 <pre width="8">Narrow screen goodies</pre>
1718 !! end
1720 !! test
1721 Entities inside <pre>
1722 !! wikitext
1723 <pre>&lt;</pre>
1724 !! html
1725 <pre>&lt;</pre>
1727 !! end
1729 !! test
1730 <pre> with forbidden attribute values (bug 3202)
1731 !! wikitext
1732 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1733 !! html
1734 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1736 !! end
1738 !! test
1739 <nowiki> inside <pre> (bug 13238)
1740 !! wikitext
1741 <pre>
1742 <nowiki>
1743 </pre>
1744 <pre>
1745 <nowiki></nowiki>
1746 </pre>
1747 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1748 !! html
1749 <pre>
1750 &lt;nowiki&gt;
1751 </pre>
1752 <pre>
1754 </pre>
1755 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1757 !! end
1759 !! test
1760 <nowiki> and <pre> preference (first one wins)
1761 !! wikitext
1762 <pre>
1763 <nowiki>
1764 </pre>
1765 </nowiki>
1766 </pre>
1768 <nowiki>
1769 <pre>
1770 <nowiki>
1771 </pre>
1772 </nowiki>
1773 </pre>
1775 !! html
1776 <pre>
1777 &lt;nowiki&gt;
1778 </pre>
1779 <p>&lt;/nowiki&gt;
1780 &lt;/pre&gt;
1781 </p><p>
1782 &lt;pre&gt;
1783 &lt;nowiki&gt;
1784 &lt;/pre&gt;
1786 &lt;/pre&gt;
1787 </p>
1788 !! end
1790 !! test
1791 </pre> inside nowiki
1792 !! wikitext
1793 <nowiki></pre></nowiki>
1794 !! html
1795 <p>&lt;/pre&gt;
1796 </p>
1797 !! end
1799 !! test
1800 Empty pre; pre inside other HTML tags (bug 54946)
1801 !! wikitext
1804 <div><pre>
1806 </pre></div>
1807 <pre></pre>
1808 !! html
1809 <p>a
1810 </p>
1811 <div><pre>
1813 </pre></div>
1814 <pre></pre>
1816 !! end
1818 !! test
1819 HTML pre followed by indent-pre
1820 !! wikitext
1821 <pre>foo</pre>
1822  bar
1823 !! html
1824 <pre>foo</pre>
1825 <pre>bar
1826 </pre>
1827 !! end
1829 !!test
1830 Block tag pre
1831 !!options
1832 parsoid
1833 !! wikitext
1834 <p><pre>foo</pre></p>
1835 !! html
1836 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1837 !!end
1839 !!test
1840 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1841 !! wikitext
1842  {{echo|}}
1843 !! html
1845 !!end
1847 !!test
1848 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1849 !! wikitext
1850  {{echo|
1851 foo}}
1852 !! html
1853 <p>foo
1854 </p>
1855 !!end
1857 !! test
1858 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1859 !! wikitext
1860  {{echo|a
1862 !! html
1863 <pre>a
1864 </pre>
1865 <p>b
1866 </p>
1867 !!end
1869 !! test
1870 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1871 !! wikitext
1872  {{echo|a
1878 !! html
1879 <pre>a
1880 </pre>
1881 <p>b
1883 </p>
1884 <pre>d
1885 </pre>
1886 <p>e
1887 </p>
1888 !!end
1890 !!test
1891 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1892 !! wikitext
1893 {{echo| foo}}
1895 {{echo| foo}}{{echo| bar}}
1897 {{echo| foo}}
1898 {{echo| bar}}
1900 {{echo|<!--cmt--> foo}}
1902 <!--cmt-->{{echo| foo}}
1904 {{echo|{{echo| }}bar}}
1905 !! html
1906 <pre>foo
1907 </pre>
1908 <pre>foo bar
1909 </pre>
1910 <pre>foo
1912 </pre>
1913 <pre>foo
1914 </pre>
1915 <pre>foo
1916 </pre>
1917 <pre>bar
1918 </pre>
1919 !!end
1921 !! test
1922 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1923 !! wikitext
1924 {{echo| }}a
1926 {{echo|
1927  }}a
1929 {{echo|
1930  b}}
1932 {{echo|a
1933  }}b
1935 {{echo|a
1936 }} b
1937 !! html
1938 <pre>a
1939 </pre>
1940 <p><br />
1941 </p>
1942 <pre>a
1943 </pre>
1944 <p><br />
1945 </p>
1946 <pre>b
1947 </pre>
1948 <p>a
1949 </p>
1950 <pre>b
1951 </pre>
1952 <p>a
1953 </p>
1954 <pre>b
1955 </pre>
1956 !!end
1958 !! test
1959 Things that look like <pre> tags aren't treated as such
1960 !! wikitext
1961 Barack Obama <President> of the United States
1962 !! html
1963 <p>Barack Obama &lt;President&gt; of the United States
1964 </p>
1965 !! end
1967 !! test
1968 Parsoid: handle pre with space after attribute
1969 !! options
1970 parsoid=wt2html
1971 !! wikitext
1972 <pre style="width:50%;" >{{echo|foo}}</pre>
1973 !! html
1974 <pre style="width:50%;">{{echo|foo}}</pre>
1975 !! end
1977 # TODO / maybe: fix wt2wt for this
1978 !! test
1979 Parsoid: Don't paragraph-wrap fosterable content
1980 !! options
1981 parsoid=wt2html
1982 !! wikitext
1984 <td></td>
1985 <td></td>
1990 !! html
1991 <table>
1993 <tbody>
1994 <tr>
1995 <td></td>
1997 <td></td></tr>
2001 </tbody></table>
2002 !! end
2004 !! test
2005 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2006 !! options
2007 parsoid=wt2html
2008 !! wikitext
2010 <td>
2011 <td>
2012 </td>
2017 !! html
2018 <table>
2020 <tbody>
2021 <tr>
2022 <td></td>
2024 <td>
2025 </td></tr>
2029 </tbody></table>
2030 !! end
2033 #--------------------------------------------------------------------
2034 # Transclusion parameter whitespace stripping tests
2035 # Behavior is different for positional and named parameters
2036 #--------------------------------------------------------------------
2037 !! test
2038 Templates: Strip leading and trailing whitespace from named-param values
2039 !! wikitext
2040 {{echo|1= a }}
2042 {{echo|1= {{echo|b}} }}
2044 {{echo| 1 =
2045  c }}
2047 {{echo| 1 =
2048 * d
2050 !! html
2051 <p>a
2052 </p><p>b
2053 </p><p>c
2054 </p>
2055 <ul><li> d</li></ul>
2057 !! end
2059 !! test
2060 Templates: Don't strip whitespace from positional-param values
2061 !! wikitext
2062 {{echo|a }}
2064 {{echo|{{echo|b}} }}
2066 {{echo| c 
2069 {{echo| {{echo|d}}
2072 {{echo|
2073  e}}
2075 {{echo|
2076 * f}}
2078 {{echo|
2079  }}g
2080 !! html
2081 <p>a 
2082 </p><p>b 
2083 </p>
2084 <pre>c 
2085 </pre>
2086 <p><br />
2087 </p>
2088 <pre>d
2089 </pre>
2090 <p><br />
2091 </p>
2092 <pre>e
2093 </pre>
2094 <p><br />
2095 </p>
2096 <ul><li> f</li></ul>
2097 <p><br />
2098 </p>
2099 <pre>g
2100 </pre>
2101 !! end
2103 !! test
2104 Templates: Handle empty comment-and-ws-only lines correctly
2105 !! wikitext
2106 {{echo|foo
2107 <!--should be ignored-->
2108  <!--should be ignored as well-->
2109 bar}}
2110 !! html
2111 <p>foo
2113 </p>
2114 !! end
2116 !! test
2117 Templates: Handle comments in the target
2118 !! wikitext
2119 {{echo
2120 <!-- should be ignored -->
2121 |foo}}
2123 {{echo<!-- should be ignored -->
2124 |foo}}
2126 {{echo<!-- should be ignored -->|foo}}
2128 {{<!-- should be ignored -->echo|foo}}
2129 !!html/parsoid
2130 <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>
2132 <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>
2134 <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>
2136 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2137 !!end
2139 #--------------------------------------------------------------------
2140 # Transclusion parameter escaping tests
2141 #--------------------------------------------------------------------
2142 !! test
2143 Templates: Parsoid parameter escaping test 1
2144 !! options
2145 parsoid
2146 !! wikitext
2147 {{echo|[foo]|{{echo|[bar]}}}}
2148 !! html
2149 <p about="#mwt1" typeof="mw:Transclusion"
2150 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2151 !! end
2153 !! test
2154 Parsoid: Pipes in external links in template parameter
2155 !! options
2156 parsoid
2157 !! wikitext
2158 {{echo|[{{echo|http://example.com}} link]}}
2159 !! html
2160 <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>
2161 !! end
2163 !! test
2164 Parsoid: pipe in transclusion parameter
2165 !! options
2166 parsoid
2167 !! wikitext
2168 {{echo|http://foo.com/a&#124;b}}
2169 !! html
2170 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2171 typeof="mw:Transclusion"
2172 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>
2173 !! end
2175 !! test
2176 Parsoid: Pipe in external link target and content in template parameter
2177 !! options
2178 parsoid=html2wt,wt2wt
2179 !! wikitext
2180 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2181 !! html
2182 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2183 typeof="mw:Transclusion"
2184 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2185 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2186 !! end
2188 !! test
2189 Templates: Don't escape already nowiki-escaped text in template parameters
2190 !! options
2191 parsoid=html2wt,wt2wt
2192 !! wikitext
2193 {{echo|foo<nowiki>|</nowiki>bar}}
2194 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2195 {{echo|<nowiki></nowiki>}}
2196 !! html
2197 <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>
2198 <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>
2199 <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>
2200 </p>
2201 !! end
2203 ## Bug 52824
2204 !! test
2205 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2206 !! options
2207 parsoid=html2wt,wt2wt
2208 !! wikitext
2209 {{echo|{{echo|1=bar}}}}
2210 !! html
2211 <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>
2212 !! end
2214 ## Bug 56733
2215 !! test
2216 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2217 !! options
2218 parsoid
2219 !! wikitext
2220 {{echo|a : b}}
2221 !! html
2222 <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>
2223 !! end
2226 ### Parsoid-centric tests for testing RT edge cases for pre
2229 !!test
2230 1a. Indent-Pre and Comments
2231 !! wikitext
2233 <!--a-->
2235 !! html
2236 <pre>a
2237 </pre>
2238 <p>c
2239 </p>
2240 !!end
2242 !!test
2243 1b. Indent-Pre and Comments
2244 !! wikitext
2246  <!--a-->
2248 !! html
2249 <pre>a
2250 </pre>
2251 <p>c
2252 </p>
2253 !!end
2255 !!test
2256 1c. Indent-Pre and Comments
2257 !! wikitext
2258 <!--a-->  a
2260  <!--a--> a
2261 !! html
2262 <pre> a
2263 </pre>
2264 <pre> a
2265 </pre>
2266 !!end
2268 !!test
2269 1d. Indent-Pre and Comments
2270 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2271 !! wikitext
2272 <!--a--> a
2274  <!--b-->b
2275 !! html
2276 <pre>a
2277 </pre>
2278 <pre>b
2279 </pre>
2280 !!end
2282 !!test
2283 2a. Indent-Pre and tables
2284 !! wikitext
2285  {|
2286  |-
2287  !h1!!h2
2288  |foo||bar
2289  |}
2290 !! html
2291 <table>
2293 <tr>
2294 <th>h1</th>
2295 <th>h2
2296 </th>
2297 <td>foo</td>
2298 <td>bar
2299 </td></tr></table>
2301 !!end
2303 !!test
2304 2b. Indent-Pre and tables
2305 !! wikitext
2306   {|
2307  |-
2308 |foo
2310 !! html
2311 <table>
2313 <tr>
2314 <td>foo
2315 </td></tr></table>
2317 !!end
2319 !!test
2320 2c. Indent-Pre and tables (bug 42252)
2321 !! wikitext
2323  |+ foo
2324  !  | bar
2326 !! html
2327 <table>
2328 <caption> foo
2329 </caption>
2330 <tr>
2331 <th> bar
2332 </th></tr></table>
2334 !!end
2336 !!test
2337 3a. Indent-Pre and block tags (single-line html)
2338 !! wikitext
2339  a <p> foo </p>
2340  b <div> foo </div>
2341  c <blockquote> foo </blockquote>
2342  <span> foo </span>
2343 !! html
2344  a <p> foo </p>
2345  b <div> foo </div>
2346  c <blockquote> foo </blockquote>
2347 <pre><span> foo </span>
2348 </pre>
2349 !!end
2351 !!test
2352 3b. Indent-Pre and block tags (multi-line html)
2353 !! wikitext
2354  a <span>foo</span>
2355  b <div> foo </div>
2356 !! html
2357 <pre>a <span>foo</span>
2358 </pre>
2359  b <div> foo </div>
2361 !!end
2363 !!test
2364 3c. Indent-Pre and block tags (pre-content on separate line)
2365 !! wikitext
2367  foo
2368 </p>
2370 <div>
2371  foo
2372 </div>
2374 <center>
2375  foo
2376 </center>
2378 <blockquote>
2379  foo
2380 </blockquote>
2382 <blockquote>
2383 <pre>
2385 </pre>
2386 </blockquote>
2388 <table><tr><td>
2389  foo
2390 </td></tr></table>
2392 <ul><li>
2393   foo
2394 </li></ul>
2396 !! html
2398  foo
2399 </p>
2400 <div>
2401 <pre>foo
2402 </pre>
2403 </div>
2404 <center>
2405 <pre>foo
2406 </pre>
2407 </center>
2408 <blockquote>
2409 <p> foo
2410 </p>
2411 </blockquote>
2412 <blockquote>
2413 <pre>
2415 </pre>
2416 </blockquote>
2417 <table><tr><td>
2418 <pre>foo
2419 </pre>
2420 </td></tr></table>
2421 <ul><li>
2422   foo
2423 </li></ul>
2425 !!end
2427 !!test
2428 4. Indent-Pre and extension tags
2429 !! wikitext
2430  a <gallery>
2431 File:foobar.jpg
2432 </gallery>
2433 !! html
2434  a <ul class="gallery mw-gallery-traditional">
2435                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2436                         <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>
2437                         <div class="gallerytext">
2438                         </div>
2439                 </div></li>
2440 </ul>
2442 !!end
2444 !! test
2445 Leading pipes outside of tables
2446 !! options
2447 parsoid
2448 !! wikitext
2449 | foo
2450 !! html
2451 <p>| foo</p>
2452 !! end
2454 !! test
2455 Leading pipes outside of tables 2
2456 !! options
2457 parsoid
2458 !! wikitext
2460 | foo
2462 !! html
2463 <p>a
2464 | foo
2465 b</p>
2466 !! end
2468 !! test
2469 Leading pipes outside of tables 3
2470 !! options
2471 parsoid
2472 !! wikitext
2474 | class="foo bar" | baz
2476 !! html
2477 <p>a
2478 | class="foo bar" | baz
2479 b</p>
2480 !! end
2482 !!test
2483 Render paragraphs when indent-pre is suppressed in blocklevels
2484 !! wikitext
2485 <blockquote>
2486  foo
2488  bar
2489 </blockquote>
2490 !! html
2491 <blockquote>
2492 <p> foo
2493 </p><p> bar
2494 </p>
2495 </blockquote>
2497 !!end
2499 !!test
2500 4. Multiple spaces at start-of-line
2501 !! wikitext
2502     <p> foo </p>
2503     foo
2504         {|
2505 |foo
2507 !! html
2508     <p> foo </p>
2509 <pre>   foo
2510 </pre>
2511 <table>
2512 <tr>
2513 <td>foo
2514 </td></tr></table>
2516 !!end
2518 ## NOTE: the leading white-space chars on empty line are significant
2519 !! test
2520 5a. White-space in indent-pre
2521 !! wikitext
2522  a<br />
2525 !! html
2526 <pre>a<br />
2529 </pre>
2530 !! end
2532 ## NOTE: the leading white-space chars on empty line are significant
2533 !! test
2534 5b. White-space in indent-pre
2535 !! wikitext
2542 !! html
2543 <pre>a
2549 </pre>
2550 !! end
2552 !! test
2553 5c. White-space in indent-pre
2554 !! wikitext
2555  ''a''
2556   ''b''
2557    ''c''
2558 !! html
2559 <pre><i>a</i>
2560  <i>b</i>
2561   <i>c</i>
2562 </pre>
2563 !! end
2565 !! test
2566 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2567 !! wikitext
2570  <!-- continue -->
2576 !! html
2577 <pre>a
2580 </pre>
2581 <pre>c
2583 </pre>
2584 <p>d
2585 </p>
2586 !! end
2588 !! test
2589 7a. Indent-pre and category links
2590 !! options
2591 parsoid=wt2html,wt2wt
2592 !! wikitext
2593  [[Category:foo]] <!-- No pre-wrapping -->
2594 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2595 !! html
2596  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2597 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2598 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2599 !! end
2601 !! test
2602 7b. Indent-pre and category links
2603 !! options
2604 parsoid=wt2html,wt2wt
2605 !! wikitext
2606  [[Category:foo]] a
2607  [[Category:foo]] {{echo|b}}
2608 !! html
2609 <pre>
2610 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2612 <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>
2613 !! end
2616 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2619 !!test
2620 HTML-pre: 1. embedded newlines
2621 !! wikitext
2622 <pre>foo</pre>
2624 <pre>
2626 </pre>
2628 <pre>
2631 </pre>
2633 <pre>
2637 </pre>
2638 !! html
2639 <pre>foo</pre>
2640 <pre>
2642 </pre>
2643 <pre>
2646 </pre>
2647 <pre>
2651 </pre>
2653 !!end
2655 !!test
2656 HTML-pre: 2: indented text
2657 !! wikitext
2658 <pre>
2659  foo
2660 </pre>
2661 !! html
2662 <pre>
2663  foo
2664 </pre>
2666 !!end
2668 !!test
2669 HTML-pre: 3: other wikitext
2670 !! wikitext
2671 <pre>
2672 * foo
2673 # bar
2674 = no-h =
2675 '' no-italic ''
2676 [[ NoLink ]]
2677 </pre>
2678 !! html
2679 <pre>
2680 * foo
2681 # bar
2682 = no-h =
2683 '' no-italic ''
2684 [[ NoLink ]]
2685 </pre>
2687 !!end
2690 ### Definition lists
2692 !! test
2693 Simple definition
2694 !! wikitext
2695 ; name : Definition
2696 !! html
2697 <dl><dt> name&#160;</dt>
2698 <dd> Definition</dd></dl>
2700 !! end
2702 !! test
2703 Definition list for indentation only
2704 !! wikitext
2705 : Indented text
2706 !! html
2707 <dl><dd> Indented text</dd></dl>
2709 !! end
2711 !! test
2712 Definition list with no space
2713 !! wikitext
2714 ;name:Definition
2715 !! html
2716 <dl><dt>name</dt>
2717 <dd>Definition</dd></dl>
2719 !!end
2721 !! test
2722 Definition list with URL link
2723 !! wikitext
2724 ; http://example.com/ : definition
2725 !! html
2726 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2727 <dd> definition</dd></dl>
2729 !! end
2731 !! test
2732 Definition list with bracketed URL link
2733 !! wikitext
2734 ;[http://www.example.com/ Example]:Something about it
2735 !! html
2736 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2737 <dd>Something about it</dd></dl>
2739 !! end
2741 !! test
2742 Definition list with wikilink containing colon
2743 !! wikitext
2744 ; [[Help:FAQ]]: The least-read page on Wikipedia
2745 !! html
2746 <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>
2747 <dd> The least-read page on Wikipedia</dd></dl>
2749 !! end
2751 # At Brion's and JeLuF's insistence... :)
2752 !! test
2753 Definition list with news link containing colon
2754 !! wikitext
2755 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
2756 !! html
2757 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2758 <dd> This isn't even a real newsgroup!</dd></dl>
2760 !! end
2762 !! test
2763 Malformed definition list with colon
2764 !! wikitext
2765 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2766 !! html
2767 <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>
2769 !! end
2771 !! test
2772 Definition lists: colon in external link text
2773 !! wikitext
2774 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2775 !! html
2776 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2777 <dd> OK, I made that up</dd></dl>
2779 !! end
2781 !! test
2782 Definition lists: colon in HTML attribute
2783 !! wikitext
2784 ;<b style="display: inline">bold</b>
2785 !! html
2786 <dl><dt><b style="display: inline">bold</b></dt></dl>
2788 !! end
2790 !! test
2791 Definition lists: self-closed tag
2792 !! wikitext
2793 ;one<br/>two : two-line fun
2794 !! html
2795 <dl><dt>one<br />two&#160;</dt>
2796 <dd> two-line fun</dd></dl>
2798 !! end
2800 !! test
2801 Bug 11748: Literal closing tags
2802 !! wikitext
2803 <dl>
2804 <dt>test 1</dt>
2805 <dd>test test test test test</dd>
2806 <dt>test 2</dt>
2807 <dd>test test test test test</dd>
2808 </dl>
2809 !! html
2810 <dl>
2811 <dt>test 1</dt>
2812 <dd>test test test test test</dd>
2813 <dt>test 2</dt>
2814 <dd>test test test test test</dd>
2815 </dl>
2817 !! end
2819 !! test
2820 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2821 !! wikitext
2822 <ul><li>
2823 ; term : description
2824 * unordered
2825 </li></ul>
2826 !! html
2827 <ul><li>
2828 <dl><dt> term&#160;</dt>
2829 <dd> description</dd></dl>
2830 <ul><li> unordered</li></ul>
2831 </li></ul>
2833 !! end
2835 !! test
2837 Definition list with empty definition and following paragraph
2838 !! wikitext
2839 ; term:
2840 Paragraph text
2841 !! html
2842 <dl><dt> term</dt>
2843 <dd></dd></dl>
2844 <p>Paragraph text
2845 </p>
2846 !! end
2848 !! test
2849 Nested definition lists using html syntax
2850 !! wikitext
2851 <dl><dt>x</dt>
2852 <dd>a</dd>
2853 <dd>b</dd></dl>
2855 !! end
2857 !! test
2858 Definition Lists: No nesting: Multiple dd's
2859 !! wikitext
2863 !! html
2864 <dl><dt>x</dt>
2865 <dd>a</dd>
2866 <dd>b</dd></dl>
2868 !! end
2870 !! test
2871 Definition Lists: Indentation: Regular
2872 !! wikitext
2874 ::i2
2875 :::i3
2876 !! html
2877 <dl><dd>i1
2878 <dl><dd>i2
2879 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
2881 !! end
2883 !! test
2884 Definition Lists: Indentation: Missing 1st level
2885 !! wikitext
2886 ::i2
2887 :::i3
2888 !! html
2889 <dl><dd><dl><dd>i2
2890 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
2892 !! end
2894 !! test
2895 Definition Lists: Indentation: Multi-level indent
2896 !! wikitext
2897 :::i3
2898 !! html
2899 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
2901 !! end
2903 !! test
2904 Definition Lists: Hacky use to indent tables
2905 !! wikitext
2906 ::{|
2907 |foo
2908 |bar
2910 this text
2911 should be left alone
2912 !! html
2913 <dl><dd><dl><dd><table>
2914 <tr>
2915 <td>foo
2916 </td>
2917 <td>bar
2918 </td></tr></table></dd></dl></dd></dl>
2919 <p>this text
2920 should be left alone
2921 </p>
2922 !! end
2924 !! test
2925 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
2926 !! wikitext
2927 <!-- foo -->
2928 ::{|
2929 |foo
2930 |bar
2931 |}<!-- bar -->
2932 this text
2933 should be left alone
2934 !! html/parsoid
2935 <!-- foo -->
2936 <dl><dd><dl><dd><table><tr>
2937 <td>foo</td>
2938 <td>bar</td>
2939 </tr></table><!-- bar --></dd></dl></dd></dl>
2940 <p>this text
2941 should be left alone</p>
2942 !! end
2944 !! test
2945 Definition Lists: Hacky use to indent tables, with comment before table
2946 !! wikitext
2947 ::<!-- foo -->{|
2948 |foo
2950 !! html/parsoid
2951 <dl><dd><dl><dd><!-- foo --><table><tr>
2952 <td>foo</td>
2953 </tr></table></dd></dl></dd></dl>
2954 !! end
2956 # Bug 52473
2957 !! test
2958 Definition Lists: Hacky use to indent tables (WS-insensitive)
2959 !! options
2960 parsoid
2961 !! wikitext
2962 : {|
2964 |} 
2965 !! html
2966 <dl>
2967 <dd> <table><tr><td>a</td></tr></table> </dd>
2968 </dl>
2969 !! end
2970 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2971 ## as an empty dt item.  It also ignores all but the last ";" when followed
2972 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
2973 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
2974 ## ";"s.
2976 ## Ex: ";;t2 ::d2" is transformed into:
2978 ## <dl>
2979 ##   <dt>t2 </dt>
2980 ##   <dd>
2981 ##     <dl>
2982 ##       <dt></dt>
2983 ##       <dd>d2</dd>
2984 ##     </dl>
2985 ##   </dd>
2986 ## </dl>
2988 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2989 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2991 ## <dl>
2992 ##   <dt>
2993 ##     <dl>
2994 ##       <dt>t2 </dt>
2995 ##       <dd>:d2</dd>
2996 ##     </dl>
2997 ##    </dt>
2998 ## </dl>
3000 ## All Parsoid only definition list tests have this difference.
3002 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3003 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3005 !! test
3006 Table / list interaction: indented table with lists in table contents
3007 !! wikitext
3010 | a
3011 * b
3013 | c
3014 * d
3016 !! html
3017 <dl><dd><table>
3019 <tr>
3020 <td> a
3021 <ul><li> b</li></ul>
3022 </td></tr>
3023 <tr>
3024 <td> c
3025 <ul><li> d</li></ul>
3026 </td></tr></table></dd></dl>
3028 !! end
3030 !!test
3031 Table / list interaction: lists nested in tables nested in indented lists
3032 !! wikitext
3044 !! html
3045 <dl><dd><table>
3046 <tr>
3047 <td>
3048 <dl><dd>a</dd>
3049 <dd>b</dd></dl>
3050 </td>
3051 <td>
3052 <ul><li>c</li>
3053 <li>d</li></ul>
3054 </td></tr></table></dd></dl>
3055 <ul><li>e</li>
3056 <li>f</li></ul>
3058 !!end
3060 !! test
3061 Definition Lists: Nesting: Multi-level (Parsoid only)
3062 !! options
3063 parsoid
3064 !! wikitext
3065 ;t1 :d1
3066 ;;t2 ::d2
3067 ;;;t3 :::d3
3068 !! html
3069 <dl>
3070   <dt>t1 </dt>
3071   <dd>d1</dd>
3072   <dt>
3073     <dl>
3074       <dt>t2 </dt>
3075       <dd>:d2</dd>
3076       <dt>
3077         <dl>
3078           <dt>t3 </dt>
3079           <dd>::d3</dd>
3080         </dl>
3081       </dt>
3082     </dl>
3083   </dt>
3084 </dl>
3087 !! end
3090 !! test
3091 Definition Lists: Nesting: Test 2 (Parsoid only)
3092 !! options
3093 parsoid
3094 !! wikitext
3096 ::d2
3097 !! html
3098 <dl>
3099   <dt>t1</dt>
3100   <dd>
3101     <dl>
3102       <dd>d2</dd>
3103     </dl>
3104   </dd>
3105 </dl>
3107 !! end
3110 !! test
3111 Definition Lists: Nesting: Test 3 (Parsoid only)
3112 !! options
3113 parsoid
3114 !! wikitext
3115 :;t1
3116 ::::d2
3117 !! html
3118 <dl>
3119   <dd>
3120     <dl>
3121       <dt>t1</dt>
3122       <dd>
3123         <dl>
3124           <dd>
3125             <dl>
3126               <dd>d2</dd>
3127             </dl>
3128           </dd>
3129         </dl>
3130       </dd>
3131     </dl>
3132   </dd>
3133 </dl>
3135 !! end
3138 !! test
3139 Definition Lists: Nesting: Test 4
3140 !! wikitext
3141 ::;t3
3142 :::d3
3143 !! html
3144 <dl><dd><dl><dd><dl><dt>t3</dt>
3145 <dd>d3</dd></dl></dd></dl></dd></dl>
3147 !! end
3150 ## The Parsoid team believes the following three test exposes a
3151 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
3152 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3153 !! test
3154 Definition Lists: Mixed Lists: Test 1
3155 !! wikitext
3156 :;* foo
3157 ::* bar
3158 :; baz
3159 !! html/php
3160 <dl><dd><dl><dt><ul><li> foo</li>
3161 <li> bar</li></ul></dt></dl>
3162 <dl><dt> baz</dt></dl></dd></dl>
3164 !! html/parsoid
3165 <dl>
3166 <dd><dl>
3167 <dt><ul>
3168 <li> foo
3169 </li>
3170 </ul></dt>
3171 <dd><ul>
3172 <li> bar
3173 </li>
3174 </ul></dd>
3175 <dt> baz</dt>
3176 </dl></dd>
3177 </dl>
3178 !! end
3180 !! test
3181 Definition Lists: Mixed Lists: Test 2
3182 !! wikitext
3183 *: d1
3184 *: d2
3185 !! html
3186 <ul><li><dl><dd> d1</dd>
3187 <dd> d2</dd></dl></li></ul>
3189 !! end
3192 !! test
3193 Definition Lists: Mixed Lists: Test 3
3194 !! wikitext
3195 *::: d1
3196 *::: d2
3197 !! html
3198 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3199 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3201 !! end
3204 !! test
3205 Definition Lists: Mixed Lists: Test 4
3206 !! wikitext
3207 *;d1 :d2
3208 *;d3 :d4
3209 !! html
3210 <ul><li><dl><dt>d1&#160;</dt>
3211 <dd>d2</dd>
3212 <dt>d3&#160;</dt>
3213 <dd>d4</dd></dl></li></ul>
3215 !! end
3218 !! test
3219 Definition Lists: Mixed Lists: Test 5
3220 !! wikitext
3221 *:d1
3222 *:: d2
3223 !! html
3224 <ul><li><dl><dd>d1
3225 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3227 !! end
3230 !! test
3231 Definition Lists: Mixed Lists: Test 6
3232 !! wikitext
3233 #*:d1
3234 #*::: d3
3235 !! html
3236 <ol><li><ul><li><dl><dd>d1
3237 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3239 !! end
3242 !! test
3243 Definition Lists: Mixed Lists: Test 7
3244 !! wikitext
3245 :* d1
3246 :* d2
3247 !! html
3248 <dl><dd><ul><li> d1</li>
3249 <li> d2</li></ul></dd></dl>
3251 !! end
3254 !! test
3255 Definition Lists: Mixed Lists: Test 8
3256 !! wikitext
3257 :* d1
3258 ::* d2
3259 !! html
3260 <dl><dd><ul><li> d1</li></ul>
3261 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3263 !! end
3266 !! test
3267 Definition Lists: Mixed Lists: Test 9
3268 !! wikitext
3269 *;foo :bar
3270 !! html
3271 <ul><li><dl><dt>foo&#160;</dt>
3272 <dd>bar</dd></dl></li></ul>
3274 !! end
3277 !! test
3278 Definition Lists: Mixed Lists: Test 10
3279 !! wikitext
3280 *#;foo :bar
3281 !! html
3282 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3283 <dd>bar</dd></dl></li></ol></li></ul>
3285 !! end
3287 # The Parsoid team disagrees with the PHP parser's seemingly-random
3288 # rules regarding dd/dt on the next two tests.  Parsoid is more
3289 # consistent, and recognizes the shared nesting and keeps the
3290 # still-open tags around until the nesting is complete.
3292 !! test
3293 Definition Lists: Mixed Lists: Test 11
3294 !! wikitext
3295 *#*#;*;;foo :bar
3296 *#*#;boo :baz
3297 !! html/php
3298 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3299 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3300 <dl><dt>boo&#160;</dt>
3301 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3303 !! html/parsoid
3304 <ul>
3305 <li>
3306 <ol>
3307 <li>
3308 <ul>
3309 <li>
3310 <ol>
3311 <li>
3312 <dl>
3313 <dt>
3314 <ul>
3315 <li>
3316 <dl>
3317 <dt>
3318 <dl>
3319 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3320 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3321 </dl></dt>
3322 </dl></li>
3323 </ul></dt>
3324 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3325 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3326 </dl></li>
3327 </ol></li>
3328 </ul></li>
3329 </ol></li>
3330 </ul>
3331 !! end
3334 !! test
3335 Definition Lists: Weird Ones: Test 1
3336 !! wikitext
3337 *#;*::;; foo : bar (who uses this?)
3338 !! html/php
3339 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3340 <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>
3342 !! html/parsoid
3343 <ul>
3344 <li>
3345 <ol>
3346 <li>
3347 <dl>
3348 <dt>
3349 <ul>
3350 <li>
3351 <dl>
3352 <dd>
3353 <dl>
3354 <dd>
3355 <dl>
3356 <dt>
3357 <dl>
3358 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3359 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3360 </dl></dt>
3361 </dl></dd>
3362 </dl></dd>
3363 </dl></li>
3364 </ul></dt>
3365 </dl></li>
3366 </ol></li>
3367 </ul>
3368 !! end
3371 ### External links
3373 !! test
3374 External links: non-bracketed
3375 !! wikitext
3376 Non-bracketed: http://example.com
3377 !! html
3378 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3379 </p>
3380 !! end
3382 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3383 !! test
3384 External links: numbered
3385 !! wikitext
3386 Numbered: [http://example.com]
3387 Numbered: [http://example.net]
3388 Numbered: [http://example.com]
3389 !! html/php
3390 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3391 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3392 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3393 </p>
3394 !! html/parsoid
3395 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3396 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3397 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3398 !!end
3400 !! test
3401 External links: specified text
3402 !! wikitext
3403 Specified text: [http://example.com link]
3404 !! html
3405 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3406 </p>
3407 !!end
3409 !! test
3410 External links: trail
3411 !! wikitext
3412 Linktrails should not work for external links: [http://example.com link]s
3413 !! html
3414 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3415 </p>
3416 !! end
3418 !! test
3419 External links: dollar sign in URL
3420 !! wikitext
3421 http://example.com/1$2345
3422 !! html
3423 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3424 </p>
3425 !! end
3427 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3428 !! test
3429 External links: dollar sign in URL (autonumber)
3430 !! wikitext
3431 [http://example.com/1$2345]
3432 !! html/php
3433 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3434 </p>
3435 !! html/parsoid
3436 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3437 !!end
3439 !! test
3440 External links: open square bracket forbidden in URL (bug 4377)
3441 !! options
3442 parsoid=wt2html,wt2wt,html2html
3443 !! wikitext
3444 http://example.com/1[2345
3445 !! html/php
3446 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3447 </p>
3448 !! html/parsoid
3449 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3450 !! end
3452 !! test
3453 External links: open square bracket forbidden in URL (named) (bug 4377)
3454 !! options
3455 parsoid=wt2html,html2html
3456 !! wikitext
3457 [http://example.com/1[2345]
3458 !! html/php
3459 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3460 </p>
3461 !! html/parsoid
3462 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3463 !!end
3465 # parsoid adds a space before the link name
3466 !! test
3467 External links: open square bracket forbidden in URL (named) (bug 4377)
3468 Parsoid variant.
3469 !! wikitext
3470 [http://example.com/1 [2345]
3471 !! html
3472 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3473 </p>
3474 !!end
3476 !! test
3477 External links: nowiki in URL link text (bug 6230)
3478 !! wikitext
3479 [http://example.com/ <nowiki>''example site''</nowiki>]
3480 !! html
3481 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3482 </p>
3483 !! end
3485 !! test
3486 External links: newline forbidden in text (bug 6230 regression check)
3487 !! wikitext
3488 [http://example.com/ first
3489 second]
3490 !! html
3491 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3492 second]
3493 </p>
3494 !!end
3496 !! test
3497 External links: Pipe char between url and text
3498 !! wikitext
3499 [http://example.com | link]
3500 !! html
3501 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3502 </p>
3503 !!end
3505 !! test
3506 External links: protocol-relative URL in brackets
3507 !! wikitext
3508 [//example.com/ Test]
3509 !! html
3510 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3511 </p>
3512 !! end
3514 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3515 !! test
3516 External links: protocol-relative URL in brackets without text
3517 !! wikitext
3518 [//example.com]
3519 !! html/php
3520 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3521 </p>
3522 !! html/parsoid
3523 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3524 !! end
3526 !! test
3527 External links: protocol-relative URL in free text is left alone
3528 !! wikitext
3529 //example.com/Foo
3530 !! html
3531 <p>//example.com/Foo
3532 </p>
3533 !!end
3535 !! test
3536 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3537 !! wikitext
3538 foo//example.com/Foo
3539 !! html
3540 <p>foo//example.com/Foo
3541 </p>
3542 !! end
3544 !! test
3545 External image
3546 !! wikitext
3547 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3548 !! html
3549 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3550 </p>
3551 !! end
3553 !! test
3554 External image from https
3555 !! wikitext
3556 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3557 !! html
3558 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3559 </p>
3560 !! end
3562 !! test
3563 External image (when not allowed)
3564 !! options
3565 wgAllowExternalImages=0
3566 !! wikitext
3567 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3568 !! html
3569 <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>
3570 </p>
3571 !! end
3573 !! test
3574 Link to non-http image, no img tag
3575 !! wikitext
3576 Link to non-http image, no img tag: ftp://example.com/test.jpg
3577 !! html
3578 <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>
3579 </p>
3580 !! end
3582 !! test
3583 External links: terminating separator
3584 !! wikitext
3585 Terminating separator: http://example.com/thing,
3586 !! html
3587 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3588 </p>
3589 !! end
3591 !! test
3592 External links: intervening separator
3593 !! wikitext
3594 Intervening separator: http://example.com/1,2,3
3595 !! html
3596 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3597 </p>
3598 !! end
3600 !! test
3601 External links: old bug with URL in query
3602 !! wikitext
3603 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3604 !! html
3605 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3606 </p>
3607 !! end
3609 !! test
3610 External links: old URL-in-URL bug, mixed protocols
3611 !! wikitext
3612 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3613 !! html
3614 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3615 </p>
3616 !!end
3618 !! test
3619 External links: URL in text
3620 !! wikitext
3621 URL in text: [http://example.com http://example.com]
3622 !! html
3623 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3624 </p>
3625 !! end
3627 !! test
3628 External links: Clickable images
3629 !! wikitext
3630 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3631 !! html
3632 <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>
3633 </p>
3634 !!end
3636 !! test
3637 External links: raw ampersand
3638 !! wikitext
3639 Old &amp; use: http://x&y
3640 !! html
3641 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3642 </p>
3643 !! end
3645 !! test
3646 External links: encoded ampersand
3647 !! wikitext
3648 Old &amp; use: http://x&amp;y
3649 !! html/php
3650 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3651 </p>
3652 !! html/parsoid
3653 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3654 !! end
3656 !! test
3657 External links: encoded equals (bug 6102)
3658 !! wikitext
3659 http://example.com/?foo&#61;bar
3660 !! html/php
3661 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3662 </p>
3663 !! html/parsoid
3664 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3665 !! end
3668 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3669 ## does it number them.  As discussed in bug 53505, we can identify
3670 ## autonumbered links via CSS.
3673 !! test
3674 External links: [raw ampersand]
3675 !! wikitext
3676 Old &amp; use: [http://x&y]
3677 !! html/php
3678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3679 </p>
3680 !! html/parsoid
3681 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3682 !! end
3684 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3685 # mode will return the [raw ampersand] wikitext
3686 !! test
3687 External links: [encoded ampersand]
3688 !! options
3689 parsoid=wt2html,wt2wt,html2html
3690 !! wikitext
3691 Old &amp; use: [http://x&amp;y]
3692 !! html/php
3693 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3694 </p>
3695 !! html/parsoid
3696 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3697 !! end
3699 !! test
3700 External links: [raw equals]
3701 !! wikitext
3702 [http://example.com/?foo=bar]
3703 !! html/php
3704 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3705 </p>
3706 !! html/parsoid
3707 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3708 !! end
3710 # note that parsoid html is identical to [raw equals] case; so html2wt
3711 # mode will return the [raw equals] wikitext
3712 !! test
3713 External links: [encoded equals] (bug 6102)
3714 !! options
3715 parsoid=wt2html,wt2wt,html2html
3716 !! wikitext
3717 [http://example.com/?foo&#61;bar]
3718 !! html/php
3719 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3720 </p>
3721 !! html/parsoid
3722 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3723 !! end
3725 # xxx parsoid strips the IDN character, so the round-trip tests will
3726 #     obviously fail and are disabled. --cscott
3727 !! test
3728 External links: [IDN ignored character reference in hostname; strip it right off]
3729 !! options
3730 parsoid=wt2html,wt2wt,html2html
3731 !! wikitext
3732 [http://e&zwnj;xample.com/]
3733 !! html/php
3734 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3735 </p>
3736 !! html/parsoid
3737 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3738 !! end
3740 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3741 # Where an external link could easily circumvent the sanitization of the text of
3742 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3743 # test demands a higher standard. That's a bit strange.
3745 # Example:
3747 # http://e‌xample.com -> [http://example.com|http://example.com]
3748 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3750 # The first example is sanitized, but the second is not. Any security benefits
3751 # from this production are trivial to circumvent. Either remove this test and
3752 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3753 # the test accordingly.
3755 # All our love,
3756 # The Parsoid team.
3757 # xxx parsoid strips the IDN character, so the round-trip tests will
3758 #     obviously fail and are disabled. --cscott
3759 !! test
3760 External links: IDN ignored character reference in hostname; strip it right off
3761 !! options
3762 parsoid=wt2html,html2html
3763 !! wikitext
3764 http://e&zwnj;xample.com/
3765 !! html/php
3766 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3767 </p>
3768 !! html/parsoid
3769 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
3770 !! end
3772 !! test
3773 External links: www.jpeg.org (bug 554)
3774 !! wikitext
3775 http://www.jpeg.org
3776 !! html
3777 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3778 </p>
3779 !! end
3781 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3782 !! test
3783 External links: URL within URL (original bug 2)
3784 !! wikitext
3785 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3786 !! html/php
3787 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3788 </p>
3789 !! html/parsoid
3790 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
3791 !! end
3793 !! test
3794 BUG 361: URL inside bracketed URL
3795 !! wikitext
3796 [http://www.example.com/foo http://www.example.com/bar]
3797 !! html
3798 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3799 </p>
3800 !! end
3802 !! test
3803 BUG 361: URL within URL, not bracketed
3804 !! wikitext
3805 http://www.example.com/foo?=http://www.example.com/bar
3806 !! html
3807 <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>
3808 </p>
3809 !! end
3811 !! test
3812 BUG 289: ">"-token in URL-tail
3813 !! wikitext
3814 http://www.example.com/<hello>
3815 !! html
3816 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3817 </p>
3818 !!end
3820 !! test
3821 BUG 289: literal ">"-token in URL-tail
3822 !! wikitext
3823 http://www.example.com/<b>html</b>
3824 !! html
3825 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3826 </p>
3827 !!end
3829 !! test
3830 BUG 289: ">"-token in bracketed URL
3831 !! wikitext
3832 [http://www.example.com/<hello> stuff]
3833 !! html
3834 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3835 </p>
3836 !!end
3838 !! test
3839 BUG 289: literal ">"-token in bracketed URL
3840 !! wikitext
3841 [http://www.example.com/<b>html</b> stuff]
3842 !! html
3843 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3844 </p>
3845 !!end
3847 !! test
3848 BUG 289: literal double quote at end of URL
3849 !! wikitext
3850 http://www.example.com/"hello"
3851 !! html
3852 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3853 </p>
3854 !!end
3856 !! test
3857 BUG 289: literal double quote in bracketed URL
3858 !! wikitext
3859 [http://www.example.com/"hello" stuff]
3860 !! html
3861 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3862 </p>
3863 !!end
3865 !! test
3866 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3867 !! wikitext
3868 [http://www.example.com  test]
3869 !! html
3870 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3871 </p>
3872 !! end
3874 !! test
3875 External links: link text with spaces
3876 !! wikitext
3877 [http://www.example.com a b c]
3878 [http://www.example.com ''a'' ''b'']
3879 !! html
3880 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3881 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3882 </p>
3883 !! end
3885 !! test
3886 External links: wiki links within external link (Bug 3695)
3887 !! wikitext
3888 [http://example.com [[wikilink]] embedded in ext link]
3889 !! html/php
3890 <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>
3891 </p>
3892 !! html/parsoid
3893 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink">wikilink</a><span> embedded in ext link</span></p>
3894 !! end
3896 !! test
3897 BUG 787: Links with one slash after the url protocol are invalid
3898 !! wikitext
3899 http:/example.com
3901 [http:/example.com title]
3902 !! html
3903 <p>http:/example.com
3904 </p><p>[http:/example.com title]
3905 </p>
3906 !! end
3908 !! test
3909 Bracketed external links with template-generated invalid target
3910 !! wikitext
3911 [{{echo|http:/example.com}} title]
3912 !! html
3913 <p>[http:/example.com title]
3914 </p>
3915 !! end
3917 !! test
3918 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3919 !! wikitext
3920 ''[http://example.com text'']
3921 [http://example.com '''text]'''
3922 ''Something [http://example.com in italic'']
3923 ''Something [http://example.com mixed''''', even bold]'''
3924 '''''Now [http://example.com both''''']
3925 !! html
3926 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3927 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3928 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3929 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3930 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3931 </p>
3932 !! end
3935 !! test
3936 Bug 4781: %26 in URL
3937 !! wikitext
3938 http://www.example.com/?title=AT%26T
3939 !! html/php
3940 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3941 </p>
3942 !! html/parsoid
3943 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
3944 !! end
3946 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3947 # % is actually legal in HTML5. Any change in output would need testing though.
3948 !! test
3949 Bug 4781, 5267: %25 in URL
3950 !! wikitext
3951 http://www.example.com/?title=100%25_Bran
3952 !! html/php
3953 <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>
3954 </p>
3955 !! html/parsoid
3956 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
3957 !! end
3959 !! test
3960 Bug 4781, 5267: %28, %29 in URL
3961 !! wikitext
3962 http://www.example.com/?title=Ben-Hur_%281959_film%29
3963 !! html/php
3964 <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>
3965 </p>
3966 !! html/parsoid
3967 <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>
3968 !! end
3971 !! test
3972 Bug 4781: %26 in autonumber URL
3973 !! wikitext
3974 [http://www.example.com/?title=AT%26T]
3975 !! html/php
3976 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3977 </p>
3978 !! html/parsoid
3979 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
3980 !! end
3982 !! test
3983 Bug 4781, 5267: %26 in autonumber URL
3984 !! wikitext
3985 [http://www.example.com/?title=100%25_Bran]
3986 !! html/php
3987 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3988 </p>
3989 !! html/parsoid
3990 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
3991 !! end
3993 !! test
3994 Bug 4781, 5267: %28, %29 in autonumber URL
3995 !! wikitext
3996 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3997 !! html/php
3998 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3999 </p>
4000 !! html/parsoid
4001 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4002 !! end
4005 !! test
4006 Bug 4781: %26 in bracketed URL
4007 !! wikitext
4008 [http://www.example.com/?title=AT%26T link]
4009 !! html/php
4010 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4011 </p>
4012 !! html/parsoid
4013 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4014 !! end
4016 !! test
4017 Bug 4781, 5267: %25 in bracketed URL
4018 !! wikitext
4019 [http://www.example.com/?title=100%25_Bran link]
4020 !! html
4021 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4022 </p>
4023 !! end
4025 !! test
4026 Bug 4781, 5267: %28, %29 in bracketed URL
4027 !! wikitext
4028 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4029 !! html/php
4030 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4031 </p>
4032 !! html/parsoid
4033 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4034 !! end
4036 # Note that parsoid does not munge anchor text; all non-space
4037 # characters are valid in HTML5 ids.
4038 !! test
4039 Anchor containing a #. (bug 63430)
4040 !! wikitext
4041 [[Main Page#And#Link]]
4042 !! html/php
4043 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
4044 </p>
4045 !! html/parsoid
4046 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
4047 !! end
4049 !! test
4050 External link containing a period in the anchor. (bug 63947)
4051 !! wikitext
4052 [//foo.org/bar#baz. bang]
4054 [//foo.org/bar. bang]
4055 !! html/php
4056 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4057 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4058 </p>
4059 !! html/parsoid
4060 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4061 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4062 !! end
4064 !! test
4065 External link containing a single quote. (bug 63947)
4066 !! wikitext
4067 [//foo.org/bar'baz]
4069 [//foo.org/bar'baz bang]
4070 !! html/php
4071 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4072 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4073 </p>
4074 !! html/parsoid
4075 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4076 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4077 !! end
4080 !! test
4081 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4082 !! wikitext
4083 Some [http://example.com/ pretty ''italics'' and stuff]!
4084 !! html
4085 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4086 </p>
4087 !! end
4089 !! test
4090 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4091 !! wikitext
4092 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4093 !! html
4094 <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>
4095 </p>
4096 !! end
4098 !! test
4099 External link containing double-single-quotes with no space separating the url from text in italics
4100 !! wikitext
4101 [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]].]
4102 !! html/php
4103 <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>
4104 </p>
4105 !! html/parsoid
4106 <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)">Museo Picasso</a><span>.</span></p>
4107 !! end
4109 !! test
4110 External link with comments in link text
4111 !! wikitext
4112 [http://www.google.com Google <!-- comment -->]
4113 !! html
4114 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4115 </p>
4116 !! end
4118 !! test
4119 URL-encoding in URL functions (single parameter)
4120 !! wikitext
4121 {{localurl:Some page|amp=&}}
4122 !! html
4123 <p>/index.php?title=Some_page&amp;amp=&amp;
4124 </p>
4125 !! end
4127 !! test
4128 URL-encoding in URL functions (multiple parameters)
4129 !! wikitext
4130 {{localurl:Some page|q=?&amp=&}}
4131 !! html
4132 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4133 </p>
4134 !! end
4136 !! test
4137 Brackets in urls
4138 !! wikitext
4139 http://example.com/index.php?foozoid%5B%5D=bar
4141 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4142 !! html/php
4143 <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>
4144 </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>
4145 </p>
4146 !! html/parsoid
4147 <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>
4149 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4150 !! end
4152 !! test
4153 IPv6 urls (bug 21261)
4154 !! options
4155 disabled
4156 !! wikitext
4157 http://[2404:130:0:1000::187:2]/index.php
4158 !! html
4159 <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>
4160 </p>
4161 !! end
4163 !! test
4164 Non-extlinks in brackets
4165 !! wikitext
4166 [foo]
4167 [foo bar]
4168 [foo ''bar'']
4169 [fool's] errand
4170 [fool's errand]
4171 [{{echo|foo}}]
4172 [{{echo|foo}} bar]
4173 [{{echo|foo}} ''bar'']
4174 [{{echo|foo}}l's] errand
4175 [{{echo|foo}}l's errand]
4176 [url={{echo|foo}}]
4177 [url=http://example.com]
4178 !! html
4179 <p>[foo]
4180 [foo bar]
4181 [foo <i>bar</i>]
4182 [fool's] errand
4183 [fool's errand]
4184 [foo]
4185 [foo bar]
4186 [foo <i>bar</i>]
4187 [fool's] errand
4188 [fool's errand]
4189 [url=foo]
4190 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4191 </p>
4192 !! end
4194 !! test
4195 Percent encoding in external links
4196 !! wikitext
4197 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4198 !! html/php
4199 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4200 </p>
4201 !! html/parsoid
4202 <p><a rel="mw:ExtLink"
4203 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4204 !! end
4206 !! test
4207 Use url link syntax for links where the content is equal the link target
4208 !! wikitext
4209 http://example.com
4210 !! html/php
4211 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4212 </p>
4213 !! html/parsoid
4214 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4215 !! end
4217 !! test
4218 Parenthesis in external links, especially URL links
4219 !! wikitext
4220 http://example.com)
4222 http://example.com/test)
4224 http://example.com/(test)
4226 http://example.com/((test)
4228 (http://example.com/(test))
4230 (http://example.com/(test)))))
4232 http://example.com/a)b
4234 [http://example.com) foo]
4235 !! html/php
4236 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4237 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4238 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4239 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4240 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4241 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4242 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4243 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4244 </p>
4245 !! html/parsoid
4246 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4247 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4248 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4249 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4250 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4251 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4252 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4253 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4254 !! end
4256 !! test
4257 Parenthesis in external links, w/ transclusion or comment
4258 !! wikitext
4259 (http://example.com/{{echo|hi}})
4261 (http://example.com<!-- hi -->)
4262 !! html/php
4263 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4264 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4265 </p>
4266 !! html/parsoid
4267 <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;dsr&amp;quot;:[20,31,null,null],&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;]}]]}\">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>
4269 <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>
4270 !! end
4273 ### Quotes
4276 !! test
4277 Quotes
4278 !! wikitext
4279 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4281 Normal text. '''''Bold italic text.''''' Normal text.
4282 !! html
4283 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4284 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4285 </p>
4286 !! end
4289 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4290 # parser strips. The wikitext contains just the first half of the bold
4291 # quote pair.
4292 !! test
4293 Unclosed and unmatched quotes
4294 !! wikitext
4295 '''''Bold italic text '''with bold deactivated''' in between.'''''
4297 '''''Bold italic text ''with italic deactivated'' in between.'''''
4299 '''Bold text..
4301 ..spanning two paragraphs (should not work).'''
4303 '''Bold tag left open
4305 ''Italic tag left open
4307 Normal text.
4309 <!-- Unmatching number of opening, closing tags: -->
4310 '''This year''''s election ''should'' beat '''last year''''s.
4312 ''Tom'''s car is bigger than ''Susan'''s.
4314 Plain ''italic'''s plain
4315 !! html/php
4316 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4317 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4318 </p><p><b>Bold text..</b>
4319 </p><p>..spanning two paragraphs (should not work).
4320 </p><p><b>Bold tag left open</b>
4321 </p><p><i>Italic tag left open</i>
4322 </p><p>Normal text.
4323 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4324 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4325 </p><p>Plain <i>italic'</i>s plain
4326 </p>
4327 !! html/parsoid
4328 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4329 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4330 </p><p><b>Bold text..</b>
4331 </p><p>..spanning two paragraphs (should not work).<b></b>
4332 </p><p><b>Bold tag left open</b>
4333 </p><p><i>Italic tag left open</i>
4334 </p><p>Normal text.
4335 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4336 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4337 </p><p>Plain <i>italic'</i>s plain
4338 </p>
4339 !! end
4342 ### Tables
4344 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4347 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4348 # is the bare minimum required by the spec, see:
4349 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4350 # Parsoid team replies: empty table tags are legal in HTML5
4351 !! test
4352 A table with no data.
4353 !! options
4354 parsoid=wt2html
4355 !! wikitext
4356 {||}
4357 !! html/php
4359 !! html/parsoid
4360 <table></table>
4362 !! end
4364 !! test
4365 A table with stray table end tags on start tag line (wt2html)
4366 !! options
4367 parsoid=wt2html
4368 !! wikitext
4369 {|style="color: red;"|}
4371 {|style="color: red;" |}
4372 |foo
4375 {|style="color: red;"|} id="foo"
4376 |foo
4379 {|style="color: red;" |} id="foo"
4380 |foo
4382 !! html
4383 <table style="color: red;"></table>
4385 <table style="color: red;">
4386 <tbody><tr>
4387 <td>foo</td>
4388 </tr></tbody>
4389 </table>
4391 <table style="color: red;" id="foo">
4392 <tbody><tr>
4393 <td>foo</td>
4394 </tr></tbody>
4395 </table>
4397 <table style="color: red;" id="foo">
4398 <tbody><tr>
4399 <td>foo</td>
4400 </tr></tbody>
4401 </table>
4403 !! end
4405 !! test
4406 A table with no data (take 2)
4407 !! wikitext
4410 !! html/parsoid
4411 <table></table>
4412 !! end
4414 # A table with nothing but a caption is invalid XHTML, we might want to render
4415 # this as <p>caption</p>
4416 # Parsoid team replies: table with only a caption is legal in HTML5
4417 !! test
4418 A table with nothing but a caption
4419 !! wikitext
4421 |+ caption
4423 !! html/php
4424 <table>
4425 <caption> caption
4426 </caption><tr><td></td></tr></table>
4428 !! html/parsoid
4429 <table><caption> caption</caption></table>
4430 !! end
4432 !! test
4433 A table with caption with default-spaced attributes and a table row
4434 !! wikitext
4436 |+ style="color: red;" | caption1
4438 | foo
4440 !! html
4441 <table>
4442 <caption style="color: red;"> caption1
4443 </caption>
4444 <tr>
4445 <td> foo
4446 </td></tr></table>
4448 !! end
4450 !! test
4451 A table with captions with non-default spaced attributes and a table row
4452 !! wikitext
4454 |+style="color: red;"|caption2
4455 |+ style="color: red;"| caption3
4457 | foo
4459 !! html
4460 <table>
4461 <caption style="color: red;">caption2
4462 </caption>
4463 <caption style="color: red;"> caption3
4464 </caption>
4465 <tr>
4466 <td> foo
4467 </td></tr></table>
4469 !! end
4471 !! test
4472 Table td-cell syntax variations
4473 !! wikitext
4475 | foo bar foo | baz
4476 | foo bar foo || baz
4477 | style='color:red;' | baz
4478 | style='color:red;' || baz
4480 !! html
4481 <table>
4482 <tr>
4483 <td> baz
4484 </td>
4485 <td> foo bar foo </td>
4486 <td> baz
4487 </td>
4488 <td style="color:red;"> baz
4489 </td>
4490 <td> style='color:red;' </td>
4491 <td> baz
4492 </td></tr></table>
4494 !! end
4496 !! test
4497 Simple table
4498 !! wikitext
4500 | 1 || 2
4502 | 3 || 4
4504 !! html
4505 <table>
4506 <tr>
4507 <td> 1 </td>
4508 <td> 2
4509 </td></tr>
4510 <tr>
4511 <td> 3 </td>
4512 <td> 4
4513 </td></tr></table>
4515 !! end
4517 !! test
4518 Simple table but with multiple dashes for row wikitext
4519 !! wikitext
4521 | foo
4522 |-----
4523 | bar
4525 !! html
4526 <table>
4527 <tr>
4528 <td> foo
4529 </td></tr>
4530 <tr>
4531 <td> bar
4532 </td></tr></table>
4534 !! end
4535 !! test
4536 Multiplication table
4537 !! wikitext
4538 {| border="1" cellpadding="2"
4539 |+Multiplication table
4541 ! &times; !! 1 !! 2 !! 3
4543 ! 1
4544 | 1 || 2 || 3
4546 ! 2
4547 | 2 || 4 || 6
4549 ! 3
4550 | 3 || 6 || 9
4552 ! 4
4553 | 4 || 8 || 12
4555 ! 5
4556 | 5 || 10 || 15
4558 !! html
4559 <table border="1" cellpadding="2">
4560 <caption>Multiplication table
4561 </caption>
4562 <tr>
4563 <th> &#215; </th>
4564 <th> 1 </th>
4565 <th> 2 </th>
4566 <th> 3
4567 </th></tr>
4568 <tr>
4569 <th> 1
4570 </th>
4571 <td> 1 </td>
4572 <td> 2 </td>
4573 <td> 3
4574 </td></tr>
4575 <tr>
4576 <th> 2
4577 </th>
4578 <td> 2 </td>
4579 <td> 4 </td>
4580 <td> 6
4581 </td></tr>
4582 <tr>
4583 <th> 3
4584 </th>
4585 <td> 3 </td>
4586 <td> 6 </td>
4587 <td> 9
4588 </td></tr>
4589 <tr>
4590 <th> 4
4591 </th>
4592 <td> 4 </td>
4593 <td> 8 </td>
4594 <td> 12
4595 </td></tr>
4596 <tr>
4597 <th> 5
4598 </th>
4599 <td> 5 </td>
4600 <td> 10 </td>
4601 <td> 15
4602 </td></tr></table>
4604 !! end
4606 !! test
4607 Accept "||" in table headings
4608 !! wikitext
4610 !h1 || h2
4612 !! html
4613 <table>
4614 <tr>
4615 <th>h1 </th>
4616 <th> h2
4617 </th></tr></table>
4619 !! end
4621 !! test
4622 Accept "||" in indented table headings
4623 !! wikitext
4625 !h1 || h2
4627 !! html
4628 <dl><dd><table>
4629 <tr>
4630 <th>h1 </th>
4631 <th> h2
4632 </th></tr></table></dd></dl>
4634 !! end
4636 !! test
4637 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4638 !! wikitext
4640 !| h1
4641 || a
4643 !! html
4644 <table>
4645 <tr>
4646 <th> h1
4647 </th>
4648 <td> a
4649 </td></tr></table>
4651 !! end
4653 !!test
4654 Accept "| !" at start of line in tables (ignore !-attribute)
4655 !! wikitext
4658 | !style="color:red" | bar
4660 !! html
4661 <table>
4663 <tr>
4664 <td> bar
4665 </td></tr></table>
4667 !!end
4669 !!test
4670 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 +/- 
4671 !! wikitext
4674 |style='color:red;'|+1
4675 |style='color:blue;'|-1
4677 | 1 || 2 || 3
4678 | 1 ||+2 ||-3
4680 | +1
4681 | -1
4683 !! html
4684 <table>
4686 <tr>
4687 <td style="color:red;">+1
4688 </td>
4689 <td style="color:blue;">-1
4690 </td></tr>
4691 <tr>
4692 <td> 1 </td>
4693 <td> 2 </td>
4694 <td> 3
4695 </td>
4696 <td> 1 </td>
4697 <td>+2 </td>
4698 <td>-3
4699 </td></tr>
4700 <tr>
4701 <td> +1
4702 </td>
4703 <td> -1
4704 </td></tr></table>
4706 !!end
4708 !! test
4709 Table rowspan
4710 !! wikitext
4711 {| border=1
4712 | Cell 1, row 1
4713 |rowspan=2| Cell 2, row 1 (and 2)
4714 | Cell 3, row 1
4716 | Cell 1, row 2
4717 | Cell 3, row 2
4719 !! html
4720 <table border="1">
4721 <tr>
4722 <td> Cell 1, row 1
4723 </td>
4724 <td rowspan="2"> Cell 2, row 1 (and 2)
4725 </td>
4726 <td> Cell 3, row 1
4727 </td></tr>
4728 <tr>
4729 <td> Cell 1, row 2
4730 </td>
4731 <td> Cell 3, row 2
4732 </td></tr></table>
4734 !! end
4736 !! test
4737 Nested table
4738 !! wikitext
4739 {| border=1
4740 | &alpha;
4742 {| bgcolor=#ABCDEF border=2
4743 |nested
4745 |table
4747 |the original table again
4749 !! html
4750 <table border="1">
4751 <tr>
4752 <td> &#945;
4753 </td>
4754 <td>
4755 <table bgcolor="#ABCDEF" border="2">
4756 <tr>
4757 <td>nested
4758 </td></tr>
4759 <tr>
4760 <td>table
4761 </td></tr></table>
4762 </td>
4763 <td>the original table again
4764 </td></tr></table>
4766 !! end
4768 !! test
4769 Invalid attributes in table cell (bug 1830)
4770 !! wikitext
4772 |Cell:|broken
4774 !! html
4775 <table>
4776 <tr>
4777 <td>broken
4778 </td></tr></table>
4780 !! end
4783 # The "|}" to close the table is missing from the input, so parsoid's
4784 # *2wt modes will fail.
4785 !! test
4786 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4787 !! options
4788 parsoid=wt2html,html2html
4789 !! wikitext
4791 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4792 !! html/php
4793 <table>
4794 <tr>
4795 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4796 <td>]" onmouseover="alert(document.cookie)"&gt;test
4797 </td>
4798 </tr>
4799 </table>
4801 !! html/parsoid
4802 <table><tbody>
4803 <tr>
4804 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
4805 !! end
4808 !! test
4809 Indented table markup mixed with indented pre content (proposed in bug 6200)
4810 !! wikitext
4811  <table>
4812  <tr>
4813  <td>
4814  Text that should be rendered preformatted
4815  </td>
4816  </tr>
4817  </table>
4818 !! html
4819  <table>
4820  <tr>
4821  <td>
4822 <pre>Text that should be rendered preformatted
4823 </pre>
4824  </td>
4825  </tr>
4826  </table>
4828 !! end
4830 !! test
4831 Template-generated table cell attributes and cell content
4832 !! wikitext
4834 |{{table_attribs}}
4835 | {{table_attribs}}
4837 !! html
4838 <table>
4839 <tr>
4840 <td style="color: red"> Foo
4841 </td>
4842 <td style="color: red"> Foo
4843 </td></tr></table>
4845 !! end
4847 !! test
4848 Template-generated table cell attributes and cell content (2)
4849 !! wikitext
4851 |align=center {{table_attribs}}
4853 !! html
4854 <table>
4855 <tr>
4856 <td align="center" style="color: red"> Foo
4857 </td></tr></table>
4859 !! end
4861 !! test
4862 Template-generated table cell attributes and cell content (3)
4863 !! wikitext
4865 |align=center {{table_cells}}
4867 !! html
4868 <table>
4869 <tr>
4870 <td align="center" style="color: red"> Foo </td>
4871 <td> Bar </td>
4872 <td> Baz
4873 </td></tr></table>
4875 !! end
4877 !! test
4878 Table with row followed by newlines and table heading
4879 !! wikitext
4883 ! foo
4885 !! html
4886 <table>
4889 <tr>
4890 <th> foo
4891 </th></tr></table>
4893 !! end
4895 !! test
4896 Table with empty line following the start tag
4897 !! wikitext
4901 | foo
4903 !! html
4904 <table>
4907 <tr>
4908 <td> foo
4909 </td></tr></table>
4911 !! end
4913 # FIXME: Preserve the attribute properly (with an empty string as value) in
4914 # the PHP parser. Parsoid implements the behavior below.
4915 !! test
4916 Table attributes with empty value
4917 !! wikitext
4919 | style=| hello
4921 !! html/parsoid
4922 <table>
4923 <tbody>
4924 <tr>
4925 <td style=""> hello
4926 </td></tr></tbody></table>
4928 !! end
4930 !! test
4931 Wikitext table with a lot of comments
4932 !! wikitext
4934 <!-- c0 -->
4935 | foo
4936 <!-- c1 -->
4937 |- <!-- c2 -->
4938 <!-- c3 -->
4939 |<!-- c4 -->
4940 <!-- c5 -->
4942 !! html
4943 <table>
4944 <tr>
4945 <td> foo
4946 </td></tr>
4947 <tr>
4948 <td>
4949 </td></tr></table>
4951 !! end
4953 !! test
4954 Wikitext table with double-line table cell
4955 !! wikitext
4960 !! html
4961 <table>
4962 <tr>
4963 <td>a
4964 <p>b
4965 </p>
4966 </td></tr></table>
4968 !! end
4970 !! test
4971 Table cell with a single comment
4972 !! wikitext
4974 | <!-- c1 -->
4975 | a
4977 !! html
4978 <table>
4979 <tr>
4980 <td>
4981 </td>
4982 <td> a
4983 </td></tr></table>
4985 !! end
4987 # The expected HTML structure in this test is debatable. The PHP parser does
4988 # not parse this kind of table at all. The main focus for Parsoid is on
4989 # round-tripping, so this output is ok for now. TODO: revisit!
4990 !! test
4991 Wikitext table with html-syntax row
4992 !! wikitext
4995 <td>foo</td>
4997 !! html/parsoid
4998 <table>
4999 <tbody>
5000 <tr>
5001 <td>foo</td></tr></tbody></table>
5002 !! end
5004 !! test
5005 Implicit <td> after a |-
5006 (PHP parser relies on Tidy to add the missing <td> tags)
5007 !! options
5008 parsoid=wt2html,wt2wt
5009 !! wikitext
5014 !! html
5015 <table>
5016 <tr><td>a</td></tr>
5017 </table>
5018 !! end
5020 !! test
5021 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5022 (PHP parser relies on Tidy to add the missing <td> tags)
5023 !! options
5024 parsoid=wt2html,wt2wt
5025 !! wikitext
5033 !! html
5034 <table>
5035 <tbody>
5036 <tr><td><pre>a</pre></td></tr>
5037 <tr><td> b</td></tr>
5038 </tbody>
5039 </table>
5040 !! end
5042 !! test
5043 Lists should be recognized in an implicit <td> context
5044 (PHP parser relies on Tidy to add the missing <td> tags)
5045 !! options
5046 parsoid=wt2html,wt2wt
5047 !! wikitext
5052 !! html
5053 <table>
5054 <tr>
5055 <td><ul>
5056 <li>a</li>
5057 </ul></td>
5058 </tr>
5059 </table>
5060 !! end
5062 !! test
5063 Parsoid: Round-trip tables directly followed by content (bug 51219)
5064 !! options
5065 parsoid=wt2html,wt2wt
5066 !! wikitext
5068 |foo
5069 |} bar
5072 |baz
5073 |}<b>quux</b>
5074 !! html
5075 <table><tbody>
5076 <tr>
5077 <td>foo</td></tr></tbody></table> bar
5078 <table>
5079 <tbody>
5080 <tr>
5081 <td>baz</td></tr></tbody></table><b>quux</b>
5082 !! end
5084 !! test
5085 Parsoid: Default to a newline after tables in new content (bug 51219)
5086 !! options
5087 parsoid=html2wt
5088 !! wikitext
5090 |foo
5092 <nowiki> </nowiki>bar
5094 |baz
5096 '''quux'''
5097 !! html
5098 <table><tbody>
5099 <tr><td>foo</td></tr></tbody></table> bar
5100 <table><tbody>
5101 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5102 !! end
5104 !! test
5105 Parsoid: newline inducing block nodes don't suppress <nowiki>
5106 !! options
5107 parsoid=html2wt
5108 !! wikitext
5109 <nowiki> </nowiki>a
5111 = foo =
5112 !! html
5113  a<h1>foo</h1>
5114 !! end
5117 ### Internal links
5119 !! test
5120 Plain link, capitalized
5121 !! wikitext
5122 [[Main Page]]
5123 !! html
5124 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5125 </p>
5126 !! end
5128 !! test
5129 Plain link, uncapitalized
5130 !! wikitext
5131 [[main Page]]
5132 !! html
5133 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5134 </p>
5135 !! end
5137 !! test
5138 Piped link
5139 !! wikitext
5140 [[Main Page|The Main Page]]
5141 !! html
5142 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5143 </p>
5144 !! end
5146 !! test
5147 Piped link with comment in link text
5148 !! wikitext
5149 [[Main Page|The Main<!--front--> Page]]
5150 !! html
5151 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5152 </p>
5153 !! end
5155 !! test
5156 Piped link with multiple pipe characters in link text
5157 !! wikitext
5158 [[Main Page||The|Main|Page|]]
5159 !! html/php
5160 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5161 </p>
5162 !! html/parsoid
5163 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5164 !! end
5166 !! test
5167 Broken link
5168 !! wikitext
5169 [[Zigzagzogzagzig]]
5170 !! html
5171 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5172 </p>
5173 !! end
5175 !! test
5176 Broken link with fragment
5177 !! wikitext
5178 [[Zigzagzogzagzig#zug]]
5179 !! html
5180 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5181 </p>
5182 !! end
5184 !! test
5185 Special page link with fragment
5186 !! wikitext
5187 [[Special:Version#anchor]]
5188 !! html
5189 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5190 </p>
5191 !! end
5193 !! test
5194 Nonexistent special page link with fragment
5195 !! wikitext
5196 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5197 !! html
5198 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5199 </p>
5200 !! end
5202 !! test
5203 Link with prefix
5204 !! wikitext
5205 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5206 !! html
5207 <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>
5208 </p>
5209 !! end
5211 !! test
5212 Link with suffix
5213 !! wikitext
5214 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5215 !! html
5216 <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>!!!
5217 </p>
5218 !! end
5220 !! article
5221 prefixed article
5222 !! text
5223 Some text
5224 !! endarticle
5226 !! test
5227 Bug 43661: Piped links with identical prefixes
5228 !! wikitext
5229 [[prefixed article|prefixed articles with spaces]]
5231 [[prefixed article|prefixed articlesaoeu]]
5233 [[Main Page|Main Page test]]
5234 !! html
5235 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5236 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5237 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5238 </p>
5239 !! end
5242 !! test
5243 Link with HTML entity in suffix / tail
5244 !! wikitext
5245 [[Main Page]]&quot;, [[Main Page]]&#97;
5246 !! html
5247 <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;
5248 </p>
5249 !! end
5251 !! test
5252 Link with 3 brackets
5253 !! wikitext
5254 [[[Main Page]]]
5255 !! html
5256 <p>[[[Main Page]]]
5257 </p>
5258 !! end
5260 !! test
5261 Link with 4 brackets
5262 !! wikitext
5263 [[[[Main Page]]]]
5264 !! html
5265 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5266 </p>
5267 !! end
5269 !! test
5270 Piped link with 3 brackets
5271 !! wikitext
5272 [[[main page|the main page]]]
5273 !! html
5274 <p>[[[main page|the main page]]]
5275 </p>
5276 !! end
5278 !! test
5279 Piped link with extlink-like text
5280 !! wikitext
5281 [[Main Page|[bar]]]
5282 [[Main Page|This is a [bar]]]
5283 !! html
5284 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5285 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5286 </p>
5287 !! end
5289 !! test
5290 Link with multiple pipes
5291 !! wikitext
5292 [[Main Page|The|Main|Page]]
5293 !! html
5294 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5295 </p>
5296 !! end
5298 !! test
5299 Link to namespaces
5300 !! wikitext
5301 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5302 !! html
5303 <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>
5304 </p>
5305 !! end
5307 !! article
5308 MemoryAlpha:AlphaTest
5309 !! text
5310 This is an article in the MemoryAlpha namespace
5311 (which shadows the memoryalpha interwiki link).
5312 !! endarticle
5314 !! test
5315 Namespace takes precedence over interwiki link (bug 51680)
5316 !! wikitext
5317 [[MemoryAlpha:AlphaTest]]
5318 !! html
5319 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5320 </p>
5321 !! end
5323 # The previous test doesn't work correctly in html2*, due to not recognizing the
5324 # link as an internal one. This one checks for the correct behavior.
5325 !! test
5326 Link to namespace preferred over interwiki with correct rel attribute
5327 !! options
5328 parsoid=html2wt,html2html
5329 !! wikitext
5330 [[MemoryAlpha:AlphaTest]]
5331 !! html
5332 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5333 </p>
5334 !! end
5336 !! test
5337 Piped link to namespace
5338 !! wikitext
5339 [[Meta:Disclaimers|The disclaimers]]
5340 !! html
5341 <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>
5342 </p>
5343 !! end
5345 !! test
5346 Link containing }
5347 !! wikitext
5348 [[Usually caused by a typo (oops}]]
5349 !! html
5350 <p>[[Usually caused by a typo (oops}]]
5351 </p>
5352 !! end
5354 !! article
5355 7% Solution
5356 !! text
5357 Just a test of an article title containing a percent.
5358 !! endarticle
5360 !! test
5361 Link containing % (not as a hex sequence)
5362 !! wikitext
5363 [[7% Solution]]
5364 !! html/php
5365 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5366 </p>
5367 !! html/parsoid
5368 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5369 !! end
5371 # note that the parsoid HTML is identical to the previous test output,
5372 # so the previous test ensures that the html2wt mode will generate the
5373 # "not as a hex sequence" wikitext.
5374 !! test
5375 Link containing % as a single hex sequence interpreted to char
5376 !! options
5377 parsoid=wt2wt,wt2html,html2html
5378 !! wikitext
5379 [[7%25 Solution]]
5380 !! html/php
5381 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5382 </p>
5383 !! html/parsoid
5384 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5385 !!end
5387 !! test
5388 Link containing % as a double hex sequence interpreted to hex sequence
5389 !! wikitext
5390 [[7%2525 Solution]]
5391 !! html
5392 <p>[[7%2525 Solution]]
5393 </p>
5394 !!end
5396 # note that parsoid does not munge anchor text; all non-space
5397 # characters are valid in HTML5 anchors.
5398 !! test
5399 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5400 Example for such a section: == < ==
5401 !! wikitext
5402 [[%23%3c]][[%23%3e]]
5403 !! html/php
5404 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5405 </p>
5406 !! html/parsoid
5407 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5408 !! end
5410 !! test
5411 Link containing "<#" and ">#" as a hex sequences
5412 !! wikitext
5413 [[%3c%23]][[%3e%23]]
5414 !! html
5415 <p>[[%3c%23]][[%3e%23]]
5416 </p>
5417 !! end
5419 !! test
5420 Link containing an equals sign
5421 !! wikitext
5422 [[Special:BookSources/isbn=4-00-026157-6]]
5423 !! html/php
5424 <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>
5425 </p>
5426 !! html/parsoid
5427 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5428 !! end
5430 !! article
5431 Foo~bar
5432 !! text
5433 Just a test of an article title containing a tilde.
5434 !! endarticle
5436 # note that links containing signatures, like [[Foo~~~~]], are
5437 # massaged by the pre-save transform (PST) and so the tildes are never
5438 # seen by the parser.
5439 !! test
5440 Link containing a tilde
5441 !! wikitext
5442 [[Foo~bar]]
5443 !! html/php
5444 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5445 </p>
5446 !! html/parsoid
5447 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5448 !! end
5450 !! test
5451 Link containing double-single-quotes '' (bug 4598)
5452 !! wikitext
5453 [[Lista d''e paise d''o munno]]
5454 !! html/php
5455 <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>
5456 </p>
5457 !! html/parsoid
5458 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5459 !! end
5461 !! test
5462 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5463 !! wikitext
5464 Some [[Link|pretty ''italics'' and stuff]]!
5465 !! html/php
5466 <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>!
5467 </p>
5468 !! html/parsoid
5469 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5470 !! end
5472 !! test
5473 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5474 !! wikitext
5475 ''Some [[Link|pretty ''italics'' and stuff]]!''
5476 !! html
5477 <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>
5478 </p>
5479 !! end
5481 !! test
5482 Link with double quotes in title part (literal) and alternate part (interpreted)
5483 !! wikitext
5484 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5486 [[''Pentecoste'']]
5488 [[''Pentecoste''|Pentecoste]]
5490 [[''Pentecoste''|''Pentecoste'']]
5491 !! html/php
5492 <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>
5493 </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>
5494 </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>
5495 </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>
5496 </p>
5497 !! html/parsoid
5498 <meta typeof="mw:Placeholder"/>
5499 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5500 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5501 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5502 !! end
5504 !! test
5505 Broken image links with HTML captions (bug 39700)
5506 !! wikitext
5507 [[File:Nonexistent|<script></script>]]
5508 [[File:Nonexistent|100px|<script></script>]]
5509 [[File:Nonexistent|&lt;]]
5510 [[File:Nonexistent|a<i>b</i>c]]
5511 !! html
5512 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5513 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5514 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5515 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5516 </p>
5517 !! end
5519 !! test
5520 Plain link to URL
5521 !! wikitext
5522 [[http://www.example.com]]
5523 !! html/php
5524 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5525 </p>
5526 !! html/parsoid
5527 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5528 !! end
5530 !! test
5531 Plain link to URL with link text
5532 !! wikitext
5533 [[http://www.example.com Link text]]
5534 !! html
5535 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5536 </p>
5537 !! end
5539 !! test
5540 Plain link to protocol-relative URL
5541 !! wikitext
5542 [[//www.example.com]]
5543 !! html/php
5544 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5545 </p>
5546 !! html/parsoid
5547 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5548 !! end
5550 !! test
5551 Plain link to protocol-relative URL with link text
5552 !! wikitext
5553 [[//www.example.com Link text]]
5554 !! html
5555 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5556 </p>
5557 !! end
5559 !! test
5560 Plain link to page with question mark in title
5561 !! wikitext
5562 [[A?b]]
5564 [[A?b|Baz]]
5565 !! html
5566 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5567 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5568 </p>
5569 !! end
5572 # I'm fairly sure the expected result here is wrong.
5573 # We want these to be URL links, not pseudo-pages with URLs for titles....
5574 # However the current output is also pretty screwy.
5576 # ----
5577 # I'm changing it to match the current output--it arguably makes more
5578 # sense in the light of the test above. Old expected result was:
5579 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5580 #</p>
5581 # But I think this test is bordering on "garbage in, garbage out" anyway.
5582 # -- wtm
5583 !! test
5584 Piped link to URL
5585 !! wikitext
5586 Piped link to URL: [[http://www.example.com|an example URL]]
5587 !! html/php
5588 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5589 </p>
5590 !! html/parsoid
5591 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5592 !! end
5594 !! test
5595 BUG 2: [[page|http://url/]] should link to page, not http://url/
5596 !! wikitext
5597 [[Main Page|http://url/]]
5598 !! html/php
5599 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5603 !! end
5605 # Parsoid does not mark self-links, by design.
5606 !! test
5607 BUG 337: Escaped self-links should be bold
5608 !! options
5609 title=[[Bug462]]
5610 !! wikitext
5611 [[Bu&#103;462]] [[Bug462]]
5612 !! html/php
5613 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5614 </p>
5615 !! html/parsoid
5616 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
5617 !! end
5619 !! test
5620 Self-link to section should not be bold
5621 !! options
5622 title=[[Main Page]]
5623 !! wikitext
5624 [[Main Page#section]]
5625 !! html
5626 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5627 </p>
5628 !! end
5630 !! article
5632 !! text
5633 This is 00.
5634 !! endarticle
5636 !!test
5637 Self-link to numeric title
5638 !!options
5639 title=[[0]]
5640 !! wikitext
5641 [[0]]
5642 !! html
5643 <p><strong class="selflink">0</strong>
5644 </p>
5645 !!end
5647 !!test
5648 Link to numeric-equivalent title
5649 !!options
5650 title=[[0]]
5651 !! wikitext
5652 [[00]]
5653 !! html
5654 <p><a href="/wiki/00" title="00">00</a>
5655 </p>
5656 !!end
5658 !! test
5659 <nowiki> inside a link
5660 !! wikitext
5661 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5662 !! html
5663 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5664 </p>
5665 !! end
5667 !! test
5668 Non-breaking spaces in title
5669 !! wikitext
5670 [[&nbsp; Main &nbsp; Page &nbsp;]]
5671 !! html
5672 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5673 </p>
5674 !!end
5676 !! test
5677 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5678 !! options
5679 language=ca
5680 !! wikitext
5681 '''[[Main Page]]'''
5682 !! html
5683 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5684 </p>
5685 !! end
5687 !! test
5688 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5689 !! options
5690 language=ca
5691 !! wikitext
5692 ''[[Main Page]]''
5693 !! html
5694 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5695 </p>
5696 !! end
5698 !! test
5699 Internal link with en linktrail: no apostrophes (bug 27473)
5700 !! options
5701 language=en
5702 !! wikitext
5703 [[Something]]'nice
5704 !! html
5705 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5706 </p>
5707 !! end
5709 !! test
5710 Internal link with ca linktrail with apostrophes (bug 27473)
5711 !! options
5712 language=ca
5713 !! wikitext
5714 [[Something]]'nice
5715 !! html
5716 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5717 </p>
5718 !! end
5720 !! test
5721 Internal link with kaa linktrail with apostrophes (bug 27473)
5722 !! options
5723 language=kaa
5724 !! wikitext
5725 [[Something]]'nice
5726 !! html
5727 <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>
5728 </p>
5729 !! end
5731 !! test
5732 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
5733 !! wikitext
5734 [[User:Foo/Test/63636:Bar|Test]]
5735 !! html/php
5736 <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>
5737 </p>
5738 !! html/parsoid
5739 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
5740 !! end
5742 !! test
5743 1. Interaction of linktrail and template encapsulation
5744 !! options
5745 parsoid
5746 !! wikitext
5747 {{echo|[[Foo]]}}l
5748 !! html
5749 <p><a rel="mw:WikiLink" href="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
5750 !! end
5752 !! test
5753 2. Interaction of linktrail and template encapsulation
5754 !! options
5755 parsoid
5756 !! wikitext
5757 {{echo|Some [[Fool]]}}s
5758 !! html
5759 <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" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
5760 !! end
5762 !! test
5763 3. Interaction of linktrail and template encapsulation
5764 !! options
5765 parsoid
5766 !! wikitext
5767 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
5768 !! html
5769 <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" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b data-parsoid="{}">bold and foolish</b></p>
5770 !! end
5772 !! article
5773 Söfnuður
5774 !! text
5775 Test.
5776 !! endarticle
5778 !! test
5779 Internal link with is link prefix
5780 !! options
5781 language=is
5782 !! wikitext
5783 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
5784 !! html
5785 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
5786 </p>
5787 !! end
5789 !! article
5790 Mótmælendatrú
5791 !! text
5792 Test.
5793 !! endarticle
5795 !! test
5796 Internal link with is link trail and link prefix
5797 !! options
5798 language=is
5799 !! wikitext
5800 [[mótmælendatrú|xxx]]ar
5801 [[mótmælendatrú]]ar
5802 mótmælenda[[söfnuður]]
5803 mótmælenda[[söfnuður|söfnuðir]]
5804 mótmælenda[[söfnuður|söfnuðir]]xxx
5805 !! html
5806 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
5807 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
5808 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
5809 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
5810 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
5811 </p>
5812 !! end
5814 !! test
5815 Parsoid link trail escaping
5816 !! options
5817 parsoid=html2wt,html2html
5818 !! wikitext
5819 [[apple]]<nowiki/>s
5820 !! html
5821 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
5822 !! end
5824 !! test
5825 Parsoid link prefix escaping
5826 !! options
5827 language=is
5828 parsoid=html2wt,html2html
5829 !! wikitext
5830 Aðrir mótmælenda<nowiki/>[[söfnuður]]
5831 !! html
5832 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
5833 !! end
5835 !! test
5836 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
5837 !! wikitext
5838 [[Foo|  bar]]
5840 [[Foo|  ''bar'']]
5842 [http://wp.org   foo]
5844 [http://wp.org   ''foo'']
5845 !! html
5846 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
5847 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  <i>bar</i></a>
5848 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
5849 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
5850 </p>
5851 !! end
5853 !! test
5854 Parsoid: Scoped parsing should handle mixed transclusions and plain text
5855 !! options
5856 parsoid
5857 !! wikitext
5858 [[Foo|{{echo|a}} b {{echo|c}}]]
5859 !! html
5860 <p><a rel="mw:WikiLink" href="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>
5861 !! end
5864 ### Interwiki links (see maintenance/interwiki.sql)
5867 !! test
5868 Inline interwiki link
5869 !! wikitext
5870 [[MeatBall:SoftSecurity]]
5871 !! html
5872 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
5873 </p>
5874 !! end
5876 !! test
5877 Inline interwiki link with empty title (bug 2372)
5878 !! wikitext
5879 [[MeatBall:]]
5880 !! html
5881 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
5882 </p>
5883 !! end
5885 !! test
5886 Interwiki link encoding conversion (bug 1636)
5887 !! wikitext
5888 *[[Wikipedia:ro:Olteni&#0355;a]]
5889 *[[Wikipedia:ro:Olteni&#355;a]]
5890 !! html
5891 <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>
5892 <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>
5894 !! end
5896 !! test
5897 Interwiki link with fragment (bug 2130)
5898 !! wikitext
5899 [[MeatBall:SoftSecurity#foo]]
5900 !! html
5901 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
5902 </p>
5903 !! end
5905 # Ideally the wikipedia: prefix here should be proto-relative too
5906 !! test
5907 Different interwiki prefixes mapping to the same URL
5908 !! wikitext
5909 [[:en:Foo]]
5911 [[:en:Foo|Foo]]
5913 [[wikipedia:Foo]]
5915 [[:wikipedia:Foo|Foo]]
5917 [[wikipedia:en:Foo]]
5919 [[:wikipedia:en:Foo]]
5920 !! html/parsoid
5921 <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>
5923 <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>
5925 <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>
5927 <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>
5929 <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>
5931 <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>
5932 !! end
5934 !! test
5935 Interwiki links that cannot be represented in wiki syntax
5936 !! wikitext
5937 [[meatball:ok]]
5938 [[meatball:ok#foo|ok with fragment]]
5939 [[meatball:ok_as_well?|ok ending with ? mark]]
5940 [http://de.wikipedia.org/wiki/Foo?action=history has query]
5941 [http://de.wikipedia.org/wiki/#foo is just fragment]
5943 !! html/parsoid
5944 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
5945 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
5946 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
5947 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
5948 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
5949 !! end
5951 !! test
5952 Interwiki links: trail
5953 !! options
5954 parsoid
5955 !! wikitext
5956 [[wikipedia:Foo|Ba]]r
5957 !! html
5958 <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>
5959 !! end
5962 ### Interlanguage links
5963 ### Language links (so that searching for '### language' matches..)
5966 !! test
5967 Interlanguage link
5968 !! wikitext
5969 Blah blah blah
5970 [[zh:Chinese]]
5971 !! html
5972 <p>Blah blah blah
5973 </p>
5974 !! end
5976 !! test
5977 Double interlanguage link
5978 !! wikitext
5979 Blah blah blah
5980 [[es:Spanish]]
5981 [[zh:Chinese]]
5982 !! html
5983 <p>Blah blah blah
5984 </p>
5985 !! end
5987 !! test
5988 Interlanguage link, with prefix links
5989 !! options
5990 language=ln
5991 !! wikitext
5992 Blah blah blah
5993 [[zh:Chinese]]
5994 !! html
5995 <p>Blah blah blah
5996 </p>
5997 !! end
5999 !! test
6000 Double interlanguage link, with prefix links (bug 8897)
6001 !! options
6002 language=ln
6003 !! wikitext
6004 Blah blah blah
6005 [[es:Spanish]]
6006 [[zh:Chinese]]
6007 !! html
6008 <p>Blah blah blah
6009 </p>
6010 !! end
6012 !! test
6013 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6014 !! options
6015 language=ln
6016 !! wikitext
6017 [[WW&nbsp;II]]
6018 !! html
6019 <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>
6020 </p>
6021 !! end
6023 !! test
6024 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6025 !! options
6026 parsoid=html2wt
6027 !! wikitext
6028 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6030 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6031 !! html
6032 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6033 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6034 !! end
6036 !! test
6037 Parsoid: handle constructor well
6038 !! options
6039 parsoid
6040 !! wikitext
6041 [[constructor]]
6043 [[constructor:foo]]
6044 !! html
6045 <p><a rel="mw:WikiLink" href="./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>
6047 <p><a rel="mw:WikiLink" href="./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>
6048 !! end
6050 !! test
6051 Parsoid: recognize interlanguage links without a target page
6052 !! options
6053 parsoid
6054 !! wikitext
6055 [[ko:]]
6056 !! html
6058 <link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6059 !! end
6061 !! test
6062 Parsoid: recognize interwiki links without a target page
6063 !! options
6064 parsoid
6065 !! wikitext
6066 [[:ko:]]
6067 !! html
6068 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6069 !! end
6071 !! test
6072 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6073 !! options
6074 parsoid
6075 !! wikitext
6076 [[en:Foo]]
6077 !! html
6078 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6079 !! end
6082 ### Redirects, Parsoid-only
6084 !! test
6085 1. Simple redirect to page
6086 !! options
6087 parsoid
6088 !! wikitext
6089 #REDIRECT [[Main Page]]
6090 !! html
6091 <link rel="mw:PageProp/redirect" href="./Main_Page">
6092 !! end
6094 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6095 !! test
6096 2. Other redirect variants
6097 !! options
6098 parsoid=wt2html,wt2wt
6099 !! wikitext
6100 #REDIRECT [[Main_Page]]
6101 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6102 !! html
6103 <link rel="mw:PageProp/redirect" href="./Main_Page">
6104 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6105 !! end
6107 !! test
6108 Optional colon in #REDIRECT
6109 !! options
6110 # the colon is archaic syntax.  we support it for wt2html, but we
6111 # don't care that it roundtrips back to the modern syntax.
6112 parsoid=wt2html,html2html
6113 !! wikitext
6114 #REDIRECT:[[Main Page]]
6115 !! html
6116 <link rel="mw:PageProp/redirect" href="./Main_Page">
6117 !! end
6119 !! test
6120 Whitespace in #REDIRECT with optional colon
6121 !! options
6122 # the colon and gratuitous whitespace is archaic syntax.  we support
6123 # it for wt2html, but we don't care that it roundtrips back to the
6124 # modern syntax (without extra whitespace)
6125 parsoid=wt2html,html2html
6126 !! wikitext
6128  #REDIRECT 
6130 [[Main Page]]
6131 !! html
6132 <link rel="mw:PageProp/redirect" href="./Main_Page">
6133 !! end
6135 !! test
6136 Piped link in #REDIRECT
6137 !! options
6138 # content after piped link is ignored.  we support this syntax,
6139 # but don't care that the piped link is lost when we roundtrip this.
6140 parsoid=wt2html
6141 !! wikitext
6142 #REDIRECT [[Main Page|bar]]
6143 !! html
6144 <link rel="mw:PageProp/redirect" href="./Main_Page">
6145 !! end
6147 !! test
6148 Redirect to category
6149 !! options
6150 parsoid=wt2html
6151 !! wikitext
6152 #REDIRECT [[Category:Foo]]
6153 !! html
6154 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6155 !! end
6157 !! test
6158 Redirect to category with URL encoding
6159 !! options
6160 parsoid=wt2html
6161 !! wikitext
6162 #REDIRECT [[Category%3AFoo]]
6163 !! html
6164 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6165 !! end
6167 !! test
6168 Redirect to category page
6169 !! options
6170 parsoid=wt2html,html2html
6171 !! wikitext
6172 #REDIRECT [[:Category:Foo]]
6173 !! html
6174 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6175 !! end
6177 !! test
6178 Redirect to image page (1)
6179 !! options
6180 parsoid
6181 !! wikitext
6182 #REDIRECT [[File:Wiki.png]]
6183 !! html
6184 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6185 !! end
6187 !! test
6188 Redirect to image page (2)
6189 !! options
6190 parsoid
6191 !! wikitext
6192 #REDIRECT [[Image:Wiki.png]]
6193 !! html
6194 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6195 !! end
6197 !! test
6198 Redirect to language
6199 !! options
6200 parsoid
6201 !! wikitext
6202 #REDIRECT [[en:File:Wiki.png]]
6203 !! html
6204 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6205 !! end
6207 !! test
6208 Redirect to interwiki
6209 !! options
6210 parsoid
6211 !! wikitext
6212 #REDIRECT [[meatball:File:Wiki.png]]
6213 !! html
6214 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6215 !! end
6217 !! test
6218 Non-English #REDIRECT
6219 !! options
6220 parsoid
6221 language=is
6222 !! wikitext
6223 #TILVÍSUN [[Main Page]]
6224 !! html
6225 <link rel="mw:PageProp/redirect" href="./Main_Page">
6226 !! end
6228 !! test
6229 New redirect
6230 !! options
6231 parsoid=html2wt
6232 !! wikitext
6234 #REDIRECT [[Foo]]
6235 !! html
6236 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6237 !! end
6240 ## XHTML tidiness
6243 !! test
6244 <br> to <br />
6245 !! wikitext
6246 1<br>2<br />3
6247 !! html
6248 <p>1<br />2<br />3
6249 </p>
6250 !! end
6252 !! test
6253 Broken br tag sanitization
6254 !! wikitext
6255 </br>
6256 !! html/php
6257 <p>&lt;/br&gt;
6258 </p>
6259 !! end
6261 # TODO: Fix html2html mode (bug 51055)!
6262 !! test
6263 Parsoid: Broken br tag recognition
6264 !! options
6265 parsoid=wt2html
6266 !! wikitext
6267 </br>
6268 !! html/parsoid
6269 <p><br></p>
6270 !! end
6272 !! test
6273 Incorrecly removing closing slashes from correctly formed XHTML
6274 !! wikitext
6275 <br style="clear:both;" />
6276 !! html
6277 <p><br style="clear:both;" />
6278 </p>
6279 !! end
6281 !! test
6282 Failing to transform badly formed HTML into correct XHTML
6283 !! wikitext
6284 <br style="clear: left;">
6285 <br style="clear: right;">
6286 <br style="clear: both;">
6287 !! html
6288 <p><br style="clear: left;" />
6289 <br style="clear: right;" />
6290 <br style="clear: both;" />
6291 </p>
6292 !!end
6294 !! test
6295 Handling html with a div self-closing tag
6296 !! wikitext
6297 <div title />
6298 <div title/>
6299 <div title/ >
6300 <div title=bar />
6301 <div title=bar/>
6302 <div title=bar/ >
6303 !! html
6304 <p>&lt;div title /&gt;
6305 &lt;div title/&gt;
6306 </p>
6307 <div>
6308 <p>&lt;div title=bar /&gt;
6309 &lt;div title=bar/&gt;
6310 </p>
6311 <div title="bar/"></div>
6312 </div>
6314 !! end
6316 !! test
6317 Handling html with a br self-closing tag
6318 !! wikitext
6319 <br title />
6320 <br title/>
6321 <br title/ >
6322 <br title=bar />
6323 <br title=bar/>
6324 <br title=bar/ >
6325 !! html
6326 <p><br title="title" />
6327 <br title="title" />
6328 <br />
6329 <br title="bar" />
6330 <br title="bar" />
6331 <br title="bar/" />
6332 </p>
6333 !! end
6335 !! test
6336 Horizontal ruler (should it add that extra space?)
6337 !! wikitext
6338 <hr>
6339 <hr >
6340 foo <hr
6341 > bar
6342 !! html
6343 <hr />
6344 <hr />
6345 foo <hr /> bar
6347 !! end
6349 !! test
6350 Horizontal ruler -- 4+ dashes render hr
6351 !! wikitext
6352 ----
6353 !! html
6354 <hr />
6356 !! end
6358 !! test
6359 Horizontal ruler -- eats additional dashes on the same line
6360 !! wikitext
6361 ---------
6362 !! html
6363 <hr />
6365 !! end
6367 !! test
6368 Horizontal ruler -- does not collapse dashes on consecutive lines
6369 !! wikitext
6370 ----
6371 ----
6372 !! html
6373 <hr />
6374 <hr />
6376 !! end
6378 !! test
6379 Horizontal ruler -- <4 dashes render as plain text
6380 !! wikitext
6382 !! html
6383 <p>---
6384 </p>
6385 !! end
6387 !! test
6388 Horizontal ruler -- Supports content following dashes on same line
6389 !! wikitext
6390 ---- Foo
6391 !! html
6392 <hr /> Foo
6394 !! end
6397 ### Block-level elements
6399 !! test
6400 Common list
6401 !! wikitext
6402 *Common list
6403 * item 2
6404 *item 3
6405 !! html
6406 <ul><li>Common list</li>
6407 <li> item 2</li>
6408 <li>item 3</li></ul>
6410 !! end
6412 !! test
6413 Numbered list
6414 !! wikitext
6415 #Numbered list
6416 #item 2
6417 # item 3
6418 !! html
6419 <ol><li>Numbered list</li>
6420 <li>item 2</li>
6421 <li> item 3</li></ol>
6423 !! end
6425 !! test
6426 Mixed list
6427 !! wikitext
6428 *Mixed list
6429 *# with numbers
6430 ** and bullets
6431 *# and numbers
6432 *bullets again
6433 **bullet level 2
6434 ***bullet level 3
6435 ***#Number on level 4
6436 **bullet level 2
6437 **#Number on level 3
6438 **#Number on level 3
6439 *#number level 2
6440 *Level 1
6441 *** Level 3
6442 #** Level 3, but ordered
6443 !! html
6444 <ul><li>Mixed list
6445 <ol><li> with numbers</li></ol>
6446 <ul><li> and bullets</li></ul>
6447 <ol><li> and numbers</li></ol></li>
6448 <li>bullets again
6449 <ul><li>bullet level 2
6450 <ul><li>bullet level 3
6451 <ol><li>Number on level 4</li></ol></li></ul></li>
6452 <li>bullet level 2
6453 <ol><li>Number on level 3</li>
6454 <li>Number on level 3</li></ol></li></ul>
6455 <ol><li>number level 2</li></ol></li>
6456 <li>Level 1
6457 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6458 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6460 !! end
6462 !! test
6463 Nested lists 1
6464 !! wikitext
6465 *foo
6466 **bar
6467 !! html
6468 <ul><li>foo
6469 <ul><li>bar</li></ul></li></ul>
6471 !! end
6473 !! test
6474 Nested lists 2
6475 !! wikitext
6476 **foo
6477 *bar
6478 !! html
6479 <ul><li><ul><li>foo</li></ul></li>
6480 <li>bar</li></ul>
6482 !! end
6484 !! test
6485 Nested lists 3 (first element empty)
6486 !! wikitext
6488 **bar
6489 !! html
6490 <ul><li>
6491 <ul><li>bar</li></ul></li></ul>
6493 !! end
6495 !! test
6496 Nested lists 4 (first element empty)
6497 !! wikitext
6499 *bar
6500 !! html
6501 <ul><li><ul><li></li></ul></li>
6502 <li>bar</li></ul>
6504 !! end
6506 !! test
6507 Nested lists 5 (both elements empty)
6508 !! wikitext
6511 !! html
6512 <ul><li><ul><li></li></ul></li>
6513 <li></li></ul>
6515 !! end
6517 !! test
6518 Nested lists 6 (both elements empty)
6519 !! wikitext
6522 !! html
6523 <ul><li>
6524 <ul><li></li></ul></li></ul>
6526 !! end
6528 !! test
6529 Nested lists 7 (skip initial nesting levels)
6530 !! wikitext
6531 *** foo
6532 !! html
6533 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6535 !! end
6537 !! test
6538 Nested lists 8 (multiple nesting transitions)
6539 !! wikitext
6540 * foo
6541 *** bar
6542 ** baz
6543 * boo
6544 !! html
6545 <ul><li> foo
6546 <ul><li><ul><li> bar</li></ul></li>
6547 <li> baz</li></ul></li>
6548 <li> boo</li></ul>
6550 !! end
6552 !! test
6553 1. Lists with start-of-line-transparent tokens before bullets: Comments
6554 !! wikitext
6555 *foo
6556 *<!--cmt-->bar
6557 <!--cmt-->*baz
6558 !! html
6559 <ul><li>foo</li>
6560 <li>bar</li>
6561 <li>baz</li></ul>
6563 !! end
6565 !! test
6566 2. Lists with start-of-line-transparent tokens before bullets: Template close
6567 !! wikitext
6568 *foo {{echo|bar
6569 }}*baz
6570 !! html
6571 <ul><li>foo bar</li>
6572 <li>baz</li></ul>
6574 !! end
6576 !! test
6577 List items are not parsed correctly following a <pre> block (bug 785)
6578 !! wikitext
6579 * <pre>foo</pre>
6580 * <pre>bar</pre>
6581 * zar
6582 !! html
6583 <ul><li> <pre>foo</pre></li>
6584 <li> <pre>bar</pre></li>
6585 <li> zar</li></ul>
6587 !! end
6589 !! test
6590 List items from template
6591 !! wikitext
6593 {{inner list}}
6594 * item 2
6596 * item 0
6597 {{inner list}}
6598 * item 2
6600 * item 0
6601 * notSOL{{inner list}}
6602 * item 2
6603 !! html
6604 <ul><li> item 1</li>
6605 <li> item 2</li></ul>
6606 <ul><li> item 0</li>
6607 <li> item 1</li>
6608 <li> item 2</li></ul>
6609 <ul><li> item 0</li>
6610 <li> notSOL</li>
6611 <li> item 1</li>
6612 <li> item 2</li></ul>
6614 !! end
6616 !! test
6617 List interrupted by empty line or heading
6618 !! wikitext
6619 * foo
6621 ** bar
6622 == A heading ==
6623 * Another list item
6624 !! html
6625 <ul><li> foo</li></ul>
6626 <ul><li><ul><li> bar</li></ul></li></ul>
6627 <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>
6628 <ul><li> Another list item</li></ul>
6630 !!end
6632 !!test
6633 Multiple list tags generated by templates
6634 !! wikitext
6635 {{echo|<li>}}a
6636 {{echo|<li>}}b
6637 {{echo|<li>}}c
6638 !! html
6639 <li>a
6640 <li>b
6641 <li>c</li>
6642 </li>
6643 </li>
6645 !!end
6647 !!test
6648 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6649 !! wikitext
6651 <!--This line will NOT split the list-->
6653  <!--This line will NOT split the list either-->
6655  <!--foo--> <!----> <!--This line NOT split the list either--> 
6657 !! html
6658 <ul><li>a</li>
6659 <li>b</li>
6660 <li>c</li>
6661 <li>d</li></ul>
6663 !!end
6665 !!test
6666 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6667 !! wikitext
6669 <!--This line will NOT split the list-->        
6671         <!--This line will NOT split the list either-->         
6673         <!--foo--> <!---->      <!--This line NOT split the list
6674         either-->        
6676 !! html
6677 <ul><li>a</li>
6678 <li>b</li>
6679 <li>c</li>
6680 <li>d</li></ul>
6682 !!end
6684 !!test
6685 Test the li-hack
6686 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6687 !!options
6688 parsoid=wt2html,wt2wt
6689 !! wikitext
6690 * foo
6691 * <li>li-hack
6692 * {{echo|<li>templated li-hack}}
6693 * <!--foo--> <li> unsupported li-hack with preceding comments
6695 <ul>
6696 <li><li>not a li-hack
6697 </li>
6698 </ul>
6699 !! html
6700 <ul>
6701 <li> foo</li>
6702 <li>li-hack</li>
6703 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}}]}'>templated li-hack</li>
6704 <li> <!--foo--> </li>
6705 <li> li-hack with preceding comments</li>
6706 </ul>
6708 <ul>
6709 <li></li>
6710 <li>not a li-hack
6711 </li>
6712 </ul>
6713 !!end
6715 !! test
6716 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6717 !! options
6718 parsoid
6719 !! wikitext
6720 # foo
6721 ## bar
6722 * foo
6723 ** bar
6724 : foo
6725 :: bar
6726 !! html
6727 <ol>
6728 <li> foo<ol>
6729 <li> bar</li>
6730 </ol></li>
6731 </ol><ul>
6732 <li> foo<ul>
6733 <li> bar</li>
6734 </ul></li>
6735 </ul><dl>
6736 <dd> foo<dl>
6737 <dd> bar</dd>
6738 </dl></dd>
6739 </dl>
6740 !! end
6742 !! test
6743 Parsoid: Test of whitespace serialization with Templated bullets
6744 !! options
6745 parsoid
6746 !! wikitext
6747 * {{bullet}}
6748 !! html
6749 <ul>
6750 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
6751 </ul>
6752 !! end
6754 # ------------------------------------------------------------------------
6755 # The next set of tests are about Parsoid's ability to handle badly nested
6756 # tags (parse, minimize scope of fixup, and roundtrip back)
6757 # ------------------------------------------------------------------------
6759 !! test
6760 Unbalanced closing block tags break a list
6761 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6762 !! wikitext
6763 <div>
6764 *a</div><div>
6765 *b</div>
6766 !! html/parsoid
6767 <div>
6768 <ul>
6769 <li>a
6770 </li>
6771 </ul></div><div>
6772 <ul>
6773 <li>b
6774 </li>
6775 </ul></div>
6776 !! end
6778 !! test
6779 Unbalanced closing non-block tags don't break a list
6780 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6781 !! wikitext
6782 <span>
6783 *a</span><span>
6784 *b</span>
6785 !! html/parsoid
6786 <p><span></span>
6787 </p>
6788 <ul>
6789 <li>a<span></span>
6790 </li>
6791 <li>b
6792 </li>
6793 </ul>
6794 !! end
6796 !! test
6797 Unclosed formatting tags that straddle lists are closed and reopened
6798 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
6799 !! wikitext
6800 # <s> a
6801 # b </s>
6802 !! html/parsoid
6803 <ol>
6804 <li> <s> a </s>
6805 </li>
6806 <li> <s> b </s>
6807 </li>
6808 </ol>
6809 !! end
6811 !!test
6812 List embedded in a non-block tag
6813 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
6814 !! wikitext
6815 <small>
6816 * foo
6817 </small>
6818 !! html/parsoid
6819 <p><small></small></p>
6820 <small>
6821 <ul>
6822 <li> foo</li>
6823 </ul>
6824 </small>
6825 <p><small></small></p>
6826 !!end
6828 !! test
6829 Table with missing opening <tr> tag
6830 !! options
6831 parsoid=wt2html,wt2wt
6832 !! wikitext
6833 <table>
6834 <td>foo</td>
6835 </tr>
6836 </table>
6837 !! html/parsoid
6838 <table>
6839 <tr>
6840 <td>foo</td>
6841 </tr>
6842 </table>
6843 !! end
6846 ### Magic Words
6849 # Note that the current date is hard-coded as
6850 #   1970-01-01T00:02:03Z (a Thursday)
6851 # when running parser tests.  The timezone is also fixed to GMT, so
6852 # local date will be identical to current date.
6854 !! test
6855 Magic Word: {{CURRENTDAY}}
6856 !! wikitext
6857 {{CURRENTDAY}}
6858 !! html
6859 <p>1
6860 </p>
6861 !! end
6863 !! test
6864 Magic Word: {{CURRENTDAY2}}
6865 !! wikitext
6866 {{CURRENTDAY2}}
6867 !! html
6868 <p>01
6869 </p>
6870 !! end
6872 !! test
6873 Magic Word: {{CURRENTDAYNAME}}
6874 !! wikitext
6875 {{CURRENTDAYNAME}}
6876 !! html
6877 <p>Thursday
6878 </p>
6879 !! end
6881 !! test
6882 Magic Word: {{CURRENTDOW}}
6883 !! wikitext
6884 {{CURRENTDOW}}
6885 !! html
6886 <p>4
6887 </p>
6888 !! end
6890 !! test
6891 Magic Word: {{CURRENTMONTH}}
6892 !! wikitext
6893 {{CURRENTMONTH}}
6894 !! html
6895 <p>01
6896 </p>
6897 !! end
6899 !! test
6900 Magic Word: {{CURRENTMONTH1}}
6901 !! wikitext
6902 {{CURRENTMONTH1}}
6903 !! html
6904 <p>1
6905 </p>
6906 !! end
6908 !! test
6909 Magic Word: {{CURRENTMONTHABBREV}}
6910 !! wikitext
6911 {{CURRENTMONTHABBREV}}
6912 !! html
6913 <p>Jan
6914 </p>
6915 !! end
6917 !! test
6918 Magic Word: {{CURRENTMONTHNAME}}
6919 !! wikitext
6920 {{CURRENTMONTHNAME}}
6921 !! html
6922 <p>January
6923 </p>
6924 !! end
6926 !! test
6927 Magic Word: {{CURRENTMONTHNAMEGEN}}
6928 !! wikitext
6929 {{CURRENTMONTHNAMEGEN}}
6930 !! html
6931 <p>January
6932 </p>
6933 !! end
6935 !! test
6936 Magic Word: {{CURRENTTIME}}
6937 !! wikitext
6938 {{CURRENTTIME}}
6939 !! html
6940 <p>00:02
6941 </p>
6942 !! end
6944 !! test
6945 Magic Word: {{CURRENTHOUR}}
6946 !! wikitext
6947 {{CURRENTHOUR}}
6948 !! html
6949 <p>00
6950 </p>
6951 !! end
6953 !! test
6954 Magic Word: {{CURRENTWEEK}} (@bug 4594)
6955 !! wikitext
6956 {{CURRENTWEEK}}
6957 !! html
6958 <p>1
6959 </p>
6960 !! end
6962 !! test
6963 Magic Word: {{CURRENTYEAR}}
6964 !! wikitext
6965 {{CURRENTYEAR}}
6966 !! html
6967 <p>1970
6968 </p>
6969 !! end
6971 !! test
6972 Magic Word: {{CURRENTTIMESTAMP}}
6973 !! wikitext
6974 {{CURRENTTIMESTAMP}}
6975 !! html
6976 <p>19700101000203
6977 </p>
6978 !! end
6980 !! test
6981 Magic Words LOCAL (UTC)
6982 !! wikitext
6983 * {{LOCALMONTH}}
6984 * {{LOCALMONTH1}}
6985 * {{LOCALMONTHNAME}}
6986 * {{LOCALMONTHNAMEGEN}}
6987 * {{LOCALMONTHABBREV}}
6988 * {{LOCALDAY}}
6989 * {{LOCALDAY2}}
6990 * {{LOCALDAYNAME}}
6991 * {{LOCALYEAR}}
6992 * {{LOCALTIME}}
6993 * {{LOCALHOUR}}
6994 * {{LOCALWEEK}}
6995 * {{LOCALDOW}}
6996 * {{LOCALTIMESTAMP}}
6997 !! html
6998 <ul><li> 01</li>
6999 <li> 1</li>
7000 <li> January</li>
7001 <li> January</li>
7002 <li> Jan</li>
7003 <li> 1</li>
7004 <li> 01</li>
7005 <li> Thursday</li>
7006 <li> 1970</li>
7007 <li> 00:02</li>
7008 <li> 00</li>
7009 <li> 1</li>
7010 <li> 4</li>
7011 <li> 19700101000203</li></ul>
7013 !! end
7015 !! test
7016 Magic Word: {{FULLPAGENAME}}
7017 !! options
7018 title=[[User:Ævar Arnfjörð Bjarmason]]
7019 !! wikitext
7020 {{FULLPAGENAME}}
7021 !! html
7022 <p>User:Ævar Arnfjörð Bjarmason
7023 </p>
7024 !! end
7026 !! test
7027 Magic Word: {{FULLPAGENAMEE}}
7028 !! options
7029 title=[[User:Ævar Arnfjörð Bjarmason]]
7030 !! wikitext
7031 {{FULLPAGENAMEE}}
7032 !! html
7033 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7034 </p>
7035 !! end
7037 !! test
7038 Magic Word: {{TALKSPACE}}
7039 !! options
7040 title=[[User:Ævar Arnfjörð Bjarmason]]
7041 !! wikitext
7042 {{TALKSPACE}}
7043 !! html
7044 <p>User talk
7045 </p>
7046 !! end
7048 !! test
7049 Magic Word: {{TALKSPACE}}, same namespace
7050 !! options
7051 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7052 !! wikitext
7053 {{TALKSPACE}}
7054 !! html
7055 <p>User talk
7056 </p>
7057 !! end
7059 !! test
7060 Magic Word: {{TALKSPACE}}, main namespace
7061 !! options
7062 title=[[Parser Test]]
7063 !! wikitext
7064 {{TALKSPACE}}
7065 !! html
7066 <p>Talk
7067 </p>
7068 !! end
7070 !! test
7071 Magic Word: {{TALKSPACEE}}
7072 !! options
7073 title=[[User:Ævar Arnfjörð Bjarmason]]
7074 !! wikitext
7075 {{TALKSPACEE}}
7076 !! html
7077 <p>User_talk
7078 </p>
7079 !! end
7081 !! test
7082 Magic Word: {{SUBJECTSPACE}}
7083 !! options
7084 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7085 !! wikitext
7086 {{SUBJECTSPACE}}
7087 !! html
7088 <p>User
7089 </p>
7090 !! end
7092 !! test
7093 Magic Word: {{SUBJECTSPACE}}, same namespace
7094 !! options
7095 title=[[User:Ævar Arnfjörð Bjarmason]]
7096 !! wikitext
7097 {{SUBJECTSPACE}}
7098 !! html
7099 <p>User
7100 </p>
7101 !! end
7103 !! test
7104 Magic Word: {{SUBJECTSPACE}}, main namespace
7105 !! options
7106 title=[[Parser Test]]
7107 !! wikitext
7108 {{SUBJECTSPACE}}
7109 !! html
7111 !! end
7113 !! test
7114 Magic Word: {{SUBJECTSPACEE}}
7115 !! options
7116 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7117 !! wikitext
7118 {{SUBJECTSPACEE}}
7119 !! html
7120 <p>User
7121 </p>
7122 !! end
7124 !! test
7125 Magic Word: {{NAMESPACE}}
7126 !! options
7127 title=[[User:Ævar Arnfjörð Bjarmason]]
7128 !! wikitext
7129 {{NAMESPACE}}
7130 !! html
7131 <p>User
7132 </p>
7133 !! end
7135 !! test
7136 Magic Word: {{NAMESPACEE}}
7137 !! options
7138 title=[[User:Ævar Arnfjörð Bjarmason]]
7139 !! wikitext
7140 {{NAMESPACEE}}
7141 !! html
7142 <p>User
7143 </p>
7144 !! end
7146 !! test
7147 Magic Word: {{NAMESPACENUMBER}}
7148 !! options
7149 title=[[User:Ævar Arnfjörð Bjarmason]]
7150 !! wikitext
7151 {{NAMESPACENUMBER}}
7152 !! html
7153 <p>2
7154 </p>
7155 !! end
7157 !! test
7158 Magic Word: {{SUBPAGENAME}}
7159 !! options
7160 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7161 !! wikitext
7162 {{SUBPAGENAME}}
7163 !! html
7164 <p>sub ö
7165 </p>
7166 !! end
7168 !! test
7169 Magic Word: {{SUBPAGENAMEE}}
7170 !! options
7171 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7172 !! wikitext
7173 {{SUBPAGENAMEE}}
7174 !! html
7175 <p>sub_%C3%B6
7176 </p>
7177 !! end
7179 !! test
7180 Magic Word: {{ROOTPAGENAME}}
7181 !! options
7182 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7183 !! wikitext
7184 {{ROOTPAGENAME}}
7185 !! html
7186 <p>Ævar Arnfjörð Bjarmason
7187 </p>
7188 !! end
7190 !! test
7191 Magic Word: {{ROOTPAGENAMEE}}
7192 !! options
7193 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7194 !! wikitext
7195 {{ROOTPAGENAMEE}}
7196 !! html
7197 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7198 </p>
7199 !! end
7201 !! test
7202 Magic Word: {{BASEPAGENAME}}
7203 !! options
7204 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7205 !! wikitext
7206 {{BASEPAGENAME}}
7207 !! html
7208 <p>Ævar Arnfjörð Bjarmason
7209 </p>
7210 !! end
7212 !! test
7213 Magic Word: {{BASEPAGENAMEE}}
7214 !! options
7215 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7216 !! wikitext
7217 {{BASEPAGENAMEE}}
7218 !! html
7219 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7220 </p>
7221 !! end
7223 !! test
7224 Magic Word: {{TALKPAGENAME}}
7225 !! options
7226 title=[[User:Ævar Arnfjörð Bjarmason]]
7227 !! wikitext
7228 {{TALKPAGENAME}}
7229 !! html
7230 <p>User talk:Ævar Arnfjörð Bjarmason
7231 </p>
7232 !! end
7234 !! test
7235 Magic Word: {{TALKPAGENAMEE}}
7236 !! options
7237 title=[[User:Ævar Arnfjörð Bjarmason]]
7238 !! wikitext
7239 {{TALKPAGENAMEE}}
7240 !! html
7241 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7242 </p>
7243 !! end
7245 !! test
7246 Magic Word: {{SUBJECTPAGENAME}}
7247 !! options
7248 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7249 !! wikitext
7250 {{SUBJECTPAGENAME}}
7251 !! html
7252 <p>User:Ævar Arnfjörð Bjarmason
7253 </p>
7254 !! end
7256 !! test
7257 Magic Word: {{SUBJECTPAGENAMEE}}
7258 !! options
7259 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7260 !! wikitext
7261 {{SUBJECTPAGENAMEE}}
7262 !! html
7263 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7264 </p>
7265 !! end
7267 !! test
7268 Magic Word: {{NUMBEROFFILES}}
7269 !! wikitext
7270 {{NUMBEROFFILES}}
7271 !! html
7272 <p>5
7273 </p>
7274 !! end
7276 !! test
7277 Magic Word: {{PAGENAME}}
7278 !! options
7279 title=[[User:Ævar Arnfjörð Bjarmason]]
7280 !! wikitext
7281 {{PAGENAME}}
7282 !! html
7283 <p>Ævar Arnfjörð Bjarmason
7284 </p>
7285 !! end
7287 !! test
7288 Magic Word: {{PAGENAME}} with metacharacters
7289 !! options
7290 title=[['foo & bar = baz']]
7291 !! wikitext
7292 ''{{PAGENAME}}''
7293 !! html
7294 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7295 </p>
7296 !! end
7298 !! test
7299 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7300 !! options
7301 title=[[*RFC 1234 http://example.com/]]
7302 !! wikitext
7303 {{PAGENAME}}
7304 !! html
7305 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7306 </p>
7307 !! end
7309 !! test
7310 Magic Word: {{PAGENAMEE}}
7311 !! options
7312 title=[[User:Ævar Arnfjörð Bjarmason]]
7313 !! wikitext
7314 {{PAGENAMEE}}
7315 !! html
7316 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7317 </p>
7318 !! end
7320 !! test
7321 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7322 !! options
7323 title=[[*RFC 1234 http://example.com/]]
7324 !! wikitext
7325 {{PAGENAMEE}}
7326 !! html
7327 <p>&#42;RFC_1234_http&#58;//example.com/
7328 </p>
7329 !! end
7331 !! test
7332 Magic Word: {{REVISIONID}}
7333 !! wikitext
7334 {{REVISIONID}}
7335 !! html
7336 <p>1337
7337 </p>
7338 !! end
7340 !! test
7341 Magic Word: {{SCRIPTPATH}}
7342 !! wikitext
7343 {{SCRIPTPATH}}
7344 !! html
7345 <p>/
7346 </p>
7347 !! end
7349 !! test
7350 Magic Word: {{STYLEPATH}}
7351 !! wikitext
7352 {{STYLEPATH}}
7353 !! html
7354 <p>/skins
7355 </p>
7356 !! end
7358 !! test
7359 Magic Word: {{SERVER}}
7360 !! wikitext
7361 {{SERVER}}
7362 !! html
7363 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7364 </p>
7365 !! end
7367 !! test
7368 Magic Word: {{SERVERNAME}}
7369 !! wikitext
7370 {{SERVERNAME}}
7371 !! html
7372 <p>example.org
7373 </p>
7374 !! end
7376 !! test
7377 Magic Word: {{SITENAME}}
7378 !! wikitext
7379 {{SITENAME}}
7380 !! html
7381 <p>MediaWiki
7382 </p>
7383 !! end
7385 !! test
7386 Case-sensitive magic words, when cased differently, should just be template transclusions
7387 !! wikitext
7388 {{CurrentMonth}}
7389 {{currentday}}
7390 {{cURreNTweEK}}
7391 {{currentHour}}
7392 !! html
7393 <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>
7394 <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>
7395 <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>
7396 <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>
7397 </p>
7398 !! end
7400 !! test
7401 Case-insensitive magic words should still work with weird casing.
7402 !! wikitext
7403 {{sErVeRNaMe}}
7404 {{LCFirst:AOEU}}
7405 {{ucFIRST:aoeu}}
7406 {{SERver}}
7407 !! html
7408 <p>example.org
7409 aOEU
7410 Aoeu
7411 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7412 </p>
7413 !! end
7415 !! test
7416 Namespace 1 {{ns:1}}
7417 !! wikitext
7418 {{ns:1}}
7419 !! html
7420 <p>Talk
7421 </p>
7422 !! end
7424 !! test
7425 Namespace 1 {{ns:01}}
7426 !! wikitext
7427 {{ns:01}}
7428 !! html
7429 <p>Talk
7430 </p>
7431 !! end
7433 !! test
7434 Namespace 0 {{ns:0}} (bug 4783)
7435 !! wikitext
7436 {{ns:0}}
7437 !! html
7439 !! end
7441 !! test
7442 Namespace 0 {{ns:00}} (bug 4783)
7443 !! wikitext
7444 {{ns:00}}
7445 !! html
7447 !! end
7449 !! test
7450 Namespace -1 {{ns:-1}}
7451 !! wikitext
7452 {{ns:-1}}
7453 !! html
7454 <p>Special
7455 </p>
7456 !! end
7458 !! test
7459 Namespace User {{ns:User}}
7460 !! wikitext
7461 {{ns:User}}
7462 !! html
7463 <p>User
7464 </p>
7465 !! end
7467 !! test
7468 Namespace User talk {{ns:User_talk}}
7469 !! wikitext
7470 {{ns:User_talk}}
7471 !! html
7472 <p>User talk
7473 </p>
7474 !! end
7476 !! test
7477 Namespace User talk {{ns:uSeR tAlK}}
7478 !! wikitext
7479 {{ns:uSeR tAlK}}
7480 !! html
7481 <p>User talk
7482 </p>
7483 !! end
7485 !! test
7486 Namespace File {{ns:File}}
7487 !! wikitext
7488 {{ns:File}}
7489 !! html
7490 <p>File
7491 </p>
7492 !! end
7494 !! test
7495 Namespace File {{ns:Image}}
7496 !! wikitext
7497 {{ns:Image}}
7498 !! html
7499 <p>File
7500 </p>
7501 !! end
7503 !! test
7504 Namespace (lang=de) Benutzer {{ns:User}}
7505 !! options
7506 language=de
7507 !! wikitext
7508 {{ns:User}}
7509 !! html
7510 <p>Benutzer
7511 </p>
7512 !! end
7514 !! test
7515 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7516 !! options
7517 language=de
7518 !! wikitext
7519 {{ns:3}}
7520 !! html
7521 <p>Benutzer Diskussion
7522 </p>
7523 !! end
7526 !! test
7527 Urlencode
7528 !! wikitext
7529 {{urlencode:hi world?!}}
7530 {{urlencode:hi world?!|WIKI}}
7531 {{urlencode:hi world?!|PATH}}
7532 {{urlencode:hi world?!|QUERY}}
7533 !! html
7534 <p>hi+world%3F%21
7535 hi_world%3F!
7536 hi%20world%3F%21
7537 hi+world%3F%21
7538 </p>
7539 !! end
7541 !! test
7542 Magic Word: prioritize type info over data-parsoid
7543 !! options
7544 parsoid=html2wt
7545 !! wikitext
7546 __FORCETOC__
7547 !! html
7548 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7549 !! end
7551 !! test
7552 Magic Word: serialize on separate line (parsoid)
7553 !! options
7554 parsoid=wt2wt,html2wt
7555 !! wikitext
7557 __NOTOC__
7559 !! html
7560 foo<meta property="mw:PageProp/notoc"/>bar
7561 !! end
7563 !! test
7564 Magic Word: rt non-english wikis
7565 !! options
7566 parsoid=wt2wt
7567 language=de
7568 !! wikitext
7569 __NOEDITSECTION__
7570 !! html
7571 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7572 !! end
7575 ### Magic links
7577 !! test
7578 Magic links: internal link to RFC (bug 479)
7579 !! wikitext
7580 [[RFC 123]]
7581 !! html
7582 <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>
7583 </p>
7584 !! end
7586 !! test
7587 Magic links: RFC (bug 479)
7588 !! wikitext
7589 RFC 822
7590 !! html
7591 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7592 </p>
7593 !! end
7595 !! test
7596 Magic links: ISBN (bug 1937)
7597 !! wikitext
7598 ISBN 0-306-40615-2
7599 !! html
7600 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7601 </p>
7602 !! end
7604 !! test
7605 Magic links: PMID incorrectly converts space to underscore
7606 !! wikitext
7607 PMID 1234
7608 !! html
7609 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7610 </p>
7611 !! end
7614 ### Templates
7615 ####
7617 !! test
7618 Nonexistent template
7619 !! wikitext
7620 {{thistemplatedoesnotexist}}
7621 !! html
7622 <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>
7623 </p>
7624 !! end
7626 !! test
7627 Template with invalid target containing tags
7628 !! wikitext
7629 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7630 !! html
7631 <p>{{a<b>b</b>|foo|a=b|a = b}}
7632 </p>
7633 !! end
7635 !! test
7636 Template with invalid target containing unclosed tag
7637 !! wikitext
7638 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7639 !! html
7640 <p>{{a<b>|foo|a=b|a = b}}</b>
7641 </p>
7642 !! end
7644 !! test
7645 Template with invalid target containing wikilink
7646 !! wikitext
7647 {{[[Main Page]]}}
7648 !! html/php
7649 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7650 </p>
7651 !! html/parsoid
7652 <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>
7653 !! end
7655 !! article
7656 Template:test
7657 !! text
7658 This is a test template
7659 !! endarticle
7661 !! test
7662 Simple template
7663 !! wikitext
7664 {{test}}
7665 !! html
7666 <p>This is a test template
7667 </p>
7668 !! end
7670 !! test
7671 Template with explicit namespace
7672 !! wikitext
7673 {{Template:test}}
7674 !! html
7675 <p>This is a test template
7676 </p>
7677 !! end
7680 !! article
7681 Template:paramtest
7682 !! text
7683 This is a test template with parameter {{{param}}}
7684 !! endarticle
7686 !! test
7687 Template parameter
7688 !! wikitext
7689 {{paramtest|param=foo}}
7690 !! html
7691 <p>This is a test template with parameter foo
7692 </p>
7693 !! end
7695 !! article
7696 Template:paramtestnum
7697 !! text
7698 [[{{{1}}}|{{{2}}}]]
7699 !! endarticle
7701 !! test
7702 Template unnamed parameter
7703 !! wikitext
7704 {{paramtestnum|Main Page|the main page}}
7705 !! html
7706 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7707 </p>
7708 !! end
7710 !! article
7711 Template:templatesimple
7712 !! text
7713 (test)
7714 !! endarticle
7716 !! article
7717 Template:templateredirect
7718 !! text
7719 #redirect [[Template:templatesimple]]
7720 !! endarticle
7722 !! article
7723 Template:templateasargtestnum
7724 !! text
7725 {{{{{1}}}}}
7726 !! endarticle
7728 !! article
7729 Template:templateasargtest
7730 !! text
7731 {{template{{{templ}}}}}
7732 !! endarticle
7734 !! article
7735 Template:templateasargtest2
7736 !! text
7737 {{{{{templ}}}}}
7738 !! endarticle
7740 !! test
7741 Template with template name as unnamed argument
7742 !! wikitext
7743 {{templateasargtestnum|templatesimple}}
7744 !! html
7745 <p>(test)
7746 </p>
7747 !! end
7749 !! test
7750 Template with template name as argument
7751 !! wikitext
7752 {{templateasargtest|templ=simple}}
7753 !! html
7754 <p>(test)
7755 </p>
7756 !! end
7758 !! test
7759 Template with template name as argument (2)
7760 !! wikitext
7761 {{templateasargtest2|templ=templatesimple}}
7762 !! html
7763 <p>(test)
7764 </p>
7765 !! end
7767 !! article
7768 Template:templateasargtestdefault
7769 !! text
7770 {{{{{templ|templatesimple}}}}}
7771 !! endarticle
7773 !! article
7774 Template:templa
7775 !! text
7776 '''templ'''
7777 !! endarticle
7779 !! test
7780 Template with default value
7781 !! wikitext
7782 {{templateasargtestdefault}}
7783 !! html
7784 <p>(test)
7785 </p>
7786 !! end
7788 !! test
7789 Template with default value (value set)
7790 !! wikitext
7791 {{templateasargtestdefault|templ=templa}}
7792 !! html
7793 <p><b>templ</b>
7794 </p>
7795 !! end
7797 !! test
7798 Template redirect
7799 !! wikitext
7800 {{templateredirect}}
7801 !! html
7802 <p>(test)
7803 </p>
7804 !! end
7806 !! test
7807 Template with argument in separate line
7808 !! wikitext
7809 {{ templateasargtest  |
7810  templ = simple }}
7811 !! html
7812 <p>(test)
7813 </p>
7814 !! end
7816 !! test
7817 Template with complex template as argument
7818 !! wikitext
7819 {{paramtest|
7820   param ={{ templateasargtest  |
7821  templ = simple }}}}
7822 !! html
7823 <p>This is a test template with parameter (test)
7824 </p>
7825 !! end
7827 !! test
7828 Template with thumb image (with link in description)
7829 !! wikitext
7830 {{paramtest|
7831   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
7832 !! html
7833 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>
7835 !! end
7837 !! article
7838 Template:complextemplate
7839 !! text
7840 {{{1}}} {{paramtest|
7841   param ={{{param}}}}}
7842 !! endarticle
7844 !! test
7845 Template with complex arguments
7846 !! wikitext
7847 {{complextemplate|
7848   param ={{ templateasargtest  |
7849  templ = simple }}|[[Template:complextemplate|link]]}}
7850 !! html
7851 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
7852 </p>
7853 !! end
7855 !! test
7856 BUG 553: link with two variables in a piped link
7857 !! wikitext
7859 |[[{{{1}}}|{{{2}}}]]
7861 !! html
7862 <table>
7863 <tr>
7864 <td>[[{{{1}}}|{{{2}}}]]
7865 </td></tr></table>
7867 !! end
7869 !! test
7870 Magic variable as template parameter
7871 !! wikitext
7872 {{paramtest|param={{SITENAME}}}}
7873 !! html
7874 <p>This is a test template with parameter MediaWiki
7875 </p>
7876 !! end
7878 !! article
7879 Template:linktest
7880 !! text
7881 [[{{{param}}}|link]]
7882 !! endarticle
7884 !! test
7885 Template parameter as link source
7886 !! wikitext
7887 {{linktest|param=Main Page}}
7888 !! html
7889 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
7890 </p>
7891 !! end
7893 !!test
7894 Template-generated attribute string (k='v')
7895 !! wikitext
7896 <span {{attr_str|id|v1}}>bar</span>
7897 !! html
7898 <p><span id="v1">bar</span>
7899 </p>
7900 !!end
7902 !!article
7903 Template:paramtest2
7904 !! text
7905 including another template, {{paramtest|param={{{arg}}}}}
7906 !! endarticle
7908 !! test
7909 Template passing argument to another template
7910 !! wikitext
7911 {{paramtest2|arg='hmm'}}
7912 !! html
7913 <p>including another template, This is a test template with parameter 'hmm'
7914 </p>
7915 !! end
7917 !! article
7918 Template:Linktest2
7919 !! text
7920 Main Page
7921 !! endarticle
7923 !! test
7924 Template as link source
7925 !! wikitext
7926 [[{{linktest2}}]]
7928 [[{{linktest2}}|Main Page]]
7930 [[{{linktest2}}]]Page
7931 !! html
7932 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7933 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7934 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
7935 </p>
7936 !! end
7939 !! article
7940 Template:loop1
7941 !! text
7942 {{loop2}}
7943 !! endarticle
7945 !! article
7946 Template:loop2
7947 !! text
7948 {{loop1}}
7949 !! endarticle
7951 !! test
7952 Template infinite loop
7953 !! wikitext
7954 {{loop1}}
7955 !! html
7956 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
7957 </p>
7958 !! end
7960 !! test
7961 Template from main namespace
7962 !! wikitext
7963 {{:Main Page}}
7964 !! html
7965 <p>blah blah
7966 </p>
7967 !! end
7969 !! article
7970 Template:table
7971 !! text
7973 | 1 || 2
7975 | 3 || 4
7977 !! endarticle
7979 !! test
7980 BUG 529: Template with table, not included at beginning of line
7981 !! wikitext
7982 foo {{table}}
7983 !! html
7984 <p>foo 
7985 </p>
7986 <table>
7987 <tr>
7988 <td> 1 </td>
7989 <td> 2
7990 </td></tr>
7991 <tr>
7992 <td> 3 </td>
7993 <td> 4
7994 </td></tr></table>
7996 !! end
7998 !! test
7999 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8000 !! wikitext
8002 {{table}}
8003 !! html
8004 <p>foo
8005 </p>
8006 <table>
8007 <tr>
8008 <td> 1 </td>
8009 <td> 2
8010 </td></tr>
8011 <tr>
8012 <td> 3 </td>
8013 <td> 4
8014 </td></tr></table>
8016 !! end
8018 !! test
8019 BUG 41: Template parameters shown as broken links
8020 !! wikitext
8021 {{{parameter}}}
8022 !! html
8023 <p>{{{parameter}}}
8024 </p>
8025 !! end
8027 !! test
8028 Template with targets containing wikilinks
8029 !! wikitext
8030 {{[[foo]]}}
8032 {{[[{{echo|foo}}]]}}
8034 {{{{echo|[[foo}}]]}}
8035 !! html
8036 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8037 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8038 </p><p>{{[[foo}}]]
8039 </p>
8040 !! end
8042 !! article
8043 Template:MSGNW test
8044 !! text
8045 ''None'' of '''this''' should be 
8046 * interpreted
8047  but rather passed unmodified
8048 {{test}}
8049 !! endarticle
8051 # hmm, fix this or just deprecate msgnw and document its behavior?
8052 !! test
8053 msgnw keyword
8054 !! options
8055 disabled
8056 !! wikitext
8057 {{msgnw:MSGNW test}}
8058 !! html
8059 <p>''None'' of '''this''' should be 
8060 * interpreted
8061  but rather passed unmodified
8062 {{test}}
8063 </p>
8064 !! end
8066 !! test
8067 int keyword
8068 !! wikitext
8069 {{int:youhavenewmessages|lots of money|not!}}
8070 !! html
8071 <p>You have lots of money (not!).
8072 </p>
8073 !! end
8075 !! article
8076 Template:Includes
8077 !! text
8078 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8079 !! endarticle
8081 !! test
8082 <includeonly> and <noinclude> being included
8083 !! wikitext
8084 {{Includes}}
8085 !! html
8086 <p>Foobar
8087 </p>
8088 !! end
8090 !! article
8091 Template:Includes2
8092 !! text
8093 <onlyinclude>Foo</onlyinclude>bar
8094 !! endarticle
8096 !! test
8097 <onlyinclude> being included
8098 !! wikitext
8099 {{Includes2}}
8100 !! html
8101 <p>Foo
8102 </p>
8103 !! end
8106 !! article
8107 Template:Includes3
8108 !! text
8109 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8110 !! endarticle
8112 !! test
8113 <onlyinclude> and <includeonly> being included
8114 !! wikitext
8115 {{Includes3}}
8116 !! html
8117 <p>Foo
8118 </p>
8119 !! end
8121 !! test
8122 <includeonly> and <noinclude> on a page
8123 !! wikitext
8124 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8125 !! html
8126 <p>Foozar
8127 </p>
8128 !! end
8130 !! test
8131 Un-closed <noinclude>
8132 !! wikitext
8133 <noinclude>
8134 !! html
8135 !! end
8137 !! test
8138 <onlyinclude> on a page
8139 !! wikitext
8140 <onlyinclude>Foo</onlyinclude>bar
8141 !! html
8142 <p>Foobar
8143 </p>
8144 !! end
8146 !! test
8147 Un-closed <onlyinclude>
8148 !! wikitext
8149 <onlyinclude>
8150 !! html
8151 !! end
8153 !!test
8154 Self-closed noinclude, includeonly, onlyinclude tags
8155 !! wikitext
8156 <noinclude />
8157 <includeonly />
8158 <onlyinclude />
8159 !! html
8160 <p><br />
8161 </p>
8162 !!end
8164 !!test
8165 Unbalanced includeonly and noinclude tags
8166 !! wikitext
8168 |a</noinclude>
8169 |b</noinclude></noinclude>
8170 |c</noinclude></includeonly>
8171 |d</includeonly></includeonly>
8173 !! html
8174 <table>
8175 <tr>
8176 <td>a
8177 </td>
8178 <td>b
8179 </td>
8180 <td>c&lt;/includeonly&gt;
8181 </td>
8182 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8183 </td></tr></table>
8185 !!end
8187 !! article
8188 Template:Includeonly section
8189 !! text
8190 <includeonly>
8191 ==Includeonly section==
8192 </includeonly>
8193 ==Section T-1==
8194 !!endarticle
8196 !! test
8197 Bug 6563: Edit link generation for section shown by <includeonly>
8198 !! wikitext
8199 {{includeonly section}}
8200 !! html
8201 <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>
8202 <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>
8204 !! end
8206 # Uses same input as the contents of [[Template:Includeonly section]]
8207 !! test
8208 Bug 6563: Section extraction for section shown by <includeonly>
8209 !! options
8210 section=T-2
8211 !! wikitext
8212 <includeonly>
8213 ==Includeonly section==
8214 </includeonly>
8215 ==Section T-2==
8216 !! html
8217 ==Section T-2==
8218 !! end
8220 !! test
8221 Bug 6563: Edit link generation for section suppressed by <includeonly>
8222 !! wikitext
8223 <includeonly>
8224 ==Includeonly section==
8225 </includeonly>
8226 ==Section 1==
8227 !! html
8228 <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>
8230 !! end
8232 !! test
8233 Bug 6563: Section extraction for section suppressed by <includeonly>
8234 !! options
8235 section=1
8236 !! wikitext
8237 <includeonly>
8238 ==Includeonly section==
8239 </includeonly>
8240 ==Section 1==
8241 !! html
8242 ==Section 1==
8243 !! end
8245 !! test
8246 Un-closed <includeonly>
8247 !! wikitext
8248 <includeonly>
8249 !! html
8250 !! end
8252 # TODO: test with DOM fragment reuse!
8253 !! test
8254 Parsoid: DOM fragment reuse
8255 !! options
8256 parsoid=wt2wt,wt2html
8257 !! wikitext
8258 a{{echo|b<table></table>c}}d
8260 a{{echo|b
8261 <table></table>
8262 c}}d
8264 {{echo|a
8266 <table></table>
8269 !! html
8270 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8271 <table></table>c"}},"i":0}}]}'>b</span>
8272 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8275 <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">
8276 </span>
8277 <table about="#mwt2"></table><span about="#mwt2">
8278 </span>
8279 <p about="#mwt2">cd</p>
8282 <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">
8284 </span>
8285 <table about="#mwt3"></table><span about="#mwt3">
8287 </span>
8288 <p about="#mwt3">b</p>
8289 !! end
8291 !! test
8292 Parsoid: Merge double tds (bug 50603)
8293 !! options
8294 parsoid
8295 !! wikitext
8297 |{{echo|{{!}} foo}}
8299 !! html
8300 <table><tbody>
8301 <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>
8302 </tbody></table>
8303 !! end
8305 !! test
8306 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8307 !! options
8308 parsoid
8309 !! wikitext
8310 {{echo|<div>}}
8312 |{{echo|{{!}} foo}}
8314 {{echo|</div>}}
8315 !! html
8316 <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}}]}'>
8317 <table><tbody>
8318 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8319 </tbody></table>
8320 </div>
8321 !! end
8324 ### <includeonly> and <noinclude> in attributes
8326 !!test
8327 0. includeonly around the entire attribute
8328 !! wikitext
8329 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8330 !! html
8331 <p><span id="v2">bar</span>
8332 </p>
8333 !!end
8335 !!test
8336 1. includeonly in html attr key
8337 !! wikitext
8338 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8339 !! html
8340 <p><span id="foo">bar</span>
8341 </p>
8342 !!end
8344 !!test
8345 2. includeonly in html attr value
8346 !! wikitext
8347 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8348 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8349 !! html
8350 <p><span id="v1">bar</span>
8351 <span id="v1">bar</span>
8352 </p>
8353 !!end
8355 !!test
8356 3. includeonly in part of an attr value
8357 !! wikitext
8358 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8359 !! html
8360 <p><span style="color:red;">bar</span>
8361 </p>
8362 !!end
8364 !!test
8365 4. includeonly in table attributes
8366 !! wikitext
8368 |- <noinclude>
8371 </noinclude>
8372 |- <includeonly>
8375 </includeonly>
8377 !! html
8378 <table>
8381 <tr>
8382 <td>a
8383 </td></tr>
8384 </table>
8386 !!end
8389 ### Testing parsing of templates where a template arg
8390 ### has the same name as the template itself.
8393 !! article
8394 Template:quote
8395 !! text
8396 {{{quote|{{{1}}}}}}
8397 !! endarticle
8399 !!test
8400 Templates: Template Name/Arg clash: 1. Use of positional param
8401 !! wikitext
8402 {{quote|foo}}
8403 !! html
8404 <p>foo
8405 </p>
8406 !!end
8408 !!test
8409 Templates: Template Name/Arg clash: 2. Use of named param
8410 !! wikitext
8411 {{quote|quote=foo}}
8412 !! html
8413 <p>foo
8414 </p>
8415 !!end
8417 !!test
8418 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8419 !! wikitext
8420 {{quote|quote}}
8421 !! html
8422 <p>quote
8423 </p>
8424 !!end
8427 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8430 !!test
8431 Templates: 1. Simple use
8432 !! wikitext
8433 {{echo|Foo}}
8434 !! html
8435 <p>Foo
8436 </p>
8437 !!end
8439 !!test
8440 Templates: 2. Inside a block tag
8441 !! wikitext
8442 <div>{{echo|Foo}}</div>
8443 <blockquote>{{echo|Foo}}</blockquote>
8444 !! html
8445 <div>Foo</div>
8446 <blockquote>Foo</blockquote>
8448 !!end
8450 !!test
8451 Templates: P-wrapping: 1a. Templates on consecutive lines
8452 !! wikitext
8453 {{echo|Foo}}
8454 {{echo|bar}}
8455 !! html
8456 <p>Foo
8458 </p>
8459 !!end
8461 !!test
8462 Templates: P-wrapping: 1b. Templates on consecutive lines
8463 !! wikitext
8466 {{echo|bar}}
8467 {{echo|baz}}
8468 !! html
8469 <p>Foo
8470 </p><p>bar
8472 </p>
8473 !!end
8475 !!test
8476 Templates: P-wrapping: 1c. Templates on consecutive lines
8477 !! wikitext
8478 {{echo|Foo}}
8479 {{echo|bar}} <div>baz</div>
8480 !! html
8481 <p>Foo
8482 </p>
8483 bar <div>baz</div>
8485 !!end
8487 !!test
8488 Templates: P-wrapping: 1d. Template preceded by comment-only line
8489 !!options
8490 parsoid
8491 !! wikitext
8492 <!-- foo -->
8493 {{echo|Bar}}
8494 !! html
8495 <!-- foo -->
8497 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8498 !!end
8500 !!test
8501 Templates: Inline Text: 1. Multiple template uses
8502 !! wikitext
8503 {{echo|Foo}}bar{{echo|baz}}
8504 !! html
8505 <p>Foobarbaz
8506 </p>
8507 !!end
8509 !!test
8510 Templates: Inline Text: 2. Back-to-back template uses
8511 !! wikitext
8512 {{echo|Foo}}{{echo|bar}}
8513 !! html
8514 <p>Foobar
8515 </p>
8516 !!end
8518 !!test
8519 Templates: Block Tags: 1. Multiple template uses
8520 !! wikitext
8521 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8522 !! html
8523 <div>Foo</div><div>bar</div><div>baz</div>
8525 !!end
8527 !!test
8528 Templates: Block Tags: 2. Back-to-back template uses
8529 !! wikitext
8530 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8531 !! html
8532 <div>Foo</div><div>bar</div>
8534 !!end
8536 !!test
8537 Templates: Links: 1. Simple example
8538 !! wikitext
8539 {{echo|[[Foo|bar]]}}
8540 !! html
8541 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8542 </p>
8543 !!end
8545 !!test
8546 Templates: Links: 2. Generation of link href
8547 !! wikitext
8548 [[{{echo|Foo}}|bar]]
8549 !! html
8550 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8551 </p>
8552 !!end
8554 !!test
8555 Templates: Links: 3. Generation of part of a link href
8556 !! wikitext
8557 [[Fo{{echo|o}}|bar]]
8559 [[Foo{{echo|bar}}]]
8561 [[Foo{{echo|bar}}baz]]
8563 [[Foo{{echo|bar}}|bar]]
8565 [[:Foo{{echo|bar}}]]
8567 [[:Foo{{echo|bar}}|bar]]
8568 !! html
8569 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8570 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8571 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8572 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8573 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8574 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8575 </p>
8576 !!end
8578 !!test
8579 Templates: Links: 4. Multiple templates generating link href
8580 !! wikitext
8581 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8582 !! html
8583 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8584 </p>
8585 !!end
8587 !!test
8588 Templates: Links: 5. Generation of link text
8589 !! wikitext
8590 [[Foo|{{echo|bar}}]]
8591 !! html
8592 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8593 </p>
8594 !!end
8596 !!test
8597 Templates: Links: 5. Nested templates (only outermost template should be marked)
8598 !! wikitext
8599 {{echo|[[{{echo|Foo}}|bar]]}}
8600 !! html
8601 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8602 </p>
8603 !!end
8605 !!test
8606 Templates: HTML Tag: 1. Generation of HTML attr. key
8607 !! wikitext
8608 <div {{echo|style}}="color:red;">foo</div>
8609 !! html
8610 <div style="color:red;">foo</div>
8612 !!end
8614 !!test
8615 Templates: HTML Tag: 2. Generation of HTML attr. value
8616 !! wikitext
8617 <div style={{echo|'color:red;'}}>foo</div>
8618 !! html
8619 <div style="color:red;">foo</div>
8621 !!end
8623 !!test
8624 Templates: HTML Tag: 3. Generation of HTML attr key and value
8625 !! wikitext
8626 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8627 !! html
8628 <div style="color:red;">foo</div>
8630 !!end
8632 !!test
8633 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8634 !! wikitext
8635 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8636 !! html
8637 <div title="This is a long title with just one piece templated">foo</div>
8639 !!end
8641 !!test
8642 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8643 !! wikitext
8644 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8645 !! html
8646 <div title="This is a long title with just one piece templated">foo</div>
8648 !!end
8650 !!test
8651 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8652 !! wikitext
8653 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8654 !! html
8655 <div title="This is a long title with just one piece templated">foo</div>
8657 !!end
8659 !!test
8660 Templates: HTML Tag: 7. Generation of partial attribute key string
8661 !! wikitext
8662 <div st{{echo|yle}}="color:red;">foo</div>
8663 !! html
8664 <div style="color:red;">foo</div>
8666 !!end
8668 !!test
8669 Templates: HTML Tables: 1. Generating start of a HTML table
8670 !! wikitext
8671 {{echo|<table><tr><td>foo</td>}}</tr></table>
8672 !! html
8673 <table><tr><td>foo</td></tr></table>
8675 !!end
8677 !!test
8678 Templates: HTML Tables: 2a. Generating middle of a HTML table
8679 !! wikitext
8680 <table><tr>{{echo|<td>foo</td>}}</tr></table>
8681 !! html
8682 <table><tr><td>foo</td></tr></table>
8684 !!end
8686 !!test
8687 Templates: HTML Tables: 2b. Generating middle of a HTML table
8688 !! wikitext
8689 <table>{{echo|<tr><td>foo</td></tr>}}</table>
8690 !! html
8691 <table><tr><td>foo</td></tr></table>
8693 !!end
8695 !!test
8696 Templates: HTML Tables: 3. Generating end of a HTML table
8697 !! wikitext
8698 <table><tr>{{echo|<td>foo</td></tr></table>}}
8699 !! html
8700 <table><tr><td>foo</td></tr></table>
8702 !!end
8704 !!test
8705 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
8706 !! wikitext
8707 {{echo|<table>}}<tr><td>foo</td></tr></table>
8708 !! html
8709 <table><tr><td>foo</td></tr></table>
8711 !!end
8713 !!test
8714 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
8715 !! wikitext
8716 <table>{{echo|<tr>}}<td>foo</td></tr></table>
8717 !! html
8718 <table><tr><td>foo</td></tr></table>
8720 !!end
8722 !!test
8723 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
8724 !! wikitext
8725 <table><tr>{{echo|<td>}}foo</td></tr></table>
8726 !! html
8727 <table><tr><td>foo</td></tr></table>
8729 !!end
8731 !!test
8732 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
8733 !! wikitext
8734 <table><tr><td>foo{{echo|</td>}}</tr></table>
8735 !! html
8736 <table><tr><td>foo</td></tr></table>
8738 !!end
8740 !!test
8741 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
8742 !! wikitext
8743 <table><tr><td>foo</td>{{echo|</tr>}}</table>
8744 !! html
8745 <table><tr><td>foo</td></tr></table>
8747 !!end
8749 !!test
8750 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
8751 !! wikitext
8752 <table><tr><td>foo</td></tr>{{echo|</table>}}
8753 !! html
8754 <table><tr><td>foo</td></tr></table>
8756 !!end
8758 !!test
8759 Templates: HTML Tables: 5. Proper fostering of categories from inside
8760 !!options
8761 parsoid=wt2html,wt2wt
8762 !! wikitext
8763 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
8764 <!--Two categories (Bug 50330)-->
8765 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
8766 !! html
8767 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
8768 <!--Two categories (Bug 50330)-->
8769 <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>
8770 !!end
8772 !!test
8773 Templates: Wiki Tables: 1a. Fostering of entire template content
8774 !! wikitext
8776 {{echo|a}}
8778 !! html
8779 <table>
8781 <tr><td></td></tr></table>
8783 !!end
8785 !!test
8786 Templates: Wiki Tables: 1b. Fostering of entire template content
8787 !! wikitext
8789 {{echo|<div>}}
8791 {{echo|</div>}}
8793 !! html
8794 <table>
8795 <div>
8796 <p>foo
8797 </p>
8798 </div>
8799 <tr><td></td></tr></table>
8801 !!end
8803 !!test
8804 Templates: Wiki Tables: 2. Fostering of partial template content
8805 !! wikitext
8807 {{echo|a
8808 <div>b</div>}}
8810 !! html
8811 <table>
8813 <div>b</div>
8814 <tr><td></td></tr></table>
8816 !!end
8818 !!test
8819 Templates: Wiki Tables: 3. td-content via multiple templates
8820 !! wikitext
8822 {{echo|{{pipe}}a}}{{echo|b}}
8824 !! html
8825 <table>
8826 <tr>
8827 <td>ab
8828 </td></tr></table>
8830 !!end
8832 !!test
8833 Templates: Wiki Tables: 4. Templated tags, no content
8834 !! wikitext
8835 {{tbl-start}}
8836 {{tbl-end}}
8837 !! html
8838 <table>
8839 <tr><td></td></tr></table>
8841 !!end
8843 !!test
8844 Templates: Wiki Tables: 5. Templated tags, regular td-tags
8845 !! wikitext
8846 {{tbl-start}}
8847 |foo
8848 {{tbl-end}}
8849 !! html
8850 <table>
8851 <tr>
8852 <td>foo
8853 </td></tr></table>
8855 !!end
8857 !!test
8858 Templates: Wiki Tables: 6. Templated tags, templated td-tags
8859 !! wikitext
8860 {{tbl-start}}
8861 {{!}}foo
8862 {{tbl-end}}
8863 !! html
8864 <table>
8865 <tr>
8866 <td>foo
8867 </td></tr></table>
8869 !!end
8871 !!test
8872 Templates: Lists: Multi-line list-items via templates
8873 !! wikitext
8874 *{{echo|a {{nonexistent|
8875 unused}}}}
8876 *{{echo|b {{nonexistent|
8877 unused}}}}
8878 !! html
8879 <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>
8880 <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>
8882 !!end
8884 !!test
8885 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
8886 !! wikitext
8887 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
8888 !! html
8889 <p><i>ab</i>c<i>d</i>e
8890 </p>
8891 !!end
8893 !!test
8894 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
8895 (PHP parser generates misnested html)
8896 !! wikitext
8897 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
8898 !! html/parsoid
8899 <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>
8900 !!end
8902 !!test
8903 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
8904 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
8905 !! options
8906 parsoid=wt2html,wt2wt
8907 !! wikitext
8908 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
8909 !! html
8910 <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>
8911 <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>
8912 <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>
8913 !!end
8915 !!test
8916 Templates: Ugly nesting: 4. Divs opened/closed across templates
8917 !! wikitext
8918 a<div>b{{echo|c</div>d}}e
8919 !! html
8920 a<div>bc</div>de
8922 !!end
8924 !!test
8925 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
8926 (Parsoid-centric)
8927 !! options
8928 parsoid
8929 !! wikitext
8931 |{{echo|foo</table>}}
8932 |bar
8934 !! html
8935 <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|}"]}'>
8937 <tbody>
8938 <tr>
8939 <td>foo</td></tr></tbody></table><span about="#mwt1">
8940 </span><span about="#mwt1">|bar</span><span about="#mwt1">
8941 |}</span>
8942 !!end
8944 !!test
8945 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
8946 (Parsoid-centric)
8947 !! options
8948 parsoid
8949 !! wikitext
8950 <table>
8951   <tr>
8952     <td>
8953     <table>
8954       <tr>
8955         <td>1. {{echo|foo </table>}}</td>
8956         <td> bar </td>
8957         <td>2. {{echo|baz </table>}}</td>
8958       </tr>
8959       <tr>
8960         <td>abc</td>
8961       </tr>
8962     </table>
8963     </td>
8964   </tr>
8965   <tr>
8966     <td>xyz</td>
8967   </tr>
8968 </table>
8969 !! html
8970 <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>"]}'>
8971   <tbody><tr>
8972     <td>
8973     <table>
8974       <tbody><tr>
8975         <td>1. foo </td></tr></tbody></table></td>
8976         <td> bar </td>
8977         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
8978       </span><span about="#mwt2">
8979       </span><span about="#mwt2">
8980         </span><span about="#mwt2">abc</span><span about="#mwt2">
8981       </span><span about="#mwt2">
8982     </span><span about="#mwt2">
8983     </span><span about="#mwt2">
8984   </span><span about="#mwt2">
8985   </span><span about="#mwt2">
8986     </span><span about="#mwt2">xyz</span><span about="#mwt2">
8987   </span><span about="#mwt2">
8988 </span>
8989 !!end
8991 !! test
8992 Templates: Ugly templates: 3. newline-only template parameter
8993 !! wikitext
8994 foo {{echo|
8996 !! html
8997 <p>foo 
8998 </p>
8999 !! end
9001 # This looks like a bug: a single newline triggers p/br for some reason.
9002 !! test
9003 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9004 !! wikitext
9005 {{echo|
9007 !! html
9008 <p><br />
9009 </p>
9010 !! end
9012 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9013 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9014 !! test
9015 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9016 !! wikitext
9017 {{echo|<table>}}
9018 {{echo|<div>foo}}
9019 {{echo|</table>}}
9020 !! html/parsoid
9021 <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
9022 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9023 </table>
9024 !! end
9026 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9027 # that are "identical" and generate nesting cycles in the algorithm
9028 !! test
9029 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9030 !! wikitext
9031 {{echo|<table><tr><td><table>}}
9032 {{echo|<div>}}
9033 {{echo|</div>}}
9034 !! html/parsoid
9035 <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"}'>
9036 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9037 </table></td></tr></tbody></table>
9038 !! end
9040 !!test
9041 Parser Functions: 1. Simple example
9042 !! wikitext
9043 {{uc:foo}}
9044 !! html
9045 <p>FOO
9046 </p>
9047 !!end
9049 !!test
9050 Parser Functions: 2. Nested use (only outermost should be marked up)
9051 !! wikitext
9052 {{uc:{{lc:FOO}}}}
9053 !! html
9054 <p>FOO
9055 </p>
9056 !!end
9059 ### Pre-save transform tests
9061 !! test
9062 pre-save transform: subst:
9063 !! options
9065 !! wikitext
9066 {{subst:test}}
9067 !! html
9068 This is a test template
9069 !! end
9071 !! test
9072 pre-save transform: normal template
9073 !! options
9075 !! wikitext
9076 {{test}}
9077 !! html
9078 {{test}}
9079 !! end
9081 !! test
9082 pre-save transform: nonexistent template
9083 !! options
9085 !! wikitext
9086 {{thistemplatedoesnotexist}}
9087 !! html
9088 {{thistemplatedoesnotexist}}
9089 !! end
9092 !! test
9093 pre-save transform: subst magic variables
9094 !! options
9096 !! wikitext
9097 {{subst:SITENAME}}
9098 !! html
9099 MediaWiki
9100 !! end
9102 # This is bug 89, which I fixed. -- wtm
9103 !! test
9104 pre-save transform: subst: templates with parameters
9105 !! options
9107 !! wikitext
9108 {{subst:paramtest|param="something else"}}
9109 !! html
9110 This is a test template with parameter "something else"
9111 !! end
9113 !! article
9114 Template:nowikitest
9115 !! text
9116 <nowiki>'''not wiki'''</nowiki>
9117 !! endarticle
9119 !! test
9120 pre-save transform: nowiki in subst (bug 1188)
9121 !! options
9123 !! wikitext
9124 {{subst:nowikitest}}
9125 !! html
9126 <nowiki>'''not wiki'''</nowiki>
9127 !! end
9130 !! article
9131 Template:commenttest
9132 !! text
9133 This template has <!-- a comment --> in it.
9134 !! endarticle
9136 !! test
9137 pre-save transform: comment in subst (bug 1936)
9138 !! options
9140 !! wikitext
9141 {{subst:commenttest}}
9142 !! html
9143 This template has <!-- a comment --> in it.
9144 !! end
9146 !! test
9147 pre-save transform: unclosed tag
9148 !! options
9149 pst noxml
9150 !! wikitext
9151 <nowiki>'''not wiki'''
9152 !! html
9153 <nowiki>'''not wiki'''
9154 !! end
9156 !! test
9157 pre-save transform: mixed tag case
9158 !! options
9159 pst noxml
9160 !! wikitext
9161 <NOwiki>'''not wiki'''</noWIKI>
9162 !! html
9163 <NOwiki>'''not wiki'''</noWIKI>
9164 !! end
9166 !! test
9167 pre-save transform: unclosed comment in <nowiki>
9168 !! options
9169 pst noxml
9170 !! wikitext
9171 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9172 !! html
9173 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9174 !!end
9176 # Leading @ in this template definition works around a limitation
9177 # in parsoid's parserTests which otherwise strips the <span> from the
9178 # result (confusing it for a template wrapper)
9179 !! article
9180 Template:dangerous
9181 !!text
9182 @<span onmouseover="alert('crap')">Oh no</span>
9183 !!endarticle
9185 !!test
9186 (confirming safety of fix for subst bug 1936)
9187 !! wikitext
9188 {{Template:dangerous}}
9189 !! html
9190 <p>@<span>Oh no</span>
9191 </p>
9192 !! end
9194 !! test
9195 pre-save transform: comment containing gallery (bug 5024)
9196 !! options
9198 !! wikitext
9199 <!-- <gallery>data</gallery> -->
9200 !! html
9201 <!-- <gallery>data</gallery> -->
9202 !!end
9204 !! test
9205 pre-save transform: comment containing extension
9206 !! options
9208 !! wikitext
9209 <!-- <tag>data</tag> -->
9210 !! html
9211 <!-- <tag>data</tag> -->
9212 !!end
9214 !! test
9215 pre-save transform: comment containing nowiki
9216 !! options
9218 !! wikitext
9219 <!-- <nowiki>data</nowiki> -->
9220 !! html
9221 <!-- <nowiki>data</nowiki> -->
9222 !!end
9224 !! test
9225 pre-save transform: <noinclude> in subst (bug 3298)
9226 !! options
9228 !! wikitext
9229 {{subst:Includes}}
9230 !! html
9231 Foobar
9232 !! end
9234 !! test
9235 pre-save transform: <onlyinclude> in subst (bug 3298)
9236 !! options
9238 !! wikitext
9239 {{subst:Includes2}}
9240 !! html
9242 !! end
9244 !! article
9245 Template:SubstTest
9246 !!text
9247 {{<includeonly>subst:</includeonly>Includes}}
9248 !! endarticle
9250 !! article
9251 Template:SafeSubstTest
9252 !! text
9253 {{<includeonly>safesubst:</includeonly>Includes}}
9254 !! endarticle
9256 !! test
9257 bug 22297: safesubst: works during PST
9258 !! options
9260 !! wikitext
9261 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9262 !! html
9263 FoobarFoobar
9264 !! end
9266 !! test
9267 bug 22297: safesubst: works during normal parse
9268 !! wikitext
9269 {{SafeSubstTest}}
9270 !! html
9271 <p>Foobar
9272 </p>
9273 !! end
9275 !! test
9276 subst: does not work during normal parse
9277 !! wikitext
9278 {{SubstTest}}
9279 !! html
9280 <p>{{subst:Includes}}
9281 </p>
9282 !! end
9284 !! test
9285 pre-save transform: context links ("pipe trick")
9286 !! options
9288 !! wikitext
9289 [[Article (context)|]]
9290 [[Bar:Article|]]
9291 [[:Bar:Article|]]
9292 [[Bar:Article (context)|]]
9293 [[:Bar:Article (context)|]]
9294 [[|Article]]
9295 [[|Article (context)]]
9296 [[Bar:X (Y) Z|]]
9297 [[:Bar:X (Y) Z|]]
9298 !! html
9299 [[Article (context)|Article]]
9300 [[Bar:Article|Article]]
9301 [[:Bar:Article|Article]]
9302 [[Bar:Article (context)|Article]]
9303 [[:Bar:Article (context)|Article]]
9304 [[Article]]
9305 [[Article (context)]]
9306 [[Bar:X (Y) Z|X (Y) Z]]
9307 [[:Bar:X (Y) Z|X (Y) Z]]
9308 !! end
9310 !! test
9311 pre-save transform: context links ("pipe trick") with interwiki prefix
9312 !! options
9314 !! wikitext
9315 [[interwiki:Article|]]
9316 [[:interwiki:Article|]]
9317 [[interwiki:Bar:Article|]]
9318 [[:interwiki:Bar:Article|]]
9319 !! html
9320 [[interwiki:Article|Article]]
9321 [[:interwiki:Article|Article]]
9322 [[interwiki:Bar:Article|Bar:Article]]
9323 [[:interwiki:Bar:Article|Bar:Article]]
9324 !! end
9326 !! test
9327 pre-save transform: context links ("pipe trick") with parens in title
9328 !! options
9329 pst title=[[Somearticle (context)]]
9330 !! wikitext
9331 [[|Article]]
9332 !! html
9333 [[Article (context)|Article]]
9334 !! end
9336 !! test
9337 pre-save transform: context links ("pipe trick") with comma in title
9338 !! options
9339 pst title=[[Someplace, Somewhere]]
9340 !! wikitext
9341 [[|Otherplace]]
9342 [[Otherplace, Elsewhere|]]
9343 [[Otherplace, Elsewhere, Anywhere|]]
9344 !! html
9345 [[Otherplace, Somewhere|Otherplace]]
9346 [[Otherplace, Elsewhere|Otherplace]]
9347 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9348 !! end
9350 !! test
9351 pre-save transform: context links ("pipe trick") with parens and comma
9352 !! options
9353 pst title=[[Someplace (IGNORED), Somewhere]]
9354 !! wikitext
9355 [[|Otherplace]]
9356 [[Otherplace (place), Elsewhere|]]
9357 !! html
9358 [[Otherplace, Somewhere|Otherplace]]
9359 [[Otherplace (place), Elsewhere|Otherplace]]
9360 !! end
9362 !! test
9363 pre-save transform: context links ("pipe trick") with comma and parens
9364 !! options
9365 pst title=[[Who, me? (context)]]
9366 !! wikitext
9367 [[|Yes, you.]]
9368 [[Me, Myself, and I (1937 song)|]]
9369 !! html
9370 [[Yes, you. (context)|Yes, you.]]
9371 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9372 !! end
9374 !! test
9375 pre-save transform: context links ("pipe trick") with namespace
9376 !! options
9377 pst title=[[Ns:Somearticle]]
9378 !! wikitext
9379 [[|Article]]
9380 !! html
9381 [[Ns:Article|Article]]
9382 !! end
9384 !! test
9385 pre-save transform: context links ("pipe trick") with namespace and parens
9386 !! options
9387 pst title=[[Ns:Somearticle (context)]]
9388 !! wikitext
9389 [[|Article]]
9390 !! html
9391 [[Ns:Article (context)|Article]]
9392 !! end
9394 !! test
9395 pre-save transform: context links ("pipe trick") with namespace and comma
9396 !! options
9397 pst title=[[Ns:Somearticle, Context, Whatever]]
9398 !! wikitext
9399 [[|Article]]
9400 !! html
9401 [[Ns:Article, Context, Whatever|Article]]
9402 !! end
9404 !! test
9405 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9406 !! options
9407 pst title=[[Ns:Somearticle, Context (context)]]
9408 !! wikitext
9409 [[|Article]]
9410 !! html
9411 [[Ns:Article (context)|Article]]
9412 !! end
9414 !! test
9415 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9416 !! options
9417 pst title=[[Ns:Somearticle (IGNORED), Context]]
9418 !! wikitext
9419 [[|Article]]
9420 !! html
9421 [[Ns:Article, Context|Article]]
9422 !! end
9424 !! test
9425 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9426 !! options
9428 !! wikitext
9429 [[Article(context)|]]
9430 [[Bar:Article(context)|]]
9431 [[:Bar:Article(context)|]]
9432 [[|Article(context)]]
9433 [[Bar:X(Y)Z|]]
9434 [[:Bar:X(Y)Z|]]
9435 !! html
9436 [[Article(context)|Article]]
9437 [[Bar:Article(context)|Article]]
9438 [[:Bar:Article(context)|Article]]
9439 [[Article(context)]]
9440 [[Bar:X(Y)Z|X(Y)Z]]
9441 [[:Bar:X(Y)Z|X(Y)Z]]
9442 !! end
9444 !! test
9445 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9446 !! options
9448 !! wikitext
9449 [[Article (context)|]]
9450 [[Bar:Article (context)|]]
9451 [[:Bar:Article (context)|]]
9452 [[|Article (context)]]
9453 [[Bar:X (Y) Z|]]
9454 [[:Bar:X (Y) Z|]]
9455 !! html
9456 [[Article (context)|Article]]
9457 [[Bar:Article (context)|Article]]
9458 [[:Bar:Article (context)|Article]]
9459 [[Article (context)]]
9460 [[Bar:X (Y) Z|X (Y) Z]]
9461 [[:Bar:X (Y) Z|X (Y) Z]]
9462 !! end
9464 !! test
9465 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9466 !! options
9468 !! wikitext
9469 [[Article(context)|]]
9470 [[Bar:Article(context)|]]
9471 [[:Bar:Article(context)|]]
9472 [[|Article(context)]]
9473 [[Bar:X(Y)Z|]]
9474 [[:Bar:X(Y)Z|]]
9475 !! html
9476 [[Article(context)|Article]]
9477 [[Bar:Article(context)|Article]]
9478 [[:Bar:Article(context)|Article]]
9479 [[Article(context)]]
9480 [[Bar:X(Y)Z|X(Y)Z]]
9481 [[:Bar:X(Y)Z|X(Y)Z]]
9482 !! end
9484 !! test
9485 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9486 !! options
9488 !! wikitext
9489 [[Article (context), context|]]
9490 [[Article (context),context|]]
9491 [[Bar:Article (context), context|]]
9492 [[Bar:Article (context),context|]]
9493 [[:Bar:Article (context), context|]]
9494 [[:Bar:Article (context),context|]]
9495 !! html
9496 [[Article (context), context|Article]]
9497 [[Article (context),context|Article]]
9498 [[Bar:Article (context), context|Article]]
9499 [[Bar:Article (context),context|Article]]
9500 [[:Bar:Article (context), context|Article]]
9501 [[:Bar:Article (context),context|Article]]
9502 !! end
9504 !! test
9505 pre-save transform: trim trailing empty lines
9506 !! options
9508 !! wikitext
9509 Empty lines are trimmed
9514 !! html
9515 Empty lines are trimmed
9516 !! end
9518 !! test
9519 pre-save transform: Signature expansion
9520 !! options
9522 !! wikitext
9523 * ~~~
9524 * <noinclude>~~~</noinclude>
9525 * <includeonly>~~~</includeonly>
9526 * <onlyinclude>~~~</onlyinclude>
9527 !! html
9528 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9529 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9530 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9531 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9532 !! end
9535 !! test
9536 pre-save transform: Signature expansion in nowiki tags (bug 93)
9537 !! options
9538 pst disabled
9539 !! wikitext
9540 Shall not expand:
9542 <nowiki>~~~~</nowiki>
9544 <includeonly><nowiki>~~~~</nowiki></includeonly>
9546 <noinclude><nowiki>~~~~</nowiki></noinclude>
9548 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9550 {{subst:Foo}} shall be converted to FOO
9552 As well as inside noinclude/onlyinclude
9553 <noinclude>{{subst:Foo}}</noinclude>
9554 <onlyinclude>{{subst:Foo}}</onlyinclude>
9556 But not inside includeonly
9557 <includeonly>{{subst:Foo}}</includeonly>
9558 !! html
9559 Shall not expand:
9561 <nowiki>~~~~</nowiki>
9563 <includeonly><nowiki>~~~~</nowiki></includeonly>
9565 <noinclude><nowiki>~~~~</nowiki></noinclude>
9567 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9569 FOO shall be converted to FOO
9571 As well as inside noinclude/onlyinclude
9572 <noinclude>FOO</noinclude>
9573 <onlyinclude>FOO</onlyinclude>
9575 But not inside includeonly
9576 <includeonly>{{subst:Foo}}</includeonly>
9577 !! end
9579 !! test
9580 Parsoid: Recognize nowiki with trailing space in tags
9581 !! options
9582 parsoid=wt2html
9583 !! wikitext
9584 <nowiki ><div>[[foo]]</nowiki >
9586 a<nowiki / >b
9588 c<nowiki />d
9590 e<nowiki/ >f
9591 !! html
9592 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9593 <p>ab</p>
9594 <p>cd</p>
9595 <p>ef</p>
9596 !! end
9598 !! test
9599 Parsoid: Recognize nowiki with odd capitalization
9600 !! options
9601 parsoid=wt2html
9602 !! wikitext
9603 <noWikI ><div>[[foo]]</Nowiki >
9604 !! html
9605 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9606 !! end
9609 !! test
9610 Parsoid: Escape nowiki with trailing space in tags
9611 !! options
9612 parsoid=html2wt
9613 !! wikitext
9614 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9616 a&lt;nowiki /&gt;b
9618 c&lt;nowiki/ &gt;d
9619 !! html
9620 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9621 <p>a&lt;nowiki /&gt;b</p>
9622 <p>c&lt;nowiki/ &gt;d</p>
9623 !! end
9625 !! test
9626 Parsoid: Escape weird noWikI capitalizations
9627 !! options
9628 parsoid=html2wt
9629 !! wikitext
9630 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9631 !! html
9632 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9633 !! end
9636 ### Message transform tests
9638 !! test
9639 message transform: magic variables
9640 !! options
9642 !! wikitext
9643 {{SITENAME}}
9644 !! html
9645 MediaWiki
9646 !! end
9648 !! test
9649 message transform: should not transform wiki markup
9650 !! options
9652 !! wikitext
9653 ''test''
9654 !! html
9655 ''test''
9656 !! end
9658 !! test
9659 message transform: <noinclude> in transcluded template (bug 4926)
9660 !! options
9662 !! wikitext
9663 {{Includes}}
9664 !! html
9665 Foobar
9666 !! end
9668 !! test
9669 message transform: <onlyinclude> in transcluded template (bug 4926)
9670 !! options
9672 !! wikitext
9673 {{Includes2}}
9674 !! html
9676 !! end
9678 !! test
9679 {{#special:}} page name, known
9680 !! options
9682 !! wikitext
9683 {{#special:Recentchanges}}
9684 !! html
9685 Special:RecentChanges
9686 !! end
9688 !! test
9689 {{#special:}} page name with subpage, known
9690 !! options
9692 !! wikitext
9693 {{#special:Recentchanges/param}}
9694 !! html
9695 Special:RecentChanges/param
9696 !! end
9698 !! test
9699 {{#special:}} page name, unknown
9700 !! options
9702 !! wikitext
9703 {{#special:foobar nonexistent}}
9704 !! html
9705 Special:Foobar nonexistent
9706 !! end
9708 !! test
9709 {{#speciale:}} page name, known
9710 !! options
9712 !! wikitext
9713 {{#speciale:Recentchanges}}
9714 !! html
9715 Special:RecentChanges
9716 !! end
9718 !! test
9719 {{#speciale:}} page name with subpage, known
9720 !! options
9722 !! wikitext
9723 {{#speciale:Recentchanges/param}}
9724 !! html
9725 Special:RecentChanges/param
9726 !! end
9728 !! test
9729 {{#speciale:}} page name, unknown
9730 !! options
9732 !! wikitext
9733 {{#speciale:foobar nonexistent}}
9734 !! html
9735 Special:Foobar_nonexistent
9736 !! end
9739 ### Images
9741 ### For Parsoid-specific tests, see
9742 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
9744 !! test
9745 Simple image
9746 !! options
9747 parsoid=wt2html,wt2wt,html2html
9748 !! wikitext
9749 [[Image:foobar.jpg]]
9750 !! html/php
9751 <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>
9752 </p>
9753 !! html/parsoid
9754 <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>
9755 </p>
9756 !! end
9758 !! test
9759 Simple image (using File: namespace, now canonical)
9760 !! wikitext
9761 [[File:Foobar.jpg]]
9762 !! html/php
9763 <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>
9764 </p>
9765 !! html/parsoid
9766 <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>
9767 </p>
9768 !! end
9770 !! test
9771 Right-aligned image
9772 !! wikitext
9773 [[File:Foobar.jpg|right]]
9774 !! html/php
9775 <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>
9777 !! html/parsoid
9778 <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>
9779 !! end
9781 !! test
9782 Image with caption
9783 !! wikitext
9784 [[File:Foobar.jpg|right|Caption text]]
9785 !! html/php
9786 <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>
9788 !! html/parsoid
9789 <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>
9790 !! end
9792 !! test
9793 Image with caption, bug 53312 #1
9794 !! wikitext
9795 [[File:Foobar.jpg|right|Caption page stuff]]
9796 !! html/php
9797 <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>
9799 !! html/parsoid
9800 <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>
9801 !! end
9803 !! test
9804 Image with caption, bug 53312 #2
9805 !! wikitext
9806 [[File:Foobar.jpg|right|Caption page=]]
9807 !! html/php
9808 <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>
9810 !! html/parsoid
9811 <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>
9812 !! end
9814 !! test
9815 Image with caption, bug 53312 #3
9816 !! wikitext
9817 [[File:Foobar.jpg|right|Caption page=stuff]]
9818 !! html/php
9819 <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>
9821 !! html/parsoid
9822 <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>
9823 !! end
9825 !! test
9826 Allow empty links in image captions (Bug 60753)
9827 !! options
9828 thumbsize=220
9829 !! wikitext
9830 [[File:Foobar.jpg|thumb|Caption [[Link1]]
9831 [[]]
9832 [[Link2]]
9834 !! html/php
9835 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
9837 !! html/parsoid
9838 <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" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"},"dsr":[32,41,2,2]}'>Link1</a>
9839 [[]]
9840 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
9841 </figcaption></figure>
9842 !! end
9844 !! test
9845 Link with empty target
9846 !! wikitext
9847 [[]]
9848 !! html
9849 <p>[[]]
9850 </p>
9851 !! end
9853 !! test
9854 Image with empty attribute
9855 !! options
9856 parsoid=wt2html,wt2wt,html2html
9857 !! wikitext
9858 [[File:Foobar.jpg|right||Caption text]]
9859 !! html/php
9860 <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>
9862 !! html/parsoid
9863 <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>
9864 !! end
9866 !! test
9867 1. Block image with individual attributes from templates
9868 !! wikitext
9869 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
9870 !! html/php
9871 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9873 !! html/parsoid
9874 <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;dsr&amp;quot;:[24,38,null,null],&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;]}]]}\">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>
9875 !! end
9877 !! test
9878 2. Block Image with individual attributes from templates
9879 !! wikitext
9880 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
9881 !! html/php
9882 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption</div></div></div>
9884 !! html/parsoid
9885 <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;dsr&amp;quot;:[18,32,null,null],&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;]}]]}\">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;dsr&amp;quot;:[33,47,null,null],&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;]}]]}\">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>
9886 !! end
9888 !! test
9889 3. Inline image with individual attributes from templates
9890 !! wikitext
9891 [[File:Foobar.jpg|{{echo|50px}}]]
9892 !! html/php
9893 <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>
9894 </p>
9895 !! html/parsoid
9896 <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;dsr&amp;quot;:[18,31,null,null],&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;]}]]}\">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>
9897 !! end
9899 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
9900 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
9901 !! test
9902 Image with multiple attributes from the same template
9903 !! wikitext
9904 [[File:Foobar.jpg|{{image_attribs}}]]
9905 !! html/php
9906 <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>
9908 !! html/parsoid
9909 <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>
9910 !! end
9912 !! test
9913 Image with link tails
9914 !! options
9915 thumbsize=220
9916 !! wikitext
9917 123[[File:Foobar.jpg]]456
9918 123[[File:Foobar.jpg|right]]456
9919 123[[File:Foobar.jpg|thumb]]456
9920 !! html/php
9921 <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
9922 </p>
9923 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
9924 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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
9926 !! html/parsoid
9927 <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>
9928 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
9929 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
9930 !! end
9932 !! test
9933 Image with multiple captions -- only last one is accepted
9934 !! wikitext
9935 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
9936 !! html/php
9937 <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>
9939 !! html/parsoid
9940 <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>
9941 !! end
9943 !! test
9944 Image with multiple widths -- use last
9945 !! wikitext
9946 [[File:Foobar.jpg|200px|300px|caption]]
9947 !! html/php
9948 <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>
9949 </p>
9950 !! html/parsoid
9951 <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>
9952 !! end
9954 !! test
9955 Image with multiple alignments -- use first (bug 48664)
9956 !! options
9957 thumbsize=220
9958 !! wikitext
9959 [[File:Foobar.jpg|thumb|left|right|center|caption]]
9961 [[File:Foobar.jpg|middle|text-top|caption]]
9962 !! html/php
9963 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
9964 <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>
9965 </p>
9966 !! html/parsoid
9967 <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>
9968 <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>
9969 !! end
9971 !! test
9972 Image with width attribute at different positions
9973 !! wikitext
9974 [[File:Foobar.jpg|200px|right|Caption]]
9975 [[File:Foobar.jpg|right|200px|Caption]]
9976 [[File:Foobar.jpg|right|Caption|200px]]
9977 !! html/php
9978 <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>
9979 <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>
9980 <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>
9982 !! html/parsoid
9983 <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>
9984 <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>
9985 <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>
9986 !! end
9988 # a sad bit of backward-compatibility
9989 !! test
9990 Image with size specified with pxpx (bug 13500, 51628)
9991 !! options
9992 parsoid=wt2html,wt2wt,html2html
9993 !! wikitext
9994 [[File:Foobar.jpg|20pxpx]]
9995 [[File:Foobar.jpg|200x20pxpx]]
9996 !! html/php
9997 <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>
9998 <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>
9999 </p>
10000 !! html/parsoid
10001 <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>
10002 !! end
10004 !! test
10005 Image with link parameter, wiki target
10006 !! wikitext
10007 [[File:Foobar.jpg|link=Main Page]]
10008 !! html/php
10009 <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>
10010 </p>
10011 !! html/parsoid
10012 <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>
10013 !! end
10015 # parsoid bug 49293 (part 1)
10016 !! test
10017 Image with link parameter, URL target
10018 !! wikitext
10019 [[File:Foobar.jpg|link=http://example.com/]]
10020 !! html/php
10021 <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>
10022 </p>
10023 !! html/parsoid
10024 <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>
10025 !! end
10027 # parsoid bug 49293 (part 2)
10028 !! test
10029 Image with link parameter, protocol-less URL target
10030 !! wikitext
10031 [[File:Foobar.jpg|link=//example.com/]]
10032 !! html/php
10033 <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>
10034 </p>
10035 !! html/parsoid
10036 <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>
10037 !! end
10039 !! test
10040 Image with link parameter, wgExternalLinkTarget
10041 !! wikitext
10042 [[Image:foobar.jpg|link=http://example.com/]]
10043 !! config
10044 wgExternalLinkTarget='foobar'
10045 !! html
10046 <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>
10047 </p>
10048 !! end
10050 !! test
10051 Image with link parameter, wgNoFollowLinks set to false
10052 !! wikitext
10053 [[Image:foobar.jpg|link=http://example.com/]]
10054 !! config
10055 wgNoFollowLinks=false
10056 !! html
10057 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10058 </p>
10059 !! end
10061 !! test
10062 Image with link parameter, wgNoFollowDomainExceptions
10063 !! wikitext
10064 [[Image:foobar.jpg|link=http://example.com/]]
10065 !! config
10066 wgNoFollowDomainExceptions='example.com'
10067 !! html
10068 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10069 </p>
10070 !! end
10072 !! test
10073 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10074 !! wikitext
10075 [[Image:foobar.jpg|link=http://example.com/|Title]]
10076 !! config
10077 wgExternalLinkTarget='foobar'
10078 !! html
10079 <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>
10080 </p>
10081 !! end
10083 !! test
10084 Image with empty link parameter
10085 !! wikitext
10086 [[File:Foobar.jpg|link=]]
10087 !! html/php
10088 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10089 </p>
10090 !! html/parsoid
10091 <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>
10092 !! end
10094 !! test
10095 Image with link parameter (wiki target) and unnamed parameter
10096 !! wikitext
10097 [[File:Foobar.jpg|link=Main_Page|Title]]
10098 !! html/php
10099 <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>
10100 </p>
10101 !! html/parsoid
10102 <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>
10103 !! end
10105 !! test
10106 Image with link parameter (URL target) and unnamed parameter
10107 !! wikitext
10108 [[File:Foobar.jpg|link=http://example.com/|Title]]
10109 !! html/php
10110 <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>
10111 </p>
10112 !! html/parsoid
10113 <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>
10114 !! end
10116 !! test
10117 Thumbnail image with link parameter
10118 !! options
10119 thumbsize=220
10120 parsoid=wt2html,wt2wt,html2html
10121 !! wikitext
10122 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10123 !! html/php
10124 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10126 !! html/parsoid
10127 <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>
10128 !! end
10130 !! test
10131 Manually-specified thumbnail image
10132 !! options
10133 thumbsize=220
10134 !! wikitext
10135 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10136 !! html/php
10137 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10139 !! html/parsoid
10140 <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>
10141 !! end
10143 !! test
10144 Manually-specified thumbnail image with explicit link to wiki page
10145 !! options
10146 thumbsize=220
10147 parsoid=wt2html,wt2wt,html2html
10148 !! wikitext
10149 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10150 !! html/php
10151 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10153 !! html/parsoid
10154 <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>
10155 !! end
10157 !! test
10158 Manually-specified thumbnail image with explicit link to url
10159 !! options
10160 thumbsize=220
10161 parsoid=wt2html,wt2wt,html2html
10162 !! wikitext
10163 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10164 !! html/php
10165 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10167 !! html/parsoid
10168 <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>
10169 !! end
10171 !! test
10172 Manually-specified thumbnail image with explicit no link
10173 !! options
10174 thumbsize=220
10175 parsoid=wt2html,wt2wt,html2html
10176 !! wikitext
10177 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10178 !! html/php
10179 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10181 !! html/parsoid
10182 <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>
10183 !! end
10185 !! test
10186 Manually-specified thumbnail image with explicit link and alt text
10187 !! options
10188 thumbsize=220
10189 parsoid=wt2html,wt2wt,html2html
10190 !! wikitext
10191 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10192 !! html/php
10193 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
10195 !! html/parsoid
10196 <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>
10197 !! end
10199 !! test
10200 Image with frame and link
10201 !! options
10202 parsoid=wt2html,wt2wt,html2html
10203 !! wikitext
10204 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10205 !! html/php
10206 <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>
10208 !! html/parsoid
10209 <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">Main Page</a></figcaption></figure>
10210 !! end
10212 !! test
10213 Image with frame and link and explicit alt
10214 !! options
10215 parsoid=wt2html,wt2wt,html2html
10216 !! wikitext
10217 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10218 !! html/php
10219 <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>
10221 !! html/parsoid
10222 <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">Main Page</a></figcaption></figure>
10223 !! end
10225 !! test
10226 Image with wiki markup in implicit alt
10227 !! options
10228 parsoid=wt2html,wt2wt,html2html
10229 !! wikitext
10230 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10232 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10233 !! html/php
10234 <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>
10235 </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>
10236 </p>
10237 !! html/parsoid
10238 <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>
10239 <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>
10240 !! end
10242 ###################
10243 # Conflicting image format options.
10244 # First option specified should 'win'.
10245 # All three cases in each test should be identical.
10247 !! test
10248 Image with 'frameless' first.
10249 !! options
10250 parsoid=wt2html,wt2wt,html2html
10251 !! wikitext
10252 [[File:Foobar.jpg|frameless|caption]]
10254 [[File:Foobar.jpg|frameless|frame|caption]]
10256 [[File:Foobar.jpg|frameless|thumb|caption]]
10257 !! html/php
10258 <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>
10259 </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>
10260 </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>
10261 </p>
10262 !! html/parsoid
10263 <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>
10264 <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>
10265 <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>
10266 !! end
10268 !! test
10269 Image with 'frame' first.
10270 !! options
10271 parsoid=wt2html,wt2wt,html2html
10272 !! wikitext
10273 [[File:Foobar.jpg|frame|caption]]
10274 [[File:Foobar.jpg|frame|frameless|caption]]
10275 [[File:Foobar.jpg|frame|thumb|caption]]
10276 !! html/php
10277 <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>
10278 <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>
10279 <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>
10281 !! html/parsoid
10282 <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>
10283 !! end
10285 !! test
10286 Image with 'thumb' first.
10287 !! options
10288 parsoid=wt2html,wt2wt,html2html
10289 !! wikitext
10290 [[File:Foobar.jpg|thumb|caption]]
10291 [[File:Foobar.jpg|thumb|frameless|caption]]
10292 [[File:Foobar.jpg|thumb|frame|caption]]
10293 !! html/php
10294 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10295 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10296 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10298 !! html/parsoid
10299 <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>
10300 !! end
10302 ###################
10303 # Image sizing.
10304 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10305 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10306 # Foobar has actual size of 1941x220
10307 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10308 #    a scalable format.
10309 # 2. Framed images always ignore size options; always render at default size.
10310 # 3. "Unspecified format" and border are the only types which can be
10311 #    enlarged.
10313 !! test
10314 Image: "unspecified format" and border enlarge
10315 !! options
10316 parsoid=wt2html,wt2wt,html2html
10317 !! wikitext
10318 [[File:Foobar.jpg|2000px]]
10320 [[File:Foobar.jpg|border|2000px]]
10321 !! html/php
10322 <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>
10323 </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>
10324 </p>
10325 !! html/parsoid
10326 <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>
10327 <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>
10328 !! end
10330 !! test
10331 Image: "unspecified format" and border reduce
10332 !! options
10333 parsoid=wt2html,wt2wt,html2html
10334 !! wikitext
10335 [[File:Foobar.jpg|1000px]]
10337 [[File:Foobar.jpg|border|1000px]]
10338 !! html/php
10339 <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>
10340 </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>
10341 </p>
10342 !! html/parsoid
10343 <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>
10344 <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>
10345 !! end
10347 !! test
10348 Image: thumbs reduce
10349 !! options
10350 parsoid=wt2html,wt2wt,html2html
10351 !! wikitext
10352 [[File:Foobar.jpg|thumb|50px]]
10353 !! html/php
10354 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10356 !! html/parsoid
10357 <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>
10358 !! end
10360 !! test
10361 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10362 !! options
10363 parsoid=wt2html,wt2wt,html2html
10364 !! wikitext
10365 [[File:Foobar.jpg|thumb|2000px]]
10367 [[File:Foobar.svg|thumb|2000px]]
10368 !! html/php
10369 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10370 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
10372 !! html/parsoid
10373 <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>
10374 <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>
10375 !! end
10377 !! test
10378 Image: frameless can reduce in size
10379 !! options
10380 parsoid=wt2html,wt2wt,html2html
10381 !! wikitext
10382 [[File:Foobar.jpg|frameless|50px]]
10383 !! html/php
10384 <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>
10385 </p>
10386 !! html/parsoid
10387 <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>
10388 !! end
10390 !! test
10391 Image: bitmap frameless can't be enlarged past original size, but vector can
10392 !! options
10393 parsoid=wt2html,wt2wt,html2html
10394 !! wikitext
10395 [[File:Foobar.jpg|frameless|2000px]]
10397 [[File:Foobar.svg|frameless|2000px]]
10398 !! html/php
10399 <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>
10400 </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>
10401 </p>
10402 !! html/parsoid
10403 <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>
10404 <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>
10405 !! end
10407 !! test
10408 Image: framed images are always unscaled.
10409 !! options
10410 parsoid=wt2html,wt2wt,html2html
10411 !! wikitext
10412 [[File:Foobar.jpg|frame]]
10414 [[File:Foobar.jpg|frame|50px]]
10416 [[File:Foobar.jpg|frame|50x50px]]
10418 [[File:Foobar.jpg|frame|2000px]]
10419 !! html/php
10420 <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>
10421 <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>
10422 <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>
10423 <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>
10425 !! html/parsoid
10426 <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>
10427 !! end
10429 ###################
10431 !! test
10432 Link to image page- image page normally doesn't exists, hence edit link
10433 Add test with existing image page
10434 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10435 !! wikitext
10436 [[:Image:test]]
10437 !! html
10438 <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>
10439 </p>
10440 !! end
10442 !! test
10443 bug 18784  Link to non-existent image page with caption should use caption as link text
10444 !! wikitext
10445 [[:Image:test|caption]]
10446 !! html
10447 <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>
10448 </p>
10449 !! end
10451 !! test
10452 Frameless image caption with a free URL
10453 !! wikitext
10454 [[File:Foobar.jpg|http://example.com]]
10455 !! html/php
10456 <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>
10457 </p>
10458 !! html/parsoid
10459 <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>
10460 !! end
10462 !! test
10463 Thumbnail image caption with a free URL
10464 !! options
10465 thumbsize=220
10466 !! wikitext
10467 [[File:Foobar.jpg|thumb|http://example.com]]
10468 !! html/php
10469 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10471 !! html/parsoid
10472 <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>
10473 !! end
10475 !! test
10476 Thumbnail image caption with a free URL and explicit alt
10477 !! options
10478 thumbsize=220
10479 parsoid=wt2html,wt2wt,html2html
10480 !! wikitext
10481 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10482 !! html/php
10483 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
10485 !! html/parsoid
10486 <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>
10487 !! end
10489 !! test
10490 SVG thumbnails with no language set
10491 !! options
10492 !! wikitext
10493 [[File:Foobar.svg|thumb|caption]]
10494 !! html/php
10495 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10497 !! html/parsoid
10498 <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>
10499 !! end
10501 !! test
10502 SVG thumbnails with language de
10503 !! options
10504 parsoid=wt2html,wt2wt,html2html
10505 !! wikitext
10506 [[File:Foobar.svg|thumb|caption|lang=de]]
10507 !! html/php
10508 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10510 !! html/parsoid
10511 <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>
10512 !! end
10514 !! test
10515 SVG thumbnails with invalid language code
10516 !! options
10517 parsoid=wt2html,wt2wt,html2html
10518 !! wikitext
10519 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10520 !! html/php
10521 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
10523 !! html/parsoid
10524 <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>
10525 !! end
10527 !! test
10528 BUG 1887: A ISBN with a thumbnail
10529 !! wikitext
10530 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10531 !! html/php
10532 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
10534 !! html/parsoid
10535 <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>
10536 !! end
10538 !! test
10539 BUG 1887: A RFC with a thumbnail
10540 !! wikitext
10541 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10542 !! html/php
10543 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
10545 !! html/parsoid
10546 <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>
10547 !! end
10549 !! test
10550 BUG 1887: A mailto link with a thumbnail
10551 !! wikitext
10552 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10553 !! html/php
10554 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
10556 !! html/parsoid
10557 <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>
10558 !! end
10560 # Pending resolution to bug 368
10561 !! test
10562 BUG 648: Frameless image caption with a link
10563 !! wikitext
10564 [[File:Foobar.jpg|text with a [[link]] in it]]
10565 !! html/php
10566 <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>
10567 </p>
10568 !! html/parsoid
10569 <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>
10570 !! end
10572 !! test
10573 BUG 648: Frameless image caption with a link (suffix)
10574 !! wikitext
10575 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10576 !! html/php
10577 <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>
10578 </p>
10579 !! html/parsoid
10580 <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>
10581 !! end
10583 !! test
10584 BUG 648: Frameless image caption with an interwiki link
10585 !! wikitext
10586 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10587 !! html/php
10588 <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>
10589 </p>
10590 !! html/parsoid
10591 <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>
10592 !! end
10594 !! test
10595 BUG 648: Frameless image caption with a piped interwiki link
10596 !! wikitext
10597 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10598 !! html/php
10599 <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>
10600 </p>
10601 !! html/parsoid
10602 <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>
10603 !! end
10605 !! test
10606 Escape HTML special chars in image alt text
10607 !! wikitext
10608 [[File:Foobar.jpg|& < > "]]
10609 !! html/php
10610 <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>
10611 </p>
10612 !! html/parsoid
10613 <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>
10614 !! end
10616 !! test
10617 BUG 499: Alt text should have &#1234;, not &amp;1234;
10618 !! wikitext
10619 [[File:Foobar.jpg|&#9792;]]
10620 !! html/php
10621 <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>
10622 </p>
10623 !! html/parsoid
10624 <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>
10625 !! end
10627 !! test
10628 Broken image caption with link
10629 !! options
10630 parsoid=wt2html,wt2wt,html2html
10631 !! wikitext
10632 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10633 !! html/php
10634 <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.
10635 </p>
10636 !! html/parsoid
10637 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page">this</a> is just an ordinary link.</p>
10638 !! end
10640 !! test
10641 Image caption containing another image
10642 !! wikitext
10643 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10644 !! html/php
10645 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10647 !! html/parsoid
10648 <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>
10649 !! end
10651 !! test
10652 Image: caption containing a newline
10653 !! wikitext
10654 [[File:Foobar.jpg|This
10655 *is some text]]
10656 !! html/php
10657 <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>
10658 </p>
10659 !! html/parsoid
10660 <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>
10661 !!end
10663 !!test
10664 Image: caption containing leading space
10665 (The leading space should not trigger nowiki escaping in wt2wt mode)
10666 !! wikitext
10667 [[File:Foobar.jpg|thumb| bar]]
10668 !! html/php
10669 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
10671 !! html/parsoid
10672 <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>
10673 !!end
10675 !! test
10676 Image: caption containing a table
10677 !! options
10678 parsoid=wt2html,wt2wt,html2html
10679 !! wikitext
10680 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
10682 ! Foo !! Bar
10684 | Foo1 || Bar1
10686 and some more text.]]
10687 !! html/php
10688 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10690 !! html/parsoid
10691 <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
10692 <table>
10693 <tbody>
10694 <tr><th>Foo </th><th>Bar</th></tr>
10695 <tr>
10696 <td>Foo1 </td>
10697 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
10698 !! end
10700 !! test
10701 Bug 3090: External links other than http: in image captions
10702 !! wikitext
10703 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
10704 !! html/php
10705 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></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>
10707 !! html/parsoid
10708 <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>
10709 !! end
10711 !! test
10712 Custom class
10713 !! options
10714 parsoid=wt2html,wt2wt,html2html
10715 !! wikitext
10716 [[Image:foobar.jpg|a|class=b]]
10717 !! html/php
10718 <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>
10719 </p>
10720 !! html/parsoid
10721 <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>
10722 !! end
10724 !! test
10725 Localized image handling (1).
10726 !! options
10727 parsoid=wt2html,wt2wt,html2html
10728 language=es
10729 !! wikitext
10730 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
10731 !! html/php
10732 <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>
10734 !! html/parsoid
10735 <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>
10736 !! end
10738 !! test
10739 Localized image handling (2).
10740 !! options
10741 thumbsize=220
10742 parsoid=wt2html,wt2wt,html2html
10743 language=es
10744 !! wikitext
10745 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
10746 !! html/php
10747 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10749 !! html/parsoid
10750 <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>
10751 !! end
10753 !! test
10754 "border", "frameless" and "class" attributes on an image.
10755 !! options
10756 thumbsize=220
10757 parsoid=wt2html,wt2wt,html2html
10758 !! wikitext
10759 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
10760 !! html/php
10761 <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>
10762 </p>
10763 !! html/parsoid
10764 <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>
10765 !! end
10767 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
10768 !! test
10769 Invalid image attributes (bug 62500)
10770 !! options
10771 thumbsize=220
10772 parsoid=wt2html,wt2wt,html2html
10773 !! wikitext
10774 [[File:Foobar.jpg|thumb|float|left|caption]]
10776 [[File:Foobar.jpg|thumb|righ|caption]]
10778 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
10779 !! html/php
10780 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10781 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10782 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
10784 !! html/parsoid
10785 <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>
10786 !! end
10788 !! article
10789 File:Barfoo.jpg
10790 !! text
10791 #REDIRECT [[File:Barfoo.jpg]]
10792 !! endarticle
10794 !! test
10795 Redirected image
10796 !! wikitext
10797 [[Image:Barfoo.jpg]]
10798 !! html
10799 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
10800 </p>
10801 !! end
10803 !! test
10804 Missing image with uploads disabled
10805 !! options
10806 wgEnableUploads=0
10807 !! wikitext
10808 [[Image:Foobaz.jpg]]
10809 !! html
10810 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
10811 </p>
10812 !! end
10814 # Parsoid-specific testing for images
10815 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10816 # Currently imperfect due to a flaw in the Parsoid testrunner
10817 # Work in progress
10818 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
10819 # image tests.
10821 !! test
10822 Parsoid-specific image handling - simple image with size and middle alignment
10823 !! wikitext
10824 [[File:Foobar.jpg|middle|50px]]
10825 !! html/parsoid
10826 <p><span class="mw-valign-middle" typeof="mw:Image">
10827 <a href="File:Foobar.jpg">
10828 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10829 </a>
10830 </span>
10831 </p>
10832 !! end
10834 !! test
10835 Parsoid-specific image handling - simple image with size, middle alignment,
10836 non-standard namespace alias
10837 !! options
10838 parsoid=wt2wt,wt2html,html2html
10839 !! wikitext
10840 [[Image:Foobar.jpg|middle|50px]]
10841 !! html/parsoid
10842 <p><span class="mw-valign-middle" typeof="mw:Image">
10843 <a href="File:Foobar.jpg">
10844 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10845 </a>
10846 </span>
10847 </p>
10848 !! end
10850 !! test
10851 Parsoid-specific image handling - simple image with size and middle alignment
10852 (existing content)
10853 !! wikitext
10854 [[File:Foobar.jpg|50px|middle]]
10855 !! html/parsoid
10856 <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>
10857 !! end
10859 !! test
10860 Parsoid-specific image handling - simple image with size and middle alignment
10861 and non-standard namespace name
10862 !! options
10863 parsoid=wt2html,wt2wt,html2html
10864 !! wikitext
10865 [[Image:Foobar.jpg|50px|middle]]
10866 !! html/parsoid
10867 <p><span class="mw-valign-middle" typeof="mw:Image">
10868 <a href="File:Foobar.jpg">
10869 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
10870 </a>
10871 </span>
10872 </p>
10873 !! end
10875 !! test
10876 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
10877 !! wikitext
10878 [[File:Foobar.jpg|500x10px|baseline|caption]]
10879 !! html/parsoid
10880 <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>
10881 !! end
10883 !! test
10884 Parsoid-specific image handling - simple image with border and size spec
10885 !! wikitext
10886 [[File:Foobar.jpg|50px|border|caption]]
10887 !! html/parsoid
10888 <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>
10889 !! end
10891 !! test
10892 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10893 !! wikitext
10894 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
10895 !! html/parsoid
10896 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
10897 <a href="File:Foobar.jpg">
10898 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
10899 </a>
10900 <figcaption>caption content</figcaption>
10901 </figure>
10902 !! end
10904 !! test
10905 Parsoid-specific image handling - thumbnail with halign, valign, and caption
10906 (existing content)
10907 !! wikitext
10908 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
10909 !! html/parsoid
10910 <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>
10911 !! end
10913 !! test
10914 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
10915 !! wikitext
10916 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
10917 !! html/parsoid
10918 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
10919 <a href="File:Foobar.jpg">
10920 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
10921 </a>
10922 <figcaption>caption</figcaption>
10923 </figure>
10924 !! end
10926 !! test
10927 Parsoid-specific image handling - thumbnail with specific size, halign,
10928 valign, and caption (existing content)
10929 !! wikitext
10930 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
10931 !! html/parsoid
10932 <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>
10933 !! end
10935 !! test
10936 Parsoid-specific image handling - framed image with specific size and caption
10937 (size is ignored)
10938 !! options
10939 parsoid=wt2html,wt2wt,html2html
10940 !! wikitext
10941 [[File:Foobar.jpg|frame|500x50px|caption]]
10942 !! html/parsoid
10943 <figure typeof="mw:Image/Frame">
10944 <a href="File:Foobar.jpg">
10945 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
10946 </a>
10947 <figcaption>caption</figcaption>
10948 </figure>
10949 !! end
10951 !! test
10952 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
10953 (size is ignored)
10954 !! options
10955 parsoid=wt2html,wt2wt,html2html
10956 !! wikitext
10957 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
10958 !! html/parsoid
10959 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
10960 <a href="File:Foobar.jpg">
10961 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
10962 </a>
10963 <figcaption>caption</figcaption>
10964 </figure>
10965 !! end
10967 !! test
10968 Parsoid-specific image handling - frameless image with specific size, border, and caption
10969 !! wikitext
10970 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
10971 !! html/parsoid
10972 <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>
10973 !! end
10975 !! test
10976 Parsoid-specific image handling - simple image with a formatted caption
10977 !! wikitext
10978 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
10979 !! html/parsoid
10980 <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>"}'>
10981 <a href="File:Foobar.jpg">
10982 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
10983 </a></span></p>
10984 !! end
10986 !! test
10987 Parsoid-specific image handling - caption with a template in it
10988 !! wikitext
10989 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
10990 !! html/parsoid
10991 <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>
10992 !! end
10994 !! test
10995 Parsoid-specific image handling - caption with unbalanced tags in it
10996 !! options
10997 parsoid=wt2html,wt2wt,html2html
10998 !! wikitext
11000 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11002 !! html/parsoid
11003 <p>foo</p>
11004 <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>
11005 <p>bar</p>
11006 !! end
11008 !! test
11009 Parsoid-specific image handling - empty caption (1)
11010 !! options
11011 parsoid=wt2html,wt2wt
11012 !! wikitext
11013 [[File:Foobar.jpg|thumb|]]
11014 !! html/parsoid
11015 <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>
11016 !! end
11018 # empty captions don't get serialized unless we're in the "round trip" case
11019 !! test
11020 Parsoid-specific image handling - empty caption (2)
11021 !! options
11022 parsoid=html2wt
11023 !! html/parsoid
11024 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11025   <a href="File:Foobar.jpg">
11026     <img resource="./File:Foobar.jpg"
11027          src="//example.com/images/3/3a/Foobar.jpg"
11028          height="25" width="220"/>
11029   </a>
11030   <figcaption></figcaption>
11031 </figure>
11032 !! wikitext
11033 [[File:Foobar.jpg|thumb]]
11034 !! end
11036 !! test
11037 Parsoid-specific image handling - whitespace caption
11038 !! wikitext
11039 [[File:Foobar.jpg|thumb| ]]
11040 !! html/parsoid
11041 <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>
11042 !! end
11044 !! test
11045 Parsoid-specific image handling - lang option
11046 !! wikitext
11048 [[File:Foobar.svg|lang=de|caption]]
11050 !! html/parsoid
11051 <p>foo
11052 <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>
11053 bar</p>
11054 !! end
11058 ### Subpages
11060 !! article
11061 Subpage test/subpage
11062 !! text
11064 !! endarticle
11066 !! test
11067 Subpage link
11068 !! options
11069 subpage title=[[Subpage test]]
11070 !! wikitext
11071 [[/subpage]]
11072 !! html
11073 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11074 </p>
11075 !! end
11077 !! test
11078 Subpage noslash link
11079 !! options
11080 subpage title=[[Subpage test]]
11081 !! wikitext
11082 [[/subpage/]]
11083 !! html
11084 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11085 </p>
11086 !! end
11088 # TODO: make this PHP-parser compatible!
11089 !! test
11090 Relative subpage noslash link
11091 !! options
11092 parsoid=wt2wt,wt2html,html2html
11093 subpage title=[[Subpage test/1/2/3/4]]
11094 !! wikitext
11095 [[../../subpage/]]
11097 [[../../subpage]]
11098 !! html
11099 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11100 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11101 !! end
11103 !! test
11104 Parsoid: dot-slash prefixed wikilinks
11105 !! wikitext
11106 [[./foo]]
11108 [[././bar]]
11110 [[././baz/]]
11111 !! html/php
11112 <p>[[./foo]]
11113 </p><p>[[././bar]]
11114 </p><p>[[././baz/]]
11115 </p>
11116 !! html/parsoid
11117 <p>[[./foo]]
11118 </p><p>[[././bar]]
11119 </p><p>[[././baz/]]
11120 </p>
11121 !! end
11123 !! test
11124 Render invalid page names as plain text (bug 51090)
11125 !! wikitext
11126 [[./../foo|bar]]
11127 [[foo�|bar]]
11128 [[foo/.|bar]]
11129 [[foo/..|bar]]
11130 [[foo~~~bar]]
11131 [[foo>bar]]
11132 [[foo[bar]]
11133 [[.]]
11134 [[..]]
11135 [[foo././bar]]
11137 [[{{echo|./../foo}}|bar]]
11138 [[{{echo|foo/.}}|bar]]
11139 [[{{echo|foo/..}}|bar]]
11140 [[{{echo|foo~~~~bar}}]]
11141 [[{{echo|foo>bar}}]]
11142 [[{{echo|foo././bar}}]]
11143 [[{{echo|foo{bar}}]]
11144 [[{{echo|foo}bar}}]]
11145 [[{{echo|foo[bar}}]]
11146 [[{{echo|foo]bar}}]]
11147 [[{{echo|foo<bar}}]]
11148 !!html/php
11149 <p>[[./../foo|bar]]
11150 [[foo�|bar]]
11151 [[foo/.|bar]]
11152 [[foo/..|bar]]
11153 [[foo~~~bar]]
11154 [[foo&gt;bar]]
11155 [[foo[bar]]
11156 [[.]]
11157 [[..]]
11158 [[foo././bar]]
11159 </p><p>[[./../foo|bar]]
11160 [[foo/.|bar]]
11161 [[foo/..|bar]]
11162 [[foo~~~~bar]]
11163 [[foo&gt;bar]]
11164 [[foo././bar]]
11165 [[foo{bar]]
11166 [[foo}bar]]
11167 [[foo[bar]]
11168 [[foo]bar]]
11169 [[foo&lt;bar]]
11170 </p>
11171 !!html/parsoid
11172 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11173 <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>
11174 !!end
11176 !! test
11177 Disabled subpages
11178 !! wikitext
11179 [[/subpage]]
11180 !! html
11181 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11182 </p>
11183 !! end
11185 !! test
11186 BUG 561: {{/Subpage}}
11187 !! options
11188 subpage title=[[Page]]
11189 !! wikitext
11190 {{/Subpage}}
11191 !! html
11192 <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>
11193 </p>
11194 !! end
11197 ### Categories
11199 !! article
11200 Category:MediaWiki User's Guide
11201 !! text
11202 blah
11203 !! endarticle
11205 !! test
11206 Link to category
11207 !! wikitext
11208 [[:Category:MediaWiki User's Guide]]
11209 !! html
11210 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11211 </p>
11212 !! end
11214 !! test
11215 Simple category
11216 !! options
11218 !! wikitext
11219 [[Category:MediaWiki User's Guide]]
11220 !! html
11221 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11222 !! end
11224 !! test
11225 PAGESINCATEGORY invalid title fatal (r33546 fix)
11226 !! wikitext
11227 {{PAGESINCATEGORY:<bogus>}}
11228 !! html
11229 <p>0
11230 </p>
11231 !! end
11233 !! test
11234 Category with different sort key
11235 !! options
11237 !! wikitext
11238 [[Category:MediaWiki User's Guide|Foo]]
11239 !! html
11240 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11241 !! end
11243 !! test
11244 Category with identical sort key
11245 !! options
11247 !! wikitext
11248 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11249 !! html
11250 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11251 !! end
11253 !! test
11254 Category with empty sort key
11255 !! options
11258 !! wikitext
11259 [[Category:MediaWiki User's Guide|]]
11260 !! html
11261 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11262 !! end
11264 !! test
11265 Category with empty sort key and parentheses
11266 !! options
11269 !! wikitext
11270 [[Category:Foo (bar)|]]
11271 !! html
11272 [[Category:Foo (bar)|Foo]]
11273 !! end
11275 !! test
11276 Category with link tail
11277 !! options
11280 !! wikitext
11281 123[[Category:Foo]]456
11282 !! html
11283 123[[Category:Foo]]456
11284 !! end
11286 !! test
11287 Category with template
11288 !! options
11291 !! wikitext
11292 [[Category:{{echo|Foo}}]]
11293 !! html
11294 [[Category:{{echo|Foo}}]]
11295 !! end
11297 !! test
11298 Category with template in sort key
11299 !! options
11302 !! wikitext
11303 [[Category:Foo|{{echo|Bar}}]]
11304 !! html
11305 [[Category:Foo|{{echo|Bar}}]]
11306 !! end
11308 !! test
11309 Category with template in sort key and title
11310 !! options
11313 !! wikitext
11314 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11315 !! html
11316 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11317 !! end
11319 !! test
11320 Category / paragraph interactions
11321 !! wikitext
11322 Foo [[Category:Baz]] Bar
11324 Foo [[Category:Baz]]
11328 [[Category:Baz]]
11332 [[Category:Baz]] Bar
11335 [[Category:Baz]]
11336  [[Category:Baz]]
11337 [[Category:Baz]]
11340 [[Category:Baz]]
11341  [[Category:Baz]]
11342 [[Category:Baz]]
11344 [[Category:Baz]]
11345  {{echo|[[Category:Baz]]}}
11346 [[Category:Baz]]
11347 !! html
11348 <p>Foo Bar
11349 </p><p>Foo
11351 </p><p>Foo
11353 </p><p>Foo Bar
11354 </p><p>Foo
11356 </p>
11357 !! end
11359 !! test
11360 Parsoid: Serialize link to category page with colon escape
11361 !! options
11362 parsoid
11363 !! wikitext
11365 [[:Category:Foo]]
11366 [[:Category:Foo|Bar]]
11367 !! html
11369 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11370 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11371 </p>
11372 !! end
11374 !! test
11375 Parsoid: Link prefix/suffixes aren't applied to category links
11376 !! options
11377 parsoid=wt2html,wt2wt,html2html
11378 language=is
11379 !! wikitext
11380 x[[Category:Foo]]y
11381 !! html
11382 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11383 !! end
11385 !! test
11386 Parsoid: Serialize link to file page with colon escape
11387 !! options
11388 parsoid
11389 !! wikitext
11391 [[:File:Foo.png]]
11392 [[:File:Foo.png|Bar]]
11393 !! html
11395 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11396 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11397 </p>
11398 !! end
11400 !! test
11401 Parsoid: Serialize a genuine category link without colon escape
11402 !! options
11403 parsoid
11404 !! wikitext
11405 [[Category:Foo]]
11406 [[Category:Foo|Bar]]
11407 !! html
11408 <link rel="mw:PageProp/Category" href="Category:Foo">
11409 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11410 !! end
11412 !! test
11413 Parsoid: Defaultsort
11414 !! options
11415 parsoid
11416 !! wikitext
11417 {{DEFAULTSORT:Foo}}
11418 !! html
11419 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11420 !! end
11423 ### Inter-language links
11425 !! test
11426 Inter-language links
11427 !! options
11429 !! wikitext
11430 [[es:Alimento]]
11431 [[fr:Nourriture]]
11432 [[zh:&#39135;&#21697;]]
11433 !! html
11434 es:Alimento fr:Nourriture zh:食品
11435 !! end
11437 !! test
11438 Duplicate interlanguage links (bug 24502)
11439 !! options
11441 !! wikitext
11442 [[es:1]]
11443 [[es:2]]
11444 [[fr:1]]
11445 [[fr:2]]
11446 !! html
11447 es:1 fr:1
11448 !! end
11451 ### Sections
11453 !! test
11454 Basic section headings
11455 !! wikitext
11456 == Headline 1 ==
11457 Some text
11459 ==Headline 2==
11460 More
11461 ===Smaller headline===
11462 Blah blah
11463 !! html
11464 <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>
11465 <p>Some text
11466 </p>
11467 <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>
11468 <p>More
11469 </p>
11470 <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>
11471 <p>Blah blah
11472 </p>
11473 !! end
11475 !! test
11476 Section headings with TOC
11477 !! wikitext
11478 == Headline 1 ==
11479 === Subheadline 1 ===
11480 ===== Skipping a level =====
11481 ====== Skipping a level ======
11483 == Headline 2 ==
11484 Some text
11485 ===Another headline===
11486 !! html
11487 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11488 <ul>
11489 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11490 <ul>
11491 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11492 <ul>
11493 <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>
11494 <ul>
11495 <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>
11496 </ul>
11497 </li>
11498 </ul>
11499 </li>
11500 </ul>
11501 </li>
11502 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11503 <ul>
11504 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11505 </ul>
11506 </li>
11507 </ul>
11508 </div>
11510 <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>
11511 <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>
11512 <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>
11513 <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>
11514 <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>
11515 <p>Some text
11516 </p>
11517 <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>
11519 !! end
11521 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11522 !! test
11523 Handling of sections up to level 6 and beyond
11524 !! wikitext
11525 = Level 1 Heading=
11526 == Level 2 Heading==
11527 === Level 3 Heading===
11528 ==== Level 4 Heading====
11529 ===== Level 5 Heading=====
11530 ====== Level 6 Heading======
11531 ======= Level 7 Heading=======
11532 ======== Level 8 Heading========
11533 ========= Level 9 Heading=========
11534 ========== Level 10 Heading==========
11535 !! html
11536 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11537 <ul>
11538 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11539 <ul>
11540 <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>
11541 <ul>
11542 <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>
11543 <ul>
11544 <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>
11545 <ul>
11546 <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>
11547 <ul>
11548 <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>
11549 <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>
11550 <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>
11551 <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>
11552 <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>
11553 </ul>
11554 </li>
11555 </ul>
11556 </li>
11557 </ul>
11558 </li>
11559 </ul>
11560 </li>
11561 </ul>
11562 </li>
11563 </ul>
11564 </div>
11566 <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>
11567 <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>
11568 <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>
11569 <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>
11570 <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>
11571 <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>
11572 <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>
11573 <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>
11574 <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>
11575 <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>
11577 !! end
11579 !! test
11580 TOC regression (bug 9764)
11581 !! wikitext
11582 == title 1 ==
11583 === title 1.1 ===
11584 ==== title 1.1.1 ====
11585 === title 1.2 ===
11586 == title 2 ==
11587 === title 2.1 ===
11588 !! html
11589 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11590 <ul>
11591 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11592 <ul>
11593 <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>
11594 <ul>
11595 <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>
11596 </ul>
11597 </li>
11598 <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>
11599 </ul>
11600 </li>
11601 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11602 <ul>
11603 <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>
11604 </ul>
11605 </li>
11606 </ul>
11607 </div>
11609 <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>
11610 <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>
11611 <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>
11612 <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>
11613 <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>
11614 <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>
11616 !! end
11618 !! test
11619 TOC with wgMaxTocLevel=3 (bug 6204)
11620 !! options
11621 wgMaxTocLevel=3
11622 !! wikitext
11623 == title 1 ==
11624 === title 1.1 ===
11625 ==== title 1.1.1 ====
11626 === title 1.2 ===
11627 == title 2 ==
11628 === title 2.1 ===
11629 !! html
11630 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11631 <ul>
11632 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11633 <ul>
11634 <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>
11635 <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>
11636 </ul>
11637 </li>
11638 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11639 <ul>
11640 <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>
11641 </ul>
11642 </li>
11643 </ul>
11644 </div>
11646 <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>
11647 <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>
11648 <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>
11649 <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>
11650 <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>
11651 <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>
11653 !! end
11655 !! test
11656 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11657 !! options
11658 wgMaxTocLevel=3
11659 !! wikitext
11660 ==Section 1==
11661 ===Section 1.1===
11662 ====Section 1.1.1====
11663 ====Section 1.1.1.1====
11664 ==Section 2==
11665 !! html
11666 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11667 <ul>
11668 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11669 <ul>
11670 <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>
11671 </ul>
11672 </li>
11673 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11674 </ul>
11675 </div>
11677 <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>
11678 <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>
11679 <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>
11680 <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>
11681 <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>
11683 !! end
11686 !! test
11687 Resolving duplicate section names
11688 !! wikitext
11689 == Foo bar ==
11690 == Foo bar ==
11691 !! html
11692 <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>
11693 <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>
11695 !! end
11697 !! test
11698 Resolving duplicate section names with differing case (bug 10721)
11699 !! wikitext
11700 == Foo bar ==
11701 == Foo Bar ==
11702 !! html
11703 <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>
11704 <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>
11706 !! end
11708 !! article
11709 Template:sections
11710 !! text
11711 ===Section 1===
11712 ==Section 2==
11713 !! endarticle
11715 !! test
11716 Template with sections, __NOTOC__
11717 !! wikitext
11718 __NOTOC__
11719 ==Section 0==
11720 {{sections}}
11721 ==Section 4==
11722 !! html
11723 <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>
11724 <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>
11725 <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>
11726 <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>
11728 !! end
11730 !! test
11731 __NOEDITSECTION__ keyword
11732 !! wikitext
11733 __NOEDITSECTION__
11734 ==Section 1==
11735 ==Section 2==
11736 !! html
11737 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
11738 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
11740 !! end
11742 !! test
11743 Link inside a section heading
11744 !! wikitext
11745 ==Section with a [[Main Page|link]] in it==
11746 !! html
11747 <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>
11749 !! end
11751 !! test
11752 TOC regression (bug 12077)
11753 !! wikitext
11754 __TOC__
11755 == title 1 ==
11756 === title 1.1 ===
11757 == title 2 ==
11758 !! html
11759 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11760 <ul>
11761 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11762 <ul>
11763 <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>
11764 </ul>
11765 </li>
11766 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
11767 </ul>
11768 </div>
11770 <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>
11771 <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>
11772 <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>
11774 !! end
11776 !! test
11777 BUG 1219 URL next to image (good)
11778 !! wikitext
11779 http://example.com [[Image:foobar.jpg]]
11780 !! html
11781 <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>
11782 </p>
11783 !!end
11785 !! test
11786 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
11787 !! wikitext
11788 === 
11789 The line above must have a trailing space!
11790 === <!--
11791 --> <!-- -->
11792 But just in case it doesn't...
11793 !! html
11794 <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>
11795 <p>The line above must have a trailing space!
11796 </p>
11797 <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>
11798 <p>But just in case it doesn't...
11799 </p>
11800 !! end
11802 !! test
11803 Header with special characters (bug 25462)
11804 !! wikitext
11805 The tooltips shall not show entities to the user (ie. be double escaped)
11807 == text > text ==
11808 section 1
11810 == text < text ==
11811 section 2
11813 == text & text ==
11814 section 3
11816 == text ' text ==
11817 section 4
11819 == text " text ==
11820 section 5
11821 !! html
11822 <p>The tooltips shall not show entities to the user (ie. be double escaped)
11823 </p>
11824 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11825 <ul>
11826 <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>
11827 <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>
11828 <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>
11829 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
11830 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
11831 </ul>
11832 </div>
11834 <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>
11835 <p>section 1
11836 </p>
11837 <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>
11838 <p>section 2
11839 </p>
11840 <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>
11841 <p>section 3
11842 </p>
11843 <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>
11844 <p>section 4
11845 </p>
11846 <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>
11847 <p>section 5
11848 </p>
11849 !! end
11851 !! test
11852 Headers with excess '=' characters
11853 (Are similar tests necessary beyond the 1st level?)
11854 !! wikitext
11855 =foo==
11856 ==foo=
11857 =''italic'' heading==
11858 ==''italic'' heading=
11859 !! html
11860 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11861 <ul>
11862 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
11863 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
11864 <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>
11865 <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>
11866 </ul>
11867 </div>
11869 <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>
11870 <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>
11871 <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>
11872 <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>
11874 !! end
11876 !! test
11877 HTML headers vs TOC (bug 23393)
11878 (__NOEDITSECTION__ for clearer output, doesn't matter here)
11879 !! wikitext
11880 <h1>Header 1</h1>
11881 == Header 1.1 ==
11882 == Header 1.2 ==
11884 <h1>Header 2
11885 </h1>
11886 == Header 2.1 ==
11887 == Header 2.2 ==
11888 __NOEDITSECTION__
11889 !! html
11890 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11891 <ul>
11892 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
11893 <ul>
11894 <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>
11895 <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>
11896 </ul>
11897 </li>
11898 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
11899 <ul>
11900 <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>
11901 <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>
11902 </ul>
11903 </li>
11904 </ul>
11905 </div>
11907 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
11908 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
11909 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
11910 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
11911 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
11912 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
11914 !! end
11916 !! test
11917 Single-line or multiline-comments can follow headings
11918 !! options
11919 parsoid=wt2html,wt2wt
11920 !! wikitext
11921 ==foo==<!---->
11922 ==bar==<!--c1-->
11923 ==baz==<!--
11925 c3-->
11926 !! html
11927 <h2><span class="mw-headline" id="foo">foo</span></h2>
11928 <h2><span class="mw-headline" id="bar">bar</span></h2>
11929 <h2><span class="mw-headline" id="baz">baz</span></h2>
11931 !! end
11933 !! test
11934 BUG 1219 URL next to image (broken)
11935 !! wikitext
11936 http://example.com[[Image:foobar.jpg]]
11937 !! html
11938 <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>
11939 </p>
11940 !!end
11942 !! test
11943 Bug 1186 news: in the middle of text
11944 !! wikitext
11945 http://en.wikinews.org/wiki/Wikinews:Workplace
11946 !! html
11947 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
11948 </p>
11949 !!end
11952 !! test
11953 Namespaced link must have a title
11954 !! wikitext
11955 [[Project:]]
11956 !! html
11957 <p>[[Project:]]
11958 </p>
11959 !!end
11961 !! test
11962 Namespaced link must have a title (bad fragment version)
11963 !! wikitext
11964 [[Project:#fragment]]
11965 !! html
11966 <p>[[Project:#fragment]]
11967 </p>
11968 !!end
11972 ### HTML tags and HTML attributes
11975 !! test
11976 div with no attributes
11977 !! wikitext
11978 <div>HTML rocks</div>
11979 !! html
11980 <div>HTML rocks</div>
11982 !! end
11984 !! test
11985 div with double-quoted attribute
11986 !! wikitext
11987 <div id="rock">HTML rocks</div>
11988 !! html
11989 <div id="rock">HTML rocks</div>
11991 !! end
11993 !! test
11994 div with single-quoted attribute
11995 !! wikitext
11996 <div id='rock'>HTML rocks</div>
11997 !! html
11998 <div id="rock">HTML rocks</div>
12000 !! end
12002 !! test
12003 div with unquoted attribute
12004 !! wikitext
12005 <div id=rock>HTML rocks</div>
12006 !! html
12007 <div id="rock">HTML rocks</div>
12009 !! end
12011 !! test
12012 div with illegal double attributes
12013 !! wikitext
12014 <div id="a" id="b">HTML rocks</div>
12015 !! html
12016 <div id="b">HTML rocks</div>
12018 !!end
12020 # FIXME: produce empty string instead of "class" in the PHP parser, following
12021 # the HTML5 spec.
12022 !! test
12023 div with empty attribute value, space before equals
12024 !! options
12025 parsoid
12026 !! wikitext
12027 <div class =>HTML rocks</div>
12028 !! html
12029 <div class="">HTML rocks</div>
12031 !! end
12033 # The PHP parser escapes the opening brace to &#123; for some reason, so
12034 # disabled this test for it.
12035 !! test
12036 div with braces in attribute value
12037 !! options
12038 parsoid
12039 !! wikitext
12040 <div title="{}">Foo</div>
12041 !! html
12042 <div title="{}">Foo</div>
12043 !! end
12045 # This it very inconsistent in the PHP parser: it returns 
12046 # class="class" if there is a space between the name and the equal sign (see
12047 # 'div with empty attribute value, space before equals'), but strips the
12048 # attribute completely if the space is missing. We hope that not much content
12049 # depends on this, so are implementing the behavior below in Parsoid for
12050 # consistencies' sake. Disabled for the PHP parser. 
12051 # FIXME: fix this behavior in the PHP parser?
12052 !! test
12053 div with empty attribute value, no space before equals
12054 !! options
12055 parsoid
12056 !! wikitext
12057 <div class=>HTML rocks</div>
12058 !! html
12059 <div class="">HTML rocks</div>
12061 !! end
12063 !! test
12064 HTML multiple attributes correction
12065 !! wikitext
12066 <p class="error" class="awesome">Awesome!</p>
12067 !! html
12068 <p class="awesome">Awesome!</p>
12070 !!end
12072 !! test
12073 Table multiple attributes correction
12074 !! wikitext
12076 !+ class="error" class="awesome"| status
12078 !! html
12079 <table>
12080 <tr>
12081 <th class="awesome"> status
12082 </th></tr></table>
12084 !!end
12086 !! test
12087 DIV IN UPPERCASE
12088 !! wikitext
12089 <DIV ID="x">HTML ROCKS</DIV>
12090 !! html
12091 <div id="x">HTML ROCKS</div>
12093 !!end
12095 !! test
12096 Non-ASCII pseudo-tags are rendered as text
12097 !! wikitext
12098 <khyô>
12099 !! html
12100 <p>&lt;khyô&gt;
12101 </p>
12102 !! end
12104 !! test
12105 Pseudo-tag with URL 'name' renders as url link
12106 !! wikitext
12107 <http://example.com/>
12108 !! html
12109 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12110 </p>
12111 !! end
12113 !! test
12114 text with amp in the middle of nowhere
12115 !! wikitext
12116 Remember AT&T?
12117 !! html
12118 <p>Remember AT&amp;T?
12119 </p>
12120 !! end
12122 !! test
12123 text with character entity: eacute
12124 !! wikitext
12125 I always thought &eacute; was a cute letter.
12126 !! html
12127 <p>I always thought &#233; was a cute letter.
12128 </p>
12129 !! end
12131 !! test
12132 text with entity-escaped character entity-like string: eacute
12133 !! wikitext
12134 I always thought &amp;eacute; was a cute letter.
12135 !! html
12136 <p>I always thought &amp;eacute; was a cute letter.
12137 </p>
12138 !! end
12140 !! test
12141 text with undefined character entity: xacute
12142 !! wikitext
12143 I always thought &xacute; was a cute letter.
12144 !! html
12145 <p>I always thought &amp;xacute; was a cute letter.
12146 </p>
12147 !! end
12149 # TODO: generalize to PHP parser?
12150 !! test
12151 HTML5 tags
12152 !! options
12153 parsoid
12154 !! wikitext
12155 <data value="5">five</data>
12156 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12157 <mark>This highlighted text</mark>
12158 !! html
12159 <p><data value="5">five</data>
12160 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12161 <mark>This highlighted text</mark></p>
12162 !! end
12164 !! test
12165 HTML tag with leading space is parsed as text
12166 !! wikitext
12167 < div>foo< /div>
12168 !! html
12169 <p>&lt; div&gt;foo&lt; /div&gt;
12170 </p>
12171 !! end
12174 ### Nesting tests (see bug 41545, 50604, 51081)
12177 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12178 # Note that html2wt is considerably more difficult if we use <b> in
12179 # the test case, instead of <big>
12180 !! test
12181 Ensure that HTML adoption agency algorithm is properly implemented.
12182 !! wikitext
12183 <big>X<big>Y</big>Z</big>
12184 !! html
12185 <p><big>X<big>Y</big>Z</big>
12186 </p>
12187 !! end
12189 # This was bug 41545 in the PHP parser.
12190 !! test
12191 Nesting of <kbd>
12192 !! wikitext
12193 <kbd>X<kbd>Y</kbd>Z</kbd>
12194 !! html
12195 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12196 </p>
12197 !! end
12199 # The following cases were bug 51081 in the PHP parser.
12200 # Note that there are some other nestable tags (b, i, etc) which are
12201 # not covered; see bug 51081 for discussion.
12202 !! test
12203 Nesting of <em>
12204 !! wikitext
12205 <em>X<em>Y</em>Z</em>
12206 !! html
12207 <p><em>X<em>Y</em>Z</em>
12208 </p>
12209 !! end
12211 !! test
12212 Nesting of <strong>
12213 !! wikitext
12214 <strong>X<strong>Y</strong>Z</strong>
12215 !! html
12216 <p><strong>X<strong>Y</strong>Z</strong>
12217 </p>
12218 !! end
12220 !! test
12221 Nesting of <q>
12222 !! wikitext
12223 <q>X<q>Y</q>Z</q>
12224 !! html
12225 <p><q>X<q>Y</q>Z</q>
12226 </p>
12227 !! end
12229 !! test
12230 Nesting of <ruby>
12231 !! wikitext
12232 <ruby>X<ruby>Y</ruby>Z</ruby>
12233 !! html
12234 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12235 </p>
12236 !! end
12238 !! test
12239 Nesting of <bdo>
12240 !! wikitext
12241 <bdo>X<bdo>Y</bdo>Z</bdo>
12242 !! html
12243 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12244 </p>
12245 !! end
12249 ### Media links
12252 !! test
12253 Media link
12254 !! wikitext
12255 [[Media:Foobar.jpg]]
12256 !! html
12257 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12258 </p>
12259 !! end
12261 !! test
12262 Media link with text
12263 !! wikitext
12264 [[Media:Foobar.jpg|A neat file to look at]]
12265 !! html
12266 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12267 </p>
12268 !! end
12270 # FIXME: this is still bad HTML tag nesting
12271 !! test
12272 Media link with nasty text
12273 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12274 !! wikitext
12275 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12276 !! html
12277 <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>
12279 !! end
12281 !! test
12282 Media link to nonexistent file (bug 1702)
12283 !! wikitext
12284 [[Media:No such.jpg]]
12285 !! html
12286 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12287 </p>
12288 !! end
12290 !! test
12291 Image link to nonexistent file (bug 1850 - good)
12292 !! wikitext
12293 [[Image:No such.jpg]]
12294 !! html
12295 <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>
12296 </p>
12297 !! end
12299 !! test
12300 :Image link to nonexistent file (bug 1850 - bad)
12301 !! wikitext
12302 [[:Image:No such.jpg]]
12303 !! html
12304 <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>
12305 </p>
12306 !! end
12310 !! test
12311 Character reference normalization in link text (bug 1938)
12312 !! wikitext
12313 [[Main Page|this&that]]
12314 !! html
12315 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12316 </p>
12317 !!end
12319 !! article
12320 אַ
12321 !! text
12322 Test for unicode normalization
12324 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12325 !! endarticle
12327 !! test
12328 (bug 19451) Links should refer to the normalized form.
12329 !! wikitext
12330 [[&#xFB2E;]]
12331 [[&#x5d0;&#x5b7;]]
12332 [[&#x5d0;ַ]]
12333 [[א&#x5b7;]]
12334 [[אַ]]
12335 !! html
12336 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12337 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12338 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12339 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12340 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12341 </p>
12342 !! end
12344 !! test
12345 Empty attribute crash test (bug 2067)
12346 !! wikitext
12347 <font color="">foo</font>
12348 !! html
12349 <p><font color="">foo</font>
12350 </p>
12351 !! end
12353 !! test
12354 Empty attribute crash test single-quotes (bug 2067)
12355 !! wikitext
12356 <font color=''>foo</font>
12357 !! html
12358 <p><font color="">foo</font>
12359 </p>
12360 !! end
12362 !! test
12363 Attribute test: equals, then nothing
12364 !! wikitext
12365 <font color=>foo</font>
12366 !! html
12367 <p><font>foo</font>
12368 </p>
12369 !! end
12371 !! test
12372 Attribute test: unquoted value
12373 !! wikitext
12374 <font color=x>foo</font>
12375 !! html
12376 <p><font color="x">foo</font>
12377 </p>
12378 !! end
12380 !! test
12381 Attribute test: unquoted but illegal value (hash)
12382 !! wikitext
12383 <font color=#x>foo</font>
12384 !! html
12385 <p><font color="#x">foo</font>
12386 </p>
12387 !! end
12389 !! test
12390 Attribute test: no value
12391 !! wikitext
12392 <font color>foo</font>
12393 !! html
12394 <p><font color="color">foo</font>
12395 </p>
12396 !! end
12398 !! test
12399 Bug 2095: link with three closing brackets
12400 !! wikitext
12401 [[Main Page]]]
12402 !! html/php
12403 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12404 </p>
12405 !! html/parsoid
12406 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12407 !! end
12409 !! test
12410 Bug 2095: link with pipe and three closing brackets
12411 !! wikitext
12412 [[Main Page|link]]]
12413 !! html/php
12414 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12415 </p>
12416 !! html/parsoid
12417 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12418 !! end
12420 !! test
12421 Bug 2095: link with pipe and three closing brackets, version 2
12422 !! wikitext
12423 [[Main Page|[http://example.com/]]]
12424 !! html/php
12425 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12426 </p>
12427 !! html/parsoid
12428 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12429 !! end
12433 ### Safety
12436 !! article
12437 Template:Dangerous attribute
12438 !! text
12439 " onmouseover="alert(document.cookie)
12440 !! endarticle
12442 !! article
12443 Template:Dangerous style attribute
12444 !! text
12445 border-size: expression(alert(document.cookie))
12446 !! endarticle
12448 !! article
12449 Template:Div style
12450 !! text
12451 <div style="float: right; {{{1}}}">Magic div</div>
12452 !! endarticle
12454 !! test
12455 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12456 !! wikitext
12457 <div title="{{test}}"></div>
12458 !! html
12459 <div title="This is a test template"></div>
12461 !! end
12463 !! test
12464 Bug 2304: HTML attribute safety (dangerous template; 2309)
12465 !! wikitext
12466 <div title="{{dangerous attribute}}"></div>
12467 !! html
12468 <div title=""></div>
12470 !! end
12472 !! test
12473 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12474 !! wikitext
12475 <div style="{{dangerous style attribute}}"></div>
12476 !! html
12477 <div style="/* insecure input */"></div>
12479 !! end
12481 !! test
12482 Bug 2304: HTML attribute safety (safe parameter; 2309)
12483 !! wikitext
12484 {{div style|width: 200px}}
12485 !! html
12486 <div style="float: right; width: 200px">Magic div</div>
12488 !! end
12490 !! test
12491 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12492 !! wikitext
12493 {{div style|width: expression(alert(document.cookie))}}
12494 !! html
12495 <div style="/* insecure input */">Magic div</div>
12497 !! end
12499 !! test
12500 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12501 !! wikitext
12502 {{div style|"><script>alert(document.cookie)</script>}}
12503 !! html
12504 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12506 !! end
12508 !! test
12509 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12510 !! wikitext
12511 {{div style|" ><script>alert(document.cookie)</script>}}
12512 !! html
12513 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12515 !! end
12517 !! test
12518 Bug 2304: HTML attribute safety (link)
12519 !! wikitext
12520 <div title="[[Main Page]]"></div>
12521 !! html
12522 <div title="&#91;&#91;Main Page]]"></div>
12524 !! end
12526 !! test
12527 Bug 2304: HTML attribute safety (italics)
12528 !! wikitext
12529 <div title="''foobar''"></div>
12530 !! html
12531 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12533 !! end
12535 !! test
12536 Bug 2304: HTML attribute safety (bold)
12537 !! wikitext
12538 <div title="'''foobar'''"></div>
12539 !! html
12540 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12542 !! end
12545 !! test
12546 Bug 2304: HTML attribute safety (ISBN)
12547 !! wikitext
12548 <div title="ISBN 1234567890"></div>
12549 !! html
12550 <div title="&#73;SBN 1234567890"></div>
12552 !! end
12554 !! test
12555 Bug 2304: HTML attribute safety (RFC)
12556 !! wikitext
12557 <div title="RFC 1234"></div>
12558 !! html
12559 <div title="&#82;FC 1234"></div>
12561 !! end
12563 !! test
12564 Bug 2304: HTML attribute safety (PMID)
12565 !! wikitext
12566 <div title="PMID 1234567890"></div>
12567 !! html
12568 <div title="&#80;MID 1234567890"></div>
12570 !! end
12572 !! test
12573 Bug 2304: HTML attribute safety (web link)
12574 !! wikitext
12575 <div title="http://example.com/"></div>
12576 !! html
12577 <div title="http&#58;//example.com/"></div>
12579 !! end
12581 !! test
12582 Bug 2304: HTML attribute safety (named web link)
12583 !! wikitext
12584 <div title="[http://example.com/ link]"></div>
12585 !! html
12586 <div title="&#91;http&#58;//example.com/ link]"></div>
12588 !! end
12590 !! test
12591 Bug 3244: HTML attribute safety (extension; safe)
12592 !! wikitext
12593 <div style="<nowiki>background:blue</nowiki>"></div>
12594 !! html
12595 <div style="background:blue"></div>
12597 !! end
12599 !! test
12600 Bug 3244: HTML attribute safety (extension; unsafe)
12601 !! wikitext
12602 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12603 !! html
12604 <div style="/* insecure input */"></div>
12606 !! end
12608 # More MSIE fun discovered by Tom Gilder
12610 !! test
12611 MSIE CSS safety test: spurious slash
12612 !! wikitext
12613 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12614 !! html
12615 <div style="/* insecure input */">evil</div>
12617 !! end
12619 !! test
12620 MSIE CSS safety test: hex code
12621 !! wikitext
12622 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12623 !! html
12624 <div style="/* insecure input */">evil</div>
12626 !! end
12628 !! test
12629 MSIE CSS safety test: comment in url
12630 !! wikitext
12631 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12632 !! html
12633 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12635 !! end
12637 !! test
12638 MSIE CSS safety test: comment in expression
12639 !! wikitext
12640 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12641 !! html
12642 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12644 !! end
12646 !! test
12647 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12648 !! wikitext
12649 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12650 !! html
12651 <p style="/* invalid control char */">A</p>
12653 !! end
12655 !! test
12656 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12657 !! wikitext
12658 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12659 <div style="top:EXPRESSION(alert())">B</div>
12660 !! html
12661 <p style="/* insecure input */">A</p>
12662 <div style="/* insecure input */">B</div>
12664 !! end
12666 !! test
12667 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12668 !! wikitext
12669 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12670 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12671 !! html
12672 <div style="/* insecure input */">A</div>
12673 <p style="/* insecure input */">B</p>
12675 !! end
12677 !! test
12678 MSIE 6 CSS safety test: sup/sub script (bug 55332)
12679 !! wikitext
12680 <div style="background-image:url⁽javascript:alert())">A</div>
12681 <div style="background-image:url₍javascript:alert())">B</div>
12682 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
12683 !! html
12684 <div style="/* insecure input */">A</div>
12685 <div style="/* insecure input */">B</div>
12686 <p style="/* insecure input */">C</p>
12688 !! end
12690 !! test
12691 Opera -o-link CSS
12692 !! wikitext
12693 <div
12694 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;"
12695 style="-o-link:attr(title);-o-link-source:current">X</div>
12696 !! html
12697 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
12699 !! end
12701 !! test
12702 MSIE 6 CSS safety test: Repetition markers (bug 55332)
12703 !! wikitext
12704 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
12705 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
12706 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
12707 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
12708 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
12709 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
12710 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
12711 !! html
12712 <p style="/* insecure input */">A</p>
12713 <p style="/* insecure input */">B</p>
12714 <p style="/* insecure input */">C</p>
12715 <p style="/* insecure input */">D</p>
12716 <p style="/* insecure input */">E</p>
12717 <p style="/* insecure input */">F</p>
12718 <p style="/* insecure input */">G</p>
12720 !! end
12722 !! test
12723 Table attribute legitimate extension
12724 !! wikitext
12726 !+ style="<nowiki>color:blue</nowiki>"| status
12728 !! html
12729 <table>
12730 <tr>
12731 <th style="color:blue"> status
12732 </th></tr></table>
12734 !!end
12736 !! test
12737 Table attribute safety
12738 !! wikitext
12740 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
12742 !! html
12743 <table>
12744 <tr>
12745 <th style="/* insecure input */"> status
12746 </th></tr></table>
12748 !! end
12750 !! test
12751 CSS line continuation 1
12752 !! wikitext
12753 <div style="background-image: u\&#10;rl(test.jpg);"></div>
12754 !! html
12755 <div style="/* insecure input */"></div>
12757 !! end
12759 !! test
12760 CSS line continuation 2
12761 !! wikitext
12762 <div style="background-image: u\&#13;rl(test.jpg); "></div>
12763 !! html
12764 <div style="/* insecure input */"></div>
12766 !! end
12768 !! article
12769 Template:Identity
12770 !! text
12771 {{{1}}}
12772 !! endarticle
12774 !! test
12775 Expansion of multi-line templates in attribute values (bug 6255)
12776 !! wikitext
12777 <div style="background: {{identity|#00FF00}}">-</div>
12778 !! html
12779 <div style="background: #00FF00">-</div>
12781 !! end
12784 !! test
12785 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
12786 !! wikitext
12787 <div style="background: 
12788 #00FF00">-</div>
12789 !! html
12790 <div style="background: #00FF00">-</div>
12792 !! end
12794 !! test
12795 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
12796 !! wikitext
12797 <div style="background: &#10;#00FF00">-</div>
12798 !! html
12799 <div style="background: &#10;#00FF00">-</div>
12801 !! end
12804 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
12806 !! test
12807 Parser hook: empty input
12808 !! wikitext
12809 <tag></tag>
12810 !! html
12811 <pre>
12813 array (
12815 </pre>
12817 !! end
12819 !! test
12820 Parser hook: empty input using terminated empty elements
12821 !! wikitext
12822 <tag/>
12823 !! html
12824 <pre>
12825 NULL
12826 array (
12828 </pre>
12830 !! end
12832 !! test
12833 Parser hook: empty input using terminated empty elements (space before)
12834 !! wikitext
12835 <tag />
12836 !! html
12837 <pre>
12838 NULL
12839 array (
12841 </pre>
12843 !! end
12845 !! test
12846 Parser hook: basic input
12847 !! wikitext
12848 <tag>input</tag>
12849 !! html
12850 <pre>
12851 'input'
12852 array (
12854 </pre>
12856 !! end
12859 !! test
12860 Parser hook: case insensitive
12861 !! wikitext
12862 <TAG>input</TAG>
12863 !! html
12864 <pre>
12865 'input'
12866 array (
12868 </pre>
12870 !! end
12873 !! test
12874 Parser hook: case insensitive, redux
12875 !! wikitext
12876 <TaG>input</TAg>
12877 !! html
12878 <pre>
12879 'input'
12880 array (
12882 </pre>
12884 !! end
12886 !! test
12887 Parser hook: nested tags
12888 !! options
12889 noxml
12890 !! wikitext
12891 <tag><tag></tag></tag>
12892 !! html
12893 <pre>
12894 '<tag>'
12895 array (
12897 </pre>&lt;/tag&gt;
12899 !! end
12901 !! test
12902 Parser hook: basic arguments
12903 !! wikitext
12904 <tag width=200 height = "100" depth = '50' square></tag>
12905 !! html
12906 <pre>
12908 array (
12909   'width' => '200',
12910   'height' => '100',
12911   'depth' => '50',
12912   'square' => 'square',
12914 </pre>
12916 !! end
12918 !! test
12919 Parser hook: argument containing a forward slash (bug 5344)
12920 !! wikitext
12921 <tag filename='/tmp/bla'></tag>
12922 !! html
12923 <pre>
12925 array (
12926   'filename' => '/tmp/bla',
12928 </pre>
12930 !! end
12932 !! test
12933 Parser hook: empty input using terminated empty elements (bug 2374)
12934 !! wikitext
12935 <tag foo=bar/>text
12936 !! html
12937 <pre>
12938 NULL
12939 array (
12940   'foo' => 'bar',
12942 </pre>text
12944 !! end
12946 # </tag> should be output literally since there is no matching tag that begins it
12947 !! test
12948 Parser hook: basic arguments using terminated empty elements (bug 2374)
12949 !! wikitext
12950 <tag width=200 height = "100" depth = '50' square/>
12951 other stuff
12952 </tag>
12953 !! html
12954 <pre>
12955 NULL
12956 array (
12957   'width' => '200',
12958   'height' => '100',
12959   'depth' => '50',
12960   'square' => 'square',
12962 </pre>
12963 <p>other stuff
12964 &lt;/tag&gt;
12965 </p>
12966 !! end
12969 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
12972 !! test
12973 Parser hook: static parser hook not inside a comment
12974 !! wikitext
12975 <statictag>hello, world</statictag>
12976 <statictag action=flush/>
12977 !! html
12978 <p>hello, world
12979 </p>
12980 !! end
12983 !! test
12984 Parser hook: static parser hook inside a comment
12985 !! wikitext
12986 <!-- <statictag>hello, world</statictag> -->
12987 <statictag action=flush/>
12988 !! html
12989 <p><br />
12990 </p>
12991 !! end
12993 # Nested template calls; this case was broken by Parser.php rev 1.506,
12994 # since reverted.
12996 !! article
12997 Template:One-parameter
12998 !! text
12999 (My parameter is: {{{1}}})
13000 !! endarticle
13002 !! article
13003 Template:Map-one-parameter
13004 !! text
13005 {{{{{1}}}|{{{2}}}}}
13006 !! endarticle
13008 !! test
13009 Nested template calls
13010 !! wikitext
13011 {{Map-one-parameter|One-parameter|param}}
13012 !! html
13013 <p>(My parameter is: param)
13014 </p>
13015 !! end
13019 ### Sanitizer
13021 !! test
13022 Sanitizer: Closing of open tags
13023 !! wikitext
13024 <s></s><table></table>
13025 !! html
13026 <s></s><table></table>
13028 !! end
13030 !! test
13031 Sanitizer: Closing of open but not closed tags
13032 !! wikitext
13033 <s>foo
13034 !! html
13035 <p><s>foo</s>
13036 </p>
13037 !! end
13039 !! test
13040 Sanitizer: Closing of closed but not open tags
13041 !! wikitext
13042 </s>
13043 !! html
13044 <p>&lt;/s&gt;
13045 </p>
13046 !! end
13048 !! test
13049 Sanitizer: Closing of closed but not open table tags
13050 !! wikitext
13051 Table not started</td></tr></table>
13052 !! html
13053 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13054 </p>
13055 !! end
13057 !! test
13058 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13059 !! wikitext
13060 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13061 !! html
13062 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13063 </p>
13064 !! end
13066 !! test
13067 Sanitizer: Validating the contents of the id attribute (bug 4515)
13068 !! options
13069 disabled
13070 !! wikitext
13071 <br id=9 />
13072 !! html
13073 Something, but definitely not <br id="9" />...
13074 !! end
13076 !! test
13077 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13078 !! options
13079 disabled
13080 !! wikitext
13081 <br id="foo" /><br id="foo" />
13082 !! html
13083 Something need to be done. foo-2 ? 
13084 !! end
13086 !! test
13087 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13088 !! wikitext
13089 <div itemscope>
13090         <meta itemprop="hello" content="world">
13091         <meta http-equiv="refresh" content="5">
13092         <meta itemprop="hello" http-equiv="refresh" content="5">
13093         <link itemprop="hello" href="{{SERVER}}">
13094         <link rel="stylesheet" href="{{SERVER}}">
13095         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13096 </div>
13097 !! html
13098 <div itemscope="itemscope">
13099 <p>     <meta itemprop="hello" content="world" />
13100         &lt;meta http-equiv="refresh" content="5"&gt;
13101         <meta itemprop="hello" content="5" />
13102 </p>
13103         <link itemprop="hello" href="http&#58;//example.org" />
13104         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13105         <link itemprop="hello" href="http&#58;//example.org" />
13106 </div>
13108 !! end
13110 !! test
13111 Language converter: output gets cut off unexpectedly (bug 5757)
13112 !! options
13113 language=zh
13114 !! wikitext
13115 this bit is safe: }-
13117 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13119 then we get cut off here: }-
13121 all additional text is vanished
13122 !! html
13123 <p>this bit is safe: }-
13124 </p><p>but if we add a conversion instance: xxx
13125 </p><p>then we get cut off here: }-
13126 </p><p>all additional text is vanished
13127 </p>
13128 !! end
13130 !! test
13131 Self closed html pairs (bug 5487)
13132 !! options
13133 !! wikitext
13134 <center><font id="bug" />Centered text</center>
13135 <div><font id="bug2" />In div text</div>
13136 !! html
13137 <center>&lt;font id="bug" /&gt;Centered text</center>
13138 <div>&lt;font id="bug2" /&gt;In div text</div>
13140 !! end
13146 !! test
13147 Punctuation: nbsp before exclamation
13148 !! wikitext
13149 C'est grave !
13150 !! html
13151 <p>C'est grave&#160;!
13152 </p>
13153 !! end
13155 !! test
13156 Punctuation: CSS !important (bug 11874)
13157 !! wikitext
13158 <div style="width:50% !important">important</div>
13159 !! html
13160 <div style="width:50% !important">important</div>
13162 !!end
13164 !! test
13165 Punctuation: CSS ! important (bug 11874; with space after)
13166 !! wikitext
13167 <div style="width:50% ! important">important</div>
13168 !! html
13169 <div style="width:50% ! important">important</div>
13171 !!end
13174 !! test
13175 HTML bullet list, closed tags (bug 5497)
13176 !! wikitext
13177 <ul>
13178 <li>One</li>
13179 <li>Two</li>
13180 </ul>
13181 !! html
13182 <ul>
13183 <li>One</li>
13184 <li>Two</li>
13185 </ul>
13187 !! end
13189 !! test
13190 HTML bullet list, unclosed tags (bug 5497)
13191 !! options
13192 disabled
13193 !! wikitext
13194 <ul>
13195 <li>One
13196 <li>Two
13197 </ul>
13198 !! html
13199 <ul>
13200 <li>One
13201 </li>
13202 <li>Two
13203 </li>
13204 </ul>
13206 !! end
13208 !! test
13209 HTML ordered list, closed tags (bug 5497)
13210 !! wikitext
13211 <ol>
13212 <li>One</li>
13213 <li>Two</li>
13214 </ol>
13215 !! html
13216 <ol>
13217 <li>One</li>
13218 <li>Two</li>
13219 </ol>
13221 !! end
13223 !! test
13224 HTML ordered list, unclosed tags (bug 5497)
13225 !! options
13226 disabled
13227 !! wikitext
13228 <ol>
13229 <li>One
13230 <li>Two
13231 </ol>
13232 !! html
13233 <ol>
13234 <li>One
13235 </li>
13236 <li>Two
13237 </li>
13238 </ol>
13240 !! end
13242 !! test
13243 HTML nested bullet list, closed tags (bug 5497)
13244 !! wikitext
13245 <ul>
13246 <li>One</li>
13247 <li>Two:
13248 <ul>
13249 <li>Sub-one</li>
13250 <li>Sub-two</li>
13251 </ul>
13252 </li>
13253 </ul>
13254 !! html
13255 <ul>
13256 <li>One</li>
13257 <li>Two:
13258 <ul>
13259 <li>Sub-one</li>
13260 <li>Sub-two</li>
13261 </ul>
13262 </li>
13263 </ul>
13265 !! end
13267 !! test
13268 HTML nested bullet list, open tags (bug 5497)
13269 !! options
13270 disabled
13271 !! wikitext
13272 <ul>
13273 <li>One
13274 <li>Two:
13275 <ul>
13276 <li>Sub-one
13277 <li>Sub-two
13278 </ul>
13279 </ul>
13280 !! html
13281 <ul>
13282 <li>One
13283 </li>
13284 <li>Two:
13285 <ul>
13286 <li>Sub-one
13287 </li>
13288 <li>Sub-two
13289 </li>
13290 </ul>
13291 </li>
13292 </ul>
13294 !! end
13296 !! test
13297 HTML nested ordered list, closed tags (bug 5497)
13298 !! wikitext
13299 <ol>
13300 <li>One</li>
13301 <li>Two:
13302 <ol>
13303 <li>Sub-one</li>
13304 <li>Sub-two</li>
13305 </ol>
13306 </li>
13307 </ol>
13308 !! html
13309 <ol>
13310 <li>One</li>
13311 <li>Two:
13312 <ol>
13313 <li>Sub-one</li>
13314 <li>Sub-two</li>
13315 </ol>
13316 </li>
13317 </ol>
13319 !! end
13321 !! test
13322 HTML nested ordered list, open tags (bug 5497)
13323 !! options
13324 disabled
13325 !! wikitext
13326 <ol>
13327 <li>One
13328 <li>Two:
13329 <ol>
13330 <li>Sub-one
13331 <li>Sub-two
13332 </ol>
13333 </ol>
13334 !! html
13335 <ol>
13336 <li>One
13337 </li>
13338 <li>Two:
13339 <ol>
13340 <li>Sub-one
13341 </li>
13342 <li>Sub-two
13343 </li>
13344 </ol>
13345 </li>
13346 </ol>
13348 !! end
13350 !! test
13351 HTML ordered list item with parameters oddity
13352 !! wikitext
13353 <ol><li id="fragment">One</li>
13354 </ol>
13355 !! html
13356 <ol><li id="fragment">One</li>
13357 </ol>
13359 !! end
13361 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13362 !!test
13363 bug 5918: autonumbering
13364 !! wikitext
13365 [http://first/] [http://second] [ftp://ftp]
13367 ftp://inlineftp
13369 [mailto:enclosed@mail.tld With target]
13371 [mailto:enclosed@mail.tld]
13373 mailto:inline@mail.tld
13374 !! html/php
13375 <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>
13376 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13377 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13378 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13379 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13380 </p>
13381 !! html/parsoid
13382 <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>
13383 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13384 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13385 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13386 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13387 !! end
13391 # Security and HTML correctness
13392 # From Nick Jenkins' fuzz testing
13395 !! test
13396 Fuzz testing: Parser13
13397 !! wikitext
13398 {| 
13399 | http://a|
13400 !! html
13401 <table>
13402 <tr>
13403 <td>
13404 </td>
13405 </tr>
13406 </table>
13408 !! end
13410 !! test
13411 Fuzz testing: Parser14
13412 !! wikitext
13413 == onmouseover= ==
13414 http://__TOC__
13415 !! html
13416 <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>
13417 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13418 <ul>
13419 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13420 </ul>
13421 </div>
13424 !! end
13426 !! test
13427 Fuzz testing: Parser14-table
13428 !! wikitext
13429 ==a==
13430 {| STYLE=__TOC__
13431 !! html
13432 <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>
13433 <table style="&#95;_TOC&#95;_">
13434 <tr><td></td></tr>
13435 </table>
13437 !! end
13439 # Known to produce bogus xml (extra </td>)
13440 !! test
13441 Fuzz testing: Parser16
13442 !! options
13443 noxml
13444 !! wikitext
13446 !https://||||||
13447 !! html
13448 <table>
13449 <tr>
13450 <th>https://</th>
13451 <th></th>
13452 <th></th>
13453 <th>
13454 </td>
13455 </tr>
13456 </table>
13458 !! end
13460 !! test
13461 Fuzz testing: Parser21
13462 !! wikitext
13464 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13466 !! html
13467 <table>
13468 <tr>
13469 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13470 </th>
13471 <td>
13472 </td>
13473 </tr>
13474 </table>
13476 !! end
13478 !! test
13479 Fuzz testing: Parser22
13480 !! wikitext
13481 http://===r:::https://b
13484 !! html
13485 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13486 </p>
13487 <table>
13488 <tr><td></td></tr>
13489 </table>
13491 !! end
13493 # Known to produce bad XML for now
13494 !! test
13495 Fuzz testing: Parser24
13496 !! options
13497 noxml
13498 !! wikitext
13500 {{{|
13501 <u CLASS=
13502 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13503 <br style="onmouseover='alert(document.cookie);' " />
13505 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13507 !! html
13508 <table>
13509 {{{|
13510 <u class="&#124;">}}}} &gt;
13511 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13513 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13514 <tr>
13515 <td></u>
13516 </td>
13517 </tr>
13518 </table>
13520 !! end
13522 # Note: the current result listed for this is not what the original one was,
13523 # but the original bug was JavaScript injection, which is fixed in any case.
13524 # It's not clear that the original result listed was any more correct than the
13525 # current one.  Original result:
13526 # <p>{{{| 
13527 # </p>
13528 # <li class="&#124;&#124;">
13529 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13530 !!test
13531 Fuzz testing: Parser25 (bug 6055)
13532 !! wikitext
13535 <LI CLASS=||
13537 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13538 !! html
13539 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13540 </p>
13541 !! end
13543 !!test
13544 Fuzz testing: URL adjacent extension (with space, clean)
13545 !! options
13546 !! wikitext
13547 http://example.com <nowiki>junk</nowiki>
13548 !! html
13549 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13550 </p>
13551 !!end
13553 !!test
13554 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13555 !! options
13556 !! wikitext
13557 http://example.com<nowiki>junk</nowiki>
13558 !! html
13559 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13560 </p>
13561 !!end
13563 !!test
13564 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13565 !! options
13566 !! wikitext
13567 http://example.com<pre>junk</pre>
13568 !! html
13569 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13571 !!end
13573 !!test
13574 Fuzz testing: image with bogus manual thumbnail
13575 !! wikitext
13576 [[Image:foobar.jpg|thumbnail= ]]
13577 !! html/php
13578 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
13580 !! html/parsoid
13581 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13582 !!end
13584 !! test
13585 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13586 !! wikitext
13587 <pre dir="&#10;"></pre>
13588 !! html
13589 <pre dir="&#10;"></pre>
13591 !! end
13593 !! test
13594 Parsing optional HTML elements (Bug 6171)
13595 !! options
13596 !! wikitext
13597 <table>
13598   <tr>
13599     <td> Some tabular data</td>
13600     <td> More tabular data ...
13601     <td> And yet som tabular data</td>
13602   </tr>
13603 </table>
13604 !! html
13605 <table>
13606   <tr>
13607     <td> Some tabular data</td>
13608     <td> More tabular data ...
13609     </td><td> And yet som tabular data</td>
13610   </tr>
13611 </table>
13613 !! end
13615 !! test
13616 Correct handling of <td>, <tr> (Bug 6171)
13617 !! options
13618 !! wikitext
13619 <table>
13620   <tr>
13621     <td> Some tabular data</td>
13622     <td> More tabular data ...</td>
13623     <td> And yet som tabular data</td>
13624   </tr>
13625 </table>
13626 !! html
13627 <table>
13628   <tr>
13629     <td> Some tabular data</td>
13630     <td> More tabular data ...</td>
13631     <td> And yet som tabular data</td>
13632   </tr>
13633 </table>
13635 !! end
13638 !! test
13639 Parsing crashing regression (fr:JavaScript)
13640 !! wikitext
13641 </body></x>
13642 !! html
13643 <p>&lt;/body&gt;&lt;/x&gt;
13644 </p>
13645 !! end
13647 !! test
13648 Inline wiki vs wiki block nesting
13649 !! wikitext
13650 '''Bold paragraph
13652 New wiki paragraph
13653 !! html
13654 <p><b>Bold paragraph</b>
13655 </p><p>New wiki paragraph
13656 </p>
13657 !! end
13659 !! test
13660 Inline HTML vs wiki block nesting
13661 !! options
13662 disabled
13663 !! wikitext
13664 <b>Bold paragraph
13666 New wiki paragraph
13667 !! html
13668 <p><b>Bold paragraph</b>
13669 </p><p>New wiki paragraph
13670 </p>
13671 !! end
13673 # Original result was this:
13674 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13675 # </p>
13676 # While that might be marginally more intuitive, maybe, the six-apostrophe
13677 # construct is clearly pathological and the result stated here (which is what
13678 # the parser actually does) is about as reasonable as anything.
13679 !!test
13680 Mixing markup for italics and bold
13681 !! options
13682 !! wikitext
13683 '''bold''''''bold''bolditalics'''''
13684 !! html
13685 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
13686 </p>
13687 !! end
13690 !! article
13691 Xyzzyx
13692 !! text
13693 Article for special page transclusion test
13694 !! endarticle
13696 !! test
13697 Special page transclusion
13698 !! options
13699 !! wikitext
13700 {{Special:Prefixindex/Xyzzyx}}
13701 !! html
13702 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13704 !! end
13706 !! test
13707 Special page transclusion twice (bug 5021)
13708 !! options
13709 !! wikitext
13710 {{Special:Prefixindex/Xyzzyx}}
13711 {{Special:Prefixindex/Xyzzyx}}
13712 !! html
13713 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13714 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
13716 !! end
13718 !! test
13719 Transclusion of default MediaWiki message
13720 !! wikitext
13721 {{MediaWiki:Mainpage}}
13722 !! html
13723 <p>Main Page
13724 </p>
13725 !! end
13727 !! test
13728 Transclusion of nonexistent MediaWiki message
13729 !! wikitext
13730 {{MediaWiki:Mainpagexxx}}
13731 !! html
13732 <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>
13733 </p>
13734 !! end
13736 !! test
13737 Transclusion of MediaWiki message with underscore
13738 !! wikitext
13739 {{MediaWiki:history_short}}
13740 !! html
13741 <p>History
13742 </p>
13743 !! end
13745 !! test
13746 Transclusion of MediaWiki message with space
13747 !! wikitext
13748 {{MediaWiki:history short}}
13749 !! html
13750 <p>History
13751 </p>
13752 !! end
13754 !! test
13755 Invalid header with following text
13756 !! wikitext
13757 = x = y
13758 !! html
13759 <p>= x = y
13760 </p>
13761 !! end
13764 !! test
13765 Section extraction test (section 0)
13766 !! options
13767 section=0
13768 !! wikitext
13769 start
13770 ==a==
13771 ===aa===
13772 ====aaa====
13773 ==b==
13774 ===ba===
13775 ===bb===
13776 ====bba====
13777 ===bc===
13778 ==c==
13779 ===ca===
13780 !! html
13781 start
13782 !! end
13784 !! test
13785 Section extraction test (section 1)
13786 !! options
13787 section=1
13788 !! wikitext
13789 start
13790 ==a==
13791 ===aa===
13792 ====aaa====
13793 ==b==
13794 ===ba===
13795 ===bb===
13796 ====bba====
13797 ===bc===
13798 ==c==
13799 ===ca===
13800 !! html
13801 ==a==
13802 ===aa===
13803 ====aaa====
13804 !! end
13806 !! test
13807 Section extraction test (section 2)
13808 !! options
13809 section=2
13810 !! wikitext
13811 start
13812 ==a==
13813 ===aa===
13814 ====aaa====
13815 ==b==
13816 ===ba===
13817 ===bb===
13818 ====bba====
13819 ===bc===
13820 ==c==
13821 ===ca===
13822 !! html
13823 ===aa===
13824 ====aaa====
13825 !! end
13827 !! test
13828 Section extraction test (section 3)
13829 !! options
13830 section=3
13831 !! wikitext
13832 start
13833 ==a==
13834 ===aa===
13835 ====aaa====
13836 ==b==
13837 ===ba===
13838 ===bb===
13839 ====bba====
13840 ===bc===
13841 ==c==
13842 ===ca===
13843 !! html
13844 ====aaa====
13845 !! end
13847 !! test
13848 Section extraction test (section 4)
13849 !! options
13850 section=4
13851 !! wikitext
13852 start
13853 ==a==
13854 ===aa===
13855 ====aaa====
13856 ==b==
13857 ===ba===
13858 ===bb===
13859 ====bba====
13860 ===bc===
13861 ==c==
13862 ===ca===
13863 !! html
13864 ==b==
13865 ===ba===
13866 ===bb===
13867 ====bba====
13868 ===bc===
13869 !! end
13871 !! test
13872 Section extraction test (section 5)
13873 !! options
13874 section=5
13875 !! wikitext
13876 start
13877 ==a==
13878 ===aa===
13879 ====aaa====
13880 ==b==
13881 ===ba===
13882 ===bb===
13883 ====bba====
13884 ===bc===
13885 ==c==
13886 ===ca===
13887 !! html
13888 ===ba===
13889 !! end
13891 !! test
13892 Section extraction test (section 6)
13893 !! options
13894 section=6
13895 !! wikitext
13896 start
13897 ==a==
13898 ===aa===
13899 ====aaa====
13900 ==b==
13901 ===ba===
13902 ===bb===
13903 ====bba====
13904 ===bc===
13905 ==c==
13906 ===ca===
13907 !! html
13908 ===bb===
13909 ====bba====
13910 !! end
13912 !! test
13913 Section extraction test (section 7)
13914 !! options
13915 section=7
13916 !! wikitext
13917 start
13918 ==a==
13919 ===aa===
13920 ====aaa====
13921 ==b==
13922 ===ba===
13923 ===bb===
13924 ====bba====
13925 ===bc===
13926 ==c==
13927 ===ca===
13928 !! html
13929 ====bba====
13930 !! end
13932 !! test
13933 Section extraction test (section 8)
13934 !! options
13935 section=8
13936 !! wikitext
13937 start
13938 ==a==
13939 ===aa===
13940 ====aaa====
13941 ==b==
13942 ===ba===
13943 ===bb===
13944 ====bba====
13945 ===bc===
13946 ==c==
13947 ===ca===
13948 !! html
13949 ===bc===
13950 !! end
13952 !! test
13953 Section extraction test (section 9)
13954 !! options
13955 section=9
13956 !! wikitext
13957 start
13958 ==a==
13959 ===aa===
13960 ====aaa====
13961 ==b==
13962 ===ba===
13963 ===bb===
13964 ====bba====
13965 ===bc===
13966 ==c==
13967 ===ca===
13968 !! html
13969 ==c==
13970 ===ca===
13971 !! end
13973 !! test
13974 Section extraction test (section 10)
13975 !! options
13976 section=10
13977 !! wikitext
13978 start
13979 ==a==
13980 ===aa===
13981 ====aaa====
13982 ==b==
13983 ===ba===
13984 ===bb===
13985 ====bba====
13986 ===bc===
13987 ==c==
13988 ===ca===
13989 !! html
13990 ===ca===
13991 !! end
13993 !! test
13994 Section extraction test (nonexistent section 11)
13995 !! options
13996 section=11
13997 !! wikitext
13998 start
13999 ==a==
14000 ===aa===
14001 ====aaa====
14002 ==b==
14003 ===ba===
14004 ===bb===
14005 ====bba====
14006 ===bc===
14007 ==c==
14008 ===ca===
14009 !! html
14010 !! end
14012 !! test
14013 Section extraction test with bogus heading (section 1)
14014 !! options
14015 section=1
14016 !! wikitext
14017 ==a==
14018 ==bogus== not a legal section
14019 ==b==
14020 !! html
14021 ==a==
14022 ==bogus== not a legal section
14023 !! end
14025 !! test
14026 Section extraction test with bogus heading (section 2)
14027 !! options
14028 section=2
14029 !! wikitext
14030 ==a==
14031 ==bogus== not a legal section
14032 ==b==
14033 !! html
14034 ==b==
14035 !! end
14037 !! test
14038 Section extraction test with comment after heading (section 1)
14039 !! options
14040 section=1
14041 !! wikitext
14042 ==a==
14043 ==b== <!-- -->
14044 ==c==
14045 !! html
14046 ==a==
14047 !! end
14049 !! test
14050 Section extraction test with comment after heading (section 2)
14051 !! options
14052 section=2
14053 !! wikitext
14054 ==a==
14055 ==b== <!-- -->
14056 ==c==
14057 !! html
14058 ==b== <!-- -->
14059 !! end
14061 !! test
14062 Section extraction test with bogus <nowiki> heading (section 1)
14063 !! options
14064 section=1
14065 !! wikitext
14066 ==a==
14067 ==bogus== <nowiki>not a legal section</nowiki>
14068 ==b==
14069 !! html
14070 ==a==
14071 ==bogus== <nowiki>not a legal section</nowiki>
14072 !! end
14074 !! test
14075 Section extraction test with bogus <nowiki> heading (section 2)
14076 !! options
14077 section=2
14078 !! wikitext
14079 ==a==
14080 ==bogus== <nowiki>not a legal section</nowiki>
14081 ==b==
14082 !! html
14083 ==b==
14084 !! end
14087 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14088 # instead of respecting commented sections
14089 !! test
14090 Section extraction prefixed by comment (section 1)
14091 !! options
14092 section=1
14093 !! wikitext
14094 <!-- -->==sec1==
14095 ==sec2==
14096 !! html
14097 ==sec2==
14098 !!end
14100 !! test
14101 Section extraction prefixed by comment (section 2)
14102 !! options
14103 section=2
14104 !! wikitext
14105 <!-- -->==sec1==
14106 ==sec2==
14107 !! html
14109 !!end
14112 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14113 # instead of respecting HTML-style headings
14114 !! test
14115 Section extraction, mixed wiki and html (section 1)
14116 !! options
14117 section=1
14118 !! wikitext
14119 <h2>unmarked</h2>
14120 unmarked
14121 ==1==
14123 ==2==
14125 !! html
14126 ==1==
14128 !! end
14130 !! test
14131 Section extraction, mixed wiki and html (section 2)
14132 !! options
14133 section=2
14134 !! wikitext
14135 <h2>unmarked</h2>
14136 unmarked
14137 ==1==
14139 ==2==
14141 !! html
14142 ==2==
14144 !! end
14147 # Formerly testing for bug 3342
14148 !! test
14149 Section extraction, heading surrounded by <noinclude>
14150 !! options
14151 section=1
14152 !! wikitext
14153 <noinclude>==unmarked==</noinclude>
14154 ==marked==
14155 !! html
14156 ==marked==
14157 !!end
14159 # Test behavior of bug 19910
14160 !! test
14161 Sectiion with all-equals
14162 !! options
14163 section=2
14164 !! wikitext
14165 === 
14166 The line above must have a trailing space
14167 === <!--
14168 --> <!-- -->
14169 But just in case it doesn't...
14170 !! html
14171 === <!--
14172 --> <!-- -->
14173 But just in case it doesn't...
14174 !! end
14176 !! test
14177 Section replacement test (section 0)
14178 !! options
14179 replace=0,"xxx"
14180 !! wikitext
14181 start
14182 ==a==
14183 ===aa===
14184 ====aaa====
14185 ==b==
14186 ===ba===
14187 ===bb===
14188 ====bba====
14189 ===bc===
14190 ==c==
14191 ===ca===
14192 !! html
14195 ==a==
14196 ===aa===
14197 ====aaa====
14198 ==b==
14199 ===ba===
14200 ===bb===
14201 ====bba====
14202 ===bc===
14203 ==c==
14204 ===ca===
14205 !! end
14207 !! test
14208 Section replacement test (section 1)
14209 !! options
14210 replace=1,"xxx"
14211 !! wikitext
14212 start
14213 ==a==
14214 ===aa===
14215 ====aaa====
14216 ==b==
14217 ===ba===
14218 ===bb===
14219 ====bba====
14220 ===bc===
14221 ==c==
14222 ===ca===
14223 !! html
14224 start
14227 ==b==
14228 ===ba===
14229 ===bb===
14230 ====bba====
14231 ===bc===
14232 ==c==
14233 ===ca===
14234 !! end
14236 !! test
14237 Section replacement test (section 2)
14238 !! options
14239 replace=2,"xxx"
14240 !! wikitext
14241 start
14242 ==a==
14243 ===aa===
14244 ====aaa====
14245 ==b==
14246 ===ba===
14247 ===bb===
14248 ====bba====
14249 ===bc===
14250 ==c==
14251 ===ca===
14252 !! html
14253 start
14254 ==a==
14257 ==b==
14258 ===ba===
14259 ===bb===
14260 ====bba====
14261 ===bc===
14262 ==c==
14263 ===ca===
14264 !! end
14266 !! test
14267 Section replacement test (section 3)
14268 !! options
14269 replace=3,"xxx"
14270 !! wikitext
14271 start
14272 ==a==
14273 ===aa===
14274 ====aaa====
14275 ==b==
14276 ===ba===
14277 ===bb===
14278 ====bba====
14279 ===bc===
14280 ==c==
14281 ===ca===
14282 !! html
14283 start
14284 ==a==
14285 ===aa===
14288 ==b==
14289 ===ba===
14290 ===bb===
14291 ====bba====
14292 ===bc===
14293 ==c==
14294 ===ca===
14295 !! end
14297 !! test
14298 Section replacement test (section 4)
14299 !! options
14300 replace=4,"xxx"
14301 !! wikitext
14302 start
14303 ==a==
14304 ===aa===
14305 ====aaa====
14306 ==b==
14307 ===ba===
14308 ===bb===
14309 ====bba====
14310 ===bc===
14311 ==c==
14312 ===ca===
14313 !! html
14314 start
14315 ==a==
14316 ===aa===
14317 ====aaa====
14320 ==c==
14321 ===ca===
14322 !! end
14324 !! test
14325 Section replacement test (section 5)
14326 !! options
14327 replace=5,"xxx"
14328 !! wikitext
14329 start
14330 ==a==
14331 ===aa===
14332 ====aaa====
14333 ==b==
14334 ===ba===
14335 ===bb===
14336 ====bba====
14337 ===bc===
14338 ==c==
14339 ===ca===
14340 !! html
14341 start
14342 ==a==
14343 ===aa===
14344 ====aaa====
14345 ==b==
14348 ===bb===
14349 ====bba====
14350 ===bc===
14351 ==c==
14352 ===ca===
14353 !! end
14355 !! test
14356 Section replacement test (section 6)
14357 !! options
14358 replace=6,"xxx"
14359 !! wikitext
14360 start
14361 ==a==
14362 ===aa===
14363 ====aaa====
14364 ==b==
14365 ===ba===
14366 ===bb===
14367 ====bba====
14368 ===bc===
14369 ==c==
14370 ===ca===
14371 !! html
14372 start
14373 ==a==
14374 ===aa===
14375 ====aaa====
14376 ==b==
14377 ===ba===
14380 ===bc===
14381 ==c==
14382 ===ca===
14383 !! end
14385 !! test
14386 Section replacement test (section 7)
14387 !! options
14388 replace=7,"xxx"
14389 !! wikitext
14390 start
14391 ==a==
14392 ===aa===
14393 ====aaa====
14394 ==b==
14395 ===ba===
14396 ===bb===
14397 ====bba====
14398 ===bc===
14399 ==c==
14400 ===ca===
14401 !! html
14402 start
14403 ==a==
14404 ===aa===
14405 ====aaa====
14406 ==b==
14407 ===ba===
14408 ===bb===
14411 ===bc===
14412 ==c==
14413 ===ca===
14414 !! end
14416 !! test
14417 Section replacement test (section 8)
14418 !! options
14419 replace=8,"xxx"
14420 !! wikitext
14421 start
14422 ==a==
14423 ===aa===
14424 ====aaa====
14425 ==b==
14426 ===ba===
14427 ===bb===
14428 ====bba====
14429 ===bc===
14430 ==c==
14431 ===ca===
14432 !! html
14433 start
14434 ==a==
14435 ===aa===
14436 ====aaa====
14437 ==b==
14438 ===ba===
14439 ===bb===
14440 ====bba====
14443 ==c==
14444 ===ca===
14445 !!end
14447 !! test
14448 Section replacement test (section 9)
14449 !! options
14450 replace=9,"xxx"
14451 !! wikitext
14452 start
14453 ==a==
14454 ===aa===
14455 ====aaa====
14456 ==b==
14457 ===ba===
14458 ===bb===
14459 ====bba====
14460 ===bc===
14461 ==c==
14462 ===ca===
14463 !! html
14464 start
14465 ==a==
14466 ===aa===
14467 ====aaa====
14468 ==b==
14469 ===ba===
14470 ===bb===
14471 ====bba====
14472 ===bc===
14474 !! end
14476 !! test
14477 Section replacement test (section 10)
14478 !! options
14479 replace=10,"xxx"
14480 !! wikitext
14481 start
14482 ==a==
14483 ===aa===
14484 ====aaa====
14485 ==b==
14486 ===ba===
14487 ===bb===
14488 ====bba====
14489 ===bc===
14490 ==c==
14491 ===ca===
14492 !! html
14493 start
14494 ==a==
14495 ===aa===
14496 ====aaa====
14497 ==b==
14498 ===ba===
14499 ===bb===
14500 ====bba====
14501 ===bc===
14502 ==c==
14504 !! end
14506 !! test
14507 Section replacement test with initial whitespace (bug 13728)
14508 !! options
14509 replace=2,"xxx"
14510 !! wikitext
14511  Preformatted initial line
14512 ==a==
14513 ===a===
14514 !! html
14515  Preformatted initial line
14516 ==a==
14518 !! end
14521 !! test
14522 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14523 !! options
14524 section=1
14525 !! wikitext
14526 ==a==
14527                     a
14528 !! html
14529 ==a==
14530                     a
14531 !! end
14533 !! test
14534 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14535 !! options
14536 section=1
14537 !! wikitext
14538 ==a==
14539                    a
14540 !! html
14541 ==a==
14542                    a
14543 !! end
14546 !! test
14547 Section extraction, <pre> around bogus header (bug 10309)
14548 !! options
14549 noxml section=2
14550 !! wikitext
14551 == Section One ==
14552 <pre>
14553 =======
14554 </pre>
14556 == Section Two ==
14557 stuff
14558 !! html
14559 == Section Two ==
14560 stuff
14561 !! end
14563 !! test
14564 Section replacement, <pre> around bogus header (bug 10309)
14565 !! options
14566 noxml replace=2,"xxx"
14567 !! wikitext
14568 == Section One ==
14569 <pre>
14570 =======
14571 </pre>
14573 == Section Two ==
14574 stuff
14575 !! html
14576 == Section One ==
14577 <pre>
14578 =======
14579 </pre>
14582 !! end
14586 !! test
14587 Handling of &#x0A; in URLs
14588 !! wikitext
14589 ** irc://&#x0A;a
14590 !! html/php
14591 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14593 !! html/parsoid
14594 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
14595 a">irc://
14596 a</a></li></ul></li></ul>
14597 !! end
14599 !! test
14600 Handling of %0A in URLs
14601 !! wikitext
14602 ** irc://%0Aa
14603 !! html/php
14604 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14606 !! html/parsoid
14607 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14608 !! end
14611 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14612 !! test
14613 5 quotes, code coverage +1 line
14614 !! options
14615 parsoid=wt2html
14616 !! wikitext
14617 '''''
14618 !! html/php
14619 !! html/parsoid
14620 <p><b><i></i></b></p>
14621 !! end
14623 # same html as previous, but wikitext adjusted to match parsoid html2wt
14624 # note that wt2html and html2html will put the <i> before the <b>
14625 !! test
14626 5 quotes, code coverage +1 line w/ nowiki (1)
14627 !! options
14628 parsoid=wt2wt,html2wt
14629 !! wikitext
14630 '''''<nowiki/>'''''
14631 !! html/php
14632 <p><i></i>
14633 </p>
14634 !! html/parsoid
14635 <p><b><i></i></b></p>
14636 !! end
14638 # same as previous, just swapping the <i> and <b>
14639 !! test
14640 5 quotes, code coverage +1 line w/ nowiki (2)
14641 !! wikitext
14642 '''''<nowiki/>'''''
14643 !! html/php
14644 <p><i></i>
14645 </p>
14646 !! html/parsoid
14647 <p><i><b></b></i></p>
14648 !! end
14650 !! test
14651 Special:Search page linking.
14652 !! wikitext
14653 {{Special:search}}
14654 !! html
14655 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14656 </p>
14657 !! end
14659 !! test
14660 Say the magic word
14661 !! options
14662 title=[[Parser test]]
14663 !! wikitext
14664 * {{PAGENAME}}
14665 * {{PAGENAMEE}}
14666 * {{FULLPAGENAME}}
14667 * {{FULLPAGENAMEE}}
14668 * {{BASEPAGENAME}}
14669 * {{BASEPAGENAMEE}}
14670 * {{SUBPAGENAME}}
14671 * {{SUBPAGENAMEE}}
14672 * {{ROOTPAGENAME}}
14673 * {{ROOTPAGENAMEE}}
14674 * {{TALKPAGENAME}}
14675 * {{TALKPAGENAMEE}}
14676 * {{SUBJECTPAGENAME}}
14677 * {{SUBJECTPAGENAMEE}}
14678 * {{NAMESPACEE}}
14679 * {{NAMESPACE}}
14680 * {{NAMESPACENUMBER}}
14681 * {{TALKSPACE}}
14682 * {{TALKSPACEE}}
14683 * {{SUBJECTSPACE}}
14684 * {{SUBJECTSPACEE}}
14685 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
14686 !! html
14687 <ul><li> Parser test</li>
14688 <li> Parser_test</li>
14689 <li> Parser test</li>
14690 <li> Parser_test</li>
14691 <li> Parser test</li>
14692 <li> Parser_test</li>
14693 <li> Parser test</li>
14694 <li> Parser_test</li>
14695 <li> Parser test</li>
14696 <li> Parser_test</li>
14697 <li> Talk:Parser test</li>
14698 <li> Talk:Parser_test</li>
14699 <li> Parser test</li>
14700 <li> Parser_test</li>
14701 <li> </li>
14702 <li> </li>
14703 <li> 0</li>
14704 <li> Talk</li>
14705 <li> Talk</li>
14706 <li> </li>
14707 <li> </li>
14708 <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>
14710 !! end
14711 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
14713 !! test
14714 Gallery
14715 !! wikitext
14716 <gallery>
14717 image1.png |
14718 image2.gif|||||
14720 image3|
14721 image4    |300px| centre
14722  image5.svg| http://///////
14723 [[x|xx]]]]
14724 * image6
14725 </gallery>
14726 !! html
14727 <ul class="gallery mw-gallery-traditional">
14728                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14729                         <div class="thumb" style="height: 150px;">Image1.png</div>
14730                         <div class="gallerytext">
14731                         </div>
14732                 </div></li>
14733                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14734                         <div class="thumb" style="height: 150px;">Image2.gif</div>
14735                         <div class="gallerytext">
14736 <p>||||
14737 </p>
14738                         </div>
14739                 </div></li>
14740                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14741                         <div class="thumb" style="height: 150px;">Image3</div>
14742                         <div class="gallerytext">
14743                         </div>
14744                 </div></li>
14745                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14746                         <div class="thumb" style="height: 150px;">Image4</div>
14747                         <div class="gallerytext">
14748 <p>300px| centre
14749 </p>
14750                         </div>
14751                 </div></li>
14752                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14753                         <div class="thumb" style="height: 150px;">Image5.svg</div>
14754                         <div class="gallerytext">
14755 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
14756 </p>
14757                         </div>
14758                 </div></li>
14759                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14760                         <div class="thumb" style="height: 150px;">* image6</div>
14761                         <div class="gallerytext">
14762                         </div>
14763                 </div></li>
14764 </ul>
14766 !! end
14768 !! test
14769 Gallery (with options)
14770 !! wikitext
14771 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
14772 File:Nonexistant.jpg|caption
14773 File:Nonexistant.jpg
14774 image:foobar.jpg|some '''caption''' [[Main Page]]
14775 image:foobar.jpg
14776 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
14777 </gallery>
14778 !! html
14779 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
14780         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
14781                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14782                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14783                         <div class="gallerytext">
14784 <p>caption
14785 </p>
14786                         </div>
14787                 </div></li>
14788                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14789                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
14790                         <div class="gallerytext">
14791                         </div>
14792                 </div></li>
14793                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14794                         <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>
14795                         <div class="gallerytext">
14796 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14797 </p>
14798                         </div>
14799                 </div></li>
14800                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14801                         <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>
14802                         <div class="gallerytext">
14803                         </div>
14804                 </div></li>
14805                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
14806                         <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>
14807                         <div class="gallerytext">
14808 <p>Blabla|blabla.
14809 </p>
14810                         </div>
14811                 </div></li>
14812 </ul>
14814 !! end
14816 !! test
14817 Gallery with wikitext inside caption
14818 !! wikitext
14819 <gallery>
14820 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
14821 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
14822 </gallery>
14823 !! html
14824 <ul class="gallery mw-gallery-traditional">
14825                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14826                         <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>
14827                         <div class="gallerytext">
14828 <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>
14829 </p>
14830                         </div>
14831                 </div></li>
14832                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14833                         <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>
14834                         <div class="gallerytext">
14835 <p>This is a test template
14836 </p>
14837                         </div>
14838                 </div></li>
14839 </ul>
14841 !! end
14843 !! test
14844 gallery (with showfilename option)
14845 !! wikitext
14846 <gallery showfilename>
14847 File:Nonexistant.jpg|caption
14848 File:Nonexistant.jpg
14849 image:foobar.jpg|some '''caption''' [[Main Page]]
14850 File:Foobar.jpg
14851 </gallery>
14852 !! html
14853 <ul class="gallery mw-gallery-traditional">
14854                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14855                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14856                         <div class="gallerytext">
14857 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14858 caption
14859 </p>
14860                         </div>
14861                 </div></li>
14862                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14863                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14864                         <div class="gallerytext">
14865 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
14866 </p>
14867                         </div>
14868                 </div></li>
14869                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14870                         <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>
14871                         <div class="gallerytext">
14872 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14873 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
14874 </p>
14875                         </div>
14876                 </div></li>
14877                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14878                         <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>
14879                         <div class="gallerytext">
14880 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
14881 </p>
14882                         </div>
14883                 </div></li>
14884 </ul>
14886 !! end
14888 !! test
14889 Gallery (with namespace-less filenames)
14890 !! wikitext
14891 <gallery>
14892 File:Nonexistant.jpg
14893 Nonexistant.jpg
14894 image:foobar.jpg
14895 foobar.jpg
14896 </gallery>
14897 !! html
14898 <ul class="gallery mw-gallery-traditional">
14899                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14900                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14901                         <div class="gallerytext">
14902                         </div>
14903                 </div></li>
14904                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14905                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
14906                         <div class="gallerytext">
14907                         </div>
14908                 </div></li>
14909                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14910                         <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>
14911                         <div class="gallerytext">
14912                         </div>
14913                 </div></li>
14914                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14915                         <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>
14916                         <div class="gallerytext">
14917                         </div>
14918                 </div></li>
14919 </ul>
14921 !! end
14923 !! test
14924 HTML Hex character encoding (spells the word "JavaScript")
14925 !! options
14926 parsoid=wt2html,wt2wt,html2html
14927 !! wikitext
14928 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
14929 !! html/php
14930 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
14931 </p>
14932 !! html/parsoid
14933 <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>
14934 !! end
14936 !! test
14937 HTML Hex character encoding bogus encoding (bug 26437 regression check)
14938 !! wikitext
14939 &#xsee;&#XSEE;
14940 !! html/php
14941 <p>&amp;#xsee;&amp;#XSEE;
14942 </p>
14943 !! html/parsoid
14944 <p>&amp;#xsee;&amp;#XSEE;</p>
14945 !! end
14947 !! test
14948 HTML Hex character encoding mixed case
14949 !! options
14950 parsoid=wt2html,wt2wt,html2html
14951 !! wikitext
14952 &#xEE;&#Xee;
14953 !! html/php
14954 <p>&#xee;&#xee;
14955 </p>
14956 !! html/parsoid
14957 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
14958 !! end
14960 !! test
14961 __FORCETOC__ override
14962 !! wikitext
14963 __NEWSECTIONLINK__
14964 __FORCETOC__
14965 !! html
14966 <p><br />
14967 </p>
14968 !! end
14970 !! test
14971 ISBN code coverage
14972 !! wikitext
14973 ISBN  978-0-1234-56&#x20;789
14974 !! html
14975 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
14976 </p>
14977 !! end
14979 !! test
14980 ISBN followed by 5 spaces
14981 !! wikitext
14982 ISBN    
14983 !! html
14984 <p>ISBN    
14985 </p>
14986 !! end
14988 !! test
14989 Double ISBN
14990 !! wikitext
14991 ISBN ISBN 1234567890
14992 !! html
14993 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
14994 </p>
14995 !! end
14997 !! test
14998 ISBN with an X
14999 !! wikitext
15000 ISBN 3-462-04561-X
15001 !! html
15002 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15003 </p>
15004 !! end
15006 !! test
15007 ISBN with empty prefix (parsoid test)
15008 !! wikitext
15009 ISBN 1234567890
15010 !! html/parsoid
15011 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15012 !! end
15014 !! test
15015 Bug 22905: <abbr> followed by ISBN followed by </a>
15016 !! wikitext
15017 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15018 !! html
15019 <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>
15020 </p>
15021 !! end
15023 !! test
15024 Double RFC
15025 !! wikitext
15026 RFC RFC 1234
15027 !! html
15028 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15029 </p>
15030 !! end
15032 !! test
15033 Double RFC with a wiki link
15034 !! wikitext
15035 RFC [[RFC 1234]]
15036 !! html
15037 <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>
15038 </p>
15039 !! end
15041 !! test
15042 RFC code coverage
15043 !! wikitext
15044 RFC   983&#x20;987
15045 !! html
15046 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15047 </p>
15048 !! end
15050 !! test
15051 Centre-aligned image
15052 !! wikitext
15053 [[Image:foobar.jpg|centre]]
15054 !! html
15055 <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>
15057 !!end
15059 !! test
15060 None-aligned image
15061 !! wikitext
15062 [[Image:foobar.jpg|none]]
15063 !! html
15064 <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>
15066 !!end
15068 !! test
15069 Width + Height sized image (using px) (height is ignored)
15070 !! wikitext
15071 [[Image:foobar.jpg|640x480px]]
15072 !! html
15073 <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>
15074 </p>
15075 !!end
15077 !! test
15078 Width-sized image (using px, no following whitespace)
15079 !! wikitext
15080 [[Image:foobar.jpg|640px]]
15081 !! html
15082 <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>
15083 </p>
15084 !!end
15086 !! test
15087 Width-sized image (using px, with following whitespace - test regression from r39467)
15088 !! wikitext
15089 [[Image:foobar.jpg|640px ]]
15090 !! html
15091 <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>
15092 </p>
15093 !!end
15095 !! test
15096 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15097 !! wikitext
15098 [[Image:foobar.jpg| 640px]]
15099 !! html
15100 <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>
15101 </p>
15102 !!end
15104 !! test
15105 Image with page parameter
15106 !! options
15107 djvu
15108 !! wikitext
15109 [[File:LoremIpsum.djvu|page=2]]
15110 !! html
15111 <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>
15112 </p>
15113 !! end
15115 !! test
15116 Another italics / bold test
15117 !! wikitext
15118  ''' ''x'
15119 !! html
15120 <pre>'<i> </i>x'
15121 </pre>
15122 !!end
15124 # Note the results may be incorrect, as parserTest output included this:
15125 # XML error: Mismatched tag at byte 6120:
15126 # ...<dd> </dt></dl> </dd...
15127 !! test
15128 dt/dd/dl test
15129 !! options
15130 disabled
15131 !! wikitext
15132 :;;;::
15133 !! html
15134 <dl>
15135 <dd><dl>
15136 <dt><dl>
15137 <dt><dl>
15138 <dt><dl>
15139 <dd><dl>
15140 <dd>
15141 </dd>
15142 </dl>
15143 </dd>
15144 </dl>
15145 </dt>
15146 </dl>
15147 </dt>
15148 </dl>
15149 </dt>
15150 </dl>
15151 </dd>
15152 </dl>
15154 !!end
15157 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15158 !! test
15159 Images with the "|" character in the comment
15160 !! wikitext
15161 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15162 !! html/php
15163 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
15165 !! html/parsoid
15166 <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>
15167 !! end
15169 !! test
15170 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15171 !! wikitext
15172 <html><script>alert(1);</script></html>
15173 !! html
15174 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15175 </p>
15176 !! end
15178 !! test
15179 HTML with raw HTML ($wgRawHtml==true)
15180 !! options
15181 wgRawHtml=1
15182 !! wikitext
15183 <html><script>alert(1);</script></html>
15184 !! html
15185 <p><script>alert(1);</script>
15186 </p>
15187 !! end
15189 !! test
15190 Parents of subpages, one level up
15191 !! options
15192 subpage title=[[Subpage test/L1/L2/L3]]
15193 !! wikitext
15194 [[../|L2]]
15195 !! html
15196 <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>
15197 </p>
15198 !! end
15201 !! test
15202 Parents of subpages, one level up, not named
15203 !! options
15204 subpage title=[[Subpage test/L1/L2/L3]]
15205 !! wikitext
15206 [[../]]
15207 !! html
15208 <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>
15209 </p>
15210 !! end
15214 !! test
15215 Parents of subpages, two levels up
15216 !! options
15217 subpage title=[[Subpage test/L1/L2/L3]]
15218 !! wikitext
15219 [[../../|L1]]2
15221 [[../../|L1]]l
15222 !! html
15223 <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
15224 </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>
15225 </p>
15226 !! end
15228 !! test
15229 Parents of subpages, two levels up, without trailing slash or name.
15230 !! options
15231 subpage title=[[Subpage test/L1/L2/L3]]
15232 !! wikitext
15233 [[../..]]
15234 !! html
15235 <p>[[../..]]
15236 </p>
15237 !! end
15239 !! test
15240 Parents of subpages, two levels up, with lots of extra trailing slashes.
15241 !! options
15242 subpage title=[[Subpage test/L1/L2/L3]]
15243 !! wikitext
15244 [[../../////]]
15245 !! html
15246 <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>
15247 </p>
15248 !! end
15250 !! article
15251 Subpage test/L1/L2/L3Sibling
15252 !! text
15253 Sibling article
15254 !! endarticle
15256 !! test
15257 Transclusion of a sibling page (one level up)
15258 !! options
15259 subpage title=[[Subpage test/L1/L2/L3]]
15260 !! wikitext
15261 {{../L3Sibling}}
15262 !! html
15263 <p>Sibling article
15264 </p>
15265 !! end
15267 !! test
15268 Transclusion of a child page
15269 !! options
15270 subpage title=[[Subpage test/L1/L2]]
15271 !! wikitext
15272 {{/L3Sibling}}
15273 !! html
15274 <p>Sibling article
15275 </p>
15276 !! end
15278 !! test
15279 Non-transclusion because of too many up levels
15280 !! options
15281 subpage title=[[Subpage test/L1/L2/L3]]
15282 !! wikitext
15283 {{../../../../More than parent}}
15284 !! html
15285 <p>{{../../../../More than parent}}
15286 </p>
15287 !! end
15289 !! test
15290 Definition list code coverage
15291 !! wikitext
15292 ; title   : def
15293 ; title : def
15294 ;title: def
15295 !! html
15296 <dl><dt> title  &#160;</dt>
15297 <dd> def</dd>
15298 <dt> title&#160;</dt>
15299 <dd> def</dd>
15300 <dt>title</dt>
15301 <dd> def</dd></dl>
15303 !! end
15305 !! test
15306 Don't fall for the self-closing div
15307 !! wikitext
15308 <div>hello world</div/>
15309 !! html
15310 <div>hello world</div>
15312 !! end
15314 !! test
15315 MSGNW magic word
15316 !! wikitext
15317 {{MSGNW:msg}}
15318 !! html
15319 <p>&#91;&#91;:Template:Msg&#93;&#93;
15320 </p>
15321 !! end
15323 !! test
15324 RAW magic word
15325 !! wikitext
15326 {{RAW:QUERTY}}
15327 !! html
15328 <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>
15329 </p>
15330 !! end
15332 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15333 !! test
15334 Always escape literal '>' in output, not just after '<'
15335 !! wikitext
15337 !! html
15338 <p>&gt;&lt;&gt;
15339 </p>
15340 !! end
15342 !! test
15343 Template caching
15344 !! wikitext
15345 {{Test}}
15346 {{Test}}
15347 !! html
15348 <p>This is a test template
15349 This is a test template
15350 </p>
15351 !! end
15354 !! article
15355 MediaWiki:Fake
15356 !! text
15357 ==header==
15358 !! endarticle
15360 !! test
15361 Inclusion of !userCanEdit() content
15362 !! wikitext
15363 {{MediaWiki:Fake}}
15364 !! html
15365 <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>
15367 !! end
15370 !! test
15371 Out-of-order TOC heading levels
15372 !! wikitext
15373 ==2==
15374 ======6======
15375 ===3===
15377 =====5=====
15378 ==2==
15379 !! html
15380 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15381 <ul>
15382 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15383 <ul>
15384 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15385 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15386 </ul>
15387 </li>
15388 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15389 <ul>
15390 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15391 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15392 </ul>
15393 </li>
15394 </ul>
15395 </div>
15397 <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>
15398 <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>
15399 <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>
15400 <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>
15401 <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>
15402 <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>
15404 !! end
15407 !! test
15408 ISBN with a dummy number
15409 !! wikitext
15410 ISBN ---
15411 !! html
15412 <p>ISBN ---
15413 </p>
15414 !! end
15417 !! test
15418 ISBN with space-delimited number
15419 !! wikitext
15420 ISBN 92 9017 032 8
15421 !! html
15422 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15423 </p>
15424 !! end
15427 !! test
15428 ISBN with multiple spaces, no number
15429 !! wikitext
15430 ISBN  foo
15431 !! html
15432 <p>ISBN  foo
15433 </p>
15434 !! end
15437 !! test
15438 ISBN length
15439 !! wikitext
15440 ISBN 123456789
15442 ISBN 1234567890
15444 ISBN 12345678901
15445 !! html
15446 <p>ISBN 123456789
15447 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15448 </p><p>ISBN 12345678901
15449 </p>
15450 !! end
15453 !! test
15454 ISBN with trailing year (bug 8110)
15455 !! wikitext
15456 ISBN 1-234-56789-0 - 2006
15458 ISBN 1 234 56789 0 - 2006
15459 !! html
15460 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15461 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15462 </p>
15463 !! end
15466 !! test
15467 anchorencode
15468 !! wikitext
15469 {{anchorencode:foo bar©#%n}}
15470 !! html
15471 <p>foo_bar.C2.A9.23.25n
15472 </p>
15473 !! end
15475 !! test
15476 anchorencode trims spaces
15477 !! wikitext
15478 {{anchorencode: __pretty__please__}}
15479 !! html
15480 <p>pretty_please
15481 </p>
15482 !! end
15484 !! test
15485 anchorencode deals with links
15486 !! wikitext
15487 {{anchorencode: [[hello|world]] [[hi]]}}
15488 !! html
15489 <p>world_hi
15490 </p>
15491 !! end
15493 !! test
15494 anchorencode deals with templates
15495 !! wikitext
15496 {{anchorencode: {{Foo}} }}
15497 !! html
15498 <p>FOO
15499 </p>
15500 !! end
15502 !! test
15503 anchorencode encodes like the TOC generator: (bug 18431)
15504 !! wikitext
15505 === _ +:.3A%3A&&amp;]] ===
15506 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15507 __NOEDITSECTION__
15508 !! html
15509 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15510 <p>.2B:.3A.253A.26.26.5D.5D
15511 </p>
15512 !! end
15514 !! test
15515 Bug 6200: blockquotes and paragraph formatting
15516 !! wikitext
15517 <blockquote>
15519 </blockquote>
15523  baz
15524 !! html
15525 <blockquote>
15526 <p>foo
15527 </p>
15528 </blockquote>
15529 <p>bar
15530 </p>
15531 <pre>baz
15532 </pre>
15533 !! end
15535 !! test
15536 Bug 8293: Use of center tag ruins paragraph formatting
15537 !! wikitext
15538 <center>
15540 </center>
15544  baz
15545 !! html
15546 <center>
15547 <p>foo
15548 </p>
15549 </center>
15550 <p>bar
15551 </p>
15552 <pre>baz
15553 </pre>
15554 !! end
15556 !!test
15557 Parsing of overlapping (improperly nested) inline html tags
15558 !! wikitext
15559 <span><s>x</span></s>
15560 !! html/php
15561 <p><span><s>x&lt;/span&gt;</s></span>
15562 </p>
15563 !! html/parsoid
15564 <p><span><s>x</s></span>
15565 </p>
15566 !!end
15569 ### Language variants related tests
15571 !! test
15572 Self-link in language variants
15573 !! options
15574 title=[[Dunav]] language=sr
15575 !! wikitext
15576 Both [[Dunav]] and [[Дунав]] are names for this river.
15577 !! html
15578 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15579 </p>
15580 !!end
15582 !! article
15583 Дуна
15584 !! text
15585 content
15586 !! endarticle
15588 !! test
15589 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15590 !! options
15591 title=[[Duna]] language=sr
15592 !! wikitext
15593 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15594 !! html
15595 <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.
15596 </p>
15597 !! end
15599 !! test
15600 Link to a section of a variant of this title shouldn't be parsed as self-link
15601 !! options
15602 title=[[Duna]] language=sr
15603 !! wikitext
15604 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15605 !! html
15606 <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.
15607 </p>
15608 !! end
15610 !! test
15611 Link to pages in language variants
15612 !! options
15613 language=sr
15614 !! wikitext
15615 Main Page can be written as [[Маин Паге]]
15616 !! html
15617 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15618 </p>
15619 !!end
15622 !! test
15623 Multiple links to pages in language variants
15624 !! options
15625 language=sr
15626 !! wikitext
15627 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15628 !! html
15629 <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>.
15630 </p>
15631 !!end
15634 !! test
15635 Simple template in language variants
15636 !! options
15637 language=sr
15638 !! wikitext
15639 {{тест}}
15640 !! html
15641 <p>This is a test template
15642 </p>
15643 !! end
15646 !! test
15647 Template with explicit namespace in language variants
15648 !! options
15649 language=sr
15650 !! wikitext
15651 {{Template:тест}}
15652 !! html
15653 <p>This is a test template
15654 </p>
15655 !! end
15658 !! test
15659 Basic test for template parameter in language variants
15660 !! options
15661 language=sr
15662 !! wikitext
15663 {{парамтест|param=foo}}
15664 !! html
15665 <p>This is a test template with parameter foo
15666 </p>
15667 !! end
15670 !! test
15671 Simple category in language variants
15672 !! options
15673 language=sr cat
15674 !! wikitext
15675 [[Category:МедиаWики Усер'с Гуиде]]
15676 !! html
15677 <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>
15678 !! end
15681 !! article
15682 Category:分类
15683 !! text
15684 blah
15685 !! endarticle
15687 !! article
15688 Category:分類
15689 !! text
15690 blah
15691 !! endarticle
15693 !! test
15694 Don't convert blue categorylinks to another variant (bug 33210)
15695 !! options
15696 language=zh cat
15697 !! wikitext
15698 [[A]][[Category:分类]]
15699 !! html
15700 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
15701 !! end
15704 !! test
15705 Stripping -{}- tags (language variants)
15706 !! options
15707 language=sr
15708 !! wikitext
15709 Latin proverb: -{Ne nuntium necare}-
15710 !! html
15711 <p>Latin proverb: Ne nuntium necare
15712 </p>
15713 !! end
15716 !! test
15717 Prevent conversion with -{}- tags (language variants)
15718 !! options
15719 language=sr variant=sr-ec
15720 !! wikitext
15721 Latinski: -{Ne nuntium necare}-
15722 !! html
15723 <p>Латински: Ne nuntium necare
15724 </p>
15725 !! end
15728 !! test
15729 Prevent conversion of text with -{}- tags (language variants)
15730 !! options
15731 language=sr variant=sr-ec
15732 !! wikitext
15733 Latinski: -{Ne nuntium necare}-
15734 !! html
15735 <p>Латински: Ne nuntium necare
15736 </p>
15737 !! end
15740 !! test
15741 Prevent conversion of links with -{}- tags (language variants)
15742 !! options
15743 language=sr variant=sr-ec
15744 !! wikitext
15745 -{[[Main Page]]}-
15746 !! html
15747 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15748 </p>
15749 !! end
15752 !! test
15753 -{}- tags within headlines (within html for parserConvert())
15754 !! options
15755 language=sr variant=sr-ec
15756 !! wikitext
15757 == -{Naslov}- ==
15758 !! html
15759 <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>
15761 !! end
15764 !! test
15765 Explicit definition of language variant alternatives
15766 !! options
15767 language=zh variant=zh-tw
15768 !! wikitext
15769 -{zh:China;zh-tw:Taiwan}-, not China
15770 !! html
15771 <p>Taiwan, not China
15772 </p>
15773 !! end
15776 !! test
15777 Conversion around HTML tags
15778 !! options
15779 language=sr variant=sr-ec
15780 !! wikitext
15781 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
15782 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
15783 !! html
15785 <span title="ЛаCтин">ски</span>
15786 </p>
15787 !! end
15790 !! test
15791 Explicit session-wise language variant mapping (A flag and - flag)
15792 !! options
15793 language=zh variant=zh-tw
15794 !! wikitext
15795 Taiwan is not China.
15796 But -{A|zh:China;zh-tw:Taiwan}- is China,
15797 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
15798 and -{China}- is China.
15799 !! html
15800 <p>Taiwan is not China.
15801 But Taiwan is Taiwan,
15802 (This should be stripped!)
15803 and China is China.
15804 </p>
15805 !! end
15807 !! test
15808 Explicit session-wise language variant mapping (H flag for hide)
15809 !! options
15810 language=zh variant=zh-tw
15811 !! wikitext
15812 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
15813 Taiwan is China.
15814 !! html
15815 <p>(This should be stripped!)
15816 Taiwan is Taiwan.
15817 </p>
15818 !! end
15820 !! test
15821 Adding explicit conversion rule for title (T flag)
15822 !! options
15823 language=zh variant=zh-tw showtitle
15824 !! wikitext
15825 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15826 !! html
15827 Taiwan
15828 <p>Should be stripped!
15829 </p>
15830 !! end
15832 !! test
15833 Testing that changing the language variant here in the tests actually works
15834 !! options
15835 language=zh variant=zh showtitle
15836 !! wikitext
15837 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15838 !! html
15839 China
15840 <p>Should be stripped!
15841 </p>
15842 !! end
15844 !! test
15845 Recursive conversion of alt and title attrs shouldn't clear converter state
15846 !! options
15847 language=zh variant=zh-cn showtitle
15848 !! wikitext
15849 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
15850 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
15851 !! html
15852 China
15854 Should be stripped<span title="Exclamation">!</span>
15855 </p>
15856 !! end
15858 !! test
15859 Bug 24072: more test on conversion rule for title
15860 !! options
15861 language=zh variant=zh-tw showtitle
15862 !! wikitext
15863 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
15864 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
15865 !! html
15866 Taiwan
15867 <p>This should be stripped!
15868 This won't take interferes with the title rule.
15869 </p>
15870 !! end
15872 !! test
15873 Partly disable title conversion if variant == main language code
15874 !! options
15875 language=zh variant=zh title=[[ZH]] showtitle
15876 !! wikitext
15877 -{T|zh-cn:CN;zh-tw:TW}-
15878 !! html
15881 </p>
15882 !! end
15884 !! test
15885 Partly disable title conversion if variant == main language code, more
15886 !! options
15887 language=zh variant=zh title=[[ZH]] showtitle
15888 !! wikitext
15889 -{T|TW}-
15890 !! html
15893 </p>
15894 !! end
15896 !! test
15897 Raw output of variant escape tags (R flag)
15898 !! options
15899 language=zh variant=zh-tw
15900 !! wikitext
15901 Raw: -{R|zh:China;zh-tw:Taiwan}-
15902 !! html
15903 <p>Raw: zh:China;zh-tw:Taiwan
15904 </p>
15905 !! end
15907 !! test
15908 Nested using of manual convert syntax
15909 !! options
15910 language=zh variant=zh-hk
15911 !! wikitext
15912 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
15913 !! html
15914 <p>Nested: Hello Hong Kong!
15915 </p>
15916 !! end
15918 !! test
15919 Proper conversion of text in external links
15920 !! options
15921 language=sr variant=sr-ec
15922 !! wikitext
15923 http://www.google.com
15924 gopher://www.google.com
15925 [http://www.google.com http://www.google.com]
15926 [gopher://www.google.com gopher://www.google.com]
15927 [https://www.google.com irc://www.google.com]
15928 [ftp://www.google.com www.google.com/ftp://dir]
15929 [//www.google.com www.google.com]
15930 !! html
15931 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15932 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15933 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
15934 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
15935 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
15936 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
15937 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
15938 </p>
15939 !! end
15941 !! test
15942 Do not convert roman numbers to language variants
15943 !! options
15944 language=sr variant=sr-ec
15945 !! wikitext
15946 Fridrih IV je car.
15947 !! html
15948 <p>Фридрих IV је цар.
15949 </p>
15950 !! end
15952 !! test
15953 Unclosed language converter markup "-{"
15954 !! options
15955 language=sr
15956 !! wikitext
15957 -{T|hello
15958 !! html
15959 <p>-{T|hello
15960 </p>
15961 !! end
15963 !! test
15964 Don't convert raw rule "-{R|=&gt;}-" to "=>"
15965 !! options
15966 language=sr
15967 !! wikitext
15968 -{R|=&gt;}-
15969 !! html
15970 <p>=&gt;
15971 </p>
15972 !!end
15974 !! test
15975 Don't break link parsing if language converter markup is in the caption.
15976 !! options
15977 language=sr variant=sr-ec
15978 !! wikitext
15979 [[Main Page|-{R|main page}-]]
15980 !! html
15981 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
15982 </p>
15983 !! end
15985 # This test is currently broken in the PHP parser (bug 52661)
15986 !! test
15987 Don't break image parsing if language converter markup is in the caption.
15988 !! options
15989 language=sr
15990 disabled
15991 !! wikitext
15992 [[File:Foobar.jpg|-{R|caption}-]]
15993 !! html
15994 <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>
15995 </p>
15996 !! end
15998 # This test is currently broken in the PHP parser (bug 52661)
15999 !! test
16000 Don't break list handling if language converter markup is in the item.
16001 !! options
16002 language=zh variant=zh-cn
16003 disabled
16004 !! wikitext
16005 ;-{zh-cn:AAA;zh-tw:BBB}-
16006 !! html
16007 <dl><dt>AAA
16008 </dt></dl>
16010 !! end
16012 # This test is currently broken in the PHP parser (bug 52661)
16013 !! test
16014 Don't break table handling if language converter markup is in the cell.
16015 !! options
16016 language=sr variant=sr-ec
16017 disabled
16018 !! wikitext
16021 | -{R|B}-
16023 !! html
16024 <table>
16026 <tr>
16027 <td> B
16028 </td></tr></table>
16030 !! end
16032 !! test
16033 Bug 529: Uncovered bullet
16034 !! wikitext
16035 * Foo {{bullet}}
16036 !! html
16037 <ul><li> Foo </li>
16038 <li> Bar</li></ul>
16040 !! end
16042 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16043 # Templates in Wikipedia rely on this behavior, as tidy has always been
16044 # enabled there. These tests are normally run *without* tidy, so specify the
16045 # full output here. 
16046 # To test realistic parsing behavior, apply a tidy-like transformation to both
16047 # the expected output and your parser's output.
16048 !! test
16049 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16050 !! wikitext
16051 ******* Foo {{bullet}}
16052 !! html
16053 <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>
16054 <li> Bar</li></ul>
16056 !! end
16058 !! test
16059 Bug 529: Uncovered table already at line-start
16060 !! wikitext
16063 {{table}}
16065 !! html
16066 <p>x
16067 </p>
16068 <table>
16069 <tr>
16070 <td> 1 </td>
16071 <td> 2
16072 </td></tr>
16073 <tr>
16074 <td> 3 </td>
16075 <td> 4
16076 </td></tr></table>
16077 <p>y
16078 </p>
16079 !! end
16081 !! test
16082 Bug 529: Uncovered bullet in parser function result
16083 !! wikitext
16084 * Foo {{lc:{{bullet}} }}
16085 !! html
16086 <ul><li> Foo </li>
16087 <li> bar</li></ul>
16089 !! end
16091 !! test
16092 Bug 5678: Double-parsed template argument
16093 !! wikitext
16094 {{lc:{{{1}}}|hello}}
16095 !! html
16096 <p>{{{1}}}
16097 </p>
16098 !! end
16100 !! test
16101 Bug 5678: Double-parsed template invocation
16102 !! wikitext
16103 {{lc:{{paramtest {{!}} param = hello }} }}
16104 !! html
16105 <p>{{paramtest | param = hello }}
16106 </p>
16107 !! end
16109 !! test
16110 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16111 !! options
16112 language=cs
16113 title=[[Main Page]]
16114 !! wikitext
16115 {{PRVNÍVELKÉ:ěščř}}
16116 {{prvnívelké:ěščř}}
16117 {{PRVNÍMALÉ:ěščř}}
16118 {{prvnímalé:ěščř}}
16119 {{MALÁ:ěščř}}
16120 {{malá:ěščř}}
16121 {{VELKÁ:ěščř}}
16122 {{velká:ěščř}}
16123 !! html
16124 <p>Ěščř
16125 Ěščř
16126 ěščř
16127 ěščř
16128 ěščř
16129 ěščř
16130 ĚŠČŘ
16131 ĚŠČŘ
16132 </p>
16133 !! end
16135 !! test
16136 Morwen/13: Unclosed link followed by heading
16137 !! wikitext
16138 [[link
16139 ==heading==
16140 !! html
16141 <p>[[link
16142 </p>
16143 <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>
16145 !! end
16147 !! test
16148 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16149 !! wikitext
16150 {{foo|
16151 =heading=
16152 !! html
16153 <p>{{foo|
16154 </p>
16155 <h1><span class="mw-headline" id="heading">heading</span></h1>
16157 !! end
16159 !! test
16160 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16161 !! wikitext
16162 {{foo|
16163 ==heading==
16164 !! html
16165 <p>{{foo|
16166 </p>
16167 <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>
16169 !! end
16171 !! test
16172 Tildes in comments
16173 !! options
16175 !! wikitext
16176 <!-- ~~~~ -->
16177 !! html
16178 <!-- ~~~~ -->
16179 !! end
16181 !! test
16182 Paragraphs inside divs (no extra line breaks)
16183 !! wikitext
16184 <div>Line one
16186 Line two</div>
16187 !! html
16188 <div>Line one
16189 Line two</div>
16191 !! end
16193 !! test
16194 Paragraphs inside divs (extra line break on open)
16195 !! wikitext
16196 <div>
16197 Line one
16199 Line two</div>
16200 !! html
16201 <div>
16202 <p>Line one
16203 </p>
16204 Line two</div>
16206 !! end
16208 !! test
16209 Paragraphs inside divs (extra line break on close)
16210 !! wikitext
16211 <div>Line one
16213 Line two
16214 </div>
16215 !! html
16216 <div>Line one
16217 <p>Line two
16218 </p>
16219 </div>
16221 !! end
16223 !! test
16224 Paragraphs inside divs (extra line break on open and close)
16225 !! wikitext
16226 <div>
16227 Line one
16229 Line two
16230 </div>
16231 !! html
16232 <div>
16233 <p>Line one
16234 </p><p>Line two
16235 </p>
16236 </div>
16238 !! end
16240 !! test
16241 Nesting tags, paragraphs on lines which begin with <div>
16242 !! options
16243 disabled
16244 !! wikitext
16245 <div></div><strong>A
16246 B</strong>
16247 !! html
16248 <div></div>
16249 <p><strong>A
16250 B</strong>
16251 </p>
16252 !! end
16254 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16255 !! test
16256 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16257 !! wikitext
16258 <blockquote>Line one
16260 Line two</blockquote>
16261 !! html
16262 <blockquote>Line one
16263 Line two</blockquote>
16265 !! end
16267 !! test
16268 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16269 !! wikitext
16270 <blockquote>
16271 Line one
16273 Line two</blockquote>
16274 !! html
16275 <blockquote>
16276 <p>Line one
16277 </p>
16278 Line two</blockquote>
16280 !! end
16282 !! test
16283 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16284 !! wikitext
16285 <blockquote>Line one
16287 Line two
16288 </blockquote>
16289 !! html
16290 <blockquote>Line one
16291 <p>Line two
16292 </p>
16293 </blockquote>
16295 !! end
16297 !! test
16298 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16299 !! wikitext
16300 <blockquote>
16301 Line one
16303 Line two
16304 </blockquote>
16305 !! html
16306 <blockquote>
16307 <p>Line one
16308 </p><p>Line two
16309 </p>
16310 </blockquote>
16312 !! end
16314 !! test
16315 Paragraphs inside blockquotes/divs (no extra line breaks)
16316 !! wikitext
16317 <blockquote><div>Line one
16319 Line two</div></blockquote>
16320 !! html
16321 <blockquote><div>Line one
16322 Line two</div></blockquote>
16324 !! end
16326 !! test
16327 Paragraphs inside blockquotes/divs (extra line break on open)
16328 !! wikitext
16329 <blockquote><div>
16330 Line one
16332 Line two</div></blockquote>
16333 !! html
16334 <blockquote><div>
16335 <p>Line one
16336 </p>
16337 Line two</div></blockquote>
16339 !! end
16341 !! test
16342 Paragraphs inside blockquotes/divs (extra line break on close)
16343 !! wikitext
16344 <blockquote><div>Line one
16346 Line two
16347 </div></blockquote>
16348 !! html
16349 <blockquote><div>Line one
16350 <p>Line two
16351 </p>
16352 </div></blockquote>
16354 !! end
16356 !! test
16357 Paragraphs inside blockquotes/divs (extra line break on open and close)
16358 !! wikitext
16359 <blockquote><div>
16360 Line one
16362 Line two
16363 </div></blockquote>
16364 !! html
16365 <blockquote><div>
16366 <p>Line one
16367 </p><p>Line two
16368 </p>
16369 </div></blockquote>
16371 !! end
16373 !! test
16374 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16375 !! options
16376 wgLinkHolderBatchSize=0
16377 !! wikitext
16378 [[meatball:1]]
16379 [[meatball:2]]
16380 [[meatball:3]]
16381 !! html
16382 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16383 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16384 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16385 </p>
16386 !! end
16388 !! test
16389 Free external link invading image caption
16390 !! wikitext
16391 [[Image:Foobar.jpg|thumb|http://x|hello]]
16392 !! html
16393 <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"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
16395 !! end
16397 !! test
16398 Bug 15196: localised external link numbers
16399 !! options
16400 language=fa
16401 !! wikitext
16402 [http://en.wikipedia.org/]
16403 !! html/php
16404 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16405 </p>
16406 !! html/parsoid
16407 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16408 !! end
16410 !! test
16411 Multibyte character in padleft
16412 !! wikitext
16413 {{padleft:-Hello|7|Æ}}
16414 !! html
16415 <p>Æ-Hello
16416 </p>
16417 !! end
16419 !! test
16420 Multibyte character in padright
16421 !! wikitext
16422 {{padright:Hello-|7|Æ}}
16423 !! html
16424 <p>Hello-Æ
16425 </p>
16426 !! end
16428 !!test
16429 formatdate parser function
16430 !! wikitext
16431 {{#formatdate:2009-03-24}}
16432 !! html
16433 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16434 </p>
16435 !! end
16437 !!test
16438 formatdate parser function, with default format
16439 !! wikitext
16440 {{#formatdate:2009-03-24|mdy}}
16441 !! html
16442 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16443 </p>
16444 !! end
16446 !! test
16447 Spacing of numbers in formatted dates
16448 !! wikitext
16449 {{#formatdate:January 15}}
16450 !! html
16451 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16452 </p>
16453 !! end
16455 !! test
16456 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
16457 !! options
16458 language=nl title=[[MediaWiki:Common.css]]
16459 !! wikitext
16460 {{#formatdate:2009-03-24|dmy}}
16461 !! html
16462 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16463 </p>
16464 !! end
16471 # Edit comments
16474 !! test
16475 Edit comment with link
16476 !! options
16477 comment
16478 !! wikitext
16479 I like the [[Main Page]] a lot
16480 !! html
16481 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16482 !!end
16484 !! test
16485 Edit comment with link and link text
16486 !! options
16487 comment
16488 !! wikitext
16489 I like the [[Main Page|best pages]] a lot
16490 !! html
16491 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16492 !!end
16494 !! test
16495 Edit comment with link and link text with suffix
16496 !! options
16497 comment
16498 !! wikitext
16499 I like the [[Main Page|best page]]s a lot
16500 !! html
16501 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16502 !!end
16504 !! test
16505 Edit comment with section link (non-local, eg in history list)
16506 !! options
16507 comment title=[[Main Page]]
16508 !! wikitext
16509 /* External links */ removed bogus entries
16510 !! html
16511 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16512 !!end
16514 !! test
16515 Edit comment with section link and text before it (non-local, eg in history list)
16516 !! options
16517 comment title=[[Main Page]]
16518 !! wikitext
16519 pre-comment text /* External links */ removed bogus entries
16520 !! html
16521 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>
16522 !!end
16524 !! test
16525 Edit comment with section link (local, eg in diff view)
16526 !! options
16527 comment local title=[[Main Page]]
16528 !! wikitext
16529 /* External links */ removed bogus entries
16530 !! html
16531 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16532 !!end
16534 !! test
16535 Edit comment with subpage link (bug 14080)
16536 !! options
16537 comment
16538 subpage
16539 title=[[Subpage test]]
16540 !! wikitext
16541 Poked at a [[/subpage]] here...
16542 !! html
16543 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16544 !!end
16546 !! test
16547 Edit comment with subpage link and link text (bug 14080)
16548 !! options
16549 comment
16550 subpage
16551 title=[[Subpage test]]
16552 !! wikitext
16553 Poked at a [[/subpage|neat little page]] here...
16554 !! html
16555 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16556 !!end
16558 !! test
16559 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16560 !! options
16561 comment
16562 title=[[Subpage test]]
16563 !! wikitext
16564 Poked at a [[/subpage]] here...
16565 !! html
16566 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...
16567 !!end
16569 !! test
16570 Edit comment with bare anchor link (local, as on diff)
16571 !! options
16572 comment
16573 local
16574 title=[[Main Page]]
16575 !! wikitext
16576 [[#section]]
16577 !! html
16578 <a href="#section">#section</a>
16579 !! end
16581 !! test
16582 Edit comment with bare anchor link (non-local, as on history)
16583 !! options
16584 comment
16585 title=[[Main Page]]
16586 !! wikitext
16587 [[#section]]
16588 !! html
16589 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16590 !! end
16592 !! test
16593 Anchor starting with underscore
16594 !! wikitext
16595 [[#_ref|One]]
16596 !! html
16597 <p><a href="#_ref">One</a>
16598 </p>
16599 !! end
16601 !! test
16602 Id starting with underscore
16603 !! wikitext
16604 <div id="_ref"></div>
16605 !! html
16606 <div id="_ref"></div>
16608 !! end
16610 !! test
16611 Space normalisation on autocomment (bug 22784)
16612 !! options
16613 comment
16614 title=[[Main Page]]
16615 !! wikitext
16616 /* __hello__world__ */
16617 !! html
16618 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16619 !! end
16621 !! test
16622 percent-encoding and + signs in comments (Bug 26410)
16623 !! options
16624 comment
16625 !! wikitext
16626 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16627 !! html
16628 <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>
16629 !! end
16631 !! test
16632 Bad images - basic functionality
16633 !! options
16634 disabled
16635 !! wikitext
16636 [[File:Bad.jpg]]
16637 !! html
16638 !! end
16640 !! test
16641 Bad images - bug 16039: text after bad image disappears
16642 !! options
16643 disabled
16644 !! wikitext
16645 Foo bar
16646 [[File:Bad.jpg]]
16647 Bar foo
16648 !! html
16649 <p>Foo bar
16650 </p><p>Bar foo
16651 </p>
16652 !! end
16654 !! test
16655 Verify that displaytitle works (bug #22501) no displaytitle
16656 !! options
16657 showtitle
16658 !! config
16659 wgAllowDisplayTitle=true
16660 wgRestrictDisplayTitle=false
16661 !! wikitext
16662 this is not the the title
16663 !! html
16664 Parser test
16665 <p>this is not the the title
16666 </p>
16667 !! end
16669 !! test
16670 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16671 !! options
16672 showtitle
16673 title=[[Screen]]
16674 !! config
16675 wgAllowDisplayTitle=true
16676 wgRestrictDisplayTitle=false
16677 !! wikitext
16678 this is not the the title
16679 {{DISPLAYTITLE:whatever}}
16680 !! html
16681 whatever
16682 <p>this is not the the title
16683 </p>
16684 !! end
16686 !! test
16687 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
16688 !! options
16689 showtitle
16690 title=[[Screen]]
16691 !! config
16692 wgAllowDisplayTitle=true
16693 wgRestrictDisplayTitle=true
16694 !! wikitext
16695 this is not the the title
16696 {{DISPLAYTITLE:whatever}}
16697 !! html
16698 Screen
16699 <p>this is not the the title
16700 </p>
16701 !! end
16703 !! test
16704 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
16705 !! options
16706 showtitle
16707 title=[[Screen]]
16708 !! config
16709 wgAllowDisplayTitle=true
16710 wgRestrictDisplayTitle=true
16711 !! wikitext
16712 this is not the the title
16713 {{DISPLAYTITLE:screen}}
16714 !! html
16715 screen
16716 <p>this is not the the title
16717 </p>
16718 !! end
16720 !! test
16721 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
16722 !! options
16723 showtitle
16724 title=[[Screen]]
16725 !! config
16726 wgAllowDisplayTitle=false
16727 !! wikitext
16728 this is not the the title
16729 {{DISPLAYTITLE:screen}}
16730 !! html
16731 Screen
16732 <p>this is not the the title
16733 <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>
16734 </p>
16735 !! end
16737 !! test
16738 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
16739 !! options
16740 showtitle
16741 title=[[Screen]]
16742 !! config
16743 wgAllowDisplayTitle=false
16744 !! wikitext
16745 this is not the the title
16746 !! html
16747 Screen
16748 <p>this is not the the title
16749 </p>
16750 !! end
16752 !! test
16753 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
16754 !! options
16755 showtitle
16756 title=[[Screen]]
16757 !! config
16758 wgAllowDisplayTitle=true
16759 wgRestrictDisplayTitle=true
16760 !! wikitext
16761 this is not the the title
16762 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
16763 !! html
16764 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
16765 <p>this is not the the title
16766 </p>
16767 !! end
16769 !! test
16770 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
16771 !! options
16772 showtitle
16773 title=[[Screen]]
16774 !! config
16775 wgAllowDisplayTitle=true
16776 wgRestrictDisplayTitle=true
16777 !! wikitext
16778 this is not the the title
16779 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
16780 !! html
16781 <span style="color: red;">s</span>creen
16782 <p>this is not the the title
16783 </p>
16784 !! end
16786 !! test
16787 preload: check <noinclude> and <includeonly>
16788 !! options
16789 preload
16790 !! wikitext
16791 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
16792 !! html
16793 Hello kind world.
16794 !! end
16796 !! test
16797 preload: check <onlyinclude>
16798 !! options
16799 preload
16800 !! wikitext
16801 Goodbye <onlyinclude>Hello world</onlyinclude>
16802 !! html
16803 Hello world
16804 !! end
16806 !! test
16807 preload: can pass tags through if we want to
16808 !! options
16809 preload
16810 !! wikitext
16811 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
16812 !! html
16813 <includeonly>Hello world</includeonly>
16814 !! end
16816 !! test
16817 preload: check that it doesn't try to do tricks
16818 !! options
16819 preload
16820 !! wikitext
16821 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16822 !! html
16823 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
16824 !! end
16826 !! test
16827 Play a bit with r67090 and bug 3158
16828 !! options
16829 disabled
16830 !! wikitext
16831 <div style="width:50% !important">&nbsp;</div>
16832 <div style="width:50%&nbsp;!important">&nbsp;</div>
16833 <div style="width:50%&#160;!important">&nbsp;</div>
16834 <div style="border : solid;">&nbsp;</div>
16835 !! html
16836 <div style="width:50% !important">&nbsp;</div>
16837 <div style="width:50% !important">&nbsp;</div>
16838 <div style="width:50% !important">&nbsp;</div>
16839 <div style="border&#160;: solid;">&nbsp;</div>
16841 !! end
16843 !! test
16844 HTML5 data attributes
16845 !! wikitext
16846 <span data-foo="bar">Baz</span>
16847 <p data-abc-def_hij="">Quuz</p>
16848 !! html
16849 <p><span data-foo="bar">Baz</span>
16850 </p>
16851 <p data-abc-def_hij="">Quuz</p>
16853 !! end
16855 !! test
16856 percent-encoding and + signs in internal links (Bug 26410)
16857 !! wikitext
16858 [[User:+%]] [[Page+title%]]
16859 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
16860 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
16861 [[%33%45]] [[%33%45+]]
16862 !! html
16863 <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>
16864 <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>
16865 <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>
16866 <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>
16867 </p>
16868 !! end
16870 !! test
16871 Special characters in embedded file links (bug 27679)
16872 !! wikitext
16873 [[File:Contains & ampersand.jpg]]
16874 [[File:Does not exist.jpg|Title with & ampersand]]
16875 !! html
16876 <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>
16877 <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>
16878 </p>
16879 !! end
16882 !! test
16883 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
16884 !! wikitext
16885 Text&apos;s been normalized?
16886 !! html
16887 <p>Text&#39;s been normalized?
16888 </p>
16889 !! end
16891 !! test
16892 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
16893 !! wikitext
16894 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
16895 !! html
16896 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
16897 </p>
16898 !! end
16900 !! test
16901 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
16902 !! wikitext
16903 [http://www.example.org/ ideograms]
16904 !! html
16905 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
16906 </p>
16907 !! end
16909 !! test
16910 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
16911 !! wikitext
16912 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
16913 !! html
16914 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
16915 </p>
16916 !! end
16918 !! article
16919 Mediawiki:loop1
16920 !! text
16921 {{Identical|A}}
16922 !! endarticle
16924 !! article
16925 Mediawiki:loop2
16926 !! text
16927 {{Identical|B}}
16928 !! endarticle
16930 !! article
16931 Template:Identical
16932 !! text
16933 {{int:loop1}}
16934 {{int:loop2}}
16935 !! endarticle
16937 !! test
16938 Bug 31098 Template which includes system messages which includes the template
16939 !! wikitext
16940 {{Identical}}
16941 !! html
16942 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16943 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
16944 </p>
16945 !! end
16947 !! test
16948 Bug31490 Turkish: ucfirst 'blah'
16949 !! options
16950 language=tr
16951 !! wikitext
16952 {{ucfirst:blah}}
16953 !! html
16954 <p>Blah
16955 </p>
16956 !! end
16958 !! test
16959 Bug31490 Turkish: ucfirst 'ix'
16960 !! options
16961 language=tr
16962 !! wikitext
16963 {{ucfirst:ix}}
16964 !! html
16965 <p>İx
16966 </p>
16967 !! end
16969 !! test
16970 Bug31490 Turkish: lcfirst 'BLAH'
16971 !! options
16972 language=tr
16973 !! wikitext
16974 {{lcfirst:BLAH}}
16975 !! html
16976 <p>bLAH
16977 </p>
16978 !! end
16980 !! test
16981 Bug31490 Turkish: ucfırst (with a dotless i)
16982 !! options
16983 language=tr
16984 !! wikitext
16985 {{ucfırst:blah}}
16986 !! html
16987 <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>
16988 </p>
16989 !! end
16991 !! test
16992 Bug31490 ucfırst (with a dotless i) with English language
16993 !! options
16994 language=en
16995 !! wikitext
16996 {{ucfırst:blah}}
16997 !! html
16998 <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>
16999 </p>
17000 !! end
17002 !! test
17003 Bug 26375: TOC with italics
17004 !! options
17005 title=[[Main Page]]
17006 !! wikitext
17007 __TOC__
17008 == ''Lost'' episodes ==
17009 !! html
17010 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17011 <ul>
17012 <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>
17013 </ul>
17014 </div>
17016 <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>
17018 !! end
17020 !! test
17021 Bug 26375: TOC with bold
17022 !! options
17023 title=[[Main Page]]
17024 !! wikitext
17025 __TOC__
17026 == '''should be bold''' then normal text ==
17027 !! html
17028 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17029 <ul>
17030 <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>
17031 </ul>
17032 </div>
17034 <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>
17036 !! end
17038 !! test
17039 Bug 33845: Headings become cursive in TOC when they contain an image
17040 !! options
17041 title=[[Main Page]]
17042 !! wikitext
17043 __TOC__
17044 == Image [[Image:foobar.jpg]] ==
17045 !! html
17046 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17047 <ul>
17048 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17049 </ul>
17050 </div>
17052 <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>
17054 !! end
17056 !! test
17057 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17058 !! options
17059 title=[[Main Page]]
17060 !! wikitext
17061 __TOC__
17062 == <blockquote>Quote</blockquote> ==
17063 !! html
17064 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17065 <ul>
17066 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17067 </ul>
17068 </div>
17070 <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>
17072 !! end
17074 !! test
17075 Unclosed tags in TOC
17076 !! options
17077 title=[[Main Page]]
17078 !! wikitext
17079 __TOC__
17080 == Proof: 2 < 3 ==
17081 <small>Hanc marginis exiguitas non caperet.</small>
17083 !! html
17084 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17085 <ul>
17086 <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>
17087 </ul>
17088 </div>
17090 <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>
17091 <p><small>Hanc marginis exiguitas non caperet.</small>
17093 </p>
17094 !! end
17096 !! test
17097 Multiple tags in TOC
17098 !! wikitext
17099 __TOC__
17100 == <i>Foo</i> <b>Bar</b> ==
17102 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17103 !! html
17104 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17105 <ul>
17106 <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>
17107 <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>
17108 </ul>
17109 </div>
17111 <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>
17112 <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>
17114 !! end
17116 !! test
17117 Tags with parameters in TOC
17118 !! wikitext
17119 __TOC__
17120 == <sup class="in-h2">Hello</sup> ==
17122 == <sup class="a > b">Evilbye</sup> ==
17123 !! html
17124 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17125 <ul>
17126 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17127 <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>
17128 </ul>
17129 </div>
17131 <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>
17132 <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>
17134 !! end
17136 !! test
17137 span tags with directionality in TOC
17138 !! wikitext
17139 __TOC__
17140 == <span dir="ltr">C++</span> ==
17142 == <span dir="rtl">זבנג!</span> ==
17144 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17146 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17148 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17149 !! html
17150 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17151 <ul>
17152 <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>
17153 <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>
17154 <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>
17155 <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>
17156 <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>
17157 </ul>
17158 </div>
17160 <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>
17161 <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>
17162 <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>
17163 <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>
17164 <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>
17166 !! end
17168 !! article
17169 MediaWiki:Bug32057
17170 !! text
17171 == {{int:headline_sample}} ==
17172 !! endarticle
17174 !! test
17175 Bug 32057: Title needed when expanding <h> nodes.
17176 !! options
17177 title=[[Main Page]]
17178 !! wikitext
17179 {{int:Bug32057}}
17180 !! html
17181 <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>
17183 !! end
17185 !! test
17186 Strip marker in urlencode
17187 !! wikitext
17188 {{urlencode:x<nowiki/>y}}
17189 {{urlencode:x<nowiki/>y|wiki}}
17190 {{urlencode:x<nowiki/>y|path}}
17191 !! html
17192 <p>xy
17195 </p>
17196 !! end
17198 !! test
17199 Strip marker in lc
17200 !! wikitext
17201 {{lc:x<nowiki/>y}}
17202 !! html
17203 <p>xy
17204 </p>
17205 !! end
17207 !! test
17208 Strip marker in uc
17209 !! wikitext
17210 {{uc:x<nowiki/>y}}
17211 !! html
17212 <p>XY
17213 </p>
17214 !! end
17216 !! test
17217 Strip marker in formatNum
17218 !! wikitext
17219 {{formatnum:1<nowiki/>2}}
17220 {{formatnum:1<nowiki/>2|R}}
17221 !! html
17222 <p>12
17224 </p>
17225 !! end
17227 !! test
17228 Check noCommafy in formatNum
17229 !! options
17230 language=be-tarask
17231 !! wikitext
17232 {{formatnum:123456.78}}
17233 {{formatnum:123456.78|NOSEP}}
17234 !! html
17235 <p>123 456,78
17236 123456.78
17237 </p>
17238 !! end
17240 !! test
17241 Wrong option for formatNum (bug 56199)
17242 !! wikitext
17243 {{formatnum:1,234.56|Random}}
17244 {{formatnum:1,234.56|EVERYTHING}}
17245 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17246 !! html
17247 <p>1,234.56
17248 1,234.56
17249 1,234.56
17250 </p>
17251 !! end
17253 !! test
17254 Strip marker in grammar
17255 !! options
17256 language=fi
17257 !! wikitext
17258 {{grammar:elative|foo<nowiki/>bar}}
17259 !! html
17260 <p>foobarista
17261 </p>
17262 !! end
17264 !! test
17265 Strip marker in padleft
17266 !! wikitext
17267 {{padleft:|2|x<nowiki/>y}}
17268 !! html
17269 <p>xy
17270 </p>
17271 !! end
17273 !! test
17274 Strip marker in padright
17275 !! wikitext
17276 {{padright:|2|x<nowiki/>y}}
17277 !! html
17278 <p>xy
17279 </p>
17280 !! end
17282 !! test
17283 Strip marker in anchorencode
17284 !! wikitext
17285 {{anchorencode:x<nowiki/>y}}
17286 !! html
17287 <p>xy
17288 </p>
17289 !! end
17291 !! test
17292 nowiki inside link inside heading (bug 18295)
17293 !! wikitext
17294 ==[[foo|x<nowiki>y</nowiki>z]]==
17295 !! html
17296 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">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>
17298 !! end
17300 !! test
17301 new support for bdi element (bug 31817)
17302 !! wikitext
17303 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17304 !! html
17305 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17307 !!end
17309 !! test
17310 Ignore pipe between table row attributes
17311 !! wikitext
17313 | quux
17314 |- id=foo | style='color: red'
17315 | bar
17317 !! html
17318 <table>
17319 <tr>
17320 <td> quux
17321 </td></tr>
17322 <tr id="foo" style="color: red">
17323 <td> bar
17324 </td></tr></table>
17326 !! end
17328 !!test
17329 Gallery override link with WikiLink (bug 34852)
17330 !! wikitext
17331 <gallery>
17332 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17333 </gallery>
17334 !! html
17335 <ul class="gallery mw-gallery-traditional">
17336                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17337                         <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>
17338                         <div class="gallerytext">
17339 <p>caption
17340 </p>
17341                         </div>
17342                 </div></li>
17343 </ul>
17345 !! end
17347 !!test
17348 Gallery override link with absolute external link (bug 34852)
17349 !! wikitext
17350 <gallery>
17351 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17352 </gallery>
17353 !! html
17354 <ul class="gallery mw-gallery-traditional">
17355                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17356                         <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>
17357                         <div class="gallerytext">
17358 <p>caption
17359 </p>
17360                         </div>
17361                 </div></li>
17362 </ul>
17364 !! end
17366 !!test
17367 Gallery override link with malicious javascript (bug 34852)
17368 !! wikitext
17369 <gallery>
17370 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17371 </gallery>
17372 !! html
17373 <ul class="gallery mw-gallery-traditional">
17374                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17375                         <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>
17376                         <div class="gallerytext">
17377 <p>caption
17378 </p>
17379                         </div>
17380                 </div></li>
17381 </ul>
17383 !! end
17385 !!test
17386 Gallery with invalid title as link (bug 43964)
17387 !! wikitext
17388 <gallery>
17389 File:foobar.jpg|link=<
17390 </gallery>
17391 !! html
17392 <ul class="gallery mw-gallery-traditional">
17393                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17394                         <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>
17395                         <div class="gallerytext">
17396                         </div>
17397                 </div></li>
17398 </ul>
17400 !! end
17402 !!test
17403 Language parser function
17404 !! wikitext
17405 {{#language:ar}}
17406 !! html
17407 <p>العربية
17408 </p>
17409 !! end
17411 !!test
17412 Padleft and padright as substr
17413 !! wikitext
17414 {{padleft:|3|abcde}}
17415 {{padright:|3|abcde}}
17416 !! html
17417 <p>abc
17419 </p>
17420 !! end
17422 !!test
17423 Special parser function
17424 !! wikitext
17425 {{#special:RandomPage}}
17426 {{#special:BaDtItLe}}
17427 {{#special:Foobar}}
17428 !! html
17429 <p>Special:Random
17430 Special:Badtitle
17431 Special:Foobar
17432 </p>
17433 !! end
17435 !!test
17436 Bug 34939 - Case insensitive link parsing ([HttP://])
17437 !! wikitext
17438 [HttP://MediaWiki.Org/]
17439 !! html/php
17440 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17441 </p>
17442 !! html/parsoid
17443 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17444 !! end
17446 !!test
17447 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17448 !! wikitext
17449 [HttP://MediaWiki.Org/ MediaWiki]
17450 !! html
17451 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17452 </p>
17453 !! end
17455 !!test
17456 Bug 34939 - Case insensitive link parsing (HttP://)
17457 !! wikitext
17458 HttP://MediaWiki.Org/
17459 !! html/php
17460 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17461 </p>
17462 !! html/parsoid
17463 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17464 !! end
17466 !!test
17467 Disable TOC
17468 !! options
17469 notoc
17470 !! wikitext
17471 Lead
17472 == Section 1 ==
17473 == Section 2 ==
17474 == Section 3 ==
17475 == Section 4 ==
17476 == Section 5 ==
17477 !! html
17478 <p>Lead
17479 </p>
17481 <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>
17482 <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>
17483 <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>
17484 <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>
17485 <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>
17487 !! end
17491 ### Parsoids-specific tests
17492 ### Parsoid-PHP parser incompatibilities
17494 !!test
17495 1. SOL-sensitive wikitext tokens as template-args
17496 !!options
17497 parsoid=wt2html,wt2wt
17498 !! wikitext
17499 {{echo|*a}}
17500 {{echo|#a}}
17501 {{echo|:a}}
17502 !! html
17503 <span about="#mwt1" typeof="mw:Transclusion">
17504 </span><ul about="#mwt1"><li>a</li>
17505 </ul>
17506 <span about="#mwt2" typeof="mw:Transclusion">
17507 </span><ol about="#mwt2"><li>a</li>
17508 </ol>
17509 <span about="#mwt3" typeof="mw:Transclusion">
17510 </span><dl about="#mwt3"><dd>a</dd>
17511 </dl>
17512 !!end
17514 #### ----------------------------------------------------------------
17515 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17516 #### tags. Parsoid's output for these tags differs from that of the
17517 #### PHP parser.
17518 #### ----------------------------------------------------------------
17520 !!test
17521 Ref: 1. ref-location should be replaced with an index span
17522 !!options
17523 parsoid
17524 !! wikitext
17525 A <ref>foo</ref>
17526 B <ref name="x">foo</ref>
17527 C <ref name="y" />
17528 !! html
17529 <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>
17530 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>
17531 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>
17532 !!end
17534 !!test
17535 Ref: 2. ref-tags with identical names should all get the same index
17536 !!options
17537 parsoid
17538 !! wikitext
17539 A <ref name="x">foo</ref>
17540 B <ref name="x" />
17541 !! html
17542 <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>
17543 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>
17544 !!end
17546 !!test
17547 Ref: 3. spaces in ref-names should be ignored
17548 !!options
17549 parsoid
17550 !! wikitext
17551 A <ref name="x">foo</ref>
17552 B <ref name=" x " />
17553 C <ref name= x  />
17554 !! html
17555 <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>
17556 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>
17557 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>
17558 !!end
17560 !!test
17561 Ref: 4. 'constructor' should be accepted as a valid ref-name
17562 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17563 !!options
17564 parsoid
17565 !! wikitext
17566 A <ref name="constructor">foo</ref>
17567 !! html
17568 <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>
17569 !!end
17571 !!test
17572 Ref: 5. body should accept generic wikitext
17573 !!options
17574 parsoid
17575 !! wikitext
17576 A <ref>
17577  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17578 </ref>
17580 <references />
17581 !! html
17582 <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\" 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;{\"dsr\":[55,76,null,null],\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]]}&#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>
17584 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17585 <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">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>
17586 </li>
17587 </ol>
17588 !!end
17590 !!test
17591 Ref: 6. indent-pres should not be output in ref-body
17592 !!options
17593 parsoid
17594 !! wikitext
17595 A <ref>
17596  foo
17597  bar
17598  baz
17599 </ref>
17601 <references />
17602 !! html
17603 <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>
17605 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17606 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17607  bar
17608  baz
17609 </li>
17610 </ol>
17611 !!end
17613 !!test
17614 Ref: 7. No p-wrapping in ref-body
17615 !!options
17616 parsoid
17617 !! wikitext
17618 A <ref>
17628 booz
17629 </ref>
17631 <references />
17632 !! html
17633 <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>
17635 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17636 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17645 booz
17646 </li>
17647 </ol>
17648 !!end
17650 !!test
17651 Ref: 8. transclusion wikitext has lower precedence
17652 !!options
17653 parsoid
17654 !! wikitext
17655 A <ref> foo {{echo|</ref> B C}}
17657 <references />
17658 !! html
17659 <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>
17660 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
17661 <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>
17662 </ol>
17663 !!end
17665 !!test
17666 Ref: 9. unclosed comments should not leak out of ref-body
17667 !!options
17668 parsoid
17669 !! wikitext
17670 A <ref> foo <!--</ref> B C
17671 <references />
17672 !! html
17673 <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>
17674 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17675 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
17676 </ol>
17677 !!end
17679 !!test
17680 Ref: 10. Unclosed HTML tags should not leak out of ref-body
17681 !!options
17682 parsoid
17683 !! wikitext
17684 A <ref> <b> foo </ref> B C
17686 <references />
17687 !! html
17688 <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>
17691 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17692 <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>
17693 </ol>
17694 !!end
17696 !!test
17697 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
17698 !!options
17699 parsoid
17700 !! wikitext
17701 A <ref>foo</ref> B
17702 C <ref>bar</ref> D
17703 !! html
17704 <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
17705 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>
17706 !!end
17708 !!test
17709 Ref: 12. ref-tags act as trailing newline migration barrier
17710 !!options
17711 parsoid
17712 !! wikitext
17713 <!--the newline at the end of this line moves out of the p-tag-->a
17715 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
17716 <ref />
17719 !! html
17720 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
17723 <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>
17724 <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>
17727 <p>c</p>
17728 !!end
17730 !!test
17731 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
17732 !!options
17733 parsoid
17734 !! wikitext
17735 <ref>foo</ref> A
17736 <ref>bar
17737 </ref> B
17738 !! html
17739 <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
17740 <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>
17741 !!end
17743 !!test
17744 Ref: 14. A nested ref-tag should be emitted as plain text
17745 !!options
17746 parsoid
17747 !! wikitext
17748 <ref>foo <ref>bar</ref> baz</ref>
17750 <references />
17751 !! html
17752 <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>
17754 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
17755 <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>
17756 </ol>
17757 !!end
17759 !!test
17760 Ref: 15. ref-tags with identical names should get identical indexes
17761 !!options
17762 parsoid
17763 !! wikitext
17764 A1 <ref name="a">foo</ref> A2 <ref name="a" />
17765 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
17767 <references />
17768 !! html
17769 <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>
17770 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>
17772 <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>
17773 </ol>
17774 !!end
17776 ## We don't bother wt2wt-ing non-standard whitespace
17777 !!test
17778 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
17779 !!options
17780 parsoid=wt2html
17781 !! wikitext
17782 A <ref >foo</ref >
17784 <references />
17785 !! html
17786 <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>
17788 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17789 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
17790 !!end
17792 !!test
17793 References: 1. references tag without any refs should be handled properly
17794 !!options
17795 parsoid
17796 !! wikitext
17797 <references />
17798 !! html
17799 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
17800 !!end
17802 !!test
17803 References: 2. references tag with group only outputs references from that group
17804 !!options
17805 parsoid
17806 !! wikitext
17807 A <ref group="a">foo</ref>
17808 B <ref group="b">bar</ref>
17810 <references group="a" />
17811 !! html
17812 <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>
17813 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>
17815 <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>
17816 </ol>
17817 !!end
17819 !!test
17820 References: 3. ref list should be cleared after processing references
17821 !!options
17822 parsoid
17823 !! wikitext
17824 A <ref>foo</ref>
17826 <references />
17828 B <ref>bar</ref>
17830 <references />
17831 !! html
17832 <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>
17834 <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>
17835 </ol>
17837 <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>
17839 <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>
17840 </ol>
17841 !!end
17843 !!test
17844 References: 4. only referenced group should be cleared after processing references
17845 !!options
17846 parsoid
17847 !! wikitext
17848 A <ref group="a">afoo</ref>
17849 B <ref>bfoo</ref>
17851 <references group="a" />
17853 C <ref>cfoo</ref>
17855 <references />
17856 !! html
17857 <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>
17858 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>
17860 <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>
17861 </ol>
17863 <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>
17865 <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>
17866 </ol>
17867 !!end
17869 !!test
17870 References: 5. ref tags in references should be processed while ignoring all other content
17871 !!options
17872 parsoid
17873 !! wikitext
17874 A <ref name="a" />
17875 B <ref name="b">bar</ref>
17877 <references>
17878 <ref name="a">foo</ref>
17879 This should just get lost.
17880 </references>
17881 !! html
17882 <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>
17883 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>
17886 <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":{}}'>
17887 <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>
17888 <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>
17889 </ol>
17890 !!end
17892 !!test
17893 References: 6. <references /> from a transclusion
17894 !!options
17895 parsoid
17896 !! wikitext
17897 <ref>Foo</ref> {{echo|<references />}}
17898 !! html
17899 <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>
17900 !!end
17902 !! test
17903 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
17904 !! options
17905 parsoid
17906 !! wikitext
17907 A <ref>foo bar for a</ref>
17908 B <ref group="X" name="b" />
17910 <references />
17912 <references group="X">
17913 <ref name="b">foo</ref>
17914 </references>
17915 !! html
17916 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-2" data-parsoid="{}">[2]</a></span>
17917 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-3-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"b\" group=\"X\" />"}'><a href="#cite_note-b-3" data-parsoid="{}">[X 1]</a></span></p>
17919 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}">↑</span> foo</li><li about="#cite_note-2" id="cite_note-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-2-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
17921 <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-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-3" id="cite_note-b-3" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-3-0" data-parsoid="{}">↑</a></span> </li></ol>
17922 !! end
17924 !! test
17925 Entities in ref name
17926 !! options
17927 parsoid
17928 !! wikitext
17929 <ref name="test &amp; me">hi</ref>
17930 !! html
17931 <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>
17932 !! end
17934 # This test is wt2html only because we're permitting the serializer to produce
17935 # dirty diffs, normalizing the unclosed references to the self-closed version.
17936 !! test
17937 Generate references for unclosed references tag
17938 !! options
17939 parsoid=wt2html
17940 !! wikitext
17941 a<ref>foo</ref>
17943 <references>
17944 !! html
17945 <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>
17948 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
17949 <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>
17950 !! end
17952 !! test
17953 New reference serializes on its own line
17954 !! options
17955 parsoid=wt2wt,html2wt
17956 !! wikitext
17958 <references />
17959 !! html
17960 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
17961 !! end
17963 #### ----------------------------------------------------------------
17964 #### The following section of tests are primarily to test
17965 #### wikitext escaping capabilities of Parsoid.  Given that
17966 #### escaping can be done any number of ways, the wikitext (input)
17967 #### is always adjusted to reflect how Parsoid adds nowiki
17968 #### escape tags.
17969 ####
17970 #### We are marking several tests as parsoid-only since the
17971 #### HTML in the result section is different from what the
17972 #### PHP parser generates for it.
17973 #### ----------------------------------------------------------------
17976 #### --------------- Headings ---------------
17977 #### 0. Unnested
17978 #### 1. Nested inside html <h1>=foo=</h1>
17979 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
17980 #### 3. Nested inside html with wikitext split by html tags
17981 #### 4. No escape needed
17982 #### 5. Empty headings <h1></h1>
17983 #### 6. Heading chars in SOL context
17984 #### ----------------------------------------
17985 !! test
17986 Headings: 0. Unnested
17987 !! options
17988 parsoid
17989 !! wikitext
17990 <nowiki>=foo=</nowiki>
17992 <nowiki> =foo= </nowiki>
17993 <!--cmt-->
17994 <nowiki>=foo=</nowiki>
17996 =foo''a''<nowiki>=</nowiki>
17997 !! html
17998 <p><span typeof="mw:Nowiki">=foo=</span></p>
18000 <p><span typeof="mw:Nowiki"> =foo= </span>
18001 <!--cmt-->
18002 <span typeof="mw:Nowiki">=foo=</span></p>
18004 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18005 !!end
18007 !! test
18008 Headings: 1. Nested inside html
18009 (New headings and existing headings are handled differently)
18010 !! options
18011 parsoid=html2wt
18012 !! wikitext
18013 = =foo= =
18015 == =foo= ==
18017 === =foo= ===
18019 =<nowiki>=foo=</nowiki>=
18020 ==<nowiki>=foo=</nowiki>==
18021 ===<nowiki>=foo=</nowiki>===
18022 ====<nowiki>=foo=</nowiki>====
18023 =====<nowiki>=foo=</nowiki>=====
18024 ======<nowiki>=foo=</nowiki>======
18026 !! html
18027 <h1>=foo=</h1>
18028 <h2>=foo=</h2>
18029 <h3>=foo=</h3>
18031 <h1 data-parsoid='{}'>=foo=</h1>
18032 <h2 data-parsoid='{}'>=foo=</h2>
18033 <h3 data-parsoid='{}'>=foo=</h3>
18034 <h4 data-parsoid='{}'>=foo=</h4>
18035 <h5 data-parsoid='{}'>=foo=</h5>
18036 <h6 data-parsoid='{}'>=foo=</h6>
18037 !!end
18039 !! test
18040 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18041 !! options
18042 parsoid=html2wt
18043 !! wikitext
18044 = foo =
18045 <nowiki>*</nowiki>bar
18047 = foo =
18048 =bar
18050 = foo =
18051 <nowiki>=bar=</nowiki>
18052 !! html
18053 <h1>foo</h1>*bar
18054 <h1>foo</h1>=bar
18055 <h1>foo</h1>=bar=
18056 !!end
18058 !! test
18059 Headings: 3. Nested inside html with wikitext split by html tags
18060 !! options
18061 parsoid=html2wt
18062 !! wikitext
18063 = ='''bold'''<nowiki>foo=</nowiki> =
18064 !! html
18065 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18066 !!end
18068 !! test
18069 Headings: 4a. No escaping needed (testing just h1 and h2)
18070 !! options
18071 parsoid=html2wt
18072 !! wikitext
18073 = =foo =
18075 = foo= =
18077 = =foo= =
18079 = =foo= bar =
18081 == =foo ==
18083 == foo= ==
18085 = ''=''foo= =
18087 = <nowiki>=</nowiki> =
18088 !! html
18089 <h1>=foo</h1>
18090 <h1>foo=</h1>
18091 <h1> =foo= </h1>
18092 <h1>=foo= bar</h1>
18093 <h2>=foo</h2>
18094 <h2>foo=</h2>
18095 <h1><i>=</i>foo=</h1>
18096 <h1><span typeof="mw:Nowiki">=</span></h1>
18097 !!end
18099 !! test
18100 Headings: 4b. No escaping needed (inside p-tags)
18101 !! options
18102 parsoid=html2wt
18103 !! wikitext
18105 =foo= x
18106 =foo= <s></s>
18107 !! html
18108 <p>===
18109 =foo= x
18110 =foo= <s></s>
18111 </p>
18112 !!end
18114 !! test
18115 Headings: 5. Empty headings
18116 !! options
18117 parsoid
18118 !! wikitext
18119 =<nowiki/>=
18121 ==<nowiki/>==
18123 ===<nowiki/>===
18125 ====<nowiki/>====
18127 =====<nowiki/>=====
18129 ======<nowiki/>======
18130 !! html
18131 <h1></h1>
18132 <h2></h2>
18133 <h3></h3>
18134 <h4></h4>
18135 <h5></h5>
18136 <h6></h6>
18137 !!end
18139 !! test
18140 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18141 !! options
18142 parsoid
18143 !! wikitext
18144 <nowiki>=a=</nowiki>
18146 <nowiki>=a=</nowiki> 
18148 <nowiki>=a=</nowiki>    
18150 <nowiki>=a=</nowiki>    
18151 !! html
18152 <p>=a=</p>
18153 <p>=a= </p>
18154 <p>=a=  </p>
18155 <p>=a=  </p>
18156 !!end
18158 !! test
18159 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18160 !! options
18161 parsoid
18162 !! wikitext
18163 <nowiki>=a=
18164 b</nowiki>
18166 <nowiki>=a= 
18167 b</nowiki>
18169 <nowiki>=a=     
18170 b</nowiki>
18172 <nowiki>=a=      
18173 b</nowiki>
18174 !! html
18175 <p>=a=
18176 b</p>
18177 <p>=a= 
18178 b</p>
18179 <p>=a=  
18180 b</p>
18181 <p>=a=   
18182 b</p>
18183 </p>
18184 !!end
18186 !! test
18187 Headings: 6c. Heading chars in SOL context (leading newline break)
18188 !! options
18189 parsoid
18190 !! wikitext
18192 <nowiki>=b=</nowiki>
18193 !! html
18194 <p>a
18195 =b=</p>
18196 !!end
18198 !! test
18199 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18200 !! options
18201 parsoid
18202 !! wikitext
18203 <!--c0--><nowiki>=a=</nowiki>
18205 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
18206 !! html
18207 <p><!--c0-->=a=</p>
18208 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
18209 !!end
18211 !! test
18212 Headings: 6d. Heading chars in SOL context (No escaping needed)
18213 !! options
18214 parsoid=html2wt
18215 !! wikitext
18216 =a=<div>b</div>
18217 !! html
18218 =a=<div>b</div>
18219 !!end
18221 #### --------------- Lists ---------------
18222 #### 0. Outside nests (*foo, etc.)
18223 #### 1. Nested inside html <ul><li>*foo</li></ul>
18224 #### 2. Inside definition lists
18225 #### 3. Only bullets at start should be escaped
18226 #### 4. No escapes needed
18227 #### 5. No unnecessary escapes
18228 #### 6. Escape bullets in SOL position
18229 #### 7. Escape bullets in a multi-line context
18230 #### ----------------------------------------
18232 !! test
18233 Lists: 0. Outside nests
18234 !! wikitext
18235 <nowiki>*</nowiki>foo
18237 <nowiki>#</nowiki>foo
18238 !! html
18239 <p>*foo
18240 </p><p>#foo
18241 </p>
18242 !!end
18244 !! test
18245 Lists: 1. Nested inside html
18246 !! wikitext
18247 *<nowiki>*foo</nowiki>
18249 *<nowiki>#foo</nowiki>
18251 *<nowiki>:foo</nowiki>
18253 *<nowiki>;foo</nowiki>
18255 #<nowiki>*foo</nowiki>
18257 #<nowiki>#foo</nowiki>
18259 #<nowiki>:foo</nowiki>
18261 #<nowiki>;foo</nowiki>
18262 !! html
18263 <ul><li>*foo</li></ul>
18264 <ul><li>#foo</li></ul>
18265 <ul><li>:foo</li></ul>
18266 <ul><li>;foo</li></ul>
18267 <ol><li>*foo</li></ol>
18268 <ol><li>#foo</li></ol>
18269 <ol><li>:foo</li></ol>
18270 <ol><li>;foo</li></ol>
18272 !!end
18274 !! test
18275 Lists: 2. Inside definition lists
18276 !! wikitext
18277 ;<nowiki>;foo</nowiki>
18279 ;<nowiki>:foo</nowiki>
18281 ;<nowiki>:foo</nowiki>
18282 :bar
18284 :<nowiki>:foo</nowiki>
18285 !! html
18286 <dl><dt>;foo</dt></dl>
18287 <dl><dt>:foo</dt></dl>
18288 <dl><dt>:foo</dt>
18289 <dd>bar</dd></dl>
18290 <dl><dd>:foo</dd></dl>
18292 !!end
18294 !! test
18295 Lists: 3. Only bullets at start of text should be escaped
18296 !! wikitext
18297 *<nowiki>*foo*bar</nowiki>
18299 *<nowiki>*foo</nowiki>''it''*bar
18300 !! html
18301 <ul><li>*foo*bar</li></ul>
18302 <ul><li>*foo<i>it</i>*bar</li></ul>
18304 !!end
18306 !! test
18307 Lists: 4. No escapes needed
18308 !! options
18309 parsoid
18310 !! wikitext
18311 *foo*bar
18313 *''foo''*bar
18315 *[[Foo]]: bar
18317 *[[Foo]]*bar
18318 !! html
18319 <ul>
18320 <li>foo*bar
18321 </li>
18322 </ul>
18323 <ul>
18324 <li><i>foo</i>*bar
18325 </li>
18326 </ul>
18327 <ul>
18328 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18329 </li>
18330 </ul>
18331 <ul>
18332 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18333 </li>
18334 </ul>
18335 !!end
18337 !! test
18338 Lists: 5. No unnecessary escapes
18339 !! wikitext
18340 * bar <span><nowiki>[[foo]]</nowiki></span>
18342 *=bar <span><nowiki>[[foo]]</nowiki></span>
18344 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18346 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18348 *=bar <span>foo]]</span>=
18350 * <s></s>: a
18351 !! html
18352 <ul><li> bar <span>[[foo]]</span></li></ul>
18353 <ul><li>=bar <span>[[foo]]</span></li></ul>
18354 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18355 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18356 <ul><li>=bar <span>foo]]</span>=</li></ul>
18357 <ul><li> <s></s>: a</li></ul>
18359 !!end
18361 !! test
18362 Lists: 6. Escape bullets in SOL position
18363 !! options
18364 parsoid
18365 !! wikitext
18366 <!--cmt--><nowiki>*foo</nowiki>
18367 !! html
18368 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18369 !!end
18371 !! test
18372 Lists: 7. Escape bullets in a multi-line context
18373 !! wikitext
18375 <nowiki>*</nowiki>b
18376 !! html
18377 <p>a
18379 </p>
18380 !!end
18382 #### --------------- HRs ---------------
18383 #### 1. Single line
18384 #### -----------------------------------
18386 !! test
18387 HRs: 1. Single line
18388 !! options
18389 parsoid
18390 !! wikitext
18391 ----<nowiki>----</nowiki>
18392 ----=foo=
18393 ----*foo
18394 !! html
18395 <hr><span typeof="mw:Nowiki">----</span>
18396 <hr>=foo=
18397 <hr>*foo
18398 !! end
18400 #### --------------- Tables ---------------
18401 #### 1a. Simple example
18402 #### 1b. No escaping needed (!foo)
18403 #### 1c. No escaping needed (|foo)
18404 #### 1d. No escaping needed (|}foo)
18405 ####
18406 #### 2a. Nested in td (<td>foo|bar</td>)
18407 #### 2b. Nested in td (<td>foo||bar</td>)
18408 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18409 ####
18410 #### 3a. Nested in th (<th>foo!bar</th>)
18411 #### 3b. Nested in th (<th>foo!!bar</th>)
18412 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18413 ####
18414 #### 4a. Escape -
18415 #### 4b. Escape +
18416 #### 4c. No escaping needed
18417 #### --------------------------------------
18419 !! test
18420 Tables: 1a. Simple example
18421 !! wikitext
18422 <nowiki>{|
18423 |}</nowiki>
18424 !! html
18425 <p>{|
18427 </p>
18428 !! end
18430 !! test
18431 Tables: 1b. No escaping needed
18432 !! wikitext
18433 !foo
18434 !! html
18435 <p>!foo
18436 </p>
18437 !! end
18439 !! test
18440 Tables: 1c. No escaping needed
18441 !! wikitext
18442 |foo
18443 !! html
18444 <p>|foo
18445 </p>
18446 !! end
18448 !! test
18449 Tables: 1d. No escaping needed
18450 !! wikitext
18451 |}foo
18452 !! html
18453 <p>|}foo
18454 </p>
18455 !! end
18457 !! test
18458 Tables: 2a. Nested in td
18459 !! options
18460 parsoid=html2wt
18461 !! wikitext
18463 |<nowiki>foo|bar</nowiki>
18465 |x<div><nowiki>a|b</nowiki></div>
18467 !! html
18468 <table><tbody><tr>
18469 <td>foo|bar</td></tr>
18470 <tr><td>x<div>a|b</div></td>
18471 </tbody></table>
18472 !! end
18474 !! test
18475 Tables: 2b. Nested in td
18476 !! options
18477 parsoid
18478 !! wikitext
18480 |<nowiki>foo||bar</nowiki>
18481 |''it''<nowiki>foo||bar</nowiki>
18483 !! html
18484 <table><tbody><tr>
18485 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18486 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18487 !! end
18489 !! test
18490 Tables: 2c. Nested in td -- no escaping needed
18491 !! options
18492 parsoid
18493 !! wikitext
18495 |foo!!bar
18497 !! html
18498 <table><tbody><tr><td>foo!!bar
18499 </td></tr></tbody></table>
18501 !! end
18503 !! test
18504 Tables: 3a. Nested in th
18505 !! options
18506 parsoid
18507 !! wikitext
18509 !foo!bar
18511 !! html
18512 <table><tbody><tr><th>foo!bar
18513 </th></tr></tbody></table>
18515 !! end
18517 !! test
18518 Tables: 3b. Nested in th
18519 !! options
18520 parsoid
18521 !! wikitext
18523 !<nowiki>foo!!bar</nowiki>
18525 !! html
18526 <table>
18527 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18528 </tbody></table>
18529 !! end
18531 !! test
18532 Tables: 3c. Nested in th -- no escaping needed
18533 !! options
18534 parsoid
18535 !! wikitext
18537 !<nowiki>foo||bar</nowiki>
18539 !! html
18540 <table><tbody><tr>
18541 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18542 !! end
18544 !! test
18545 Tables: 4a. Escape -
18546 !! options
18547 parsoid
18548 !! wikitext
18550 !-bar
18552 |<nowiki>-bar</nowiki>
18554 !! html
18555 <table><tbody>
18556 <tr><th>-bar</th></tr>
18557 <tr>
18558 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18559 !! end
18561 !! test
18562 Tables: 4b. Escape +
18563 !! options
18564 parsoid
18565 !! wikitext
18567 !+bar
18569 |<nowiki>+bar</nowiki>
18571 !! html
18572 <table><tbody>
18573 <tr><th>+bar</th></tr>
18574 <tr>
18575 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18576 !! end
18578 !! test
18579 Tables: 4c. No escaping needed
18580 !! options
18581 parsoid
18582 !! wikitext
18584 |foo-bar
18585 |foo+bar
18587 |''foo''-bar
18588 |''foo''+bar
18590 |foo
18591 bar|baz
18592 +bar
18593 -bar
18596 <div>a|b</div>
18598 !! html
18599 <table><tbody>
18600 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18601 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18602 <tr><td>foo
18603 <p>bar|baz
18604 +bar
18605 -bar</p></td></tr>
18606 <tr><td>x
18607 <div>a|b</div></td>
18608 </tbody></table>
18609 !! end
18611 !! test
18612 Tables: 4d. No escaping needed
18613 !! options
18614 parsoid
18615 !! wikitext
18617 |[[Foo]]-bar
18618 ||+1
18619 ||-2
18621 !! html
18622 <table>
18623 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18624 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18625 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18626 </tbody></table>
18627 !! end
18629 !! test
18630 Tables: Digest broken attributes on table and tr tag
18631 !! options
18632 parsoid=wt2html
18633 !! wikitext
18634 {| || |} ++
18635 |- || || ++ --
18636 |- > [
18638 !! html
18639 <table>
18640 <tbody>
18641 <tr></tr>
18642 <tr></tr>
18643 </tbody></table>
18644 !! end
18646 #### --------------- Links ----------------
18647 #### 1. Quote marks in link text
18648 #### 2. Wikilinks: Escapes needed
18649 #### 3. Wikilinks: No escapes needed
18650 #### 4. Extlinks: Escapes needed
18651 #### 5. Extlinks: No escapes needed
18652 #### --------------------------------------
18653 !! test
18654 Links 1. Quote marks in link text
18655 !! options
18656 parsoid
18657 !! wikitext
18658 [[Foo|Foo<nowiki>''boo''</nowiki>]]
18659 !! html
18660 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
18661 !! end
18663 !! test
18664 Links 2. WikiLinks: Escapes needed
18665 !! options
18666 parsoid
18667 !! wikitext
18668 [[Foo|[Foobar]]]
18669 [[Foo|<nowiki>Foobar]</nowiki>]]
18670 [[Foo|x [Foobar] x]]
18671 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
18672 [[Foo|<nowiki>[[Bar]]</nowiki>]]
18673 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
18674 [[Foo|<nowiki>|Bar</nowiki>]]
18675 [[Foo|<nowiki>]]bar</nowiki>]]
18676 [[Foo|<nowiki>[[bar</nowiki>]]
18677 [[Foo|<nowiki>x [[ y</nowiki>]]
18678 [[Foo|<nowiki>x ]] y</nowiki>]]
18679 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
18680 !! html
18681 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
18682 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
18683 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
18684 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
18685 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
18686 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
18687 <a href="Foo" rel="mw:WikiLink">|Bar</a>
18688 <a href="Foo" rel="mw:WikiLink">]]bar</a>
18689 <a href="Foo" rel="mw:WikiLink">[[bar</a>
18690 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
18691 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
18692 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
18693 !! end
18695 !! test
18696 Links 3. WikiLinks: No escapes needed
18697 !! options
18698 parsoid
18699 !! wikitext
18700 [[Foo|[Foobar]]
18701 [[Foo|foo|bar]]
18702 !! html
18703 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
18704 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
18705 !! end
18707 !! test
18708 Links 4. ExtLinks: Escapes needed
18709 !! options
18710 parsoid
18711 !! wikitext
18712 [http://google.com <nowiki>[google]</nowiki>]
18713 [http://google.com <nowiki>google]</nowiki>]
18715 <nowiki>[http://google.com]</nowiki>
18717 <nowiki>[http://google.com google]</nowiki>
18719 !! html
18720 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
18721 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
18722 <p>[http://google.com]</p>
18723 <p>[http://google.com google]</p>
18724 !! end
18726 !! test
18727 Links 5. ExtLinks: No escapes needed
18728 !! options
18729 parsoid
18730 !! wikitext
18731 [http://google.com [google]
18732 !! html
18733 <a href="http://google.com" rel="mw:ExtLink">[google</a>
18734 !! end
18736 #### --------------- Quotes ---------------
18737 #### 1. Quotes inside <b> and <i>
18738 #### 2. Link fragments separated by <i> and <b> tags
18739 #### 3. Link fragments inside <i> and <b>
18740 #### 4. No escaping needed
18741 #### --------------------------------------
18742 !! test
18743 1. Quotes inside <b> and <i>
18744 !! options
18745 parsoid=html2wt,wt2wt
18746 !! wikitext
18747 ''<nowiki>'foo'</nowiki>''
18748 ''<nowiki>''foo''</nowiki>''
18749 ''<nowiki>'''foo'''</nowiki>''
18750 ''foo''<nowiki/>'s
18751 '''<nowiki>'foo'</nowiki>'''
18752 '''<nowiki>''foo''</nowiki>'''
18753 '''<nowiki>'''foo'''</nowiki>'''
18754 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
18755 '''foo'''<nowiki/>'s
18756 '''foo''
18757 ''foo''<nowiki/>'
18758 '<nowiki/>''foo''<nowiki/>'
18759 ''''foo'''
18760 '''foo'''<nowiki/>'
18761 '<nowiki/>'''foo'''<nowiki/>'
18762 ''fools'<span> errand</span>''
18763 ''<span>fool</span>'s errand''
18764 !! html
18765 <p><i>'foo'</i>
18766 <i>''foo''</i>
18767 <i>'''foo'''</i>
18768 <i>foo</i>'s
18769 <b>'foo'</b>
18770 <b>''foo''</b>
18771 <b>'''foo'''</b>
18772 <b>foo'<i>bar'</i>baz</b>
18773 <b>foo</b>'s
18774 '<i>foo</i>
18775 <i>foo</i>'
18776 '<i>foo</i>'
18777 '<b>foo</b>
18778 <b>foo</b>'
18779 '<b>foo</b>'</p>
18780 <i>fools'<span> errand</span></i>
18781 <i><span>fool</span>'s errand</i>
18782 !! end
18784 !! test
18785 2. Link fragments separated by <i> and <b> tags
18786 !! wikitext
18787 [[''foo''<nowiki>hello]]</nowiki>
18789 [['''foo'''<nowiki>hello]]</nowiki>
18790 !! html
18791 <p>[[<i>foo</i>hello]]
18792 </p><p>[[<b>foo</b>hello]]
18793 </p>
18794 !! end
18796 !! test
18797 3. Link fragments inside <i> and <b>
18798 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
18799  this is one of the shortcomings of this format)
18800 !! wikitext
18801 ''[[foo''<nowiki>]]</nowiki>
18803 '''[[foo'''<nowiki>]]</nowiki>
18804 !! html
18805 <p><i>[[foo</i>]]
18806 </p><p><b>[[foo</b>]]
18807 </p>
18808 !! end
18810 !! test
18811 4. No escaping needed
18812 !! wikitext
18813 '<span>''bar''</span>'
18814 '<span>'''bar'''</span>'
18815 !! html
18816 <p>'<span><i>bar</i></span>'
18817 '<span><b>bar</b></span>'
18818 </p>
18819 !! end
18821 #### ----------- Paragraphs ---------------
18822 #### 1. No unnecessary escapes
18823 #### --------------------------------------
18825 !! test
18826 1. No unnecessary escapes
18827 !! wikitext
18828 bar <span><nowiki>[[foo]]</nowiki></span>
18830 =bar <span><nowiki>[[foo]]</nowiki></span>
18832 [[bar <span><nowiki>[[foo]]</nowiki></span>
18834 ]]bar <span><nowiki>[[foo]]</nowiki></span>
18836 =bar <span>foo]]</span><nowiki>=</nowiki>
18837 !! html
18838 <p>bar <span>[[foo]]</span>
18839 </p><p>=bar <span>[[foo]]</span>
18840 </p><p>[[bar <span>[[foo]]</span>
18841 </p><p>]]bar <span>[[foo]]</span>
18842 </p><p>=bar <span>foo]]</span>=
18843 </p>
18844 !!end
18846 #### ----------------------- PRE --------------------------
18847 #### 1. Leading whitespace in SOL context should be escaped
18848 #### ------------------------------------------------------
18849 !! test
18850 1. Leading whitespace in SOL context should be escaped
18851 !! options
18852 parsoid
18853 !! wikitext
18854 <nowiki> </nowiki>a
18856 <nowiki> </nowiki> a
18858 <nowiki>        </nowiki>a(tab)
18860 <nowiki> </nowiki>      a
18861 <!--cmt-->
18862 <nowiki> </nowiki> a
18865 <nowiki> </nowiki>b
18868 <nowiki>        </nowiki>b
18871 <nowiki>        </nowiki> b
18872 !! html
18873 <p> a</p>
18874 <p>  a</p>
18875 <p>     a(tab)</p>
18876 <p>     a</p>
18877 <p><!--cmt-->  a</p>
18878 <p>a
18879  b</p>
18880 <p>a
18881         b</p>
18882 <p>a
18883          b</p>
18884 !! end
18886 #### --------------- Behavior Switches --------------------
18887 !! test
18888 1. Valid behavior switches should be escaped
18889 !! options
18890 parsoid=html2wt
18891 !! wikitext
18892 <nowiki>__TOC__</nowiki>
18893 !! html
18894 __TOC__
18895 !! end
18897 !! test
18898 2. Invalid behavior switches should not be escaped
18899 !! options
18900 parsoid=html2wt
18901 !! wikitext
18902 __TOO__
18903 __|__
18904 !! html
18905 __TOO__
18906 __|__
18907 !! end
18909 #### --------------- HTML tags ---------------
18910 #### 1. a tags
18911 #### 2. other tags
18912 #### 3. multi-line html tag
18913 #### 4. extension tags
18914 #### -----------------------------------------
18915 !! test
18916 1. a tags
18917 !! options
18918 parsoid
18919 !! wikitext
18920 <a href="http://google.com">google</a>
18921 !! html
18922 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
18923 !! end
18925 !! test
18926 2. other tags
18927 !! wikitext
18928 <nowiki><div>foo</div>
18929 <div style="color:red">foo</div></nowiki>
18930 !! html
18931 <p>&lt;div&gt;foo&lt;/div&gt;
18932 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
18933 </p>
18934 !! end
18936 !! test
18937 3. multi-line html tag
18938 !! wikitext
18939 <nowiki><div
18940 >foo</div
18941 ></nowiki>
18942 !! html
18943 <p>&lt;div
18944 &gt;foo&lt;/div
18945 &gt;
18946 </p>
18947 !! end
18949 !! test
18950 4. extension tags
18951 !! wikitext
18952 <nowiki><ref>foo</ref></nowiki>
18954 <nowiki><ref>bar</nowiki>
18956 baz<nowiki></ref></nowiki>
18957 !! html
18958 <p>&lt;ref&gt;foo&lt;/ref&gt;
18959 </p><p>&lt;ref&gt;bar
18960 </p><p>baz&lt;/ref&gt;
18961 </p>
18962 !! end
18964 #### --------------- Others ---------------
18965 !! test
18966 Escaping nowikis
18967 !! wikitext
18968 &lt;nowiki&gt;foo&lt;/nowiki&gt;
18969 !! html
18970 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
18971 </p>
18972 !! end
18974 ## The quote-char in the input is necessary for triggering the bug
18975 !! test
18976 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
18977 !! options
18978 parsoid=wt2wt,html2wt
18979 !! wikitext
18980 foo's bar :
18981 !! html
18982 <p>foo's bar :</p>
18983 !! end
18985 !! test
18987 Tag-like HTML structures are passed through as text
18988 !! wikitext
18989 <x y>
18991 <x.y>
18993 <x-y>
19001 1<d e>f
19002 !! html
19003 <p>&lt;x y&gt;
19004 </p><p>&lt;x.y&gt;
19005 </p><p>&lt;x-y&gt;
19006 </p><p>1&gt;2
19007 </p><p>x&lt;y
19008 </p><p>a&gt;b
19009 </p><p>1&lt;d e&gt;f
19010 </p>
19011 !! end
19014 # This was a bug in the PHP parser (see bug 17663 and its dups,
19015 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19016 !! test
19017 Tag names followed by punctuation should not be recognized as tags
19018 !! wikitext
19019 <s.ome> text
19020 !! html
19021 <p>&lt;s.ome&gt; text
19022 </p>
19023 !! end
19025 !! test
19026 HTML tag with necessary entities in attributes
19027 !! wikitext
19028 <span title="&amp;amp;">foo</span>
19029 !! html
19030 <p><span title="&amp;amp;">foo</span>
19031 </p>
19032 !! end
19034 !! test
19035 HTML tag with 'unnecessary' entity encoding in attributes
19036 !! wikitext
19037 <span title="&amp;">foo</span>
19038 !! html
19039 <p><span title="&amp;">foo</span>
19040 </p>
19041 !! end
19043 !! test
19044 HTML tag with broken attribute value quoting
19045 !! wikitext
19046 <span title="Hello world>Foo</span>
19047 !! html
19048 <p><span>Foo</span>
19049 </p>
19050 !! end
19052 !! test
19053 Parsoid-only: HTML tag with broken attribute value quoting
19054 !! options
19055 parsoid
19056 !! wikitext
19057 <span title="Hello world>Foo</span>
19058 !! html
19059 <p><span title="Hello world">Foo</span>
19060 </p>
19061 !! end
19063 !! test
19064 Table with broken attribute value quoting
19065 !! wikitext
19067 | title="Hello world|Foo
19069 !! html
19070 <table>
19071 <tr>
19072 <td>Foo
19073 </td></tr></table>
19075 !! end
19077 !! test
19078 Table with broken attribute value quoting on consecutive lines
19079 !! wikitext
19081 | title="Hello world|Foo
19082 | style="color:red|Bar
19084 !! html
19085 <table>
19086 <tr>
19087 <td>Foo
19088 </td>
19089 <td>Bar
19090 </td></tr></table>
19092 !! end
19094 !! test
19095 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19096 !! options
19097 parsoid
19098 !! wikitext
19100 | title="Hello world|Foo
19101 | style="color:red|Bar
19103 !! html
19104 <table><tbody>
19105 <tr>
19106 <td title="Hello world">Foo
19107 </td><td style="color: red">Bar
19108 </td></tr></tbody></table>
19110 !! end
19112 !! test
19113 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19114 !! options
19115 parsoid
19116 !! wikitext
19117 {{}}
19118 !! html
19119 {{}}
19120 !! end
19122 !! test
19123 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19124 !! options
19125 parsoid
19126 !! wikitext
19127 }}{{
19128 !! html
19129 }}{{
19130 !! end
19132 !!test
19133 Accept empty td cell attribute
19134 !! wikitext
19136 | align="center" | foo ||  |
19138 !! html
19139 <table>
19140 <tr>
19141 <td align="center"> foo </td>
19142 <td>
19143 </td></tr></table>
19145 !!end
19147 !!test
19148 Non-empty attributes in th-cells
19149 !! wikitext
19151 ! Foo !! style="color: red" | Bar
19153 !! html
19154 <table>
19155 <tr>
19156 <th> Foo </th>
19157 <th style="color: red"> Bar
19158 </th></tr></table>
19160 !!end
19162 !!test
19163 Accept empty attributes in th-cells
19164 !! wikitext
19166 !| foo !!| bar
19168 !! html
19169 <table>
19170 <tr>
19171 <th> foo </th>
19172 <th> bar
19173 </th></tr></table>
19175 !!end
19177 !!test
19178 Empty table rows go away
19179 !! wikitext
19181 | Hello
19182 | there
19183 |- class="foo"
19186 !! html
19187 <table>
19188 <tr>
19189 <td> Hello
19190 </td>
19191 <td> there
19192 </td></tr>
19194 </table>
19196 !! end
19199 ### Parsoid-centric tests for testing RTing of inter-element separators
19200 ### Edge cases not tested by existing parser tests and specific to
19201 ### Parsoid-specific serialization strategies.
19204 !!test
19205 RT-ed inter-element separators should be valid separators
19206 !! wikitext
19208 |- [[foo]]
19210 !! html
19211 <table>
19213 </table>
19215 !!end
19217 !!test
19218 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19219 (Parsoid-only since PHP parser relies on Tidy for correct output)
19220 !!options
19221 parsoid
19222 !! wikitext
19224 |<small>foo
19229 |<small>foo<small>
19231 !! html
19232 !!end
19234 !!test
19235 Empty TD followed by TD with tpl-generated attribute
19236 !! wikitext
19240 |{{echo|style='color:red'}}|foo
19242 !! html
19243 <table>
19245 <tr>
19246 <td>
19247 </td>
19248 <td>foo
19249 </td></tr></table>
19251 !!end
19253 !!test
19254 Indented table with an empty td
19255 !! wikitext
19256  {|
19257  |-
19259  |foo
19260  |}
19261 !! html
19262 <table>
19264 <tr>
19265 <td>
19266 </td>
19267 <td>foo
19268 </td></tr></table>
19270 !!end
19272 !!test
19273 Empty TR followed by a template-generated TR
19274 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19275 !!options
19276 parsoid
19277 !! wikitext
19280 {{echo|<tr><td>foo</td></tr>}}
19282 !! html
19283 <table>
19284 <tbody>
19285 <tr></tr>
19286 <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}}]}'>
19287 <td>foo</td></tr>
19288 </tbody></table>
19289 !!end
19291 ## PHP and parsoid output differ for this, and since this is primarily
19292 ## for testing Parsoid's serializer, marking this Parsoid only
19293 !!test
19294 Empty TR followed by mixed-ws-comment line should RT correctly
19295 !!options
19296 parsoid
19297 !! wikitext
19300  <!--c-->
19302 <!--c--> <!--d-->
19304 !! html
19305 <table>
19306 <tbody>
19307 <tr></tr>
19308  <!--c-->
19309 <tr>
19310 <!--c--> </tr><!--d-->
19311 </tbody></table>
19313 !!end
19315 !!test
19316 Multi-line image caption generated by templates with/without trailing newlines
19317 !!options
19318 parsoid
19319 !! wikitext
19320 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19321 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19322 !! html
19323 <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>
19324 <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>
19326 !!end
19328 !! test
19329 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19330 !! options
19331 parsoid=html2wt
19332 !! wikitext
19333 <includeonly>foo</includeonly>
19334 new para
19336 [[./Category:Foo]]
19338 = new heading =
19339 !! html
19340 <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>
19342 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19343 !! end
19345 ## PHP emits broken html for this, and since this is primarily
19346 ## a Parsoid serializer test, marking this Parsoid only
19347 !!test
19348 Improperly nested inline or quotes tags with whitespace in between
19349 !!options
19350 parsoid
19351 !! wikitext
19352 <span> <s>x</span> </s>
19353 ''' ''x''' ''
19354 !! html
19355 <p><span> <s>x</s></span><s> </s>
19356 <b> <i>x</i></b><i> </i>
19357 </p>
19358 !!end
19360 !!test
19361 Encapsulate protected attributes from wt
19362 !!options
19363 parsoid
19364 !! wikitext
19365 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19366 !! html
19367 <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>
19368 </body>
19369 !!end
19371 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19372 ## Having nested or stray pre tags results in the attempt to add duplicates,
19373 ## causing an assertion fail. This test tries to prevent that situation.
19374 !!test
19375 Ensure ParagraphWrapper can deal with stray closing pre tags
19376 !!options
19377 parsoid=wt2html
19378 !! wikitext
19379 plain text</pre>
19380 !! html
19381 plain text
19382 !!end
19384 !!test
19385 1. Ensure fostered text content is wrapped in spans
19386 !!options
19387 parsoid=wt2html
19388 !! wikitext
19389 <table>hi</table><table>ho</table>
19390 !! html
19391 <span>hi</span>
19392 <table></table>
19393 <span>ho</span>
19394 <table></table>
19395 !!end
19397 !!test
19398 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19399 !!options
19400 parsoid=wt2html,wt2wt
19401 !! wikitext
19402 <table>
19403 <tr> || ||
19404 <td> a
19405 </table>
19406 !! html
19407 <span> || ||</span>
19408 <table>
19409 <tbody>
19410 <tr>
19411 <td> a</td></tr>
19412 </tbody></table>
19413 !!end
19415 !!test
19416 Encapsulation properly handles null DSR information from foster box
19417 !!options
19418 parsoid=wt2html,wt2wt
19419 !! wikitext
19420 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19421 !! html
19422 <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;
19423 <table>foo
19424 <tr>
19425 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19426 <table>
19427 <tbody>
19428 <tr>
19429 <td>bar</td></tr></tbody></table>
19430 !!end
19432 !!test
19433 1. Encapsulate foster-parented transclusion content
19434 !!options
19435 parsoid=wt2wt,wt2html
19436 !! wikitext
19437 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19438 !! html
19439 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19440 <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
19441 <tr>
19442 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19443 <table>
19444 <tbody>
19445 <tr>
19446 <td>bar</td></tr></tbody></table>
19447 !!end
19449 !!test
19450 2. Encapsulate foster-parented transclusion content
19451 !!options
19452 parsoid=wt2wt,wt2html
19453 !! wikitext
19454 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19455 !! html
19456 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19457 <table>
19458 <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>
19459 <tr>
19460 <td>bar</td></tr></table>&quot;]}">foo</div>
19461 <table>
19462 <tbody>
19463 <tr>
19464 <td>bar</td></tr></tbody></table>
19465 !!end
19467 !!test
19468 3. Encapsulate foster-parented transclusion content
19469 !!options
19470 parsoid=wt2wt,wt2html
19471 !! wikitext
19472 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19473 !! html
19474 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19475 <table>
19476 <div>
19477 <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>
19478 <tr>
19479 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19480 <p>foo</p></div>
19481 <table>
19482 <tbody>
19483 <tr>
19484 <td>bar</td></tr></tbody></table>
19485 !!end
19487 !!test
19488 4. Encapsulate foster-parented transclusion content
19489 !!options
19490 parsoid=wt2wt,wt2html
19491 !! wikitext
19492 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19493 !! html
19494 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19495 <table>
19496 <div>
19497 <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>
19498 <tr>
19499 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19500 <p>foo</p></div>
19501 <table>
19502 <tbody>
19503 <tr>
19504 <td>bar</td></tr></tbody></table>
19505 !!end
19507 !!test
19508 5. Encapsulate foster-parented transclusion content
19509 !!options
19510 parsoid=wt2wt,wt2html
19511 !! wikitext
19512 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
19513 !! html
19514 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19515 <table>
19516 <tr>
19517 <td>
19518 <div>
19519 <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>
19520 <table>
19521 <tbody>
19522 <tr>
19523 <td>
19524 <div>
19525 <p>foo</p></div></td></tr></tbody></table>
19526 !!end
19528 !!test
19529 6. Encapsulate foster-parented transclusion content
19530 !!options
19531 parsoid=wt2wt,wt2html
19532 !! wikitext
19533 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
19534 !! html
19535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19536 <table>
19537 <tr>
19538 <td>
19539 <div>
19540 <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>
19541 <table>
19542 <tbody>
19543 <tr>
19544 <td>
19545 <div>
19546 <p>foo</p></div></td></tr></tbody></table>
19547 <p>ok</p>
19548 !!end
19550 !!test
19551 7. Encapsulate foster-parented transclusion content
19552 !!options
19553 parsoid=wt2wt,wt2html
19554 !! wikitext
19555 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
19556 !! html
19557 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19558 <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;
19559 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
19560 <td>bar</td></table>&quot;]}">foo</p>
19561 <table>
19562 <tbody>
19563 <tr>
19564 <td>bar</td></tr></tbody></table>
19565 !!end
19567 !!test
19568 8. Encapsulate foster-parented transclusion content
19569 !!options
19570 parsoid=wt2wt,wt2html
19571 !! wikitext
19572 {{echo|a
19573 }}{|{{echo|style='color:red'}}
19577 !! html
19578 <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>
19579 <table>
19580 <tbody>
19581 <tr>
19582 <td>b</td></tr></tbody></table>
19583 !!end
19585 !!test
19586 9. Encapsulate foster-parented transclusion content
19587 !!options
19588 parsoid=wt2wt,wt2html
19589 !! wikitext
19590 <table>{{echo|hi</table>hello}}
19591 !! html
19592 <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>
19593 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
19594 !!end
19596 !!test
19597 Table in fosterable position
19598 !!options
19599 parsoid=wt2html,wt2wt
19600 !! wikitext
19601 {{OpenTable}}
19602 <div>
19605 </div>
19607 !! html
19608 <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="{}">
19609 </span>
19610 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
19612 <table>
19613 </table>
19614 !!end
19616 !!test
19617 Support <object> element with .data attribute
19618 !!options
19619 parsoid=html2wt
19620 !! wikitext
19621 <object data="test.swf"></object>
19622 !! html
19623 <object data="test.swf"></object>
19624 !!end
19626 # -----------------------------------------------------------------
19627 # The following section of tests are primarily to spec requirements
19628 # around serialization of new/edited content.
19630 # All these tests are marked Parsoid html2wt and html2html only
19631 # ----------------------------------------------------------------
19633 !! test
19634 Image: Modifying size of an image (1)
19635 !! options
19636 parsoid={
19637   "modes": ["wt2wt"],
19638   "changes": [
19639     ["img[height]", "attr", "height", "22"],
19640     ["img[width]", "attr", "width", "200"]
19641   ]
19643 !! wikitext
19644 [[Image:Foobar.jpg|230x230px]]
19645 !! wikitext/edited
19646 [[Image:Foobar.jpg|200x200px]]
19647 !!end
19649 !! test
19650 Image: Modifying size of an image (2)
19651 !! options
19652 parsoid={
19653   "modes": ["wt2wt"],
19654   "changes": [
19655     ["img[height]", "attr", "height", "100"],
19656     ["img[width]", "attr", "width", "500"]
19657   ]
19659 !! wikitext
19660 [[Image:Foobar.jpg|230x230px]]
19661 !! wikitext/edited
19662 [[Image:Foobar.jpg|500x500px]]
19663 !!end
19665 # Change in size is ignored so long as class='mw-default-size'
19666 !! test
19667 Image: Modifying size of an image (3)
19668 !! options
19669 parsoid={
19670   "modes": ["wt2wt"],
19671   "changes": [
19672     ["figure[class]", "removeClass", "mw-default-size"],
19673     ["figure img", "attr", "height", "19"],
19674     ["figure img", "attr", "width", "170"]
19675   ]
19677 !! wikitext
19678 [[Image:Foobar.jpg|thumb]]
19679 !! wikitext/edited
19680 [[Image:Foobar.jpg|thumb|170x170px]]
19681 !!end
19683 !! test
19684 Image: Modifying alignment of an image (bug 48665)
19685 !! options
19686 parsoid={
19687   "modes": ["wt2wt"],
19688   "changes": [
19689     ["figure[class]", "removeClass", "mw-halign-right"],
19690     ["figure[class]", "addClass", "mw-halign-left"]
19691   ]
19693 !! wikitext
19694 [[Image:Foobar.jpg|thumb|caption|right]]
19695 !! wikitext/edited
19696 [[Image:Foobar.jpg|thumb|caption|left]]
19697 !! end
19699 !! test
19700 Image: Modifying mw-default-size of an frameless image (bug 62805)
19701 !! options
19702 parsoid={
19703   "modes": ["wt2wt"],
19704   "changes": [
19705     ["figure.mw-default-size", "removeClass", "mw-default-size"]
19706   ]
19708 !! wikitext
19709 [[Image:Foobar.jpg|frameless|right]]
19710 !! wikitext/edited
19711 [[Image:Foobar.jpg|frameless|right|220x220px]]
19712 !! end
19714 !! test
19715 Image: Modifying valign of an image (bug 49221)
19716 !! options
19717 parsoid={
19718   "modes": ["wt2wt"],
19719   "changes": [
19720     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
19721     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
19722   ]
19724 !! wikitext
19725 [[File:Foobar.jpg|20px|middle]]
19726 !! wikitext/edited
19727 [[File:Foobar.jpg|20px|text-top]]
19728 !! end
19730 !! test
19731 Image: Modifying alt attribute of an image (bug 56400)
19732 !! options
19733 parsoid={
19734   "modes": ["wt2wt"],
19735   "changes": [
19736     ["img[alt]", "attr", "alt", "some alternate edited text"]
19737   ]
19739 !! wikitext
19740 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
19741 !! wikitext/edited
19742 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
19743 !!end
19745 !! test
19746 Image: Modifying caption of an image
19747 !! options
19748 parsoid={
19749   "modes": ["wt2wt"],
19750   "changes": [
19751     ["figcaption", "text", "new caption"]
19752   ]
19754 !! wikitext
19755 [[Image:Foobar.jpg|thumb|original caption]]
19756 !! wikitext/edited
19757 [[Image:Foobar.jpg|thumb|new caption]]
19758 !!end
19760 !! test
19761 Image: empty alt attribute (bug 48924)
19762 !! options
19763 parsoid
19764 !! wikitext
19765 [[File:Foobar.jpg|thumb|alt=|bar]]
19766 !! html
19767 <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>
19768 !! end
19770 #!! test
19771 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
19772 #!! options
19773 #parsoid=html2wt
19774 #language=ar
19775 #!! input
19776 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
19777 #!! result
19778 #<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>
19779 #!! end
19781 !! test
19782 Image: Block level image should have \n before and after
19783 !! options
19784 parsoid
19785 !! wikitext
19787 [[File:Foobar.jpg|right|thumb|150x150px]]
19789 !! html
19790 <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>
19791 !!end
19793 !! test
19794 Image: New block level image should have \n before and after (existing
19795 content)
19796 !! options
19797 parsoid
19798 !! wikitext
19800 [[File:Foobar.jpg|right|thumb|150x150px]]
19802 !! html
19803 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
19804 <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>
19805 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
19806 !!end
19808 !! test
19809 Image: upright option (parsoid)
19810 !! options
19811 parsoid
19812 !! wikitext
19813 [[File:Foobar.jpg|thumb|upright|caption]]
19814 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
19815 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
19816 !! html
19817 <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="19" width="170"/></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>
19818 !!end
19820 !! test
19821 Image: upright option is ignored on inline and frame images (parsoid)
19822 !! options
19823 parsoid
19824 !! wikitext
19825 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
19826 !! html
19827 <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>
19828 !!end
19830 !! test
19831 Image: from basic HTML (1)
19832 !! options
19833 parsoid=html2wt
19834 !! html/parsoid
19835 <span typeof="mw:Image">
19836   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
19837 </span>
19838 !! wikitext
19839 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
19840 !! end
19842 !! test
19843 Image: from basic HTML (2)
19844 !! options
19845 parsoid=html2wt
19846 !! html/parsoid
19847 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
19848 !! wikitext
19849 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
19850 !! end
19852 !! test
19853 Image: from basic HTML (3)
19854 !! options
19855 parsoid=html2wt
19856 !! html/parsoid
19857 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
19858 !! wikitext
19859 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
19860 !! end
19862 !! test
19863 Image: from basic HTML (4)
19864 !! options
19865 parsoid=html2wt
19866 !! html/parsoid
19867 <img src="File:Foobar.jpg">
19868 !! wikitext
19869 [[File:Foobar.jpg|link=]]
19870 !! end
19872 !! test
19873 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
19874 !! options
19875 parsoid=html2wt
19876 !! wikitext
19877 * foo
19878 !! html
19879 <ul>
19880 <li><p>foo</p></li>
19881 </ul>
19882 !! end
19884 !! test
19885 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
19886 !! options
19887 parsoid=html2wt
19888 !! wikitext
19889 * foo
19890 !! html
19891 <ul> <li>foo</li></ul>
19892 !! end
19894 !! test
19895 Don't strip leading whitespace when handling indent-pre suppressing tags
19896 !! options
19897 parsoid=html2wt
19898 !! wikitext
19900   | indented row
19902 <blockquote>
19903  '''This is very bold of you!'''
19907  indented cell (no pre-wrapping!)
19909 </blockquote>
19911  <div>bar</div>
19912 !! html
19913 <table>
19914   <tr><td> indented row</td></tr>
19915 </table>
19916 <blockquote><p>
19917  <b>This is very bold of you!</b>
19918 </p>
19919 <table><tr><td>
19920  indented cell (no pre-wrapping!)
19921 </td></tr></table>
19922 </blockquote>
19923 <p>foo</p>
19924  <div>bar</div>
19925 !! end
19927 !! test
19928 Strip leading whitespace when handling indent-pre inducing tags
19929 !! options
19930 parsoid=html2wt
19931 !! wikitext
19933 <span>bar</span>
19935 <span>foo2
19936 </span>bar2
19938 <div>foo</div>
19939 <span>bar</span>
19941 <div>
19942 <span>foo</span>
19943 </div>
19944 !! html
19945 <p>foo</p>
19946  <span>bar</span>
19948 <span>foo2
19949  </span>bar2
19951 <div>foo</div>
19952  <span>bar</span>
19954 <div>
19955  <span>foo</span>
19956 </div>
19957 !! end
19959 !! test
19960 Lists: Add space after bullets
19961 !! options
19962 parsoid=html2wt
19963 !! wikitext
19964 * foo
19965 * bar
19966 * <span> baz</span>
19967 !! html
19968 <ul>
19969 <li>foo</li>
19970 <li> bar</li>
19971 <li><span> baz</span></li>
19972 </ul>
19973 !! end
19975 !! test
19976 Lists: Dont insert newlines in a serialized list item.
19977 !! options
19978 parsoid=html2wt
19979 !! wikitext
19980 * a<br>b
19981 * c
19982 !! html
19983 <ul><li>a<br>b</li><li>c</li></ul>
19984 !! end
19986 !! test
19987 Headings: Add space before/after == (Bug 51744)
19988 !! options
19989 parsoid=html2wt
19990 !! wikitext
19991 == foo ==
19993 == bar ==
19995 == baz ==
19997 == <span> baz</span> ==
19998 !! html
19999 <h2>foo</h2>
20000 <h2> bar</h2>
20001 <h2>baz </h2>
20002 <h2><span> baz</span></h2>
20003 !! end
20005 !! test
20006 Parsoid: Serialize positional parameters with = in them as named parameter
20007 !! options
20008 parsoid=html2wt
20009 !! wikitext
20010 {{echo|1 = f=oo}}
20012 {{echo|1 = f=oo|2 = bar}}
20014 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20015 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20016 {{echo|<nowiki>f=oo</nowiki>|bar}}
20017 !! html
20018 <p about="#mwt1" typeof="mw:Transclusion"
20019 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20021 <p about="#mwt1" typeof="mw:Transclusion"
20022 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20024 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20025 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20026 <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>
20027 !! end
20029 !! test
20030 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20031 !! options
20032 parsoid=html2wt
20033 !! wikitext
20034 <div>a
20036 </div>
20037 <div>a
20039 </div>
20040 <div>
20044 </div>
20045 !! html
20046 <div>a<p>b</p></div>
20047 <div>a
20048 <p>b</p></div>
20049 <div>
20051 <p>b</p></div>
20052 !! end
20054 !! test
20055 Substrings resembling wikitext in hrefs should not get nowiki escapes
20056 !! options
20057 parsoid=html2wt
20058 !! wikitext
20059 [[Foo''bar''baz]]
20060 !! html
20061 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20062 !! end
20064 #-----------------------------
20065 # I/B quote minimization tests
20066 #-----------------------------
20068 !! test
20069 1. I/B quote minimization: wikitext-only tags should be combined
20070 !! options
20071 parsoid=html2wt
20072 !! wikitext
20073 ''AB''
20075 '''AB'''
20077 ''A'''B'''''
20079 '''A''B'''''
20081 '''A''BC''D'''
20083 '''''AB'''''
20085 '''''AB'''''
20087 '''''AB'''''
20088 !! html
20089 <p><i>A</i><i>B</i></p>
20090 <p><b>A</b><b>B</b></p>
20091 <p><i>A</i><b><i>B</i></b></p>
20092 <p><b>A</b><i><b>B</b></i></p>
20093 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20094 <p><i><b>A</b></i><i><b>B</b></i></p>
20095 <p><i><b>A</b></i><b><i>B</i></b></p>
20096 <p><b><i>A</i></b><i><b>B</b></i></p>
20097 !! end
20099 !! test
20100 2. I/B quote minimization: wikitext and html tags should not be combined
20101 !! options
20102 parsoid=html2wt
20103 !! wikitext
20104 ''A''<i>B</i>
20106 ''A'''''<i>B</i>'''
20107 !! html
20108 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20109 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20110 !! end
20112 !! test
20113 3. I/B quote minimization: templated content stops minimization
20114 !! options
20115 parsoid=html2wt
20116 !! wikitext
20117 ''A''{{echo|''B''}}
20119 ''A''{{echo|'''''B'''''}}
20120 !! html
20121 <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>
20122 <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>
20123 !! end
20125 !! test
20126 4. I/B quote minimization: new content should be mimimized with adjacent old content
20127 !! options
20128 parsoid=html2wt
20129 !! wikitext
20130 ''AB''
20132 '''AB'''
20134 ''A'''B'''''
20135 !! html
20136 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20137 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20138 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20139 !! end
20141 #------------------------------------
20142 # End of I/B quote minimization tests
20143 #------------------------------------
20145 !!test
20146 Bug 54262: New entities
20147 !! options
20148 parsoid=html2wt
20149 !! wikitext
20150 &nbsp;
20151 !! html
20152 <span typeof="mw:Entity">&nbsp;</span>
20153 !! end
20155 ## Note that there is no wikitext output for 'unknownproperty' ##
20156 ## Unknown magic words are silently dropped ##
20158 !! test
20159 Magic words
20160 !! options
20161 parsoid=html2wt
20162 !! wikitext
20163 __TOC__
20164 __NOTOC__
20165 __FORCETOC__
20166 __INDEX__
20167 __NOINDEX__
20168 __NOGALLERY__
20169 __NOEDITSECTION__
20170 __NOTITLECONVERT__
20171 __NOCONTENTCONVERT__
20172 !! html
20173 <meta property='mw:PageProp/toc' />
20174 <meta property='mw:PageProp/notoc' />
20175 <meta property='mw:PageProp/forcetoc' />
20176 <meta property='mw:PageProp/index' />
20177 <meta property='mw:PageProp/noindex' />
20178 <meta property='mw:PageProp/nogallery' />
20179 <meta property='mw:PageProp/noeditsection' />
20180 <meta property='mw:PageProp/notitleconvert' />
20181 <meta property='mw:PageProp/nocontentconvert' />
20182 <meta property='mw:PageProp/unknownproperty' />
20183 !! end
20185 !! test
20186 Consecutive <pre>s should not get merged
20187 !! options
20188 parsoid=html2wt,html2html
20189 !! wikitext
20203 !! html
20204 <pre>a</pre><pre>b</pre>
20206 <pre>c
20207 </pre><pre>
20208 d</pre>
20210 <pre>e
20212 </pre><pre>
20214 f</pre>
20215 !! end
20217 !! test
20218 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20219 !! options
20220 parsoid=html2wt
20221 !! wikitext
20222 [[Special:BookSources/1234567890|ISBN 1234567895]]
20223 !! html
20224 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20225 !! end
20227 !! test
20228 Edited RFC links not serializable as RFC links should serialize as extlinks
20229 !! options
20230 parsoid=html2wt
20231 !! wikitext
20232 [//tools.ietf.org/html/rfc123 New RFC]
20233 !! html
20234 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20235 !! end
20237 !! test
20238 Edited PMID links not serializable as PMID links should serialize as extlinks
20239 !! options
20240 parsoid=html2wt
20241 !! wikitext
20242 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20243 !! html
20244 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20245 !! end
20247 !! test
20248 Edited Redirect link should emit a non-piped wikitext link
20249 !! options
20250 parsoid=html2wt
20251 !! wikitext
20252 #REDIRECT [[Bar]]
20253 !! html
20254 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20255 !! end
20257 # -----------------------------------------------------------------
20258 # End of section for Parsoid-only html2wt tests for serialization
20259 # of new content
20260 # -----------------------------------------------------------------
20262 TODO:
20263 more images
20264 more tables
20265 character entities
20266 and much more
20267 Try for 100% code coverage