Merge "Rename Parser_DiffTest class to ParserDiffTest"
[mediawiki.git] / tests / parser / parserTests.txt
blobc447a44c53aa05df6fd4a144695e15d3743cbc5f
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 <President></President>
1963 !! html
1964 <p>Barack Obama &lt;President&gt; of the United States
1965 &lt;President&gt;&lt;/President&gt;
1966 </p>
1967 !! end
1969 ## PHP parser discards the "<pre " string
1970 !! test
1971 Handle broken pre-like tags (bug 64025)
1972 !! options
1973 parsoid=wt2html
1974 !! wikitext
1975 {{echo|<pre <pre>x</pre>}}
1977 <table><pre </table>
1978 !! html/php
1979 <pre>x</pre>
1980 <table><pre></pre></table>
1982 !! html/parsoid
1983 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>&lt;pre </span>
1984 <pre>x</pre>
1986 <span>&lt;pre </span>
1987 <table></table>
1988 !! end
1990 !! test
1991 Parsoid: handle pre with space after attribute
1992 !! options
1993 parsoid=wt2html
1994 !! wikitext
1995 <pre style="width:50%;" >{{echo|foo}}</pre>
1996 !! html
1997 <pre style="width:50%;">{{echo|foo}}</pre>
1998 !! end
2000 # TODO / maybe: fix wt2wt for this
2001 !! test
2002 Parsoid: Don't paragraph-wrap fosterable content
2003 !! options
2004 parsoid=wt2html
2005 !! wikitext
2007 <td></td>
2008 <td></td>
2013 !! html
2014 <table>
2016 <tbody>
2017 <tr>
2018 <td></td>
2020 <td></td></tr>
2024 </tbody></table>
2025 !! end
2027 !! test
2028 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2033 <td>
2034 <td>
2035 </td>
2040 !! html
2041 <table>
2043 <tbody>
2044 <tr>
2045 <td></td>
2047 <td>
2048 </td></tr>
2052 </tbody></table>
2053 !! end
2056 #--------------------------------------------------------------------
2057 # Transclusion parameter whitespace stripping tests
2058 # Behavior is different for positional and named parameters
2059 #--------------------------------------------------------------------
2060 !! test
2061 Templates: Strip leading and trailing whitespace from named-param values
2062 !! wikitext
2063 {{echo|1= a }}
2065 {{echo|1= {{echo|b}} }}
2067 {{echo| 1 =
2068  c }}
2070 {{echo| 1 =
2071 * d
2073 !! html
2074 <p>a
2075 </p><p>b
2076 </p><p>c
2077 </p>
2078 <ul><li> d</li></ul>
2080 !! end
2082 !! test
2083 Templates: Don't strip whitespace from positional-param values
2084 !! wikitext
2085 {{echo|a }}
2087 {{echo|{{echo|b}} }}
2089 {{echo| c 
2092 {{echo| {{echo|d}}
2095 {{echo|
2096  e}}
2098 {{echo|
2099 * f}}
2101 {{echo|
2102  }}g
2103 !! html
2104 <p>a 
2105 </p><p>b 
2106 </p>
2107 <pre>c 
2108 </pre>
2109 <p><br />
2110 </p>
2111 <pre>d
2112 </pre>
2113 <p><br />
2114 </p>
2115 <pre>e
2116 </pre>
2117 <p><br />
2118 </p>
2119 <ul><li> f</li></ul>
2120 <p><br />
2121 </p>
2122 <pre>g
2123 </pre>
2124 !! end
2126 !! test
2127 Templates: Handle empty comment-and-ws-only lines correctly
2128 !! wikitext
2129 {{echo|foo
2130 <!--should be ignored-->
2131  <!--should be ignored as well-->
2132 bar}}
2133 !! html
2134 <p>foo
2136 </p>
2137 !! end
2139 !! test
2140 Templates: Handle comments in the target
2141 !! wikitext
2142 {{echo
2143 <!-- should be ignored -->
2144 |foo}}
2146 {{echo<!-- should be ignored -->
2147 |foo}}
2149 {{echo<!-- should be ignored -->|foo}}
2151 {{<!-- should be ignored -->echo|foo}}
2152 !!html/parsoid
2153 <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>
2155 <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>
2157 <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>
2159 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2160 !!end
2162 #--------------------------------------------------------------------
2163 # Transclusion parameter escaping tests
2164 #--------------------------------------------------------------------
2165 !! test
2166 Templates: Parsoid parameter escaping test 1
2167 !! options
2168 parsoid
2169 !! wikitext
2170 {{echo|[foo]|{{echo|[bar]}}}}
2171 !! html
2172 <p about="#mwt1" typeof="mw:Transclusion"
2173 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2174 !! end
2176 !! test
2177 Parsoid: Pipes in external links in template parameter
2178 !! options
2179 parsoid
2180 !! wikitext
2181 {{echo|[{{echo|http://example.com}} link]}}
2182 !! html
2183 <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>
2184 !! end
2186 !! test
2187 Parsoid: pipe in transclusion parameter
2188 !! options
2189 parsoid
2190 !! wikitext
2191 {{echo|http://foo.com/a&#124;b}}
2192 !! html
2193 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2194 typeof="mw:Transclusion"
2195 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>
2196 !! end
2198 !! test
2199 Parsoid: Pipe in external link target and content in template parameter
2200 !! options
2201 parsoid=html2wt,wt2wt
2202 !! wikitext
2203 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2204 !! html
2205 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2206 typeof="mw:Transclusion"
2207 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2208 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2209 !! end
2211 !! test
2212 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2213 !! options
2214 parsoid
2215 !! wikitext
2216 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2217 !! html
2218 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2219 !! end
2221 !! test
2222 Templates: Don't escape already nowiki-escaped text in template parameters
2223 !! options
2224 parsoid=html2wt,wt2wt
2225 !! wikitext
2226 {{echo|foo<nowiki>|</nowiki>bar}}
2227 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2228 {{echo|<nowiki></nowiki>}}
2229 !! html
2230 <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>
2231 <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>
2232 <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>
2233 </p>
2234 !! end
2236 ## Bug 52824
2237 !! test
2238 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2239 !! options
2240 parsoid=html2wt,wt2wt
2241 !! wikitext
2242 {{echo|{{echo|1=bar}}}}
2243 !! html
2244 <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>
2245 !! end
2247 ## Bug 56733
2248 !! test
2249 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2250 !! options
2251 parsoid
2252 !! wikitext
2253 {{echo|a : b}}
2254 !! html
2255 <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>
2256 !! end
2259 ### Parsoid-centric tests for testing RT edge cases for pre
2262 !!test
2263 1a. Indent-Pre and Comments
2264 !! wikitext
2266 <!--a-->
2268 !! html
2269 <pre>a
2270 </pre>
2271 <p>c
2272 </p>
2273 !!end
2275 !!test
2276 1b. Indent-Pre and Comments
2277 !! wikitext
2279  <!--a-->
2281 !! html
2282 <pre>a
2283 </pre>
2284 <p>c
2285 </p>
2286 !!end
2288 !!test
2289 1c. Indent-Pre and Comments
2290 !! wikitext
2291 <!--a-->  a
2293  <!--a--> a
2294 !! html
2295 <pre> a
2296 </pre>
2297 <pre> a
2298 </pre>
2299 !!end
2301 !!test
2302 1d. Indent-Pre and Comments
2303 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2304 !! wikitext
2305 <!--a--> a
2307  <!--b-->b
2308 !! html
2309 <pre>a
2310 </pre>
2311 <pre>b
2312 </pre>
2313 !!end
2315 !!test
2316 2a. Indent-Pre and tables
2317 !! wikitext
2318  {|
2319  |-
2320  !h1!!h2
2321  |foo||bar
2322  |}
2323 !! html
2324 <table>
2326 <tr>
2327 <th>h1</th>
2328 <th>h2
2329 </th>
2330 <td>foo</td>
2331 <td>bar
2332 </td></tr></table>
2334 !!end
2336 !!test
2337 2b. Indent-Pre and tables
2338 !! wikitext
2339   {|
2340  |-
2341 |foo
2343 !! html
2344 <table>
2346 <tr>
2347 <td>foo
2348 </td></tr></table>
2350 !!end
2352 !!test
2353 2c. Indent-Pre and tables (bug 42252)
2354 !! wikitext
2356  |+ foo
2357  !  | bar
2359 !! html
2360 <table>
2361 <caption> foo
2362 </caption>
2363 <tr>
2364 <th> bar
2365 </th></tr></table>
2367 !!end
2369 !!test
2370 2d. Indent-Pre and tables
2371 !! wikitext
2373  {|
2374  | b
2375  |}
2376 !! html/php
2377 <pre>a
2378 </pre>
2379 <table>
2380 <tr>
2381 <td> b
2382 </td></tr></table>
2384 !! html/parsoid
2385 <pre>a</pre>
2387 <table>
2389 <tbody>
2390 <tr>
2391 <td> b</td></tr>
2392  </tbody></table>
2393 !!end
2395 !!test
2396 2e. Indent-Pre and table-line syntax
2397 !! wikitext
2399  | b
2400  | c
2401 !! html/parsoid
2402 <pre>a
2403 | b
2404 | c</pre>
2405 !!end
2407 !!test
2408 2f. Indent-pre started by table-line syntax
2409 !! wikitext
2411  | b
2412  | c
2413 !! html/parsoid
2414 <p>a</p>
2415 <pre>
2416 | b
2417 | c</pre>
2418 !!end
2420 !!test
2421 3a. Indent-Pre and block tags (single-line html)
2422 !! wikitext
2423  a <p> foo </p>
2424  b <div> foo </div>
2425  c <blockquote> foo </blockquote>
2426  <span> foo </span>
2427 !! html
2428  a <p> foo </p>
2429  b <div> foo </div>
2430  c <blockquote> foo </blockquote>
2431 <pre><span> foo </span>
2432 </pre>
2433 !!end
2435 !!test
2436 3b. Indent-Pre and block tags (multi-line html)
2437 !! wikitext
2438  a <span>foo</span>
2439  b <div> foo </div>
2440 !! html
2441 <pre>a <span>foo</span>
2442 </pre>
2443  b <div> foo </div>
2445 !!end
2447 !!test
2448 3c. Indent-Pre and block tags (pre-content on separate line)
2449 !! wikitext
2451  foo
2452 </p>
2454 <div>
2455  foo
2456 </div>
2458 <center>
2459  foo
2460 </center>
2462 <blockquote>
2463  foo
2464 </blockquote>
2466 <blockquote>
2467 <pre>
2469 </pre>
2470 </blockquote>
2472 <table><tr><td>
2473  foo
2474 </td></tr></table>
2476 <ul><li>
2477   foo
2478 </li></ul>
2480 !! html
2482  foo
2483 </p>
2484 <div>
2485 <pre>foo
2486 </pre>
2487 </div>
2488 <center>
2489 <pre>foo
2490 </pre>
2491 </center>
2492 <blockquote>
2493 <p> foo
2494 </p>
2495 </blockquote>
2496 <blockquote>
2497 <pre>
2499 </pre>
2500 </blockquote>
2501 <table><tr><td>
2502 <pre>foo
2503 </pre>
2504 </td></tr></table>
2505 <ul><li>
2506   foo
2507 </li></ul>
2509 !!end
2511 !!test
2512 4. Indent-Pre and extension tags
2513 !! wikitext
2514  a <gallery>
2515 File:foobar.jpg
2516 </gallery>
2517 !! html
2518  a <ul class="gallery mw-gallery-traditional">
2519                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2520                         <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>
2521                         <div class="gallerytext">
2522                         </div>
2523                 </div></li>
2524 </ul>
2526 !!end
2528 !! test
2529 Leading pipes outside of tables
2530 !! options
2531 parsoid
2532 !! wikitext
2533 | foo
2534 !! html
2535 <p>| foo</p>
2536 !! end
2538 !! test
2539 Leading pipes outside of tables 2
2540 !! options
2541 parsoid
2542 !! wikitext
2544 | foo
2546 !! html
2547 <p>a
2548 | foo
2549 b</p>
2550 !! end
2552 !! test
2553 Leading pipes outside of tables 3
2554 !! options
2555 parsoid
2556 !! wikitext
2558 | class="foo bar" | baz
2560 !! html
2561 <p>a
2562 | class="foo bar" | baz
2563 b</p>
2564 !! end
2566 !!test
2567 Render paragraphs when indent-pre is suppressed in blocklevels
2568 !! wikitext
2569 <blockquote>
2570  foo
2572  bar
2573 </blockquote>
2574 !! html
2575 <blockquote>
2576 <p> foo
2577 </p><p> bar
2578 </p>
2579 </blockquote>
2581 !!end
2583 !!test
2584 4. Multiple spaces at start-of-line
2585 !! wikitext
2586     <p> foo </p>
2587     foo
2588         {|
2589 |foo
2591 !! html
2592     <p> foo </p>
2593 <pre>   foo
2594 </pre>
2595 <table>
2596 <tr>
2597 <td>foo
2598 </td></tr></table>
2600 !!end
2602 ## NOTE: the leading white-space chars on empty line are significant
2603 !! test
2604 5a. White-space in indent-pre
2605 !! wikitext
2606  a<br />
2609 !! html
2610 <pre>a<br />
2613 </pre>
2614 !! end
2616 ## NOTE: the leading white-space chars on empty line are significant
2617 !! test
2618 5b. White-space in indent-pre
2619 !! wikitext
2626 !! html
2627 <pre>a
2633 </pre>
2634 !! end
2636 !! test
2637 5c. White-space in indent-pre
2638 !! wikitext
2639  ''a''
2640   ''b''
2641    ''c''
2642 !! html
2643 <pre><i>a</i>
2644  <i>b</i>
2645   <i>c</i>
2646 </pre>
2647 !! end
2649 !! test
2650 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2651 !! wikitext
2654  <!-- continue -->
2660 !! html
2661 <pre>a
2664 </pre>
2665 <pre>c
2667 </pre>
2668 <p>d
2669 </p>
2670 !! end
2672 !! test
2673 7a. Indent-pre and category links
2674 !! options
2675 parsoid=wt2html,wt2wt
2676 !! wikitext
2677  [[Category:foo]] <!-- No pre-wrapping -->
2678 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2679 !! html
2680  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2681 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2682 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2683 !! end
2685 !! test
2686 7b. Indent-pre and category links
2687 !! options
2688 parsoid=wt2html,wt2wt
2689 !! wikitext
2690  [[Category:foo]] a
2691  [[Category:foo]] {{echo|b}}
2692 !! html
2693 <pre>
2694 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2696 <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>
2697 !! end
2700 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2703 !!test
2704 HTML-pre: 1. embedded newlines
2705 !! wikitext
2706 <pre>foo</pre>
2708 <pre>
2710 </pre>
2712 <pre>
2715 </pre>
2717 <pre>
2721 </pre>
2722 !! html
2723 <pre>foo</pre>
2724 <pre>
2726 </pre>
2727 <pre>
2730 </pre>
2731 <pre>
2735 </pre>
2737 !! html/parsoid
2738 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2740 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2742 </pre>
2744 <pre data-parsoid='{"stx":"html"}'>
2747 </pre>
2749 <pre data-parsoid='{"stx":"html"}'>
2753 </pre>
2754 !!end
2756 !! test
2757 HTML-pre: big spaces
2758 !! wikitext
2759 <pre>
2764 haha
2769 haha
2774 </pre>
2775 !! html
2776 <pre>
2781 haha
2786 haha
2791 </pre>
2793 !! html/parsoid
2794 <pre data-parsoid='{"stx":"html"}'>
2799 haha
2804 haha
2809 </pre>
2810 !! end
2812 !!test
2813 HTML-pre: 2: indented text
2814 !! wikitext
2815 <pre>
2816  foo
2817 </pre>
2818 !! html
2819 <pre>
2820  foo
2821 </pre>
2823 !!end
2825 !!test
2826 HTML-pre: 3: other wikitext
2827 !! wikitext
2828 <pre>
2829 * foo
2830 # bar
2831 = no-h =
2832 '' no-italic ''
2833 [[ NoLink ]]
2834 </pre>
2835 !! html
2836 <pre>
2837 * foo
2838 # bar
2839 = no-h =
2840 '' no-italic ''
2841 [[ NoLink ]]
2842 </pre>
2844 !!end
2847 ### Definition lists
2849 !! test
2850 Simple definition
2851 !! wikitext
2852 ; name : Definition
2853 !! html
2854 <dl><dt> name&#160;</dt>
2855 <dd> Definition</dd></dl>
2857 !! end
2859 !! test
2860 Definition list for indentation only
2861 !! wikitext
2862 : Indented text
2863 !! html
2864 <dl><dd> Indented text</dd></dl>
2866 !! end
2868 !! test
2869 Definition list with no space
2870 !! wikitext
2871 ;name:Definition
2872 !! html
2873 <dl><dt>name</dt>
2874 <dd>Definition</dd></dl>
2876 !!end
2878 !! test
2879 Definition list with URL link
2880 !! wikitext
2881 ; http://example.com/ : definition
2882 !! html
2883 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2884 <dd> definition</dd></dl>
2886 !! end
2888 !! test
2889 Definition list with bracketed URL link
2890 !! wikitext
2891 ;[http://www.example.com/ Example]:Something about it
2892 !! html
2893 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2894 <dd>Something about it</dd></dl>
2896 !! end
2898 !! test
2899 Definition list with wikilink containing colon
2900 !! wikitext
2901 ; [[Help:FAQ]]: The least-read page on Wikipedia
2902 !! html
2903 <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>
2904 <dd> The least-read page on Wikipedia</dd></dl>
2906 !! end
2908 # At Brion's and JeLuF's insistence... :)
2909 !! test
2910 Definition list with news link containing colon
2911 !! wikitext
2912 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
2913 !! html
2914 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2915 <dd> This isn't even a real newsgroup!</dd></dl>
2917 !! end
2919 !! test
2920 Malformed definition list with colon
2921 !! wikitext
2922 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2923 !! html
2924 <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>
2926 !! end
2928 !! test
2929 Definition lists: colon in external link text
2930 !! wikitext
2931 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2932 !! html
2933 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
2934 <dd> OK, I made that up</dd></dl>
2936 !! end
2938 !! test
2939 Definition lists: colon in HTML attribute
2940 !! wikitext
2941 ;<b style="display: inline">bold</b>
2942 !! html
2943 <dl><dt><b style="display: inline">bold</b></dt></dl>
2945 !! end
2947 !! test
2948 Definition lists: self-closed tag
2949 !! wikitext
2950 ;one<br/>two : two-line fun
2951 !! html
2952 <dl><dt>one<br />two&#160;</dt>
2953 <dd> two-line fun</dd></dl>
2955 !! end
2957 !! test
2958 Bug 11748: Literal closing tags
2959 !! wikitext
2960 <dl>
2961 <dt>test 1</dt>
2962 <dd>test test test test test</dd>
2963 <dt>test 2</dt>
2964 <dd>test test test test test</dd>
2965 </dl>
2966 !! html
2967 <dl>
2968 <dt>test 1</dt>
2969 <dd>test test test test test</dd>
2970 <dt>test 2</dt>
2971 <dd>test test test test test</dd>
2972 </dl>
2974 !! end
2976 !! test
2977 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2978 !! wikitext
2979 <ul><li>
2980 ; term : description
2981 * unordered
2982 </li></ul>
2983 !! html
2984 <ul><li>
2985 <dl><dt> term&#160;</dt>
2986 <dd> description</dd></dl>
2987 <ul><li> unordered</li></ul>
2988 </li></ul>
2990 !! end
2992 !! test
2994 Definition list with empty definition and following paragraph
2995 !! wikitext
2996 ; term:
2997 Paragraph text
2998 !! html
2999 <dl><dt> term</dt>
3000 <dd></dd></dl>
3001 <p>Paragraph text
3002 </p>
3003 !! end
3005 !! test
3006 Nested definition lists using html syntax
3007 !! wikitext
3008 <dl><dt>x</dt>
3009 <dd>a</dd>
3010 <dd>b</dd></dl>
3012 !! end
3014 !! test
3015 Definition Lists: No nesting: Multiple dd's
3016 !! wikitext
3020 !! html
3021 <dl><dt>x</dt>
3022 <dd>a</dd>
3023 <dd>b</dd></dl>
3025 !! end
3027 !! test
3028 Definition Lists: Indentation: Regular
3029 !! wikitext
3031 ::i2
3032 :::i3
3033 !! html
3034 <dl><dd>i1
3035 <dl><dd>i2
3036 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3038 !! end
3040 !! test
3041 Definition Lists: Indentation: Missing 1st level
3042 !! wikitext
3043 ::i2
3044 :::i3
3045 !! html
3046 <dl><dd><dl><dd>i2
3047 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3049 !! end
3051 !! test
3052 Definition Lists: Indentation: Multi-level indent
3053 !! wikitext
3054 :::i3
3055 !! html
3056 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3058 !! end
3060 !! test
3061 Definition Lists: Hacky use to indent tables
3062 !! wikitext
3063 ::{|
3064 |foo
3065 |bar
3067 this text
3068 should be left alone
3069 !! html
3070 <dl><dd><dl><dd><table>
3071 <tr>
3072 <td>foo
3073 </td>
3074 <td>bar
3075 </td></tr></table></dd></dl></dd></dl>
3076 <p>this text
3077 should be left alone
3078 </p>
3079 !! end
3081 !! test
3082 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3083 !! wikitext
3084 <!-- foo -->
3085 ::{|
3086 |foo
3087 |bar
3088 |}<!-- bar -->
3089 this text
3090 should be left alone
3091 !! html/parsoid
3092 <!-- foo -->
3093 <dl><dd><dl><dd><table><tr>
3094 <td>foo</td>
3095 <td>bar</td>
3096 </tr></table><!-- bar --></dd></dl></dd></dl>
3097 <p>this text
3098 should be left alone</p>
3099 !! end
3101 !! test
3102 Definition Lists: Hacky use to indent tables, with comment before table
3103 !! wikitext
3104 ::<!-- foo -->{|
3105 |foo
3107 !! html/parsoid
3108 <dl><dd><dl><dd><!-- foo --><table><tr>
3109 <td>foo</td>
3110 </tr></table></dd></dl></dd></dl>
3111 !! end
3113 # Bug 52473
3114 !! test
3115 Definition Lists: Hacky use to indent tables (WS-insensitive)
3116 !! options
3117 parsoid
3118 !! wikitext
3119 : {|
3121 |} 
3122 !! html
3123 <dl>
3124 <dd> <table><tr><td>a</td></tr></table> </dd>
3125 </dl>
3126 !! end
3127 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3128 ## as an empty dt item.  It also ignores all but the last ";" when followed
3129 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3130 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3131 ## ";"s.
3133 ## Ex: ";;t2 ::d2" is transformed into:
3135 ## <dl>
3136 ##   <dt>t2 </dt>
3137 ##   <dd>
3138 ##     <dl>
3139 ##       <dt></dt>
3140 ##       <dd>d2</dd>
3141 ##     </dl>
3142 ##   </dd>
3143 ## </dl>
3145 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3146 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3148 ## <dl>
3149 ##   <dt>
3150 ##     <dl>
3151 ##       <dt>t2 </dt>
3152 ##       <dd>:d2</dd>
3153 ##     </dl>
3154 ##    </dt>
3155 ## </dl>
3157 ## All Parsoid only definition list tests have this difference.
3159 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3160 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3162 !! test
3163 Table / list interaction: indented table with lists in table contents
3164 !! wikitext
3167 | a
3168 * b
3170 | c
3171 * d
3173 !! html
3174 <dl><dd><table>
3176 <tr>
3177 <td> a
3178 <ul><li> b</li></ul>
3179 </td></tr>
3180 <tr>
3181 <td> c
3182 <ul><li> d</li></ul>
3183 </td></tr></table></dd></dl>
3185 !! end
3187 !!test
3188 Table / list interaction: lists nested in tables nested in indented lists
3189 !! wikitext
3201 !! html
3202 <dl><dd><table>
3203 <tr>
3204 <td>
3205 <dl><dd>a</dd>
3206 <dd>b</dd></dl>
3207 </td>
3208 <td>
3209 <ul><li>c</li>
3210 <li>d</li></ul>
3211 </td></tr></table></dd></dl>
3212 <ul><li>e</li>
3213 <li>f</li></ul>
3215 !!end
3217 !! test
3218 Definition Lists: Nesting: Multi-level (Parsoid only)
3219 !! options
3220 parsoid
3221 !! wikitext
3222 ;t1 :d1
3223 ;;t2 ::d2
3224 ;;;t3 :::d3
3225 !! html
3226 <dl>
3227   <dt>t1 </dt>
3228   <dd>d1</dd>
3229   <dt>
3230     <dl>
3231       <dt>t2 </dt>
3232       <dd>:d2</dd>
3233       <dt>
3234         <dl>
3235           <dt>t3 </dt>
3236           <dd>::d3</dd>
3237         </dl>
3238       </dt>
3239     </dl>
3240   </dt>
3241 </dl>
3244 !! end
3247 !! test
3248 Definition Lists: Nesting: Test 2 (Parsoid only)
3249 !! options
3250 parsoid
3251 !! wikitext
3253 ::d2
3254 !! html
3255 <dl>
3256   <dt>t1</dt>
3257   <dd>
3258     <dl>
3259       <dd>d2</dd>
3260     </dl>
3261   </dd>
3262 </dl>
3264 !! end
3267 !! test
3268 Definition Lists: Nesting: Test 3 (Parsoid only)
3269 !! options
3270 parsoid
3271 !! wikitext
3272 :;t1
3273 ::::d2
3274 !! html
3275 <dl>
3276   <dd>
3277     <dl>
3278       <dt>t1</dt>
3279       <dd>
3280         <dl>
3281           <dd>
3282             <dl>
3283               <dd>d2</dd>
3284             </dl>
3285           </dd>
3286         </dl>
3287       </dd>
3288     </dl>
3289   </dd>
3290 </dl>
3292 !! end
3295 !! test
3296 Definition Lists: Nesting: Test 4
3297 !! wikitext
3298 ::;t3
3299 :::d3
3300 !! html
3301 <dl><dd><dl><dd><dl><dt>t3</dt>
3302 <dd>d3</dd></dl></dd></dl></dd></dl>
3304 !! end
3307 ## The Parsoid team believes the following three test exposes a
3308 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
3309 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3310 !! test
3311 Definition Lists: Mixed Lists: Test 1
3312 !! wikitext
3313 :;* foo
3314 ::* bar
3315 :; baz
3316 !! html/php
3317 <dl><dd><dl><dt><ul><li> foo</li>
3318 <li> bar</li></ul></dt></dl>
3319 <dl><dt> baz</dt></dl></dd></dl>
3321 !! html/parsoid
3322 <dl>
3323 <dd><dl>
3324 <dt><ul>
3325 <li> foo
3326 </li>
3327 </ul></dt>
3328 <dd><ul>
3329 <li> bar
3330 </li>
3331 </ul></dd>
3332 <dt> baz</dt>
3333 </dl></dd>
3334 </dl>
3335 !! end
3337 !! test
3338 Definition Lists: Mixed Lists: Test 2
3339 !! wikitext
3340 *: d1
3341 *: d2
3342 !! html
3343 <ul><li><dl><dd> d1</dd>
3344 <dd> d2</dd></dl></li></ul>
3346 !! end
3349 !! test
3350 Definition Lists: Mixed Lists: Test 3
3351 !! wikitext
3352 *::: d1
3353 *::: d2
3354 !! html
3355 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3356 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3358 !! end
3361 !! test
3362 Definition Lists: Mixed Lists: Test 4
3363 !! wikitext
3364 *;d1 :d2
3365 *;d3 :d4
3366 !! html
3367 <ul><li><dl><dt>d1&#160;</dt>
3368 <dd>d2</dd>
3369 <dt>d3&#160;</dt>
3370 <dd>d4</dd></dl></li></ul>
3372 !! end
3375 !! test
3376 Definition Lists: Mixed Lists: Test 5
3377 !! wikitext
3378 *:d1
3379 *:: d2
3380 !! html
3381 <ul><li><dl><dd>d1
3382 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3384 !! end
3387 !! test
3388 Definition Lists: Mixed Lists: Test 6
3389 !! wikitext
3390 #*:d1
3391 #*::: d3
3392 !! html
3393 <ol><li><ul><li><dl><dd>d1
3394 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3396 !! end
3399 !! test
3400 Definition Lists: Mixed Lists: Test 7
3401 !! wikitext
3402 :* d1
3403 :* d2
3404 !! html
3405 <dl><dd><ul><li> d1</li>
3406 <li> d2</li></ul></dd></dl>
3408 !! end
3411 !! test
3412 Definition Lists: Mixed Lists: Test 8
3413 !! wikitext
3414 :* d1
3415 ::* d2
3416 !! html
3417 <dl><dd><ul><li> d1</li></ul>
3418 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3420 !! end
3423 !! test
3424 Definition Lists: Mixed Lists: Test 9
3425 !! wikitext
3426 *;foo :bar
3427 !! html
3428 <ul><li><dl><dt>foo&#160;</dt>
3429 <dd>bar</dd></dl></li></ul>
3431 !! end
3434 !! test
3435 Definition Lists: Mixed Lists: Test 10
3436 !! wikitext
3437 *#;foo :bar
3438 !! html
3439 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3440 <dd>bar</dd></dl></li></ol></li></ul>
3442 !! end
3444 # The Parsoid team disagrees with the PHP parser's seemingly-random
3445 # rules regarding dd/dt on the next two tests.  Parsoid is more
3446 # consistent, and recognizes the shared nesting and keeps the
3447 # still-open tags around until the nesting is complete.
3449 !! test
3450 Definition Lists: Mixed Lists: Test 11
3451 !! wikitext
3452 *#*#;*;;foo :bar
3453 *#*#;boo :baz
3454 !! html/php
3455 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3456 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3457 <dl><dt>boo&#160;</dt>
3458 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3460 !! html/parsoid
3461 <ul>
3462 <li>
3463 <ol>
3464 <li>
3465 <ul>
3466 <li>
3467 <ol>
3468 <li>
3469 <dl>
3470 <dt>
3471 <ul>
3472 <li>
3473 <dl>
3474 <dt>
3475 <dl>
3476 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3477 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3478 </dl></dt>
3479 </dl></li>
3480 </ul></dt>
3481 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3482 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3483 </dl></li>
3484 </ol></li>
3485 </ul></li>
3486 </ol></li>
3487 </ul>
3488 !! end
3491 !! test
3492 Definition Lists: Weird Ones: Test 1
3493 !! wikitext
3494 *#;*::;; foo : bar (who uses this?)
3495 !! html/php
3496 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3497 <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>
3499 !! html/parsoid
3500 <ul>
3501 <li>
3502 <ol>
3503 <li>
3504 <dl>
3505 <dt>
3506 <ul>
3507 <li>
3508 <dl>
3509 <dd>
3510 <dl>
3511 <dd>
3512 <dl>
3513 <dt>
3514 <dl>
3515 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3516 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3517 </dl></dt>
3518 </dl></dd>
3519 </dl></dd>
3520 </dl></li>
3521 </ul></dt>
3522 </dl></li>
3523 </ol></li>
3524 </ul>
3525 !! end
3528 ### External links
3530 !! test
3531 External links: non-bracketed
3532 !! wikitext
3533 Non-bracketed: http://example.com
3534 !! html
3535 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3536 </p>
3537 !! end
3539 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3540 !! test
3541 External links: numbered
3542 !! wikitext
3543 Numbered: [http://example.com]
3544 Numbered: [http://example.net]
3545 Numbered: [http://example.com]
3546 !! html/php
3547 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3548 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3549 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3550 </p>
3551 !! html/parsoid
3552 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3553 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3554 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3555 !!end
3557 !! test
3558 External links: specified text
3559 !! wikitext
3560 Specified text: [http://example.com link]
3561 !! html
3562 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3563 </p>
3564 !!end
3566 !! test
3567 External links: trail
3568 !! wikitext
3569 Linktrails should not work for external links: [http://example.com link]s
3570 !! html
3571 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3572 </p>
3573 !! end
3575 !! test
3576 External links: dollar sign in URL
3577 !! wikitext
3578 http://example.com/1$2345
3579 !! html
3580 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3581 </p>
3582 !! end
3584 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3585 !! test
3586 External links: dollar sign in URL (autonumber)
3587 !! wikitext
3588 [http://example.com/1$2345]
3589 !! html/php
3590 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3591 </p>
3592 !! html/parsoid
3593 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3594 !!end
3596 !! test
3597 External links: open square bracket forbidden in URL (bug 4377)
3598 !! options
3599 parsoid=wt2html,wt2wt,html2html
3600 !! wikitext
3601 http://example.com/1[2345
3602 !! html/php
3603 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3604 </p>
3605 !! html/parsoid
3606 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3607 !! end
3609 !! test
3610 External links: open square bracket forbidden in URL (named) (bug 4377)
3611 !! options
3612 parsoid=wt2html,html2html
3613 !! wikitext
3614 [http://example.com/1[2345]
3615 !! html/php
3616 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3617 </p>
3618 !! html/parsoid
3619 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3620 !!end
3622 # parsoid adds a space before the link name
3623 !! test
3624 External links: open square bracket forbidden in URL (named) (bug 4377)
3625 Parsoid variant.
3626 !! wikitext
3627 [http://example.com/1 [2345]
3628 !! html
3629 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3630 </p>
3631 !!end
3633 !! test
3634 External links: nowiki in URL link text (bug 6230)
3635 !! wikitext
3636 [http://example.com/ <nowiki>''example site''</nowiki>]
3637 !! html
3638 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3639 </p>
3640 !! end
3642 !! test
3643 External links: newline forbidden in text (bug 6230 regression check)
3644 !! wikitext
3645 [http://example.com/ first
3646 second]
3647 !! html
3648 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3649 second]
3650 </p>
3651 !!end
3653 !! test
3654 External links: Pipe char between url and text
3655 !! wikitext
3656 [http://example.com | link]
3657 !! html
3658 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3659 </p>
3660 !!end
3662 !! test
3663 External links: protocol-relative URL in brackets
3664 !! wikitext
3665 [//example.com/ Test]
3666 !! html
3667 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3668 </p>
3669 !! end
3671 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3672 !! test
3673 External links: protocol-relative URL in brackets without text
3674 !! wikitext
3675 [//example.com]
3676 !! html/php
3677 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3678 </p>
3679 !! html/parsoid
3680 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3681 !! end
3683 !! test
3684 External links: protocol-relative URL in free text is left alone
3685 !! wikitext
3686 //example.com/Foo
3687 !! html
3688 <p>//example.com/Foo
3689 </p>
3690 !!end
3692 !! test
3693 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3694 !! wikitext
3695 foo//example.com/Foo
3696 !! html
3697 <p>foo//example.com/Foo
3698 </p>
3699 !! end
3701 !! test
3702 External links: with no contents
3703 !! wikitext
3704 [http://en.wikipedia.org/wiki/Foo]
3706 [[wikipedia:Foo|Bar]]
3708 [[wikipedia:Foo|<span>Bar</span>]]
3709 !! html/parsoid
3710 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3711 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3712 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3713 !! end
3715 !! test
3716 External image
3717 !! wikitext
3718 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3719 !! html
3720 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3721 </p>
3722 !! end
3724 !! test
3725 External image from https
3726 !! wikitext
3727 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3728 !! html
3729 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3730 </p>
3731 !! end
3733 !! test
3734 External image (when not allowed)
3735 !! options
3736 wgAllowExternalImages=0
3737 !! wikitext
3738 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3739 !! html
3740 <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>
3741 </p>
3742 !! end
3744 !! test
3745 Link to non-http image, no img tag
3746 !! wikitext
3747 Link to non-http image, no img tag: ftp://example.com/test.jpg
3748 !! html
3749 <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>
3750 </p>
3751 !! end
3753 !! test
3754 External links: terminating separator
3755 !! wikitext
3756 Terminating separator: http://example.com/thing,
3757 !! html
3758 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3759 </p>
3760 !! end
3762 !! test
3763 External links: intervening separator
3764 !! wikitext
3765 Intervening separator: http://example.com/1,2,3
3766 !! html
3767 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3768 </p>
3769 !! end
3771 !! test
3772 External links: old bug with URL in query
3773 !! wikitext
3774 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3775 !! html
3776 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3777 </p>
3778 !! end
3780 !! test
3781 External links: old URL-in-URL bug, mixed protocols
3782 !! wikitext
3783 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3784 !! html
3785 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3786 </p>
3787 !!end
3789 !! test
3790 External links: URL in text
3791 !! wikitext
3792 URL in text: [http://example.com http://example.com]
3793 !! html
3794 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3795 </p>
3796 !! end
3798 !! test
3799 External links: Clickable images
3800 !! wikitext
3801 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3802 !! html
3803 <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>
3804 </p>
3805 !!end
3807 !! test
3808 External links: raw ampersand
3809 !! wikitext
3810 Old &amp; use: http://x&y
3811 !! html
3812 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3813 </p>
3814 !! end
3816 !! test
3817 External links: encoded ampersand
3818 !! wikitext
3819 Old &amp; use: http://x&amp;y
3820 !! html/php
3821 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3822 </p>
3823 !! html/parsoid
3824 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3825 !! end
3827 !! test
3828 External links: encoded equals (bug 6102)
3829 !! wikitext
3830 http://example.com/?foo&#61;bar
3831 !! html/php
3832 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3833 </p>
3834 !! html/parsoid
3835 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3836 !! end
3839 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3840 ## does it number them.  As discussed in bug 53505, we can identify
3841 ## autonumbered links via CSS.
3844 !! test
3845 External links: [raw ampersand]
3846 !! wikitext
3847 Old &amp; use: [http://x&y]
3848 !! html/php
3849 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3850 </p>
3851 !! html/parsoid
3852 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3853 !! end
3855 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3856 # mode will return the [raw ampersand] wikitext
3857 !! test
3858 External links: [encoded ampersand]
3859 !! options
3860 parsoid=wt2html,wt2wt,html2html
3861 !! wikitext
3862 Old &amp; use: [http://x&amp;y]
3863 !! html/php
3864 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3865 </p>
3866 !! html/parsoid
3867 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3868 !! end
3870 !! test
3871 External links: [raw equals]
3872 !! wikitext
3873 [http://example.com/?foo=bar]
3874 !! html/php
3875 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3876 </p>
3877 !! html/parsoid
3878 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3879 !! end
3881 # note that parsoid html is identical to [raw equals] case; so html2wt
3882 # mode will return the [raw equals] wikitext
3883 !! test
3884 External links: [encoded equals] (bug 6102)
3885 !! options
3886 parsoid=wt2html,wt2wt,html2html
3887 !! wikitext
3888 [http://example.com/?foo&#61;bar]
3889 !! html/php
3890 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3891 </p>
3892 !! html/parsoid
3893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3894 !! end
3896 # xxx parsoid strips the IDN character, so the round-trip tests will
3897 #     obviously fail and are disabled. --cscott
3898 !! test
3899 External links: [IDN ignored character reference in hostname; strip it right off]
3900 !! options
3901 parsoid=wt2html,wt2wt,html2html
3902 !! wikitext
3903 [http://e&zwnj;xample.com/]
3904 !! html/php
3905 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3906 </p>
3907 !! html/parsoid
3908 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3909 !! end
3911 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3912 # Where an external link could easily circumvent the sanitization of the text of
3913 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3914 # test demands a higher standard. That's a bit strange.
3916 # Example:
3918 # http://e‌xample.com -> [http://example.com|http://example.com]
3919 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
3921 # The first example is sanitized, but the second is not. Any security benefits
3922 # from this production are trivial to circumvent. Either remove this test and
3923 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
3924 # the test accordingly.
3926 # All our love,
3927 # The Parsoid team.
3928 # xxx parsoid strips the IDN character, so the round-trip tests will
3929 #     obviously fail and are disabled. --cscott
3930 !! test
3931 External links: IDN ignored character reference in hostname; strip it right off
3932 !! options
3933 parsoid=wt2html,html2html
3934 !! wikitext
3935 http://e&zwnj;xample.com/
3936 !! html/php
3937 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
3938 </p>
3939 !! html/parsoid
3940 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
3941 !! end
3943 !! test
3944 External links: www.jpeg.org (bug 554)
3945 !! wikitext
3946 http://www.jpeg.org
3947 !! html
3948 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
3949 </p>
3950 !! end
3952 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3953 !! test
3954 External links: URL within URL (original bug 2)
3955 !! wikitext
3956 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
3957 !! html/php
3958 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
3959 </p>
3960 !! html/parsoid
3961 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
3962 !! end
3964 !! test
3965 BUG 361: URL inside bracketed URL
3966 !! wikitext
3967 [http://www.example.com/foo http://www.example.com/bar]
3968 !! html
3969 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
3970 </p>
3971 !! end
3973 !! test
3974 BUG 361: URL within URL, not bracketed
3975 !! wikitext
3976 http://www.example.com/foo?=http://www.example.com/bar
3977 !! html
3978 <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>
3979 </p>
3980 !! end
3982 !! test
3983 BUG 289: ">"-token in URL-tail
3984 !! wikitext
3985 http://www.example.com/<hello>
3986 !! html
3987 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3988 </p>
3989 !!end
3991 !! test
3992 BUG 289: literal ">"-token in URL-tail
3993 !! wikitext
3994 http://www.example.com/<b>html</b>
3995 !! html
3996 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3997 </p>
3998 !!end
4000 !! test
4001 BUG 289: ">"-token in bracketed URL
4002 !! wikitext
4003 [http://www.example.com/<hello> stuff]
4004 !! html
4005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4006 </p>
4007 !!end
4009 !! test
4010 BUG 289: literal ">"-token in bracketed URL
4011 !! wikitext
4012 [http://www.example.com/<b>html</b> stuff]
4013 !! html
4014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4015 </p>
4016 !!end
4018 !! test
4019 BUG 289: literal double quote at end of URL
4020 !! wikitext
4021 http://www.example.com/"hello"
4022 !! html
4023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4024 </p>
4025 !!end
4027 !! test
4028 BUG 289: literal double quote in bracketed URL
4029 !! wikitext
4030 [http://www.example.com/"hello" stuff]
4031 !! html
4032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4033 </p>
4034 !!end
4036 !! test
4037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4038 !! wikitext
4039 [http://www.example.com  test]
4040 !! html
4041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4042 </p>
4043 !! end
4045 !! test
4046 External links: link text with spaces
4047 !! wikitext
4048 [http://www.example.com a b c]
4049 [http://www.example.com ''a'' ''b'']
4050 !! html
4051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4053 </p>
4054 !! end
4056 !! test
4057 External links: wiki links within external link (Bug 3695)
4058 !! wikitext
4059 [http://example.com [[wikilink]] embedded in ext link]
4060 !! html/php
4061 <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>
4062 </p>
4063 !! html/parsoid
4064 <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>
4065 !! end
4067 !! test
4068 BUG 787: Links with one slash after the url protocol are invalid
4069 !! wikitext
4070 http:/example.com
4072 [http:/example.com title]
4073 !! html
4074 <p>http:/example.com
4075 </p><p>[http:/example.com title]
4076 </p>
4077 !! end
4079 !! test
4080 Bracketed external links with template-generated invalid target
4081 !! wikitext
4082 [{{echo|http:/example.com}} title]
4083 !! html
4084 <p>[http:/example.com title]
4085 </p>
4086 !! end
4088 !! test
4089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4090 !! wikitext
4091 ''[http://example.com text'']
4092 [http://example.com '''text]'''
4093 ''Something [http://example.com in italic'']
4094 ''Something [http://example.com mixed''''', even bold]'''
4095 '''''Now [http://example.com both''''']
4096 !! html
4097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4102 </p>
4103 !! end
4106 !! test
4107 Bug 4781: %26 in URL
4108 !! wikitext
4109 http://www.example.com/?title=AT%26T
4110 !! html/php
4111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4112 </p>
4113 !! html/parsoid
4114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4115 !! end
4117 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4118 # % is actually legal in HTML5. Any change in output would need testing though.
4119 !! test
4120 Bug 4781, 5267: %25 in URL
4121 !! wikitext
4122 http://www.example.com/?title=100%25_Bran
4123 !! html/php
4124 <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>
4125 </p>
4126 !! html/parsoid
4127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4128 !! end
4130 !! test
4131 Bug 4781, 5267: %28, %29 in URL
4132 !! wikitext
4133 http://www.example.com/?title=Ben-Hur_%281959_film%29
4134 !! html/php
4135 <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>
4136 </p>
4137 !! html/parsoid
4138 <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>
4139 !! end
4142 !! test
4143 Bug 4781: %26 in autonumber URL
4144 !! wikitext
4145 [http://www.example.com/?title=AT%26T]
4146 !! html/php
4147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4148 </p>
4149 !! html/parsoid
4150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4151 !! end
4153 !! test
4154 Bug 4781, 5267: %26 in autonumber URL
4155 !! wikitext
4156 [http://www.example.com/?title=100%25_Bran]
4157 !! html/php
4158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4159 </p>
4160 !! html/parsoid
4161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4162 !! end
4164 !! test
4165 Bug 4781, 5267: %28, %29 in autonumber URL
4166 !! wikitext
4167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4168 !! html/php
4169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4170 </p>
4171 !! html/parsoid
4172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4173 !! end
4176 !! test
4177 Bug 4781: %26 in bracketed URL
4178 !! wikitext
4179 [http://www.example.com/?title=AT%26T link]
4180 !! html/php
4181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4182 </p>
4183 !! html/parsoid
4184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4185 !! end
4187 !! test
4188 Bug 4781, 5267: %25 in bracketed URL
4189 !! wikitext
4190 [http://www.example.com/?title=100%25_Bran link]
4191 !! html
4192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4193 </p>
4194 !! end
4196 !! test
4197 Bug 4781, 5267: %28, %29 in bracketed URL
4198 !! wikitext
4199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4200 !! html/php
4201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4202 </p>
4203 !! html/parsoid
4204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4205 !! end
4207 !! test
4208 External link containing a period in the anchor. (bug 63947)
4209 !! wikitext
4210 [//foo.org/bar#baz. bang]
4212 [//foo.org/bar. bang]
4213 !! html/php
4214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4216 </p>
4217 !! html/parsoid
4218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4220 !! end
4222 !! test
4223 External link containing a single quote. (bug 63947)
4224 !! wikitext
4225 [//foo.org/bar'baz]
4227 [//foo.org/bar'baz bang]
4228 !! html/php
4229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4231 </p>
4232 !! html/parsoid
4233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4235 !! end
4238 !! test
4239 External link containing a period in the anchor. (bug 63947)
4240 !! wikitext
4241 [//foo.org/bar#baz. bang]
4243 [//foo.org/bar. bang]
4244 !! html/php
4245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4247 </p>
4248 !! html/parsoid
4249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4251 !! end
4253 !! test
4254 External link containing a single quote. (bug 63947)
4255 !! wikitext
4256 [//foo.org/bar'baz]
4258 [//foo.org/bar'baz bang]
4259 !! html/php
4260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4262 </p>
4263 !! html/parsoid
4264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4266 !! end
4269 !! test
4270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4271 !! wikitext
4272 Some [http://example.com/ pretty ''italics'' and stuff]!
4273 !! html
4274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4275 </p>
4276 !! end
4278 !! test
4279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4280 !! wikitext
4281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4282 !! html
4283 <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>
4284 </p>
4285 !! end
4287 !! test
4288 External link containing double-single-quotes with no space separating the url from text in italics
4289 !! wikitext
4290 [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]].]
4291 !! html/php
4292 <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>
4293 </p>
4294 !! html/parsoid
4295 <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>
4296 !! end
4298 !! test
4299 External link with comments in link text
4300 !! wikitext
4301 [http://www.google.com Google <!-- comment -->]
4302 !! html
4303 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4304 </p>
4305 !! end
4307 !! test
4308 URL-encoding in URL functions (single parameter)
4309 !! wikitext
4310 {{localurl:Some page|amp=&}}
4311 !! html
4312 <p>/index.php?title=Some_page&amp;amp=&amp;
4313 </p>
4314 !! end
4316 !! test
4317 URL-encoding in URL functions (multiple parameters)
4318 !! wikitext
4319 {{localurl:Some page|q=?&amp=&}}
4320 !! html
4321 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4322 </p>
4323 !! end
4325 !! test
4326 Brackets in urls
4327 !! wikitext
4328 http://example.com/index.php?foozoid%5B%5D=bar
4330 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4331 !! html/php
4332 <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>
4333 </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>
4334 </p>
4335 !! html/parsoid
4336 <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>
4338 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4339 !! end
4341 !! test
4342 IPv6 urls (bug 21261)
4343 !! options
4344 disabled
4345 !! wikitext
4346 http://[2404:130:0:1000::187:2]/index.php
4347 !! html
4348 <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>
4349 </p>
4350 !! end
4352 !! test
4353 Non-extlinks in brackets
4354 !! wikitext
4355 [foo]
4356 [foo bar]
4357 [foo ''bar'']
4358 [fool's] errand
4359 [fool's errand]
4360 [{{echo|foo}}]
4361 [{{echo|foo}} bar]
4362 [{{echo|foo}} ''bar'']
4363 [{{echo|foo}}l's] errand
4364 [{{echo|foo}}l's errand]
4365 [url={{echo|foo}}]
4366 [url=http://example.com]
4367 !! html
4368 <p>[foo]
4369 [foo bar]
4370 [foo <i>bar</i>]
4371 [fool's] errand
4372 [fool's errand]
4373 [foo]
4374 [foo bar]
4375 [foo <i>bar</i>]
4376 [fool's] errand
4377 [fool's errand]
4378 [url=foo]
4379 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4380 </p>
4381 !! end
4383 !! test
4384 Percent encoding in external links
4385 !! wikitext
4386 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4387 !! html/php
4388 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4389 </p>
4390 !! html/parsoid
4391 <p><a rel="mw:ExtLink"
4392 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4393 !! end
4395 !! test
4396 Use url link syntax for links where the content is equal the link target
4397 !! wikitext
4398 http://example.com
4399 !! html/php
4400 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4401 </p>
4402 !! html/parsoid
4403 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4404 !! end
4406 !! test
4407 Parenthesis in external links, especially URL links
4408 !! wikitext
4409 http://example.com)
4411 http://example.com/test)
4413 http://example.com/(test)
4415 http://example.com/((test)
4417 (http://example.com/(test))
4419 (http://example.com/(test)))))
4421 http://example.com/a)b
4423 [http://example.com) foo]
4424 !! html/php
4425 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4426 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4427 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4428 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4429 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4430 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4431 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4432 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4433 </p>
4434 !! html/parsoid
4435 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4436 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4437 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4438 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4439 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4440 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4441 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4442 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4443 !! end
4445 !! test
4446 Parenthesis in external links, w/ transclusion or comment
4447 !! wikitext
4448 (http://example.com/{{echo|hi}})
4450 (http://example.com<!-- hi -->)
4451 !! html/php
4452 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4453 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4454 </p>
4455 !! html/parsoid
4456 <p>(<a data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\">hi&lt;/span>"}]]}' typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}'>http://example.com/hi</a>)</p>
4458 <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>
4459 !! end
4462 ### Quotes
4465 !! test
4466 Quotes
4467 !! wikitext
4468 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4470 Normal text. '''''Bold italic text.''''' Normal text.
4471 !! html
4472 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4473 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4474 </p>
4475 !! end
4478 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4479 # parser strips. The wikitext contains just the first half of the bold
4480 # quote pair.
4481 !! test
4482 Unclosed and unmatched quotes
4483 !! wikitext
4484 '''''Bold italic text '''with bold deactivated''' in between.'''''
4486 '''''Bold italic text ''with italic deactivated'' in between.'''''
4488 '''Bold text..
4490 ..spanning two paragraphs (should not work).'''
4492 '''Bold tag left open
4494 ''Italic tag left open
4496 Normal text.
4498 <!-- Unmatching number of opening, closing tags: -->
4499 '''This year''''s election ''should'' beat '''last year''''s.
4501 ''Tom'''s car is bigger than ''Susan'''s.
4503 Plain ''italic'''s plain
4504 !! html/php
4505 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4506 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4507 </p><p><b>Bold text..</b>
4508 </p><p>..spanning two paragraphs (should not work).
4509 </p><p><b>Bold tag left open</b>
4510 </p><p><i>Italic tag left open</i>
4511 </p><p>Normal text.
4512 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4513 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4514 </p><p>Plain <i>italic'</i>s plain
4515 </p>
4516 !! html/parsoid
4517 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4518 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4519 </p><p><b>Bold text..</b>
4520 </p><p>..spanning two paragraphs (should not work).<b></b>
4521 </p><p><b>Bold tag left open</b>
4522 </p><p><i>Italic tag left open</i>
4523 </p><p>Normal text.
4524 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4525 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4526 </p><p>Plain <i>italic'</i>s plain
4527 </p>
4528 !! end
4531 ### Tables
4533 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4536 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4537 # is the bare minimum required by the spec, see:
4538 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4539 # Parsoid team replies: empty table tags are legal in HTML5
4540 !! test
4541 A table with no data.
4542 !! options
4543 parsoid=wt2html
4544 !! wikitext
4545 {||}
4546 !! html/php
4548 !! html/parsoid
4549 <table></table>
4551 !! end
4553 !! test
4554 A table with stray table end tags on start tag line (wt2html)
4555 !! options
4556 parsoid=wt2html
4557 !! wikitext
4558 {|style="color: red;"|}
4560 {|style="color: red;" |}
4561 |foo
4564 {|style="color: red;"|} id="foo"
4565 |foo
4568 {|style="color: red;" |} id="foo"
4569 |foo
4571 !! html
4572 <table style="color: red;"></table>
4574 <table style="color: red;">
4575 <tbody><tr>
4576 <td>foo</td>
4577 </tr></tbody>
4578 </table>
4580 <table style="color: red;" id="foo">
4581 <tbody><tr>
4582 <td>foo</td>
4583 </tr></tbody>
4584 </table>
4586 <table style="color: red;" id="foo">
4587 <tbody><tr>
4588 <td>foo</td>
4589 </tr></tbody>
4590 </table>
4592 !! end
4594 !! test
4595 A table with no data (take 2)
4596 !! wikitext
4599 !! html/parsoid
4600 <table></table>
4601 !! end
4603 # A table with nothing but a caption is invalid XHTML, we might want to render
4604 # this as <p>caption</p>
4605 # Parsoid team replies: table with only a caption is legal in HTML5
4606 !! test
4607 A table with nothing but a caption
4608 !! wikitext
4610 |+ caption
4612 !! html/php
4613 <table>
4614 <caption> caption
4615 </caption><tr><td></td></tr></table>
4617 !! html/parsoid
4618 <table><caption> caption</caption></table>
4619 !! end
4621 !! test
4622 A table with caption with default-spaced attributes and a table row
4623 !! wikitext
4625 |+ style="color: red;" | caption1
4627 | foo
4629 !! html
4630 <table>
4631 <caption style="color: red;"> caption1
4632 </caption>
4633 <tr>
4634 <td> foo
4635 </td></tr></table>
4637 !! end
4639 !! test
4640 A table with captions with non-default spaced attributes and a table row
4641 !! wikitext
4643 |+style="color: red;"|caption2
4644 |+ style="color: red;"| caption3
4646 | foo
4648 !! html
4649 <table>
4650 <caption style="color: red;">caption2
4651 </caption>
4652 <caption style="color: red;"> caption3
4653 </caption>
4654 <tr>
4655 <td> foo
4656 </td></tr></table>
4658 !! end
4660 !! test
4661 Table td-cell syntax variations
4662 !! wikitext
4664 | foo bar foo | baz
4665 | foo bar foo || baz
4666 | style='color:red;' | baz
4667 | style='color:red;' || baz
4669 !! html
4670 <table>
4671 <tr>
4672 <td> baz
4673 </td>
4674 <td> foo bar foo </td>
4675 <td> baz
4676 </td>
4677 <td style="color:red;"> baz
4678 </td>
4679 <td> style='color:red;' </td>
4680 <td> baz
4681 </td></tr></table>
4683 !! end
4685 !! test
4686 Simple table
4687 !! wikitext
4689 | 1 || 2
4691 | 3 || 4
4693 !! html
4694 <table>
4695 <tr>
4696 <td> 1 </td>
4697 <td> 2
4698 </td></tr>
4699 <tr>
4700 <td> 3 </td>
4701 <td> 4
4702 </td></tr></table>
4704 !! end
4706 !! test
4707 Simple table but with multiple dashes for row wikitext
4708 !! wikitext
4710 | foo
4711 |-----
4712 | bar
4714 !! html
4715 <table>
4716 <tr>
4717 <td> foo
4718 </td></tr>
4719 <tr>
4720 <td> bar
4721 </td></tr></table>
4723 !! end
4724 !! test
4725 Multiplication table
4726 !! wikitext
4727 {| border="1" cellpadding="2"
4728 |+Multiplication table
4730 ! &times; !! 1 !! 2 !! 3
4732 ! 1
4733 | 1 || 2 || 3
4735 ! 2
4736 | 2 || 4 || 6
4738 ! 3
4739 | 3 || 6 || 9
4741 ! 4
4742 | 4 || 8 || 12
4744 ! 5
4745 | 5 || 10 || 15
4747 !! html
4748 <table border="1" cellpadding="2">
4749 <caption>Multiplication table
4750 </caption>
4751 <tr>
4752 <th> &#215; </th>
4753 <th> 1 </th>
4754 <th> 2 </th>
4755 <th> 3
4756 </th></tr>
4757 <tr>
4758 <th> 1
4759 </th>
4760 <td> 1 </td>
4761 <td> 2 </td>
4762 <td> 3
4763 </td></tr>
4764 <tr>
4765 <th> 2
4766 </th>
4767 <td> 2 </td>
4768 <td> 4 </td>
4769 <td> 6
4770 </td></tr>
4771 <tr>
4772 <th> 3
4773 </th>
4774 <td> 3 </td>
4775 <td> 6 </td>
4776 <td> 9
4777 </td></tr>
4778 <tr>
4779 <th> 4
4780 </th>
4781 <td> 4 </td>
4782 <td> 8 </td>
4783 <td> 12
4784 </td></tr>
4785 <tr>
4786 <th> 5
4787 </th>
4788 <td> 5 </td>
4789 <td> 10 </td>
4790 <td> 15
4791 </td></tr></table>
4793 !! end
4795 !! test
4796 Accept "||" in table headings
4797 !! wikitext
4799 !h1 || h2
4801 !! html
4802 <table>
4803 <tr>
4804 <th>h1 </th>
4805 <th> h2
4806 </th></tr></table>
4808 !! end
4810 !! test
4811 Accept "!!" in table data
4812 !! wikitext
4814 | Foo!! ||
4816 !! html/parsoid
4817 <table data-parsoid='{}'>
4818 <tbody data-parsoid='{}'><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
4819 </tbody></table>
4820 !! end
4822 !! test
4823 Accept "||" in indented table headings
4824 !! wikitext
4826 !h1 || h2
4828 !! html
4829 <dl><dd><table>
4830 <tr>
4831 <th>h1 </th>
4832 <th> h2
4833 </th></tr></table></dd></dl>
4835 !! end
4837 !! test
4838 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4839 !! wikitext
4841 !| h1
4842 || a
4844 !! html
4845 <table>
4846 <tr>
4847 <th> h1
4848 </th>
4849 <td> a
4850 </td></tr></table>
4852 !! end
4854 !!test
4855 Accept "| !" at start of line in tables (ignore !-attribute)
4856 !! wikitext
4859 | !style="color:red" | bar
4861 !! html
4862 <table>
4864 <tr>
4865 <td> bar
4866 </td></tr></table>
4868 !!end
4870 !!test
4871 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 +/- 
4872 !! wikitext
4875 |style='color:red;'|+1
4876 |style='color:blue;'|-1
4878 | 1 || 2 || 3
4879 | 1 ||+2 ||-3
4881 | +1
4882 | -1
4884 !! html
4885 <table>
4887 <tr>
4888 <td style="color:red;">+1
4889 </td>
4890 <td style="color:blue;">-1
4891 </td></tr>
4892 <tr>
4893 <td> 1 </td>
4894 <td> 2 </td>
4895 <td> 3
4896 </td>
4897 <td> 1 </td>
4898 <td>+2 </td>
4899 <td>-3
4900 </td></tr>
4901 <tr>
4902 <td> +1
4903 </td>
4904 <td> -1
4905 </td></tr></table>
4907 !!end
4909 !! test
4910 Table rowspan
4911 !! wikitext
4912 {| border=1
4913 | Cell 1, row 1
4914 |rowspan=2| Cell 2, row 1 (and 2)
4915 | Cell 3, row 1
4917 | Cell 1, row 2
4918 | Cell 3, row 2
4920 !! html
4921 <table border="1">
4922 <tr>
4923 <td> Cell 1, row 1
4924 </td>
4925 <td rowspan="2"> Cell 2, row 1 (and 2)
4926 </td>
4927 <td> Cell 3, row 1
4928 </td></tr>
4929 <tr>
4930 <td> Cell 1, row 2
4931 </td>
4932 <td> Cell 3, row 2
4933 </td></tr></table>
4935 !! end
4937 !! test
4938 Nested table
4939 !! wikitext
4940 {| border=1
4941 | &alpha;
4943 {| bgcolor=#ABCDEF border=2
4944 |nested
4946 |table
4948 |the original table again
4950 !! html
4951 <table border="1">
4952 <tr>
4953 <td> &#945;
4954 </td>
4955 <td>
4956 <table bgcolor="#ABCDEF" border="2">
4957 <tr>
4958 <td>nested
4959 </td></tr>
4960 <tr>
4961 <td>table
4962 </td></tr></table>
4963 </td>
4964 <td>the original table again
4965 </td></tr></table>
4967 !! end
4969 !! test
4970 Invalid attributes in table cell (bug 1830)
4971 !! wikitext
4973 |Cell:|broken
4975 !! html
4976 <table>
4977 <tr>
4978 <td>broken
4979 </td></tr></table>
4981 !! end
4984 # The "|}" to close the table is missing from the input, so parsoid's
4985 # *2wt modes will fail.
4986 !! test
4987 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
4988 !! options
4989 parsoid=wt2html,html2html
4990 !! wikitext
4992 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
4993 !! html/php
4994 <table>
4995 <tr>
4996 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
4997 <td>]" onmouseover="alert(document.cookie)"&gt;test
4998 </td>
4999 </tr>
5000 </table>
5002 !! html/parsoid
5003 <table><tbody>
5004 <tr>
5005 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5006 !! end
5009 !! test
5010 Indented table markup mixed with indented pre content (proposed in bug 6200)
5011 !! wikitext
5012  <table>
5013  <tr>
5014  <td>
5015  Text that should be rendered preformatted
5016  </td>
5017  </tr>
5018  </table>
5019 !! html
5020  <table>
5021  <tr>
5022  <td>
5023 <pre>Text that should be rendered preformatted
5024 </pre>
5025  </td>
5026  </tr>
5027  </table>
5029 !! end
5031 !! test
5032 Template-generated table cell attributes and cell content
5033 !! wikitext
5035 |{{table_attribs}}
5036 | {{table_attribs}}
5038 !! html
5039 <table>
5040 <tr>
5041 <td style="color: red"> Foo
5042 </td>
5043 <td style="color: red"> Foo
5044 </td></tr></table>
5046 !! end
5048 !! test
5049 Template-generated table cell attributes and cell content (2)
5050 !! wikitext
5052 |align=center {{table_attribs}}
5054 !! html
5055 <table>
5056 <tr>
5057 <td align="center" style="color: red"> Foo
5058 </td></tr></table>
5060 !! end
5062 !! test
5063 Template-generated table cell attributes and cell content (3)
5064 !! wikitext
5066 |align=center {{table_cells}}
5068 !! html
5069 <table>
5070 <tr>
5071 <td align="center" style="color: red"> Foo </td>
5072 <td> Bar </td>
5073 <td> Baz
5074 </td></tr></table>
5076 !! end
5078 !! test
5079 Table with row followed by newlines and table heading
5080 !! wikitext
5084 ! foo
5086 !! html
5087 <table>
5090 <tr>
5091 <th> foo
5092 </th></tr></table>
5094 !! end
5096 !! test
5097 Table with empty line following the start tag
5098 !! wikitext
5102 | foo
5104 !! html
5105 <table>
5108 <tr>
5109 <td> foo
5110 </td></tr></table>
5112 !! end
5114 # FIXME: Preserve the attribute properly (with an empty string as value) in
5115 # the PHP parser. Parsoid implements the behavior below.
5116 !! test
5117 Table attributes with empty value
5118 !! wikitext
5120 | style=| hello
5122 !! html/parsoid
5123 <table>
5124 <tbody>
5125 <tr>
5126 <td style=""> hello
5127 </td></tr></tbody></table>
5129 !! end
5131 !! test
5132 Wikitext table with a lot of comments
5133 !! wikitext
5135 <!-- c0 -->
5136 | foo
5137 <!-- c1 -->
5138 |- <!-- c2 -->
5139 <!-- c3 -->
5140 |<!-- c4 -->
5141 <!-- c5 -->
5143 !! html
5144 <table>
5145 <tr>
5146 <td> foo
5147 </td></tr>
5148 <tr>
5149 <td>
5150 </td></tr></table>
5152 !! end
5154 !! test
5155 Wikitext table with double-line table cell
5156 !! wikitext
5161 !! html
5162 <table>
5163 <tr>
5164 <td>a
5165 <p>b
5166 </p>
5167 </td></tr></table>
5169 !! end
5171 !! test
5172 Table cell with a single comment
5173 !! wikitext
5175 | <!-- c1 -->
5176 | a
5178 !! html
5179 <table>
5180 <tr>
5181 <td>
5182 </td>
5183 <td> a
5184 </td></tr></table>
5186 !! end
5188 # The expected HTML structure in this test is debatable. The PHP parser does
5189 # not parse this kind of table at all. The main focus for Parsoid is on
5190 # round-tripping, so this output is ok for now. TODO: revisit!
5191 !! test
5192 Wikitext table with html-syntax row
5193 !! wikitext
5196 <td>foo</td>
5198 !! html/parsoid
5199 <table>
5200 <tbody>
5201 <tr>
5202 <td>foo</td></tr></tbody></table>
5203 !! end
5205 !! test
5206 Implicit <td> after a |-
5207 (PHP parser relies on Tidy to add the missing <td> tags)
5208 !! options
5209 parsoid=wt2html,wt2wt
5210 !! wikitext
5215 !! html
5216 <table>
5217 <tr><td>a</td></tr>
5218 </table>
5219 !! end
5221 !! test
5222 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5223 (PHP parser relies on Tidy to add the missing <td> tags)
5224 !! options
5225 parsoid=wt2html,wt2wt
5226 !! wikitext
5234 !! html
5235 <table>
5236 <tbody>
5237 <tr><td><pre>a</pre></td></tr>
5238 <tr><td> b</td></tr>
5239 </tbody>
5240 </table>
5241 !! end
5243 !! test
5244 Lists should be recognized in an implicit <td> context
5245 (PHP parser relies on Tidy to add the missing <td> tags)
5246 !! options
5247 parsoid=wt2html,wt2wt
5248 !! wikitext
5253 !! html
5254 <table>
5255 <tr>
5256 <td><ul>
5257 <li>a</li>
5258 </ul></td>
5259 </tr>
5260 </table>
5261 !! end
5263 !! test
5264 Parsoid: Round-trip tables directly followed by content (bug 51219)
5265 !! options
5266 parsoid=wt2html,wt2wt
5267 !! wikitext
5269 |foo
5270 |} bar
5273 |baz
5274 |}<b>quux</b>
5275 !! html
5276 <table><tbody>
5277 <tr>
5278 <td>foo</td></tr></tbody></table> bar
5279 <table>
5280 <tbody>
5281 <tr>
5282 <td>baz</td></tr></tbody></table><b>quux</b>
5283 !! end
5285 !! test
5286 Parsoid: Default to a newline after tables in new content (bug 51219)
5287 !! options
5288 parsoid=html2wt
5289 !! wikitext
5291 |foo
5293 <nowiki> </nowiki>bar
5295 |baz
5297 '''quux'''
5298 !! html
5299 <table><tbody>
5300 <tr><td>foo</td></tr></tbody></table> bar
5301 <table><tbody>
5302 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5303 !! end
5305 !! test
5306 Parsoid: newline inducing block nodes don't suppress <nowiki>
5307 !! options
5308 parsoid=html2wt
5309 !! wikitext
5310 <nowiki> </nowiki>a
5312 = foo =
5313 !! html
5314  a<h1>foo</h1>
5315 !! end
5317 !! test
5318 Parsoid: Row-syntax table headings followed by comment & table cells
5319 !! options
5320 parsoid=wt2html,wt2wt
5321 !! wikitext
5323 ! foo || bar
5324 <!-- foo -->  || baz || quux
5326 !! html/parsoid
5327 <table>
5328 <tbody>
5329 <tr><th>foo </th><th>bar  </th>
5330 <td>baz </td>
5331 <td>quux</td></tr></tbody></table>
5332 !! end
5335 !!test
5336 Parsoid: Recover better from broken table attributes
5337 !!options
5338 parsoid=wt2html
5339 !!wikitext
5340 {| class="foo
5341 | class="bar" |
5344 !!html/parsoid
5345 <table class="foo">
5346 <tr>
5347 <td class="bar">
5348 <p>foo</p></td></tr>
5349 </tbody></table>
5350 !!end
5353 ### Internal links
5355 !! test
5356 Plain link, capitalized
5357 !! wikitext
5358 [[Main Page]]
5359 !! html
5360 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5361 </p>
5362 !! end
5364 !! test
5365 Plain link, uncapitalized
5366 !! wikitext
5367 [[main Page]]
5368 !! html
5369 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5370 </p>
5371 !! end
5373 !! test
5374 Piped link
5375 !! wikitext
5376 [[Main Page|The Main Page]]
5377 !! html
5378 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5379 </p>
5380 !! end
5382 !! test
5383 Piped link with comment in link text
5384 !! wikitext
5385 [[Main Page|The Main<!--front--> Page]]
5386 !! html
5387 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5388 </p>
5389 !! end
5391 !! test
5392 Piped link with multiple pipe characters in link text
5393 !! wikitext
5394 [[Main Page||The|Main|Page|]]
5395 !! html/php
5396 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5397 </p>
5398 !! html/parsoid
5399 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5400 !! end
5402 !! test
5403 Broken link
5404 !! wikitext
5405 [[Zigzagzogzagzig]]
5406 !! html
5407 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5408 </p>
5409 !! end
5411 !! test
5412 Broken link with fragment
5413 !! wikitext
5414 [[Zigzagzogzagzig#zug]]
5415 !! html
5416 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5417 </p>
5418 !! end
5420 !! test
5421 Special page link with fragment
5422 !! wikitext
5423 [[Special:Version#anchor]]
5424 !! html
5425 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5426 </p>
5427 !! end
5429 !! test
5430 Nonexistent special page link with fragment
5431 !! wikitext
5432 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5433 !! html
5434 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5435 </p>
5436 !! end
5438 !! test
5439 Link with prefix
5440 !! wikitext
5441 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5442 !! html
5443 <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>
5444 </p>
5445 !! end
5447 !! test
5448 Link with suffix
5449 !! wikitext
5450 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5451 !! html
5452 <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>!!!
5453 </p>
5454 !! end
5456 !! article
5457 prefixed article
5458 !! text
5459 Some text
5460 !! endarticle
5462 !! test
5463 Bug 43661: Piped links with identical prefixes
5464 !! wikitext
5465 [[prefixed article|prefixed articles with spaces]]
5467 [[prefixed article|prefixed articlesaoeu]]
5469 [[Main Page|Main Page test]]
5470 !! html
5471 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5472 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5473 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5474 </p>
5475 !! end
5478 !! test
5479 Link with HTML entity in suffix / tail
5480 !! wikitext
5481 [[Main Page]]&quot;, [[Main Page]]&#97;
5482 !! html
5483 <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;
5484 </p>
5485 !! end
5487 !! test
5488 Link with 3 brackets
5489 !! wikitext
5490 [[[Main Page]]]
5491 !! html
5492 <p>[[[Main Page]]]
5493 </p>
5494 !! end
5496 !! test
5497 Link with 4 brackets
5498 !! wikitext
5499 [[[[Main Page]]]]
5500 !! html
5501 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5502 </p>
5503 !! end
5505 !! test
5506 Piped link with 3 brackets
5507 !! wikitext
5508 [[[main page|the main page]]]
5509 !! html
5510 <p>[[[main page|the main page]]]
5511 </p>
5512 !! end
5514 !! test
5515 Piped link with extlink-like text
5516 !! wikitext
5517 [[Main Page|[bar]]]
5518 [[Main Page|This is a [bar]]]
5519 !! html
5520 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5521 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5522 </p>
5523 !! end
5525 !! test
5526 Link with multiple pipes
5527 !! wikitext
5528 [[Main Page|The|Main|Page]]
5529 !! html
5530 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5531 </p>
5532 !! end
5534 # Note that parsoid does not munge anchor text; all non-space
5535 # characters are valid in HTML5 ids.
5536 !! test
5537 Anchor containing a #. (bug 63430)
5538 !! wikitext
5539 [[Main Page#And#Link]]
5540 !! html/php
5541 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5542 </p>
5543 !! html/parsoid
5544 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5545 !! end
5547 !! test
5548 Link to namespaces
5549 !! wikitext
5550 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5551 !! html
5552 <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>
5553 </p>
5554 !! end
5556 !! test
5557 Link with space in namespace
5558 !! wikitext
5559 [[User talk:Foo bar]]
5560 !! html
5561 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
5562 </p>
5563 !! end
5565 !! article
5566 MemoryAlpha:AlphaTest
5567 !! text
5568 This is an article in the MemoryAlpha namespace
5569 (which shadows the memoryalpha interwiki link).
5570 !! endarticle
5572 !! test
5573 Namespace takes precedence over interwiki link (bug 51680)
5574 !! wikitext
5575 [[MemoryAlpha:AlphaTest]]
5576 !! html
5577 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5578 </p>
5579 !! end
5581 # The previous test doesn't work correctly in html2*, due to not recognizing the
5582 # link as an internal one. This one checks for the correct behavior.
5583 !! test
5584 Link to namespace preferred over interwiki with correct rel attribute
5585 !! options
5586 parsoid=html2wt,html2html
5587 !! wikitext
5588 [[MemoryAlpha:AlphaTest]]
5589 !! html
5590 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5591 </p>
5592 !! end
5594 !! test
5595 Piped link to namespace
5596 !! wikitext
5597 [[Meta:Disclaimers|The disclaimers]]
5598 !! html
5599 <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>
5600 </p>
5601 !! end
5603 !! test
5604 Link containing }
5605 !! wikitext
5606 [[Usually caused by a typo (oops}]]
5607 !! html
5608 <p>[[Usually caused by a typo (oops}]]
5609 </p>
5610 !! end
5612 !! article
5613 7% Solution
5614 !! text
5615 Just a test of an article title containing a percent.
5616 !! endarticle
5618 !! test
5619 Link containing % (not as a hex sequence)
5620 !! wikitext
5621 [[7% Solution]]
5622 !! html/php
5623 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5624 </p>
5625 !! html/parsoid
5626 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5627 !! end
5629 # note that the parsoid HTML is identical to the previous test output,
5630 # so the previous test ensures that the html2wt mode will generate the
5631 # "not as a hex sequence" wikitext.
5632 !! test
5633 Link containing % as a single hex sequence interpreted to char
5634 !! options
5635 parsoid=wt2wt,wt2html,html2html
5636 !! wikitext
5637 [[7%25 Solution]]
5638 !! html/php
5639 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5640 </p>
5641 !! html/parsoid
5642 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5643 !!end
5645 !! test
5646 Link containing % as a double hex sequence interpreted to hex sequence
5647 !! wikitext
5648 [[7%2525 Solution]]
5649 !! html
5650 <p>[[7%2525 Solution]]
5651 </p>
5652 !!end
5654 # note that parsoid does not munge anchor text; all non-space
5655 # characters are valid in HTML5 anchors.
5656 !! test
5657 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5658 Example for such a section: == < ==
5659 !! wikitext
5660 [[%23%3c]][[%23%3e]]
5661 !! html/php
5662 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5663 </p>
5664 !! html/parsoid
5665 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5666 !! end
5668 !! test
5669 Link containing "<#" and ">#" as a hex sequences
5670 !! wikitext
5671 [[%3c%23]][[%3e%23]]
5672 !! html
5673 <p>[[%3c%23]][[%3e%23]]
5674 </p>
5675 !! end
5677 !! test
5678 Link containing an equals sign
5679 !! wikitext
5680 [[Special:BookSources/isbn=4-00-026157-6]]
5681 !! html/php
5682 <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>
5683 </p>
5684 !! html/parsoid
5685 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5686 !! end
5688 !! article
5689 Foo~bar
5690 !! text
5691 Just a test of an article title containing a tilde.
5692 !! endarticle
5694 # note that links containing signatures, like [[Foo~~~~]], are
5695 # massaged by the pre-save transform (PST) and so the tildes are never
5696 # seen by the parser.
5697 !! test
5698 Link containing a tilde
5699 !! wikitext
5700 [[Foo~bar]]
5701 !! html/php
5702 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5703 </p>
5704 !! html/parsoid
5705 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5706 !! end
5708 !! test
5709 Link containing double-single-quotes '' (bug 4598)
5710 !! wikitext
5711 [[Lista d''e paise d''o munno]]
5712 !! html/php
5713 <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>
5714 </p>
5715 !! html/parsoid
5716 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5717 !! end
5719 !! test
5720 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5721 !! wikitext
5722 Some [[Link|pretty ''italics'' and stuff]]!
5723 !! html/php
5724 <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>!
5725 </p>
5726 !! html/parsoid
5727 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5728 !! end
5730 !! test
5731 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5732 !! wikitext
5733 ''Some [[Link|pretty ''italics'' and stuff]]!''
5734 !! html
5735 <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>
5736 </p>
5737 !! end
5739 !! test
5740 Link with double quotes in title part (literal) and alternate part (interpreted)
5741 !! wikitext
5742 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5744 [[''Pentecoste'']]
5746 [[''Pentecoste''|Pentecoste]]
5748 [[''Pentecoste''|''Pentecoste'']]
5749 !! html/php
5750 <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>
5751 </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>
5752 </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>
5753 </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>
5754 </p>
5755 !! html/parsoid
5756 <meta typeof="mw:Placeholder"/>
5757 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5758 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5759 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5760 !! end
5762 !! test
5763 Broken image links with HTML captions (bug 39700)
5764 !! wikitext
5765 [[File:Nonexistent|<script></script>]]
5766 [[File:Nonexistent|100px|<script></script>]]
5767 [[File:Nonexistent|&lt;]]
5768 [[File:Nonexistent|a<i>b</i>c]]
5769 !! html
5770 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5771 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5772 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5773 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5774 </p>
5775 !! end
5777 !! test
5778 Plain link to URL
5779 !! wikitext
5780 [[http://www.example.com]]
5781 !! html/php
5782 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5783 </p>
5784 !! html/parsoid
5785 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5786 !! end
5788 !! test
5789 Plain link to URL with link text
5790 !! wikitext
5791 [[http://www.example.com Link text]]
5792 !! html
5793 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5794 </p>
5795 !! end
5797 !! test
5798 Plain link to protocol-relative URL
5799 !! wikitext
5800 [[//www.example.com]]
5801 !! html/php
5802 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5803 </p>
5804 !! html/parsoid
5805 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5806 !! end
5808 !! test
5809 Plain link to protocol-relative URL with link text
5810 !! wikitext
5811 [[//www.example.com Link text]]
5812 !! html
5813 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5814 </p>
5815 !! end
5817 !! test
5818 Plain link to page with question mark in title
5819 !! wikitext
5820 [[A?b]]
5822 [[A?b|Baz]]
5823 !! html
5824 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5825 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5826 </p>
5827 !! end
5830 # I'm fairly sure the expected result here is wrong.
5831 # We want these to be URL links, not pseudo-pages with URLs for titles....
5832 # However the current output is also pretty screwy.
5834 # ----
5835 # I'm changing it to match the current output--it arguably makes more
5836 # sense in the light of the test above. Old expected result was:
5837 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5838 #</p>
5839 # But I think this test is bordering on "garbage in, garbage out" anyway.
5840 # -- wtm
5841 !! test
5842 Piped link to URL
5843 !! wikitext
5844 Piped link to URL: [[http://www.example.com|an example URL]]
5845 !! html/php
5846 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
5847 </p>
5848 !! html/parsoid
5849 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
5850 !! end
5852 !! test
5853 BUG 2: [[page|http://url/]] should link to page, not http://url/
5854 !! wikitext
5855 [[Main Page|http://url/]]
5856 !! html/php
5857 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
5858 </p>
5859 !! html/parsoid
5860 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
5861 !! end
5863 # Parsoid does not mark self-links, by design.
5864 !! test
5865 BUG 337: Escaped self-links should be bold
5866 !! options
5867 title=[[Bug462]]
5868 !! wikitext
5869 [[Bu&#103;462]] [[Bug462]]
5870 !! html/php
5871 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
5872 </p>
5873 !! html/parsoid
5874 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
5875 !! end
5877 !! test
5878 Self-link to section should not be bold
5879 !! options
5880 title=[[Main Page]]
5881 !! wikitext
5882 [[Main Page#section]]
5883 !! html
5884 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
5885 </p>
5886 !! end
5888 !! article
5890 !! text
5891 This is 00.
5892 !! endarticle
5894 !!test
5895 Self-link to numeric title
5896 !!options
5897 title=[[0]]
5898 !! wikitext
5899 [[0]]
5900 !! html
5901 <p><strong class="selflink">0</strong>
5902 </p>
5903 !!end
5905 !!test
5906 Link to numeric-equivalent title
5907 !!options
5908 title=[[0]]
5909 !! wikitext
5910 [[00]]
5911 !! html
5912 <p><a href="/wiki/00" title="00">00</a>
5913 </p>
5914 !!end
5916 !! test
5917 <nowiki> inside a link
5918 !! wikitext
5919 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
5920 !! html
5921 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
5922 </p>
5923 !! end
5925 !! test
5926 Non-breaking spaces in title
5927 !! wikitext
5928 [[&nbsp; Main &nbsp; Page &nbsp;]]
5929 !! html
5930 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
5931 </p>
5932 !!end
5934 !! test
5935 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
5936 !! options
5937 language=ca
5938 !! wikitext
5939 '''[[Main Page]]'''
5940 !! html
5941 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
5942 </p>
5943 !! end
5945 !! test
5946 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
5947 !! options
5948 language=ca
5949 !! wikitext
5950 ''[[Main Page]]''
5951 !! html
5952 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
5953 </p>
5954 !! end
5956 !! test
5957 Internal link with en linktrail: no apostrophes (bug 27473)
5958 !! options
5959 language=en
5960 !! wikitext
5961 [[Something]]'nice
5962 !! html
5963 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
5964 </p>
5965 !! end
5967 !! test
5968 Internal link with ca linktrail with apostrophes (bug 27473)
5969 !! options
5970 language=ca
5971 !! wikitext
5972 [[Something]]'nice
5973 !! html
5974 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
5975 </p>
5976 !! end
5978 !! test
5979 Internal link with kaa linktrail with apostrophes (bug 27473)
5980 !! options
5981 language=kaa
5982 !! wikitext
5983 [[Something]]'nice
5984 !! html
5985 <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>
5986 </p>
5987 !! end
5989 !! test
5990 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
5991 !! wikitext
5992 [[User:Foo/Test/63636:Bar|Test]]
5993 !! html/php
5994 <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>
5995 </p>
5996 !! html/parsoid
5997 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
5998 !! end
6000 !! test
6001 1. Interaction of linktrail and template encapsulation
6002 !! options
6003 parsoid
6004 !! wikitext
6005 {{echo|[[Foo]]}}l
6006 !! html
6007 <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>
6008 !! end
6010 !! test
6011 2. Interaction of linktrail and template encapsulation
6012 !! options
6013 parsoid
6014 !! wikitext
6015 {{echo|Some [[Fool]]}}s
6016 !! html
6017 <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>
6018 !! end
6020 !! test
6021 3. Interaction of linktrail and template encapsulation
6022 !! options
6023 parsoid
6024 !! wikitext
6025 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6026 !! html
6027 <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>
6028 !! end
6030 !! article
6031 Söfnuður
6032 !! text
6033 Test.
6034 !! endarticle
6036 !! test
6037 Internal link with is link prefix
6038 !! options
6039 language=is
6040 !! wikitext
6041 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6042 !! html
6043 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6044 </p>
6045 !! end
6047 !! article
6048 Mótmælendatrú
6049 !! text
6050 Test.
6051 !! endarticle
6053 !! test
6054 Internal link with is link trail and link prefix
6055 !! options
6056 language=is
6057 !! wikitext
6058 [[mótmælendatrú|xxx]]ar
6059 [[mótmælendatrú]]ar
6060 mótmælenda[[söfnuður]]
6061 mótmælenda[[söfnuður|söfnuðir]]
6062 mótmælenda[[söfnuður|söfnuðir]]xxx
6063 !! html
6064 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6065 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6066 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6067 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6068 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6069 </p>
6070 !! end
6072 !! test
6073 Parsoid link trail escaping
6074 !! options
6075 parsoid=html2wt,html2html
6076 !! wikitext
6077 [[apple]]<nowiki/>s
6078 !! html
6079 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6080 !! end
6082 !! test
6083 Parsoid link prefix escaping
6084 !! options
6085 language=is
6086 parsoid=html2wt,html2html
6087 !! wikitext
6088 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6089 !! html
6090 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6091 !! end
6093 !! test
6094 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6095 !! wikitext
6096 [[Foo|  bar]]
6098 [[Foo|  ''bar'']]
6100 [http://wp.org   foo]
6102 [http://wp.org   ''foo'']
6103 !! html
6104 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
6105 </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>
6106 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6107 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6108 </p>
6109 !! end
6111 !! test
6112 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6113 !! options
6114 parsoid
6115 !! wikitext
6116 [[Foo|{{echo|a}} b {{echo|c}}]]
6117 !! html
6118 <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>
6119 !! end
6121 !! test
6122 Link with angle bracket after anchor
6123 !! wikitext
6124 [[Foo#<bar>]]
6125 !! html/parsoid
6126 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
6127 !! end
6130 ### Interwiki links (see maintenance/interwiki.sql)
6133 !! test
6134 Inline interwiki link
6135 !! wikitext
6136 [[MeatBall:SoftSecurity]]
6137 !! html
6138 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6139 </p>
6140 !! end
6142 !! test
6143 Inline interwiki link with empty title (bug 2372)
6144 !! wikitext
6145 [[MeatBall:]]
6146 !! html
6147 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6148 </p>
6149 !! end
6151 !! test
6152 Interwiki link encoding conversion (bug 1636)
6153 !! wikitext
6154 *[[Wikipedia:ro:Olteni&#0355;a]]
6155 *[[Wikipedia:ro:Olteni&#355;a]]
6156 !! html
6157 <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>
6158 <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>
6160 !! end
6162 !! test
6163 Interwiki link with fragment (bug 2130)
6164 !! wikitext
6165 [[MeatBall:SoftSecurity#foo]]
6166 !! html
6167 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6168 </p>
6169 !! end
6171 # Ideally the wikipedia: prefix here should be proto-relative too
6172 !! test
6173 Different interwiki prefixes mapping to the same URL
6174 !! wikitext
6175 [[:en:Foo]]
6177 [[:en:Foo|Foo]]
6179 [[wikipedia:Foo]]
6181 [[:wikipedia:Foo|Foo]]
6183 [[wikipedia:en:Foo]]
6185 [[:wikipedia:en:Foo]]
6186 !! html/parsoid
6187 <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>
6189 <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>
6191 <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>
6193 <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>
6195 <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>
6197 <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>
6198 !! end
6200 !! test
6201 Interwiki links that cannot be represented in wiki syntax
6202 !! wikitext
6203 [[meatball:ok]]
6204 [[meatball:ok#foo|ok with fragment]]
6205 [[meatball:ok_as_well?|ok ending with ? mark]]
6206 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6207 [http://de.wikipedia.org/wiki/#foo is just fragment]
6209 !! html/parsoid
6210 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6211 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6212 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6213 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6214 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6215 !! end
6217 !! test
6218 Interwiki links: trail
6219 !! options
6220 parsoid
6221 !! wikitext
6222 [[wikipedia:Foo|Ba]]r
6223 !! html
6224 <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>
6225 !! end
6228 ### Interlanguage links
6229 ### Language links (so that searching for '### language' matches..)
6232 !! test
6233 Interlanguage link
6234 !! wikitext
6235 Blah blah blah
6236 [[zh:Chinese]]
6237 !! html
6238 <p>Blah blah blah
6239 </p>
6240 !! end
6242 !! test
6243 Double interlanguage link
6244 !! wikitext
6245 Blah blah blah
6246 [[es:Spanish]]
6247 [[zh:Chinese]]
6248 !! html
6249 <p>Blah blah blah
6250 </p>
6251 !! end
6253 !! test
6254 Interlanguage link, with prefix links
6255 !! options
6256 language=ln
6257 !! wikitext
6258 Blah blah blah
6259 [[zh:Chinese]]
6260 !! html
6261 <p>Blah blah blah
6262 </p>
6263 !! end
6265 !! test
6266 Double interlanguage link, with prefix links (bug 8897)
6267 !! options
6268 language=ln
6269 !! wikitext
6270 Blah blah blah
6271 [[es:Spanish]]
6272 [[zh:Chinese]]
6273 !! html
6274 <p>Blah blah blah
6275 </p>
6276 !! end
6278 !! test
6279 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6280 !! options
6281 language=ln
6282 !! wikitext
6283 [[WW&nbsp;II]]
6284 !! html
6285 <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>
6286 </p>
6287 !! end
6289 !! test
6290 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6291 !! options
6292 parsoid=html2wt
6293 !! wikitext
6294 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6296 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6297 !! html
6298 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6299 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6300 !! end
6302 !! test
6303 Parsoid: handle constructor well
6304 !! options
6305 parsoid
6306 !! wikitext
6307 [[constructor]]
6309 [[constructor:foo]]
6310 !! html
6311 <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>
6313 <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>
6314 !! end
6316 !! test
6317 Parsoid: recognize interlanguage links without a target page
6318 !! options
6319 parsoid
6320 !! wikitext
6321 [[ko:]]
6322 !! html
6323 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6324 !! end
6326 !! test
6327 Parsoid: recognize interwiki links without a target page
6328 !! options
6329 parsoid
6330 !! wikitext
6331 [[:ko:]]
6332 !! html
6333 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6334 !! end
6336 !! test
6337 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6338 !! options
6339 parsoid
6340 !! wikitext
6341 [[en:Foo]]
6342 !! html
6343 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6344 !! end
6347 ### Redirects, Parsoid-only
6349 !! test
6350 1. Simple redirect to page
6351 !! options
6352 parsoid
6353 !! wikitext
6354 #REDIRECT [[Main Page]]
6355 !! html
6356 <link rel="mw:PageProp/redirect" href="./Main_Page">
6357 !! end
6359 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6360 !! test
6361 2. Other redirect variants
6362 !! options
6363 parsoid=wt2html,wt2wt
6364 !! wikitext
6365 #REDIRECT [[Main_Page]]
6366 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6367 !! html
6368 <link rel="mw:PageProp/redirect" href="./Main_Page">
6369 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6370 !! end
6372 !! test
6373 Empty redirect
6374 !! options
6375 parsoid=wt2html,wt2wt
6376 !! wikitext
6377 #REDIRECT [[]]
6378 !! html
6379 <ol>
6380 <li>REDIRECT [[]]</li></ol>
6381 !! end
6383 !! test
6384 Optional colon in #REDIRECT
6385 !! options
6386 # the colon is archaic syntax.  we support it for wt2html, but we
6387 # don't care that it roundtrips back to the modern syntax.
6388 parsoid=wt2html,html2html
6389 !! wikitext
6390 #REDIRECT:[[Main Page]]
6391 !! html
6392 <link rel="mw:PageProp/redirect" href="./Main_Page">
6393 !! end
6395 !! test
6396 Whitespace in #REDIRECT with optional colon
6397 !! options
6398 # the colon and gratuitous whitespace is archaic syntax.  we support
6399 # it for wt2html, but we don't care that it roundtrips back to the
6400 # modern syntax (without extra whitespace)
6401 parsoid=wt2html,html2html
6402 !! wikitext
6404  #REDIRECT 
6406 [[Main Page]]
6407 !! html
6408 <link rel="mw:PageProp/redirect" href="./Main_Page">
6409 !! end
6411 !! test
6412 Piped link in #REDIRECT
6413 !! options
6414 # content after piped link is ignored.  we support this syntax,
6415 # but don't care that the piped link is lost when we roundtrip this.
6416 parsoid=wt2html
6417 !! wikitext
6418 #REDIRECT [[Main Page|bar]]
6419 !! html
6420 <link rel="mw:PageProp/redirect" href="./Main_Page">
6421 !! end
6423 !! test
6424 Redirect to category
6425 !! options
6426 parsoid=wt2html
6427 !! wikitext
6428 #REDIRECT [[Category:Foo]]
6429 !! html
6430 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6431 !! end
6433 !! test
6434 Redirect to category with URL encoding
6435 !! options
6436 parsoid=wt2html
6437 !! wikitext
6438 #REDIRECT [[Category%3AFoo]]
6439 !! html
6440 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6441 !! end
6443 !! test
6444 Redirect to category page
6445 !! options
6446 parsoid=wt2html,html2html
6447 !! wikitext
6448 #REDIRECT [[:Category:Foo]]
6449 !! html
6450 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6451 !! end
6453 !! test
6454 Redirect to image page (1)
6455 !! options
6456 parsoid
6457 !! wikitext
6458 #REDIRECT [[File:Wiki.png]]
6459 !! html
6460 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6461 !! end
6463 !! test
6464 Redirect to image page (2)
6465 !! options
6466 parsoid
6467 !! wikitext
6468 #REDIRECT [[Image:Wiki.png]]
6469 !! html
6470 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6471 !! end
6473 !! test
6474 Redirect to language
6475 !! options
6476 parsoid
6477 !! wikitext
6478 #REDIRECT [[en:File:Wiki.png]]
6479 !! html
6480 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6481 !! end
6483 !! test
6484 Redirect to interwiki
6485 !! options
6486 parsoid
6487 !! wikitext
6488 #REDIRECT [[meatball:File:Wiki.png]]
6489 !! html
6490 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6491 !! end
6493 !! test
6494 Non-English #REDIRECT
6495 !! options
6496 parsoid
6497 language=is
6498 !! wikitext
6499 #TILVÍSUN [[Main Page]]
6500 !! html
6501 <link rel="mw:PageProp/redirect" href="./Main_Page">
6502 !! end
6504 !! test
6505 New redirect
6506 !! options
6507 parsoid=html2wt
6508 !! wikitext
6510 #REDIRECT [[Foo]]
6511 !! html
6512 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6513 !! end
6516 ## XHTML tidiness
6519 !! test
6520 <br> to <br />
6521 !! wikitext
6522 1<br>2<br />3
6523 !! html
6524 <p>1<br />2<br />3
6525 </p>
6526 !! end
6528 !! test
6529 Broken br tag sanitization
6530 !! wikitext
6531 </br>
6532 !! html/php
6533 <p>&lt;/br&gt;
6534 </p>
6535 !! end
6537 # TODO: Fix html2html mode (bug 51055)!
6538 !! test
6539 Parsoid: Broken br tag recognition
6540 !! options
6541 parsoid=wt2html
6542 !! wikitext
6543 </br>
6545 <br/ >
6546 !! html/parsoid
6547 <p><br></p>
6548 <p><br/></p>
6549 !! end
6551 !! test
6552 Incorrecly removing closing slashes from correctly formed XHTML
6553 !! wikitext
6554 <br style="clear:both;" />
6555 !! html
6556 <p><br style="clear:both;" />
6557 </p>
6558 !! end
6560 !! test
6561 Failing to transform badly formed HTML into correct XHTML
6562 !! wikitext
6563 <br style="clear: left;">
6564 <br style="clear: right;">
6565 <br style="clear: both;">
6566 !! html
6567 <p><br style="clear: left;" />
6568 <br style="clear: right;" />
6569 <br style="clear: both;" />
6570 </p>
6571 !!end
6573 !! test
6574 Handling html with a div self-closing tag
6575 !! wikitext
6576 <div title />
6577 <div title/>
6578 <div title/ >
6579 <div title=bar />
6580 <div title=bar/>
6581 <div title=bar/ >
6582 !! html
6583 <p>&lt;div title /&gt;
6584 &lt;div title/&gt;
6585 </p>
6586 <div>
6587 <p>&lt;div title=bar /&gt;
6588 &lt;div title=bar/&gt;
6589 </p>
6590 <div title="bar/"></div>
6591 </div>
6593 !! end
6595 !! test
6596 Handling html with a br self-closing tag
6597 !! wikitext
6598 <br title />
6599 <br title/>
6600 <br title/ >
6601 <br title=bar />
6602 <br title=bar/>
6603 <br title=bar/ >
6604 !! html
6605 <p><br title="title" />
6606 <br title="title" />
6607 <br />
6608 <br title="bar" />
6609 <br title="bar" />
6610 <br title="bar/" />
6611 </p>
6612 !! end
6614 !! test
6615 Horizontal ruler (should it add that extra space?)
6616 !! wikitext
6617 <hr>
6618 <hr >
6619 foo <hr
6620 > bar
6621 !! html
6622 <hr />
6623 <hr />
6624 foo <hr /> bar
6626 !! end
6628 !! test
6629 Horizontal ruler -- 4+ dashes render hr
6630 !! wikitext
6631 ----
6632 !! html
6633 <hr />
6635 !! end
6637 !! test
6638 Horizontal ruler -- eats additional dashes on the same line
6639 !! wikitext
6640 ---------
6641 !! html
6642 <hr />
6644 !! end
6646 !! test
6647 Horizontal ruler -- does not collapse dashes on consecutive lines
6648 !! wikitext
6649 ----
6650 ----
6651 !! html
6652 <hr />
6653 <hr />
6655 !! end
6657 !! test
6658 Horizontal ruler -- <4 dashes render as plain text
6659 !! wikitext
6661 !! html
6662 <p>---
6663 </p>
6664 !! end
6666 !! test
6667 Horizontal ruler -- Supports content following dashes on same line
6668 !! wikitext
6669 ---- Foo
6670 !! html
6671 <hr /> Foo
6673 !! end
6676 ### Block-level elements
6678 !! test
6679 Common list
6680 !! wikitext
6681 *Common list
6682 * item 2
6683 *item 3
6684 !! html
6685 <ul><li>Common list</li>
6686 <li> item 2</li>
6687 <li>item 3</li></ul>
6689 !! end
6691 !! test
6692 Numbered list
6693 !! wikitext
6694 #Numbered list
6695 #item 2
6696 # item 3
6697 !! html
6698 <ol><li>Numbered list</li>
6699 <li>item 2</li>
6700 <li> item 3</li></ol>
6702 !! end
6704 !! test
6705 Mixed list
6706 !! wikitext
6707 *Mixed list
6708 *# with numbers
6709 ** and bullets
6710 *# and numbers
6711 *bullets again
6712 **bullet level 2
6713 ***bullet level 3
6714 ***#Number on level 4
6715 **bullet level 2
6716 **#Number on level 3
6717 **#Number on level 3
6718 *#number level 2
6719 *Level 1
6720 *** Level 3
6721 #** Level 3, but ordered
6722 !! html
6723 <ul><li>Mixed list
6724 <ol><li> with numbers</li></ol>
6725 <ul><li> and bullets</li></ul>
6726 <ol><li> and numbers</li></ol></li>
6727 <li>bullets again
6728 <ul><li>bullet level 2
6729 <ul><li>bullet level 3
6730 <ol><li>Number on level 4</li></ol></li></ul></li>
6731 <li>bullet level 2
6732 <ol><li>Number on level 3</li>
6733 <li>Number on level 3</li></ol></li></ul>
6734 <ol><li>number level 2</li></ol></li>
6735 <li>Level 1
6736 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6737 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6739 !! end
6741 !! test
6742 Nested lists 1
6743 !! wikitext
6744 *foo
6745 **bar
6746 !! html
6747 <ul><li>foo
6748 <ul><li>bar</li></ul></li></ul>
6750 !! end
6752 !! test
6753 Nested lists 2
6754 !! wikitext
6755 **foo
6756 *bar
6757 !! html
6758 <ul><li><ul><li>foo</li></ul></li>
6759 <li>bar</li></ul>
6761 !! end
6763 !! test
6764 Nested lists 3 (first element empty)
6765 !! wikitext
6767 **bar
6768 !! html
6769 <ul><li>
6770 <ul><li>bar</li></ul></li></ul>
6772 !! end
6774 !! test
6775 Nested lists 4 (first element empty)
6776 !! wikitext
6778 *bar
6779 !! html
6780 <ul><li><ul><li></li></ul></li>
6781 <li>bar</li></ul>
6783 !! end
6785 !! test
6786 Nested lists 5 (both elements empty)
6787 !! wikitext
6790 !! html
6791 <ul><li><ul><li></li></ul></li>
6792 <li></li></ul>
6794 !! end
6796 !! test
6797 Nested lists 6 (both elements empty)
6798 !! wikitext
6801 !! html
6802 <ul><li>
6803 <ul><li></li></ul></li></ul>
6805 !! end
6807 !! test
6808 Nested lists 7 (skip initial nesting levels)
6809 !! wikitext
6810 *** foo
6811 !! html
6812 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
6814 !! end
6816 !! test
6817 Nested lists 8 (multiple nesting transitions)
6818 !! wikitext
6819 * foo
6820 *** bar
6821 ** baz
6822 * boo
6823 !! html
6824 <ul><li> foo
6825 <ul><li><ul><li> bar</li></ul></li>
6826 <li> baz</li></ul></li>
6827 <li> boo</li></ul>
6829 !! end
6831 !! test
6832 1. Lists with start-of-line-transparent tokens before bullets: Comments
6833 !! wikitext
6834 *foo
6835 *<!--cmt-->bar
6836 <!--cmt-->*baz
6837 !! html
6838 <ul><li>foo</li>
6839 <li>bar</li>
6840 <li>baz</li></ul>
6842 !! end
6844 !! test
6845 2. Lists with start-of-line-transparent tokens before bullets: Template close
6846 !! wikitext
6847 *foo {{echo|bar
6848 }}*baz
6849 !! html
6850 <ul><li>foo bar</li>
6851 <li>baz</li></ul>
6853 !! end
6855 !! test
6856 List items are not parsed correctly following a <pre> block (bug 785)
6857 !! wikitext
6858 * <pre>foo</pre>
6859 * <pre>bar</pre>
6860 * zar
6861 !! html
6862 <ul><li> <pre>foo</pre></li>
6863 <li> <pre>bar</pre></li>
6864 <li> zar</li></ul>
6866 !! end
6868 !! test
6869 List items from template
6870 !! wikitext
6872 {{inner list}}
6873 * item 2
6875 * item 0
6876 {{inner list}}
6877 * item 2
6879 * item 0
6880 * notSOL{{inner list}}
6881 * item 2
6882 !! html
6883 <ul><li> item 1</li>
6884 <li> item 2</li></ul>
6885 <ul><li> item 0</li>
6886 <li> item 1</li>
6887 <li> item 2</li></ul>
6888 <ul><li> item 0</li>
6889 <li> notSOL</li>
6890 <li> item 1</li>
6891 <li> item 2</li></ul>
6893 !! end
6895 !! test
6896 List interrupted by empty line or heading
6897 !! wikitext
6898 * foo
6900 ** bar
6901 == A heading ==
6902 * Another list item
6903 !! html
6904 <ul><li> foo</li></ul>
6905 <ul><li><ul><li> bar</li></ul></li></ul>
6906 <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>
6907 <ul><li> Another list item</li></ul>
6909 !!end
6911 !!test
6912 Multiple list tags generated by templates
6913 !! wikitext
6914 {{echo|<li>}}a
6915 {{echo|<li>}}b
6916 {{echo|<li>}}c
6917 !! html
6918 <li>a
6919 <li>b
6920 <li>c</li>
6921 </li>
6922 </li>
6924 !!end
6926 !!test
6927 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
6928 !! wikitext
6930 <!--This line will NOT split the list-->
6932  <!--This line will NOT split the list either-->
6934  <!--foo--> <!----> <!--This line NOT split the list either--> 
6936 !! html
6937 <ul><li>a</li>
6938 <li>b</li>
6939 <li>c</li>
6940 <li>d</li></ul>
6942 !!end
6944 !!test
6945 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
6946 !! wikitext
6948 <!--This line will NOT split the list-->        
6950         <!--This line will NOT split the list either-->         
6952         <!--foo--> <!---->      <!--This line NOT split the list
6953         either-->        
6955 !! html
6956 <ul><li>a</li>
6957 <li>b</li>
6958 <li>c</li>
6959 <li>d</li></ul>
6961 !!end
6963 !!test
6964 Test the li-hack
6965 (Cannot test this with PHP parser since it relies on Tidy for the hack)
6966 !!options
6967 parsoid=wt2html,wt2wt
6968 !! wikitext
6969 * foo
6970 * <li>li-hack
6971 * {{echo|<li>templated li-hack}}
6972 * <!--foo--> <li> unsupported li-hack with preceding comments
6974 <ul>
6975 <li><li>not a li-hack
6976 </li>
6977 </ul>
6978 !! html
6979 <ul>
6980 <li> foo</li>
6981 <li>li-hack</li>
6982 <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>
6983 <li> <!--foo--> </li>
6984 <li> li-hack with preceding comments</li>
6985 </ul>
6987 <ul>
6988 <li></li>
6989 <li>not a li-hack
6990 </li>
6991 </ul>
6992 !!end
6994 !! test
6995 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
6996 !! options
6997 parsoid
6998 !! wikitext
6999 # foo
7000 ## bar
7001 * foo
7002 ** bar
7003 : foo
7004 :: bar
7005 !! html
7006 <ol>
7007 <li> foo<ol>
7008 <li> bar</li>
7009 </ol></li>
7010 </ol><ul>
7011 <li> foo<ul>
7012 <li> bar</li>
7013 </ul></li>
7014 </ul><dl>
7015 <dd> foo<dl>
7016 <dd> bar</dd>
7017 </dl></dd>
7018 </dl>
7019 !! end
7021 !! test
7022 Parsoid: Test of whitespace serialization with Templated bullets
7023 !! options
7024 parsoid
7025 !! wikitext
7026 * {{bullet}}
7027 !! html
7028 <ul>
7029 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7030 </ul>
7031 !! end
7033 # ------------------------------------------------------------------------
7034 # The next set of tests are about Parsoid's ability to handle badly nested
7035 # tags (parse, minimize scope of fixup, and roundtrip back)
7036 # ------------------------------------------------------------------------
7038 !! test
7039 Unbalanced closing block tags break a list
7040 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7041 !! wikitext
7042 <div>
7043 *a</div><div>
7044 *b</div>
7045 !! html/parsoid
7046 <div>
7047 <ul>
7048 <li>a
7049 </li>
7050 </ul></div><div>
7051 <ul>
7052 <li>b
7053 </li>
7054 </ul></div>
7055 !! end
7057 !! test
7058 Unbalanced closing non-block tags don't break a list
7059 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7060 !! wikitext
7061 <span>
7062 *a</span><span>
7063 *b</span>
7064 !! html/parsoid
7065 <p><span></span>
7066 </p>
7067 <ul>
7068 <li>a<span></span>
7069 </li>
7070 <li>b
7071 </li>
7072 </ul>
7073 !! end
7075 !! test
7076 Unclosed formatting tags that straddle lists are closed and reopened
7077 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7078 !! wikitext
7079 # <s> a
7080 # b </s>
7081 !! html/parsoid
7082 <ol>
7083 <li> <s> a </s>
7084 </li>
7085 <li> <s> b </s>
7086 </li>
7087 </ol>
7088 !! end
7090 !!test
7091 List embedded in a non-block tag
7092 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7093 !! wikitext
7094 <small>
7095 * foo
7096 </small>
7097 !! html/parsoid
7098 <p><small></small></p>
7099 <small>
7100 <ul>
7101 <li> foo</li>
7102 </ul>
7103 </small>
7104 <p><small></small></p>
7105 !!end
7107 !! test
7108 Table with missing opening <tr> tag
7109 !! options
7110 parsoid=wt2html,wt2wt
7111 !! wikitext
7112 <table>
7113 <td>foo</td>
7114 </tr>
7115 </table>
7116 !! html/parsoid
7117 <table>
7118 <tr>
7119 <td>foo</td>
7120 </tr>
7121 </table>
7122 !! end
7125 ### Magic Words
7128 # Note that the current date is hard-coded as
7129 #   1970-01-01T00:02:03Z (a Thursday)
7130 # when running parser tests.  The timezone is also fixed to GMT, so
7131 # local date will be identical to current date.
7133 !! test
7134 Magic Word: {{CURRENTDAY}}
7135 !! wikitext
7136 {{CURRENTDAY}}
7137 !! html
7138 <p>1
7139 </p>
7140 !! end
7142 !! test
7143 Magic Word: {{CURRENTDAY2}}
7144 !! wikitext
7145 {{CURRENTDAY2}}
7146 !! html
7147 <p>01
7148 </p>
7149 !! end
7151 !! test
7152 Magic Word: {{CURRENTDAYNAME}}
7153 !! wikitext
7154 {{CURRENTDAYNAME}}
7155 !! html
7156 <p>Thursday
7157 </p>
7158 !! end
7160 !! test
7161 Magic Word: {{CURRENTDOW}}
7162 !! wikitext
7163 {{CURRENTDOW}}
7164 !! html
7165 <p>4
7166 </p>
7167 !! end
7169 !! test
7170 Magic Word: {{CURRENTMONTH}}
7171 !! wikitext
7172 {{CURRENTMONTH}}
7173 !! html
7174 <p>01
7175 </p>
7176 !! end
7178 !! test
7179 Magic Word: {{CURRENTMONTH1}}
7180 !! wikitext
7181 {{CURRENTMONTH1}}
7182 !! html
7183 <p>1
7184 </p>
7185 !! end
7187 !! test
7188 Magic Word: {{CURRENTMONTHABBREV}}
7189 !! wikitext
7190 {{CURRENTMONTHABBREV}}
7191 !! html
7192 <p>Jan
7193 </p>
7194 !! end
7196 !! test
7197 Magic Word: {{CURRENTMONTHNAME}}
7198 !! wikitext
7199 {{CURRENTMONTHNAME}}
7200 !! html
7201 <p>January
7202 </p>
7203 !! end
7205 !! test
7206 Magic Word: {{CURRENTMONTHNAMEGEN}}
7207 !! wikitext
7208 {{CURRENTMONTHNAMEGEN}}
7209 !! html
7210 <p>January
7211 </p>
7212 !! end
7214 !! test
7215 Magic Word: {{CURRENTTIME}}
7216 !! wikitext
7217 {{CURRENTTIME}}
7218 !! html
7219 <p>00:02
7220 </p>
7221 !! end
7223 !! test
7224 Magic Word: {{CURRENTHOUR}}
7225 !! wikitext
7226 {{CURRENTHOUR}}
7227 !! html
7228 <p>00
7229 </p>
7230 !! end
7232 !! test
7233 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7234 !! wikitext
7235 {{CURRENTWEEK}}
7236 !! html
7237 <p>1
7238 </p>
7239 !! end
7241 !! test
7242 Magic Word: {{CURRENTYEAR}}
7243 !! wikitext
7244 {{CURRENTYEAR}}
7245 !! html
7246 <p>1970
7247 </p>
7248 !! end
7250 !! test
7251 Magic Word: {{CURRENTTIMESTAMP}}
7252 !! wikitext
7253 {{CURRENTTIMESTAMP}}
7254 !! html
7255 <p>19700101000203
7256 </p>
7257 !! end
7259 !! test
7260 Magic Words LOCAL (UTC)
7261 !! wikitext
7262 * {{LOCALMONTH}}
7263 * {{LOCALMONTH1}}
7264 * {{LOCALMONTHNAME}}
7265 * {{LOCALMONTHNAMEGEN}}
7266 * {{LOCALMONTHABBREV}}
7267 * {{LOCALDAY}}
7268 * {{LOCALDAY2}}
7269 * {{LOCALDAYNAME}}
7270 * {{LOCALYEAR}}
7271 * {{LOCALTIME}}
7272 * {{LOCALHOUR}}
7273 * {{LOCALWEEK}}
7274 * {{LOCALDOW}}
7275 * {{LOCALTIMESTAMP}}
7276 !! html
7277 <ul><li> 01</li>
7278 <li> 1</li>
7279 <li> January</li>
7280 <li> January</li>
7281 <li> Jan</li>
7282 <li> 1</li>
7283 <li> 01</li>
7284 <li> Thursday</li>
7285 <li> 1970</li>
7286 <li> 00:02</li>
7287 <li> 00</li>
7288 <li> 1</li>
7289 <li> 4</li>
7290 <li> 19700101000203</li></ul>
7292 !! end
7294 !! test
7295 Magic Word: {{FULLPAGENAME}}
7296 !! options
7297 title=[[User:Ævar Arnfjörð Bjarmason]]
7298 !! wikitext
7299 {{FULLPAGENAME}}
7300 !! html
7301 <p>User:Ævar Arnfjörð Bjarmason
7302 </p>
7303 !! end
7305 !! test
7306 Magic Word: {{FULLPAGENAMEE}}
7307 !! options
7308 title=[[User:Ævar Arnfjörð Bjarmason]]
7309 !! wikitext
7310 {{FULLPAGENAMEE}}
7311 !! html
7312 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7313 </p>
7314 !! end
7316 !! test
7317 Magic Word: {{TALKSPACE}}
7318 !! options
7319 title=[[User:Ævar Arnfjörð Bjarmason]]
7320 !! wikitext
7321 {{TALKSPACE}}
7322 !! html
7323 <p>User talk
7324 </p>
7325 !! end
7327 !! test
7328 Magic Word: {{TALKSPACE}}, same namespace
7329 !! options
7330 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7331 !! wikitext
7332 {{TALKSPACE}}
7333 !! html
7334 <p>User talk
7335 </p>
7336 !! end
7338 !! test
7339 Magic Word: {{TALKSPACE}}, main namespace
7340 !! options
7341 title=[[Parser Test]]
7342 !! wikitext
7343 {{TALKSPACE}}
7344 !! html
7345 <p>Talk
7346 </p>
7347 !! end
7349 !! test
7350 Magic Word: {{TALKSPACEE}}
7351 !! options
7352 title=[[User:Ævar Arnfjörð Bjarmason]]
7353 !! wikitext
7354 {{TALKSPACEE}}
7355 !! html
7356 <p>User_talk
7357 </p>
7358 !! end
7360 !! test
7361 Magic Word: {{SUBJECTSPACE}}
7362 !! options
7363 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7364 !! wikitext
7365 {{SUBJECTSPACE}}
7366 !! html
7367 <p>User
7368 </p>
7369 !! end
7371 !! test
7372 Magic Word: {{SUBJECTSPACE}}, same namespace
7373 !! options
7374 title=[[User:Ævar Arnfjörð Bjarmason]]
7375 !! wikitext
7376 {{SUBJECTSPACE}}
7377 !! html
7378 <p>User
7379 </p>
7380 !! end
7382 !! test
7383 Magic Word: {{SUBJECTSPACE}}, main namespace
7384 !! options
7385 title=[[Parser Test]]
7386 !! wikitext
7387 {{SUBJECTSPACE}}
7388 !! html
7390 !! end
7392 !! test
7393 Magic Word: {{SUBJECTSPACEE}}
7394 !! options
7395 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7396 !! wikitext
7397 {{SUBJECTSPACEE}}
7398 !! html
7399 <p>User
7400 </p>
7401 !! end
7403 !! test
7404 Magic Word: {{NAMESPACE}}
7405 !! options
7406 title=[[User:Ævar Arnfjörð Bjarmason]]
7407 !! wikitext
7408 {{NAMESPACE}}
7409 !! html
7410 <p>User
7411 </p>
7412 !! end
7414 !! test
7415 Magic Word: {{NAMESPACEE}}
7416 !! options
7417 title=[[User:Ævar Arnfjörð Bjarmason]]
7418 !! wikitext
7419 {{NAMESPACEE}}
7420 !! html
7421 <p>User
7422 </p>
7423 !! end
7425 !! test
7426 Magic Word: {{NAMESPACENUMBER}}
7427 !! options
7428 title=[[User:Ævar Arnfjörð Bjarmason]]
7429 !! wikitext
7430 {{NAMESPACENUMBER}}
7431 !! html
7432 <p>2
7433 </p>
7434 !! end
7436 !! test
7437 Magic Word: {{SUBPAGENAME}}
7438 !! options
7439 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7440 !! wikitext
7441 {{SUBPAGENAME}}
7442 !! html
7443 <p>sub ö
7444 </p>
7445 !! end
7447 !! test
7448 Magic Word: {{SUBPAGENAMEE}}
7449 !! options
7450 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7451 !! wikitext
7452 {{SUBPAGENAMEE}}
7453 !! html
7454 <p>sub_%C3%B6
7455 </p>
7456 !! end
7458 !! test
7459 Magic Word: {{ROOTPAGENAME}}
7460 !! options
7461 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7462 !! wikitext
7463 {{ROOTPAGENAME}}
7464 !! html
7465 <p>Ævar Arnfjörð Bjarmason
7466 </p>
7467 !! end
7469 !! test
7470 Magic Word: {{ROOTPAGENAMEE}}
7471 !! options
7472 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7473 !! wikitext
7474 {{ROOTPAGENAMEE}}
7475 !! html
7476 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7477 </p>
7478 !! end
7480 !! test
7481 Magic Word: {{BASEPAGENAME}}
7482 !! options
7483 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7484 !! wikitext
7485 {{BASEPAGENAME}}
7486 !! html
7487 <p>Ævar Arnfjörð Bjarmason
7488 </p>
7489 !! end
7491 !! test
7492 Magic Word: {{BASEPAGENAMEE}}
7493 !! options
7494 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7495 !! wikitext
7496 {{BASEPAGENAMEE}}
7497 !! html
7498 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7499 </p>
7500 !! end
7502 !! test
7503 Magic Word: {{TALKPAGENAME}}
7504 !! options
7505 title=[[User:Ævar Arnfjörð Bjarmason]]
7506 !! wikitext
7507 {{TALKPAGENAME}}
7508 !! html
7509 <p>User talk:Ævar Arnfjörð Bjarmason
7510 </p>
7511 !! end
7513 !! test
7514 Magic Word: {{TALKPAGENAMEE}}
7515 !! options
7516 title=[[User:Ævar Arnfjörð Bjarmason]]
7517 !! wikitext
7518 {{TALKPAGENAMEE}}
7519 !! html
7520 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7521 </p>
7522 !! end
7524 !! test
7525 Magic Word: {{SUBJECTPAGENAME}}
7526 !! options
7527 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7528 !! wikitext
7529 {{SUBJECTPAGENAME}}
7530 !! html
7531 <p>User:Ævar Arnfjörð Bjarmason
7532 </p>
7533 !! end
7535 !! test
7536 Magic Word: {{SUBJECTPAGENAMEE}}
7537 !! options
7538 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7539 !! wikitext
7540 {{SUBJECTPAGENAMEE}}
7541 !! html
7542 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7543 </p>
7544 !! end
7546 !! test
7547 Magic Word: {{NUMBEROFFILES}}
7548 !! wikitext
7549 {{NUMBEROFFILES}}
7550 !! html
7551 <p>5
7552 </p>
7553 !! end
7555 !! test
7556 Magic Word: {{PAGENAME}}
7557 !! options
7558 title=[[User:Ævar Arnfjörð Bjarmason]]
7559 !! wikitext
7560 {{PAGENAME}}
7561 !! html
7562 <p>Ævar Arnfjörð Bjarmason
7563 </p>
7564 !! end
7566 !! test
7567 Magic Word: {{PAGENAME}} with metacharacters
7568 !! options
7569 title=[['foo & bar = baz']]
7570 !! wikitext
7571 ''{{PAGENAME}}''
7572 !! html
7573 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7574 </p>
7575 !! end
7577 !! test
7578 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7579 !! options
7580 title=[[*RFC 1234 http://example.com/]]
7581 !! wikitext
7582 {{PAGENAME}}
7583 !! html
7584 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7585 </p>
7586 !! end
7588 !! test
7589 Magic Word: {{PAGENAMEE}}
7590 !! options
7591 title=[[User:Ævar Arnfjörð Bjarmason]]
7592 !! wikitext
7593 {{PAGENAMEE}}
7594 !! html
7595 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7596 </p>
7597 !! end
7599 !! test
7600 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7601 !! options
7602 title=[[*RFC 1234 http://example.com/]]
7603 !! wikitext
7604 {{PAGENAMEE}}
7605 !! html
7606 <p>&#42;RFC_1234_http&#58;//example.com/
7607 </p>
7608 !! end
7610 !! test
7611 Magic Word: {{REVISIONID}}
7612 !! wikitext
7613 {{REVISIONID}}
7614 !! html
7615 <p>1337
7616 </p>
7617 !! end
7619 !! test
7620 Magic Word: {{SCRIPTPATH}}
7621 !! wikitext
7622 {{SCRIPTPATH}}
7623 !! html
7624 <p>/
7625 </p>
7626 !! end
7628 !! test
7629 Magic Word: {{STYLEPATH}}
7630 !! wikitext
7631 {{STYLEPATH}}
7632 !! html
7633 <p>/skins
7634 </p>
7635 !! end
7637 !! test
7638 Magic Word: {{SERVER}}
7639 !! wikitext
7640 {{SERVER}}
7641 !! html
7642 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7643 </p>
7644 !! end
7646 !! test
7647 Magic Word: {{SERVERNAME}}
7648 !! wikitext
7649 {{SERVERNAME}}
7650 !! html
7651 <p>example.org
7652 </p>
7653 !! end
7655 !! test
7656 Magic Word: {{SITENAME}}
7657 !! wikitext
7658 {{SITENAME}}
7659 !! html
7660 <p>MediaWiki
7661 </p>
7662 !! end
7664 !! test
7665 Case-sensitive magic words, when cased differently, should just be template transclusions
7666 !! wikitext
7667 {{CurrentMonth}}
7668 {{currentday}}
7669 {{cURreNTweEK}}
7670 {{currentHour}}
7671 !! html
7672 <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>
7673 <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>
7674 <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>
7675 <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>
7676 </p>
7677 !! end
7679 !! test
7680 Case-insensitive magic words should still work with weird casing.
7681 !! wikitext
7682 {{sErVeRNaMe}}
7683 {{LCFirst:AOEU}}
7684 {{ucFIRST:aoeu}}
7685 {{SERver}}
7686 !! html
7687 <p>example.org
7688 aOEU
7689 Aoeu
7690 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7691 </p>
7692 !! end
7694 !! test
7695 Namespace 1 {{ns:1}}
7696 !! wikitext
7697 {{ns:1}}
7698 !! html
7699 <p>Talk
7700 </p>
7701 !! end
7703 !! test
7704 Namespace 1 {{ns:01}}
7705 !! wikitext
7706 {{ns:01}}
7707 !! html
7708 <p>Talk
7709 </p>
7710 !! end
7712 !! test
7713 Namespace 0 {{ns:0}} (bug 4783)
7714 !! wikitext
7715 {{ns:0}}
7716 !! html
7718 !! end
7720 !! test
7721 Namespace 0 {{ns:00}} (bug 4783)
7722 !! wikitext
7723 {{ns:00}}
7724 !! html
7726 !! end
7728 !! test
7729 Namespace -1 {{ns:-1}}
7730 !! wikitext
7731 {{ns:-1}}
7732 !! html
7733 <p>Special
7734 </p>
7735 !! end
7737 !! test
7738 Namespace User {{ns:User}}
7739 !! wikitext
7740 {{ns:User}}
7741 !! html
7742 <p>User
7743 </p>
7744 !! end
7746 !! test
7747 Namespace User talk {{ns:User_talk}}
7748 !! wikitext
7749 {{ns:User_talk}}
7750 !! html
7751 <p>User talk
7752 </p>
7753 !! end
7755 !! test
7756 Namespace User talk {{ns:uSeR tAlK}}
7757 !! wikitext
7758 {{ns:uSeR tAlK}}
7759 !! html
7760 <p>User talk
7761 </p>
7762 !! end
7764 !! test
7765 Namespace File {{ns:File}}
7766 !! wikitext
7767 {{ns:File}}
7768 !! html
7769 <p>File
7770 </p>
7771 !! end
7773 !! test
7774 Namespace File {{ns:Image}}
7775 !! wikitext
7776 {{ns:Image}}
7777 !! html
7778 <p>File
7779 </p>
7780 !! end
7782 !! test
7783 Namespace (lang=de) Benutzer {{ns:User}}
7784 !! options
7785 language=de
7786 !! wikitext
7787 {{ns:User}}
7788 !! html
7789 <p>Benutzer
7790 </p>
7791 !! end
7793 !! test
7794 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7795 !! options
7796 language=de
7797 !! wikitext
7798 {{ns:3}}
7799 !! html
7800 <p>Benutzer Diskussion
7801 </p>
7802 !! end
7805 !! test
7806 Urlencode
7807 !! wikitext
7808 {{urlencode:hi world?!}}
7809 {{urlencode:hi world?!|WIKI}}
7810 {{urlencode:hi world?!|PATH}}
7811 {{urlencode:hi world?!|QUERY}}
7812 !! html
7813 <p>hi+world%3F%21
7814 hi_world%3F!
7815 hi%20world%3F%21
7816 hi+world%3F%21
7817 </p>
7818 !! end
7820 !! test
7821 Magic Word: prioritize type info over data-parsoid
7822 !! options
7823 parsoid=html2wt
7824 !! wikitext
7825 __FORCETOC__
7826 !! html
7827 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
7828 !! end
7830 !! test
7831 Magic Word: serialize on separate line (parsoid)
7832 !! options
7833 parsoid=wt2wt,html2wt
7834 !! wikitext
7836 __NOTOC__
7838 !! html
7839 foo<meta property="mw:PageProp/notoc"/>bar
7840 !! end
7842 !! test
7843 Magic Word: rt non-english wikis
7844 !! options
7845 parsoid=wt2wt
7846 language=de
7847 !! wikitext
7848 __NOEDITSECTION__
7849 !! html
7850 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
7851 !! end
7854 ### Magic links
7856 !! test
7857 Magic links: internal link to RFC (bug 479)
7858 !! wikitext
7859 [[RFC 123]]
7860 !! html
7861 <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>
7862 </p>
7863 !! end
7865 !! test
7866 Magic links: RFC (bug 479)
7867 !! wikitext
7868 RFC 822
7869 !! html
7870 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
7871 </p>
7872 !! end
7874 !! test
7875 Magic links: ISBN (bug 1937)
7876 !! wikitext
7877 ISBN 0-306-40615-2
7878 !! html
7879 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
7880 </p>
7881 !! end
7883 !! test
7884 Magic links: PMID incorrectly converts space to underscore
7885 !! wikitext
7886 PMID 1234
7887 !! html
7888 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
7889 </p>
7890 !! end
7893 ### Templates
7894 ####
7896 !! test
7897 Nonexistent template
7898 !! wikitext
7899 {{thistemplatedoesnotexist}}
7900 !! html
7901 <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>
7902 </p>
7903 !! end
7905 !! test
7906 Template with invalid target containing tags
7907 !! wikitext
7908 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7909 !! html
7910 <p>{{a<b>b</b>|foo|a=b|a = b}}
7911 </p>
7912 !! end
7914 !! test
7915 Template with invalid target containing unclosed tag
7916 !! wikitext
7917 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
7918 !! html
7919 <p>{{a<b>|foo|a=b|a = b}}</b>
7920 </p>
7921 !! end
7923 !! test
7924 Template with invalid target containing wikilink
7925 !! wikitext
7926 {{[[Main Page]]}}
7927 !! html/php
7928 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
7929 </p>
7930 !! html/parsoid
7931 <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>
7932 !! end
7934 !! article
7935 Template:test
7936 !! text
7937 This is a test template
7938 !! endarticle
7940 !! test
7941 Simple template
7942 !! wikitext
7943 {{test}}
7944 !! html
7945 <p>This is a test template
7946 </p>
7947 !! end
7949 !! test
7950 Template with explicit namespace
7951 !! wikitext
7952 {{Template:test}}
7953 !! html
7954 <p>This is a test template
7955 </p>
7956 !! end
7959 !! article
7960 Template:paramtest
7961 !! text
7962 This is a test template with parameter {{{param}}}
7963 !! endarticle
7965 !! test
7966 Template parameter
7967 !! wikitext
7968 {{paramtest|param=foo}}
7969 !! html
7970 <p>This is a test template with parameter foo
7971 </p>
7972 !! end
7974 !! article
7975 Template:paramtestnum
7976 !! text
7977 [[{{{1}}}|{{{2}}}]]
7978 !! endarticle
7980 !! test
7981 Template unnamed parameter
7982 !! wikitext
7983 {{paramtestnum|Main Page|the main page}}
7984 !! html
7985 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
7986 </p>
7987 !! end
7989 !! article
7990 Template:templatesimple
7991 !! text
7992 (test)
7993 !! endarticle
7995 !! article
7996 Template:templateredirect
7997 !! text
7998 #redirect [[Template:templatesimple]]
7999 !! endarticle
8001 !! article
8002 Template:templateasargtestnum
8003 !! text
8004 {{{{{1}}}}}
8005 !! endarticle
8007 !! article
8008 Template:templateasargtest
8009 !! text
8010 {{template{{{templ}}}}}
8011 !! endarticle
8013 !! article
8014 Template:templateasargtest2
8015 !! text
8016 {{{{{templ}}}}}
8017 !! endarticle
8019 !! test
8020 Template with template name as unnamed argument
8021 !! wikitext
8022 {{templateasargtestnum|templatesimple}}
8023 !! html
8024 <p>(test)
8025 </p>
8026 !! end
8028 !! test
8029 Template with template name as argument
8030 !! wikitext
8031 {{templateasargtest|templ=simple}}
8032 !! html
8033 <p>(test)
8034 </p>
8035 !! end
8037 !! test
8038 Template with template name as argument (2)
8039 !! wikitext
8040 {{templateasargtest2|templ=templatesimple}}
8041 !! html
8042 <p>(test)
8043 </p>
8044 !! end
8046 !! article
8047 Template:templateasargtestdefault
8048 !! text
8049 {{{{{templ|templatesimple}}}}}
8050 !! endarticle
8052 !! article
8053 Template:templa
8054 !! text
8055 '''templ'''
8056 !! endarticle
8058 !! test
8059 Template with default value
8060 !! wikitext
8061 {{templateasargtestdefault}}
8062 !! html
8063 <p>(test)
8064 </p>
8065 !! end
8067 !! test
8068 Template with default value (value set)
8069 !! wikitext
8070 {{templateasargtestdefault|templ=templa}}
8071 !! html
8072 <p><b>templ</b>
8073 </p>
8074 !! end
8076 !! test
8077 Template redirect
8078 !! wikitext
8079 {{templateredirect}}
8080 !! html
8081 <p>(test)
8082 </p>
8083 !! end
8085 !! test
8086 Template with argument in separate line
8087 !! wikitext
8088 {{ templateasargtest  |
8089  templ = simple }}
8090 !! html
8091 <p>(test)
8092 </p>
8093 !! end
8095 !! test
8096 Template with complex template as argument
8097 !! wikitext
8098 {{paramtest|
8099   param ={{ templateasargtest  |
8100  templ = simple }}}}
8101 !! html
8102 <p>This is a test template with parameter (test)
8103 </p>
8104 !! end
8106 !! test
8107 Template with thumb image (with link in description)
8108 !! wikitext
8109 {{paramtest|
8110   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8111 !! html
8112 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>
8114 !! end
8116 !! article
8117 Template:complextemplate
8118 !! text
8119 {{{1}}} {{paramtest|
8120   param ={{{param}}}}}
8121 !! endarticle
8123 !! test
8124 Template with complex arguments
8125 !! wikitext
8126 {{complextemplate|
8127   param ={{ templateasargtest  |
8128  templ = simple }}|[[Template:complextemplate|link]]}}
8129 !! html
8130 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8131 </p>
8132 !! end
8134 !! test
8135 BUG 553: link with two variables in a piped link
8136 !! wikitext
8138 |[[{{{1}}}|{{{2}}}]]
8140 !! html
8141 <table>
8142 <tr>
8143 <td>[[{{{1}}}|{{{2}}}]]
8144 </td></tr></table>
8146 !! end
8148 !! test
8149 Magic variable as template parameter
8150 !! wikitext
8151 {{paramtest|param={{SITENAME}}}}
8152 !! html
8153 <p>This is a test template with parameter MediaWiki
8154 </p>
8155 !! end
8157 !! article
8158 Template:linktest
8159 !! text
8160 [[{{{param}}}|link]]
8161 !! endarticle
8163 !! test
8164 Template parameter as link source
8165 !! wikitext
8166 {{linktest|param=Main Page}}
8167 !! html
8168 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8169 </p>
8170 !! end
8172 !!test
8173 Template-generated attribute string (k='v')
8174 !! wikitext
8175 <span {{attr_str|id|v1}}>bar</span>
8176 !! html
8177 <p><span id="v1">bar</span>
8178 </p>
8179 !!end
8181 !!article
8182 Template:paramtest2
8183 !! text
8184 including another template, {{paramtest|param={{{arg}}}}}
8185 !! endarticle
8187 !! test
8188 Template passing argument to another template
8189 !! wikitext
8190 {{paramtest2|arg='hmm'}}
8191 !! html
8192 <p>including another template, This is a test template with parameter 'hmm'
8193 </p>
8194 !! end
8196 !! article
8197 Template:Linktest2
8198 !! text
8199 Main Page
8200 !! endarticle
8202 !! test
8203 Template as link source
8204 !! wikitext
8205 [[{{linktest2}}]]
8207 [[{{linktest2}}|Main Page]]
8209 [[{{linktest2}}]]Page
8210 !! html
8211 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8212 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8213 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8214 </p>
8215 !! end
8218 !! article
8219 Template:loop1
8220 !! text
8221 {{loop2}}
8222 !! endarticle
8224 !! article
8225 Template:loop2
8226 !! text
8227 {{loop1}}
8228 !! endarticle
8230 !! test
8231 Template infinite loop
8232 !! wikitext
8233 {{loop1}}
8234 !! html
8235 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8236 </p>
8237 !! end
8239 !! test
8240 Template from main namespace
8241 !! wikitext
8242 {{:Main Page}}
8243 !! html
8244 <p>blah blah
8245 </p>
8246 !! end
8248 !! article
8249 Template:table
8250 !! text
8252 | 1 || 2
8254 | 3 || 4
8256 !! endarticle
8258 !! test
8259 BUG 529: Template with table, not included at beginning of line
8260 !! wikitext
8261 foo {{table}}
8262 !! html
8263 <p>foo 
8264 </p>
8265 <table>
8266 <tr>
8267 <td> 1 </td>
8268 <td> 2
8269 </td></tr>
8270 <tr>
8271 <td> 3 </td>
8272 <td> 4
8273 </td></tr></table>
8275 !! end
8277 !! test
8278 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8279 !! wikitext
8281 {{table}}
8282 !! html
8283 <p>foo
8284 </p>
8285 <table>
8286 <tr>
8287 <td> 1 </td>
8288 <td> 2
8289 </td></tr>
8290 <tr>
8291 <td> 3 </td>
8292 <td> 4
8293 </td></tr></table>
8295 !! end
8297 !! test
8298 BUG 41: Template parameters shown as broken links
8299 !! wikitext
8300 {{{parameter}}}
8301 !! html
8302 <p>{{{parameter}}}
8303 </p>
8304 !! end
8306 !! test
8307 Template with targets containing wikilinks
8308 !! wikitext
8309 {{[[foo]]}}
8311 {{[[{{echo|foo}}]]}}
8313 {{{{echo|[[foo}}]]}}
8314 !! html
8315 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8316 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8317 </p><p>{{[[foo}}]]
8318 </p>
8319 !! end
8321 !! article
8322 Template:MSGNW test
8323 !! text
8324 ''None'' of '''this''' should be 
8325 * interpreted
8326  but rather passed unmodified
8327 {{test}}
8328 <gallery>
8329 File:Foobar.jpg
8330 </gallery>
8331 !! endarticle
8333 # hmm, fix this or just deprecate msgnw and document its behavior?
8334 !! test
8335 msgnw keyword
8336 !! wikitext
8337 {{msgnw:MSGNW test}}
8338 !! html
8339 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
8340 &#42; interpreted
8341 &#32;but rather passed unmodified
8342 &#123;&#123;test&#125;&#125;
8343 &#60;gallery&#62;
8344 File:Foobar.jpg
8345 &#60;/gallery&#62;
8346 </p>
8347 !! end
8349 !! test
8350 int keyword
8351 !! wikitext
8352 {{int:youhavenewmessages|lots of money|not!}}
8353 !! html
8354 <p>You have lots of money (not!).
8355 </p>
8356 !! end
8358 !! article
8359 Template:Includes
8360 !! text
8361 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8362 !! endarticle
8364 !! test
8365 <includeonly> and <noinclude> being included
8366 !! wikitext
8367 {{Includes}}
8368 !! html
8369 <p>Foobar
8370 </p>
8371 !! end
8373 !! article
8374 Template:Includes2
8375 !! text
8376 <onlyinclude>Foo</onlyinclude>bar
8377 !! endarticle
8379 !! test
8380 <onlyinclude> being included
8381 !! wikitext
8382 {{Includes2}}
8383 !! html
8384 <p>Foo
8385 </p>
8386 !! end
8389 !! article
8390 Template:Includes3
8391 !! text
8392 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8393 !! endarticle
8395 !! test
8396 <onlyinclude> and <includeonly> being included
8397 !! wikitext
8398 {{Includes3}}
8399 !! html
8400 <p>Foo
8401 </p>
8402 !! end
8404 !! test
8405 <includeonly> and <noinclude> on a page
8406 !! wikitext
8407 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8408 !! html
8409 <p>Foozar
8410 </p>
8411 !! end
8413 !! test
8414 Un-closed <noinclude>
8415 !! wikitext
8416 <noinclude>
8417 !! html
8418 !! end
8420 !! test
8421 <onlyinclude> on a page
8422 !! wikitext
8423 <onlyinclude>Foo</onlyinclude>bar
8424 !! html
8425 <p>Foobar
8426 </p>
8427 !! end
8429 !! test
8430 Un-closed <onlyinclude>
8431 !! wikitext
8432 <onlyinclude>
8433 !! html
8434 !! end
8436 !!test
8437 Self-closed noinclude, includeonly, onlyinclude tags
8438 !! wikitext
8439 <noinclude />
8440 <includeonly />
8441 <onlyinclude />
8442 !! html
8443 <p><br />
8444 </p>
8445 !!end
8447 !!test
8448 Unbalanced includeonly and noinclude tags
8449 !! wikitext
8451 |a</noinclude>
8452 |b</noinclude></noinclude>
8453 |c</noinclude></includeonly>
8454 |d</includeonly></includeonly>
8456 !! html
8457 <table>
8458 <tr>
8459 <td>a
8460 </td>
8461 <td>b
8462 </td>
8463 <td>c&lt;/includeonly&gt;
8464 </td>
8465 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8466 </td></tr></table>
8468 !!end
8470 !! article
8471 Template:Includeonly section
8472 !! text
8473 <includeonly>
8474 ==Includeonly section==
8475 </includeonly>
8476 ==Section T-1==
8477 !!endarticle
8479 !! test
8480 Bug 6563: Edit link generation for section shown by <includeonly>
8481 !! wikitext
8482 {{includeonly section}}
8483 !! html
8484 <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>
8485 <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>
8487 !! end
8489 # Uses same input as the contents of [[Template:Includeonly section]]
8490 !! test
8491 Bug 6563: Section extraction for section shown by <includeonly>
8492 !! options
8493 section=T-2
8494 !! wikitext
8495 <includeonly>
8496 ==Includeonly section==
8497 </includeonly>
8498 ==Section T-2==
8499 !! html
8500 ==Section T-2==
8501 !! end
8503 !! test
8504 Bug 6563: Edit link generation for section suppressed by <includeonly>
8505 !! wikitext
8506 <includeonly>
8507 ==Includeonly section==
8508 </includeonly>
8509 ==Section 1==
8510 !! html
8511 <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>
8513 !! end
8515 !! test
8516 Bug 6563: Section extraction for section suppressed by <includeonly>
8517 !! options
8518 section=1
8519 !! wikitext
8520 <includeonly>
8521 ==Includeonly section==
8522 </includeonly>
8523 ==Section 1==
8524 !! html
8525 ==Section 1==
8526 !! end
8528 !! test
8529 Un-closed <includeonly>
8530 !! wikitext
8531 <includeonly>
8532 !! html
8533 !! end
8535 # TODO: test with DOM fragment reuse!
8536 !! test
8537 Parsoid: DOM fragment reuse
8538 !! options
8539 parsoid=wt2wt,wt2html
8540 !! wikitext
8541 a{{echo|b<table></table>c}}d
8543 a{{echo|b
8544 <table></table>
8545 c}}d
8547 {{echo|a
8549 <table></table>
8552 !! html
8553 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8554 <table></table>c"}},"i":0}}]}'>b</span>
8555 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8558 <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">
8559 </span>
8560 <table about="#mwt2"></table><span about="#mwt2">
8561 </span>
8562 <p about="#mwt2">cd</p>
8565 <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">
8567 </span>
8568 <table about="#mwt3"></table><span about="#mwt3">
8570 </span>
8571 <p about="#mwt3">b</p>
8572 !! end
8574 !! test
8575 Parsoid: Merge double tds (bug 50603)
8576 !! options
8577 parsoid
8578 !! wikitext
8580 |{{echo|{{!}} foo}}
8582 !! html
8583 <table><tbody>
8584 <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>
8585 </tbody></table>
8586 !! end
8588 !! test
8589 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8590 !! options
8591 parsoid
8592 !! wikitext
8593 {{echo|<div>}}
8595 |{{echo|{{!}} foo}}
8597 {{echo|</div>}}
8598 !! html
8599 <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}}]}'>
8600 <table><tbody>
8601 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8602 </tbody></table>
8603 </div>
8604 !! end
8607 ### <includeonly> and <noinclude> in attributes
8609 !!test
8610 0. includeonly around the entire attribute
8611 !! wikitext
8612 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8613 !! html
8614 <p><span id="v2">bar</span>
8615 </p>
8616 !!end
8618 !!test
8619 1. includeonly in html attr key
8620 !! wikitext
8621 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8622 !! html
8623 <p><span id="foo">bar</span>
8624 </p>
8625 !!end
8627 !!test
8628 2. includeonly in html attr value
8629 !! wikitext
8630 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8631 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8632 !! html
8633 <p><span id="v1">bar</span>
8634 <span id="v1">bar</span>
8635 </p>
8636 !!end
8638 !!test
8639 3. includeonly in part of an attr value
8640 !! wikitext
8641 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8642 !! html
8643 <p><span style="color:red;">bar</span>
8644 </p>
8645 !!end
8647 !!test
8648 4. includeonly in table attributes
8649 !! wikitext
8651 |- <noinclude>
8654 </noinclude>
8655 |- <includeonly>
8658 </includeonly>
8660 !! html
8661 <table>
8664 <tr>
8665 <td>a
8666 </td></tr>
8667 </table>
8669 !!end
8672 ### Token Stream Patcher tests
8674 ### These tests won't always pass wt2wt and other modes because
8675 ### on serialization, the table will be output on a new line.
8676 ### For now, we are blacklisting them, and using this to test selser.
8679 !!test
8680 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8681 !!options
8682 parsoid=wt2html,wt2wt
8683 !!wikitext
8684 {{echo|}}{| width = '100%'
8685 |foo
8687 !!html/parsoid
8688 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8689 <table width="100%">
8690 <tbody>
8691 <tr>
8692 <td>foo</td></tr></tbody></table>
8693 !!end
8695 !!test
8696 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8697 !!options
8698 parsoid=wt2html,wt2wt
8699 !!wikitext
8700 <includeonly>a</includeonly>{| {{{b}}}
8703 !!html/parsoid
8704 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":"&lt;/includeonly>"}'/><span data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>{{{b}}}</span><table about="#mwt1" typeof="mw:Param" data-parsoid='{"a":{" ":null},"sa":{" ":""},"src":"{| {{{b}}}\n|c\n|}"}'>
8705 <tbody><tr><td>c</td></tr>
8706 </tbody></table>
8707 !!end
8710 ### Testing parsing of templates where a template arg
8711 ### has the same name as the template itself.
8714 !! article
8715 Template:quote
8716 !! text
8717 {{{quote|{{{1}}}}}}
8718 !! endarticle
8720 !!test
8721 Templates: Template Name/Arg clash: 1. Use of positional param
8722 !! wikitext
8723 {{quote|foo}}
8724 !! html
8725 <p>foo
8726 </p>
8727 !!end
8729 !!test
8730 Templates: Template Name/Arg clash: 2. Use of named param
8731 !! wikitext
8732 {{quote|quote=foo}}
8733 !! html
8734 <p>foo
8735 </p>
8736 !!end
8738 !!test
8739 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8740 !! wikitext
8741 {{quote|quote}}
8742 !! html
8743 <p>quote
8744 </p>
8745 !!end
8748 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8751 !!test
8752 Templates: 1. Simple use
8753 !! wikitext
8754 {{echo|Foo}}
8755 !! html
8756 <p>Foo
8757 </p>
8758 !!end
8760 !!test
8761 Templates: 2. Inside a block tag
8762 !! wikitext
8763 <div>{{echo|Foo}}</div>
8764 <blockquote>{{echo|Foo}}</blockquote>
8765 !! html
8766 <div>Foo</div>
8767 <blockquote>Foo</blockquote>
8769 !!end
8771 !!test
8772 Templates: P-wrapping: 1a. Templates on consecutive lines
8773 !! wikitext
8774 {{echo|Foo}}
8775 {{echo|bar}}
8776 !! html
8777 <p>Foo
8779 </p>
8780 !!end
8782 !!test
8783 Templates: P-wrapping: 1b. Templates on consecutive lines
8784 !! wikitext
8787 {{echo|bar}}
8788 {{echo|baz}}
8789 !! html
8790 <p>Foo
8791 </p><p>bar
8793 </p>
8794 !!end
8796 !!test
8797 Templates: P-wrapping: 1c. Templates on consecutive lines
8798 !! wikitext
8799 {{echo|Foo}}
8800 {{echo|bar}} <div>baz</div>
8801 !! html
8802 <p>Foo
8803 </p>
8804 bar <div>baz</div>
8806 !!end
8808 !!test
8809 Templates: P-wrapping: 1d. Template preceded by comment-only line
8810 !!options
8811 parsoid
8812 !! wikitext
8813 <!-- foo -->
8814 {{echo|Bar}}
8815 !! html
8816 <!-- foo -->
8818 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
8819 !!end
8821 !!test
8822 Templates: Inline Text: 1. Multiple template uses
8823 !! wikitext
8824 {{echo|Foo}}bar{{echo|baz}}
8825 !! html
8826 <p>Foobarbaz
8827 </p>
8828 !!end
8830 !!test
8831 Templates: Inline Text: 2. Back-to-back template uses
8832 !! wikitext
8833 {{echo|Foo}}{{echo|bar}}
8834 !! html
8835 <p>Foobar
8836 </p>
8837 !!end
8839 !!test
8840 Templates: Block Tags: 1. Multiple template uses
8841 !! wikitext
8842 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
8843 !! html
8844 <div>Foo</div><div>bar</div><div>baz</div>
8846 !!end
8848 !!test
8849 Templates: Block Tags: 2. Back-to-back template uses
8850 !! wikitext
8851 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
8852 !! html
8853 <div>Foo</div><div>bar</div>
8855 !!end
8857 !!test
8858 Templates: Links: 1. Simple example
8859 !! wikitext
8860 {{echo|[[Foo|bar]]}}
8861 !! html
8862 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8863 </p>
8864 !!end
8866 !!test
8867 Templates: Links: 2. Generation of link href
8868 !! wikitext
8869 [[{{echo|Foo}}|bar]]
8870 !! html
8871 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8872 </p>
8873 !!end
8875 !!test
8876 Templates: Links: 3. Generation of part of a link href
8877 !! wikitext
8878 [[Fo{{echo|o}}|bar]]
8880 [[Foo{{echo|bar}}]]
8882 [[Foo{{echo|bar}}baz]]
8884 [[Foo{{echo|bar}}|bar]]
8886 [[:Foo{{echo|bar}}]]
8888 [[:Foo{{echo|bar}}|bar]]
8889 !! html
8890 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8891 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8892 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
8893 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8894 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8895 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
8896 </p>
8897 !!end
8899 !!test
8900 Templates: Links: 4. Multiple templates generating link href
8901 !! wikitext
8902 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
8903 !! html
8904 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
8905 </p>
8906 !!end
8908 !!test
8909 Templates: Links: 5. Generation of link text
8910 !! wikitext
8911 [[Foo|{{echo|bar}}]]
8912 !! html
8913 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8914 </p>
8915 !!end
8917 !!test
8918 Templates: Links: 5. Nested templates (only outermost template should be marked)
8919 !! wikitext
8920 {{echo|[[{{echo|Foo}}|bar]]}}
8921 !! html
8922 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
8923 </p>
8924 !!end
8926 !!test
8927 Templates: HTML Tag: 1. Generation of HTML attr. key
8928 !! wikitext
8929 <div {{echo|style}}="color:red;">foo</div>
8930 !! html
8931 <div style="color:red;">foo</div>
8933 !!end
8935 !!test
8936 Templates: HTML Tag: 2. Generation of HTML attr. value
8937 !! wikitext
8938 <div style={{echo|'color:red;'}}>foo</div>
8939 !! html
8940 <div style="color:red;">foo</div>
8942 !!end
8944 !!test
8945 Templates: HTML Tag: 3. Generation of HTML attr key and value
8946 !! wikitext
8947 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
8948 !! html
8949 <div style="color:red;">foo</div>
8951 !!end
8953 !!test
8954 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
8955 !! wikitext
8956 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
8957 !! html
8958 <div title="This is a long title with just one piece templated">foo</div>
8960 !!end
8962 !!test
8963 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
8964 !! wikitext
8965 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
8966 !! html
8967 <div title="This is a long title with just one piece templated">foo</div>
8969 !!end
8971 !!test
8972 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
8973 !! wikitext
8974 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
8975 !! html
8976 <div title="This is a long title with just one piece templated">foo</div>
8978 !!end
8980 !!test
8981 Templates: HTML Tag: 7. Generation of partial attribute key string
8982 !! wikitext
8983 <div st{{echo|yle}}="color:red;">foo</div>
8984 !! html
8985 <div style="color:red;">foo</div>
8987 !!end
8989 !!test
8990 Templates: HTML Tables: 1. Generating start of a HTML table
8991 !! wikitext
8992 {{echo|<table><tr><td>foo</td>}}</tr></table>
8993 !! html
8994 <table><tr><td>foo</td></tr></table>
8996 !!end
8998 !!test
8999 Templates: HTML Tables: 2a. Generating middle of a HTML table
9000 !! wikitext
9001 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9002 !! html
9003 <table><tr><td>foo</td></tr></table>
9005 !!end
9007 !!test
9008 Templates: HTML Tables: 2b. Generating middle of a HTML table
9009 !! wikitext
9010 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9011 !! html
9012 <table><tr><td>foo</td></tr></table>
9014 !!end
9016 !!test
9017 Templates: HTML Tables: 3. Generating end of a HTML table
9018 !! wikitext
9019 <table><tr>{{echo|<td>foo</td></tr></table>}}
9020 !! html
9021 <table><tr><td>foo</td></tr></table>
9023 !!end
9025 !!test
9026 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9027 !! wikitext
9028 {{echo|<table>}}<tr><td>foo</td></tr></table>
9029 !! html
9030 <table><tr><td>foo</td></tr></table>
9032 !!end
9034 !!test
9035 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9036 !! wikitext
9037 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9038 !! html
9039 <table><tr><td>foo</td></tr></table>
9041 !!end
9043 !!test
9044 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9045 !! wikitext
9046 <table><tr>{{echo|<td>}}foo</td></tr></table>
9047 !! html
9048 <table><tr><td>foo</td></tr></table>
9050 !!end
9052 !!test
9053 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9054 !! wikitext
9055 <table><tr><td>foo{{echo|</td>}}</tr></table>
9056 !! html
9057 <table><tr><td>foo</td></tr></table>
9059 !!end
9061 !!test
9062 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9063 !! wikitext
9064 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9065 !! html
9066 <table><tr><td>foo</td></tr></table>
9068 !!end
9070 !!test
9071 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9072 !! wikitext
9073 <table><tr><td>foo</td></tr>{{echo|</table>}}
9074 !! html
9075 <table><tr><td>foo</td></tr></table>
9077 !!end
9079 !!test
9080 Templates: HTML Tables: 5. Proper fostering of categories from inside
9081 !!options
9082 parsoid=wt2html,wt2wt
9083 !! wikitext
9084 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9085 <!--Two categories (Bug 50330)-->
9086 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9087 !! html
9088 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9089 <!--Two categories (Bug 50330)-->
9090 <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>
9091 !!end
9093 !!test
9094 Templates: Wiki Tables: 1a. Fostering of entire template content
9095 !! wikitext
9097 {{echo|a}}
9099 !! html
9100 <table>
9102 <tr><td></td></tr></table>
9104 !!end
9106 !!test
9107 Templates: Wiki Tables: 1b. Fostering of entire template content
9108 !! wikitext
9110 {{echo|<div>}}
9112 {{echo|</div>}}
9114 !! html
9115 <table>
9116 <div>
9117 <p>foo
9118 </p>
9119 </div>
9120 <tr><td></td></tr></table>
9122 !!end
9124 !!test
9125 Templates: Wiki Tables: 2. Fostering of partial template content
9126 !! wikitext
9128 {{echo|a
9129 <div>b</div>}}
9131 !! html
9132 <table>
9134 <div>b</div>
9135 <tr><td></td></tr></table>
9137 !!end
9139 !!test
9140 Templates: Wiki Tables: 3. td-content via multiple templates
9141 !! wikitext
9143 {{echo|{{pipe}}a}}{{echo|b}}
9145 !! html
9146 <table>
9147 <tr>
9148 <td>ab
9149 </td></tr></table>
9151 !!end
9153 !!test
9154 Templates: Wiki Tables: 4. Templated tags, no content
9155 !! wikitext
9156 {{tbl-start}}
9157 {{tbl-end}}
9158 !! html
9159 <table>
9160 <tr><td></td></tr></table>
9162 !!end
9164 !!test
9165 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9166 !! wikitext
9167 {{tbl-start}}
9168 |foo
9169 {{tbl-end}}
9170 !! html
9171 <table>
9172 <tr>
9173 <td>foo
9174 </td></tr></table>
9176 !!end
9178 !!test
9179 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9180 !! wikitext
9181 {{tbl-start}}
9182 {{!}}foo
9183 {{tbl-end}}
9184 !! html
9185 <table>
9186 <tr>
9187 <td>foo
9188 </td></tr></table>
9190 !!end
9192 !!test
9193 Templates: Lists: Multi-line list-items via templates
9194 !! wikitext
9195 *{{echo|a {{nonexistent|
9196 unused}}}}
9197 *{{echo|b {{nonexistent|
9198 unused}}}}
9199 !! html
9200 <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>
9201 <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>
9203 !!end
9205 !!test
9206 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9207 !! wikitext
9208 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9209 !! html
9210 <p><i>ab</i>c<i>d</i>e
9211 </p>
9212 !!end
9214 !!test
9215 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9216 (PHP parser generates misnested html)
9217 !! wikitext
9218 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9219 !! html/parsoid
9220 <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>
9221 !!end
9223 !!test
9224 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9225 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9226 !! options
9227 parsoid=wt2html,wt2wt
9228 !! wikitext
9229 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9230 !! html
9231 <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>
9232 <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>
9233 <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>
9234 !!end
9236 !!test
9237 Templates: Ugly nesting: 4. Divs opened/closed across templates
9238 !! wikitext
9239 a<div>b{{echo|c</div>d}}e
9240 !! html
9241 a<div>bc</div>de
9243 !!end
9245 !!test
9246 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9247 (Parsoid-centric)
9248 !! options
9249 parsoid
9250 !! wikitext
9252 |{{echo|foo</table>}}
9253 |bar
9255 !! html
9256 <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|}"]}'>
9258 <tbody>
9259 <tr>
9260 <td>foo</td></tr></tbody></table><span about="#mwt1">
9261 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9262 |}</span>
9263 !!end
9265 !!test
9266 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9267 (Parsoid-centric)
9268 !! options
9269 parsoid
9270 !! wikitext
9271 <table>
9272   <tr>
9273     <td>
9274     <table>
9275       <tr>
9276         <td>1. {{echo|foo </table>}}</td>
9277         <td> bar </td>
9278         <td>2. {{echo|baz </table>}}</td>
9279       </tr>
9280       <tr>
9281         <td>abc</td>
9282       </tr>
9283     </table>
9284     </td>
9285   </tr>
9286   <tr>
9287     <td>xyz</td>
9288   </tr>
9289 </table>
9290 !! html
9291 <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>"]}'>
9292   <tbody><tr>
9293     <td>
9294     <table>
9295       <tbody><tr>
9296         <td>1. foo </td></tr></tbody></table></td>
9297         <td> bar </td>
9298         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9299       </span><span about="#mwt2">
9300       </span><span about="#mwt2">
9301         </span><span about="#mwt2">abc</span><span about="#mwt2">
9302       </span><span about="#mwt2">
9303     </span><span about="#mwt2">
9304     </span><span about="#mwt2">
9305   </span><span about="#mwt2">
9306   </span><span about="#mwt2">
9307     </span><span about="#mwt2">xyz</span><span about="#mwt2">
9308   </span><span about="#mwt2">
9309 </span>
9310 !!end
9312 !! test
9313 Templates: Ugly templates: 3. newline-only template parameter
9314 !! wikitext
9315 foo {{echo|
9317 !! html
9318 <p>foo 
9319 </p>
9320 !! end
9322 # This looks like a bug: a single newline triggers p/br for some reason.
9323 !! test
9324 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9325 !! wikitext
9326 {{echo|
9328 !! html
9329 <p><br />
9330 </p>
9331 !! end
9333 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9334 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9335 !! test
9336 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9337 !! wikitext
9338 {{echo|<table>}}
9339 {{echo|<div>foo}}
9340 {{echo|</table>}}
9341 !! html/parsoid
9342 <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
9343 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9344 </table>
9345 !! end
9347 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9348 # that are "identical" and generate nesting cycles in the algorithm
9349 !! test
9350 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9351 !! wikitext
9352 {{echo|<table><tr><td><table>}}
9353 {{echo|<div>}}
9354 {{echo|</div>}}
9355 !! html/parsoid
9356 <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"}'>
9357 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9358 </table></td></tr></tbody></table>
9359 !! end
9361 !!test
9362 Parser Functions: 1. Simple example
9363 !! wikitext
9364 {{uc:foo}}
9365 !! html
9366 <p>FOO
9367 </p>
9368 !!end
9370 !!test
9371 Parser Functions: 2. Nested use (only outermost should be marked up)
9372 !! wikitext
9373 {{uc:{{lc:FOO}}}}
9374 !! html
9375 <p>FOO
9376 </p>
9377 !!end
9380 ### Pre-save transform tests
9382 !! test
9383 pre-save transform: subst:
9384 !! options
9386 !! wikitext
9387 {{subst:test}}
9388 !! html
9389 This is a test template
9390 !! end
9392 !! test
9393 pre-save transform: normal template
9394 !! options
9396 !! wikitext
9397 {{test}}
9398 !! html
9399 {{test}}
9400 !! end
9402 !! test
9403 pre-save transform: nonexistent template
9404 !! options
9406 !! wikitext
9407 {{thistemplatedoesnotexist}}
9408 !! html
9409 {{thistemplatedoesnotexist}}
9410 !! end
9413 !! test
9414 pre-save transform: subst magic variables
9415 !! options
9417 !! wikitext
9418 {{subst:SITENAME}}
9419 !! html
9420 MediaWiki
9421 !! end
9423 # This is bug 89, which I fixed. -- wtm
9424 !! test
9425 pre-save transform: subst: templates with parameters
9426 !! options
9428 !! wikitext
9429 {{subst:paramtest|param="something else"}}
9430 !! html
9431 This is a test template with parameter "something else"
9432 !! end
9434 !! article
9435 Template:nowikitest
9436 !! text
9437 <nowiki>'''not wiki'''</nowiki>
9438 !! endarticle
9440 !! test
9441 pre-save transform: nowiki in subst (bug 1188)
9442 !! options
9444 !! wikitext
9445 {{subst:nowikitest}}
9446 !! html
9447 <nowiki>'''not wiki'''</nowiki>
9448 !! end
9451 !! article
9452 Template:commenttest
9453 !! text
9454 This template has <!-- a comment --> in it.
9455 !! endarticle
9457 !! test
9458 pre-save transform: comment in subst (bug 1936)
9459 !! options
9461 !! wikitext
9462 {{subst:commenttest}}
9463 !! html
9464 This template has <!-- a comment --> in it.
9465 !! end
9467 !! test
9468 pre-save transform: unclosed tag
9469 !! options
9470 pst noxml
9471 !! wikitext
9472 <nowiki>'''not wiki'''
9473 !! html
9474 <nowiki>'''not wiki'''
9475 !! end
9477 !! test
9478 pre-save transform: mixed tag case
9479 !! options
9480 pst noxml
9481 !! wikitext
9482 <NOwiki>'''not wiki'''</noWIKI>
9483 !! html
9484 <NOwiki>'''not wiki'''</noWIKI>
9485 !! end
9487 !! test
9488 pre-save transform: unclosed comment in <nowiki>
9489 !! options
9490 pst noxml
9491 !! wikitext
9492 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9493 !! html
9494 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9495 !!end
9497 # Leading @ in this template definition works around a limitation
9498 # in parsoid's parserTests which otherwise strips the <span> from the
9499 # result (confusing it for a template wrapper)
9500 !! article
9501 Template:dangerous
9502 !!text
9503 @<span onmouseover="alert('crap')">Oh no</span>
9504 !!endarticle
9506 !!test
9507 (confirming safety of fix for subst bug 1936)
9508 !! wikitext
9509 {{Template:dangerous}}
9510 !! html
9511 <p>@<span>Oh no</span>
9512 </p>
9513 !! end
9515 !! test
9516 pre-save transform: comment containing gallery (bug 5024)
9517 !! options
9519 !! wikitext
9520 <!-- <gallery>data</gallery> -->
9521 !! html
9522 <!-- <gallery>data</gallery> -->
9523 !!end
9525 !! test
9526 pre-save transform: comment containing extension
9527 !! options
9529 !! wikitext
9530 <!-- <tag>data</tag> -->
9531 !! html
9532 <!-- <tag>data</tag> -->
9533 !!end
9535 !! test
9536 pre-save transform: comment containing nowiki
9537 !! options
9539 !! wikitext
9540 <!-- <nowiki>data</nowiki> -->
9541 !! html
9542 <!-- <nowiki>data</nowiki> -->
9543 !!end
9545 !! test
9546 pre-save transform: <noinclude> in subst (bug 3298)
9547 !! options
9549 !! wikitext
9550 {{subst:Includes}}
9551 !! html
9552 Foobar
9553 !! end
9555 !! test
9556 pre-save transform: <onlyinclude> in subst (bug 3298)
9557 !! options
9559 !! wikitext
9560 {{subst:Includes2}}
9561 !! html
9563 !! end
9565 !! article
9566 Template:SubstTest
9567 !!text
9568 {{<includeonly>subst:</includeonly>Includes}}
9569 !! endarticle
9571 !! article
9572 Template:SafeSubstTest
9573 !! text
9574 {{<includeonly>safesubst:</includeonly>Includes}}
9575 !! endarticle
9577 !! test
9578 bug 22297: safesubst: works during PST
9579 !! options
9581 !! wikitext
9582 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9583 !! html
9584 FoobarFoobar
9585 !! end
9587 !! test
9588 bug 22297: safesubst: works during normal parse
9589 !! wikitext
9590 {{SafeSubstTest}}
9591 !! html
9592 <p>Foobar
9593 </p>
9594 !! end
9596 !! test
9597 subst: does not work during normal parse
9598 !! wikitext
9599 {{SubstTest}}
9600 !! html
9601 <p>{{subst:Includes}}
9602 </p>
9603 !! end
9605 !! test
9606 pre-save transform: context links ("pipe trick")
9607 !! options
9609 !! wikitext
9610 [[Article (context)|]]
9611 [[Bar:Article|]]
9612 [[:Bar:Article|]]
9613 [[Bar:Article (context)|]]
9614 [[:Bar:Article (context)|]]
9615 [[|Article]]
9616 [[|Article (context)]]
9617 [[Bar:X (Y) Z|]]
9618 [[:Bar:X (Y) Z|]]
9619 !! html
9620 [[Article (context)|Article]]
9621 [[Bar:Article|Article]]
9622 [[:Bar:Article|Article]]
9623 [[Bar:Article (context)|Article]]
9624 [[:Bar:Article (context)|Article]]
9625 [[Article]]
9626 [[Article (context)]]
9627 [[Bar:X (Y) Z|X (Y) Z]]
9628 [[:Bar:X (Y) Z|X (Y) Z]]
9629 !! end
9631 !! test
9632 pre-save transform: context links ("pipe trick") with interwiki prefix
9633 !! options
9635 !! wikitext
9636 [[interwiki:Article|]]
9637 [[:interwiki:Article|]]
9638 [[interwiki:Bar:Article|]]
9639 [[:interwiki:Bar:Article|]]
9640 !! html
9641 [[interwiki:Article|Article]]
9642 [[:interwiki:Article|Article]]
9643 [[interwiki:Bar:Article|Bar:Article]]
9644 [[:interwiki:Bar:Article|Bar:Article]]
9645 !! end
9647 !! test
9648 pre-save transform: context links ("pipe trick") with parens in title
9649 !! options
9650 pst title=[[Somearticle (context)]]
9651 !! wikitext
9652 [[|Article]]
9653 !! html
9654 [[Article (context)|Article]]
9655 !! end
9657 !! test
9658 pre-save transform: context links ("pipe trick") with comma in title
9659 !! options
9660 pst title=[[Someplace, Somewhere]]
9661 !! wikitext
9662 [[|Otherplace]]
9663 [[Otherplace, Elsewhere|]]
9664 [[Otherplace, Elsewhere, Anywhere|]]
9665 !! html
9666 [[Otherplace, Somewhere|Otherplace]]
9667 [[Otherplace, Elsewhere|Otherplace]]
9668 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9669 !! end
9671 !! test
9672 pre-save transform: context links ("pipe trick") with parens and comma
9673 !! options
9674 pst title=[[Someplace (IGNORED), Somewhere]]
9675 !! wikitext
9676 [[|Otherplace]]
9677 [[Otherplace (place), Elsewhere|]]
9678 !! html
9679 [[Otherplace, Somewhere|Otherplace]]
9680 [[Otherplace (place), Elsewhere|Otherplace]]
9681 !! end
9683 !! test
9684 pre-save transform: context links ("pipe trick") with comma and parens
9685 !! options
9686 pst title=[[Who, me? (context)]]
9687 !! wikitext
9688 [[|Yes, you.]]
9689 [[Me, Myself, and I (1937 song)|]]
9690 !! html
9691 [[Yes, you. (context)|Yes, you.]]
9692 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9693 !! end
9695 !! test
9696 pre-save transform: context links ("pipe trick") with namespace
9697 !! options
9698 pst title=[[Ns:Somearticle]]
9699 !! wikitext
9700 [[|Article]]
9701 !! html
9702 [[Ns:Article|Article]]
9703 !! end
9705 !! test
9706 pre-save transform: context links ("pipe trick") with namespace and parens
9707 !! options
9708 pst title=[[Ns:Somearticle (context)]]
9709 !! wikitext
9710 [[|Article]]
9711 !! html
9712 [[Ns:Article (context)|Article]]
9713 !! end
9715 !! test
9716 pre-save transform: context links ("pipe trick") with namespace and comma
9717 !! options
9718 pst title=[[Ns:Somearticle, Context, Whatever]]
9719 !! wikitext
9720 [[|Article]]
9721 !! html
9722 [[Ns:Article, Context, Whatever|Article]]
9723 !! end
9725 !! test
9726 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9727 !! options
9728 pst title=[[Ns:Somearticle, Context (context)]]
9729 !! wikitext
9730 [[|Article]]
9731 !! html
9732 [[Ns:Article (context)|Article]]
9733 !! end
9735 !! test
9736 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9737 !! options
9738 pst title=[[Ns:Somearticle (IGNORED), Context]]
9739 !! wikitext
9740 [[|Article]]
9741 !! html
9742 [[Ns:Article, Context|Article]]
9743 !! end
9745 !! test
9746 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9747 !! options
9749 !! wikitext
9750 [[Article(context)|]]
9751 [[Bar:Article(context)|]]
9752 [[:Bar:Article(context)|]]
9753 [[|Article(context)]]
9754 [[Bar:X(Y)Z|]]
9755 [[:Bar:X(Y)Z|]]
9756 !! html
9757 [[Article(context)|Article]]
9758 [[Bar:Article(context)|Article]]
9759 [[:Bar:Article(context)|Article]]
9760 [[Article(context)]]
9761 [[Bar:X(Y)Z|X(Y)Z]]
9762 [[:Bar:X(Y)Z|X(Y)Z]]
9763 !! end
9765 !! test
9766 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9767 !! options
9769 !! wikitext
9770 [[Article (context)|]]
9771 [[Bar:Article (context)|]]
9772 [[:Bar:Article (context)|]]
9773 [[|Article (context)]]
9774 [[Bar:X (Y) Z|]]
9775 [[:Bar:X (Y) Z|]]
9776 !! html
9777 [[Article (context)|Article]]
9778 [[Bar:Article (context)|Article]]
9779 [[:Bar:Article (context)|Article]]
9780 [[Article (context)]]
9781 [[Bar:X (Y) Z|X (Y) Z]]
9782 [[:Bar:X (Y) Z|X (Y) Z]]
9783 !! end
9785 !! test
9786 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
9787 !! options
9789 !! wikitext
9790 [[Article(context)|]]
9791 [[Bar:Article(context)|]]
9792 [[:Bar:Article(context)|]]
9793 [[|Article(context)]]
9794 [[Bar:X(Y)Z|]]
9795 [[:Bar:X(Y)Z|]]
9796 !! html
9797 [[Article(context)|Article]]
9798 [[Bar:Article(context)|Article]]
9799 [[:Bar:Article(context)|Article]]
9800 [[Article(context)]]
9801 [[Bar:X(Y)Z|X(Y)Z]]
9802 [[:Bar:X(Y)Z|X(Y)Z]]
9803 !! end
9805 !! test
9806 pre-save transform: context links ("pipe trick") with commas (bug 21660)
9807 !! options
9809 !! wikitext
9810 [[Article (context), context|]]
9811 [[Article (context),context|]]
9812 [[Bar:Article (context), context|]]
9813 [[Bar:Article (context),context|]]
9814 [[:Bar:Article (context), context|]]
9815 [[:Bar:Article (context),context|]]
9816 !! html
9817 [[Article (context), context|Article]]
9818 [[Article (context),context|Article]]
9819 [[Bar:Article (context), context|Article]]
9820 [[Bar:Article (context),context|Article]]
9821 [[:Bar:Article (context), context|Article]]
9822 [[:Bar:Article (context),context|Article]]
9823 !! end
9825 !! test
9826 pre-save transform: trim trailing empty lines
9827 !! options
9829 !! wikitext
9830 Empty lines are trimmed
9835 !! html
9836 Empty lines are trimmed
9837 !! end
9839 !! test
9840 pre-save transform: Signature expansion
9841 !! options
9843 !! wikitext
9844 * ~~~
9845 * <noinclude>~~~</noinclude>
9846 * <includeonly>~~~</includeonly>
9847 * <onlyinclude>~~~</onlyinclude>
9848 !! html
9849 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
9850 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
9851 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
9852 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
9853 !! end
9856 !! test
9857 pre-save transform: Signature expansion in nowiki tags (bug 93)
9858 !! options
9859 pst disabled
9860 !! wikitext
9861 Shall not expand:
9863 <nowiki>~~~~</nowiki>
9865 <includeonly><nowiki>~~~~</nowiki></includeonly>
9867 <noinclude><nowiki>~~~~</nowiki></noinclude>
9869 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9871 {{subst:Foo}} shall be converted to FOO
9873 As well as inside noinclude/onlyinclude
9874 <noinclude>{{subst:Foo}}</noinclude>
9875 <onlyinclude>{{subst:Foo}}</onlyinclude>
9877 But not inside includeonly
9878 <includeonly>{{subst:Foo}}</includeonly>
9879 !! html
9880 Shall not expand:
9882 <nowiki>~~~~</nowiki>
9884 <includeonly><nowiki>~~~~</nowiki></includeonly>
9886 <noinclude><nowiki>~~~~</nowiki></noinclude>
9888 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
9890 FOO shall be converted to FOO
9892 As well as inside noinclude/onlyinclude
9893 <noinclude>FOO</noinclude>
9894 <onlyinclude>FOO</onlyinclude>
9896 But not inside includeonly
9897 <includeonly>{{subst:Foo}}</includeonly>
9898 !! end
9900 !! test
9901 Parsoid: Recognize nowiki with trailing space in tags
9902 !! options
9903 parsoid=wt2html
9904 !! wikitext
9905 <nowiki ><div>[[foo]]</nowiki >
9907 a<nowiki / >b
9909 c<nowiki />d
9911 e<nowiki/ >f
9912 !! html
9913 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9914 <p>ab</p>
9915 <p>cd</p>
9916 <p>ef</p>
9917 !! end
9919 !! test
9920 Parsoid: Recognize nowiki with odd capitalization
9921 !! options
9922 parsoid=wt2html
9923 !! wikitext
9924 <noWikI ><div>[[foo]]</Nowiki >
9925 !! html
9926 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
9927 !! end
9930 !! test
9931 Parsoid: Escape nowiki with trailing space in tags
9932 !! options
9933 parsoid=html2wt
9934 !! wikitext
9935 &lt;nowiki &gt; foo &lt;/nowiki &gt;
9937 a&lt;nowiki /&gt;b
9939 c&lt;nowiki/ &gt;d
9940 !! html
9941 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
9942 <p>a&lt;nowiki /&gt;b</p>
9943 <p>c&lt;nowiki/ &gt;d</p>
9944 !! end
9946 !! test
9947 Parsoid: Escape weird noWikI capitalizations
9948 !! options
9949 parsoid=html2wt
9950 !! wikitext
9951 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
9952 !! html
9953 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
9954 !! end
9957 ### Message transform tests
9959 !! test
9960 message transform: magic variables
9961 !! options
9963 !! wikitext
9964 {{SITENAME}}
9965 !! html
9966 MediaWiki
9967 !! end
9969 !! test
9970 message transform: should not transform wiki markup
9971 !! options
9973 !! wikitext
9974 ''test''
9975 !! html
9976 ''test''
9977 !! end
9979 !! test
9980 message transform: <noinclude> in transcluded template (bug 4926)
9981 !! options
9983 !! wikitext
9984 {{Includes}}
9985 !! html
9986 Foobar
9987 !! end
9989 !! test
9990 message transform: <onlyinclude> in transcluded template (bug 4926)
9991 !! options
9993 !! wikitext
9994 {{Includes2}}
9995 !! html
9997 !! end
9999 !! test
10000 {{#special:}} page name, known
10001 !! options
10003 !! wikitext
10004 {{#special:Recentchanges}}
10005 !! html
10006 Special:RecentChanges
10007 !! end
10009 !! test
10010 {{#special:}} page name with subpage, known
10011 !! options
10013 !! wikitext
10014 {{#special:Recentchanges/param}}
10015 !! html
10016 Special:RecentChanges/param
10017 !! end
10019 !! test
10020 {{#special:}} page name, unknown
10021 !! options
10023 !! wikitext
10024 {{#special:foobar nonexistent}}
10025 !! html
10026 Special:Foobar nonexistent
10027 !! end
10029 !! test
10030 {{#speciale:}} page name, known
10031 !! options
10033 !! wikitext
10034 {{#speciale:Recentchanges}}
10035 !! html
10036 Special:RecentChanges
10037 !! end
10039 !! test
10040 {{#speciale:}} page name with subpage, known
10041 !! options
10043 !! wikitext
10044 {{#speciale:Recentchanges/param}}
10045 !! html
10046 Special:RecentChanges/param
10047 !! end
10049 !! test
10050 {{#speciale:}} page name, unknown
10051 !! options
10053 !! wikitext
10054 {{#speciale:foobar nonexistent}}
10055 !! html
10056 Special:Foobar_nonexistent
10057 !! end
10060 ### Images
10062 ### For Parsoid-specific tests, see
10063 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10065 !! test
10066 Simple image
10067 !! options
10068 parsoid=wt2html,wt2wt,html2html
10069 !! wikitext
10070 [[Image:foobar.jpg]]
10071 !! html/php
10072 <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>
10073 </p>
10074 !! html/parsoid
10075 <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>
10076 </p>
10077 !! end
10079 !! test
10080 Simple image (using File: namespace, now canonical)
10081 !! wikitext
10082 [[File:Foobar.jpg]]
10083 !! html/php
10084 <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>
10085 </p>
10086 !! html/parsoid
10087 <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>
10088 </p>
10089 !! end
10091 !! test
10092 Right-aligned image
10093 !! wikitext
10094 [[File:Foobar.jpg|right]]
10095 !! html/php
10096 <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>
10098 !! html/parsoid
10099 <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>
10100 !! end
10102 !! test
10103 Image with caption
10104 !! wikitext
10105 [[File:Foobar.jpg|right|Caption text]]
10106 !! html/php
10107 <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>
10109 !! html/parsoid
10110 <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>
10111 !! end
10113 !! test
10114 Image with caption, bug 53312 #1
10115 !! wikitext
10116 [[File:Foobar.jpg|right|Caption page stuff]]
10117 !! html/php
10118 <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>
10120 !! html/parsoid
10121 <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>
10122 !! end
10124 !! test
10125 Image with caption, bug 53312 #2
10126 !! wikitext
10127 [[File:Foobar.jpg|right|Caption page=]]
10128 !! html/php
10129 <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>
10131 !! html/parsoid
10132 <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>
10133 !! end
10135 !! test
10136 Image with caption, bug 53312 #3
10137 !! wikitext
10138 [[File:Foobar.jpg|right|Caption page=stuff]]
10139 !! html/php
10140 <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>
10142 !! html/parsoid
10143 <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>
10144 !! end
10146 !! test
10147 Allow empty links in image captions (Bug 60753)
10148 !! options
10149 thumbsize=220
10150 !! wikitext
10151 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10152 [[]]
10153 [[Link2]]
10155 !! html/php
10156 <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>
10158 !! html/parsoid
10159 <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>
10160 [[]]
10161 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10162 </figcaption></figure>
10163 !! end
10165 !! test
10166 Link with empty target
10167 !! wikitext
10168 [[]]
10169 !! html
10170 <p>[[]]
10171 </p>
10172 !! end
10174 !! test
10175 Image with empty attribute
10176 !! options
10177 parsoid=wt2html,wt2wt,html2html
10178 !! wikitext
10179 [[File:Foobar.jpg|right||Caption text]]
10180 !! html/php
10181 <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>
10183 !! html/parsoid
10184 <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>
10185 !! end
10187 !! test
10188 1. Block image with individual attributes from templates
10189 !! wikitext
10190 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10191 !! html/php
10192 <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>
10194 !! html/parsoid
10195 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10196 !! end
10198 !! test
10199 2. Block Image with individual attributes from templates
10200 !! wikitext
10201 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10202 !! html/php
10203 <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>
10205 !! html/parsoid
10206 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\">137px&lt;/span>"}]]}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
10207 !! end
10209 !! test
10210 3. Inline image with individual attributes from templates
10211 !! wikitext
10212 [[File:Foobar.jpg|{{echo|50px}}]]
10213 !! html/php
10214 <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>
10215 </p>
10216 !! html/parsoid
10217 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\">50px&lt;/span>"}]]}' data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
10218 !! end
10220 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10221 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10222 !! test
10223 Image with multiple attributes from the same template
10224 !! wikitext
10225 [[File:Foobar.jpg|{{image_attribs}}]]
10226 !! html/php
10227 <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>
10229 !! html/parsoid
10230 <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>
10231 !! end
10233 !! test
10234 Image with link tails
10235 !! options
10236 thumbsize=220
10237 !! wikitext
10238 123[[File:Foobar.jpg]]456
10239 123[[File:Foobar.jpg|right]]456
10240 123[[File:Foobar.jpg|thumb]]456
10241 !! html/php
10242 <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
10243 </p>
10244 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
10245 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
10247 !! html/parsoid
10248 <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>
10249 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
10250 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
10251 !! end
10253 !! test
10254 Image with multiple captions -- only last one is accepted
10255 !! wikitext
10256 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10257 !! html/php
10258 <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>
10260 !! html/parsoid
10261 <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>
10262 !! end
10264 !! test
10265 Image with multiple widths -- use last
10266 !! wikitext
10267 [[File:Foobar.jpg|200px|300px|caption]]
10268 !! html/php
10269 <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>
10270 </p>
10271 !! html/parsoid
10272 <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>
10273 !! end
10275 !! test
10276 Image with multiple alignments -- use first (bug 48664)
10277 !! options
10278 thumbsize=220
10279 !! wikitext
10280 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10282 [[File:Foobar.jpg|middle|text-top|caption]]
10283 !! html/php
10284 <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>
10285 <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>
10286 </p>
10287 !! html/parsoid
10288 <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>
10289 <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>
10290 !! end
10292 !! test
10293 Image with width attribute at different positions
10294 !! wikitext
10295 [[File:Foobar.jpg|200px|right|Caption]]
10296 [[File:Foobar.jpg|right|200px|Caption]]
10297 [[File:Foobar.jpg|right|Caption|200px]]
10298 !! html/php
10299 <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>
10300 <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>
10301 <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>
10303 !! html/parsoid
10304 <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>
10305 <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>
10306 <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>
10307 !! end
10309 # a sad bit of backward-compatibility
10310 !! test
10311 Image with size specified with pxpx (bug 13500, 51628)
10312 !! options
10313 parsoid=wt2html,wt2wt,html2html
10314 !! wikitext
10315 [[File:Foobar.jpg|20pxpx]]
10316 [[File:Foobar.jpg|200x20pxpx]]
10317 !! html/php
10318 <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>
10319 <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>
10320 </p>
10321 !! html/parsoid
10322 <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>
10323 !! end
10325 !! test
10326 Image with link parameter, wiki target
10327 !! wikitext
10328 [[File:Foobar.jpg|link=Main Page]]
10329 !! html/php
10330 <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>
10331 </p>
10332 !! html/parsoid
10333 <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>
10334 !! end
10336 # parsoid bug 49293 (part 1)
10337 !! test
10338 Image with link parameter, URL target
10339 !! wikitext
10340 [[File:Foobar.jpg|link=http://example.com/]]
10341 !! html/php
10342 <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>
10343 </p>
10344 !! html/parsoid
10345 <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>
10346 !! end
10348 # parsoid bug 49293 (part 2)
10349 !! test
10350 Image with link parameter, protocol-less URL target
10351 !! wikitext
10352 [[File:Foobar.jpg|link=//example.com/]]
10353 !! html/php
10354 <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>
10355 </p>
10356 !! html/parsoid
10357 <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>
10358 !! end
10360 !! test
10361 Image with link parameter, wgExternalLinkTarget
10362 !! wikitext
10363 [[Image:foobar.jpg|link=http://example.com/]]
10364 !! config
10365 wgExternalLinkTarget='foobar'
10366 !! html
10367 <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>
10368 </p>
10369 !! end
10371 !! test
10372 Image with link parameter, wgNoFollowLinks set to false
10373 !! wikitext
10374 [[Image:foobar.jpg|link=http://example.com/]]
10375 !! config
10376 wgNoFollowLinks=false
10377 !! html
10378 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10379 </p>
10380 !! end
10382 !! test
10383 Image with link parameter, wgNoFollowDomainExceptions
10384 !! wikitext
10385 [[Image:foobar.jpg|link=http://example.com/]]
10386 !! config
10387 wgNoFollowDomainExceptions='example.com'
10388 !! html
10389 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10390 </p>
10391 !! end
10393 !! test
10394 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10395 !! wikitext
10396 [[Image:foobar.jpg|link=http://example.com/|Title]]
10397 !! config
10398 wgExternalLinkTarget='foobar'
10399 !! html
10400 <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>
10401 </p>
10402 !! end
10404 !! test
10405 Image with empty link parameter
10406 !! wikitext
10407 [[File:Foobar.jpg|link=]]
10408 !! html/php
10409 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10410 </p>
10411 !! html/parsoid
10412 <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>
10413 !! end
10415 !! test
10416 Image with link parameter (wiki target) and unnamed parameter
10417 !! wikitext
10418 [[File:Foobar.jpg|link=Main_Page|Title]]
10419 !! html/php
10420 <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>
10421 </p>
10422 !! html/parsoid
10423 <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>
10424 !! end
10426 !! test
10427 Image with link parameter (URL target) and unnamed parameter
10428 !! wikitext
10429 [[File:Foobar.jpg|link=http://example.com/|Title]]
10430 !! html/php
10431 <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>
10432 </p>
10433 !! html/parsoid
10434 <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>
10435 !! end
10437 !! test
10438 Thumbnail image with link parameter
10439 !! options
10440 thumbsize=220
10441 parsoid=wt2html,wt2wt,html2html
10442 !! wikitext
10443 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10444 !! html/php
10445 <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>
10447 !! html/parsoid
10448 <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>
10449 !! end
10451 !! test
10452 Manually-specified thumbnail image
10453 !! options
10454 thumbsize=220
10455 !! wikitext
10456 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10457 !! html/php
10458 <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>
10460 !! html/parsoid
10461 <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>
10462 !! end
10464 !! test
10465 Manually-specified thumbnail image with explicit link to wiki page
10466 !! options
10467 thumbsize=220
10468 parsoid=wt2html,wt2wt,html2html
10469 !! wikitext
10470 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10471 !! html/php
10472 <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>
10474 !! html/parsoid
10475 <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>
10476 !! end
10478 !! test
10479 Manually-specified thumbnail image with explicit link to url
10480 !! options
10481 thumbsize=220
10482 parsoid=wt2html,wt2wt,html2html
10483 !! wikitext
10484 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10485 !! html/php
10486 <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>
10488 !! html/parsoid
10489 <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>
10490 !! end
10492 !! test
10493 Manually-specified thumbnail image with explicit no link
10494 !! options
10495 thumbsize=220
10496 parsoid=wt2html,wt2wt,html2html
10497 !! wikitext
10498 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10499 !! html/php
10500 <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>
10502 !! html/parsoid
10503 <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>
10504 !! end
10506 !! test
10507 Manually-specified thumbnail image with explicit link and alt text
10508 !! options
10509 thumbsize=220
10510 parsoid=wt2html,wt2wt,html2html
10511 !! wikitext
10512 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10513 !! html/php
10514 <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>
10516 !! html/parsoid
10517 <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>
10518 !! end
10520 !! test
10521 Image with frame and link
10522 !! options
10523 parsoid=wt2html,wt2wt,html2html
10524 !! wikitext
10525 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10526 !! html/php
10527 <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>
10529 !! html/parsoid
10530 <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>
10531 !! end
10533 !! test
10534 Image with frame and link and explicit alt
10535 !! options
10536 parsoid=wt2html,wt2wt,html2html
10537 !! wikitext
10538 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10539 !! html/php
10540 <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>
10542 !! html/parsoid
10543 <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>
10544 !! end
10546 !! test
10547 Image with wiki markup in implicit alt
10548 !! options
10549 parsoid=wt2html,wt2wt,html2html
10550 !! wikitext
10551 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10553 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10554 !! html/php
10555 <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>
10556 </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>
10557 </p>
10558 !! html/parsoid
10559 <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>
10560 <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>
10561 !! end
10563 ###################
10564 # Conflicting image format options.
10565 # First option specified should 'win'.
10566 # All three cases in each test should be identical.
10568 !! test
10569 Image with 'frameless' first.
10570 !! options
10571 parsoid=wt2html,wt2wt,html2html
10572 !! wikitext
10573 [[File:Foobar.jpg|frameless|caption]]
10575 [[File:Foobar.jpg|frameless|frame|caption]]
10577 [[File:Foobar.jpg|frameless|thumb|caption]]
10578 !! html/php
10579 <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>
10580 </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>
10581 </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>
10582 </p>
10583 !! html/parsoid
10584 <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>
10585 <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>
10586 <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>
10587 !! end
10589 !! test
10590 Image with 'frame' first.
10591 !! options
10592 parsoid=wt2html,wt2wt,html2html
10593 !! wikitext
10594 [[File:Foobar.jpg|frame|caption]]
10595 [[File:Foobar.jpg|frame|frameless|caption]]
10596 [[File:Foobar.jpg|frame|thumb|caption]]
10597 !! html/php
10598 <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>
10599 <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>
10600 <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>
10602 !! html/parsoid
10603 <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>
10604 !! end
10606 !! test
10607 Image with 'thumb' first.
10608 !! options
10609 parsoid=wt2html,wt2wt,html2html
10610 !! wikitext
10611 [[File:Foobar.jpg|thumb|caption]]
10612 [[File:Foobar.jpg|thumb|frameless|caption]]
10613 [[File:Foobar.jpg|thumb|frame|caption]]
10614 !! html/php
10615 <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>
10616 <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>
10617 <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>
10619 !! html/parsoid
10620 <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>
10621 !! end
10623 ###################
10624 # Image sizing.
10625 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10626 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10627 # Foobar has actual size of 1941x220
10628 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10629 #    a scalable format.
10630 # 2. Framed images always ignore size options; always render at default size.
10631 # 3. "Unspecified format" and border are the only types which can be
10632 #    enlarged.
10634 !! test
10635 Image: "unspecified format" and border enlarge
10636 !! options
10637 parsoid=wt2html,wt2wt,html2html
10638 !! wikitext
10639 [[File:Foobar.jpg|2000px]]
10641 [[File:Foobar.jpg|border|2000px]]
10642 !! html/php
10643 <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>
10644 </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>
10645 </p>
10646 !! html/parsoid
10647 <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>
10648 <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>
10649 !! end
10651 !! test
10652 Image: "unspecified format" and border reduce
10653 !! options
10654 parsoid=wt2html,wt2wt,html2html
10655 !! wikitext
10656 [[File:Foobar.jpg|1000px]]
10658 [[File:Foobar.jpg|border|1000px]]
10659 !! html/php
10660 <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>
10661 </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>
10662 </p>
10663 !! html/parsoid
10664 <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>
10665 <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>
10666 !! end
10668 !! test
10669 Image: thumbs reduce
10670 !! options
10671 parsoid=wt2html,wt2wt,html2html
10672 !! wikitext
10673 [[File:Foobar.jpg|thumb|50px]]
10674 !! html/php
10675 <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>
10677 !! html/parsoid
10678 <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>
10679 !! end
10681 !! test
10682 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10683 !! options
10684 parsoid=wt2html,wt2wt,html2html
10685 !! wikitext
10686 [[File:Foobar.jpg|thumb|2000px]]
10688 [[File:Foobar.svg|thumb|2000px]]
10689 !! html/php
10690 <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>
10691 <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>
10693 !! html/parsoid
10694 <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>
10695 <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>
10696 !! end
10698 !! test
10699 Image: frameless can reduce in size
10700 !! options
10701 parsoid=wt2html,wt2wt,html2html
10702 !! wikitext
10703 [[File:Foobar.jpg|frameless|50px]]
10704 !! html/php
10705 <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>
10706 </p>
10707 !! html/parsoid
10708 <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>
10709 !! end
10711 !! test
10712 Image: bitmap frameless can't be enlarged past original size, but vector can
10713 !! options
10714 parsoid=wt2html,wt2wt,html2html
10715 !! wikitext
10716 [[File:Foobar.jpg|frameless|2000px]]
10718 [[File:Foobar.svg|frameless|2000px]]
10719 !! html/php
10720 <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>
10721 </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>
10722 </p>
10723 !! html/parsoid
10724 <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>
10725 <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>
10726 !! end
10728 !! test
10729 Image: framed images are always unscaled.
10730 !! options
10731 parsoid=wt2html,wt2wt,html2html
10732 !! wikitext
10733 [[File:Foobar.jpg|frame]]
10735 [[File:Foobar.jpg|frame|50px]]
10737 [[File:Foobar.jpg|frame|50x50px]]
10739 [[File:Foobar.jpg|frame|2000px]]
10740 !! html/php
10741 <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>
10742 <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>
10743 <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>
10744 <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>
10746 !! html/parsoid
10747 <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>
10748 !! end
10750 ###################
10752 !! test
10753 Link to image page- image page normally doesn't exists, hence edit link
10754 Add test with existing image page
10755 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10756 !! wikitext
10757 [[:Image:test]]
10758 !! html
10759 <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>
10760 </p>
10761 !! end
10763 !! test
10764 bug 18784  Link to non-existent image page with caption should use caption as link text
10765 !! wikitext
10766 [[:Image:test|caption]]
10767 !! html
10768 <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>
10769 </p>
10770 !! end
10772 !! test
10773 Frameless image caption with a free URL
10774 !! wikitext
10775 [[File:Foobar.jpg|http://example.com]]
10776 !! html/php
10777 <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>
10778 </p>
10779 !! html/parsoid
10780 <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>
10781 !! end
10783 !! test
10784 Thumbnail image caption with a free URL
10785 !! options
10786 thumbsize=220
10787 !! wikitext
10788 [[File:Foobar.jpg|thumb|http://example.com]]
10789 !! html/php
10790 <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>
10792 !! html/parsoid
10793 <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>
10794 !! end
10796 !! test
10797 Thumbnail image caption with a free URL and explicit alt
10798 !! options
10799 thumbsize=220
10800 parsoid=wt2html,wt2wt,html2html
10801 !! wikitext
10802 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
10803 !! html/php
10804 <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>
10806 !! html/parsoid
10807 <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>
10808 !! end
10810 !! test
10811 SVG thumbnails with no language set
10812 !! options
10813 !! wikitext
10814 [[File:Foobar.svg|thumb|caption]]
10815 !! html/php
10816 <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>
10818 !! html/parsoid
10819 <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>
10820 !! end
10822 !! test
10823 SVG thumbnails with language de
10824 !! options
10825 parsoid=wt2html,wt2wt,html2html
10826 !! wikitext
10827 [[File:Foobar.svg|thumb|caption|lang=de]]
10828 !! html/php
10829 <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>
10831 !! html/parsoid
10832 <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>
10833 !! end
10835 !! test
10836 SVG thumbnails with invalid language code
10837 !! options
10838 parsoid=wt2html,wt2wt,html2html
10839 !! wikitext
10840 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
10841 !! html/php
10842 <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>
10844 !! html/parsoid
10845 <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>
10846 !! end
10848 !! test
10849 BUG 1887: A ISBN with a thumbnail
10850 !! wikitext
10851 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
10852 !! html/php
10853 <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>
10855 !! html/parsoid
10856 <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>
10857 !! end
10859 !! test
10860 BUG 1887: A RFC with a thumbnail
10861 !! wikitext
10862 [[File:Foobar.jpg|thumb|This is RFC 12354]]
10863 !! html/php
10864 <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>
10866 !! html/parsoid
10867 <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>
10868 !! end
10870 !! test
10871 BUG 1887: A mailto link with a thumbnail
10872 !! wikitext
10873 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
10874 !! html/php
10875 <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>
10877 !! html/parsoid
10878 <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>
10879 !! end
10881 # Pending resolution to bug 368
10882 !! test
10883 BUG 648: Frameless image caption with a link
10884 !! wikitext
10885 [[File:Foobar.jpg|text with a [[link]] in it]]
10886 !! html/php
10887 <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>
10888 </p>
10889 !! html/parsoid
10890 <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>
10891 !! end
10893 !! test
10894 BUG 648: Frameless image caption with a link (suffix)
10895 !! wikitext
10896 [[File:Foobar.jpg|text with a [[link]]foo in it]]
10897 !! html/php
10898 <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>
10899 </p>
10900 !! html/parsoid
10901 <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>
10902 !! end
10904 !! test
10905 BUG 648: Frameless image caption with an interwiki link
10906 !! wikitext
10907 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
10908 !! html/php
10909 <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>
10910 </p>
10911 !! html/parsoid
10912 <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>
10913 !! end
10915 !! test
10916 BUG 648: Frameless image caption with a piped interwiki link
10917 !! wikitext
10918 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
10919 !! html/php
10920 <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>
10921 </p>
10922 !! html/parsoid
10923 <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>
10924 !! end
10926 !! test
10927 Escape HTML special chars in image alt text
10928 !! wikitext
10929 [[File:Foobar.jpg|& < > "]]
10930 !! html/php
10931 <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>
10932 </p>
10933 !! html/parsoid
10934 <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>
10935 !! end
10937 !! test
10938 BUG 499: Alt text should have &#1234;, not &amp;1234;
10939 !! wikitext
10940 [[File:Foobar.jpg|&#9792;]]
10941 !! html/php
10942 <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>
10943 </p>
10944 !! html/parsoid
10945 <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>
10946 !! end
10948 !! test
10949 Broken image caption with link
10950 !! options
10951 parsoid=wt2html,wt2wt,html2html
10952 !! wikitext
10953 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
10954 !! html/php
10955 <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.
10956 </p>
10957 !! html/parsoid
10958 <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>
10959 !! end
10961 !! test
10962 Image caption containing another image
10963 !! wikitext
10964 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
10965 !! html/php
10966 <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>
10968 !! html/parsoid
10969 <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>
10970 !! end
10972 !! test
10973 Image: caption containing a newline
10974 !! wikitext
10975 [[File:Foobar.jpg|This
10976 *is some text]]
10977 !! html/php
10978 <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>
10979 </p>
10980 !! html/parsoid
10981 <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>
10982 !!end
10984 !!test
10985 Image: caption containing leading space
10986 (The leading space should not trigger nowiki escaping in wt2wt mode)
10987 !! wikitext
10988 [[File:Foobar.jpg|thumb| bar]]
10989 !! html/php
10990 <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>
10992 !! html/parsoid
10993 <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>
10994 !!end
10996 !! test
10997 Image: caption containing a table
10998 !! options
10999 parsoid=wt2html,wt2wt,html2html
11000 !! wikitext
11001 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11003 ! Foo !! Bar
11005 | Foo1 || Bar1
11007 and some more text.]]
11008 !! html/php
11009 <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>
11011 !! html/parsoid
11012 <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
11013 <table>
11014 <tbody>
11015 <tr><th>Foo </th><th>Bar</th></tr>
11016 <tr>
11017 <td>Foo1 </td>
11018 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11019 !! end
11021 !! test
11022 Bug 3090: External links other than http: in image captions
11023 !! wikitext
11024 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11025 !! html/php
11026 <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>
11028 !! html/parsoid
11029 <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>
11030 !! end
11032 !! test
11033 Custom class
11034 !! options
11035 parsoid=wt2html,wt2wt,html2html
11036 !! wikitext
11037 [[Image:foobar.jpg|a|class=b]]
11038 !! html/php
11039 <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>
11040 </p>
11041 !! html/parsoid
11042 <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>
11043 !! end
11045 !! test
11046 Localized image handling (1).
11047 !! options
11048 parsoid=wt2html,wt2wt,html2html
11049 language=es
11050 !! wikitext
11051 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11052 !! html/php
11053 <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>
11055 !! html/parsoid
11056 <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>
11057 !! end
11059 !! test
11060 Localized image handling (2).
11061 !! options
11062 thumbsize=220
11063 parsoid=wt2html,wt2wt,html2html
11064 language=es
11065 !! wikitext
11066 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11067 !! html/php
11068 <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>
11070 !! html/parsoid
11071 <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>
11072 !! end
11074 !! test
11075 "border", "frameless" and "class" attributes on an image.
11076 !! options
11077 thumbsize=220
11078 parsoid=wt2html,wt2wt,html2html
11079 !! wikitext
11080 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11081 !! html/php
11082 <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>
11083 </p>
11084 !! html/parsoid
11085 <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>
11086 !! end
11088 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11089 !! test
11090 Invalid image attributes (bug 62500)
11091 !! options
11092 thumbsize=220
11093 parsoid=wt2html,wt2wt,html2html
11094 !! wikitext
11095 [[File:Foobar.jpg|thumb|float|left|caption]]
11097 [[File:Foobar.jpg|thumb|righ|caption]]
11099 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11100 !! html/php
11101 <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>
11102 <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>
11103 <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>
11105 !! html/parsoid
11106 <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>
11107 !! end
11109 !! article
11110 File:Barfoo.jpg
11111 !! text
11112 #REDIRECT [[File:Barfoo.jpg]]
11113 !! endarticle
11115 !! test
11116 Redirected image
11117 !! wikitext
11118 [[Image:Barfoo.jpg]]
11119 !! html
11120 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11121 </p>
11122 !! end
11124 !! test
11125 Missing image with uploads disabled
11126 !! options
11127 wgEnableUploads=0
11128 !! wikitext
11129 [[Image:Foobaz.jpg]]
11130 !! html
11131 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11132 </p>
11133 !! end
11135 # Parsoid-specific testing for images
11136 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11137 # Currently imperfect due to a flaw in the Parsoid testrunner
11138 # Work in progress
11139 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11140 # image tests.
11142 !! test
11143 Parsoid-specific image handling - simple image with size and middle alignment
11144 !! wikitext
11145 [[File:Foobar.jpg|middle|50px]]
11146 !! html/parsoid
11147 <p><span class="mw-valign-middle" typeof="mw:Image">
11148 <a href="File:Foobar.jpg">
11149 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11150 </a>
11151 </span>
11152 </p>
11153 !! end
11155 !! test
11156 Parsoid-specific image handling - simple image with size, middle alignment,
11157 non-standard namespace alias
11158 !! options
11159 parsoid=wt2wt,wt2html,html2html
11160 !! wikitext
11161 [[Image:Foobar.jpg|middle|50px]]
11162 !! html/parsoid
11163 <p><span class="mw-valign-middle" typeof="mw:Image">
11164 <a href="File:Foobar.jpg">
11165 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11166 </a>
11167 </span>
11168 </p>
11169 !! end
11171 !! test
11172 Parsoid-specific image handling - simple image with size and middle alignment
11173 (existing content)
11174 !! wikitext
11175 [[File:Foobar.jpg|50px|middle]]
11176 !! html/parsoid
11177 <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>
11178 !! end
11180 !! test
11181 Parsoid-specific image handling - simple image with size and middle alignment
11182 and non-standard namespace name
11183 !! options
11184 parsoid=wt2html,wt2wt,html2html
11185 !! wikitext
11186 [[Image:Foobar.jpg|50px|middle]]
11187 !! html/parsoid
11188 <p><span class="mw-valign-middle" typeof="mw:Image">
11189 <a href="File:Foobar.jpg">
11190 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11191 </a>
11192 </span>
11193 </p>
11194 !! end
11196 !! test
11197 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11198 !! wikitext
11199 [[File:Foobar.jpg|500x10px|baseline|caption]]
11200 !! html/parsoid
11201 <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>
11202 !! end
11204 !! test
11205 Parsoid-specific image handling - simple image with border and size spec
11206 !! wikitext
11207 [[File:Foobar.jpg|50px|border|caption]]
11208 !! html/parsoid
11209 <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>
11210 !! end
11212 !! test
11213 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11214 !! wikitext
11215 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11216 !! html/parsoid
11217 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11218 <a href="File:Foobar.jpg">
11219 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11220 </a>
11221 <figcaption>caption content</figcaption>
11222 </figure>
11223 !! end
11225 !! test
11226 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11227 (existing content)
11228 !! wikitext
11229 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11230 !! html/parsoid
11231 <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>
11232 !! end
11234 !! test
11235 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11236 !! wikitext
11237 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11238 !! html/parsoid
11239 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11240 <a href="File:Foobar.jpg">
11241 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11242 </a>
11243 <figcaption>caption</figcaption>
11244 </figure>
11245 !! end
11247 !! test
11248 Parsoid-specific image handling - thumbnail with specific size, halign,
11249 valign, and caption (existing content)
11250 !! wikitext
11251 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11252 !! html/parsoid
11253 <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>
11254 !! end
11256 !! test
11257 Parsoid-specific image handling - framed image with specific size and caption
11258 (size is ignored)
11259 !! options
11260 parsoid=wt2html,wt2wt,html2html
11261 !! wikitext
11262 [[File:Foobar.jpg|frame|500x50px|caption]]
11263 !! html/parsoid
11264 <figure typeof="mw:Image/Frame">
11265 <a href="File:Foobar.jpg">
11266 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11267 </a>
11268 <figcaption>caption</figcaption>
11269 </figure>
11270 !! end
11272 !! test
11273 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11274 (size is ignored)
11275 !! options
11276 parsoid=wt2html,wt2wt,html2html
11277 !! wikitext
11278 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11279 !! html/parsoid
11280 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11281 <a href="File:Foobar.jpg">
11282 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11283 </a>
11284 <figcaption>caption</figcaption>
11285 </figure>
11286 !! end
11288 !! test
11289 Parsoid-specific image handling - frameless image with specific size, border, and caption
11290 !! wikitext
11291 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11292 !! html/parsoid
11293 <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>
11294 !! end
11296 !! test
11297 Parsoid-specific image handling - simple image with a formatted caption
11298 !! wikitext
11299 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11300 !! html/parsoid
11301 <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>"}'>
11302 <a href="File:Foobar.jpg">
11303 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11304 </a></span></p>
11305 !! end
11307 !! test
11308 Parsoid-specific image handling - caption with a template in it
11309 !! wikitext
11310 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11311 !! html/parsoid
11312 <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>
11313 !! end
11315 !! test
11316 Parsoid-specific image handling - caption with unbalanced tags in it
11317 !! options
11318 parsoid=wt2html,wt2wt,html2html
11319 !! wikitext
11321 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11323 !! html/parsoid
11324 <p>foo</p>
11325 <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>
11326 <p>bar</p>
11327 !! end
11329 !! test
11330 Parsoid-specific image handling - empty caption (1)
11331 !! options
11332 parsoid=wt2html,wt2wt
11333 !! wikitext
11334 [[File:Foobar.jpg|thumb|]]
11335 !! html/parsoid
11336 <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>
11337 !! end
11339 # empty captions don't get serialized unless we're in the "round trip" case
11340 !! test
11341 Parsoid-specific image handling - empty caption (2)
11342 !! options
11343 parsoid=html2wt
11344 !! html/parsoid
11345 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11346   <a href="File:Foobar.jpg">
11347     <img resource="./File:Foobar.jpg"
11348          src="//example.com/images/3/3a/Foobar.jpg"
11349          height="25" width="220"/>
11350   </a>
11351   <figcaption></figcaption>
11352 </figure>
11353 !! wikitext
11354 [[File:Foobar.jpg|thumb]]
11355 !! end
11357 !! test
11358 Parsoid-specific image handling - whitespace caption
11359 !! wikitext
11360 [[File:Foobar.jpg|thumb| ]]
11361 !! html/parsoid
11362 <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>
11363 !! end
11365 !! test
11366 Parsoid-specific image handling - lang option
11367 !! wikitext
11369 [[File:Foobar.svg|lang=de|caption]]
11371 !! html/parsoid
11372 <p>foo
11373 <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>
11374 bar</p>
11375 !! end
11379 ### Subpages
11381 !! article
11382 Subpage test/subpage
11383 !! text
11385 !! endarticle
11387 !! test
11388 Subpage link
11389 !! options
11390 subpage title=[[Subpage test]]
11391 !! wikitext
11392 [[/subpage]]
11393 !! html
11394 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11395 </p>
11396 !! end
11398 !! test
11399 Subpage noslash link
11400 !! options
11401 subpage title=[[Subpage test]]
11402 !! wikitext
11403 [[/subpage/]]
11404 !! html
11405 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11406 </p>
11407 !! end
11409 # TODO: make this PHP-parser compatible!
11410 !! test
11411 Relative subpage noslash link
11412 !! options
11413 parsoid=wt2wt,wt2html,html2html
11414 subpage title=[[Subpage test/1/2/3/4]]
11415 !! wikitext
11416 [[../../subpage/]]
11418 [[../../subpage]]
11419 !! html
11420 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11421 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11422 !! end
11424 !! test
11425 Parsoid: dot-slash prefixed wikilinks
11426 !! wikitext
11427 [[./foo]]
11429 [[././bar]]
11431 [[././baz/]]
11432 !! html/php
11433 <p>[[./foo]]
11434 </p><p>[[././bar]]
11435 </p><p>[[././baz/]]
11436 </p>
11437 !! html/parsoid
11438 <p>[[./foo]]
11439 </p><p>[[././bar]]
11440 </p><p>[[././baz/]]
11441 </p>
11442 !! end
11444 !! test
11445 Render invalid page names as plain text (bug 51090)
11446 !! wikitext
11447 [[./../foo|bar]]
11448 [[foo�|bar]]
11449 [[foo/.|bar]]
11450 [[foo/..|bar]]
11451 [[foo~~~bar]]
11452 [[foo>bar]]
11453 [[foo[bar]]
11454 [[.]]
11455 [[..]]
11456 [[foo././bar]]
11458 [[{{echo|./../foo}}|bar]]
11459 [[{{echo|foo/.}}|bar]]
11460 [[{{echo|foo/..}}|bar]]
11461 [[{{echo|foo~~~~bar}}]]
11462 [[{{echo|foo>bar}}]]
11463 [[{{echo|foo././bar}}]]
11464 [[{{echo|foo{bar}}]]
11465 [[{{echo|foo}bar}}]]
11466 [[{{echo|foo[bar}}]]
11467 [[{{echo|foo]bar}}]]
11468 [[{{echo|foo<bar}}]]
11469 !!html/php
11470 <p>[[./../foo|bar]]
11471 [[foo�|bar]]
11472 [[foo/.|bar]]
11473 [[foo/..|bar]]
11474 [[foo~~~bar]]
11475 [[foo&gt;bar]]
11476 [[foo[bar]]
11477 [[.]]
11478 [[..]]
11479 [[foo././bar]]
11480 </p><p>[[./../foo|bar]]
11481 [[foo/.|bar]]
11482 [[foo/..|bar]]
11483 [[foo~~~~bar]]
11484 [[foo&gt;bar]]
11485 [[foo././bar]]
11486 [[foo{bar]]
11487 [[foo}bar]]
11488 [[foo[bar]]
11489 [[foo]bar]]
11490 [[foo&lt;bar]]
11491 </p>
11492 !!html/parsoid
11493 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11494 <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>
11495 !!end
11497 !! test
11498 Disabled subpages
11499 !! wikitext
11500 [[/subpage]]
11501 !! html
11502 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11503 </p>
11504 !! end
11506 !! test
11507 BUG 561: {{/Subpage}}
11508 !! options
11509 subpage title=[[Page]]
11510 !! wikitext
11511 {{/Subpage}}
11512 !! html
11513 <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>
11514 </p>
11515 !! end
11518 ### Categories
11520 !! article
11521 Category:MediaWiki User's Guide
11522 !! text
11523 blah
11524 !! endarticle
11526 !! test
11527 Link to category
11528 !! wikitext
11529 [[:Category:MediaWiki User's Guide]]
11530 !! html
11531 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11532 </p>
11533 !! end
11535 !! test
11536 Simple category
11537 !! options
11539 !! wikitext
11540 [[Category:MediaWiki User's Guide]]
11541 !! html
11542 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11543 !! end
11545 !! test
11546 PAGESINCATEGORY invalid title fatal (r33546 fix)
11547 !! wikitext
11548 {{PAGESINCATEGORY:<bogus>}}
11549 !! html
11550 <p>0
11551 </p>
11552 !! end
11554 !! test
11555 Category with different sort key
11556 !! options
11558 !! wikitext
11559 [[Category:MediaWiki User's Guide|Foo]]
11560 !! html
11561 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11562 !! end
11564 !! test
11565 Category with identical sort key
11566 !! options
11568 !! wikitext
11569 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11570 !! html
11571 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11572 !! end
11574 !! test
11575 Category with empty sort key
11576 !! options
11579 !! wikitext
11580 [[Category:MediaWiki User's Guide|]]
11581 !! html
11582 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11583 !! end
11585 !! test
11586 Category with empty sort key and parentheses
11587 !! options
11590 !! wikitext
11591 [[Category:Foo (bar)|]]
11592 !! html
11593 [[Category:Foo (bar)|Foo]]
11594 !! end
11596 !! test
11597 Category with link tail
11598 !! options
11601 !! wikitext
11602 123[[Category:Foo]]456
11603 !! html
11604 123[[Category:Foo]]456
11605 !! end
11607 !! test
11608 Category with template
11609 !! options
11612 !! wikitext
11613 [[Category:{{echo|Foo}}]]
11614 !! html
11615 [[Category:{{echo|Foo}}]]
11616 !! end
11618 !! test
11619 Category with template in sort key
11620 !! options
11623 !! wikitext
11624 [[Category:Foo|{{echo|Bar}}]]
11625 !! html
11626 [[Category:Foo|{{echo|Bar}}]]
11627 !! end
11629 !! test
11630 Category with template in sort key and title
11631 !! options
11634 !! wikitext
11635 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11636 !! html
11637 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11638 !! end
11640 !! test
11641 Category / paragraph interactions
11642 !! wikitext
11643 Foo [[Category:Baz]] Bar
11645 Foo [[Category:Baz]]
11649 [[Category:Baz]]
11653 [[Category:Baz]] Bar
11656 [[Category:Baz]]
11657  [[Category:Baz]]
11658 [[Category:Baz]]
11661 [[Category:Baz]]
11662  [[Category:Baz]]
11663 [[Category:Baz]]
11665 [[Category:Baz]]
11666  {{echo|[[Category:Baz]]}}
11667 [[Category:Baz]]
11668 !! html
11669 <p>Foo Bar
11670 </p><p>Foo
11672 </p><p>Foo
11674 </p><p>Foo Bar
11675 </p><p>Foo
11677 </p>
11678 !! end
11680 !! test
11681 Parsoid: Serialize link to category page with colon escape
11682 !! options
11683 parsoid
11684 !! wikitext
11686 [[:Category:Foo]]
11687 [[:Category:Foo|Bar]]
11688 !! html
11690 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11691 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11692 </p>
11693 !! end
11695 !! test
11696 Parsoid: Link prefix/suffixes aren't applied to category links
11697 !! options
11698 parsoid=wt2html,wt2wt,html2html
11699 language=is
11700 !! wikitext
11701 x[[Category:Foo]]y
11702 !! html
11703 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11704 !! end
11706 !! test
11707 Parsoid: Serialize link to file page with colon escape
11708 !! options
11709 parsoid
11710 !! wikitext
11712 [[:File:Foo.png]]
11713 [[:File:Foo.png|Bar]]
11714 !! html
11716 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11717 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11718 </p>
11719 !! end
11721 !! test
11722 Parsoid: Serialize a genuine category link without colon escape
11723 !! options
11724 parsoid
11725 !! wikitext
11726 [[Category:Foo]]
11727 [[Category:Foo|Bar]]
11728 !! html
11729 <link rel="mw:PageProp/Category" href="Category:Foo">
11730 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11731 !! end
11733 !! test
11734 Parsoid: Defaultsort
11735 !! options
11736 parsoid
11737 !! wikitext
11738 {{DEFAULTSORT:Foo}}
11739 !! html
11740 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11741 !! end
11744 ### Inter-language links
11746 !! test
11747 Inter-language links
11748 !! options
11750 !! wikitext
11751 [[es:Alimento]]
11752 [[fr:Nourriture]]
11753 [[zh:&#39135;&#21697;]]
11754 !! html
11755 es:Alimento fr:Nourriture zh:食品
11756 !! end
11758 !! test
11759 Duplicate interlanguage links (bug 24502)
11760 !! options
11762 !! wikitext
11763 [[es:1]]
11764 [[es:2]]
11765 [[fr:1]]
11766 [[fr:2]]
11767 !! html
11768 es:1 fr:1
11769 !! end
11772 ### Sections
11774 !! test
11775 Basic section headings
11776 !! wikitext
11777 == Headline 1 ==
11778 Some text
11780 ==Headline 2==
11781 More
11782 ===Smaller headline===
11783 Blah blah
11784 !! html
11785 <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>
11786 <p>Some text
11787 </p>
11788 <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>
11789 <p>More
11790 </p>
11791 <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>
11792 <p>Blah blah
11793 </p>
11794 !! end
11796 !! test
11797 Section headings with TOC
11798 !! wikitext
11799 == Headline 1 ==
11800 === Subheadline 1 ===
11801 ===== Skipping a level =====
11802 ====== Skipping a level ======
11804 == Headline 2 ==
11805 Some text
11806 ===Another headline===
11807 !! html
11808 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11809 <ul>
11810 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
11811 <ul>
11812 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
11813 <ul>
11814 <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>
11815 <ul>
11816 <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>
11817 </ul>
11818 </li>
11819 </ul>
11820 </li>
11821 </ul>
11822 </li>
11823 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
11824 <ul>
11825 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
11826 </ul>
11827 </li>
11828 </ul>
11829 </div>
11831 <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>
11832 <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>
11833 <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>
11834 <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>
11835 <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>
11836 <p>Some text
11837 </p>
11838 <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>
11840 !! end
11842 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
11843 !! test
11844 Handling of sections up to level 6 and beyond
11845 !! wikitext
11846 = Level 1 Heading=
11847 == Level 2 Heading==
11848 === Level 3 Heading===
11849 ==== Level 4 Heading====
11850 ===== Level 5 Heading=====
11851 ====== Level 6 Heading======
11852 ======= Level 7 Heading=======
11853 ======== Level 8 Heading========
11854 ========= Level 9 Heading=========
11855 ========== Level 10 Heading==========
11856 !! html
11857 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11858 <ul>
11859 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
11860 <ul>
11861 <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>
11862 <ul>
11863 <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>
11864 <ul>
11865 <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>
11866 <ul>
11867 <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>
11868 <ul>
11869 <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>
11870 <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>
11871 <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>
11872 <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>
11873 <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>
11874 </ul>
11875 </li>
11876 </ul>
11877 </li>
11878 </ul>
11879 </li>
11880 </ul>
11881 </li>
11882 </ul>
11883 </li>
11884 </ul>
11885 </div>
11887 <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>
11888 <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>
11889 <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>
11890 <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>
11891 <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>
11892 <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>
11893 <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>
11894 <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>
11895 <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>
11896 <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>
11898 !! end
11900 !! test
11901 TOC regression (bug 9764)
11902 !! wikitext
11903 == title 1 ==
11904 === title 1.1 ===
11905 ==== title 1.1.1 ====
11906 === title 1.2 ===
11907 == title 2 ==
11908 === title 2.1 ===
11909 !! html
11910 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11911 <ul>
11912 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11913 <ul>
11914 <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>
11915 <ul>
11916 <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>
11917 </ul>
11918 </li>
11919 <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>
11920 </ul>
11921 </li>
11922 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11923 <ul>
11924 <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>
11925 </ul>
11926 </li>
11927 </ul>
11928 </div>
11930 <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>
11931 <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>
11932 <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>
11933 <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>
11934 <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>
11935 <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>
11937 !! end
11939 !! test
11940 TOC with wgMaxTocLevel=3 (bug 6204)
11941 !! options
11942 wgMaxTocLevel=3
11943 !! wikitext
11944 == title 1 ==
11945 === title 1.1 ===
11946 ==== title 1.1.1 ====
11947 === title 1.2 ===
11948 == title 2 ==
11949 === title 2.1 ===
11950 !! html
11951 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11952 <ul>
11953 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
11954 <ul>
11955 <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>
11956 <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>
11957 </ul>
11958 </li>
11959 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
11960 <ul>
11961 <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>
11962 </ul>
11963 </li>
11964 </ul>
11965 </div>
11967 <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>
11968 <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>
11969 <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>
11970 <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>
11971 <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>
11972 <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>
11974 !! end
11976 !! test
11977 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
11978 !! options
11979 wgMaxTocLevel=3
11980 !! wikitext
11981 ==Section 1==
11982 ===Section 1.1===
11983 ====Section 1.1.1====
11984 ====Section 1.1.1.1====
11985 ==Section 2==
11986 !! html
11987 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
11988 <ul>
11989 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
11990 <ul>
11991 <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>
11992 </ul>
11993 </li>
11994 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
11995 </ul>
11996 </div>
11998 <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>
11999 <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>
12000 <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>
12001 <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>
12002 <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>
12004 !! end
12007 !! test
12008 Resolving duplicate section names
12009 !! wikitext
12010 == Foo bar ==
12011 == Foo bar ==
12012 !! html
12013 <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>
12014 <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>
12016 !! end
12018 !! test
12019 Resolving duplicate section names with differing case (bug 10721)
12020 !! wikitext
12021 == Foo bar ==
12022 == Foo Bar ==
12023 !! html
12024 <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>
12025 <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>
12027 !! end
12029 !! article
12030 Template:sections
12031 !! text
12032 ===Section 1===
12033 ==Section 2==
12034 !! endarticle
12036 !! test
12037 Template with sections, __NOTOC__
12038 !! wikitext
12039 __NOTOC__
12040 ==Section 0==
12041 {{sections}}
12042 ==Section 4==
12043 !! html
12044 <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>
12045 <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>
12046 <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>
12047 <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>
12049 !! end
12051 !! test
12052 __NOEDITSECTION__ keyword
12053 !! wikitext
12054 __NOEDITSECTION__
12055 ==Section 1==
12056 ==Section 2==
12057 !! html
12058 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12059 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12061 !! end
12063 !! test
12064 Link inside a section heading
12065 !! wikitext
12066 ==Section with a [[Main Page|link]] in it==
12067 !! html
12068 <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>
12070 !! end
12072 !! test
12073 TOC regression (bug 12077)
12074 !! wikitext
12075 __TOC__
12076 == title 1 ==
12077 === title 1.1 ===
12078 == title 2 ==
12079 !! html
12080 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12081 <ul>
12082 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12083 <ul>
12084 <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>
12085 </ul>
12086 </li>
12087 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12088 </ul>
12089 </div>
12091 <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>
12092 <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>
12093 <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>
12095 !! end
12097 !! test
12098 BUG 1219 URL next to image (good)
12099 !! wikitext
12100 http://example.com [[Image:foobar.jpg]]
12101 !! html
12102 <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>
12103 </p>
12104 !!end
12106 !! test
12107 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12108 !! wikitext
12109 === 
12110 The line above must have a trailing space!
12111 === <!--
12112 --> <!-- -->
12113 But just in case it doesn't...
12114 !! html
12115 <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>
12116 <p>The line above must have a trailing space!
12117 </p>
12118 <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>
12119 <p>But just in case it doesn't...
12120 </p>
12121 !! end
12123 !! test
12124 Header with special characters (bug 25462)
12125 !! wikitext
12126 The tooltips shall not show entities to the user (ie. be double escaped)
12128 == text > text ==
12129 section 1
12131 == text < text ==
12132 section 2
12134 == text & text ==
12135 section 3
12137 == text ' text ==
12138 section 4
12140 == text " text ==
12141 section 5
12142 !! html
12143 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12144 </p>
12145 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12146 <ul>
12147 <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>
12148 <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>
12149 <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>
12150 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12151 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12152 </ul>
12153 </div>
12155 <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>
12156 <p>section 1
12157 </p>
12158 <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>
12159 <p>section 2
12160 </p>
12161 <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>
12162 <p>section 3
12163 </p>
12164 <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>
12165 <p>section 4
12166 </p>
12167 <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>
12168 <p>section 5
12169 </p>
12170 !! end
12172 !! test
12173 Headers with excess '=' characters
12174 (Are similar tests necessary beyond the 1st level?)
12175 !! wikitext
12176 =foo==
12177 ==foo=
12178 =''italic'' heading==
12179 ==''italic'' heading=
12180 !! html
12181 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12182 <ul>
12183 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12184 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12185 <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>
12186 <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>
12187 </ul>
12188 </div>
12190 <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>
12191 <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>
12192 <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>
12193 <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>
12195 !! end
12197 !! test
12198 HTML headers vs TOC (bug 23393)
12199 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12200 !! wikitext
12201 <h1>Header 1</h1>
12202 == Header 1.1 ==
12203 == Header 1.2 ==
12205 <h1>Header 2
12206 </h1>
12207 == Header 2.1 ==
12208 == Header 2.2 ==
12209 __NOEDITSECTION__
12210 !! html
12211 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12212 <ul>
12213 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12214 <ul>
12215 <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>
12216 <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>
12217 </ul>
12218 </li>
12219 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12220 <ul>
12221 <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>
12222 <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>
12223 </ul>
12224 </li>
12225 </ul>
12226 </div>
12228 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12229 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12230 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12231 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12232 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12233 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12235 !! end
12237 !! test
12238 Single-line or multiline-comments can follow headings
12239 !! options
12240 parsoid=wt2html,wt2wt
12241 !! wikitext
12242 ==foo==<!---->
12243 ==bar==<!--c1-->
12244 ==baz==<!--
12246 c3-->
12247 !! html
12248 <h2><span class="mw-headline" id="foo">foo</span></h2>
12249 <h2><span class="mw-headline" id="bar">bar</span></h2>
12250 <h2><span class="mw-headline" id="baz">baz</span></h2>
12252 !! end
12254 !! test
12255 BUG 1219 URL next to image (broken)
12256 !! wikitext
12257 http://example.com[[Image:foobar.jpg]]
12258 !! html
12259 <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>
12260 </p>
12261 !!end
12263 !! test
12264 Bug 1186 news: in the middle of text
12265 !! wikitext
12266 http://en.wikinews.org/wiki/Wikinews:Workplace
12267 !! html
12268 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12269 </p>
12270 !!end
12273 !! test
12274 Namespaced link must have a title
12275 !! wikitext
12276 [[Project:]]
12277 !! html
12278 <p>[[Project:]]
12279 </p>
12280 !!end
12282 !! test
12283 Namespaced link must have a title (bad fragment version)
12284 !! wikitext
12285 [[Project:#fragment]]
12286 !! html
12287 <p>[[Project:#fragment]]
12288 </p>
12289 !!end
12293 ### HTML tags and HTML attributes
12296 !! test
12297 div with no attributes
12298 !! wikitext
12299 <div>HTML rocks</div>
12300 !! html
12301 <div>HTML rocks</div>
12303 !! end
12305 !! test
12306 div with double-quoted attribute
12307 !! wikitext
12308 <div id="rock">HTML rocks</div>
12309 !! html
12310 <div id="rock">HTML rocks</div>
12312 !! end
12314 !! test
12315 div with single-quoted attribute
12316 !! wikitext
12317 <div id='rock'>HTML rocks</div>
12318 !! html
12319 <div id="rock">HTML rocks</div>
12321 !! end
12323 !! test
12324 div with unquoted attribute
12325 !! wikitext
12326 <div id=rock>HTML rocks</div>
12327 !! html
12328 <div id="rock">HTML rocks</div>
12330 !! end
12332 !! test
12333 div with illegal double attributes
12334 !! wikitext
12335 <div id="a" id="b">HTML rocks</div>
12336 !! html
12337 <div id="b">HTML rocks</div>
12339 !!end
12341 # FIXME: produce empty string instead of "class" in the PHP parser, following
12342 # the HTML5 spec.
12343 !! test
12344 div with empty attribute value, space before equals
12345 !! options
12346 parsoid
12347 !! wikitext
12348 <div class =>HTML rocks</div>
12349 !! html
12350 <div class="">HTML rocks</div>
12352 !! end
12354 # The PHP parser escapes the opening brace to &#123; for some reason, so
12355 # disabled this test for it.
12356 !! test
12357 div with braces in attribute value
12358 !! options
12359 parsoid
12360 !! wikitext
12361 <div title="{}">Foo</div>
12362 !! html
12363 <div title="{}">Foo</div>
12364 !! end
12366 # This it very inconsistent in the PHP parser: it returns 
12367 # class="class" if there is a space between the name and the equal sign (see
12368 # 'div with empty attribute value, space before equals'), but strips the
12369 # attribute completely if the space is missing. We hope that not much content
12370 # depends on this, so are implementing the behavior below in Parsoid for
12371 # consistencies' sake. Disabled for the PHP parser. 
12372 # FIXME: fix this behavior in the PHP parser?
12373 !! test
12374 div with empty attribute value, no space before equals
12375 !! options
12376 parsoid
12377 !! wikitext
12378 <div class=>HTML rocks</div>
12379 !! html
12380 <div class="">HTML rocks</div>
12382 !! end
12384 !! test
12385 HTML multiple attributes correction
12386 !! wikitext
12387 <p class="error" class="awesome">Awesome!</p>
12388 !! html
12389 <p class="awesome">Awesome!</p>
12391 !!end
12393 !! test
12394 Table multiple attributes correction
12395 !! wikitext
12397 !+ class="error" class="awesome"| status
12399 !! html
12400 <table>
12401 <tr>
12402 <th class="awesome"> status
12403 </th></tr></table>
12405 !!end
12407 !! test
12408 DIV IN UPPERCASE
12409 !! wikitext
12410 <DIV ID="x">HTML ROCKS</DIV>
12411 !! html
12412 <div id="x">HTML ROCKS</div>
12414 !!end
12416 !! test
12417 Non-ASCII pseudo-tags are rendered as text
12418 !! wikitext
12419 <khyô>
12420 !! html
12421 <p>&lt;khyô&gt;
12422 </p>
12423 !! end
12425 !! test
12426 Pseudo-tag with URL 'name' renders as url link
12427 !! wikitext
12428 <http://example.com/>
12429 !! html
12430 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12431 </p>
12432 !! end
12434 !! test
12435 text with amp in the middle of nowhere
12436 !! wikitext
12437 Remember AT&T?
12438 !! html
12439 <p>Remember AT&amp;T?
12440 </p>
12441 !! end
12443 !! test
12444 text with character entity: eacute
12445 !! wikitext
12446 I always thought &eacute; was a cute letter.
12447 !! html
12448 <p>I always thought &#233; was a cute letter.
12449 </p>
12450 !! end
12452 !! test
12453 text with entity-escaped character entity-like string: eacute
12454 !! wikitext
12455 I always thought &amp;eacute; was a cute letter.
12456 !! html
12457 <p>I always thought &amp;eacute; was a cute letter.
12458 </p>
12459 !! end
12461 !! test
12462 text with undefined character entity: xacute
12463 !! wikitext
12464 I always thought &xacute; was a cute letter.
12465 !! html
12466 <p>I always thought &amp;xacute; was a cute letter.
12467 </p>
12468 !! end
12470 # TODO: generalize to PHP parser?
12471 !! test
12472 HTML5 tags
12473 !! options
12474 parsoid
12475 !! wikitext
12476 <data value="5">five</data>
12477 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12478 <mark>This highlighted text</mark>
12479 !! html
12480 <p><data value="5">five</data>
12481 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12482 <mark>This highlighted text</mark></p>
12483 !! end
12485 !! test
12486 HTML tag with leading space is parsed as text
12487 !! wikitext
12488 < div>foo< /div>
12489 !! html
12490 <p>&lt; div&gt;foo&lt; /div&gt;
12491 </p>
12492 !! end
12495 ### Nesting tests (see bug 41545, 50604, 51081)
12498 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12499 # Note that html2wt is considerably more difficult if we use <b> in
12500 # the test case, instead of <big>
12501 !! test
12502 Ensure that HTML adoption agency algorithm is properly implemented.
12503 !! wikitext
12504 <big>X<big>Y</big>Z</big>
12505 !! html
12506 <p><big>X<big>Y</big>Z</big>
12507 </p>
12508 !! end
12510 # This was bug 41545 in the PHP parser.
12511 !! test
12512 Nesting of <kbd>
12513 !! wikitext
12514 <kbd>X<kbd>Y</kbd>Z</kbd>
12515 !! html
12516 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12517 </p>
12518 !! end
12520 # The following cases were bug 51081 in the PHP parser.
12521 # Note that there are some other nestable tags (b, i, etc) which are
12522 # not covered; see bug 51081 for discussion.
12523 !! test
12524 Nesting of <em>
12525 !! wikitext
12526 <em>X<em>Y</em>Z</em>
12527 !! html
12528 <p><em>X<em>Y</em>Z</em>
12529 </p>
12530 !! end
12532 !! test
12533 Nesting of <strong>
12534 !! wikitext
12535 <strong>X<strong>Y</strong>Z</strong>
12536 !! html
12537 <p><strong>X<strong>Y</strong>Z</strong>
12538 </p>
12539 !! end
12541 !! test
12542 Nesting of <q>
12543 !! wikitext
12544 <q>X<q>Y</q>Z</q>
12545 !! html
12546 <p><q>X<q>Y</q>Z</q>
12547 </p>
12548 !! end
12550 !! test
12551 Nesting of <ruby>
12552 !! wikitext
12553 <ruby>X<ruby>Y</ruby>Z</ruby>
12554 !! html
12555 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12556 </p>
12557 !! end
12559 !! test
12560 Nesting of <bdo>
12561 !! wikitext
12562 <bdo>X<bdo>Y</bdo>Z</bdo>
12563 !! html
12564 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12565 </p>
12566 !! end
12570 ### Media links
12573 !! test
12574 Media link
12575 !! wikitext
12576 [[Media:Foobar.jpg]]
12577 !! html
12578 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12579 </p>
12580 !! end
12582 !! test
12583 Media link with text
12584 !! wikitext
12585 [[Media:Foobar.jpg|A neat file to look at]]
12586 !! html
12587 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12588 </p>
12589 !! end
12591 # FIXME: this is still bad HTML tag nesting
12592 !! test
12593 Media link with nasty text
12594 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12595 !! wikitext
12596 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12597 !! html
12598 <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>
12600 !! end
12602 !! test
12603 Media link to nonexistent file (bug 1702)
12604 !! wikitext
12605 [[Media:No such.jpg]]
12606 !! html
12607 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12608 </p>
12609 !! end
12611 !! test
12612 Image link to nonexistent file (bug 1850 - good)
12613 !! wikitext
12614 [[Image:No such.jpg]]
12615 !! html
12616 <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>
12617 </p>
12618 !! end
12620 !! test
12621 :Image link to nonexistent file (bug 1850 - bad)
12622 !! wikitext
12623 [[:Image:No such.jpg]]
12624 !! html
12625 <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>
12626 </p>
12627 !! end
12631 !! test
12632 Character reference normalization in link text (bug 1938)
12633 !! wikitext
12634 [[Main Page|this&that]]
12635 !! html
12636 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12637 </p>
12638 !!end
12640 !! article
12641 אַ
12642 !! text
12643 Test for unicode normalization
12645 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12646 !! endarticle
12648 !! test
12649 (bug 19451) Links should refer to the normalized form.
12650 !! wikitext
12651 [[&#xFB2E;]]
12652 [[&#x5d0;&#x5b7;]]
12653 [[&#x5d0;ַ]]
12654 [[א&#x5b7;]]
12655 [[אַ]]
12656 !! html
12657 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12658 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12659 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12660 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12661 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12662 </p>
12663 !! end
12665 !! test
12666 Empty attribute crash test (bug 2067)
12667 !! wikitext
12668 <font color="">foo</font>
12669 !! html
12670 <p><font color="">foo</font>
12671 </p>
12672 !! end
12674 !! test
12675 Empty attribute crash test single-quotes (bug 2067)
12676 !! wikitext
12677 <font color=''>foo</font>
12678 !! html
12679 <p><font color="">foo</font>
12680 </p>
12681 !! end
12683 !! test
12684 Attribute test: equals, then nothing
12685 !! wikitext
12686 <font color=>foo</font>
12687 !! html
12688 <p><font>foo</font>
12689 </p>
12690 !! end
12692 !! test
12693 Attribute test: unquoted value
12694 !! wikitext
12695 <font color=x>foo</font>
12696 !! html
12697 <p><font color="x">foo</font>
12698 </p>
12699 !! end
12701 !! test
12702 Attribute test: unquoted but illegal value (hash)
12703 !! wikitext
12704 <font color=#x>foo</font>
12705 !! html
12706 <p><font color="#x">foo</font>
12707 </p>
12708 !! end
12710 !! test
12711 Attribute test: no value
12712 !! wikitext
12713 <font color>foo</font>
12714 !! html
12715 <p><font color="color">foo</font>
12716 </p>
12717 !! end
12719 !! test
12720 Bug 2095: link with three closing brackets
12721 !! wikitext
12722 [[Main Page]]]
12723 !! html/php
12724 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12725 </p>
12726 !! html/parsoid
12727 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12728 !! end
12730 !! test
12731 Bug 2095: link with pipe and three closing brackets
12732 !! wikitext
12733 [[Main Page|link]]]
12734 !! html/php
12735 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12736 </p>
12737 !! html/parsoid
12738 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12739 !! end
12741 !! test
12742 Bug 2095: link with pipe and three closing brackets, version 2
12743 !! wikitext
12744 [[Main Page|[http://example.com/]]]
12745 !! html/php
12746 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12747 </p>
12748 !! html/parsoid
12749 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12750 !! end
12754 ### Safety
12757 !! article
12758 Template:Dangerous attribute
12759 !! text
12760 " onmouseover="alert(document.cookie)
12761 !! endarticle
12763 !! article
12764 Template:Dangerous style attribute
12765 !! text
12766 border-size: expression(alert(document.cookie))
12767 !! endarticle
12769 !! article
12770 Template:Div style
12771 !! text
12772 <div style="float: right; {{{1}}}">Magic div</div>
12773 !! endarticle
12775 !! test
12776 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
12777 !! wikitext
12778 <div title="{{test}}"></div>
12779 !! html
12780 <div title="This is a test template"></div>
12782 !! end
12784 !! test
12785 Bug 2304: HTML attribute safety (dangerous template; 2309)
12786 !! wikitext
12787 <div title="{{dangerous attribute}}"></div>
12788 !! html
12789 <div title=""></div>
12791 !! end
12793 !! test
12794 Bug 2304: HTML attribute safety (dangerous style template; 2309)
12795 !! wikitext
12796 <div style="{{dangerous style attribute}}"></div>
12797 !! html
12798 <div style="/* insecure input */"></div>
12800 !! end
12802 !! test
12803 Bug 2304: HTML attribute safety (safe parameter; 2309)
12804 !! wikitext
12805 {{div style|width: 200px}}
12806 !! html
12807 <div style="float: right; width: 200px">Magic div</div>
12809 !! end
12811 !! test
12812 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
12813 !! wikitext
12814 {{div style|width: expression(alert(document.cookie))}}
12815 !! html
12816 <div style="/* insecure input */">Magic div</div>
12818 !! end
12820 !! test
12821 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
12822 !! wikitext
12823 {{div style|"><script>alert(document.cookie)</script>}}
12824 !! html
12825 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12827 !! end
12829 !! test
12830 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
12831 !! wikitext
12832 {{div style|" ><script>alert(document.cookie)</script>}}
12833 !! html
12834 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
12836 !! end
12838 !! test
12839 Bug 2304: HTML attribute safety (link)
12840 !! wikitext
12841 <div title="[[Main Page]]"></div>
12842 !! html
12843 <div title="&#91;&#91;Main Page]]"></div>
12845 !! end
12847 !! test
12848 Bug 2304: HTML attribute safety (italics)
12849 !! wikitext
12850 <div title="''foobar''"></div>
12851 !! html
12852 <div title="&#39;&#39;foobar&#39;&#39;"></div>
12854 !! end
12856 !! test
12857 Bug 2304: HTML attribute safety (bold)
12858 !! wikitext
12859 <div title="'''foobar'''"></div>
12860 !! html
12861 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
12863 !! end
12866 !! test
12867 Bug 2304: HTML attribute safety (ISBN)
12868 !! wikitext
12869 <div title="ISBN 1234567890"></div>
12870 !! html
12871 <div title="&#73;SBN 1234567890"></div>
12873 !! end
12875 !! test
12876 Bug 2304: HTML attribute safety (RFC)
12877 !! wikitext
12878 <div title="RFC 1234"></div>
12879 !! html
12880 <div title="&#82;FC 1234"></div>
12882 !! end
12884 !! test
12885 Bug 2304: HTML attribute safety (PMID)
12886 !! wikitext
12887 <div title="PMID 1234567890"></div>
12888 !! html
12889 <div title="&#80;MID 1234567890"></div>
12891 !! end
12893 !! test
12894 Bug 2304: HTML attribute safety (web link)
12895 !! wikitext
12896 <div title="http://example.com/"></div>
12897 !! html
12898 <div title="http&#58;//example.com/"></div>
12900 !! end
12902 !! test
12903 Bug 2304: HTML attribute safety (named web link)
12904 !! wikitext
12905 <div title="[http://example.com/ link]"></div>
12906 !! html
12907 <div title="&#91;http&#58;//example.com/ link]"></div>
12909 !! end
12911 !! test
12912 Bug 3244: HTML attribute safety (extension; safe)
12913 !! wikitext
12914 <div style="<nowiki>background:blue</nowiki>"></div>
12915 !! html
12916 <div style="background:blue"></div>
12918 !! end
12920 !! test
12921 Bug 3244: HTML attribute safety (extension; unsafe)
12922 !! wikitext
12923 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
12924 !! html
12925 <div style="/* insecure input */"></div>
12927 !! end
12929 # More MSIE fun discovered by Tom Gilder
12931 !! test
12932 MSIE CSS safety test: spurious slash
12933 !! wikitext
12934 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
12935 !! html
12936 <div style="/* insecure input */">evil</div>
12938 !! end
12940 !! test
12941 MSIE CSS safety test: hex code
12942 !! wikitext
12943 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
12944 !! html
12945 <div style="/* insecure input */">evil</div>
12947 !! end
12949 !! test
12950 MSIE CSS safety test: comment in url
12951 !! wikitext
12952 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
12953 !! html
12954 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
12956 !! end
12958 !! test
12959 MSIE CSS safety test: comment in expression
12960 !! wikitext
12961 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
12962 !! html
12963 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
12965 !! end
12967 !! test
12968 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
12969 !! wikitext
12970 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
12971 !! html
12972 <p style="/* invalid control char */">A</p>
12974 !! end
12976 !! test
12977 MSIE 6 CSS safety test: Fullwidth (bug 55332)
12978 !! wikitext
12979 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
12980 <div style="top:EXPRESSION(alert())">B</div>
12981 !! html
12982 <p style="/* insecure input */">A</p>
12983 <div style="/* insecure input */">B</div>
12985 !! end
12987 !! test
12988 MSIE 6 CSS safety test: IPA extensions (bug 55332)
12989 !! wikitext
12990 <div style="background-image:uʀʟ(javascript:alert())">A</div>
12991 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
12992 !! html
12993 <div style="/* insecure input */">A</div>
12994 <p style="/* insecure input */">B</p>
12996 !! end
12998 !! test
12999 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13000 !! wikitext
13001 <div style="background-image:url⁽javascript:alert())">A</div>
13002 <div style="background-image:url₍javascript:alert())">B</div>
13003 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13004 !! html
13005 <div style="/* insecure input */">A</div>
13006 <div style="/* insecure input */">B</div>
13007 <p style="/* insecure input */">C</p>
13009 !! end
13011 !! test
13012 Opera -o-link CSS
13013 !! wikitext
13014 <div
13015 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;"
13016 style="-o-link:attr(title);-o-link-source:current">X</div>
13017 !! html
13018 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13020 !! end
13022 !! test
13023 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13024 !! wikitext
13025 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13026 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13027 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13028 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13029 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13030 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13031 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13032 !! html
13033 <p style="/* insecure input */">A</p>
13034 <p style="/* insecure input */">B</p>
13035 <p style="/* insecure input */">C</p>
13036 <p style="/* insecure input */">D</p>
13037 <p style="/* insecure input */">E</p>
13038 <p style="/* insecure input */">F</p>
13039 <p style="/* insecure input */">G</p>
13041 !! end
13043 !! test
13044 Table attribute legitimate extension
13045 !! wikitext
13047 !+ style="<nowiki>color:blue</nowiki>"| status
13049 !! html
13050 <table>
13051 <tr>
13052 <th style="color:blue"> status
13053 </th></tr></table>
13055 !!end
13057 !! test
13058 Table attribute safety
13059 !! wikitext
13061 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13063 !! html
13064 <table>
13065 <tr>
13066 <th style="/* insecure input */"> status
13067 </th></tr></table>
13069 !! end
13071 !! test
13072 CSS line continuation 1
13073 !! wikitext
13074 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13075 !! html
13076 <div style="/* insecure input */"></div>
13078 !! end
13080 !! test
13081 CSS line continuation 2
13082 !! wikitext
13083 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13084 !! html
13085 <div style="/* insecure input */"></div>
13087 !! end
13089 !! article
13090 Template:Identity
13091 !! text
13092 {{{1}}}
13093 !! endarticle
13095 !! test
13096 Expansion of multi-line templates in attribute values (bug 6255)
13097 !! wikitext
13098 <div style="background: {{identity|#00FF00}}">-</div>
13099 !! html
13100 <div style="background: #00FF00">-</div>
13102 !! end
13105 !! test
13106 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13107 !! wikitext
13108 <div style="background: 
13109 #00FF00">-</div>
13110 !! html
13111 <div style="background: #00FF00">-</div>
13113 !! end
13115 !! test
13116 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13117 !! wikitext
13118 <div style="background: &#10;#00FF00">-</div>
13119 !! html
13120 <div style="background: &#10;#00FF00">-</div>
13122 !! end
13125 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13127 !! test
13128 Parser hook: empty input
13129 !! wikitext
13130 <tag></tag>
13131 !! html
13132 <pre>
13134 array (
13136 </pre>
13138 !! end
13140 !! test
13141 Parser hook: empty input using terminated empty elements
13142 !! wikitext
13143 <tag/>
13144 !! html
13145 <pre>
13146 NULL
13147 array (
13149 </pre>
13151 !! end
13153 !! test
13154 Parser hook: empty input using terminated empty elements (space before)
13155 !! wikitext
13156 <tag />
13157 !! html
13158 <pre>
13159 NULL
13160 array (
13162 </pre>
13164 !! end
13166 !! test
13167 Parser hook: basic input
13168 !! wikitext
13169 <tag>input</tag>
13170 !! html
13171 <pre>
13172 'input'
13173 array (
13175 </pre>
13177 !! end
13180 !! test
13181 Parser hook: case insensitive
13182 !! wikitext
13183 <TAG>input</TAG>
13184 !! html
13185 <pre>
13186 'input'
13187 array (
13189 </pre>
13191 !! end
13194 !! test
13195 Parser hook: case insensitive, redux
13196 !! wikitext
13197 <TaG>input</TAg>
13198 !! html
13199 <pre>
13200 'input'
13201 array (
13203 </pre>
13205 !! end
13207 !! test
13208 Parser hook: nested tags
13209 !! options
13210 noxml
13211 !! wikitext
13212 <tag><tag></tag></tag>
13213 !! html
13214 <pre>
13215 '<tag>'
13216 array (
13218 </pre>&lt;/tag&gt;
13220 !! end
13222 !! test
13223 Parser hook: basic arguments
13224 !! wikitext
13225 <tag width=200 height = "100" depth = '50' square></tag>
13226 !! html
13227 <pre>
13229 array (
13230   'width' => '200',
13231   'height' => '100',
13232   'depth' => '50',
13233   'square' => 'square',
13235 </pre>
13237 !! end
13239 !! test
13240 Parser hook: argument containing a forward slash (bug 5344)
13241 !! wikitext
13242 <tag filename='/tmp/bla'></tag>
13243 !! html
13244 <pre>
13246 array (
13247   'filename' => '/tmp/bla',
13249 </pre>
13251 !! end
13253 !! test
13254 Parser hook: empty input using terminated empty elements (bug 2374)
13255 !! wikitext
13256 <tag foo=bar/>text
13257 !! html
13258 <pre>
13259 NULL
13260 array (
13261   'foo' => 'bar',
13263 </pre>text
13265 !! end
13267 # </tag> should be output literally since there is no matching tag that begins it
13268 !! test
13269 Parser hook: basic arguments using terminated empty elements (bug 2374)
13270 !! wikitext
13271 <tag width=200 height = "100" depth = '50' square/>
13272 other stuff
13273 </tag>
13274 !! html
13275 <pre>
13276 NULL
13277 array (
13278   'width' => '200',
13279   'height' => '100',
13280   'depth' => '50',
13281   'square' => 'square',
13283 </pre>
13284 <p>other stuff
13285 &lt;/tag&gt;
13286 </p>
13287 !! end
13290 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13293 !! test
13294 Parser hook: static parser hook not inside a comment
13295 !! wikitext
13296 <statictag>hello, world</statictag>
13297 <statictag action=flush/>
13298 !! html
13299 <p>hello, world
13300 </p>
13301 !! end
13304 !! test
13305 Parser hook: static parser hook inside a comment
13306 !! wikitext
13307 <!-- <statictag>hello, world</statictag> -->
13308 <statictag action=flush/>
13309 !! html
13310 <p><br />
13311 </p>
13312 !! end
13314 # Nested template calls; this case was broken by Parser.php rev 1.506,
13315 # since reverted.
13317 !! article
13318 Template:One-parameter
13319 !! text
13320 (My parameter is: {{{1}}})
13321 !! endarticle
13323 !! article
13324 Template:Map-one-parameter
13325 !! text
13326 {{{{{1}}}|{{{2}}}}}
13327 !! endarticle
13329 !! test
13330 Nested template calls
13331 !! wikitext
13332 {{Map-one-parameter|One-parameter|param}}
13333 !! html
13334 <p>(My parameter is: param)
13335 </p>
13336 !! end
13340 ### Sanitizer
13342 !! test
13343 Sanitizer: Closing of open tags
13344 !! wikitext
13345 <s></s><table></table>
13346 !! html
13347 <s></s><table></table>
13349 !! end
13351 !! test
13352 Sanitizer: Closing of open but not closed tags
13353 !! wikitext
13354 <s>foo
13355 !! html
13356 <p><s>foo</s>
13357 </p>
13358 !! end
13360 !! test
13361 Sanitizer: Closing of closed but not open tags
13362 !! wikitext
13363 </s>
13364 !! html
13365 <p>&lt;/s&gt;
13366 </p>
13367 !! end
13369 !! test
13370 Sanitizer: Closing of closed but not open table tags
13371 !! wikitext
13372 Table not started</td></tr></table>
13373 !! html
13374 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13375 </p>
13376 !! end
13378 !! test
13379 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13380 !! wikitext
13381 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13382 !! html
13383 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13384 </p>
13385 !! end
13387 !! test
13388 Sanitizer: Validating the contents of the id attribute (bug 4515)
13389 !! options
13390 disabled
13391 !! wikitext
13392 <br id=9 />
13393 !! html
13394 Something, but definitely not <br id="9" />...
13395 !! end
13397 !! test
13398 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13399 !! options
13400 disabled
13401 !! wikitext
13402 <br id="foo" /><br id="foo" />
13403 !! html
13404 Something need to be done. foo-2 ? 
13405 !! end
13407 !! test
13408 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13409 !! wikitext
13410 <div itemscope>
13411         <meta itemprop="hello" content="world">
13412         <meta http-equiv="refresh" content="5">
13413         <meta itemprop="hello" http-equiv="refresh" content="5">
13414         <link itemprop="hello" href="{{SERVER}}">
13415         <link rel="stylesheet" href="{{SERVER}}">
13416         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13417 </div>
13418 !! html
13419 <div itemscope="itemscope">
13420 <p>     <meta itemprop="hello" content="world" />
13421         &lt;meta http-equiv="refresh" content="5"&gt;
13422         <meta itemprop="hello" content="5" />
13423 </p>
13424         <link itemprop="hello" href="http&#58;//example.org" />
13425         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13426         <link itemprop="hello" href="http&#58;//example.org" />
13427 </div>
13429 !! end
13431 !! test
13432 Language converter: output gets cut off unexpectedly (bug 5757)
13433 !! options
13434 language=zh
13435 !! wikitext
13436 this bit is safe: }-
13438 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13440 then we get cut off here: }-
13442 all additional text is vanished
13443 !! html
13444 <p>this bit is safe: }-
13445 </p><p>but if we add a conversion instance: xxx
13446 </p><p>then we get cut off here: }-
13447 </p><p>all additional text is vanished
13448 </p>
13449 !! end
13451 !! test
13452 Self closed html pairs (bug 5487)
13453 !! options
13454 !! wikitext
13455 <center><font id="bug" />Centered text</center>
13456 <div><font id="bug2" />In div text</div>
13457 !! html
13458 <center>&lt;font id="bug" /&gt;Centered text</center>
13459 <div>&lt;font id="bug2" /&gt;In div text</div>
13461 !! end
13467 !! test
13468 Punctuation: nbsp before exclamation
13469 !! wikitext
13470 C'est grave !
13471 !! html
13472 <p>C'est grave&#160;!
13473 </p>
13474 !! end
13476 !! test
13477 Punctuation: CSS !important (bug 11874)
13478 !! wikitext
13479 <div style="width:50% !important">important</div>
13480 !! html
13481 <div style="width:50% !important">important</div>
13483 !!end
13485 !! test
13486 Punctuation: CSS ! important (bug 11874; with space after)
13487 !! wikitext
13488 <div style="width:50% ! important">important</div>
13489 !! html
13490 <div style="width:50% ! important">important</div>
13492 !!end
13495 !! test
13496 HTML bullet list, closed tags (bug 5497)
13497 !! wikitext
13498 <ul>
13499 <li>One</li>
13500 <li>Two</li>
13501 </ul>
13502 !! html
13503 <ul>
13504 <li>One</li>
13505 <li>Two</li>
13506 </ul>
13508 !! end
13510 !! test
13511 HTML bullet list, unclosed tags (bug 5497)
13512 !! options
13513 disabled
13514 !! wikitext
13515 <ul>
13516 <li>One
13517 <li>Two
13518 </ul>
13519 !! html
13520 <ul>
13521 <li>One
13522 </li>
13523 <li>Two
13524 </li>
13525 </ul>
13527 !! end
13529 !! test
13530 HTML ordered list, closed tags (bug 5497)
13531 !! wikitext
13532 <ol>
13533 <li>One</li>
13534 <li>Two</li>
13535 </ol>
13536 !! html
13537 <ol>
13538 <li>One</li>
13539 <li>Two</li>
13540 </ol>
13542 !! end
13544 !! test
13545 HTML ordered list, unclosed tags (bug 5497)
13546 !! options
13547 disabled
13548 !! wikitext
13549 <ol>
13550 <li>One
13551 <li>Two
13552 </ol>
13553 !! html
13554 <ol>
13555 <li>One
13556 </li>
13557 <li>Two
13558 </li>
13559 </ol>
13561 !! end
13563 !! test
13564 HTML nested bullet list, closed tags (bug 5497)
13565 !! wikitext
13566 <ul>
13567 <li>One</li>
13568 <li>Two:
13569 <ul>
13570 <li>Sub-one</li>
13571 <li>Sub-two</li>
13572 </ul>
13573 </li>
13574 </ul>
13575 !! html
13576 <ul>
13577 <li>One</li>
13578 <li>Two:
13579 <ul>
13580 <li>Sub-one</li>
13581 <li>Sub-two</li>
13582 </ul>
13583 </li>
13584 </ul>
13586 !! end
13588 !! test
13589 HTML nested bullet list, open tags (bug 5497)
13590 !! options
13591 disabled
13592 !! wikitext
13593 <ul>
13594 <li>One
13595 <li>Two:
13596 <ul>
13597 <li>Sub-one
13598 <li>Sub-two
13599 </ul>
13600 </ul>
13601 !! html
13602 <ul>
13603 <li>One
13604 </li>
13605 <li>Two:
13606 <ul>
13607 <li>Sub-one
13608 </li>
13609 <li>Sub-two
13610 </li>
13611 </ul>
13612 </li>
13613 </ul>
13615 !! end
13617 !! test
13618 HTML nested ordered list, closed tags (bug 5497)
13619 !! wikitext
13620 <ol>
13621 <li>One</li>
13622 <li>Two:
13623 <ol>
13624 <li>Sub-one</li>
13625 <li>Sub-two</li>
13626 </ol>
13627 </li>
13628 </ol>
13629 !! html
13630 <ol>
13631 <li>One</li>
13632 <li>Two:
13633 <ol>
13634 <li>Sub-one</li>
13635 <li>Sub-two</li>
13636 </ol>
13637 </li>
13638 </ol>
13640 !! end
13642 !! test
13643 HTML nested ordered list, open tags (bug 5497)
13644 !! options
13645 disabled
13646 !! wikitext
13647 <ol>
13648 <li>One
13649 <li>Two:
13650 <ol>
13651 <li>Sub-one
13652 <li>Sub-two
13653 </ol>
13654 </ol>
13655 !! html
13656 <ol>
13657 <li>One
13658 </li>
13659 <li>Two:
13660 <ol>
13661 <li>Sub-one
13662 </li>
13663 <li>Sub-two
13664 </li>
13665 </ol>
13666 </li>
13667 </ol>
13669 !! end
13671 !! test
13672 HTML ordered list item with parameters oddity
13673 !! wikitext
13674 <ol><li id="fragment">One</li>
13675 </ol>
13676 !! html
13677 <ol><li id="fragment">One</li>
13678 </ol>
13680 !! end
13682 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13683 !!test
13684 bug 5918: autonumbering
13685 !! wikitext
13686 [http://first/] [http://second] [ftp://ftp]
13688 ftp://inlineftp
13690 [mailto:enclosed@mail.tld With target]
13692 [mailto:enclosed@mail.tld]
13694 mailto:inline@mail.tld
13695 !! html/php
13696 <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>
13697 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13698 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13699 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13700 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13701 </p>
13702 !! html/parsoid
13703 <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>
13704 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13705 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13706 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13707 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13708 !! end
13712 # Security and HTML correctness
13713 # From Nick Jenkins' fuzz testing
13716 !! test
13717 Fuzz testing: Parser13
13718 !! wikitext
13719 {| 
13720 | http://a|
13721 !! html
13722 <table>
13723 <tr>
13724 <td>
13725 </td>
13726 </tr>
13727 </table>
13729 !! end
13731 !! test
13732 Fuzz testing: Parser14
13733 !! wikitext
13734 == onmouseover= ==
13735 http://__TOC__
13736 !! html
13737 <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>
13738 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13739 <ul>
13740 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13741 </ul>
13742 </div>
13745 !! end
13747 !! test
13748 Fuzz testing: Parser14-table
13749 !! wikitext
13750 ==a==
13751 {| STYLE=__TOC__
13752 !! html
13753 <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>
13754 <table style="&#95;_TOC&#95;_">
13755 <tr><td></td></tr>
13756 </table>
13758 !! end
13760 # Known to produce bogus xml (extra </td>)
13761 !! test
13762 Fuzz testing: Parser16
13763 !! options
13764 noxml
13765 !! wikitext
13767 !https://||||||
13768 !! html
13769 <table>
13770 <tr>
13771 <th>https://</th>
13772 <th></th>
13773 <th></th>
13774 <th>
13775 </td>
13776 </tr>
13777 </table>
13779 !! end
13781 !! test
13782 Fuzz testing: Parser21
13783 !! wikitext
13785 ! irc://{{ftp://a" onmouseover="alert('hello world');"
13787 !! html
13788 <table>
13789 <tr>
13790 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
13791 </th>
13792 <td>
13793 </td>
13794 </tr>
13795 </table>
13797 !! end
13799 !! test
13800 Fuzz testing: Parser22
13801 !! wikitext
13802 http://===r:::https://b
13805 !! html
13806 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
13807 </p>
13808 <table>
13809 <tr><td></td></tr>
13810 </table>
13812 !! end
13814 # Known to produce bad XML for now
13815 !! test
13816 Fuzz testing: Parser24
13817 !! options
13818 noxml
13819 !! wikitext
13821 {{{|
13822 <u CLASS=
13823 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
13824 <br style="onmouseover='alert(document.cookie);' " />
13826 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13828 !! html
13829 <table>
13830 {{{|
13831 <u class="&#124;">}}}} &gt;
13832 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
13834 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
13835 <tr>
13836 <td></u>
13837 </td>
13838 </tr>
13839 </table>
13841 !! end
13843 # Note: the current result listed for this is not what the original one was,
13844 # but the original bug was JavaScript injection, which is fixed in any case.
13845 # It's not clear that the original result listed was any more correct than the
13846 # current one.  Original result:
13847 # <p>{{{| 
13848 # </p>
13849 # <li class="&#124;&#124;">
13850 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13851 !!test
13852 Fuzz testing: Parser25 (bug 6055)
13853 !! wikitext
13856 <LI CLASS=||
13858 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
13859 !! html
13860 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
13861 </p>
13862 !! end
13864 !!test
13865 Fuzz testing: URL adjacent extension (with space, clean)
13866 !! options
13867 !! wikitext
13868 http://example.com <nowiki>junk</nowiki>
13869 !! html
13870 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
13871 </p>
13872 !!end
13874 !!test
13875 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
13876 !! options
13877 !! wikitext
13878 http://example.com<nowiki>junk</nowiki>
13879 !! html
13880 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
13881 </p>
13882 !!end
13884 !!test
13885 Fuzz testing: URL adjacent extension (no space, dirty; pre)
13886 !! options
13887 !! wikitext
13888 http://example.com<pre>junk</pre>
13889 !! html
13890 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
13892 !!end
13894 !!test
13895 Fuzz testing: image with bogus manual thumbnail
13896 !! wikitext
13897 [[Image:foobar.jpg|thumbnail= ]]
13898 !! html/php
13899 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
13901 !! html/parsoid
13902 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
13903 !!end
13905 !! test
13906 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
13907 !! wikitext
13908 <pre dir="&#10;"></pre>
13909 !! html
13910 <pre dir="&#10;"></pre>
13912 !! end
13914 !! test
13915 Parsing optional HTML elements (Bug 6171)
13916 !! options
13917 !! wikitext
13918 <table>
13919   <tr>
13920     <td> Some tabular data</td>
13921     <td> More tabular data ...
13922     <td> And yet som tabular data</td>
13923   </tr>
13924 </table>
13925 !! html
13926 <table>
13927   <tr>
13928     <td> Some tabular data</td>
13929     <td> More tabular data ...
13930     </td><td> And yet som tabular data</td>
13931   </tr>
13932 </table>
13934 !! end
13936 !! test
13937 Correct handling of <td>, <tr> (Bug 6171)
13938 !! options
13939 !! wikitext
13940 <table>
13941   <tr>
13942     <td> Some tabular data</td>
13943     <td> More tabular data ...</td>
13944     <td> And yet som tabular data</td>
13945   </tr>
13946 </table>
13947 !! html
13948 <table>
13949   <tr>
13950     <td> Some tabular data</td>
13951     <td> More tabular data ...</td>
13952     <td> And yet som tabular data</td>
13953   </tr>
13954 </table>
13956 !! end
13959 !! test
13960 Parsing crashing regression (fr:JavaScript)
13961 !! wikitext
13962 </body></x>
13963 !! html
13964 <p>&lt;/body&gt;&lt;/x&gt;
13965 </p>
13966 !! end
13968 !! test
13969 Inline wiki vs wiki block nesting
13970 !! wikitext
13971 '''Bold paragraph
13973 New wiki paragraph
13974 !! html
13975 <p><b>Bold paragraph</b>
13976 </p><p>New wiki paragraph
13977 </p>
13978 !! end
13980 !! test
13981 Inline HTML vs wiki block nesting
13982 !! options
13983 disabled
13984 !! wikitext
13985 <b>Bold paragraph
13987 New wiki paragraph
13988 !! html
13989 <p><b>Bold paragraph</b>
13990 </p><p>New wiki paragraph
13991 </p>
13992 !! end
13994 # Original result was this:
13995 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
13996 # </p>
13997 # While that might be marginally more intuitive, maybe, the six-apostrophe
13998 # construct is clearly pathological and the result stated here (which is what
13999 # the parser actually does) is about as reasonable as anything.
14000 !!test
14001 Mixing markup for italics and bold
14002 !! options
14003 !! wikitext
14004 '''bold''''''bold''bolditalics'''''
14005 !! html
14006 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14007 </p>
14008 !! end
14011 !! article
14012 Xyzzyx
14013 !! text
14014 Article for special page transclusion test
14015 !! endarticle
14017 !! test
14018 Special page transclusion
14019 !! options
14020 !! wikitext
14021 {{Special:Prefixindex/Xyzzyx}}
14022 !! html
14023 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14025 !! end
14027 !! test
14028 Special page transclusion twice (bug 5021)
14029 !! options
14030 !! wikitext
14031 {{Special:Prefixindex/Xyzzyx}}
14032 {{Special:Prefixindex/Xyzzyx}}
14033 !! html
14034 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14035 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14037 !! end
14039 !! test
14040 Transclusion of default MediaWiki message
14041 !! wikitext
14042 {{MediaWiki:Mainpage}}
14043 !! html
14044 <p>Main Page
14045 </p>
14046 !! end
14048 !! test
14049 Transclusion of nonexistent MediaWiki message
14050 !! wikitext
14051 {{MediaWiki:Mainpagexxx}}
14052 !! html
14053 <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>
14054 </p>
14055 !! end
14057 !! test
14058 Transclusion of MediaWiki message with underscore
14059 !! wikitext
14060 {{MediaWiki:history_short}}
14061 !! html
14062 <p>History
14063 </p>
14064 !! end
14066 !! test
14067 Transclusion of MediaWiki message with space
14068 !! wikitext
14069 {{MediaWiki:history short}}
14070 !! html
14071 <p>History
14072 </p>
14073 !! end
14075 !! test
14076 Invalid header with following text
14077 !! wikitext
14078 = x = y
14079 !! html
14080 <p>= x = y
14081 </p>
14082 !! end
14085 !! test
14086 Section extraction test (section 0)
14087 !! options
14088 section=0
14089 !! wikitext
14090 start
14091 ==a==
14092 ===aa===
14093 ====aaa====
14094 ==b==
14095 ===ba===
14096 ===bb===
14097 ====bba====
14098 ===bc===
14099 ==c==
14100 ===ca===
14101 !! html
14102 start
14103 !! end
14105 !! test
14106 Section extraction test (section 1)
14107 !! options
14108 section=1
14109 !! wikitext
14110 start
14111 ==a==
14112 ===aa===
14113 ====aaa====
14114 ==b==
14115 ===ba===
14116 ===bb===
14117 ====bba====
14118 ===bc===
14119 ==c==
14120 ===ca===
14121 !! html
14122 ==a==
14123 ===aa===
14124 ====aaa====
14125 !! end
14127 !! test
14128 Section extraction test (section 2)
14129 !! options
14130 section=2
14131 !! wikitext
14132 start
14133 ==a==
14134 ===aa===
14135 ====aaa====
14136 ==b==
14137 ===ba===
14138 ===bb===
14139 ====bba====
14140 ===bc===
14141 ==c==
14142 ===ca===
14143 !! html
14144 ===aa===
14145 ====aaa====
14146 !! end
14148 !! test
14149 Section extraction test (section 3)
14150 !! options
14151 section=3
14152 !! wikitext
14153 start
14154 ==a==
14155 ===aa===
14156 ====aaa====
14157 ==b==
14158 ===ba===
14159 ===bb===
14160 ====bba====
14161 ===bc===
14162 ==c==
14163 ===ca===
14164 !! html
14165 ====aaa====
14166 !! end
14168 !! test
14169 Section extraction test (section 4)
14170 !! options
14171 section=4
14172 !! wikitext
14173 start
14174 ==a==
14175 ===aa===
14176 ====aaa====
14177 ==b==
14178 ===ba===
14179 ===bb===
14180 ====bba====
14181 ===bc===
14182 ==c==
14183 ===ca===
14184 !! html
14185 ==b==
14186 ===ba===
14187 ===bb===
14188 ====bba====
14189 ===bc===
14190 !! end
14192 !! test
14193 Section extraction test (section 5)
14194 !! options
14195 section=5
14196 !! wikitext
14197 start
14198 ==a==
14199 ===aa===
14200 ====aaa====
14201 ==b==
14202 ===ba===
14203 ===bb===
14204 ====bba====
14205 ===bc===
14206 ==c==
14207 ===ca===
14208 !! html
14209 ===ba===
14210 !! end
14212 !! test
14213 Section extraction test (section 6)
14214 !! options
14215 section=6
14216 !! wikitext
14217 start
14218 ==a==
14219 ===aa===
14220 ====aaa====
14221 ==b==
14222 ===ba===
14223 ===bb===
14224 ====bba====
14225 ===bc===
14226 ==c==
14227 ===ca===
14228 !! html
14229 ===bb===
14230 ====bba====
14231 !! end
14233 !! test
14234 Section extraction test (section 7)
14235 !! options
14236 section=7
14237 !! wikitext
14238 start
14239 ==a==
14240 ===aa===
14241 ====aaa====
14242 ==b==
14243 ===ba===
14244 ===bb===
14245 ====bba====
14246 ===bc===
14247 ==c==
14248 ===ca===
14249 !! html
14250 ====bba====
14251 !! end
14253 !! test
14254 Section extraction test (section 8)
14255 !! options
14256 section=8
14257 !! wikitext
14258 start
14259 ==a==
14260 ===aa===
14261 ====aaa====
14262 ==b==
14263 ===ba===
14264 ===bb===
14265 ====bba====
14266 ===bc===
14267 ==c==
14268 ===ca===
14269 !! html
14270 ===bc===
14271 !! end
14273 !! test
14274 Section extraction test (section 9)
14275 !! options
14276 section=9
14277 !! wikitext
14278 start
14279 ==a==
14280 ===aa===
14281 ====aaa====
14282 ==b==
14283 ===ba===
14284 ===bb===
14285 ====bba====
14286 ===bc===
14287 ==c==
14288 ===ca===
14289 !! html
14290 ==c==
14291 ===ca===
14292 !! end
14294 !! test
14295 Section extraction test (section 10)
14296 !! options
14297 section=10
14298 !! wikitext
14299 start
14300 ==a==
14301 ===aa===
14302 ====aaa====
14303 ==b==
14304 ===ba===
14305 ===bb===
14306 ====bba====
14307 ===bc===
14308 ==c==
14309 ===ca===
14310 !! html
14311 ===ca===
14312 !! end
14314 !! test
14315 Section extraction test (nonexistent section 11)
14316 !! options
14317 section=11
14318 !! wikitext
14319 start
14320 ==a==
14321 ===aa===
14322 ====aaa====
14323 ==b==
14324 ===ba===
14325 ===bb===
14326 ====bba====
14327 ===bc===
14328 ==c==
14329 ===ca===
14330 !! html
14331 !! end
14333 !! test
14334 Section extraction test with bogus heading (section 1)
14335 !! options
14336 section=1
14337 !! wikitext
14338 ==a==
14339 ==bogus== not a legal section
14340 ==b==
14341 !! html
14342 ==a==
14343 ==bogus== not a legal section
14344 !! end
14346 !! test
14347 Section extraction test with bogus heading (section 2)
14348 !! options
14349 section=2
14350 !! wikitext
14351 ==a==
14352 ==bogus== not a legal section
14353 ==b==
14354 !! html
14355 ==b==
14356 !! end
14358 !! test
14359 Section extraction test with comment after heading (section 1)
14360 !! options
14361 section=1
14362 !! wikitext
14363 ==a==
14364 ==b== <!-- -->
14365 ==c==
14366 !! html
14367 ==a==
14368 !! end
14370 !! test
14371 Section extraction test with comment after heading (section 2)
14372 !! options
14373 section=2
14374 !! wikitext
14375 ==a==
14376 ==b== <!-- -->
14377 ==c==
14378 !! html
14379 ==b== <!-- -->
14380 !! end
14382 !! test
14383 Section extraction test with bogus <nowiki> heading (section 1)
14384 !! options
14385 section=1
14386 !! wikitext
14387 ==a==
14388 ==bogus== <nowiki>not a legal section</nowiki>
14389 ==b==
14390 !! html
14391 ==a==
14392 ==bogus== <nowiki>not a legal section</nowiki>
14393 !! end
14395 !! test
14396 Section extraction test with bogus <nowiki> heading (section 2)
14397 !! options
14398 section=2
14399 !! wikitext
14400 ==a==
14401 ==bogus== <nowiki>not a legal section</nowiki>
14402 ==b==
14403 !! html
14404 ==b==
14405 !! end
14408 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14409 # instead of respecting commented sections
14410 !! test
14411 Section extraction prefixed by comment (section 1)
14412 !! options
14413 section=1
14414 !! wikitext
14415 <!-- -->==sec1==
14416 ==sec2==
14417 !! html
14418 ==sec2==
14419 !!end
14421 !! test
14422 Section extraction prefixed by comment (section 2)
14423 !! options
14424 section=2
14425 !! wikitext
14426 <!-- -->==sec1==
14427 ==sec2==
14428 !! html
14430 !!end
14433 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14434 # instead of respecting HTML-style headings
14435 !! test
14436 Section extraction, mixed wiki and html (section 1)
14437 !! options
14438 section=1
14439 !! wikitext
14440 <h2>unmarked</h2>
14441 unmarked
14442 ==1==
14444 ==2==
14446 !! html
14447 ==1==
14449 !! end
14451 !! test
14452 Section extraction, mixed wiki and html (section 2)
14453 !! options
14454 section=2
14455 !! wikitext
14456 <h2>unmarked</h2>
14457 unmarked
14458 ==1==
14460 ==2==
14462 !! html
14463 ==2==
14465 !! end
14468 # Formerly testing for bug 3342
14469 !! test
14470 Section extraction, heading surrounded by <noinclude>
14471 !! options
14472 section=1
14473 !! wikitext
14474 <noinclude>==unmarked==</noinclude>
14475 ==marked==
14476 !! html
14477 ==marked==
14478 !!end
14480 # Test behavior of bug 19910
14481 !! test
14482 Sectiion with all-equals
14483 !! options
14484 section=2
14485 !! wikitext
14486 === 
14487 The line above must have a trailing space
14488 === <!--
14489 --> <!-- -->
14490 But just in case it doesn't...
14491 !! html
14492 === <!--
14493 --> <!-- -->
14494 But just in case it doesn't...
14495 !! end
14497 !! test
14498 Section replacement test (section 0)
14499 !! options
14500 replace=0,"xxx"
14501 !! wikitext
14502 start
14503 ==a==
14504 ===aa===
14505 ====aaa====
14506 ==b==
14507 ===ba===
14508 ===bb===
14509 ====bba====
14510 ===bc===
14511 ==c==
14512 ===ca===
14513 !! html
14516 ==a==
14517 ===aa===
14518 ====aaa====
14519 ==b==
14520 ===ba===
14521 ===bb===
14522 ====bba====
14523 ===bc===
14524 ==c==
14525 ===ca===
14526 !! end
14528 !! test
14529 Section replacement test (section 1)
14530 !! options
14531 replace=1,"xxx"
14532 !! wikitext
14533 start
14534 ==a==
14535 ===aa===
14536 ====aaa====
14537 ==b==
14538 ===ba===
14539 ===bb===
14540 ====bba====
14541 ===bc===
14542 ==c==
14543 ===ca===
14544 !! html
14545 start
14548 ==b==
14549 ===ba===
14550 ===bb===
14551 ====bba====
14552 ===bc===
14553 ==c==
14554 ===ca===
14555 !! end
14557 !! test
14558 Section replacement test (section 2)
14559 !! options
14560 replace=2,"xxx"
14561 !! wikitext
14562 start
14563 ==a==
14564 ===aa===
14565 ====aaa====
14566 ==b==
14567 ===ba===
14568 ===bb===
14569 ====bba====
14570 ===bc===
14571 ==c==
14572 ===ca===
14573 !! html
14574 start
14575 ==a==
14578 ==b==
14579 ===ba===
14580 ===bb===
14581 ====bba====
14582 ===bc===
14583 ==c==
14584 ===ca===
14585 !! end
14587 !! test
14588 Section replacement test (section 3)
14589 !! options
14590 replace=3,"xxx"
14591 !! wikitext
14592 start
14593 ==a==
14594 ===aa===
14595 ====aaa====
14596 ==b==
14597 ===ba===
14598 ===bb===
14599 ====bba====
14600 ===bc===
14601 ==c==
14602 ===ca===
14603 !! html
14604 start
14605 ==a==
14606 ===aa===
14609 ==b==
14610 ===ba===
14611 ===bb===
14612 ====bba====
14613 ===bc===
14614 ==c==
14615 ===ca===
14616 !! end
14618 !! test
14619 Section replacement test (section 4)
14620 !! options
14621 replace=4,"xxx"
14622 !! wikitext
14623 start
14624 ==a==
14625 ===aa===
14626 ====aaa====
14627 ==b==
14628 ===ba===
14629 ===bb===
14630 ====bba====
14631 ===bc===
14632 ==c==
14633 ===ca===
14634 !! html
14635 start
14636 ==a==
14637 ===aa===
14638 ====aaa====
14641 ==c==
14642 ===ca===
14643 !! end
14645 !! test
14646 Section replacement test (section 5)
14647 !! options
14648 replace=5,"xxx"
14649 !! wikitext
14650 start
14651 ==a==
14652 ===aa===
14653 ====aaa====
14654 ==b==
14655 ===ba===
14656 ===bb===
14657 ====bba====
14658 ===bc===
14659 ==c==
14660 ===ca===
14661 !! html
14662 start
14663 ==a==
14664 ===aa===
14665 ====aaa====
14666 ==b==
14669 ===bb===
14670 ====bba====
14671 ===bc===
14672 ==c==
14673 ===ca===
14674 !! end
14676 !! test
14677 Section replacement test (section 6)
14678 !! options
14679 replace=6,"xxx"
14680 !! wikitext
14681 start
14682 ==a==
14683 ===aa===
14684 ====aaa====
14685 ==b==
14686 ===ba===
14687 ===bb===
14688 ====bba====
14689 ===bc===
14690 ==c==
14691 ===ca===
14692 !! html
14693 start
14694 ==a==
14695 ===aa===
14696 ====aaa====
14697 ==b==
14698 ===ba===
14701 ===bc===
14702 ==c==
14703 ===ca===
14704 !! end
14706 !! test
14707 Section replacement test (section 7)
14708 !! options
14709 replace=7,"xxx"
14710 !! wikitext
14711 start
14712 ==a==
14713 ===aa===
14714 ====aaa====
14715 ==b==
14716 ===ba===
14717 ===bb===
14718 ====bba====
14719 ===bc===
14720 ==c==
14721 ===ca===
14722 !! html
14723 start
14724 ==a==
14725 ===aa===
14726 ====aaa====
14727 ==b==
14728 ===ba===
14729 ===bb===
14732 ===bc===
14733 ==c==
14734 ===ca===
14735 !! end
14737 !! test
14738 Section replacement test (section 8)
14739 !! options
14740 replace=8,"xxx"
14741 !! wikitext
14742 start
14743 ==a==
14744 ===aa===
14745 ====aaa====
14746 ==b==
14747 ===ba===
14748 ===bb===
14749 ====bba====
14750 ===bc===
14751 ==c==
14752 ===ca===
14753 !! html
14754 start
14755 ==a==
14756 ===aa===
14757 ====aaa====
14758 ==b==
14759 ===ba===
14760 ===bb===
14761 ====bba====
14764 ==c==
14765 ===ca===
14766 !!end
14768 !! test
14769 Section replacement test (section 9)
14770 !! options
14771 replace=9,"xxx"
14772 !! wikitext
14773 start
14774 ==a==
14775 ===aa===
14776 ====aaa====
14777 ==b==
14778 ===ba===
14779 ===bb===
14780 ====bba====
14781 ===bc===
14782 ==c==
14783 ===ca===
14784 !! html
14785 start
14786 ==a==
14787 ===aa===
14788 ====aaa====
14789 ==b==
14790 ===ba===
14791 ===bb===
14792 ====bba====
14793 ===bc===
14795 !! end
14797 !! test
14798 Section replacement test (section 10)
14799 !! options
14800 replace=10,"xxx"
14801 !! wikitext
14802 start
14803 ==a==
14804 ===aa===
14805 ====aaa====
14806 ==b==
14807 ===ba===
14808 ===bb===
14809 ====bba====
14810 ===bc===
14811 ==c==
14812 ===ca===
14813 !! html
14814 start
14815 ==a==
14816 ===aa===
14817 ====aaa====
14818 ==b==
14819 ===ba===
14820 ===bb===
14821 ====bba====
14822 ===bc===
14823 ==c==
14825 !! end
14827 !! test
14828 Section replacement test with initial whitespace (bug 13728)
14829 !! options
14830 replace=2,"xxx"
14831 !! wikitext
14832  Preformatted initial line
14833 ==a==
14834 ===a===
14835 !! html
14836  Preformatted initial line
14837 ==a==
14839 !! end
14842 !! test
14843 Section extraction, heading followed by pre with 20 spaces (bug 6398)
14844 !! options
14845 section=1
14846 !! wikitext
14847 ==a==
14848                     a
14849 !! html
14850 ==a==
14851                     a
14852 !! end
14854 !! test
14855 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
14856 !! options
14857 section=1
14858 !! wikitext
14859 ==a==
14860                    a
14861 !! html
14862 ==a==
14863                    a
14864 !! end
14867 !! test
14868 Section extraction, <pre> around bogus header (bug 10309)
14869 !! options
14870 noxml section=2
14871 !! wikitext
14872 == Section One ==
14873 <pre>
14874 =======
14875 </pre>
14877 == Section Two ==
14878 stuff
14879 !! html
14880 == Section Two ==
14881 stuff
14882 !! end
14884 !! test
14885 Section replacement, <pre> around bogus header (bug 10309)
14886 !! options
14887 noxml replace=2,"xxx"
14888 !! wikitext
14889 == Section One ==
14890 <pre>
14891 =======
14892 </pre>
14894 == Section Two ==
14895 stuff
14896 !! html
14897 == Section One ==
14898 <pre>
14899 =======
14900 </pre>
14903 !! end
14907 !! test
14908 Handling of &#x0A; in URLs
14909 !! wikitext
14910 ** irc://&#x0A;a
14911 !! html/php
14912 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14914 !! html/parsoid
14915 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
14916 a">irc://
14917 a</a></li></ul></li></ul>
14918 !! end
14920 !! test
14921 Handling of %0A in URLs
14922 !! wikitext
14923 ** irc://%0Aa
14924 !! html/php
14925 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14927 !! html/parsoid
14928 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
14929 !! end
14932 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
14933 !! test
14934 5 quotes, code coverage +1 line
14935 !! options
14936 parsoid=wt2html
14937 !! wikitext
14938 '''''
14939 !! html/php
14940 !! html/parsoid
14941 <p><b><i></i></b></p>
14942 !! end
14944 # same html as previous, but wikitext adjusted to match parsoid html2wt
14945 # note that wt2html and html2html will put the <i> before the <b>
14946 !! test
14947 5 quotes, code coverage +1 line w/ nowiki (1)
14948 !! options
14949 parsoid=wt2wt,html2wt
14950 !! wikitext
14951 '''''<nowiki/>'''''
14952 !! html/php
14953 <p><i></i>
14954 </p>
14955 !! html/parsoid
14956 <p><b><i></i></b></p>
14957 !! end
14959 # same as previous, just swapping the <i> and <b>
14960 !! test
14961 5 quotes, code coverage +1 line w/ nowiki (2)
14962 !! wikitext
14963 '''''<nowiki/>'''''
14964 !! html/php
14965 <p><i></i>
14966 </p>
14967 !! html/parsoid
14968 <p><i><b></b></i></p>
14969 !! end
14971 !! test
14972 Special:Search page linking.
14973 !! wikitext
14974 {{Special:search}}
14975 !! html
14976 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
14977 </p>
14978 !! end
14980 !! test
14981 Say the magic word
14982 !! options
14983 title=[[Parser test]]
14984 !! wikitext
14985 * {{PAGENAME}}
14986 * {{PAGENAMEE}}
14987 * {{FULLPAGENAME}}
14988 * {{FULLPAGENAMEE}}
14989 * {{BASEPAGENAME}}
14990 * {{BASEPAGENAMEE}}
14991 * {{SUBPAGENAME}}
14992 * {{SUBPAGENAMEE}}
14993 * {{ROOTPAGENAME}}
14994 * {{ROOTPAGENAMEE}}
14995 * {{TALKPAGENAME}}
14996 * {{TALKPAGENAMEE}}
14997 * {{SUBJECTPAGENAME}}
14998 * {{SUBJECTPAGENAMEE}}
14999 * {{NAMESPACEE}}
15000 * {{NAMESPACE}}
15001 * {{NAMESPACENUMBER}}
15002 * {{TALKSPACE}}
15003 * {{TALKSPACEE}}
15004 * {{SUBJECTSPACE}}
15005 * {{SUBJECTSPACEE}}
15006 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15007 !! html
15008 <ul><li> Parser test</li>
15009 <li> Parser_test</li>
15010 <li> Parser test</li>
15011 <li> Parser_test</li>
15012 <li> Parser test</li>
15013 <li> Parser_test</li>
15014 <li> Parser test</li>
15015 <li> Parser_test</li>
15016 <li> Parser test</li>
15017 <li> Parser_test</li>
15018 <li> Talk:Parser test</li>
15019 <li> Talk:Parser_test</li>
15020 <li> Parser test</li>
15021 <li> Parser_test</li>
15022 <li> </li>
15023 <li> </li>
15024 <li> 0</li>
15025 <li> Talk</li>
15026 <li> Talk</li>
15027 <li> </li>
15028 <li> </li>
15029 <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>
15031 !! end
15032 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15034 !! test
15035 Gallery
15036 !! wikitext
15037 <gallery>
15038 image1.png |
15039 image2.gif|||||
15041 image3|
15042 image4    |300px| centre
15043  image5.svg| http://///////
15044 [[x|xx]]]]
15045 * image6
15046 </gallery>
15047 !! html
15048 <ul class="gallery mw-gallery-traditional">
15049                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15050                         <div class="thumb" style="height: 150px;">Image1.png</div>
15051                         <div class="gallerytext">
15052                         </div>
15053                 </div></li>
15054                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15055                         <div class="thumb" style="height: 150px;">Image2.gif</div>
15056                         <div class="gallerytext">
15057 <p>||||
15058 </p>
15059                         </div>
15060                 </div></li>
15061                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15062                         <div class="thumb" style="height: 150px;">Image3</div>
15063                         <div class="gallerytext">
15064                         </div>
15065                 </div></li>
15066                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15067                         <div class="thumb" style="height: 150px;">Image4</div>
15068                         <div class="gallerytext">
15069 <p>300px| centre
15070 </p>
15071                         </div>
15072                 </div></li>
15073                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15074                         <div class="thumb" style="height: 150px;">Image5.svg</div>
15075                         <div class="gallerytext">
15076 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15077 </p>
15078                         </div>
15079                 </div></li>
15080                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15081                         <div class="thumb" style="height: 150px;">* image6</div>
15082                         <div class="gallerytext">
15083                         </div>
15084                 </div></li>
15085 </ul>
15087 !! end
15089 !! test
15090 Gallery (with options)
15091 !! wikitext
15092 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15093 File:Nonexistant.jpg|caption
15094 File:Nonexistant.jpg
15095 image:foobar.jpg|some '''caption''' [[Main Page]]
15096 image:foobar.jpg
15097 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15098 </gallery>
15099 !! html
15100 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15101         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15102                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15103                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15104                         <div class="gallerytext">
15105 <p>caption
15106 </p>
15107                         </div>
15108                 </div></li>
15109                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15110                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15111                         <div class="gallerytext">
15112                         </div>
15113                 </div></li>
15114                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15115                         <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>
15116                         <div class="gallerytext">
15117 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15118 </p>
15119                         </div>
15120                 </div></li>
15121                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15122                         <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>
15123                         <div class="gallerytext">
15124                         </div>
15125                 </div></li>
15126                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15127                         <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>
15128                         <div class="gallerytext">
15129 <p>Blabla|blabla.
15130 </p>
15131                         </div>
15132                 </div></li>
15133 </ul>
15135 !! end
15137 !! test
15138 Gallery with wikitext inside caption
15139 !! wikitext
15140 <gallery>
15141 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15142 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15143 </gallery>
15144 !! html
15145 <ul class="gallery mw-gallery-traditional">
15146                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15147                         <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>
15148                         <div class="gallerytext">
15149 <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>
15150 </p>
15151                         </div>
15152                 </div></li>
15153                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15154                         <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>
15155                         <div class="gallerytext">
15156 <p>This is a test template
15157 </p>
15158                         </div>
15159                 </div></li>
15160 </ul>
15162 !! end
15164 !! test
15165 gallery (with showfilename option)
15166 !! wikitext
15167 <gallery showfilename>
15168 File:Nonexistant.jpg|caption
15169 File:Nonexistant.jpg
15170 image:foobar.jpg|some '''caption''' [[Main Page]]
15171 File:Foobar.jpg
15172 </gallery>
15173 !! html
15174 <ul class="gallery mw-gallery-traditional">
15175                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15176                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15177                         <div class="gallerytext">
15178 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15179 caption
15180 </p>
15181                         </div>
15182                 </div></li>
15183                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15184                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15185                         <div class="gallerytext">
15186 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15187 </p>
15188                         </div>
15189                 </div></li>
15190                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15191                         <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>
15192                         <div class="gallerytext">
15193 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15194 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15195 </p>
15196                         </div>
15197                 </div></li>
15198                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15199                         <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>
15200                         <div class="gallerytext">
15201 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15202 </p>
15203                         </div>
15204                 </div></li>
15205 </ul>
15207 !! end
15209 !! test
15210 Gallery (with namespace-less filenames)
15211 !! wikitext
15212 <gallery>
15213 File:Nonexistant.jpg
15214 Nonexistant.jpg
15215 image:foobar.jpg
15216 foobar.jpg
15217 </gallery>
15218 !! html
15219 <ul class="gallery mw-gallery-traditional">
15220                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15221                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15222                         <div class="gallerytext">
15223                         </div>
15224                 </div></li>
15225                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15226                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15227                         <div class="gallerytext">
15228                         </div>
15229                 </div></li>
15230                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15231                         <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>
15232                         <div class="gallerytext">
15233                         </div>
15234                 </div></li>
15235                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15236                         <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>
15237                         <div class="gallerytext">
15238                         </div>
15239                 </div></li>
15240 </ul>
15242 !! end
15244 !! test
15245 HTML Hex character encoding (spells the word "JavaScript")
15246 !! options
15247 parsoid=wt2html,wt2wt,html2html
15248 !! wikitext
15249 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15250 !! html/php
15251 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15252 </p>
15253 !! html/parsoid
15254 <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>
15255 !! end
15257 !! test
15258 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15259 !! wikitext
15260 &#xsee;&#XSEE;
15261 !! html/php
15262 <p>&amp;#xsee;&amp;#XSEE;
15263 </p>
15264 !! html/parsoid
15265 <p>&amp;#xsee;&amp;#XSEE;</p>
15266 !! end
15268 !! test
15269 HTML Hex character encoding mixed case
15270 !! options
15271 parsoid=wt2html,wt2wt,html2html
15272 !! wikitext
15273 &#xEE;&#Xee;
15274 !! html/php
15275 <p>&#xee;&#xee;
15276 </p>
15277 !! html/parsoid
15278 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15279 !! end
15281 !! test
15282 __FORCETOC__ override
15283 !! wikitext
15284 __NEWSECTIONLINK__
15285 __FORCETOC__
15286 !! html
15287 <p><br />
15288 </p>
15289 !! end
15291 !! test
15292 ISBN code coverage
15293 !! wikitext
15294 ISBN  978-0-1234-56&#x20;789
15295 !! html
15296 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15297 </p>
15298 !! end
15300 !! test
15301 ISBN followed by 5 spaces
15302 !! wikitext
15303 ISBN    
15304 !! html
15305 <p>ISBN    
15306 </p>
15307 !! end
15309 !! test
15310 Double ISBN
15311 !! wikitext
15312 ISBN ISBN 1234567890
15313 !! html
15314 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15315 </p>
15316 !! end
15318 !! test
15319 ISBN with an X
15320 !! wikitext
15321 ISBN 3-462-04561-X
15322 !! html
15323 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15324 </p>
15325 !! end
15327 !! test
15328 ISBN with empty prefix (parsoid test)
15329 !! wikitext
15330 ISBN 1234567890
15331 !! html/parsoid
15332 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15333 !! end
15335 !! test
15336 Bug 22905: <abbr> followed by ISBN followed by </a>
15337 !! wikitext
15338 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15339 !! html
15340 <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>
15341 </p>
15342 !! end
15344 !! test
15345 Double RFC
15346 !! wikitext
15347 RFC RFC 1234
15348 !! html
15349 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15350 </p>
15351 !! end
15353 !! test
15354 Double RFC with a wiki link
15355 !! wikitext
15356 RFC [[RFC 1234]]
15357 !! html
15358 <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>
15359 </p>
15360 !! end
15362 !! test
15363 RFC code coverage
15364 !! wikitext
15365 RFC   983&#x20;987
15366 !! html
15367 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15368 </p>
15369 !! end
15371 !! test
15372 Centre-aligned image
15373 !! wikitext
15374 [[Image:foobar.jpg|centre]]
15375 !! html
15376 <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>
15378 !!end
15380 !! test
15381 None-aligned image
15382 !! wikitext
15383 [[Image:foobar.jpg|none]]
15384 !! html
15385 <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>
15387 !!end
15389 !! test
15390 Width + Height sized image (using px) (height is ignored)
15391 !! wikitext
15392 [[Image:foobar.jpg|640x480px]]
15393 !! html
15394 <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>
15395 </p>
15396 !!end
15398 !! test
15399 Width-sized image (using px, no following whitespace)
15400 !! wikitext
15401 [[Image:foobar.jpg|640px]]
15402 !! html
15403 <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>
15404 </p>
15405 !!end
15407 !! test
15408 Width-sized image (using px, with following whitespace - test regression from r39467)
15409 !! wikitext
15410 [[Image:foobar.jpg|640px ]]
15411 !! html
15412 <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>
15413 </p>
15414 !!end
15416 !! test
15417 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15418 !! wikitext
15419 [[Image:foobar.jpg| 640px]]
15420 !! html
15421 <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>
15422 </p>
15423 !!end
15425 !! test
15426 Image with page parameter
15427 !! options
15428 djvu
15429 !! wikitext
15430 [[File:LoremIpsum.djvu|page=2]]
15431 !! html
15432 <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>
15433 </p>
15434 !! end
15436 !! test
15437 Another italics / bold test
15438 !! wikitext
15439  ''' ''x'
15440 !! html
15441 <pre>'<i> </i>x'
15442 </pre>
15443 !!end
15445 # Note the results may be incorrect, as parserTest output included this:
15446 # XML error: Mismatched tag at byte 6120:
15447 # ...<dd> </dt></dl> </dd...
15448 !! test
15449 dt/dd/dl test
15450 !! options
15451 disabled
15452 !! wikitext
15453 :;;;::
15454 !! html
15455 <dl>
15456 <dd><dl>
15457 <dt><dl>
15458 <dt><dl>
15459 <dt><dl>
15460 <dd><dl>
15461 <dd>
15462 </dd>
15463 </dl>
15464 </dd>
15465 </dl>
15466 </dt>
15467 </dl>
15468 </dt>
15469 </dl>
15470 </dt>
15471 </dl>
15472 </dd>
15473 </dl>
15475 !!end
15478 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15479 !! test
15480 Images with the "|" character in the comment
15481 !! wikitext
15482 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15483 !! html/php
15484 <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>
15486 !! html/parsoid
15487 <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>
15488 !! end
15490 !! test
15491 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15492 !! wikitext
15493 <html><script>alert(1);</script></html>
15494 !! html
15495 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15496 </p>
15497 !! end
15499 !! test
15500 HTML with raw HTML ($wgRawHtml==true)
15501 !! options
15502 wgRawHtml=1
15503 !! wikitext
15504 <html><script>alert(1);</script></html>
15505 !! html
15506 <p><script>alert(1);</script>
15507 </p>
15508 !! end
15510 !! test
15511 Parents of subpages, one level up
15512 !! options
15513 subpage title=[[Subpage test/L1/L2/L3]]
15514 !! wikitext
15515 [[../|L2]]
15516 !! html
15517 <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>
15518 </p>
15519 !! end
15522 !! test
15523 Parents of subpages, one level up, not named
15524 !! options
15525 subpage title=[[Subpage test/L1/L2/L3]]
15526 !! wikitext
15527 [[../]]
15528 !! html
15529 <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>
15530 </p>
15531 !! end
15535 !! test
15536 Parents of subpages, two levels up
15537 !! options
15538 subpage title=[[Subpage test/L1/L2/L3]]
15539 !! wikitext
15540 [[../../|L1]]2
15542 [[../../|L1]]l
15543 !! html
15544 <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
15545 </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>
15546 </p>
15547 !! end
15549 !! test
15550 Parents of subpages, two levels up, without trailing slash or name.
15551 !! options
15552 subpage title=[[Subpage test/L1/L2/L3]]
15553 !! wikitext
15554 [[../..]]
15555 !! html
15556 <p>[[../..]]
15557 </p>
15558 !! end
15560 !! test
15561 Parents of subpages, two levels up, with lots of extra trailing slashes.
15562 !! options
15563 subpage title=[[Subpage test/L1/L2/L3]]
15564 !! wikitext
15565 [[../../////]]
15566 !! html
15567 <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>
15568 </p>
15569 !! end
15571 !! article
15572 Subpage test/L1/L2/L3Sibling
15573 !! text
15574 Sibling article
15575 !! endarticle
15577 !! test
15578 Transclusion of a sibling page (one level up)
15579 !! options
15580 subpage title=[[Subpage test/L1/L2/L3]]
15581 !! wikitext
15582 {{../L3Sibling}}
15583 !! html
15584 <p>Sibling article
15585 </p>
15586 !! end
15588 !! test
15589 Transclusion of a child page
15590 !! options
15591 subpage title=[[Subpage test/L1/L2]]
15592 !! wikitext
15593 {{/L3Sibling}}
15594 !! html
15595 <p>Sibling article
15596 </p>
15597 !! end
15599 !! test
15600 Non-transclusion because of too many up levels
15601 !! options
15602 subpage title=[[Subpage test/L1/L2/L3]]
15603 !! wikitext
15604 {{../../../../More than parent}}
15605 !! html
15606 <p>{{../../../../More than parent}}
15607 </p>
15608 !! end
15610 !! test
15611 Definition list code coverage
15612 !! wikitext
15613 ; title   : def
15614 ; title : def
15615 ;title: def
15616 !! html
15617 <dl><dt> title  &#160;</dt>
15618 <dd> def</dd>
15619 <dt> title&#160;</dt>
15620 <dd> def</dd>
15621 <dt>title</dt>
15622 <dd> def</dd></dl>
15624 !! end
15626 !! test
15627 Don't fall for the self-closing div
15628 !! wikitext
15629 <div>hello world</div/>
15630 !! html
15631 <div>hello world</div>
15633 !! end
15635 !! test
15636 MSGNW magic word
15637 !! wikitext
15638 {{MSGNW:msg}}
15639 !! html
15640 <p>&#91;&#91;:Template:Msg&#93;&#93;
15641 </p>
15642 !! end
15644 !! test
15645 RAW magic word
15646 !! wikitext
15647 {{RAW:QUERTY}}
15648 !! html
15649 <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>
15650 </p>
15651 !! end
15653 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15654 !! test
15655 Always escape literal '>' in output, not just after '<'
15656 !! wikitext
15658 !! html
15659 <p>&gt;&lt;&gt;
15660 </p>
15661 !! end
15663 !! test
15664 Template caching
15665 !! wikitext
15666 {{Test}}
15667 {{Test}}
15668 !! html
15669 <p>This is a test template
15670 This is a test template
15671 </p>
15672 !! end
15675 !! article
15676 MediaWiki:Fake
15677 !! text
15678 ==header==
15679 !! endarticle
15681 !! test
15682 Inclusion of !userCanEdit() content
15683 !! wikitext
15684 {{MediaWiki:Fake}}
15685 !! html
15686 <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>
15688 !! end
15691 !! test
15692 Out-of-order TOC heading levels
15693 !! wikitext
15694 ==2==
15695 ======6======
15696 ===3===
15698 =====5=====
15699 ==2==
15700 !! html
15701 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15702 <ul>
15703 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15704 <ul>
15705 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15706 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15707 </ul>
15708 </li>
15709 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15710 <ul>
15711 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15712 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15713 </ul>
15714 </li>
15715 </ul>
15716 </div>
15718 <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>
15719 <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>
15720 <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>
15721 <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>
15722 <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>
15723 <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>
15725 !! end
15728 !! test
15729 ISBN with a dummy number
15730 !! wikitext
15731 ISBN ---
15732 !! html
15733 <p>ISBN ---
15734 </p>
15735 !! end
15738 !! test
15739 ISBN with space-delimited number
15740 !! wikitext
15741 ISBN 92 9017 032 8
15742 !! html
15743 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
15744 </p>
15745 !! end
15748 !! test
15749 ISBN with multiple spaces, no number
15750 !! wikitext
15751 ISBN  foo
15752 !! html
15753 <p>ISBN  foo
15754 </p>
15755 !! end
15758 !! test
15759 ISBN length
15760 !! wikitext
15761 ISBN 123456789
15763 ISBN 1234567890
15765 ISBN 12345678901
15766 !! html
15767 <p>ISBN 123456789
15768 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15769 </p><p>ISBN 12345678901
15770 </p>
15771 !! end
15774 !! test
15775 ISBN with trailing year (bug 8110)
15776 !! wikitext
15777 ISBN 1-234-56789-0 - 2006
15779 ISBN 1 234 56789 0 - 2006
15780 !! html
15781 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
15782 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
15783 </p>
15784 !! end
15787 !! test
15788 anchorencode
15789 !! wikitext
15790 {{anchorencode:foo bar©#%n}}
15791 !! html
15792 <p>foo_bar.C2.A9.23.25n
15793 </p>
15794 !! end
15796 !! test
15797 anchorencode trims spaces
15798 !! wikitext
15799 {{anchorencode: __pretty__please__}}
15800 !! html
15801 <p>pretty_please
15802 </p>
15803 !! end
15805 !! test
15806 anchorencode deals with links
15807 !! wikitext
15808 {{anchorencode: [[hello|world]] [[hi]]}}
15809 !! html
15810 <p>world_hi
15811 </p>
15812 !! end
15814 !! test
15815 anchorencode deals with templates
15816 !! wikitext
15817 {{anchorencode: {{Foo}} }}
15818 !! html
15819 <p>FOO
15820 </p>
15821 !! end
15823 !! test
15824 anchorencode encodes like the TOC generator: (bug 18431)
15825 !! wikitext
15826 === _ +:.3A%3A&&amp;]] ===
15827 {{anchorencode: _ +:.3A%3A&&amp;]] }}
15828 __NOEDITSECTION__
15829 !! html
15830 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
15831 <p>.2B:.3A.253A.26.26.5D.5D
15832 </p>
15833 !! end
15835 !! test
15836 Bug 6200: blockquotes and paragraph formatting
15837 !! wikitext
15838 <blockquote>
15840 </blockquote>
15844  baz
15845 !! html
15846 <blockquote>
15847 <p>foo
15848 </p>
15849 </blockquote>
15850 <p>bar
15851 </p>
15852 <pre>baz
15853 </pre>
15854 !! end
15856 !! test
15857 Bug 8293: Use of center tag ruins paragraph formatting
15858 !! wikitext
15859 <center>
15861 </center>
15865  baz
15866 !! html
15867 <center>
15868 <p>foo
15869 </p>
15870 </center>
15871 <p>bar
15872 </p>
15873 <pre>baz
15874 </pre>
15875 !! end
15877 !!test
15878 Parsing of overlapping (improperly nested) inline html tags
15879 !! wikitext
15880 <span><s>x</span></s>
15881 !! html/php
15882 <p><span><s>x&lt;/span&gt;</s></span>
15883 </p>
15884 !! html/parsoid
15885 <p><span><s>x</s></span>
15886 </p>
15887 !!end
15890 ### Language variants related tests
15892 !! test
15893 Self-link in language variants
15894 !! options
15895 title=[[Dunav]] language=sr
15896 !! wikitext
15897 Both [[Dunav]] and [[Дунав]] are names for this river.
15898 !! html
15899 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
15900 </p>
15901 !!end
15903 !! article
15904 Дуна
15905 !! text
15906 content
15907 !! endarticle
15909 !! test
15910 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
15911 !! options
15912 title=[[Duna]] language=sr
15913 !! wikitext
15914 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
15915 !! html
15916 <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.
15917 </p>
15918 !! end
15920 !! test
15921 Link to a section of a variant of this title shouldn't be parsed as self-link
15922 !! options
15923 title=[[Duna]] language=sr
15924 !! wikitext
15925 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
15926 !! html
15927 <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.
15928 </p>
15929 !! end
15931 !! test
15932 Link to pages in language variants
15933 !! options
15934 language=sr
15935 !! wikitext
15936 Main Page can be written as [[Маин Паге]]
15937 !! html
15938 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
15939 </p>
15940 !!end
15943 !! test
15944 Multiple links to pages in language variants
15945 !! options
15946 language=sr
15947 !! wikitext
15948 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
15949 !! html
15950 <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>.
15951 </p>
15952 !!end
15955 !! test
15956 Simple template in language variants
15957 !! options
15958 language=sr
15959 !! wikitext
15960 {{тест}}
15961 !! html
15962 <p>This is a test template
15963 </p>
15964 !! end
15967 !! test
15968 Template with explicit namespace in language variants
15969 !! options
15970 language=sr
15971 !! wikitext
15972 {{Template:тест}}
15973 !! html
15974 <p>This is a test template
15975 </p>
15976 !! end
15979 !! test
15980 Basic test for template parameter in language variants
15981 !! options
15982 language=sr
15983 !! wikitext
15984 {{парамтест|param=foo}}
15985 !! html
15986 <p>This is a test template with parameter foo
15987 </p>
15988 !! end
15991 !! test
15992 Simple category in language variants
15993 !! options
15994 language=sr cat
15995 !! wikitext
15996 [[Category:МедиаWики Усер'с Гуиде]]
15997 !! html
15998 <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>
15999 !! end
16002 !! article
16003 Category:分类
16004 !! text
16005 blah
16006 !! endarticle
16008 !! article
16009 Category:分類
16010 !! text
16011 blah
16012 !! endarticle
16014 !! test
16015 Don't convert blue categorylinks to another variant (bug 33210)
16016 !! options
16017 language=zh cat
16018 !! wikitext
16019 [[A]][[Category:分类]]
16020 !! html
16021 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16022 !! end
16025 !! test
16026 Stripping -{}- tags (language variants)
16027 !! options
16028 language=sr
16029 !! wikitext
16030 Latin proverb: -{Ne nuntium necare}-
16031 !! html
16032 <p>Latin proverb: Ne nuntium necare
16033 </p>
16034 !! end
16037 !! test
16038 Prevent conversion with -{}- tags (language variants)
16039 !! options
16040 language=sr variant=sr-ec
16041 !! wikitext
16042 Latinski: -{Ne nuntium necare}-
16043 !! html
16044 <p>Латински: Ne nuntium necare
16045 </p>
16046 !! end
16049 !! test
16050 Prevent conversion of text with -{}- tags (language variants)
16051 !! options
16052 language=sr variant=sr-ec
16053 !! wikitext
16054 Latinski: -{Ne nuntium necare}-
16055 !! html
16056 <p>Латински: Ne nuntium necare
16057 </p>
16058 !! end
16061 !! test
16062 Prevent conversion of links with -{}- tags (language variants)
16063 !! options
16064 language=sr variant=sr-ec
16065 !! wikitext
16066 -{[[Main Page]]}-
16067 !! html
16068 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16069 </p>
16070 !! end
16073 !! test
16074 -{}- tags within headlines (within html for parserConvert())
16075 !! options
16076 language=sr variant=sr-ec
16077 !! wikitext
16078 == -{Naslov}- ==
16079 !! html
16080 <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>
16082 !! end
16085 !! test
16086 Explicit definition of language variant alternatives
16087 !! options
16088 language=zh variant=zh-tw
16089 !! wikitext
16090 -{zh:China;zh-tw:Taiwan}-, not China
16091 !! html
16092 <p>Taiwan, not China
16093 </p>
16094 !! end
16097 !! test
16098 Conversion around HTML tags
16099 !! options
16100 language=sr variant=sr-ec
16101 !! wikitext
16102 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16103 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16104 !! html
16106 <span title="ЛаCтин">ски</span>
16107 </p>
16108 !! end
16111 !! test
16112 Explicit session-wise language variant mapping (A flag and - flag)
16113 !! options
16114 language=zh variant=zh-tw
16115 !! wikitext
16116 Taiwan is not China.
16117 But -{A|zh:China;zh-tw:Taiwan}- is China,
16118 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16119 and -{China}- is China.
16120 !! html
16121 <p>Taiwan is not China.
16122 But Taiwan is Taiwan,
16123 (This should be stripped!)
16124 and China is China.
16125 </p>
16126 !! end
16128 !! test
16129 Explicit session-wise language variant mapping (H flag for hide)
16130 !! options
16131 language=zh variant=zh-tw
16132 !! wikitext
16133 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16134 Taiwan is China.
16135 !! html
16136 <p>(This should be stripped!)
16137 Taiwan is Taiwan.
16138 </p>
16139 !! end
16141 !! test
16142 Adding explicit conversion rule for title (T flag)
16143 !! options
16144 language=zh variant=zh-tw showtitle
16145 !! wikitext
16146 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16147 !! html
16148 Taiwan
16149 <p>Should be stripped!
16150 </p>
16151 !! end
16153 !! test
16154 Testing that changing the language variant here in the tests actually works
16155 !! options
16156 language=zh variant=zh showtitle
16157 !! wikitext
16158 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16159 !! html
16160 China
16161 <p>Should be stripped!
16162 </p>
16163 !! end
16165 !! test
16166 Recursive conversion of alt and title attrs shouldn't clear converter state
16167 !! options
16168 language=zh variant=zh-cn showtitle
16169 !! wikitext
16170 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16171 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16172 !! html
16173 China
16175 Should be stripped<span title="Exclamation">!</span>
16176 </p>
16177 !! end
16179 !! test
16180 Bug 24072: more test on conversion rule for title
16181 !! options
16182 language=zh variant=zh-tw showtitle
16183 !! wikitext
16184 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16185 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16186 !! html
16187 Taiwan
16188 <p>This should be stripped!
16189 This won't take interferes with the title rule.
16190 </p>
16191 !! end
16193 !! test
16194 Partly disable title conversion if variant == main language code
16195 !! options
16196 language=zh variant=zh title=[[ZH]] showtitle
16197 !! wikitext
16198 -{T|zh-cn:CN;zh-tw:TW}-
16199 !! html
16202 </p>
16203 !! end
16205 !! test
16206 Partly disable title conversion if variant == main language code, more
16207 !! options
16208 language=zh variant=zh title=[[ZH]] showtitle
16209 !! wikitext
16210 -{T|TW}-
16211 !! html
16214 </p>
16215 !! end
16217 !! test
16218 Raw output of variant escape tags (R flag)
16219 !! options
16220 language=zh variant=zh-tw
16221 !! wikitext
16222 Raw: -{R|zh:China;zh-tw:Taiwan}-
16223 !! html
16224 <p>Raw: zh:China;zh-tw:Taiwan
16225 </p>
16226 !! end
16228 !! test
16229 Nested using of manual convert syntax
16230 !! options
16231 language=zh variant=zh-hk
16232 !! wikitext
16233 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16234 !! html
16235 <p>Nested: Hello Hong Kong!
16236 </p>
16237 !! end
16239 !! test
16240 Proper conversion of text in external links
16241 !! options
16242 language=sr variant=sr-ec
16243 !! wikitext
16244 http://www.google.com
16245 gopher://www.google.com
16246 [http://www.google.com http://www.google.com]
16247 [gopher://www.google.com gopher://www.google.com]
16248 [https://www.google.com irc://www.google.com]
16249 [ftp://www.google.com www.google.com/ftp://dir]
16250 [//www.google.com www.google.com]
16251 !! html
16252 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16253 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16254 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16255 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16256 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16257 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16258 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16259 </p>
16260 !! end
16262 !! test
16263 Do not convert roman numbers to language variants
16264 !! options
16265 language=sr variant=sr-ec
16266 !! wikitext
16267 Fridrih IV je car.
16268 !! html
16269 <p>Фридрих IV је цар.
16270 </p>
16271 !! end
16273 !! test
16274 Unclosed language converter markup "-{"
16275 !! options
16276 language=sr
16277 !! wikitext
16278 -{T|hello
16279 !! html
16280 <p>-{T|hello
16281 </p>
16282 !! end
16284 !! test
16285 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16286 !! options
16287 language=sr
16288 !! wikitext
16289 -{R|=&gt;}-
16290 !! html
16291 <p>=&gt;
16292 </p>
16293 !!end
16295 !! test
16296 Don't break link parsing if language converter markup is in the caption.
16297 !! options
16298 language=sr variant=sr-ec
16299 !! wikitext
16300 [[Main Page|-{R|main page}-]]
16301 !! html
16302 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16303 </p>
16304 !! end
16306 # This test is currently broken in the PHP parser (bug 52661)
16307 !! test
16308 Don't break image parsing if language converter markup is in the caption.
16309 !! options
16310 language=sr
16311 disabled
16312 !! wikitext
16313 [[File:Foobar.jpg|-{R|caption}-]]
16314 !! html
16315 <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>
16316 </p>
16317 !! end
16319 # This test is currently broken in the PHP parser (bug 52661)
16320 !! test
16321 Don't break list handling if language converter markup is in the item.
16322 !! options
16323 language=zh variant=zh-cn
16324 disabled
16325 !! wikitext
16326 ;-{zh-cn:AAA;zh-tw:BBB}-
16327 !! html
16328 <dl><dt>AAA
16329 </dt></dl>
16331 !! end
16333 # This test is currently broken in the PHP parser (bug 52661)
16334 !! test
16335 Don't break table handling if language converter markup is in the cell.
16336 !! options
16337 language=sr variant=sr-ec
16338 disabled
16339 !! wikitext
16342 | -{R|B}-
16344 !! html
16345 <table>
16347 <tr>
16348 <td> B
16349 </td></tr></table>
16351 !! end
16353 !! test
16354 Bug 529: Uncovered bullet
16355 !! wikitext
16356 * Foo {{bullet}}
16357 !! html
16358 <ul><li> Foo </li>
16359 <li> Bar</li></ul>
16361 !! end
16363 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16364 # Templates in Wikipedia rely on this behavior, as tidy has always been
16365 # enabled there. These tests are normally run *without* tidy, so specify the
16366 # full output here. 
16367 # To test realistic parsing behavior, apply a tidy-like transformation to both
16368 # the expected output and your parser's output.
16369 !! test
16370 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16371 !! wikitext
16372 ******* Foo {{bullet}}
16373 !! html
16374 <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>
16375 <li> Bar</li></ul>
16377 !! end
16379 !! test
16380 Bug 529: Uncovered table already at line-start
16381 !! wikitext
16384 {{table}}
16386 !! html
16387 <p>x
16388 </p>
16389 <table>
16390 <tr>
16391 <td> 1 </td>
16392 <td> 2
16393 </td></tr>
16394 <tr>
16395 <td> 3 </td>
16396 <td> 4
16397 </td></tr></table>
16398 <p>y
16399 </p>
16400 !! end
16402 !! test
16403 Bug 529: Uncovered bullet in parser function result
16404 !! wikitext
16405 * Foo {{lc:{{bullet}} }}
16406 !! html
16407 <ul><li> Foo </li>
16408 <li> bar</li></ul>
16410 !! end
16412 !! test
16413 Bug 5678: Double-parsed template argument
16414 !! wikitext
16415 {{lc:{{{1}}}|hello}}
16416 !! html
16417 <p>{{{1}}}
16418 </p>
16419 !! end
16421 !! test
16422 Bug 5678: Double-parsed template invocation
16423 !! wikitext
16424 {{lc:{{paramtest {{!}} param = hello }} }}
16425 !! html
16426 <p>{{paramtest | param = hello }}
16427 </p>
16428 !! end
16430 !! test
16431 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16432 !! options
16433 language=cs
16434 title=[[Main Page]]
16435 !! wikitext
16436 {{PRVNÍVELKÉ:ěščř}}
16437 {{prvnívelké:ěščř}}
16438 {{PRVNÍMALÉ:ěščř}}
16439 {{prvnímalé:ěščř}}
16440 {{MALÁ:ěščř}}
16441 {{malá:ěščř}}
16442 {{VELKÁ:ěščř}}
16443 {{velká:ěščř}}
16444 !! html
16445 <p>Ěščř
16446 Ěščř
16447 ěščř
16448 ěščř
16449 ěščř
16450 ěščř
16451 ĚŠČŘ
16452 ĚŠČŘ
16453 </p>
16454 !! end
16456 !! test
16457 Morwen/13: Unclosed link followed by heading
16458 !! wikitext
16459 [[link
16460 ==heading==
16461 !! html
16462 <p>[[link
16463 </p>
16464 <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>
16466 !! end
16468 !! test
16469 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16470 !! wikitext
16471 {{foo|
16472 =heading=
16473 !! html
16474 <p>{{foo|
16475 </p>
16476 <h1><span class="mw-headline" id="heading">heading</span></h1>
16478 !! end
16480 !! test
16481 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16482 !! wikitext
16483 {{foo|
16484 ==heading==
16485 !! html
16486 <p>{{foo|
16487 </p>
16488 <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>
16490 !! end
16492 !! test
16493 Tildes in comments
16494 !! options
16496 !! wikitext
16497 <!-- ~~~~ -->
16498 !! html
16499 <!-- ~~~~ -->
16500 !! end
16502 !! test
16503 Paragraphs inside divs (no extra line breaks)
16504 !! wikitext
16505 <div>Line one
16507 Line two</div>
16508 !! html
16509 <div>Line one
16510 Line two</div>
16512 !! end
16514 !! test
16515 Paragraphs inside divs (extra line break on open)
16516 !! wikitext
16517 <div>
16518 Line one
16520 Line two</div>
16521 !! html
16522 <div>
16523 <p>Line one
16524 </p>
16525 Line two</div>
16527 !! end
16529 !! test
16530 Paragraphs inside divs (extra line break on close)
16531 !! wikitext
16532 <div>Line one
16534 Line two
16535 </div>
16536 !! html
16537 <div>Line one
16538 <p>Line two
16539 </p>
16540 </div>
16542 !! end
16544 !! test
16545 Paragraphs inside divs (extra line break on open and close)
16546 !! wikitext
16547 <div>
16548 Line one
16550 Line two
16551 </div>
16552 !! html
16553 <div>
16554 <p>Line one
16555 </p><p>Line two
16556 </p>
16557 </div>
16559 !! end
16561 !! test
16562 Nesting tags, paragraphs on lines which begin with <div>
16563 !! options
16564 disabled
16565 !! wikitext
16566 <div></div><strong>A
16567 B</strong>
16568 !! html
16569 <div></div>
16570 <p><strong>A
16571 B</strong>
16572 </p>
16573 !! end
16575 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16576 !! test
16577 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16578 !! wikitext
16579 <blockquote>Line one
16581 Line two</blockquote>
16582 !! html
16583 <blockquote>Line one
16584 Line two</blockquote>
16586 !! end
16588 !! test
16589 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16590 !! wikitext
16591 <blockquote>
16592 Line one
16594 Line two</blockquote>
16595 !! html
16596 <blockquote>
16597 <p>Line one
16598 </p>
16599 Line two</blockquote>
16601 !! end
16603 !! test
16604 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16605 !! wikitext
16606 <blockquote>Line one
16608 Line two
16609 </blockquote>
16610 !! html
16611 <blockquote>Line one
16612 <p>Line two
16613 </p>
16614 </blockquote>
16616 !! end
16618 !! test
16619 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16620 !! wikitext
16621 <blockquote>
16622 Line one
16624 Line two
16625 </blockquote>
16626 !! html
16627 <blockquote>
16628 <p>Line one
16629 </p><p>Line two
16630 </p>
16631 </blockquote>
16633 !! end
16635 !! test
16636 Paragraphs inside blockquotes/divs (no extra line breaks)
16637 !! wikitext
16638 <blockquote><div>Line one
16640 Line two</div></blockquote>
16641 !! html
16642 <blockquote><div>Line one
16643 Line two</div></blockquote>
16645 !! end
16647 !! test
16648 Paragraphs inside blockquotes/divs (extra line break on open)
16649 !! wikitext
16650 <blockquote><div>
16651 Line one
16653 Line two</div></blockquote>
16654 !! html
16655 <blockquote><div>
16656 <p>Line one
16657 </p>
16658 Line two</div></blockquote>
16660 !! end
16662 !! test
16663 Paragraphs inside blockquotes/divs (extra line break on close)
16664 !! wikitext
16665 <blockquote><div>Line one
16667 Line two
16668 </div></blockquote>
16669 !! html
16670 <blockquote><div>Line one
16671 <p>Line two
16672 </p>
16673 </div></blockquote>
16675 !! end
16677 !! test
16678 Paragraphs inside blockquotes/divs (extra line break on open and close)
16679 !! wikitext
16680 <blockquote><div>
16681 Line one
16683 Line two
16684 </div></blockquote>
16685 !! html
16686 <blockquote><div>
16687 <p>Line one
16688 </p><p>Line two
16689 </p>
16690 </div></blockquote>
16692 !! end
16694 !! test
16695 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16696 !! options
16697 wgLinkHolderBatchSize=0
16698 !! wikitext
16699 [[meatball:1]]
16700 [[meatball:2]]
16701 [[meatball:3]]
16702 !! html
16703 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16704 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16705 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16706 </p>
16707 !! end
16709 !! test
16710 Free external link invading image caption
16711 !! wikitext
16712 [[Image:Foobar.jpg|thumb|http://x|hello]]
16713 !! html
16714 <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>
16716 !! end
16718 !! test
16719 Bug 15196: localised external link numbers
16720 !! options
16721 language=fa
16722 !! wikitext
16723 [http://en.wikipedia.org/]
16724 !! html/php
16725 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16726 </p>
16727 !! html/parsoid
16728 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
16729 !! end
16731 !! test
16732 Multibyte character in padleft
16733 !! wikitext
16734 {{padleft:-Hello|7|Æ}}
16735 !! html
16736 <p>Æ-Hello
16737 </p>
16738 !! end
16740 !! test
16741 Multibyte character in padright
16742 !! wikitext
16743 {{padright:Hello-|7|Æ}}
16744 !! html
16745 <p>Hello-Æ
16746 </p>
16747 !! end
16749 !!test
16750 formatdate parser function
16751 !! wikitext
16752 {{#formatdate:2009-03-24}}
16753 !! html
16754 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
16755 </p>
16756 !! end
16758 !!test
16759 formatdate parser function, with default format
16760 !! wikitext
16761 {{#formatdate:2009-03-24|mdy}}
16762 !! html
16763 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
16764 </p>
16765 !! end
16767 !! test
16768 Spacing of numbers in formatted dates
16769 !! wikitext
16770 {{#formatdate:January 15}}
16771 !! html
16772 <p><span class="mw-formatted-date" title="01-15">January 15</span>
16773 </p>
16774 !! end
16776 !! test
16777 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
16778 !! options
16779 language=nl title=[[MediaWiki:Common.css]]
16780 !! wikitext
16781 {{#formatdate:2009-03-24|dmy}}
16782 !! html
16783 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
16784 </p>
16785 !! end
16792 # Edit comments
16795 !! test
16796 Edit comment with link
16797 !! options
16798 comment
16799 !! wikitext
16800 I like the [[Main Page]] a lot
16801 !! html
16802 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
16803 !!end
16805 !! test
16806 Edit comment with link and link text
16807 !! options
16808 comment
16809 !! wikitext
16810 I like the [[Main Page|best pages]] a lot
16811 !! html
16812 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16813 !!end
16815 !! test
16816 Edit comment with link and link text with suffix
16817 !! options
16818 comment
16819 !! wikitext
16820 I like the [[Main Page|best page]]s a lot
16821 !! html
16822 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
16823 !!end
16825 !! test
16826 Edit comment with section link (non-local, eg in history list)
16827 !! options
16828 comment title=[[Main Page]]
16829 !! wikitext
16830 /* External links */ removed bogus entries
16831 !! html
16832 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16833 !!end
16835 !! test
16836 Edit comment with section link and text before it (non-local, eg in history list)
16837 !! options
16838 comment title=[[Main Page]]
16839 !! wikitext
16840 pre-comment text /* External links */ removed bogus entries
16841 !! html
16842 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>
16843 !!end
16845 !! test
16846 Edit comment with section link (local, eg in diff view)
16847 !! options
16848 comment local title=[[Main Page]]
16849 !! wikitext
16850 /* External links */ removed bogus entries
16851 !! html
16852 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
16853 !!end
16855 !! test
16856 Edit comment with subpage link (bug 14080)
16857 !! options
16858 comment
16859 subpage
16860 title=[[Subpage test]]
16861 !! wikitext
16862 Poked at a [[/subpage]] here...
16863 !! html
16864 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
16865 !!end
16867 !! test
16868 Edit comment with subpage link and link text (bug 14080)
16869 !! options
16870 comment
16871 subpage
16872 title=[[Subpage test]]
16873 !! wikitext
16874 Poked at a [[/subpage|neat little page]] here...
16875 !! html
16876 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
16877 !!end
16879 !! test
16880 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
16881 !! options
16882 comment
16883 title=[[Subpage test]]
16884 !! wikitext
16885 Poked at a [[/subpage]] here...
16886 !! html
16887 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...
16888 !!end
16890 !! test
16891 Edit comment with bare anchor link (local, as on diff)
16892 !! options
16893 comment
16894 local
16895 title=[[Main Page]]
16896 !! wikitext
16897 [[#section]]
16898 !! html
16899 <a href="#section">#section</a>
16900 !! end
16902 !! test
16903 Edit comment with bare anchor link (non-local, as on history)
16904 !! options
16905 comment
16906 title=[[Main Page]]
16907 !! wikitext
16908 [[#section]]
16909 !! html
16910 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
16911 !! end
16913 !! test
16914 Anchor starting with underscore
16915 !! wikitext
16916 [[#_ref|One]]
16917 !! html
16918 <p><a href="#_ref">One</a>
16919 </p>
16920 !! end
16922 !! test
16923 Id starting with underscore
16924 !! wikitext
16925 <div id="_ref"></div>
16926 !! html
16927 <div id="_ref"></div>
16929 !! end
16931 !! test
16932 Space normalisation on autocomment (bug 22784)
16933 !! options
16934 comment
16935 title=[[Main Page]]
16936 !! wikitext
16937 /* __hello__world__ */
16938 !! html
16939 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
16940 !! end
16942 !! test
16943 percent-encoding and + signs in comments (Bug 26410)
16944 !! options
16945 comment
16946 !! wikitext
16947 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
16948 !! html
16949 <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>
16950 !! end
16952 !! test
16953 Bad images - basic functionality
16954 !! options
16955 disabled
16956 !! wikitext
16957 [[File:Bad.jpg]]
16958 !! html
16959 !! end
16961 !! test
16962 Bad images - bug 16039: text after bad image disappears
16963 !! options
16964 disabled
16965 !! wikitext
16966 Foo bar
16967 [[File:Bad.jpg]]
16968 Bar foo
16969 !! html
16970 <p>Foo bar
16971 </p><p>Bar foo
16972 </p>
16973 !! end
16975 !! test
16976 Verify that displaytitle works (bug #22501) no displaytitle
16977 !! options
16978 showtitle
16979 !! config
16980 wgAllowDisplayTitle=true
16981 wgRestrictDisplayTitle=false
16982 !! wikitext
16983 this is not the the title
16984 !! html
16985 Parser test
16986 <p>this is not the the title
16987 </p>
16988 !! end
16990 !! test
16991 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
16992 !! options
16993 showtitle
16994 title=[[Screen]]
16995 !! config
16996 wgAllowDisplayTitle=true
16997 wgRestrictDisplayTitle=false
16998 !! wikitext
16999 this is not the the title
17000 {{DISPLAYTITLE:whatever}}
17001 !! html
17002 whatever
17003 <p>this is not the the title
17004 </p>
17005 !! end
17007 !! test
17008 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17009 !! options
17010 showtitle
17011 title=[[Screen]]
17012 !! config
17013 wgAllowDisplayTitle=true
17014 wgRestrictDisplayTitle=true
17015 !! wikitext
17016 this is not the the title
17017 {{DISPLAYTITLE:whatever}}
17018 !! html
17019 Screen
17020 <p>this is not the the title
17021 </p>
17022 !! end
17024 !! test
17025 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17026 !! options
17027 showtitle
17028 title=[[Screen]]
17029 !! config
17030 wgAllowDisplayTitle=true
17031 wgRestrictDisplayTitle=true
17032 !! wikitext
17033 this is not the the title
17034 {{DISPLAYTITLE:screen}}
17035 !! html
17036 screen
17037 <p>this is not the the title
17038 </p>
17039 !! end
17041 !! test
17042 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17043 !! options
17044 showtitle
17045 title=[[Screen]]
17046 !! config
17047 wgAllowDisplayTitle=false
17048 !! wikitext
17049 this is not the the title
17050 {{DISPLAYTITLE:screen}}
17051 !! html
17052 Screen
17053 <p>this is not the the title
17054 <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>
17055 </p>
17056 !! end
17058 !! test
17059 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17060 !! options
17061 showtitle
17062 title=[[Screen]]
17063 !! config
17064 wgAllowDisplayTitle=false
17065 !! wikitext
17066 this is not the the title
17067 !! html
17068 Screen
17069 <p>this is not the the title
17070 </p>
17071 !! end
17073 !! test
17074 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17075 !! options
17076 showtitle
17077 title=[[Screen]]
17078 !! config
17079 wgAllowDisplayTitle=true
17080 wgRestrictDisplayTitle=true
17081 !! wikitext
17082 this is not the the title
17083 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17084 !! html
17085 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17086 <p>this is not the the title
17087 </p>
17088 !! end
17090 !! test
17091 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17092 !! options
17093 showtitle
17094 title=[[Screen]]
17095 !! config
17096 wgAllowDisplayTitle=true
17097 wgRestrictDisplayTitle=true
17098 !! wikitext
17099 this is not the the title
17100 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17101 !! html
17102 <span style="color: red;">s</span>creen
17103 <p>this is not the the title
17104 </p>
17105 !! end
17107 !! test
17108 preload: check <noinclude> and <includeonly>
17109 !! options
17110 preload
17111 !! wikitext
17112 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17113 !! html
17114 Hello kind world.
17115 !! end
17117 !! test
17118 preload: check <onlyinclude>
17119 !! options
17120 preload
17121 !! wikitext
17122 Goodbye <onlyinclude>Hello world</onlyinclude>
17123 !! html
17124 Hello world
17125 !! end
17127 !! test
17128 preload: can pass tags through if we want to
17129 !! options
17130 preload
17131 !! wikitext
17132 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17133 !! html
17134 <includeonly>Hello world</includeonly>
17135 !! end
17137 !! test
17138 preload: check that it doesn't try to do tricks
17139 !! options
17140 preload
17141 !! wikitext
17142 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17143 !! html
17144 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17145 !! end
17147 !! test
17148 Play a bit with r67090 and bug 3158
17149 !! options
17150 disabled
17151 !! wikitext
17152 <div style="width:50% !important">&nbsp;</div>
17153 <div style="width:50%&nbsp;!important">&nbsp;</div>
17154 <div style="width:50%&#160;!important">&nbsp;</div>
17155 <div style="border : solid;">&nbsp;</div>
17156 !! html
17157 <div style="width:50% !important">&nbsp;</div>
17158 <div style="width:50% !important">&nbsp;</div>
17159 <div style="width:50% !important">&nbsp;</div>
17160 <div style="border&#160;: solid;">&nbsp;</div>
17162 !! end
17164 !! test
17165 HTML5 data attributes
17166 !! wikitext
17167 <span data-foo="bar">Baz</span>
17168 <p data-abc-def_hij="">Quuz</p>
17169 !! html
17170 <p><span data-foo="bar">Baz</span>
17171 </p>
17172 <p data-abc-def_hij="">Quuz</p>
17174 !! end
17176 !! test
17177 percent-encoding and + signs in internal links (Bug 26410)
17178 !! wikitext
17179 [[User:+%]] [[Page+title%]]
17180 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17181 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17182 [[%33%45]] [[%33%45+]]
17183 !! html
17184 <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>
17185 <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>
17186 <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>
17187 <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>
17188 </p>
17189 !! end
17191 !! test
17192 Special characters in embedded file links (bug 27679)
17193 !! wikitext
17194 [[File:Contains & ampersand.jpg]]
17195 [[File:Does not exist.jpg|Title with & ampersand]]
17196 !! html
17197 <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>
17198 <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>
17199 </p>
17200 !! end
17203 !! test
17204 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17205 !! wikitext
17206 Text&apos;s been normalized?
17207 !! html
17208 <p>Text&#39;s been normalized?
17209 </p>
17210 !! end
17212 !! test
17213 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17214 !! wikitext
17215 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17216 !! html
17217 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17218 </p>
17219 !! end
17221 !! test
17222 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17223 !! wikitext
17224 [http://www.example.org/ ideograms]
17225 !! html
17226 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17227 </p>
17228 !! end
17230 !! test
17231 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17232 !! wikitext
17233 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17234 !! html
17235 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17236 </p>
17237 !! end
17239 !! article
17240 Mediawiki:loop1
17241 !! text
17242 {{Identical|A}}
17243 !! endarticle
17245 !! article
17246 Mediawiki:loop2
17247 !! text
17248 {{Identical|B}}
17249 !! endarticle
17251 !! article
17252 Template:Identical
17253 !! text
17254 {{int:loop1}}
17255 {{int:loop2}}
17256 !! endarticle
17258 !! test
17259 Bug 31098 Template which includes system messages which includes the template
17260 !! wikitext
17261 {{Identical}}
17262 !! html
17263 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17264 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17265 </p>
17266 !! end
17268 !! test
17269 Bug31490 Turkish: ucfirst 'blah'
17270 !! options
17271 language=tr
17272 !! wikitext
17273 {{ucfirst:blah}}
17274 !! html
17275 <p>Blah
17276 </p>
17277 !! end
17279 !! test
17280 Bug31490 Turkish: ucfirst 'ix'
17281 !! options
17282 language=tr
17283 !! wikitext
17284 {{ucfirst:ix}}
17285 !! html
17286 <p>İx
17287 </p>
17288 !! end
17290 !! test
17291 Bug31490 Turkish: lcfirst 'BLAH'
17292 !! options
17293 language=tr
17294 !! wikitext
17295 {{lcfirst:BLAH}}
17296 !! html
17297 <p>bLAH
17298 </p>
17299 !! end
17301 !! test
17302 Bug31490 Turkish: ucfırst (with a dotless i)
17303 !! options
17304 language=tr
17305 !! wikitext
17306 {{ucfırst:blah}}
17307 !! html
17308 <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>
17309 </p>
17310 !! end
17312 !! test
17313 Bug31490 ucfırst (with a dotless i) with English language
17314 !! options
17315 language=en
17316 !! wikitext
17317 {{ucfırst:blah}}
17318 !! html
17319 <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>
17320 </p>
17321 !! end
17323 !! test
17324 Bug 26375: TOC with italics
17325 !! options
17326 title=[[Main Page]]
17327 !! wikitext
17328 __TOC__
17329 == ''Lost'' episodes ==
17330 !! html
17331 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17332 <ul>
17333 <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>
17334 </ul>
17335 </div>
17337 <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>
17339 !! end
17341 !! test
17342 Bug 26375: TOC with bold
17343 !! options
17344 title=[[Main Page]]
17345 !! wikitext
17346 __TOC__
17347 == '''should be bold''' then normal text ==
17348 !! html
17349 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17350 <ul>
17351 <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>
17352 </ul>
17353 </div>
17355 <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>
17357 !! end
17359 !! test
17360 Bug 33845: Headings become cursive in TOC when they contain an image
17361 !! options
17362 title=[[Main Page]]
17363 !! wikitext
17364 __TOC__
17365 == Image [[Image:foobar.jpg]] ==
17366 !! html
17367 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17368 <ul>
17369 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17370 </ul>
17371 </div>
17373 <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>
17375 !! end
17377 !! test
17378 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17379 !! options
17380 title=[[Main Page]]
17381 !! wikitext
17382 __TOC__
17383 == <blockquote>Quote</blockquote> ==
17384 !! html
17385 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17386 <ul>
17387 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17388 </ul>
17389 </div>
17391 <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>
17393 !! end
17395 !! test
17396 Unclosed tags in TOC
17397 !! options
17398 title=[[Main Page]]
17399 !! wikitext
17400 __TOC__
17401 == Proof: 2 < 3 ==
17402 <small>Hanc marginis exiguitas non caperet.</small>
17404 !! html
17405 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17406 <ul>
17407 <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>
17408 </ul>
17409 </div>
17411 <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>
17412 <p><small>Hanc marginis exiguitas non caperet.</small>
17414 </p>
17415 !! end
17417 !! test
17418 Multiple tags in TOC
17419 !! wikitext
17420 __TOC__
17421 == <i>Foo</i> <b>Bar</b> ==
17423 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17424 !! html
17425 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17426 <ul>
17427 <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>
17428 <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>
17429 </ul>
17430 </div>
17432 <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>
17433 <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>
17435 !! end
17437 !! test
17438 Tags with parameters in TOC
17439 !! wikitext
17440 __TOC__
17441 == <sup class="in-h2">Hello</sup> ==
17443 == <sup class="a > b">Evilbye</sup> ==
17444 !! html
17445 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17446 <ul>
17447 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17448 <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>
17449 </ul>
17450 </div>
17452 <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>
17453 <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>
17455 !! end
17457 !! test
17458 span tags with directionality in TOC
17459 !! wikitext
17460 __TOC__
17461 == <span dir="ltr">C++</span> ==
17463 == <span dir="rtl">זבנג!</span> ==
17465 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17467 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17469 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17470 !! html
17471 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17472 <ul>
17473 <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>
17474 <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>
17475 <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>
17476 <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>
17477 <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>
17478 </ul>
17479 </div>
17481 <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>
17482 <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>
17483 <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>
17484 <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>
17485 <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>
17487 !! end
17489 !! article
17490 MediaWiki:Bug32057
17491 !! text
17492 == {{int:headline_sample}} ==
17493 !! endarticle
17495 !! test
17496 Bug 32057: Title needed when expanding <h> nodes.
17497 !! options
17498 title=[[Main Page]]
17499 !! wikitext
17500 {{int:Bug32057}}
17501 !! html
17502 <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>
17504 !! end
17506 !! test
17507 Strip marker in urlencode
17508 !! wikitext
17509 {{urlencode:x<nowiki/>y}}
17510 {{urlencode:x<nowiki/>y|wiki}}
17511 {{urlencode:x<nowiki/>y|path}}
17512 !! html
17513 <p>xy
17516 </p>
17517 !! end
17519 !! test
17520 Strip marker in lc
17521 !! wikitext
17522 {{lc:x<nowiki/>y}}
17523 !! html
17524 <p>xy
17525 </p>
17526 !! end
17528 !! test
17529 Strip marker in uc
17530 !! wikitext
17531 {{uc:x<nowiki/>y}}
17532 !! html
17533 <p>XY
17534 </p>
17535 !! end
17537 !! test
17538 Strip marker in formatNum
17539 !! wikitext
17540 {{formatnum:1<nowiki/>2}}
17541 {{formatnum:1<nowiki/>2|R}}
17542 !! html
17543 <p>12
17545 </p>
17546 !! end
17548 !! test
17549 Check noCommafy in formatNum
17550 !! options
17551 language=be-tarask
17552 !! wikitext
17553 {{formatnum:123456.78}}
17554 {{formatnum:123456.78|NOSEP}}
17555 !! html
17556 <p>123 456,78
17557 123456.78
17558 </p>
17559 !! end
17561 !! test
17562 Wrong option for formatNum (bug 56199)
17563 !! wikitext
17564 {{formatnum:1,234.56|Random}}
17565 {{formatnum:1,234.56|EVERYTHING}}
17566 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17567 !! html
17568 <p>1,234.56
17569 1,234.56
17570 1,234.56
17571 </p>
17572 !! end
17574 !! test
17575 Strip marker in grammar
17576 !! options
17577 language=fi
17578 !! wikitext
17579 {{grammar:elative|foo<nowiki/>bar}}
17580 !! html
17581 <p>foobarista
17582 </p>
17583 !! end
17585 !! test
17586 Strip marker in padleft
17587 !! wikitext
17588 {{padleft:|2|x<nowiki/>y}}
17589 !! html
17590 <p>xy
17591 </p>
17592 !! end
17594 !! test
17595 Strip marker in padright
17596 !! wikitext
17597 {{padright:|2|x<nowiki/>y}}
17598 !! html
17599 <p>xy
17600 </p>
17601 !! end
17603 !! test
17604 Strip marker in anchorencode
17605 !! wikitext
17606 {{anchorencode:x<nowiki/>y}}
17607 !! html
17608 <p>xy
17609 </p>
17610 !! end
17612 !! test
17613 nowiki inside link inside heading (bug 18295)
17614 !! wikitext
17615 ==[[foo|x<nowiki>y</nowiki>z]]==
17616 !! html
17617 <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>
17619 !! end
17621 !! test
17622 new support for bdi element (bug 31817)
17623 !! wikitext
17624 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17625 !! html
17626 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17628 !!end
17630 !! test
17631 Ignore pipe between table row attributes
17632 !! wikitext
17634 | quux
17635 |- id=foo | style='color: red'
17636 | bar
17638 !! html
17639 <table>
17640 <tr>
17641 <td> quux
17642 </td></tr>
17643 <tr id="foo" style="color: red">
17644 <td> bar
17645 </td></tr></table>
17647 !! end
17649 !!test
17650 Gallery override link with WikiLink (bug 34852)
17651 !! wikitext
17652 <gallery>
17653 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17654 </gallery>
17655 !! html
17656 <ul class="gallery mw-gallery-traditional">
17657                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17658                         <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>
17659                         <div class="gallerytext">
17660 <p>caption
17661 </p>
17662                         </div>
17663                 </div></li>
17664 </ul>
17666 !! end
17668 !!test
17669 Gallery override link with absolute external link (bug 34852)
17670 !! wikitext
17671 <gallery>
17672 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17673 </gallery>
17674 !! html
17675 <ul class="gallery mw-gallery-traditional">
17676                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17677                         <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>
17678                         <div class="gallerytext">
17679 <p>caption
17680 </p>
17681                         </div>
17682                 </div></li>
17683 </ul>
17685 !! end
17687 !!test
17688 Gallery override link with malicious javascript (bug 34852)
17689 !! wikitext
17690 <gallery>
17691 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17692 </gallery>
17693 !! html
17694 <ul class="gallery mw-gallery-traditional">
17695                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17696                         <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>
17697                         <div class="gallerytext">
17698 <p>caption
17699 </p>
17700                         </div>
17701                 </div></li>
17702 </ul>
17704 !! end
17706 !!test
17707 Gallery with invalid title as link (bug 43964)
17708 !! wikitext
17709 <gallery>
17710 File:foobar.jpg|link=<
17711 </gallery>
17712 !! html
17713 <ul class="gallery mw-gallery-traditional">
17714                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17715                         <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>
17716                         <div class="gallerytext">
17717                         </div>
17718                 </div></li>
17719 </ul>
17721 !! end
17723 !!test
17724 Language parser function
17725 !! wikitext
17726 {{#language:ar}}
17727 !! html
17728 <p>العربية
17729 </p>
17730 !! end
17732 !!test
17733 Padleft and padright as substr
17734 !! wikitext
17735 {{padleft:|3|abcde}}
17736 {{padright:|3|abcde}}
17737 !! html
17738 <p>abc
17740 </p>
17741 !! end
17743 !!test
17744 Special parser function
17745 !! wikitext
17746 {{#special:RandomPage}}
17747 {{#special:BaDtItLe}}
17748 {{#special:Foobar}}
17749 !! html
17750 <p>Special:Random
17751 Special:Badtitle
17752 Special:Foobar
17753 </p>
17754 !! end
17756 !!test
17757 Bug 34939 - Case insensitive link parsing ([HttP://])
17758 !! wikitext
17759 [HttP://MediaWiki.Org/]
17760 !! html/php
17761 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
17762 </p>
17763 !! html/parsoid
17764 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
17765 !! end
17767 !!test
17768 Bug 34939 - Case insensitive link parsing ([HttP:// title])
17769 !! wikitext
17770 [HttP://MediaWiki.Org/ MediaWiki]
17771 !! html
17772 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
17773 </p>
17774 !! end
17776 !!test
17777 Bug 34939 - Case insensitive link parsing (HttP://)
17778 !! wikitext
17779 HttP://MediaWiki.Org/
17780 !! html/php
17781 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
17782 </p>
17783 !! html/parsoid
17784 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
17785 !! end
17787 !!test
17788 Disable TOC
17789 !! options
17790 notoc
17791 !! wikitext
17792 Lead
17793 == Section 1 ==
17794 == Section 2 ==
17795 == Section 3 ==
17796 == Section 4 ==
17797 == Section 5 ==
17798 !! html
17799 <p>Lead
17800 </p>
17802 <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>
17803 <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>
17804 <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>
17805 <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>
17806 <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>
17808 !! end
17812 ### Parsoid-specific tests
17813 ### Parsoid-PHP parser incompatibilities
17815 !!test
17816 1. SOL-sensitive wikitext tokens as template-args
17817 !!options
17818 parsoid=wt2html,wt2wt
17819 !! wikitext
17820 {{echo|*a}}
17821 {{echo|#a}}
17822 {{echo|:a}}
17823 !! html
17824 <span about="#mwt1" typeof="mw:Transclusion">
17825 </span><ul about="#mwt1"><li>a</li>
17826 </ul>
17827 <span about="#mwt2" typeof="mw:Transclusion">
17828 </span><ol about="#mwt2"><li>a</li>
17829 </ol>
17830 <span about="#mwt3" typeof="mw:Transclusion">
17831 </span><dl about="#mwt3"><dd>a</dd>
17832 </dl>
17833 !!end
17835 #### -----------------------------------------------------------------
17836 #### Parsoid-specific functionality tests
17837 #### -----------------------------------------------------------------
17839 # Bug 63642: Formatting elt fixup is cleaned up.
17840 # We know wt2wt will fail, but we expect selser to pass.
17841 # Due to the nature of our testing, wt2wt and selser tests will enter the
17842 # blacklist and we'll catch selser regressions based on changes to the
17843 # blacklist entries for selser tests.
17844 !! test
17845 Bad treebuilder fixup of formatting elt is cleaned up
17846 !! options
17847 parsoid=wt2html,wt2wt
17848 !! wikitext
17851 <small>
17852 [[Image:Foobar.jpg|right|Test]]
17853 </small>
17855 !! html/parsoid
17856 <table>
17857 <tbody><tr><td>
17858 <p><small></small></p>
17859 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a><figcaption><small>Test</small></figcaption></figure>
17860 <p></p></td></tr>
17861 </tbody></table>
17862 !! end
17864 #### ----------------------------------------------------------------
17865 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
17866 #### tags. Parsoid's output for these tags differs from that of the
17867 #### PHP parser.
17868 #### ----------------------------------------------------------------
17870 !!test
17871 Ref: 1. ref-location should be replaced with an index span
17872 !!options
17873 parsoid
17874 !! wikitext
17875 A <ref>foo</ref>
17876 B <ref name="x">foo</ref>
17877 C <ref name="y" />
17878 !! html
17879 <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>
17880 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>
17881 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>
17882 !!end
17884 !!test
17885 Ref: 2. ref-tags with identical names should all get the same index
17886 !!options
17887 parsoid
17888 !! wikitext
17889 A <ref name="x">foo</ref>
17890 B <ref name="x" />
17891 !! html
17892 <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>
17893 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>
17894 !!end
17896 !!test
17897 Ref: 3. spaces in ref-names should be ignored
17898 !!options
17899 parsoid
17900 !! wikitext
17901 A <ref name="x">foo</ref>
17902 B <ref name=" x " />
17903 C <ref name= x  />
17904 !! html
17905 <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>
17906 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>
17907 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>
17908 !!end
17910 !!test
17911 Ref: 4. 'constructor' should be accepted as a valid ref-name
17912 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
17913 !!options
17914 parsoid
17915 !! wikitext
17916 A <ref name="constructor">foo</ref>
17917 !! html
17918 <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>
17919 !!end
17921 !!test
17922 Ref: 5. body should accept generic wikitext
17923 !!options
17924 parsoid
17925 !! wikitext
17926 A <ref>
17927  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
17928 </ref>
17930 <references />
17931 !! html
17932 <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;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
17934 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
17935 <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>
17936 </li>
17937 </ol>
17938 !!end
17940 !!test
17941 Ref: 6. indent-pres should not be output in ref-body
17942 !!options
17943 parsoid
17944 !! wikitext
17945 A <ref>
17946  foo
17947  bar
17948  baz
17949 </ref>
17951 <references />
17952 !! html
17953 <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>
17955 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
17956 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17957  bar
17958  baz
17959 </li>
17960 </ol>
17961 !!end
17963 !!test
17964 Ref: 7. No p-wrapping in ref-body
17965 !!options
17966 parsoid
17967 !! wikitext
17968 A <ref>
17978 booz
17979 </ref>
17981 <references />
17982 !! html
17983 <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>
17985 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
17986 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
17995 booz
17996 </li>
17997 </ol>
17998 !!end
18000 !!test
18001 Ref: 8. transclusion wikitext has lower precedence
18002 !!options
18003 parsoid
18004 !! wikitext
18005 A <ref> foo {{echo|</ref> B C}}
18007 <references />
18008 !! html
18009 <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>
18010 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18011 <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>
18012 </ol>
18013 !!end
18015 !!test
18016 Ref: 9. unclosed comments should not leak out of ref-body
18017 !!options
18018 parsoid
18019 !! wikitext
18020 A <ref> foo <!--</ref> B C
18021 <references />
18022 !! html
18023 <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>
18024 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18025 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18026 </ol>
18027 !!end
18029 !!test
18030 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18031 !!options
18032 parsoid
18033 !! wikitext
18034 A <ref> <b> foo </ref> B C
18036 <references />
18037 !! html
18038 <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>
18041 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18042 <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>
18043 </ol>
18044 !!end
18046 !!test
18047 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18048 !!options
18049 parsoid
18050 !! wikitext
18051 A <ref>foo</ref> B
18052 C <ref>bar</ref> D
18053 !! html
18054 <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
18055 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>
18056 !!end
18058 !!test
18059 Ref: 12. ref-tags act as trailing newline migration barrier
18060 !!options
18061 parsoid
18062 !! wikitext
18063 <!--the newline at the end of this line moves out of the p-tag-->a
18065 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18066 <ref />
18069 !! html
18070 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18073 <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>
18074 <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>
18077 <p>c</p>
18078 !!end
18080 !!test
18081 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18082 !!options
18083 parsoid
18084 !! wikitext
18085 <ref>foo</ref> A
18086 <ref>bar
18087 </ref> B
18088 !! html
18089 <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
18090 <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>
18091 !!end
18093 !!test
18094 Ref: 14. A nested ref-tag should be emitted as plain text
18095 !!options
18096 parsoid
18097 !! wikitext
18098 <ref>foo <ref>bar</ref> baz</ref>
18100 <references />
18101 !! html
18102 <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>
18104 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18105 <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>
18106 </ol>
18107 !!end
18109 !!test
18110 Ref: 15. ref-tags with identical names should get identical indexes
18111 !!options
18112 parsoid
18113 !! wikitext
18114 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18115 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18117 <references />
18118 !! html
18119 <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>
18120 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>
18122 <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>
18123 </ol>
18124 !!end
18126 ## We don't bother wt2wt-ing non-standard whitespace
18127 !!test
18128 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18129 !!options
18130 parsoid=wt2html
18131 !! wikitext
18132 A <ref >foo</ref >
18134 <references />
18135 !! html
18136 <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>
18138 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18139 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18140 !!end
18142 !!test
18143 References: 1. references tag without any refs should be handled properly
18144 !!options
18145 parsoid
18146 !! wikitext
18147 <references />
18148 !! html
18149 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18150 !!end
18152 !!test
18153 References: 2. references tag with group only outputs references from that group
18154 !!options
18155 parsoid
18156 !! wikitext
18157 A <ref group="a">foo</ref>
18158 B <ref group="b">bar</ref>
18160 <references group="a" />
18161 !! html
18162 <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>
18163 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>
18165 <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>
18166 </ol>
18167 !!end
18169 !!test
18170 References: 3. ref list should be cleared after processing references
18171 !!options
18172 parsoid
18173 !! wikitext
18174 A <ref>foo</ref>
18176 <references />
18178 B <ref>bar</ref>
18180 <references />
18181 !! html
18182 <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>
18184 <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>
18185 </ol>
18187 <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>
18189 <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>
18190 </ol>
18191 !!end
18193 !!test
18194 References: 4. only referenced group should be cleared after processing references
18195 !!options
18196 parsoid
18197 !! wikitext
18198 A <ref group="a">afoo</ref>
18199 B <ref>bfoo</ref>
18201 <references group="a" />
18203 C <ref>cfoo</ref>
18205 <references />
18206 !! html
18207 <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>
18208 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>
18210 <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>
18211 </ol>
18213 <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>
18215 <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>
18216 </ol>
18217 !!end
18219 !!test
18220 References: 5. ref tags in references should be processed while ignoring all other content
18221 !!options
18222 parsoid
18223 !! wikitext
18224 A <ref name="a" />
18225 B <ref name="b">bar</ref>
18227 <references>
18228 <ref name="a">foo</ref>
18229 This should just get lost.
18230 </references>
18231 !! html
18232 <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>
18233 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>
18236 <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":{}}'>
18237 <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>
18238 <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>
18239 </ol>
18240 !!end
18242 !!test
18243 References: 6. <references /> from a transclusion
18244 !!options
18245 parsoid
18246 !! wikitext
18247 <ref>Foo</ref> {{echo|<references />}}
18248 !! html
18249 <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>
18250 !!end
18252 !! test
18253 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18254 !! options
18255 parsoid
18256 !! wikitext
18257 A <ref>foo bar for a</ref>
18258 B <ref group="X" name="b" />
18260 <references />
18262 <references group="X">
18263 <ref name="b">foo</ref>
18264 </references>
18265 !! html
18266 <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>
18267 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>
18269 <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>
18271 <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>
18272 !! end
18274 !! test
18275 Entities in ref name
18276 !! options
18277 parsoid
18278 !! wikitext
18279 <ref name="test &amp; me">hi</ref>
18280 !! html
18281 <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>
18282 !! end
18284 # This test is wt2html only because we're permitting the serializer to produce
18285 # dirty diffs, normalizing the unclosed references to the self-closed version.
18286 !! test
18287 Generate references for unclosed references tag
18288 !! options
18289 parsoid=wt2html
18290 !! wikitext
18291 a<ref>foo</ref>
18293 <references>
18294 !! html
18295 <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>
18298 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18299 <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>
18300 !! end
18302 !! test
18303 New reference serializes on its own line
18304 !! options
18305 parsoid=wt2wt,html2wt
18306 !! wikitext
18308 <references />
18309 !! html
18310 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18311 !! end
18313 #### ----------------------------------------------------------------
18314 #### The following section of tests are primarily to test
18315 #### wikitext escaping capabilities of Parsoid.  Given that
18316 #### escaping can be done any number of ways, the wikitext (input)
18317 #### is always adjusted to reflect how Parsoid adds nowiki
18318 #### escape tags.
18319 ####
18320 #### We are marking several tests as parsoid-only since the
18321 #### HTML in the result section is different from what the
18322 #### PHP parser generates for it.
18323 #### ----------------------------------------------------------------
18326 #### --------------- Headings ---------------
18327 #### 0. Unnested
18328 #### 1. Nested inside html <h1>=foo=</h1>
18329 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18330 #### 3. Nested inside html with wikitext split by html tags
18331 #### 4. No escape needed
18332 #### 5. Empty headings <h1></h1>
18333 #### 6. Heading chars in SOL context
18334 #### ----------------------------------------
18335 !! test
18336 Headings: 0. Unnested
18337 !! options
18338 parsoid
18339 !! wikitext
18340 <nowiki>=foo=</nowiki>
18342 <nowiki> =foo= </nowiki>
18343 <!--cmt-->
18344 <nowiki>=foo=</nowiki>
18346 =foo''a''<nowiki>=</nowiki>
18347 !! html
18348 <p><span typeof="mw:Nowiki">=foo=</span></p>
18350 <p><span typeof="mw:Nowiki"> =foo= </span>
18351 <!--cmt-->
18352 <span typeof="mw:Nowiki">=foo=</span></p>
18354 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18355 !!end
18357 !! test
18358 Headings: 1. Nested inside html
18359 (New headings and existing headings are handled differently)
18360 !! options
18361 parsoid=html2wt
18362 !! wikitext
18363 = =foo= =
18365 == =foo= ==
18367 === =foo= ===
18369 =<nowiki>=foo=</nowiki>=
18370 ==<nowiki>=foo=</nowiki>==
18371 ===<nowiki>=foo=</nowiki>===
18372 ====<nowiki>=foo=</nowiki>====
18373 =====<nowiki>=foo=</nowiki>=====
18374 ======<nowiki>=foo=</nowiki>======
18376 !! html
18377 <h1>=foo=</h1>
18378 <h2>=foo=</h2>
18379 <h3>=foo=</h3>
18381 <h1 data-parsoid='{}'>=foo=</h1>
18382 <h2 data-parsoid='{}'>=foo=</h2>
18383 <h3 data-parsoid='{}'>=foo=</h3>
18384 <h4 data-parsoid='{}'>=foo=</h4>
18385 <h5 data-parsoid='{}'>=foo=</h5>
18386 <h6 data-parsoid='{}'>=foo=</h6>
18387 !!end
18389 !! test
18390 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18391 !! options
18392 parsoid=html2wt
18393 !! wikitext
18394 = foo =
18395 <nowiki>*</nowiki>bar
18397 = foo =
18398 =bar
18400 = foo =
18401 <nowiki>=bar=</nowiki>
18402 !! html
18403 <h1>foo</h1>*bar
18404 <h1>foo</h1>=bar
18405 <h1>foo</h1>=bar=
18406 !!end
18408 !! test
18409 Headings: 3. Nested inside html with wikitext split by html tags
18410 !! options
18411 parsoid=html2wt
18412 !! wikitext
18413 = ='''bold'''<nowiki>foo=</nowiki> =
18414 !! html
18415 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18416 !!end
18418 !! test
18419 Headings: 4a. No escaping needed (testing just h1 and h2)
18420 !! options
18421 parsoid=html2wt
18422 !! wikitext
18423 = =foo =
18425 = foo= =
18427 = =foo= =
18429 = =foo= bar =
18431 == =foo ==
18433 == foo= ==
18435 = ''=''foo= =
18437 = <nowiki>=</nowiki> =
18438 !! html
18439 <h1>=foo</h1>
18440 <h1>foo=</h1>
18441 <h1> =foo= </h1>
18442 <h1>=foo= bar</h1>
18443 <h2>=foo</h2>
18444 <h2>foo=</h2>
18445 <h1><i>=</i>foo=</h1>
18446 <h1><span typeof="mw:Nowiki">=</span></h1>
18447 !!end
18449 !! test
18450 Headings: 4b. No escaping needed (inside p-tags)
18451 !! options
18452 parsoid=html2wt
18453 !! wikitext
18455 =foo= x
18456 =foo= <s></s>
18457 !! html
18458 <p>===
18459 =foo= x
18460 =foo= <s></s>
18461 </p>
18462 !!end
18464 !! test
18465 Headings: 5. Empty headings
18466 !! options
18467 parsoid
18468 !! wikitext
18469 =<nowiki/>=
18471 ==<nowiki/>==
18473 ===<nowiki/>===
18475 ====<nowiki/>====
18477 =====<nowiki/>=====
18479 ======<nowiki/>======
18480 !! html
18481 <h1></h1>
18482 <h2></h2>
18483 <h3></h3>
18484 <h4></h4>
18485 <h5></h5>
18486 <h6></h6>
18487 !!end
18489 !! test
18490 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18491 !! options
18492 parsoid
18493 !! wikitext
18494 <nowiki>=a=</nowiki>
18496 <nowiki>=a=</nowiki> 
18498 <nowiki>=a=</nowiki>    
18500 <nowiki>=a=</nowiki>    
18501 !! html
18502 <p>=a=</p>
18503 <p>=a= </p>
18504 <p>=a=  </p>
18505 <p>=a=  </p>
18506 !!end
18508 !! test
18509 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18510 !! options
18511 parsoid
18512 !! wikitext
18513 <nowiki>=a=
18514 b</nowiki>
18516 <nowiki>=a= 
18517 b</nowiki>
18519 <nowiki>=a=     
18520 b</nowiki>
18522 <nowiki>=a=      
18523 b</nowiki>
18524 !! html
18525 <p>=a=
18526 b</p>
18527 <p>=a= 
18528 b</p>
18529 <p>=a=  
18530 b</p>
18531 <p>=a=   
18532 b</p>
18533 </p>
18534 !!end
18536 !! test
18537 Headings: 6c. Heading chars in SOL context (leading newline break)
18538 !! options
18539 parsoid
18540 !! wikitext
18542 <nowiki>=b=</nowiki>
18543 !! html
18544 <p>a
18545 =b=</p>
18546 !!end
18548 !! test
18549 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18550 !! options
18551 parsoid
18552 !! wikitext
18553 <!--c0--><nowiki>=a=</nowiki>
18555 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
18556 !! html
18557 <p><!--c0-->=a=</p>
18558 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
18559 !!end
18561 !! test
18562 Headings: 6d. Heading chars in SOL context (No escaping needed)
18563 !! options
18564 parsoid=html2wt
18565 !! wikitext
18566 =a=<div>b</div>
18567 !! html
18568 =a=<div>b</div>
18569 !!end
18571 #### --------------- Lists ---------------
18572 #### 0. Outside nests (*foo, etc.)
18573 #### 1. Nested inside html <ul><li>*foo</li></ul>
18574 #### 2. Inside definition lists
18575 #### 3. Only bullets at start should be escaped
18576 #### 4. No escapes needed
18577 #### 5. No unnecessary escapes
18578 #### 6. Escape bullets in SOL position
18579 #### 7. Escape bullets in a multi-line context
18580 #### ----------------------------------------
18582 !! test
18583 Lists: 0. Outside nests
18584 !! wikitext
18585 <nowiki>*</nowiki>foo
18587 <nowiki>#</nowiki>foo
18589 <nowiki>;Foo:</nowiki>bar
18590 !! html
18591 <p>*foo
18592 </p><p>#foo
18593 </p><p>;Foo:bar
18594 </p>
18595 !!end
18597 !! test
18598 Lists: 1. Nested inside html
18599 !! wikitext
18600 *<nowiki>*foo</nowiki>
18602 *<nowiki>#foo</nowiki>
18604 *<nowiki>:foo</nowiki>
18606 *<nowiki>;foo</nowiki>
18608 #<nowiki>*foo</nowiki>
18610 #<nowiki>#foo</nowiki>
18612 #<nowiki>:foo</nowiki>
18614 #<nowiki>;foo</nowiki>
18615 !! html
18616 <ul><li>*foo</li></ul>
18617 <ul><li>#foo</li></ul>
18618 <ul><li>:foo</li></ul>
18619 <ul><li>;foo</li></ul>
18620 <ol><li>*foo</li></ol>
18621 <ol><li>#foo</li></ol>
18622 <ol><li>:foo</li></ol>
18623 <ol><li>;foo</li></ol>
18625 !!end
18627 !! test
18628 Lists: 2. Inside definition lists
18629 !! wikitext
18630 ;<nowiki>;foo</nowiki>
18632 ;<nowiki>:foo</nowiki>
18634 ;<nowiki>:foo</nowiki>
18635 :bar
18637 :<nowiki>:foo</nowiki>
18638 !! html
18639 <dl><dt>;foo</dt></dl>
18640 <dl><dt>:foo</dt></dl>
18641 <dl><dt>:foo</dt>
18642 <dd>bar</dd></dl>
18643 <dl><dd>:foo</dd></dl>
18645 !!end
18647 !! test
18648 Lists: 3. Only bullets at start of text should be escaped
18649 !! wikitext
18650 *<nowiki>*foo*bar</nowiki>
18652 *<nowiki>*foo</nowiki>''it''*bar
18653 !! html
18654 <ul><li>*foo*bar</li></ul>
18655 <ul><li>*foo<i>it</i>*bar</li></ul>
18657 !!end
18659 !! test
18660 Lists: 4. No escapes needed
18661 !! options
18662 parsoid
18663 !! wikitext
18664 *foo*bar
18666 *''foo''*bar
18668 *[[Foo]]: bar
18670 *[[Foo]]*bar
18671 !! html
18672 <ul>
18673 <li>foo*bar
18674 </li>
18675 </ul>
18676 <ul>
18677 <li><i>foo</i>*bar
18678 </li>
18679 </ul>
18680 <ul>
18681 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18682 </li>
18683 </ul>
18684 <ul>
18685 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18686 </li>
18687 </ul>
18688 !!end
18690 !! test
18691 Lists: 5. No unnecessary escapes
18692 !! wikitext
18693 * bar <span><nowiki>[[foo]]</nowiki></span>
18695 *=bar <span><nowiki>[[foo]]</nowiki></span>
18697 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18699 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18701 *=bar <span>foo]]</span>=
18703 * <s></s>: a
18704 !! html
18705 <ul><li> bar <span>[[foo]]</span></li></ul>
18706 <ul><li>=bar <span>[[foo]]</span></li></ul>
18707 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18708 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18709 <ul><li>=bar <span>foo]]</span>=</li></ul>
18710 <ul><li> <s></s>: a</li></ul>
18712 !!end
18714 !! test
18715 Lists: 6. Escape bullets in SOL position
18716 !! options
18717 parsoid
18718 !! wikitext
18719 <!--cmt--><nowiki>*foo</nowiki>
18720 !! html
18721 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18722 !!end
18724 !! test
18725 Lists: 7. Escape bullets in a multi-line context
18726 !! wikitext
18728 <nowiki>*</nowiki>b
18729 !! html
18730 <p>a
18732 </p>
18733 !!end
18735 #### --------------- HRs ---------------
18736 #### 1. Single line
18737 #### -----------------------------------
18739 !! test
18740 HRs: 1. Single line
18741 !! options
18742 parsoid
18743 !! wikitext
18744 ----<nowiki>----</nowiki>
18745 ----=foo=
18746 ----*foo
18747 !! html
18748 <hr><span typeof="mw:Nowiki">----</span>
18749 <hr>=foo=
18750 <hr>*foo
18751 !! end
18753 #### --------------- Tables ---------------
18754 #### 1a. Simple example
18755 #### 1b. No escaping needed (!foo)
18756 #### 1c. No escaping needed (|foo)
18757 #### 1d. No escaping needed (|}foo)
18758 ####
18759 #### 2a. Nested in td (<td>foo|bar</td>)
18760 #### 2b. Nested in td (<td>foo||bar</td>)
18761 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
18762 ####
18763 #### 3a. Nested in th (<th>foo!bar</th>)
18764 #### 3b. Nested in th (<th>foo!!bar</th>)
18765 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
18766 ####
18767 #### 4a. Escape -
18768 #### 4b. Escape +
18769 #### 4c. No escaping needed
18770 #### --------------------------------------
18772 !! test
18773 Tables: 1a. Simple example
18774 !! wikitext
18775 <nowiki>{|
18776 |}</nowiki>
18777 !! html
18778 <p>{|
18780 </p>
18781 !! end
18783 !! test
18784 Tables: 1b. No escaping needed
18785 !! wikitext
18786 !foo
18787 !! html
18788 <p>!foo
18789 </p>
18790 !! end
18792 !! test
18793 Tables: 1c. No escaping needed
18794 !! wikitext
18795 |foo
18796 !! html
18797 <p>|foo
18798 </p>
18799 !! end
18801 !! test
18802 Tables: 1d. No escaping needed
18803 !! wikitext
18804 |}foo
18805 !! html
18806 <p>|}foo
18807 </p>
18808 !! end
18810 !! test
18811 Tables: 2a. Nested in td
18812 !! options
18813 parsoid=html2wt
18814 !! wikitext
18816 |<nowiki>foo|bar</nowiki>
18818 |x<div><nowiki>a|b</nowiki></div>
18820 !! html
18821 <table><tbody><tr>
18822 <td>foo|bar</td></tr>
18823 <tr><td>x<div>a|b</div></td>
18824 </tbody></table>
18825 !! end
18827 !! test
18828 Tables: 2b. Nested in td
18829 !! options
18830 parsoid
18831 !! wikitext
18833 |<nowiki>foo||bar</nowiki>
18834 |''it''<nowiki>foo||bar</nowiki>
18836 !! html
18837 <table><tbody><tr>
18838 <td><span typeof="mw:Nowiki">foo||bar</span></td>
18839 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
18840 !! end
18842 !! test
18843 Tables: 2c. Nested in td -- no escaping needed
18844 !! options
18845 parsoid
18846 !! wikitext
18848 |foo!!bar
18850 !! html
18851 <table><tbody><tr><td>foo!!bar
18852 </td></tr></tbody></table>
18854 !! end
18856 !! test
18857 Tables: 3a. Nested in th
18858 !! options
18859 parsoid
18860 !! wikitext
18862 !foo!bar
18864 !! html
18865 <table><tbody><tr><th>foo!bar
18866 </th></tr></tbody></table>
18868 !! end
18870 !! test
18871 Tables: 3b. Nested in th
18872 !! options
18873 parsoid
18874 !! wikitext
18876 !<nowiki>foo!!bar</nowiki>
18878 !! html
18879 <table>
18880 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
18881 </tbody></table>
18882 !! end
18884 !! test
18885 Tables: 3c. Nested in th -- no escaping needed
18886 !! options
18887 parsoid
18888 !! wikitext
18890 !<nowiki>foo||bar</nowiki>
18892 !! html
18893 <table><tbody><tr>
18894 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
18895 !! end
18897 !! test
18898 Tables: 4a. Escape -
18899 !! options
18900 parsoid
18901 !! wikitext
18903 !-bar
18905 |<nowiki>-bar</nowiki>
18907 !! html
18908 <table><tbody>
18909 <tr><th>-bar</th></tr>
18910 <tr>
18911 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
18912 !! end
18914 !! test
18915 Tables: 4b. Escape +
18916 !! options
18917 parsoid
18918 !! wikitext
18920 !+bar
18922 |<nowiki>+bar</nowiki>
18924 !! html
18925 <table><tbody>
18926 <tr><th>+bar</th></tr>
18927 <tr>
18928 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
18929 !! end
18931 !! test
18932 Tables: 4c. No escaping needed
18933 !! options
18934 parsoid
18935 !! wikitext
18937 |foo-bar
18938 |foo+bar
18940 |''foo''-bar
18941 |''foo''+bar
18943 |foo
18944 bar|baz
18945 +bar
18946 -bar
18949 <div>a|b</div>
18951 !! html
18952 <table><tbody>
18953 <tr><td>foo-bar</td><td>foo+bar</td></tr>
18954 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
18955 <tr><td>foo
18956 <p>bar|baz
18957 +bar
18958 -bar</p></td></tr>
18959 <tr><td>x
18960 <div>a|b</div></td>
18961 </tbody></table>
18962 !! end
18964 !! test
18965 Tables: 4d. No escaping needed
18966 !! options
18967 parsoid
18968 !! wikitext
18970 |[[Foo]]-bar
18971 ||+1
18972 ||-2
18974 !! html
18975 <table>
18976 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
18977 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
18978 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
18979 </tbody></table>
18980 !! end
18982 !! test
18983 Tables: Digest broken attributes on table and tr tag
18984 !! options
18985 parsoid=wt2html
18986 !! wikitext
18987 {| || |} ++
18988 |- || || ++ --
18989 |- > [
18991 !! html
18992 <table>
18993 <tbody>
18994 <tr></tr>
18995 <tr></tr>
18996 </tbody></table>
18997 !! end
18999 #### --------------- Links ----------------
19000 #### 1. Quote marks in link text
19001 #### 2. Wikilinks: Escapes needed
19002 #### 3. Wikilinks: No escapes needed
19003 #### 4. Extlinks: Escapes needed
19004 #### 5. Extlinks: No escapes needed
19005 #### --------------------------------------
19006 !! test
19007 Links 1. Quote marks in link text
19008 !! options
19009 parsoid
19010 !! wikitext
19011 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19012 !! html
19013 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19014 !! end
19016 !! test
19017 Links 2. WikiLinks: Escapes needed
19018 !! options
19019 parsoid
19020 !! wikitext
19021 [[Foo|[Foobar]]]
19022 [[Foo|<nowiki>Foobar]</nowiki>]]
19023 [[Foo|x [Foobar] x]]
19024 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19025 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19026 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19027 [[Foo|<nowiki>|Bar</nowiki>]]
19028 [[Foo|<nowiki>]]bar</nowiki>]]
19029 [[Foo|<nowiki>[[bar</nowiki>]]
19030 [[Foo|<nowiki>x [[ y</nowiki>]]
19031 [[Foo|<nowiki>x ]] y</nowiki>]]
19032 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19033 !! html
19034 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19035 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19036 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19037 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19038 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19039 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19040 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19041 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19042 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19043 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19044 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19045 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19046 !! end
19048 !! test
19049 Links 3. WikiLinks: No escapes needed
19050 !! options
19051 parsoid
19052 !! wikitext
19053 [[Foo|[Foobar]]
19054 [[Foo|foo|bar]]
19055 !! html
19056 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19057 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19058 !! end
19060 !! test
19061 Links 4. ExtLinks: Escapes needed
19062 !! options
19063 parsoid
19064 !! wikitext
19065 [http://google.com <nowiki>[google]</nowiki>]
19066 [http://google.com <nowiki>google]</nowiki>]
19068 <nowiki>[http://google.com]</nowiki>
19070 <nowiki>[http://google.com google]</nowiki>
19072 !! html
19073 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19074 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19075 <p>[http://google.com]</p>
19076 <p>[http://google.com google]</p>
19077 !! end
19079 !! test
19080 Links 5. ExtLinks: No escapes needed
19081 !! options
19082 parsoid
19083 !! wikitext
19084 [http://google.com [google]
19085 !! html
19086 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19087 !! end
19089 !! test
19090 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19091 !! html/parsoid
19092 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19093 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19094 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19095 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19096 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19097 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19098 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19099 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19100 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19101 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19102 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19103 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19104 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19105 </p>
19106 !! wikitext
19107 x<nowiki/>http://example.com<nowiki/>y
19108 http://example.com<nowiki/>?x
19109 http://example.com<nowiki/>&x
19110 http://example.com<nowiki/>'x
19111 http://example.com<nowiki/>,x
19112 http://example.com<nowiki/>.x
19113 http://example.com<nowiki/>;x
19114 http://example.com<nowiki/>:x
19115 http://example.com<nowiki/>;x
19116 http://example.com<nowiki/>!x
19117 http://example.com<nowiki/>=x
19118 http://example.com<nowiki/>(x)
19119 http://example.com(x<nowiki/>)
19120 !! end
19122 !! test
19123 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19124 !! html/parsoid
19125 <p>x
19126 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19128 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19129 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19130 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19131 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19132 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19133 </p>
19134 !! wikitext
19136 http://example.com
19138 "http://example.com"
19139 (http://example.com)
19140 (http://example.com) foo
19141 http://example.com,
19142 http://example.com, foo
19143 !! end
19145 ## Parsoid currently fails wt2html on this one!
19146 !! test
19147 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19148 !! html/parsoid
19149 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19150 !! wikitext
19151 http://example.com.,;:!?
19152 !! end
19154 !! test
19155 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19156 !! html/parsoid
19157 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19158 !! wikitext
19159 RFC 123<nowiki/>4
19160 !! end
19162 !! test
19163 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19164 !! html/parsoid
19165 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19166 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19167 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19168 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19169 </p>
19170 !! wikitext
19171 xRFC 123y
19172 XRFC 123y
19173 RFC 123?foo
19174 RFC 123&foo
19175 !! end
19177 !! test
19178 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19179 !! html/parsoid
19180 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19181 !! wikitext
19182 PMID 123<nowiki/>4
19183 !! end
19185 !! test
19186 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19187 !! html/parsoid
19188 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19189 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19190 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19191 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19192 </p>
19193 !! wikitext
19194 xPMID 123y
19195 XPMID 123y
19196 PMID 123?foo
19197 PMID 123&foo
19198 !! end
19200 !! test
19201 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19202 !! html/parsoid
19203 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19204 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19205 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19206 </p>
19207 !! wikitext
19208 ISBN 1234567890<nowiki/>1
19209 ISBN 1234567890<nowiki/>x
19210 ISBN 1234567890<nowiki/>b
19211 !! end
19213 !! test
19214 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19215 !! html/parsoid
19216 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19217 !! wikitext
19218 ISBN 1234567890's
19219 !! end
19221 #### --------------- Quotes ---------------
19222 #### 1. Quotes inside <b> and <i>
19223 #### 2. Link fragments separated by <i> and <b> tags
19224 #### 3. Link fragments inside <i> and <b>
19225 #### 4. No escaping needed
19226 #### --------------------------------------
19227 !! test
19228 1. Quotes inside <b> and <i>
19229 !! options
19230 parsoid=html2wt,wt2wt
19231 !! wikitext
19232 ''<nowiki>'foo'</nowiki>''
19233 ''<nowiki>''foo''</nowiki>''
19234 ''<nowiki>'''foo'''</nowiki>''
19235 ''foo''<nowiki/>'s
19236 '''<nowiki>'foo'</nowiki>'''
19237 '''<nowiki>''foo''</nowiki>'''
19238 '''<nowiki>'''foo'''</nowiki>'''
19239 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19240 '''foo'''<nowiki/>'s
19241 '''foo''
19242 ''foo''<nowiki/>'
19243 '<nowiki/>''foo''<nowiki/>'
19244 ''''foo'''
19245 '''foo'''<nowiki/>'
19246 '<nowiki/>'''foo'''<nowiki/>'
19247 ''fools'<span> errand</span>''
19248 ''<span>fool</span>'s errand''
19249 !! html
19250 <p><i>'foo'</i>
19251 <i>''foo''</i>
19252 <i>'''foo'''</i>
19253 <i>foo</i>'s
19254 <b>'foo'</b>
19255 <b>''foo''</b>
19256 <b>'''foo'''</b>
19257 <b>foo'<i>bar'</i>baz</b>
19258 <b>foo</b>'s
19259 '<i>foo</i>
19260 <i>foo</i>'
19261 '<i>foo</i>'
19262 '<b>foo</b>
19263 <b>foo</b>'
19264 '<b>foo</b>'</p>
19265 <i>fools'<span> errand</span></i>
19266 <i><span>fool</span>'s errand</i>
19267 !! end
19269 !! test
19270 2. Link fragments separated by <i> and <b> tags
19271 !! wikitext
19272 [[''foo''<nowiki>hello]]</nowiki>
19274 [['''foo'''<nowiki>hello]]</nowiki>
19275 !! html
19276 <p>[[<i>foo</i>hello]]
19277 </p><p>[[<b>foo</b>hello]]
19278 </p>
19279 !! end
19281 !! test
19282 3. Link fragments inside <i> and <b>
19283 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19284  this is one of the shortcomings of this format)
19285 !! wikitext
19286 ''[[foo''<nowiki>]]</nowiki>
19288 '''[[foo'''<nowiki>]]</nowiki>
19289 !! html
19290 <p><i>[[foo</i>]]
19291 </p><p><b>[[foo</b>]]
19292 </p>
19293 !! end
19295 !! test
19296 4. No escaping needed
19297 !! wikitext
19298 '<span>''bar''</span>'
19299 '<span>'''bar'''</span>'
19300 !! html
19301 <p>'<span><i>bar</i></span>'
19302 '<span><b>bar</b></span>'
19303 </p>
19304 !! end
19306 #### ----------- Paragraphs ---------------
19307 #### 1. No unnecessary escapes
19308 #### --------------------------------------
19310 !! test
19311 1. No unnecessary escapes
19312 !! wikitext
19313 bar <span><nowiki>[[foo]]</nowiki></span>
19315 =bar <span><nowiki>[[foo]]</nowiki></span>
19317 [[bar <span><nowiki>[[foo]]</nowiki></span>
19319 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19321 =bar <span>foo]]</span><nowiki>=</nowiki>
19322 !! html
19323 <p>bar <span>[[foo]]</span>
19324 </p><p>=bar <span>[[foo]]</span>
19325 </p><p>[[bar <span>[[foo]]</span>
19326 </p><p>]]bar <span>[[foo]]</span>
19327 </p><p>=bar <span>foo]]</span>=
19328 </p>
19329 !!end
19331 #### ----------------------- PRE --------------------------
19332 #### 1. Leading whitespace in SOL context should be escaped
19333 #### ------------------------------------------------------
19334 !! test
19335 1. Leading whitespace in SOL context should be escaped
19336 !! options
19337 parsoid
19338 !! wikitext
19339 <nowiki> </nowiki>a
19341 <nowiki> </nowiki> a
19343 <nowiki>        </nowiki>a(tab)
19345 <nowiki> </nowiki>      a
19346 <!--cmt-->
19347 <nowiki> </nowiki> a
19350 <nowiki> </nowiki>b
19353 <nowiki>        </nowiki>b
19356 <nowiki>        </nowiki> b
19357 !! html
19358 <p> a</p>
19359 <p>  a</p>
19360 <p>     a(tab)</p>
19361 <p>     a</p>
19362 <p><!--cmt-->  a</p>
19363 <p>a
19364  b</p>
19365 <p>a
19366         b</p>
19367 <p>a
19368          b</p>
19369 !! end
19371 #### --------------- Behavior Switches --------------------
19372 !! test
19373 1. Valid behavior switches should be escaped
19374 !! options
19375 parsoid=html2wt
19376 !! wikitext
19377 <nowiki>__TOC__</nowiki>
19378 !! html
19379 __TOC__
19380 !! end
19382 !! test
19383 2. Invalid behavior switches should not be escaped
19384 !! options
19385 parsoid=html2wt
19386 !! wikitext
19387 __TOO__
19388 __|__
19389 !! html
19390 __TOO__
19391 __|__
19392 !! end
19394 #### --------------- HTML tags ---------------
19395 #### 1. a tags
19396 #### 2. other tags
19397 #### 3. multi-line html tag
19398 #### 4. extension tags
19399 #### -----------------------------------------
19400 !! test
19401 1. a tags
19402 !! options
19403 parsoid
19404 !! wikitext
19405 <a href="http://google.com">google</a>
19406 !! html
19407 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19408 !! end
19410 !! test
19411 2. other tags
19412 !! wikitext
19413 <nowiki><div>foo</div>
19414 <div style="color:red">foo</div></nowiki>
19415 !! html
19416 <p>&lt;div&gt;foo&lt;/div&gt;
19417 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19418 </p>
19419 !! end
19421 !! test
19422 3. multi-line html tag
19423 !! wikitext
19424 <nowiki><div
19425 >foo</div
19426 ></nowiki>
19427 !! html
19428 <p>&lt;div
19429 &gt;foo&lt;/div
19430 &gt;
19431 </p>
19432 !! end
19434 !! test
19435 4. extension tags
19436 !! wikitext
19437 <nowiki><ref>foo</ref></nowiki>
19439 <nowiki><ref>bar</nowiki>
19441 baz<nowiki></ref></nowiki>
19442 !! html
19443 <p>&lt;ref&gt;foo&lt;/ref&gt;
19444 </p><p>&lt;ref&gt;bar
19445 </p><p>baz&lt;/ref&gt;
19446 </p>
19447 !! end
19449 #### --------------- Others ---------------
19450 !! test
19451 Escaping nowikis
19452 !! wikitext
19453 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19454 !! html
19455 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19456 </p>
19457 !! end
19459 ## The quote-char in the input is necessary for triggering the bug
19460 !! test
19461 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19462 !! options
19463 parsoid=wt2wt,html2wt
19464 !! wikitext
19465 foo's bar :
19466 !! html
19467 <p>foo's bar :</p>
19468 !! end
19470 !! test
19472 Tag-like HTML structures are passed through as text
19473 !! wikitext
19474 <x y>
19476 <x.y>
19478 <x-y>
19486 1<d e>f
19487 !! html
19488 <p>&lt;x y&gt;
19489 </p><p>&lt;x.y&gt;
19490 </p><p>&lt;x-y&gt;
19491 </p><p>1&gt;2
19492 </p><p>x&lt;y
19493 </p><p>a&gt;b
19494 </p><p>1&lt;d e&gt;f
19495 </p>
19496 !! end
19499 # This was a bug in the PHP parser (see bug 17663 and its dups,
19500 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19501 !! test
19502 Tag names followed by punctuation should not be recognized as tags
19503 !! wikitext
19504 <s.ome> text
19505 !! html
19506 <p>&lt;s.ome&gt; text
19507 </p>
19508 !! end
19510 !! test
19511 HTML tag with necessary entities in attributes
19512 !! wikitext
19513 <span title="&amp;amp;">foo</span>
19514 !! html
19515 <p><span title="&amp;amp;">foo</span>
19516 </p>
19517 !! end
19519 !! test
19520 HTML tag with 'unnecessary' entity encoding in attributes
19521 !! wikitext
19522 <span title="&amp;">foo</span>
19523 !! html
19524 <p><span title="&amp;">foo</span>
19525 </p>
19526 !! end
19528 !! test
19529 HTML tag with broken attribute value quoting
19530 !! wikitext
19531 <span title="Hello world>Foo</span>
19532 !! html
19533 <p><span>Foo</span>
19534 </p>
19535 !! end
19537 !! test
19538 Parsoid-only: HTML tag with broken attribute value quoting
19539 !! options
19540 parsoid
19541 !! wikitext
19542 <span title="Hello world>Foo</span>
19543 !! html
19544 <p><span title="Hello world">Foo</span>
19545 </p>
19546 !! end
19548 !! test
19549 Table with broken attribute value quoting
19550 !! wikitext
19552 | title="Hello world|Foo
19554 !! html
19555 <table>
19556 <tr>
19557 <td>Foo
19558 </td></tr></table>
19560 !! end
19562 !! test
19563 Table with broken attribute value quoting on consecutive lines
19564 !! wikitext
19566 | title="Hello world|Foo
19567 | style="color:red|Bar
19569 !! html
19570 <table>
19571 <tr>
19572 <td>Foo
19573 </td>
19574 <td>Bar
19575 </td></tr></table>
19577 !! end
19579 !! test
19580 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19581 !! options
19582 parsoid
19583 !! wikitext
19585 | title="Hello world|Foo
19586 | style="color:red|Bar
19588 !! html
19589 <table><tbody>
19590 <tr>
19591 <td title="Hello world">Foo
19592 </td><td style="color: red">Bar
19593 </td></tr></tbody></table>
19595 !! end
19597 !! test
19598 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19599 !! options
19600 parsoid
19601 !! wikitext
19602 {{}}
19603 !! html
19604 {{}}
19605 !! end
19607 !! test
19608 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19609 !! options
19610 parsoid
19611 !! wikitext
19612 }}{{
19613 !! html
19614 }}{{
19615 !! end
19617 !!test
19618 Accept empty td cell attribute
19619 !! wikitext
19621 | align="center" | foo ||  |
19623 !! html
19624 <table>
19625 <tr>
19626 <td align="center"> foo </td>
19627 <td>
19628 </td></tr></table>
19630 !!end
19632 !!test
19633 Non-empty attributes in th-cells
19634 !! wikitext
19636 ! Foo !! style="color: red" | Bar
19638 !! html
19639 <table>
19640 <tr>
19641 <th> Foo </th>
19642 <th style="color: red"> Bar
19643 </th></tr></table>
19645 !!end
19647 !!test
19648 Accept empty attributes in th-cells
19649 !! wikitext
19651 !| foo !!| bar
19653 !! html
19654 <table>
19655 <tr>
19656 <th> foo </th>
19657 <th> bar
19658 </th></tr></table>
19660 !!end
19662 !!test
19663 Empty table rows go away
19664 !! wikitext
19666 | Hello
19667 | there
19668 |- class="foo"
19671 !! html
19672 <table>
19673 <tr>
19674 <td> Hello
19675 </td>
19676 <td> there
19677 </td></tr>
19679 </table>
19681 !! end
19684 ### Parsoid-centric tests for testing RTing of inter-element separators
19685 ### Edge cases not tested by existing parser tests and specific to
19686 ### Parsoid-specific serialization strategies.
19689 !!test
19690 RT-ed inter-element separators should be valid separators
19691 !! wikitext
19693 |- [[foo]]
19695 !! html
19696 <table>
19698 </table>
19700 !!end
19702 !!test
19703 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
19704 (Parsoid-only since PHP parser relies on Tidy for correct output)
19705 !!options
19706 parsoid
19707 !! wikitext
19709 |<small>foo
19714 |<small>foo<small>
19716 !! html
19717 !!end
19719 !!test
19720 Empty TD followed by TD with tpl-generated attribute
19721 !! wikitext
19725 |{{echo|style='color:red'}}|foo
19727 !! html
19728 <table>
19730 <tr>
19731 <td>
19732 </td>
19733 <td>foo
19734 </td></tr></table>
19736 !!end
19738 !!test
19739 Indented table with an empty td
19740 !! wikitext
19741  {|
19742  |-
19744  |foo
19745  |}
19746 !! html
19747 <table>
19749 <tr>
19750 <td>
19751 </td>
19752 <td>foo
19753 </td></tr></table>
19755 !!end
19757 !!test
19758 Indented block & table
19759 !! wikitext
19760  <div>foo</div>
19761  {|
19762  |foo
19763  |}
19764 !! html/parsoid
19765  <div data-parsoid='{"stx":"html"}'>foo</div>
19766  <table><tbody>
19767  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
19768  </tbody></table>
19769 !!end
19771 !!test
19772 Empty TR followed by a template-generated TR
19773 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
19774 !!options
19775 parsoid
19776 !! wikitext
19779 {{echo|<tr><td>foo</td></tr>}}
19781 !! html
19782 <table>
19783 <tbody>
19784 <tr></tr>
19785 <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}}]}'>
19786 <td>foo</td></tr>
19787 </tbody></table>
19788 !!end
19790 ## PHP and parsoid output differ for this, and since this is primarily
19791 ## for testing Parsoid's serializer, marking this Parsoid only
19792 !!test
19793 Empty TR followed by mixed-ws-comment line should RT correctly
19794 !!options
19795 parsoid
19796 !! wikitext
19799  <!--c-->
19801 <!--c--> <!--d-->
19803 !! html
19804 <table>
19805 <tbody>
19806 <tr></tr>
19807  <!--c-->
19808 <tr>
19809 <!--c--> </tr><!--d-->
19810 </tbody></table>
19812 !!end
19814 !!test
19815 Multi-line image caption generated by templates with/without trailing newlines
19816 !!options
19817 parsoid
19818 !! wikitext
19819 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
19820 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
19821 !! html
19822 <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>
19823 <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>
19825 !!end
19827 !! test
19828 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
19829 !! options
19830 parsoid=html2wt
19831 !! wikitext
19832 <includeonly>foo</includeonly>
19833 new para
19835 [[./Category:Foo]]
19837 = new heading =
19838 !! html
19839 <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>
19841 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
19842 !! end
19844 ## PHP emits broken html for this, and since this is primarily
19845 ## a Parsoid serializer test, marking this Parsoid only
19846 !!test
19847 Improperly nested inline or quotes tags with whitespace in between
19848 !!options
19849 parsoid
19850 !! wikitext
19851 <span> <s>x</span> </s>
19852 ''' ''x''' ''
19853 !! html
19854 <p><span> <s>x</s></span><s> </s>
19855 <b> <i>x</i></b><i> </i>
19856 </p>
19857 !!end
19859 !!test
19860 Encapsulate protected attributes from wt
19861 !!options
19862 parsoid
19863 !! wikitext
19864 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
19865 !! html
19866 <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>
19867 </body>
19868 !!end
19870 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
19871 ## Having nested or stray pre tags results in the attempt to add duplicates,
19872 ## causing an assertion fail. This test tries to prevent that situation.
19873 !!test
19874 Ensure ParagraphWrapper can deal with stray closing pre tags
19875 !!options
19876 parsoid=wt2html
19877 !! wikitext
19878 plain text</pre>
19879 !! html
19880 plain text
19881 !!end
19883 !!test
19884 1. Ensure fostered text content is wrapped in spans
19885 !!options
19886 parsoid=wt2html
19887 !! wikitext
19888 <table>hi</table><table>ho</table>
19889 !! html
19890 <span>hi</span>
19891 <table></table>
19892 <span>ho</span>
19893 <table></table>
19894 !!end
19896 !!test
19897 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
19898 !!options
19899 parsoid=wt2html,wt2wt
19900 !! wikitext
19901 <table>
19902 <tr> || ||
19903 <td> a
19904 </table>
19905 !! html
19906 <span> || ||</span>
19907 <table>
19908 <tbody>
19909 <tr>
19910 <td> a</td></tr>
19911 </tbody></table>
19912 !!end
19914 !!test
19915 Encapsulation properly handles null DSR information from foster box
19916 !!options
19917 parsoid=wt2html,wt2wt
19918 !! wikitext
19919 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
19920 !! html
19921 <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;
19922 <table>foo
19923 <tr>
19924 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
19925 <table>
19926 <tbody>
19927 <tr>
19928 <td>bar</td></tr></tbody></table>
19929 !!end
19931 !!test
19932 1. Encapsulate foster-parented transclusion content
19933 !!options
19934 parsoid=wt2wt,wt2html
19935 !! wikitext
19936 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
19937 !! html
19938 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19939 <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
19940 <tr>
19941 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
19942 <table>
19943 <tbody>
19944 <tr>
19945 <td>bar</td></tr></tbody></table>
19946 !!end
19948 !!test
19949 2. Encapsulate foster-parented transclusion content
19950 !!options
19951 parsoid=wt2wt,wt2html
19952 !! wikitext
19953 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
19954 !! html
19955 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19956 <table>
19957 <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>
19958 <tr>
19959 <td>bar</td></tr></table>&quot;]}">foo</div>
19960 <table>
19961 <tbody>
19962 <tr>
19963 <td>bar</td></tr></tbody></table>
19964 !!end
19966 !!test
19967 3. Encapsulate foster-parented transclusion content
19968 !!options
19969 parsoid=wt2wt,wt2html
19970 !! wikitext
19971 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19972 !! html
19973 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19974 <table>
19975 <div>
19976 <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>
19977 <tr>
19978 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19979 <p>foo</p></div>
19980 <table>
19981 <tbody>
19982 <tr>
19983 <td>bar</td></tr></tbody></table>
19984 !!end
19986 !!test
19987 4. Encapsulate foster-parented transclusion content
19988 !!options
19989 parsoid=wt2wt,wt2html
19990 !! wikitext
19991 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
19992 !! html
19993 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
19994 <table>
19995 <div>
19996 <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>
19997 <tr>
19998 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
19999 <p>foo</p></div>
20000 <table>
20001 <tbody>
20002 <tr>
20003 <td>bar</td></tr></tbody></table>
20004 !!end
20006 !!test
20007 5. Encapsulate foster-parented transclusion content
20008 !!options
20009 parsoid=wt2wt,wt2html
20010 !! wikitext
20011 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20012 !! html
20013 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20014 <table>
20015 <tr>
20016 <td>
20017 <div>
20018 <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>
20019 <table>
20020 <tbody>
20021 <tr>
20022 <td>
20023 <div>
20024 <p>foo</p></div></td></tr></tbody></table>
20025 !!end
20027 !!test
20028 6. Encapsulate foster-parented transclusion content
20029 !!options
20030 parsoid=wt2wt,wt2html
20031 !! wikitext
20032 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20033 !! html
20034 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20035 <table>
20036 <tr>
20037 <td>
20038 <div>
20039 <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>
20040 <table>
20041 <tbody>
20042 <tr>
20043 <td>
20044 <div>
20045 <p>foo</p></div></td></tr></tbody></table>
20046 <p>ok</p>
20047 !!end
20049 !!test
20050 7. Encapsulate foster-parented transclusion content
20051 !!options
20052 parsoid=wt2wt,wt2html
20053 !! wikitext
20054 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20055 !! html
20056 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20057 <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;
20058 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20059 <td>bar</td></table>&quot;]}">foo</p>
20060 <table>
20061 <tbody>
20062 <tr>
20063 <td>bar</td></tr></tbody></table>
20064 !!end
20066 !!test
20067 8. Encapsulate foster-parented transclusion content
20068 !!options
20069 parsoid=wt2wt,wt2html
20070 !! wikitext
20071 {{echo|a
20072 }}{|{{echo|style='color:red'}}
20076 !! html
20077 <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>
20078 <table>
20079 <tbody>
20080 <tr>
20081 <td>b</td></tr></tbody></table>
20082 !!end
20084 !!test
20085 9. Encapsulate foster-parented transclusion content
20086 !!options
20087 parsoid=wt2wt,wt2html
20088 !! wikitext
20089 <table>{{echo|hi</table>hello}}
20090 !! html
20091 <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>
20092 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20093 !!end
20095 !!test
20096 Table in fosterable position
20097 !!options
20098 parsoid=wt2html,wt2wt
20099 !! wikitext
20100 {{OpenTable}}
20101 <div>
20104 </div>
20106 !! html
20107 <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="{}">
20108 </span>
20109 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20111 <table>
20112 </table>
20113 !!end
20115 # Parsoid only for bug 64747
20116 !! test
20117 Properly encapsulate empty-content transclusions in fosterable positions
20118 !! wikitext
20119 <table>
20120 {{#if:|
20121 <td>foo</td>
20123 </table>
20124 !! html/parsoid
20125 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
20127 </table>
20128 !! end
20130 !!test
20131 Support <object> element with .data attribute
20132 !!options
20133 parsoid=html2wt
20134 !! wikitext
20135 <object data="test.swf"></object>
20136 !! html
20137 <object data="test.swf"></object>
20138 !!end
20140 # -----------------------------------------------------------------
20141 # The following section of tests are primarily to spec requirements
20142 # around serialization of new/edited content.
20144 # All these tests are marked Parsoid html2wt and html2html only
20145 # ----------------------------------------------------------------
20147 !! test
20148 Image: Modifying size of an image (1)
20149 !! options
20150 parsoid={
20151   "modes": ["wt2wt"],
20152   "changes": [
20153     ["img[height]", "attr", "height", "22"],
20154     ["img[width]", "attr", "width", "200"]
20155   ]
20157 !! wikitext
20158 [[Image:Foobar.jpg|230x230px]]
20159 !! wikitext/edited
20160 [[Image:Foobar.jpg|200x200px]]
20161 !!end
20163 !! test
20164 Image: Modifying size of an image (2)
20165 !! options
20166 parsoid={
20167   "modes": ["wt2wt"],
20168   "changes": [
20169     ["img[height]", "attr", "height", "100"],
20170     ["img[width]", "attr", "width", "500"]
20171   ]
20173 !! wikitext
20174 [[Image:Foobar.jpg|230x230px]]
20175 !! wikitext/edited
20176 [[Image:Foobar.jpg|500x500px]]
20177 !!end
20179 # Change in size is ignored so long as class='mw-default-size'
20180 !! test
20181 Image: Modifying size of an image (3)
20182 !! options
20183 parsoid={
20184   "modes": ["wt2wt"],
20185   "changes": [
20186     ["figure[class]", "removeClass", "mw-default-size"],
20187     ["figure img", "attr", "height", "19"],
20188     ["figure img", "attr", "width", "170"]
20189   ]
20191 !! wikitext
20192 [[Image:Foobar.jpg|thumb]]
20193 !! wikitext/edited
20194 [[Image:Foobar.jpg|thumb|170x170px]]
20195 !!end
20197 !! test
20198 Image: Modifying alignment of an image (bug 48665)
20199 !! options
20200 parsoid={
20201   "modes": ["wt2wt"],
20202   "changes": [
20203     ["figure[class]", "removeClass", "mw-halign-right"],
20204     ["figure[class]", "addClass", "mw-halign-left"]
20205   ]
20207 !! wikitext
20208 [[Image:Foobar.jpg|thumb|caption|right]]
20209 !! wikitext/edited
20210 [[Image:Foobar.jpg|thumb|caption|left]]
20211 !! end
20213 !! test
20214 Image: Modifying mw-default-size of an frameless image (bug 62805)
20215 !! options
20216 parsoid={
20217   "modes": ["wt2wt"],
20218   "changes": [
20219     ["figure.mw-default-size", "removeClass", "mw-default-size"]
20220   ]
20222 !! wikitext
20223 [[Image:Foobar.jpg|frameless|right]]
20224 !! wikitext/edited
20225 [[Image:Foobar.jpg|frameless|right|220x220px]]
20226 !! end
20228 !! test
20229 Image: Modifying valign of an image (bug 49221)
20230 !! options
20231 parsoid={
20232   "modes": ["wt2wt"],
20233   "changes": [
20234     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20235     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20236   ]
20238 !! wikitext
20239 [[File:Foobar.jpg|20px|middle]]
20240 !! wikitext/edited
20241 [[File:Foobar.jpg|20px|text-top]]
20242 !! end
20244 !! test
20245 Image: Modifying alt attribute of an image (bug 56400)
20246 !! options
20247 parsoid={
20248   "modes": ["wt2wt"],
20249   "changes": [
20250     ["img[alt]", "attr", "alt", "some alternate edited text"]
20251   ]
20253 !! wikitext
20254 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20255 !! wikitext/edited
20256 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20257 !!end
20259 !! test
20260 Image: Modifying caption of an image
20261 !! options
20262 parsoid={
20263   "modes": ["wt2wt"],
20264   "changes": [
20265     ["figcaption", "text", "new caption"]
20266   ]
20268 !! wikitext
20269 [[Image:Foobar.jpg|thumb|original caption]]
20270 !! wikitext/edited
20271 [[Image:Foobar.jpg|thumb|new caption]]
20272 !!end
20274 !! test
20275 Image: empty alt attribute (bug 48924)
20276 !! options
20277 parsoid
20278 !! wikitext
20279 [[File:Foobar.jpg|thumb|alt=|bar]]
20280 !! html
20281 <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>
20282 !! end
20284 #!! test
20285 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20286 #!! options
20287 #parsoid=html2wt
20288 #language=ar
20289 #!! input
20290 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20291 #!! result
20292 #<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>
20293 #!! end
20295 !! test
20296 Image: Block level image should have \n before and after
20297 !! options
20298 parsoid
20299 !! wikitext
20301 [[File:Foobar.jpg|right|thumb|150x150px]]
20303 !! html
20304 <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>
20305 !!end
20307 !! test
20308 Image: New block level image should have \n before and after (existing
20309 content)
20310 !! options
20311 parsoid
20312 !! wikitext
20314 [[File:Foobar.jpg|right|thumb|150x150px]]
20316 !! html
20317 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20318 <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>
20319 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20320 !!end
20322 !! test
20323 Image: upright option (parsoid)
20324 !! options
20325 parsoid
20326 !! wikitext
20327 [[File:Foobar.jpg|thumb|upright|caption]]
20328 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20329 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20330 !! html
20331 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure><figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
20332 !!end
20334 !! test
20335 Image: upright option is ignored on inline and frame images (parsoid)
20336 !! options
20337 parsoid
20338 !! wikitext
20339 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20340 !! html
20341 <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>
20342 !!end
20344 !! test
20345 Image: from basic HTML (1)
20346 !! options
20347 parsoid=html2wt
20348 !! html/parsoid
20349 <span typeof="mw:Image">
20350   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20351 </span>
20352 !! wikitext
20353 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20354 !! end
20356 !! test
20357 Image: from basic HTML (2)
20358 !! options
20359 parsoid=html2wt
20360 !! html/parsoid
20361 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20362 !! wikitext
20363 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20364 !! end
20366 !! test
20367 Image: from basic HTML (3)
20368 !! options
20369 parsoid=html2wt
20370 !! html/parsoid
20371 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20372 !! wikitext
20373 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20374 !! end
20376 !! test
20377 Image: from basic HTML (4)
20378 !! options
20379 parsoid=html2wt
20380 !! html/parsoid
20381 <img src="File:Foobar.jpg">
20382 !! wikitext
20383 [[File:Foobar.jpg|link=]]
20384 !! end
20386 !! test
20387 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20388 !! options
20389 parsoid=html2wt
20390 !! wikitext
20391 * foo
20392 !! html
20393 <ul>
20394 <li><p>foo</p></li>
20395 </ul>
20396 !! end
20398 !! test
20399 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20400 !! options
20401 parsoid=html2wt
20402 !! wikitext
20403 * foo
20404 !! html
20405 <ul> <li>foo</li></ul>
20406 !! end
20408 !! test
20409 Don't strip leading whitespace when handling indent-pre suppressing tags
20410 !! options
20411 parsoid=html2wt
20412 !! wikitext
20414   | indented row
20416 <blockquote>
20417  '''This is very bold of you!'''
20421  indented cell (no pre-wrapping!)
20423 </blockquote>
20425  <div>bar</div>
20426 !! html
20427 <table>
20428   <tr><td> indented row</td></tr>
20429 </table>
20430 <blockquote><p>
20431  <b>This is very bold of you!</b>
20432 </p>
20433 <table><tr><td>
20434  indented cell (no pre-wrapping!)
20435 </td></tr></table>
20436 </blockquote>
20437 <p>foo</p>
20438  <div>bar</div>
20439 !! end
20441 !! test
20442 Strip leading whitespace when handling indent-pre inducing tags
20443 !! options
20444 parsoid=html2wt
20445 !! wikitext
20447 <span>bar</span>
20449 <span>foo2
20450 </span>bar2
20452 <div>foo</div>
20453 <span>bar</span>
20455 <div>
20456 <span>foo</span>
20457 </div>
20458 !! html
20459 <p>foo</p>
20460  <span>bar</span>
20462 <span>foo2
20463  </span>bar2
20465 <div>foo</div>
20466  <span>bar</span>
20468 <div>
20469  <span>foo</span>
20470 </div>
20471 !! end
20473 !! test
20474 Lists: Add space after bullets
20475 !! options
20476 parsoid=html2wt
20477 !! wikitext
20478 * foo
20479 * bar
20480 * <span> baz</span>
20481 !! html
20482 <ul>
20483 <li>foo</li>
20484 <li> bar</li>
20485 <li><span> baz</span></li>
20486 </ul>
20487 !! end
20489 !! test
20490 Lists: Dont insert newlines in a serialized list item.
20491 !! options
20492 parsoid=html2wt
20493 !! wikitext
20494 * a<br>b
20495 * c
20496 !! html
20497 <ul><li>a<br>b</li><li>c</li></ul>
20498 !! end
20500 !! test
20501 Headings: Add space before/after == (Bug 51744)
20502 !! options
20503 parsoid=html2wt
20504 !! wikitext
20505 == foo ==
20507 == bar ==
20509 == baz ==
20511 == <span> baz</span> ==
20512 !! html
20513 <h2>foo</h2>
20514 <h2> bar</h2>
20515 <h2>baz </h2>
20516 <h2><span> baz</span></h2>
20517 !! end
20519 !! test
20520 Parsoid: Serialize positional parameters with = in them as named parameter
20521 !! options
20522 parsoid=html2wt
20523 !! wikitext
20524 {{echo|1 = f=oo}}
20526 {{echo|1 = f=oo|2 = bar}}
20528 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20529 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20530 {{echo|<nowiki>f=oo</nowiki>|bar}}
20531 !! html
20532 <p about="#mwt1" typeof="mw:Transclusion"
20533 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20535 <p about="#mwt1" typeof="mw:Transclusion"
20536 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20538 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20539 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20540 <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>
20541 !! end
20543 !! test
20544 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20545 !! options
20546 parsoid=html2wt
20547 !! wikitext
20548 <div>a
20550 </div>
20551 <div>a
20553 </div>
20554 <div>
20558 </div>
20559 !! html
20560 <div>a<p>b</p></div>
20561 <div>a
20562 <p>b</p></div>
20563 <div>
20565 <p>b</p></div>
20566 !! end
20568 !! test
20569 Substrings resembling wikitext in hrefs should not get nowiki escapes
20570 !! options
20571 parsoid=html2wt
20572 !! wikitext
20573 [[Foo''bar''baz]]
20574 !! html
20575 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20576 !! end
20578 #-----------------------------
20579 # I/B quote minimization tests
20580 #-----------------------------
20582 !! test
20583 1. I/B quote minimization: wikitext-only tags should be combined
20584 !! options
20585 parsoid=html2wt
20586 !! wikitext
20587 ''AB''
20589 '''AB'''
20591 ''A'''B'''''
20593 '''A''B'''''
20595 '''A''BC''D'''
20597 '''''AB'''''
20599 '''''AB'''''
20601 '''''AB'''''
20602 !! html
20603 <p><i>A</i><i>B</i></p>
20604 <p><b>A</b><b>B</b></p>
20605 <p><i>A</i><b><i>B</i></b></p>
20606 <p><b>A</b><i><b>B</b></i></p>
20607 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20608 <p><i><b>A</b></i><i><b>B</b></i></p>
20609 <p><i><b>A</b></i><b><i>B</i></b></p>
20610 <p><b><i>A</i></b><i><b>B</b></i></p>
20611 !! end
20613 !! test
20614 2. I/B quote minimization: wikitext and html tags should not be combined
20615 !! options
20616 parsoid=html2wt
20617 !! wikitext
20618 ''A''<i>B</i>
20620 ''A'''''<i>B</i>'''
20621 !! html
20622 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20623 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20624 !! end
20626 !! test
20627 3. I/B quote minimization: templated content stops minimization
20628 !! options
20629 parsoid=html2wt
20630 !! wikitext
20631 ''A''{{echo|''B''}}
20633 ''A''{{echo|'''''B'''''}}
20634 !! html
20635 <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>
20636 <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>
20637 !! end
20639 !! test
20640 4. I/B quote minimization: new content should be mimimized with adjacent old content
20641 !! options
20642 parsoid=html2wt
20643 !! wikitext
20644 ''AB''
20646 '''AB'''
20648 ''A'''B'''''
20649 !! html
20650 <p><i>A</i><i data-parsoid='{}'>B</i></p>
20651 <p><b data-parsoid='{}'>A</b><b>B</b></p>
20652 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
20653 !! end
20655 #------------------------------------
20656 # End of I/B quote minimization tests
20657 #------------------------------------
20659 !!test
20660 Bug 54262: New entities
20661 !! options
20662 parsoid=html2wt
20663 !! wikitext
20664 &nbsp;
20665 !! html
20666 <span typeof="mw:Entity">&nbsp;</span>
20667 !! end
20669 ## Note that there is no wikitext output for 'unknownproperty' ##
20670 ## Unknown magic words are silently dropped ##
20672 !! test
20673 Magic words
20674 !! options
20675 parsoid=html2wt
20676 !! wikitext
20677 __TOC__
20678 __NOTOC__
20679 __FORCETOC__
20680 __INDEX__
20681 __NOINDEX__
20682 __NOGALLERY__
20683 __NOEDITSECTION__
20684 __NOTITLECONVERT__
20685 __NOCONTENTCONVERT__
20686 !! html
20687 <meta property='mw:PageProp/toc' />
20688 <meta property='mw:PageProp/notoc' />
20689 <meta property='mw:PageProp/forcetoc' />
20690 <meta property='mw:PageProp/index' />
20691 <meta property='mw:PageProp/noindex' />
20692 <meta property='mw:PageProp/nogallery' />
20693 <meta property='mw:PageProp/noeditsection' />
20694 <meta property='mw:PageProp/notitleconvert' />
20695 <meta property='mw:PageProp/nocontentconvert' />
20696 <meta property='mw:PageProp/unknownproperty' />
20697 !! end
20699 !! test
20700 Consecutive <pre>s should not get merged
20701 !! options
20702 parsoid=html2wt,html2html
20703 !! wikitext
20717 !! html
20718 <pre>a</pre><pre>b</pre>
20720 <pre>c
20721 </pre><pre>
20722 d</pre>
20724 <pre>e
20726 </pre><pre>
20728 f</pre>
20729 !! end
20731 !! test
20732 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
20733 !! options
20734 parsoid=html2wt
20735 !! wikitext
20736 [[Special:BookSources/1234567890|ISBN 1234567895]]
20737 !! html
20738 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
20739 !! end
20741 !! test
20742 Edited RFC links not serializable as RFC links should serialize as extlinks
20743 !! options
20744 parsoid=html2wt
20745 !! wikitext
20746 [//tools.ietf.org/html/rfc123 New RFC]
20747 !! html
20748 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
20749 !! end
20751 !! test
20752 Edited PMID links not serializable as PMID links should serialize as extlinks
20753 !! options
20754 parsoid=html2wt
20755 !! wikitext
20756 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
20757 !! html
20758 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
20759 !! end
20761 !! test
20762 Edited Redirect link should emit a non-piped wikitext link
20763 !! options
20764 parsoid=html2wt
20765 !! wikitext
20766 #REDIRECT [[Bar]]
20767 !! html
20768 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
20769 !! end
20771 # -----------------------------------------------------------------
20772 # End of section for Parsoid-only html2wt tests for serialization
20773 # of new content
20774 # -----------------------------------------------------------------
20776 TODO:
20777 more images
20778 more tables
20779 character entities
20780 and much more
20781 Try for 100% code coverage