Remove old maintenance script importTextFile.php
[mediawiki.git] / tests / parser / parserTests.txt
blob4a3889d10b5e6e0aa95a6f99ed25986f35b43d8f
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:echo
92 !! text
93 {{{1}}}
94 !! endarticle
96 !! article
97 Template:echo_with_span
98 !! text
99 <span>{{{1}}}</span>
100 !! endarticle
102 !! article
103 Template:echo_with_div
104 !! text
105 <div>{{{1}}}</div>
106 !! endarticle
108 !! article
109 Template:attr_str
110 !! text
111 {{{1}}}="{{{2}}}"
112 !! endarticle
114 !! article
115 Template:table_attribs
116 !! text
117 <noinclude>
118 |</noinclude>style="color: red"| Foo
119 !! endarticle
121 !! article
122 Template:table_cells
123 !! text
124 {{table_attribs}} || Bar || Baz
125 !! endarticle
127 !! article
128 Template:image_attribs
129 !! text
130 <noinclude>
131 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
132 !! endarticle
134 !! article
136 !! text
137 Weirdo titles!
138 !! endarticle
140 !!article
141 Template:Bullet
142 !!text
143 * Bar
144 !!endarticle
146 !!article
147 Template:OpenTable
148 !!text
150 !!endarticle
153 ### Basic tests
155 !! test
156 Blank input
157 !! wikitext
158 !! html
159 !! end
162 !! test
163 Simple paragraph
164 !! wikitext
165 This is a simple paragraph.
166 !! html
167 <p>This is a simple paragraph.
168 </p>
169 !! end
171 !! test
172 Paragraphs with extra newline spacing
173 !! wikitext
183 booz
184 !! html
185 <p>foo
186 </p><p>bar
187 </p><p><br />
189 </p><p><br />
190 </p><p>booz
191 </p>
192 !! end
194 !! test
195 Paragraphs with newline spacing with comment lines in between
196 !! wikitext
197 ----
199 <!--foo-->
201 ----
203 <!--foo--><!--More than 1 comment, still stripped-->
205 ----
207  <!--foo--> <!----> <!-- bar --> 
209 ----
211 <!--foo-->
214 ----
217 <!--foo-->
219 ----
221 <!--foo-->
225 ----
229 <!--foo-->
231 ----
232 !! html
233 <hr />
234 <p>a
236 </p>
237 <hr />
238 <p>a
240 </p>
241 <hr />
242 <p>a
244 </p>
245 <hr />
246 <p>a
247 </p><p>b
248 </p>
249 <hr />
250 <p>a
251 </p><p>b
252 </p>
253 <hr />
254 <p>a
255 </p><p><br />
257 </p>
258 <hr />
259 <p>a
260 </p><p><br />
262 </p>
263 <hr />
265 !! end
267 !! test
268 Paragraphs with newline spacing with non-empty white-space lines in between
269 !! wikitext
270 ----
274 ----
279 ----
280 !! html
281 <hr />
282 <p>a
283 </p><p>b
284 </p>
285 <hr />
286 <p>a
287 </p><p><br /> 
289 </p>
290 <hr />
292 !! end
294 !! test
295 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
296 !! wikitext
297 ----
299  <!--foo-->
301 ----
303  <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
305 ----
308 <!--foo-->
309  <!--bar-->
311 ----
314  <!--foo-->
315  <!--bar-->
318 ----
319 !! html
320 <hr />
321 <p>a
323 </p>
324 <hr />
325 <p>a
327 </p>
328 <hr />
329 <p>a
330 </p><p>b
331 </p>
332 <hr />
333 <p>a
334 </p><p><br /> 
336 </p>
337 <hr />
339 !! end
341 !! test
342 Extra newlines: More paragraphs with indented comment
343 !! wikitext
346    <!--boo-->
349 !! html
350 <p>a
351 </p><p><br />
353 </p>
354 !!end
356 !! test
357 Extra newlines followed by heading
358 !! wikitext
364 [[a]]
368 !! html
369 <p>a
370 </p><p><br />
371 </p>
372 <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>
373 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
374 </p><p><br />
375 </p>
376 <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>
378 !! end
380 !! test
381 Extra newlines between heading and content are swallowed
382 !! wikitext
387 [[a]]
388 !! html
389 <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>
390 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
391 </p>
392 !! end
394 !! test
395 Parsing an URL
396 !! wikitext
397 http://fr.wikipedia.org/wiki/🍺
398 <!-- EasterEgg we love beer, better be able be able to link to it -->
399 !! html
400 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
401 </p>
402 !! end
404 !! test
405 Simple list
406 !! wikitext
407 * Item 1
408 * Item 2
409 !! html
410 <ul><li> Item 1</li>
411 <li> Item 2</li></ul>
413 !! end
415 !! test
416 Italics and bold
417 !! wikitext
418 * plain
419 * plain''italic''plain
420 * plain''italic''plain''italic''plain
421 * plain'''bold'''plain
422 * plain'''bold'''plain'''bold'''plain
423 * plain''italic''plain'''bold'''plain
424 * plain'''bold'''plain''italic''plain
425 * plain''italic'''bold-italic'''italic''plain
426 * plain'''bold''bold-italic''bold'''plain
427 * plain'''''bold-italic'''italic''plain
428 * plain'''''bold-italic''bold'''plain
429 * plain''italic'''bold-italic'''''plain
430 * plain'''bold''bold-italic'''''plain
431 * plain l'''italic''plain
432 * plain l''''bold''' plain
433 !! html
434 <ul><li> plain</li>
435 <li> plain<i>italic</i>plain</li>
436 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
437 <li> plain<b>bold</b>plain</li>
438 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
439 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
440 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
441 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
442 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
443 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
444 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
445 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
446 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
447 <li> plain l'<i>italic</i>plain</li>
448 <li> plain l'<b>bold</b> plain</li></ul>
450 !! end
452 # this example taken from the [[simple:Moon]] article (bug 47326)
453 !! test
454 Italics and possessives (1)
455 !! wikitext
456 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
457 !! html
458 <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
459 </p>
460 !! end
462 # this example taken from [[en:Flaming Pie]] (bug 49926)
463 !! test
464 Italics and possessives (2)
465 !! wikitext
466 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
467 !! html
468 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
469 </p>
470 !! end
472 # this example taken from [[en:Dictionary]] (bug 49926)
473 !! test
474 Italics and possessives (3)
475 !! wikitext
476 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''.
477 !! html
478 <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>.
479 </p>
480 !! end
484 ### 2-quote opening sequence tests
486 !! test
487 Italics and bold: 2-quote opening sequence: (2,2)
488 !! wikitext
489 ''foo''
490 !! html
491 <p><i>foo</i>
492 </p>
493 !!end
496 !! test
497 Italics and bold: 2-quote opening sequence: (2,3)
498 !! options
499 parsoid=wt2html
500 !! wikitext
501 ''foo'''
502 !! html/*
503 <p><i>foo'</i>
504 </p>
505 !!end
508 # same html as previous, but wikitext adjusted to match parsoid html2wt
509 !! test
510 Italics and bold: 2-quote opening sequence: (2,3) w/ nowiki
511 !! wikitext
512 ''<nowiki>foo'</nowiki>''
513 !! html
514 <p><i>foo'</i>
515 </p>
516 !! end
519 !! test
520 Italics and bold: 2-quote opening sequence: (2,4)
521 !! options
522 parsoid=wt2html
523 !! wikitext
524 ''foo''''
525 !! html/*
526 <p><i>foo''</i>
527 </p>
528 !!end
531 # same html as previous, but wikitext adjusted to match parsoid html2wt
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
534 !! wikitext
535 ''<nowiki>foo''</nowiki>''
536 !! html
537 <p><i>foo''</i>
538 </p>
539 !! end
542 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
543 !! test
544 Italics and bold: 2-quote opening sequence: (2,5)
545 !! options
546 parsoid=wt2html
547 !! wikitext
548 ''foo'''''
549 !! html/php
550 <p><i>foo</i>
551 </p>
552 !! html/parsoid
553 <p><i>foo</i><b></b>
554 </p>
555 !!end
557 # same html as previous, but wikitext adjusted to match parsoid html2wt
558 !! test
559 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
560 !! wikitext
561 ''foo'''''<nowiki/>'''
562 !! html/php
563 <p><i>foo</i>
564 </p>
565 !! html/parsoid
566 <p><i>foo</i><b></b>
567 </p>
568 !! end
572 ### 3-quote opening sequence tests
575 !! test
576 Italics and bold: 3-quote opening sequence: (3,2)
577 !! wikitext
578 '''foo''
579 !! html
580 <p>'<i>foo</i>
581 </p>
582 !!end
585 !! test
586 Italics and bold: 3-quote opening sequence: (3,3)
587 !! wikitext
588 '''foo'''
589 !! html
590 <p><b>foo</b>
591 </p>
592 !!end
595 !! test
596 Italics and bold: 3-quote opening sequence: (3,4)
597 !! options
598 parsoid=wt2html
599 !! wikitext
600 '''foo''''
601 !! html/*
602 <p><b>foo'</b>
603 </p>
604 !!end
607 # same html as previous, but wikitext adjusted to match parsoid html2wt
608 !! test
609 Italics and bold: 3-quote opening sequence: (3,4) w/ nowiki
610 !! wikitext
611 '''<nowiki>foo'</nowiki>'''
612 !! html
613 <p><b>foo'</b>
614 </p>
615 !! end
618 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
619 !! test
620 Italics and bold: 3-quote opening sequence: (3,5)
621 !! options
622 parsoid=wt2html
623 !! wikitext
624 '''foo'''''
625 !! html/php
626 <p><b>foo</b>
627 </p>
628 !! html/parsoid
629 <p><b>foo</b><i></i>
630 </p>
631 !!end
633 # same html as previous, but wikitext adjusted to match parsoid html2wt
634 !! test
635 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
636 !! wikitext
637 '''foo'''''<nowiki/>''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !! end
648 ### 4-quote opening sequence tests
651 !! test
652 Italics and bold: 4-quote opening sequence: (4,2)
653 !! options
654 parsoid=wt2html
655 !! wikitext
656 ''''foo''
657 !! html/*
658 <p>''<i>foo</i>
659 </p>
660 !!end
663 # same html as previous, but wikitext adjusted to match parsoid html2wt
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
666 !! wikitext
667 <nowiki>''</nowiki>''foo''
668 !! html
669 <p>''<i>foo</i>
670 </p>
671 !! end
674 !! test
675 Italics and bold: 4-quote opening sequence: (4,3)
676 !! wikitext
677 ''''foo'''
678 !! html
679 <p>'<b>foo</b>
680 </p>
681 !!end
684 !! test
685 Italics and bold: 4-quote opening sequence: (4,4)
686 !! options
687 parsoid=wt2html
688 !! wikitext
689 ''''foo''''
690 !! html/*
691 <p>'<b>foo'</b>
692 </p>
693 !!end
696 # same html as previous, but wikitext adjusted to match parsoid html2wt
697 !! test
698 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
699 !! wikitext
700 ''''<nowiki>foo'</nowiki>'''
701 !! html
702 <p>'<b>foo'</b>
703 </p>
704 !! end
707 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
708 !! test
709 Italics and bold: 4-quote opening sequence: (4,5)
710 !! options
711 parsoid=wt2html
712 !! wikitext
713 ''''foo'''''
714 !! html/php
715 <p>'<b>foo</b>
716 </p>
717 !! html/parsoid
718 <p>'<b>foo</b><i></i>
719 </p>
720 !!end
722 # same html as previous, but wikitext adjusted to match parsoid html2wt
723 !! test
724 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
725 !! wikitext
726 ''''foo'''''<nowiki/>''
727 !! html/php
728 <p>'<b>foo</b>
729 </p>
730 !! html/parsoid
731 <p>'<b>foo</b><i></i>
732 </p>
733 !! end
737 ### 5-quote opening sequence tests
740 !! test
741 Italics and bold: 5-quote opening sequence: (5,2)
742 !! options
743 parsoid=wt2html
744 !! wikitext
745 '''''foo''
746 !! html/*
747 <p><b><i>foo</i></b>
748 </p>
749 !!end
752 # same html as previous, but wikitext adjusted to match parsoid html2wt
753 # skipping wt2html and html2html because it wants to put <i> before <b>
754 !! test
755 Italics and bold: 5-quote opening sequence: (5,2+3)
756 !! options
757 parsoid=wt2wt,html2wt
758 !! wikitext
759 '''''foo'''''
760 !! html/*
761 <p><b><i>foo</i></b>
762 </p>
763 !! end
765 !! test
766 Italics and bold: 5-quote opening sequence: (5,3)
767 !! options
768 parsoid=wt2html
769 !! wikitext
770 '''''foo'''
771 !! html/*
772 <p><i><b>foo</b></i>
773 </p>
774 !!end
777 # same html as previous, but wikitext adjusted to match parsoid html2wt
778 !! test
779 Italics and bold: 5-quote opening sequence: (5,3+2)
780 !! wikitext
781 '''''foo'''''
782 !! html
783 <p><i><b>foo</b></i>
784 </p>
785 !! end
788 !! test
789 Italics and bold: 5-quote opening sequence: (5,4)
790 !! options
791 parsoid=wt2html
792 !! wikitext
793 '''''foo''''
794 !! html/*
795 <p><i><b>foo'</b></i>
796 </p>
797 !!end
800 # same html as previous, but wikitext adjusted to match parsoid html2wt
801 !! test
802 Italics and bold: 5-quote opening sequence: (5,4+2) w/ nowiki
803 !! wikitext
804 '''''<nowiki>foo'</nowiki>'''''
805 !! html
806 <p><i><b>foo'</b></i>
807 </p>
808 !! end
811 !! test
812 Italics and bold: 5-quote opening sequence: (5,5)
813 !! wikitext
814 '''''foo'''''
815 !! html
816 <p><i><b>foo</b></i>
817 </p>
818 !!end
821 ### multiple quote sequences in a line
823 !! test
824 Italics and bold: multiple quote sequences: (2,4,2)
825 !! options
826 parsoid=wt2html
827 !! wikitext
828 ''foo''''bar''
829 !! html/*
830 <p><i>foo'<b>bar</b></i>
831 </p>
832 !!end
835 # same html as previous, but wikitext adjusted to match parsoid html2wt
836 !! test
837 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
838 !! wikitext
839 ''<nowiki>foo'</nowiki>'''bar'''''
840 !! html
841 <p><i>foo'<b>bar</b></i>
842 </p>
843 !! end
846 !! test
847 Italics and bold: multiple quote sequences: (2,4,3)
848 !! options
849 parsoid=wt2html
850 !! wikitext
851 ''foo''''bar'''
852 !! html/*
853 <p><i>foo'<b>bar</b></i>
854 </p>
855 !!end
858 # same html as previous, but wikitext adjusted to match parsoid html2wt
859 !! test
860 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
861 !! wikitext
862 ''<nowiki>foo'</nowiki>'''bar'''''
863 !! html
864 <p><i>foo'<b>bar</b></i>
865 </p>
866 !! end
869 !! test
870 Italics and bold: multiple quote sequences: (2,4,4)
871 !! options
872 parsoid=wt2html
873 !! wikitext
874 ''foo''''bar''''
875 !! html/*
876 <p><i>foo'<b>bar'</b></i>
877 </p>
878 !!end
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
884 !! wikitext
885 ''<nowiki>foo'</nowiki>'''<nowiki>bar'</nowiki>'''''
886 !! html
887 <p><i>foo'<b>bar'</b></i>
888 </p>
889 !! end
892 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
893 !! test
894 Italics and bold: multiple quote sequences: (3,4,2)
895 !! options
896 parsoid=wt2html
897 !! wikitext
898 '''foo''''bar''
899 !! html/php
900 <p><b>foo'</b>bar
901 </p>
902 !! html/parsoid
903 <p><b>foo'</b>bar<i></i>
904 </p>
905 !!end
907 # same html as previous, but wikitext adjusted to match parsoid html2wt
908 !! test
909 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
910 !! options
911 parsoid
912 !! wikitext
913 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
914 !! html/php
915 <p><b>foo'</b>bar
916 </p>
917 !! html/parsoid
918 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
919 </p>
920 !! end
923 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
924 !! test
925 Italics and bold: multiple quote sequences: (3,4,3)
926 !! options
927 parsoid=wt2html
928 !! wikitext
929 '''foo''''bar'''
930 !! html/php
931 <p><b>foo'</b>bar
932 </p>
933 !! html/parsoid
934 <p><b>foo'</b>bar<b></b>
935 </p>
936 !!end
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
941 !! wikitext
942 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
943 !! html/php
944 <p><b>foo'</b>bar
945 </p>
946 !! html/parsoid
947 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
948 </p>
949 !! end
952 ### other quote tests
954 !! test
955 Italics and bold: other quote tests: (2,3,5)
956 !! wikitext
957 ''this is about '''foo's family'''''
958 !! html
959 <p><i>this is about <b>foo's family</b></i>
960 </p>
961 !!end
964 !! test
965 Italics and bold: other quote tests: (2,(3,3),2)
966 !! wikitext
967 ''this is about '''foo's''' family''
968 !! html
969 <p><i>this is about <b>foo's</b> family</i>
970 </p>
971 !!end
974 !! test
975 Italics and bold: other quote tests: (3,2,3,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''this is about ''foo'''s family''
980 !! html/*
981 <p><b>this is about <i>foo</i></b><i>s family</i>
982 </p>
983 !!end
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 # add 'parsoid' option to use 'parsoid' normalization of the placeholder
988 !! test
989 Italics and bold: other quote tests: (3,2,3+2+2,2)
990 !! options
991 parsoid
992 !! wikitext
993 '''this is about ''foo'''''<nowiki/>''s family''
994 !! html/*
995 <p><b>this is about <i>foo</i></b><i>s family</i>
996 </p>
997 !! end
1000 !! test
1001 Italics and bold: other quote tests: (3,2,3,3)
1002 !! options
1003 !! wikitext
1004 '''this is about ''foo'''s family'''
1005 !! html
1006 <p>'<i>this is about </i>foo<b>s family</b>
1007 </p>
1008 !!end
1011 !! test
1012 Italics and bold: other quote tests: (3,(2,2),3)
1013 !! wikitext
1014 '''this is about ''foo's'' family'''
1015 !! html
1016 <p><b>this is about <i>foo's</i> family</b>
1017 </p>
1018 !!end
1021 !! test
1022 Italicized possessive
1023 !! wikitext
1024 The ''[[Main Page]]'''s talk page.
1025 !! html
1026 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1027 </p>
1028 !! end
1030 !! test
1031 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1032 (Requires tidy for PHP parser output to be fixed up)
1033 !! options
1034 parsoid=wt2html,wt2wt
1035 !! wikitext
1037 !''a!!''b
1038 |''a||''b
1040 !! html
1041 <table>
1042 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1043 <td><i>a</i></td><td><i>b</i></td></tr>
1044 </tbody></table>
1045 !! end
1048 ### Non-html5 tags
1051 !! test
1052 Non-html5 tags should be accepted
1053 !! wikitext
1054 <center>''foo''</center>
1055 <big>''foo''</big>
1056 <font>''foo''</font>
1057 <strike>''foo''</strike>
1058 <tt>''foo''</tt>
1059 !! html
1060 <center><i>foo</i></center>
1061 <p><big><i>foo</i></big>
1062 <font><i>foo</i></font>
1063 <strike><i>foo</i></strike>
1064 <tt><i>foo</i></tt>
1065 </p>
1066 !! end
1068 !! test
1069 <wbr> is valid wikitext (bug 52468)
1070 !! wikitext
1071 <wbr>
1072 !! html
1073 <p><wbr />
1074 </p>
1075 !! end
1077 # <strike> is HTML4, <s> is HTML4/5.
1078 !! test
1079 <s> or <strike> for strikethrough
1080 !! wikitext
1081 <strike>strike</strike>
1083 <s>s</s>
1084 !! html
1085 <p><strike>strike</strike>
1086 </p><p><s>s</s>
1087 </p>
1088 !! end
1090 ## a not permitted
1091 ## i,b,br omitted
1092 !! test
1093 Text-level semantic html elements in wikitext
1094 !! wikitext
1095 <em>text</em>
1096 <strong>text</strong>
1097 <small>text</small>
1098 <s>text</s>
1099 <cite>text</cite>
1100 <q>text</q>
1101 <dfn>text</dfn>
1102 <abbr>text</abbr>
1103 <data>text</data>
1104 <time>text</time>
1105 <code>text</code>
1106 <var>text</var>
1107 <samp>text</samp>
1108 <kbd>text</kbd>
1109 <sub>text</sub>
1110 <u>text</u>
1111 <mark>text</mark>
1112 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1113 <bdi>text</bdi>
1114 <bdo>text</bdo>
1115 <span>text</span>
1116 <wbr />
1117 !! html
1118 <p><em>text</em>
1119 <strong>text</strong>
1120 <small>text</small>
1121 <s>text</s>
1122 <cite>text</cite>
1123 <q>text</q>
1124 <dfn>text</dfn>
1125 <abbr>text</abbr>
1126 <data>text</data>
1127 <time>text</time>
1128 <code>text</code>
1129 <var>text</var>
1130 <samp>text</samp>
1131 <kbd>text</kbd>
1132 <sub>text</sub>
1133 <u>text</u>
1134 <mark>text</mark>
1135 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1136 <bdi>text</bdi>
1137 <bdo>text</bdo>
1138 <span>text</span>
1139 <wbr />
1140 </p>
1141 !! end
1143 # test cases taken from
1144 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1145 !! test
1146 Ruby markup (W3C-style)
1147 !! wikitext
1148 ; Mono-ruby for individual base characters
1149 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1150 ; Group ruby
1151 : <ruby>今日<rt>きょう</rt></ruby>
1152 ; Jukugo ruby
1153 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1154 ; Inline ruby
1155 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1156 ; Double-sided ruby
1157 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1158 <ruby>
1159 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1160 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1161 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1162 </ruby>
1163 !! html
1164 <dl><dt> Mono-ruby for individual base characters</dt>
1165 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1166 <dt> Group ruby</dt>
1167 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1168 <dt> Jukugo ruby</dt>
1169 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1170 <dt> Inline ruby</dt>
1171 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1172 <dt> Double-sided ruby</dt>
1173 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1174 <p><ruby>
1175 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1176 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1177 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1178 </ruby>
1179 </p>
1180 !! end
1182 !! test
1183 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1184 !! wikitext
1185 <b→> doesn't work! </b→>
1187 <bä> doesn't work! </bä>
1189 <boo> works fine </boo>
1191 <s.foo>s.foo</s.foo>
1193 <sub-ID#1>
1194 !! html
1195 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1196 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1197 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1198 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1199 </p><p>&lt;sub-ID#1&gt;
1200 </p>
1201 !! end
1203 !! test
1204 Isolated close tags should be treated as literal text (bug 52760)
1205 !! wikitext
1206 </b>
1208 <s.foo>s</s>
1209 !! html
1210 <p>&lt;/b&gt;
1211 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1212 </p>
1213 !! end
1216 ### Special characters
1219 !! test
1220 Bare pipe character (bug 52363)
1221 !! wikitext
1223 !! html
1224 <p>|
1225 </p>
1226 !! end
1228 !! test
1229 Bare pipe character from a template (bug 52363)
1230 !! wikitext
1231 {{pipe}}
1232 !! html
1233 <p>|
1234 </p>
1235 !! end
1238 ### <nowiki> test cases
1241 !! test
1242 <nowiki> unordered list
1243 !! wikitext
1244 <nowiki>* This is not an unordered list item.</nowiki>
1245 !! html
1246 <p>* This is not an unordered list item.
1247 </p>
1248 !! end
1250 !! test
1251 <nowiki> spacing
1252 !! wikitext
1253 <nowiki>Lorem ipsum dolor
1255 sed abit.
1256   sed nullum.
1258 :and a colon
1259 </nowiki>
1260 !! html
1261 <p>Lorem ipsum dolor
1263 sed abit.
1264   sed nullum.
1266 :and a colon
1268 </p>
1269 !! end
1271 !! test
1272 nowiki 3
1273 !! wikitext
1274 :There is not nowiki.
1275 :There is <nowiki>nowiki</nowiki>.
1277 #There is not nowiki.
1278 #There is <nowiki>nowiki</nowiki>.
1280 *There is not nowiki.
1281 *There is <nowiki>nowiki</nowiki>.
1282 !! html
1283 <dl><dd>There is not nowiki.</dd>
1284 <dd>There is nowiki.</dd></dl>
1285 <ol><li>There is not nowiki.</li>
1286 <li>There is nowiki.</li></ol>
1287 <ul><li>There is not nowiki.</li>
1288 <li>There is nowiki.</li></ul>
1290 !! end
1292 !! test
1293 Entities inside <nowiki>
1294 !! wikitext
1295 <nowiki>&lt;</nowiki>
1296 !! html
1297 <p>&lt;
1298 </p>
1299 !! end
1301 !! test
1302 Entities inside template parameters
1303 !! options
1304 parsoid
1305 !! wikitext
1306 {{echo|&ndash;}}
1307 !! html
1308 <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>
1309 </p>
1310 !! end
1312 !! test
1313 Properly escape nowiki when combined with other wiki markup
1314 !! options
1315 parsoid=html2wt
1316 !! wikitext
1317 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1318 !! html
1319 <p>* &lt;/nowiki&gt; tag</p>
1320 !! end
1323 ### Comments
1325 !! test
1326 Comments and Indent-Pre
1327 !! wikitext
1328 <!-- comment 1 --> asdf
1330 <!-- comment 1 --> asdf
1331 <!-- comment 2 -->
1333 <!-- comment 1 --> asdf
1334 <!-- comment 2 -->xyz
1336 <!-- comment 1 --> asdf
1337 <!-- comment 2 --> xyz
1338 !! html
1339 <pre>asdf
1340 </pre>
1341 <pre>asdf
1342 </pre>
1343 <pre>asdf
1344 </pre>
1345 <p>xyz
1346 </p>
1347 <pre>asdf
1349 </pre>
1350 !! end
1352 !! test
1353 Comment test 2a
1354 !! wikitext
1355 asdf
1356 <!-- comment 1 -->
1358 !! html
1359 <p>asdf
1361 </p>
1362 !! end
1364 !! test
1365 Comment test 2b
1366 !! wikitext
1367 asdf
1368 <!-- comment 1 -->
1371 !! html
1372 <p>asdf
1373 </p><p>jkl
1374 </p>
1375 !! end
1377 !! test
1378 Comment test 3
1379 !! wikitext
1380 asdf
1381 <!-- comment 1 -->
1382 <!-- comment 2 -->
1384 !! html
1385 <p>asdf
1387 </p>
1388 !! end
1390 !! test
1391 Comment test 4
1392 !! wikitext
1393 asdf<!-- comment 1 -->jkl
1394 !! html
1395 <p>asdfjkl
1396 </p>
1397 !! end
1399 !! test
1400 Comment spacing
1401 !! wikitext
1403  <!-- foo --> b <!-- bar -->
1405 !! html
1406 <p>a
1407 </p>
1408 <pre> b 
1409 </pre>
1410 <p>c
1411 </p>
1412 !! end
1414 !! test
1415 Comment whitespace
1416 !! wikitext
1417 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1418 !! html
1420 !! end
1422 !! test
1423 Comment semantics and delimiters
1424 !! wikitext
1425 <!-- --><!----><!-----><!------>
1426 !! html
1428 !! end
1430 !! test
1431 Comment semantics and delimiters, redux
1432 !! wikitext
1433 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1434 -- foo -- funky huh? ... -->
1435 !! html
1437 !! end
1439 !! test
1440 Comment semantics and delimiters: directors cut
1441 !! wikitext
1442 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1443 everything starting with < followed by !-- until the first -- and > we see,
1444 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1445 -->-->
1446 !! html
1447 <p>--&gt;
1448 </p>
1449 !! end
1451 !! test
1452 Comment semantics: nesting
1453 !! wikitext
1454 <!--<!-- no, we're not going to do anything fancy here -->-->
1455 !! html
1456 <p>--&gt;
1457 </p>
1458 !! end
1460 !! test
1461 Comment semantics: unclosed comment at end
1462 !! wikitext
1463 <!--This comment will run out to the end of the document
1464 !! html
1466 !! end
1468 !! test
1469 Comment in template title
1470 !! wikitext
1471 {{f<!---->oo}}
1472 !! html
1473 <p>FOO
1474 </p>
1475 !! end
1477 !! test
1478 Comment on its own line post-expand
1479 !! wikitext
1481 {{blank}}<!---->
1483 !! html
1484 <p>a
1485 </p><p>b
1486 </p>
1487 !! end
1489 !! test
1490 Comment on its own line post-expand with non-significant whitespace
1491 !! wikitext
1493  {{blank}} <!----> 
1495 !! html
1496 <p>a
1497 </p><p>b
1498 </p>
1499 !! end
1501 !! test
1502 Multiple comments should still parse as SOL-transparent
1503 !! options
1504 parsoid=wt2html,wt2wt
1505 !! wikitext
1506 <!--c1-->*a
1507 <!--c2--><!--c3--><!--c4-->*b
1508 !! html
1509 <ul>
1510 <li>a
1511 </li>
1512 <li>b
1513 </li>
1514 </ul>
1515 !! end
1518 ### paragraph wrapping tests
1520 !! test
1521 No block tags
1522 !! wikitext
1526 !! html
1527 <p>a
1528 </p><p>b
1529 </p>
1530 !! end
1532 !! test
1533 Block tag on one line (<div>)
1534 !! wikitext
1535 a <div>foo</div>
1538 !! html
1539 a <div>foo</div>
1540 <p>b
1541 </p>
1542 !! end
1544 !! test
1545 Block tag on one line (<blockquote>)
1546 !! wikitext
1547 a <blockquote>foo</blockquote>
1550 !! html
1551 a <blockquote>foo</blockquote>
1552 <p>b
1553 </p>
1554 !! end
1556 !! test
1557 Block tag on both lines (<div>)
1558 !! wikitext
1559 a <div>foo</div>
1561 b <div>foo</div>
1562 !! html
1563 a <div>foo</div>
1564 b <div>foo</div>
1566 !! end
1568 !! test
1569 Block tag on both lines (<blockquote>)
1570 !! wikitext
1571 a <blockquote>foo</blockquote>
1573 b <blockquote>foo</blockquote>
1574 !! html
1575 a <blockquote>foo</blockquote>
1576 b <blockquote>foo</blockquote>
1578 !! end
1580 !! test
1581 Multiple lines without block tags
1582 !! wikitext
1583 <div>foo</div> a
1586 d<!--foo--> e
1587 x <div>foo</div> z
1588 !! html
1589 <div>foo</div> a
1590 <p>b
1592 d e
1593 </p>
1594 x <div>foo</div> z
1596 !! end
1598 !! test
1599 Empty lines between lines with block tags
1600 !! wikitext
1601 <div></div>
1604 <div></div>a
1607 <div>a</div>b
1609 <div>b</div>d
1612 <div>e</div>
1613 !! html
1614 <div></div>
1615 <p><br />
1616 </p>
1617 <div></div>a
1618 <p>b
1619 </p>
1620 <div>a</div>b
1621 <div>b</div>d
1622 <p><br />
1623 </p>
1624 <div>e</div>
1626 !! end
1628 ## PHP parser emits output which is broken
1629 !! test
1630 Unclosed HTML p-tags should be handled properly
1631 !! wikitext
1632 <div><p>foo</div>
1636 !! html/parsoid
1637 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1638 <p>a</p>
1639 <p>b</p>
1640 !! end
1643 ### Preformatted text
1645 !! test
1646 Preformatted text
1647 !! wikitext
1648  This is some
1649  Preformatted text
1650  With ''italic''
1651  And '''bold'''
1652  And a [[Main Page|link]]
1653 !! html
1654 <pre>This is some
1655 Preformatted text
1656 With <i>italic</i>
1657 And <b>bold</b>
1658 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1659 </pre>
1660 !! end
1662 !! test
1663 Tabs don't trigger preformatted text
1664 !! wikitext
1665         This is not
1666          preformatted text.
1667  This is preformatted text.
1668         So is this.
1669 !! html
1670 <p>     This is not
1671          preformatted text.
1672 </p>
1673 <pre>This is preformatted text.
1674         So is this.
1675 </pre>
1676 !! end
1678 !! test
1679 Ident preformatting with inline content
1680 !! wikitext
1682  ''b''
1683 !! html
1684 <pre>a
1685 <i>b</i>
1686 </pre>
1687 !! end
1689 !! test
1690 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1691 !! wikitext
1692 <pre><nowiki>
1694 <cite>
1695 <em>
1696 </nowiki></pre>
1697 !! html
1698 <pre>
1699 &lt;b&gt;
1700 &lt;cite&gt;
1701 &lt;em&gt;
1702 </pre>
1704 !! end
1706 !! test
1707 Regression with preformatted in <center>
1708 !! wikitext
1709 <center>
1710  Blah
1711 </center>
1712 !! html
1713 <center>
1714 <pre>Blah
1715 </pre>
1716 </center>
1718 !! end
1720 !! test
1721 Bug 52763: Preformatted in <blockquote>
1722 !! wikitext
1723 <blockquote>
1724  Blah
1727  indented cell (no pre-wrapping!)
1729 </blockquote>
1730 !! html
1731 <blockquote>
1732 <p> Blah
1733 </p>
1734 <table>
1735 <tr>
1736 <td>
1737 <p> indented cell (no pre-wrapping!)
1738 </p>
1739 </td></tr></table>
1740 </blockquote>
1742 !! end
1744 !! test
1745 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1746 !! wikitext
1747 <blockquote>
1751 </blockquote>
1752 !! html
1753 <blockquote>
1754 <p>Foo
1755 </p><p>Bar
1756 </p>
1757 </blockquote>
1759 !! end
1761 !! test
1762 Bug 15491: <ins>/<del> in blockquote
1763 !! wikitext
1764 <blockquote>
1765 Foo <del>bar</del> <ins>baz</ins> quux
1766 </blockquote>
1767 !! html
1768 <blockquote>
1769 <p>Foo <del>bar</del> <ins>baz</ins> quux
1770 </p>
1771 </blockquote>
1773 !! end
1775 # Note that the p-wrapping is newline sensitive, which could be
1776 # considered a bug: tidy will wrap only the 'Foo' in the example
1777 # below in a <p> tag. (see comment 23-25 of bug #6200)
1778 !! test
1779 Bug 15491: <ins>/<del> in blockquote (2)
1780 !! wikitext
1781 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1782 </blockquote>
1783 !! html
1784 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1785 </blockquote>
1787 !! end
1789 !! test
1790 <pre> with attributes (bug 3202)
1791 !! wikitext
1792 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1793 !! html
1794 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1796 !! end
1798 !! test
1799 <pre> with width attribute (bug 3202)
1800 !! wikitext
1801 <pre width="8">Narrow screen goodies</pre>
1802 !! html
1803 <pre width="8">Narrow screen goodies</pre>
1805 !! end
1807 !! test
1808 <pre> with forbidden attribute (bug 3202)
1809 !! wikitext
1810 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1811 !! html
1812 <pre width="8">Narrow screen goodies</pre>
1814 !! end
1816 !! test
1817 Entities inside <pre>
1818 !! wikitext
1819 <pre>&lt;</pre>
1820 !! html
1821 <pre>&lt;</pre>
1823 !! end
1825 !! test
1826 <pre> with forbidden attribute values (bug 3202)
1827 !! wikitext
1828 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1829 !! html
1830 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1832 !! end
1834 !! test
1835 <nowiki> inside <pre> (bug 13238)
1836 !! wikitext
1837 <pre>
1838 <nowiki>
1839 </pre>
1840 <pre>
1841 <nowiki></nowiki>
1842 </pre>
1843 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1844 !! html
1845 <pre>
1846 &lt;nowiki&gt;
1847 </pre>
1848 <pre>
1850 </pre>
1851 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1853 !! end
1855 !! test
1856 <nowiki> and <pre> preference (first one wins)
1857 !! wikitext
1858 <pre>
1859 <nowiki>
1860 </pre>
1861 </nowiki>
1862 </pre>
1864 <nowiki>
1865 <pre>
1866 <nowiki>
1867 </pre>
1868 </nowiki>
1869 </pre>
1871 !! html
1872 <pre>
1873 &lt;nowiki&gt;
1874 </pre>
1875 <p>&lt;/nowiki&gt;
1876 &lt;/pre&gt;
1877 </p><p>
1878 &lt;pre&gt;
1879 &lt;nowiki&gt;
1880 &lt;/pre&gt;
1882 &lt;/pre&gt;
1883 </p>
1884 !! end
1886 !! test
1887 </pre> inside nowiki
1888 !! wikitext
1889 <nowiki></pre></nowiki>
1890 !! html
1891 <p>&lt;/pre&gt;
1892 </p>
1893 !! end
1895 !! test
1896 Empty pre; pre inside other HTML tags (bug 54946)
1897 !! wikitext
1900 <div><pre>
1902 </pre></div>
1903 <pre></pre>
1904 !! html
1905 <p>a
1906 </p>
1907 <div><pre>
1909 </pre></div>
1910 <pre></pre>
1912 !! end
1914 !! test
1915 HTML pre followed by indent-pre
1916 !! wikitext
1917 <pre>foo</pre>
1918  bar
1919 !! html
1920 <pre>foo</pre>
1921 <pre>bar
1922 </pre>
1923 !! end
1925 !!test
1926 Block tag pre
1927 !!options
1928 parsoid
1929 !! wikitext
1930 <p><pre>foo</pre></p>
1931 !! html
1932 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
1933 !!end
1935 !!test
1936 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1937 !! wikitext
1938  {{echo|}}
1939 !! html
1941 !!end
1943 !!test
1944 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1945 !! wikitext
1946  {{echo|
1947 foo}}
1948 !! html
1949 <p>foo
1950 </p>
1951 !!end
1953 !! test
1954 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1955 !! wikitext
1956  {{echo|a
1958 !! html
1959 <pre>a
1960 </pre>
1961 <p>b
1962 </p>
1963 !!end
1965 !! test
1966 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1967 !! wikitext
1968  {{echo|a
1974 !! html
1975 <pre>a
1976 </pre>
1977 <p>b
1979 </p>
1980 <pre>d
1981 </pre>
1982 <p>e
1983 </p>
1984 !!end
1986 !!test
1987 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1988 !! wikitext
1989 {{echo| foo}}
1991 {{echo| foo}}{{echo| bar}}
1993 {{echo| foo}}
1994 {{echo| bar}}
1996 {{echo|<!--cmt--> foo}}
1998 <!--cmt-->{{echo| foo}}
2000 {{echo|{{echo| }}bar}}
2001 !! html
2002 <pre>foo
2003 </pre>
2004 <pre>foo bar
2005 </pre>
2006 <pre>foo
2008 </pre>
2009 <pre>foo
2010 </pre>
2011 <pre>foo
2012 </pre>
2013 <pre>bar
2014 </pre>
2015 !!end
2017 !! test
2018 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2019 !! wikitext
2020 {{echo| }}a
2022 {{echo|
2023  }}a
2025 {{echo|
2026  b}}
2028 {{echo|a
2029  }}b
2031 {{echo|a
2032 }} b
2033 !! html
2034 <pre>a
2035 </pre>
2036 <p><br />
2037 </p>
2038 <pre>a
2039 </pre>
2040 <p><br />
2041 </p>
2042 <pre>b
2043 </pre>
2044 <p>a
2045 </p>
2046 <pre>b
2047 </pre>
2048 <p>a
2049 </p>
2050 <pre>b
2051 </pre>
2052 !!end
2054 !! test
2055 Things that look like <pre> tags aren't treated as such
2056 !! wikitext
2057 Barack Obama <President> of the United States
2058 <President></President>
2059 !! html
2060 <p>Barack Obama &lt;President&gt; of the United States
2061 &lt;President&gt;&lt;/President&gt;
2062 </p>
2063 !! end
2065 ## PHP parser discards the "<pre " string
2066 !! test
2067 Handle broken pre-like tags (bug 64025)
2068 !! options
2069 parsoid=wt2html
2070 !! wikitext
2071 {{echo|<pre <pre>x</pre>}}
2073 <table><pre </table>
2074 !! html/php
2075 <pre>x</pre>
2076 <table><pre></pre></table>
2078 !! html/parsoid
2079 <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>
2080 <pre>x</pre>
2082 <span>&lt;pre </span>
2083 <table></table>
2084 !! end
2086 !! test
2087 Parsoid: handle pre with space after attribute
2088 !! options
2089 parsoid=wt2html
2090 !! wikitext
2091 <pre style="width:50%;" >{{echo|foo}}</pre>
2092 !! html
2093 <pre style="width:50%;">{{echo|foo}}</pre>
2094 !! end
2096 # TODO / maybe: fix wt2wt for this
2097 !! test
2098 Parsoid: Don't paragraph-wrap fosterable content
2099 !! options
2100 parsoid=wt2html
2101 !! wikitext
2103 <td></td>
2104 <td></td>
2109 !! html
2110 <table>
2112 <tbody>
2113 <tr>
2114 <td></td>
2116 <td></td></tr>
2120 </tbody></table>
2121 !! end
2123 !! test
2124 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2125 !! options
2126 parsoid=wt2html
2127 !! wikitext
2129 <td>
2130 <td>
2131 </td>
2136 !! html
2137 <table>
2139 <tbody>
2140 <tr>
2141 <td></td>
2143 <td>
2144 </td></tr>
2148 </tbody></table>
2149 !! end
2152 #--------------------------------------------------------------------
2153 # Transclusion parameter whitespace stripping tests
2154 # Behavior is different for positional and named parameters
2155 #--------------------------------------------------------------------
2156 !! test
2157 Templates: Strip leading and trailing whitespace from named-param values
2158 !! wikitext
2159 {{echo|1= a }}
2161 {{echo|1= {{echo|b}} }}
2163 {{echo| 1 =
2164  c }}
2166 {{echo| 1 =
2167 * d
2169 !! html
2170 <p>a
2171 </p><p>b
2172 </p><p>c
2173 </p>
2174 <ul><li> d</li></ul>
2176 !! end
2178 !! test
2179 Templates: Don't strip whitespace from positional-param values
2180 !! wikitext
2181 {{echo|a }}
2183 {{echo|{{echo|b}} }}
2185 {{echo| c 
2188 {{echo| {{echo|d}}
2191 {{echo|
2192  e}}
2194 {{echo|
2195 * f}}
2197 {{echo|
2198  }}g
2199 !! html
2200 <p>a 
2201 </p><p>b 
2202 </p>
2203 <pre>c 
2204 </pre>
2205 <p><br />
2206 </p>
2207 <pre>d
2208 </pre>
2209 <p><br />
2210 </p>
2211 <pre>e
2212 </pre>
2213 <p><br />
2214 </p>
2215 <ul><li> f</li></ul>
2216 <p><br />
2217 </p>
2218 <pre>g
2219 </pre>
2220 !! end
2222 !! test
2223 Templates: Handle empty comment-and-ws-only lines correctly
2224 !! wikitext
2225 {{echo|foo
2226 <!--should be ignored-->
2227  <!--should be ignored as well-->
2228 bar}}
2229 !! html
2230 <p>foo
2232 </p>
2233 !! end
2235 !! test
2236 Templates: Handle comments in the target
2237 !! wikitext
2238 {{echo
2239 <!-- should be ignored -->
2240 |foo}}
2242 {{echo<!-- should be ignored -->
2243 |foo}}
2245 {{echo<!-- should be ignored -->|foo}}
2247 {{<!-- should be ignored -->echo|foo}}
2248 !!html/parsoid
2249 <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>
2251 <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>
2253 <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>
2255 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2256 !!end
2258 #--------------------------------------------------------------------
2259 # Transclusion parameter escaping tests
2260 #--------------------------------------------------------------------
2261 !! test
2262 Templates: Parsoid parameter escaping test 1
2263 !! options
2264 parsoid
2265 !! wikitext
2266 {{echo|[foo]|{{echo|[bar]}}}}
2267 !! html
2268 <p about="#mwt1" typeof="mw:Transclusion"
2269 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2270 !! end
2272 !! test
2273 Parsoid: Pipes in external links in template parameter
2274 !! options
2275 parsoid
2276 !! wikitext
2277 {{echo|[{{echo|http://example.com}} link]}}
2278 !! html
2279 <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>
2280 !! end
2282 !! test
2283 Parsoid: pipe in transclusion parameter
2284 !! options
2285 parsoid
2286 !! wikitext
2287 {{echo|http://foo.com/a&#124;b}}
2288 !! html
2289 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2290 typeof="mw:Transclusion"
2291 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>
2292 !! end
2294 !! test
2295 Parsoid: Pipe in external link target and content in template parameter
2296 !! options
2297 parsoid=html2wt,wt2wt
2298 !! wikitext
2299 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2300 !! html
2301 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2302 typeof="mw:Transclusion"
2303 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2304 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2305 !! end
2307 !! test
2308 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2309 !! options
2310 parsoid
2311 !! wikitext
2312 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2313 !! html
2314 <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>
2315 !! end
2317 !! test
2318 Templates: Don't escape already nowiki-escaped text in template parameters
2319 !! options
2320 parsoid=html2wt,wt2wt
2321 !! wikitext
2322 {{echo|foo<nowiki>|</nowiki>bar}}
2323 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2324 {{echo|<nowiki></nowiki>}}
2325 !! html
2326 <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>
2327 <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>
2328 <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>
2329 </p>
2330 !! end
2332 ## Bug 52824
2333 !! test
2334 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2335 !! options
2336 parsoid=html2wt,wt2wt
2337 !! wikitext
2338 {{echo|{{echo|1=bar}}}}
2339 !! html
2340 <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>
2341 !! end
2343 ## Bug 56733
2344 !! test
2345 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2346 !! options
2347 parsoid
2348 !! wikitext
2349 {{echo|a : b}}
2350 !! html
2351 <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>
2352 !! end
2355 ### Parsoid-centric tests for testing RT edge cases for pre
2358 !!test
2359 1a. Indent-Pre and Comments
2360 !! wikitext
2362 <!--a-->
2364 !! html
2365 <pre>a
2366 </pre>
2367 <p>c
2368 </p>
2369 !!end
2371 !!test
2372 1b. Indent-Pre and Comments
2373 !! wikitext
2375  <!--a-->
2377 !! html
2378 <pre>a
2379 </pre>
2380 <p>c
2381 </p>
2382 !!end
2384 !!test
2385 1c. Indent-Pre and Comments
2386 !! wikitext
2387 <!--a-->  a
2389  <!--a--> a
2390 !! html
2391 <pre> a
2392 </pre>
2393 <pre> a
2394 </pre>
2395 !!end
2397 !!test
2398 1d. Indent-Pre and Comments
2399 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2400 !! wikitext
2401 <!--a--> a
2403  <!--b-->b
2404 !! html
2405 <pre>a
2406 </pre>
2407 <pre>b
2408 </pre>
2409 !!end
2411 !!test
2412 2a. Indent-Pre and tables
2413 !! wikitext
2414  {|
2415  |-
2416  !h1!!h2
2417  |foo||bar
2418  |}
2419 !! html
2420 <table>
2422 <tr>
2423 <th>h1</th>
2424 <th>h2
2425 </th>
2426 <td>foo</td>
2427 <td>bar
2428 </td></tr></table>
2430 !!end
2432 !!test
2433 2b. Indent-Pre and tables
2434 !! wikitext
2435   {|
2436  |-
2437 |foo
2439 !! html
2440 <table>
2442 <tr>
2443 <td>foo
2444 </td></tr></table>
2446 !!end
2448 !!test
2449 2c. Indent-Pre and tables (bug 42252)
2450 !! wikitext
2452  |+ foo
2453  !  | bar
2455 !! html
2456 <table>
2457 <caption> foo
2458 </caption>
2459 <tr>
2460 <th> bar
2461 </th></tr></table>
2463 !!end
2465 !!test
2466 2d. Indent-Pre and tables
2467 !! wikitext
2469  {|
2470  | b
2471  |}
2472 !! html/php
2473 <pre>a
2474 </pre>
2475 <table>
2476 <tr>
2477 <td> b
2478 </td></tr></table>
2480 !! html/parsoid
2481 <pre>a</pre>
2483 <table>
2485 <tbody>
2486 <tr>
2487 <td> b</td></tr>
2488  </tbody></table>
2489 !!end
2491 !!test
2492 2e. Indent-Pre and table-line syntax
2493 !! wikitext
2495  | b
2496  | c
2497 !! html/parsoid
2498 <pre>a
2499 | b
2500 | c</pre>
2501 !!end
2503 !!test
2504 2f. Indent-pre started by table-line syntax
2505 !! wikitext
2507  | b
2508  | c
2509 !! html/parsoid
2510 <p>a</p>
2511 <pre>
2512 | b
2513 | c</pre>
2514 !!end
2516 !!test
2517 3a. Indent-Pre and block tags (single-line html)
2518 !! wikitext
2519  a <p> foo </p>
2520  b <div> foo </div>
2521  c <blockquote> foo </blockquote>
2522  <span> foo </span>
2523 !! html
2524  a <p> foo </p>
2525  b <div> foo </div>
2526  c <blockquote> foo </blockquote>
2527 <pre><span> foo </span>
2528 </pre>
2529 !!end
2531 !!test
2532 3b. Indent-Pre and block tags (multi-line html)
2533 !! wikitext
2534  a <span>foo</span>
2535  b <div> foo </div>
2536 !! html
2537 <pre>a <span>foo</span>
2538 </pre>
2539  b <div> foo </div>
2541 !!end
2543 !!test
2544 3c. Indent-Pre and block tags (pre-content on separate line)
2545 !! wikitext
2547  foo
2548 </p>
2550 <div>
2551  foo
2552 </div>
2554 <center>
2555  foo
2556 </center>
2558 <blockquote>
2559  foo
2560 </blockquote>
2562 <blockquote>
2563 <pre>
2565 </pre>
2566 </blockquote>
2568 <table><tr><td>
2569  foo
2570 </td></tr></table>
2572 <ul><li>
2573   foo
2574 </li></ul>
2576 !! html
2578  foo
2579 </p>
2580 <div>
2581 <pre>foo
2582 </pre>
2583 </div>
2584 <center>
2585 <pre>foo
2586 </pre>
2587 </center>
2588 <blockquote>
2589 <p> foo
2590 </p>
2591 </blockquote>
2592 <blockquote>
2593 <pre>
2595 </pre>
2596 </blockquote>
2597 <table><tr><td>
2598 <pre>foo
2599 </pre>
2600 </td></tr></table>
2601 <ul><li>
2602   foo
2603 </li></ul>
2605 !!end
2607 !!test
2608 4. Indent-Pre and extension tags
2609 !! wikitext
2610  a <gallery>
2611 File:foobar.jpg
2612 </gallery>
2613 !! html
2614  a <ul class="gallery mw-gallery-traditional">
2615                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2616                         <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>
2617                         <div class="gallerytext">
2618                         </div>
2619                 </div></li>
2620 </ul>
2622 !!end
2624 !! test
2625 Table wikitext syntax outside wiki-tables
2626 !! wikitext
2628 ! not a table heading
2629 |- not a table row
2630 | not a table cell
2631 | class="foo bar" | baz
2636 !! html
2637 <p>a
2638 ! not a table heading
2639 |- not a table row
2640 | not a table cell
2641 | class="foo bar" | baz
2646 </p>
2647 !! end
2649 !!test
2650 Render paragraphs when indent-pre is suppressed in blocklevels
2651 !! wikitext
2652 <blockquote>
2653  foo
2655  bar
2656 </blockquote>
2657 !! html
2658 <blockquote>
2659 <p> foo
2660 </p><p> bar
2661 </p>
2662 </blockquote>
2664 !!end
2666 !!test
2667 4. Multiple spaces at start-of-line
2668 !! wikitext
2669     <p> foo </p>
2670     foo
2671         {|
2672 |foo
2674 !! html
2675     <p> foo </p>
2676 <pre>   foo
2677 </pre>
2678 <table>
2679 <tr>
2680 <td>foo
2681 </td></tr></table>
2683 !!end
2685 ## NOTE: the leading white-space chars on empty line are significant
2686 !! test
2687 5a. White-space in indent-pre
2688 !! wikitext
2689  a<br />
2692 !! html
2693 <pre>a<br />
2696 </pre>
2697 !! end
2699 ## NOTE: the leading white-space chars on empty line are significant
2700 !! test
2701 5b. White-space in indent-pre
2702 !! wikitext
2709 !! html
2710 <pre>a
2716 </pre>
2717 !! end
2719 !! test
2720 5c. White-space in indent-pre
2721 !! wikitext
2722  ''a''
2723   ''b''
2724    ''c''
2725 !! html
2726 <pre><i>a</i>
2727  <i>b</i>
2728   <i>c</i>
2729 </pre>
2730 !! end
2732 !! test
2733 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2734 !! wikitext
2737  <!-- continue -->
2743 !! html
2744 <pre>a
2747 </pre>
2748 <pre>c
2750 </pre>
2751 <p>d
2752 </p>
2753 !! end
2755 !! test
2756 7a. Indent-pre and category links
2757 !! options
2758 parsoid=wt2html,wt2wt
2759 !! wikitext
2760  [[Category:foo]] <!-- No pre-wrapping -->
2761 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2762 !! html
2763  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2764 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span>
2765 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre-wrapping -->
2766 !! end
2768 !! test
2769 7b. Indent-pre and category links
2770 !! options
2771 parsoid=wt2html,wt2wt
2772 !! wikitext
2773  [[Category:foo]] a
2774  [[Category:foo]] {{echo|b}}
2775 !! html
2776 <pre>
2777 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2779 <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>
2780 !! end
2783 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2786 !!test
2787 HTML-pre: 1. embedded newlines
2788 !! wikitext
2789 <pre>foo</pre>
2791 <pre>
2793 </pre>
2795 <pre>
2798 </pre>
2800 <pre>
2804 </pre>
2805 !! html
2806 <pre>foo</pre>
2807 <pre>
2809 </pre>
2810 <pre>
2813 </pre>
2814 <pre>
2818 </pre>
2820 !! html/parsoid
2821 <pre data-parsoid='{"stx":"html"}'>foo</pre>
2823 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
2825 </pre>
2827 <pre data-parsoid='{"stx":"html"}'>
2830 </pre>
2832 <pre data-parsoid='{"stx":"html"}'>
2836 </pre>
2837 !!end
2839 !! test
2840 HTML-pre: big spaces
2841 !! wikitext
2842 <pre>
2847 haha
2852 haha
2857 </pre>
2858 !! html
2859 <pre>
2864 haha
2869 haha
2874 </pre>
2876 !! html/parsoid
2877 <pre data-parsoid='{"stx":"html"}'>
2882 haha
2887 haha
2892 </pre>
2893 !! end
2895 !!test
2896 HTML-pre: 2: indented text
2897 !! wikitext
2898 <pre>
2899  foo
2900 </pre>
2901 !! html
2902 <pre>
2903  foo
2904 </pre>
2906 !!end
2908 !!test
2909 HTML-pre: 3: other wikitext
2910 !! wikitext
2911 <pre>
2912 * foo
2913 # bar
2914 = no-h =
2915 '' no-italic ''
2916 [[ NoLink ]]
2917 </pre>
2918 !! html
2919 <pre>
2920 * foo
2921 # bar
2922 = no-h =
2923 '' no-italic ''
2924 [[ NoLink ]]
2925 </pre>
2927 !!end
2930 ### Definition lists
2932 !! test
2933 Simple definition
2934 !! wikitext
2935 ; name : Definition
2936 !! html
2937 <dl><dt> name&#160;</dt>
2938 <dd> Definition</dd></dl>
2940 !! end
2942 !! test
2943 Definition list for indentation only
2944 !! wikitext
2945 : Indented text
2946 !! html
2947 <dl><dd> Indented text</dd></dl>
2949 !! end
2951 !! test
2952 Definition list with no space
2953 !! wikitext
2954 ;name:Definition
2955 !! html
2956 <dl><dt>name</dt>
2957 <dd>Definition</dd></dl>
2959 !!end
2961 !! test
2962 Definition list with URL link
2963 !! wikitext
2964 ; http://example.com/ : definition
2965 !! html
2966 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
2967 <dd> definition</dd></dl>
2969 !! end
2971 !! test
2972 Definition list with bracketed URL link
2973 !! wikitext
2974 ;[http://www.example.com/ Example]:Something about it
2975 !! html
2976 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
2977 <dd>Something about it</dd></dl>
2979 !! end
2981 !! test
2982 Definition list with wikilink containing colon
2983 !! wikitext
2984 ; [[Help:FAQ]]: The least-read page on Wikipedia
2985 !! html
2986 <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>
2987 <dd> The least-read page on Wikipedia</dd></dl>
2989 !! end
2991 # At Brion's and JeLuF's insistence... :)
2992 !! test
2993 Definition list with news link containing colon
2994 !! wikitext
2995 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
2996 !! html
2997 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
2998 <dd> This isn't even a real newsgroup!</dd></dl>
3000 !! end
3002 !! test
3003 Malformed definition list with colon
3004 !! wikitext
3005 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3006 !! html
3007 <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>
3009 !! end
3011 !! test
3012 Definition lists: colon in external link text
3013 !! wikitext
3014 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3015 !! html
3016 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3017 <dd> OK, I made that up</dd></dl>
3019 !! end
3021 !! test
3022 Definition lists: colon in HTML attribute
3023 !! wikitext
3024 ;<b style="display: inline">bold</b>
3025 !! html
3026 <dl><dt><b style="display: inline">bold</b></dt></dl>
3028 !! end
3030 !! test
3031 Definition lists: self-closed tag
3032 !! wikitext
3033 ;one<br/>two : two-line fun
3034 !! html
3035 <dl><dt>one<br />two&#160;</dt>
3036 <dd> two-line fun</dd></dl>
3038 !! end
3040 !! test
3041 Bug 11748: Literal closing tags
3042 !! wikitext
3043 <dl>
3044 <dt>test 1</dt>
3045 <dd>test test test test test</dd>
3046 <dt>test 2</dt>
3047 <dd>test test test test test</dd>
3048 </dl>
3049 !! html
3050 <dl>
3051 <dt>test 1</dt>
3052 <dd>test test test test test</dd>
3053 <dt>test 2</dt>
3054 <dd>test test test test test</dd>
3055 </dl>
3057 !! end
3059 !! test
3060 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3061 !! wikitext
3062 <ul><li>
3063 ; term : description
3064 * unordered
3065 </li></ul>
3066 !! html
3067 <ul><li>
3068 <dl><dt> term&#160;</dt>
3069 <dd> description</dd></dl>
3070 <ul><li> unordered</li></ul>
3071 </li></ul>
3073 !! end
3075 !! test
3077 Definition list with empty definition and following paragraph
3078 !! wikitext
3079 ; term:
3080 Paragraph text
3081 !! html
3082 <dl><dt> term</dt>
3083 <dd></dd></dl>
3084 <p>Paragraph text
3085 </p>
3086 !! end
3088 !! test
3089 Nested definition lists using html syntax
3090 !! wikitext
3091 <dl><dt>x</dt>
3092 <dd>a</dd>
3093 <dd>b</dd></dl>
3095 !! end
3097 !! test
3098 Definition Lists: No nesting: Multiple dd's
3099 !! wikitext
3103 !! html
3104 <dl><dt>x</dt>
3105 <dd>a</dd>
3106 <dd>b</dd></dl>
3108 !! end
3110 !! test
3111 Definition Lists: Indentation: Regular
3112 !! wikitext
3114 ::i2
3115 :::i3
3116 !! html
3117 <dl><dd>i1
3118 <dl><dd>i2
3119 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3121 !! end
3123 !! test
3124 Definition Lists: Indentation: Missing 1st level
3125 !! wikitext
3126 ::i2
3127 :::i3
3128 !! html
3129 <dl><dd><dl><dd>i2
3130 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3132 !! end
3134 !! test
3135 Definition Lists: Indentation: Multi-level indent
3136 !! wikitext
3137 :::i3
3138 !! html
3139 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3141 !! end
3143 !! test
3144 Definition Lists: Hacky use to indent tables
3145 !! wikitext
3146 ::{|
3147 |foo
3148 |bar
3150 this text
3151 should be left alone
3152 !! html
3153 <dl><dd><dl><dd><table>
3154 <tr>
3155 <td>foo
3156 </td>
3157 <td>bar
3158 </td></tr></table></dd></dl></dd></dl>
3159 <p>this text
3160 should be left alone
3161 </p>
3162 !! end
3164 !! test
3165 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3166 !! wikitext
3167 <!-- foo -->
3168 ::{|
3169 |foo
3170 |bar
3171 |}<!-- bar -->
3172 this text
3173 should be left alone
3174 !! html/parsoid
3175 <!-- foo -->
3176 <dl><dd><dl><dd><table><tr>
3177 <td>foo</td>
3178 <td>bar</td>
3179 </tr></table><!-- bar --></dd></dl></dd></dl>
3180 <p>this text
3181 should be left alone</p>
3182 !! end
3184 !! test
3185 Definition Lists: Hacky use to indent tables, with comment before table
3186 !! wikitext
3187 ::<!-- foo -->{|
3188 |foo
3190 !! html/parsoid
3191 <dl><dd><dl><dd><!-- foo --><table><tr>
3192 <td>foo</td>
3193 </tr></table></dd></dl></dd></dl>
3194 !! end
3196 # Bug 52473
3197 !! test
3198 Definition Lists: Hacky use to indent tables (WS-insensitive)
3199 !! options
3200 parsoid
3201 !! wikitext
3202 : {|
3204 |} 
3205 !! html
3206 <dl>
3207 <dd> <table><tr><td>a</td></tr></table> </dd>
3208 </dl>
3209 !! end
3210 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3211 ## as an empty dt item.  It also ignores all but the last ";" when followed
3212 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3213 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3214 ## ";"s.
3216 ## Ex: ";;t2 ::d2" is transformed into:
3218 ## <dl>
3219 ##   <dt>t2 </dt>
3220 ##   <dd>
3221 ##     <dl>
3222 ##       <dt></dt>
3223 ##       <dd>d2</dd>
3224 ##     </dl>
3225 ##   </dd>
3226 ## </dl>
3228 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3229 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3231 ## <dl>
3232 ##   <dt>
3233 ##     <dl>
3234 ##       <dt>t2 </dt>
3235 ##       <dd>:d2</dd>
3236 ##     </dl>
3237 ##    </dt>
3238 ## </dl>
3240 ## All Parsoid only definition list tests have this difference.
3242 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3243 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3245 !! test
3246 Table / list interaction: indented table with lists in table contents
3247 !! wikitext
3250 | a
3251 * b
3253 | c
3254 * d
3256 !! html
3257 <dl><dd><table>
3259 <tr>
3260 <td> a
3261 <ul><li> b</li></ul>
3262 </td></tr>
3263 <tr>
3264 <td> c
3265 <ul><li> d</li></ul>
3266 </td></tr></table></dd></dl>
3268 !! end
3270 !!test
3271 Table / list interaction: lists nested in tables nested in indented lists
3272 !! wikitext
3284 !! html
3285 <dl><dd><table>
3286 <tr>
3287 <td>
3288 <dl><dd>a</dd>
3289 <dd>b</dd></dl>
3290 </td>
3291 <td>
3292 <ul><li>c</li>
3293 <li>d</li></ul>
3294 </td></tr></table></dd></dl>
3295 <ul><li>e</li>
3296 <li>f</li></ul>
3298 !!end
3300 !! test
3301 Definition Lists: Nesting: Multi-level (Parsoid only)
3302 !! options
3303 parsoid
3304 !! wikitext
3305 ;t1 :d1
3306 ;;t2 ::d2
3307 ;;;t3 :::d3
3308 !! html
3309 <dl>
3310   <dt>t1 </dt>
3311   <dd>d1</dd>
3312   <dt>
3313     <dl>
3314       <dt>t2 </dt>
3315       <dd>:d2</dd>
3316       <dt>
3317         <dl>
3318           <dt>t3 </dt>
3319           <dd>::d3</dd>
3320         </dl>
3321       </dt>
3322     </dl>
3323   </dt>
3324 </dl>
3327 !! end
3330 !! test
3331 Definition Lists: Nesting: Test 2 (Parsoid only)
3332 !! options
3333 parsoid
3334 !! wikitext
3336 ::d2
3337 !! html
3338 <dl>
3339   <dt>t1</dt>
3340   <dd>
3341     <dl>
3342       <dd>d2</dd>
3343     </dl>
3344   </dd>
3345 </dl>
3347 !! end
3350 !! test
3351 Definition Lists: Nesting: Test 3 (Parsoid only)
3352 !! options
3353 parsoid
3354 !! wikitext
3355 :;t1
3356 ::::d2
3357 !! html
3358 <dl>
3359   <dd>
3360     <dl>
3361       <dt>t1</dt>
3362       <dd>
3363         <dl>
3364           <dd>
3365             <dl>
3366               <dd>d2</dd>
3367             </dl>
3368           </dd>
3369         </dl>
3370       </dd>
3371     </dl>
3372   </dd>
3373 </dl>
3375 !! end
3378 !! test
3379 Definition Lists: Nesting: Test 4
3380 !! wikitext
3381 ::;t3
3382 :::d3
3383 !! html
3384 <dl><dd><dl><dd><dl><dt>t3</dt>
3385 <dd>d3</dd></dl></dd></dl></dd></dl>
3387 !! end
3390 ## The Parsoid team believes the following three test exposes a
3391 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
3392 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3393 !! test
3394 Definition Lists: Mixed Lists: Test 1
3395 !! wikitext
3396 :;* foo
3397 ::* bar
3398 :; baz
3399 !! html/php
3400 <dl><dd><dl><dt><ul><li> foo</li>
3401 <li> bar</li></ul></dt></dl>
3402 <dl><dt> baz</dt></dl></dd></dl>
3404 !! html/parsoid
3405 <dl>
3406 <dd><dl>
3407 <dt><ul>
3408 <li> foo
3409 </li>
3410 </ul></dt>
3411 <dd><ul>
3412 <li> bar
3413 </li>
3414 </ul></dd>
3415 <dt> baz</dt>
3416 </dl></dd>
3417 </dl>
3418 !! end
3420 !! test
3421 Definition Lists: Mixed Lists: Test 2
3422 !! wikitext
3423 *: d1
3424 *: d2
3425 !! html
3426 <ul><li><dl><dd> d1</dd>
3427 <dd> d2</dd></dl></li></ul>
3429 !! end
3432 !! test
3433 Definition Lists: Mixed Lists: Test 3
3434 !! wikitext
3435 *::: d1
3436 *::: d2
3437 !! html
3438 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3439 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3441 !! end
3444 !! test
3445 Definition Lists: Mixed Lists: Test 4
3446 !! wikitext
3447 *;d1 :d2
3448 *;d3 :d4
3449 !! html
3450 <ul><li><dl><dt>d1&#160;</dt>
3451 <dd>d2</dd>
3452 <dt>d3&#160;</dt>
3453 <dd>d4</dd></dl></li></ul>
3455 !! end
3458 !! test
3459 Definition Lists: Mixed Lists: Test 5
3460 !! wikitext
3461 *:d1
3462 *:: d2
3463 !! html
3464 <ul><li><dl><dd>d1
3465 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3467 !! end
3470 !! test
3471 Definition Lists: Mixed Lists: Test 6
3472 !! wikitext
3473 #*:d1
3474 #*::: d3
3475 !! html
3476 <ol><li><ul><li><dl><dd>d1
3477 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3479 !! end
3482 !! test
3483 Definition Lists: Mixed Lists: Test 7
3484 !! wikitext
3485 :* d1
3486 :* d2
3487 !! html
3488 <dl><dd><ul><li> d1</li>
3489 <li> d2</li></ul></dd></dl>
3491 !! end
3494 !! test
3495 Definition Lists: Mixed Lists: Test 8
3496 !! wikitext
3497 :* d1
3498 ::* d2
3499 !! html
3500 <dl><dd><ul><li> d1</li></ul>
3501 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3503 !! end
3506 !! test
3507 Definition Lists: Mixed Lists: Test 9
3508 !! wikitext
3509 *;foo :bar
3510 !! html
3511 <ul><li><dl><dt>foo&#160;</dt>
3512 <dd>bar</dd></dl></li></ul>
3514 !! end
3517 !! test
3518 Definition Lists: Mixed Lists: Test 10
3519 !! wikitext
3520 *#;foo :bar
3521 !! html
3522 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3523 <dd>bar</dd></dl></li></ol></li></ul>
3525 !! end
3527 # The Parsoid team disagrees with the PHP parser's seemingly-random
3528 # rules regarding dd/dt on the next two tests.  Parsoid is more
3529 # consistent, and recognizes the shared nesting and keeps the
3530 # still-open tags around until the nesting is complete.
3532 !! test
3533 Definition Lists: Mixed Lists: Test 11
3534 !! wikitext
3535 *#*#;*;;foo :bar
3536 *#*#;boo :baz
3537 !! html/php
3538 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3539 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3540 <dl><dt>boo&#160;</dt>
3541 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3543 !! html/parsoid
3544 <ul>
3545 <li>
3546 <ol>
3547 <li>
3548 <ul>
3549 <li>
3550 <ol>
3551 <li>
3552 <dl>
3553 <dt>
3554 <ul>
3555 <li>
3556 <dl>
3557 <dt>
3558 <dl>
3559 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3560 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3561 </dl></dt>
3562 </dl></li>
3563 </ul></dt>
3564 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3565 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3566 </dl></li>
3567 </ol></li>
3568 </ul></li>
3569 </ol></li>
3570 </ul>
3571 !! end
3574 !! test
3575 Definition Lists: Weird Ones: Test 1
3576 !! wikitext
3577 *#;*::;; foo : bar (who uses this?)
3578 !! html/php
3579 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3580 <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>
3582 !! html/parsoid
3583 <ul>
3584 <li>
3585 <ol>
3586 <li>
3587 <dl>
3588 <dt>
3589 <ul>
3590 <li>
3591 <dl>
3592 <dd>
3593 <dl>
3594 <dd>
3595 <dl>
3596 <dt>
3597 <dl>
3598 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3599 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3600 </dl></dt>
3601 </dl></dd>
3602 </dl></dd>
3603 </dl></li>
3604 </ul></dt>
3605 </dl></li>
3606 </ol></li>
3607 </ul>
3608 !! end
3611 ### External links
3613 !! test
3614 External links: non-bracketed
3615 !! wikitext
3616 Non-bracketed: http://example.com
3617 !! html
3618 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3619 </p>
3620 !! end
3622 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3623 !! test
3624 External links: numbered
3625 !! wikitext
3626 Numbered: [http://example.com]
3627 Numbered: [http://example.net]
3628 Numbered: [http://example.com]
3629 !! html/php
3630 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
3631 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
3632 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
3633 </p>
3634 !! html/parsoid
3635 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
3636 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
3637 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
3638 !!end
3640 !! test
3641 External links: specified text
3642 !! wikitext
3643 Specified text: [http://example.com link]
3644 !! html
3645 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
3646 </p>
3647 !!end
3649 !! test
3650 External links: trail
3651 !! wikitext
3652 Linktrails should not work for external links: [http://example.com link]s
3653 !! html
3654 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
3655 </p>
3656 !! end
3658 !! test
3659 External links: dollar sign in URL
3660 !! wikitext
3661 http://example.com/1$2345
3662 !! html
3663 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
3664 </p>
3665 !! end
3667 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3668 !! test
3669 External links: dollar sign in URL (autonumber)
3670 !! wikitext
3671 [http://example.com/1$2345]
3672 !! html/php
3673 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
3674 </p>
3675 !! html/parsoid
3676 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
3677 !!end
3679 !! test
3680 External links: open square bracket forbidden in URL (bug 4377)
3681 !! options
3682 parsoid=wt2html,wt2wt,html2html
3683 !! wikitext
3684 http://example.com/1[2345
3685 !! html/php
3686 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
3687 </p>
3688 !! html/parsoid
3689 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
3690 !! end
3692 !! test
3693 External links: open square bracket forbidden in URL (named) (bug 4377)
3694 !! options
3695 parsoid=wt2html,html2html
3696 !! wikitext
3697 [http://example.com/1[2345]
3698 !! html/php
3699 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3700 </p>
3701 !! html/parsoid
3702 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
3703 !!end
3705 # parsoid adds a space before the link name
3706 !! test
3707 External links: open square bracket forbidden in URL (named) (bug 4377)
3708 Parsoid variant.
3709 !! wikitext
3710 [http://example.com/1 [2345]
3711 !! html
3712 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
3713 </p>
3714 !!end
3716 !! test
3717 External links: nowiki in URL link text (bug 6230)
3718 !! wikitext
3719 [http://example.com/ <nowiki>''example site''</nowiki>]
3720 !! html
3721 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
3722 </p>
3723 !! end
3725 !! test
3726 External links: newline forbidden in text (bug 6230 regression check)
3727 !! wikitext
3728 [http://example.com/ first
3729 second]
3730 !! html
3731 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
3732 second]
3733 </p>
3734 !!end
3736 !! test
3737 External links: Pipe char between url and text
3738 !! wikitext
3739 [http://example.com | link]
3740 !! html
3741 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
3742 </p>
3743 !!end
3745 !! test
3746 External links: protocol-relative URL in brackets
3747 !! wikitext
3748 [//example.com/ Test]
3749 !! html
3750 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
3751 </p>
3752 !! end
3754 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3755 !! test
3756 External links: protocol-relative URL in brackets without text
3757 !! wikitext
3758 [//example.com]
3759 !! html/php
3760 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
3761 </p>
3762 !! html/parsoid
3763 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
3764 !! end
3766 !! test
3767 External links: protocol-relative URL in free text is left alone
3768 !! wikitext
3769 //example.com/Foo
3770 !! html
3771 <p>//example.com/Foo
3772 </p>
3773 !!end
3775 !! test
3776 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
3777 !! wikitext
3778 foo//example.com/Foo
3779 !! html
3780 <p>foo//example.com/Foo
3781 </p>
3782 !! end
3784 !! test
3785 External links: with no contents
3786 !! wikitext
3787 [http://en.wikipedia.org/wiki/Foo]
3789 [[wikipedia:Foo|Bar]]
3791 [[wikipedia:Foo|<span>Bar</span>]]
3792 !! html/parsoid
3793 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
3794 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo">Bar</a></p>
3795 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"><span>Bar</span></a></p>
3796 !! end
3798 !! test
3799 External image
3800 !! wikitext
3801 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3802 !! html
3803 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3804 </p>
3805 !! end
3807 !! test
3808 External image from https
3809 !! wikitext
3810 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3811 !! html
3812 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
3813 </p>
3814 !! end
3816 !! test
3817 External image (when not allowed)
3818 !! options
3819 wgAllowExternalImages=0
3820 !! wikitext
3821 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
3822 !! html
3823 <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>
3824 </p>
3825 !! end
3827 !! test
3828 Link to non-http image, no img tag
3829 !! wikitext
3830 Link to non-http image, no img tag: ftp://example.com/test.jpg
3831 !! html
3832 <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>
3833 </p>
3834 !! end
3836 !! test
3837 External links: terminating separator
3838 !! wikitext
3839 Terminating separator: http://example.com/thing,
3840 !! html
3841 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
3842 </p>
3843 !! end
3845 !! test
3846 External links: intervening separator
3847 !! wikitext
3848 Intervening separator: http://example.com/1,2,3
3849 !! html
3850 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
3851 </p>
3852 !! end
3854 !! test
3855 External links: old bug with URL in query
3856 !! wikitext
3857 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
3858 !! html
3859 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
3860 </p>
3861 !! end
3863 !! test
3864 External links: old URL-in-URL bug, mixed protocols
3865 !! wikitext
3866 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
3867 !! html
3868 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
3869 </p>
3870 !!end
3872 !! test
3873 External links: URL in text
3874 !! wikitext
3875 URL in text: [http://example.com http://example.com]
3876 !! html
3877 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3878 </p>
3879 !! end
3881 !! test
3882 External links: Clickable images
3883 !! wikitext
3884 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
3885 !! html
3886 <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>
3887 </p>
3888 !!end
3890 !! test
3891 External links: raw ampersand
3892 !! wikitext
3893 Old &amp; use: http://x&y
3894 !! html
3895 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3896 </p>
3897 !! end
3899 !! test
3900 External links: encoded ampersand
3901 !! wikitext
3902 Old &amp; use: http://x&amp;y
3903 !! html/php
3904 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
3905 </p>
3906 !! html/parsoid
3907 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
3908 !! end
3910 !! test
3911 External links: encoded equals (bug 6102)
3912 !! wikitext
3913 http://example.com/?foo&#61;bar
3914 !! html/php
3915 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
3916 </p>
3917 !! html/parsoid
3918 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
3919 !! end
3922 ## Note that parsoid doesn't explicit mark autonumbered links, nor
3923 ## does it number them.  As discussed in bug 53505, we can identify
3924 ## autonumbered links via CSS.
3927 !! test
3928 External links: [raw ampersand]
3929 !! wikitext
3930 Old &amp; use: [http://x&y]
3931 !! html/php
3932 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3933 </p>
3934 !! html/parsoid
3935 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3936 !! end
3938 # note that parsoid html is identical to [raw ampersand] case; so html2wt
3939 # mode will return the [raw ampersand] wikitext
3940 !! test
3941 External links: [encoded ampersand]
3942 !! options
3943 parsoid=wt2html,wt2wt,html2html
3944 !! wikitext
3945 Old &amp; use: [http://x&amp;y]
3946 !! html/php
3947 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
3948 </p>
3949 !! html/parsoid
3950 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
3951 !! end
3953 !! test
3954 External links: [raw equals]
3955 !! wikitext
3956 [http://example.com/?foo=bar]
3957 !! html/php
3958 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3959 </p>
3960 !! html/parsoid
3961 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3962 !! end
3964 # note that parsoid html is identical to [raw equals] case; so html2wt
3965 # mode will return the [raw equals] wikitext
3966 !! test
3967 External links: [encoded equals] (bug 6102)
3968 !! options
3969 parsoid=wt2html,wt2wt,html2html
3970 !! wikitext
3971 [http://example.com/?foo&#61;bar]
3972 !! html/php
3973 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
3974 </p>
3975 !! html/parsoid
3976 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
3977 !! end
3979 # xxx parsoid strips the IDN character, so the round-trip tests will
3980 #     obviously fail and are disabled. --cscott
3981 !! test
3982 External links: [IDN ignored character reference in hostname; strip it right off]
3983 !! options
3984 parsoid=wt2html,wt2wt,html2html
3985 !! wikitext
3986 [http://e&zwnj;xample.com/]
3987 !! html/php
3988 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
3989 </p>
3990 !! html/parsoid
3991 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
3992 !! end
3994 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
3995 # Where an external link could easily circumvent the sanitization of the text of
3996 # a link like this (where an IDN-ignore character is in the URL somewhere), this
3997 # test demands a higher standard. That's a bit strange.
3999 # Example:
4001 # http://e‌xample.com -> [http://example.com|http://example.com]
4002 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4004 # The first example is sanitized, but the second is not. Any security benefits
4005 # from this production are trivial to circumvent. Either remove this test and
4006 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4007 # the test accordingly.
4009 # All our love,
4010 # The Parsoid team.
4011 # xxx parsoid strips the IDN character, so the round-trip tests will
4012 #     obviously fail and are disabled. --cscott
4013 !! test
4014 External links: IDN ignored character reference in hostname; strip it right off
4015 !! options
4016 parsoid=wt2html,html2html
4017 !! wikitext
4018 http://e&zwnj;xample.com/
4019 !! html/php
4020 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4021 </p>
4022 !! html/parsoid
4023 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4024 !! end
4026 !! test
4027 External links: www.jpeg.org (bug 554)
4028 !! wikitext
4029 http://www.jpeg.org
4030 !! html
4031 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4032 </p>
4033 !! end
4035 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4036 !! test
4037 External links: URL within URL (original bug 2)
4038 !! wikitext
4039 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4040 !! html/php
4041 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4042 </p>
4043 !! html/parsoid
4044 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4045 !! end
4047 !! test
4048 BUG 361: URL inside bracketed URL
4049 !! wikitext
4050 [http://www.example.com/foo http://www.example.com/bar]
4051 !! html
4052 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4053 </p>
4054 !! end
4056 !! test
4057 BUG 361: URL within URL, not bracketed
4058 !! wikitext
4059 http://www.example.com/foo?=http://www.example.com/bar
4060 !! html
4061 <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>
4062 </p>
4063 !! end
4065 !! test
4066 BUG 289: ">"-token in URL-tail
4067 !! wikitext
4068 http://www.example.com/<hello>
4069 !! html
4070 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4071 </p>
4072 !!end
4074 !! test
4075 BUG 289: literal ">"-token in URL-tail
4076 !! wikitext
4077 http://www.example.com/<b>html</b>
4078 !! html
4079 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4080 </p>
4081 !!end
4083 !! test
4084 BUG 289: ">"-token in bracketed URL
4085 !! wikitext
4086 [http://www.example.com/<hello> stuff]
4087 !! html
4088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4089 </p>
4090 !!end
4092 !! test
4093 BUG 289: literal ">"-token in bracketed URL
4094 !! wikitext
4095 [http://www.example.com/<b>html</b> stuff]
4096 !! html
4097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4098 </p>
4099 !!end
4101 !! test
4102 BUG 289: literal double quote at end of URL
4103 !! wikitext
4104 http://www.example.com/"hello"
4105 !! html
4106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4107 </p>
4108 !!end
4110 !! test
4111 BUG 289: literal double quote in bracketed URL
4112 !! wikitext
4113 [http://www.example.com/"hello" stuff]
4114 !! html
4115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4116 </p>
4117 !!end
4119 !! test
4120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4121 !! wikitext
4122 [http://www.example.com  test]
4123 !! html
4124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4125 </p>
4126 !! end
4128 !! test
4129 External links: link text with spaces
4130 !! wikitext
4131 [http://www.example.com a b c]
4132 [http://www.example.com ''a'' ''b'']
4133 !! html
4134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4136 </p>
4137 !! end
4139 !! test
4140 External links: wiki links within external link (Bug 3695)
4141 !! wikitext
4142 [http://example.com [[wikilink]] embedded in ext link]
4143 !! html/php
4144 <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>
4145 </p>
4146 !! html/parsoid
4147 <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>
4148 !! end
4150 !! test
4151 BUG 787: Links with one slash after the url protocol are invalid
4152 !! wikitext
4153 http:/example.com
4155 [http:/example.com title]
4156 !! html
4157 <p>http:/example.com
4158 </p><p>[http:/example.com title]
4159 </p>
4160 !! end
4162 !! test
4163 Bracketed external links with template-generated invalid target
4164 !! wikitext
4165 [{{echo|http:/example.com}} title]
4166 !! html
4167 <p>[http:/example.com title]
4168 </p>
4169 !! end
4171 !! test
4172 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4173 !! wikitext
4174 ''[http://example.com text'']
4175 [http://example.com '''text]'''
4176 ''Something [http://example.com in italic'']
4177 ''Something [http://example.com mixed''''', even bold]'''
4178 '''''Now [http://example.com both''''']
4179 !! html
4180 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4181 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4182 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4183 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4184 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4185 </p>
4186 !! end
4189 !! test
4190 Bug 4781: %26 in URL
4191 !! wikitext
4192 http://www.example.com/?title=AT%26T
4193 !! html/php
4194 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4195 </p>
4196 !! html/parsoid
4197 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4198 !! end
4200 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4201 # % is actually legal in HTML5. Any change in output would need testing though.
4202 !! test
4203 Bug 4781, 5267: %25 in URL
4204 !! wikitext
4205 http://www.example.com/?title=100%25_Bran
4206 !! html/php
4207 <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>
4208 </p>
4209 !! html/parsoid
4210 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4211 !! end
4213 !! test
4214 Bug 4781, 5267: %28, %29 in URL
4215 !! wikitext
4216 http://www.example.com/?title=Ben-Hur_%281959_film%29
4217 !! html/php
4218 <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>
4219 </p>
4220 !! html/parsoid
4221 <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>
4222 !! end
4225 !! test
4226 Bug 4781: %26 in autonumber URL
4227 !! wikitext
4228 [http://www.example.com/?title=AT%26T]
4229 !! html/php
4230 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4231 </p>
4232 !! html/parsoid
4233 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4234 !! end
4236 !! test
4237 Bug 4781, 5267: %26 in autonumber URL
4238 !! wikitext
4239 [http://www.example.com/?title=100%25_Bran]
4240 !! html/php
4241 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4242 </p>
4243 !! html/parsoid
4244 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4245 !! end
4247 !! test
4248 Bug 4781, 5267: %28, %29 in autonumber URL
4249 !! wikitext
4250 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4251 !! html/php
4252 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4253 </p>
4254 !! html/parsoid
4255 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4256 !! end
4259 !! test
4260 Bug 4781: %26 in bracketed URL
4261 !! wikitext
4262 [http://www.example.com/?title=AT%26T link]
4263 !! html/php
4264 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4265 </p>
4266 !! html/parsoid
4267 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4268 !! end
4270 !! test
4271 Bug 4781, 5267: %25 in bracketed URL
4272 !! wikitext
4273 [http://www.example.com/?title=100%25_Bran link]
4274 !! html
4275 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4276 </p>
4277 !! end
4279 !! test
4280 Bug 4781, 5267: %28, %29 in bracketed URL
4281 !! wikitext
4282 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4283 !! html/php
4284 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4285 </p>
4286 !! html/parsoid
4287 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4288 !! end
4290 !! test
4291 External link containing a period in the anchor. (bug 63947)
4292 !! wikitext
4293 [//foo.org/bar#baz. bang]
4295 [//foo.org/bar. bang]
4296 !! html/php
4297 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4298 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4299 </p>
4300 !! html/parsoid
4301 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4302 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4303 !! end
4305 !! test
4306 External link containing a single quote. (bug 63947)
4307 !! wikitext
4308 [//foo.org/bar'baz]
4310 [//foo.org/bar'baz bang]
4311 !! html/php
4312 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4313 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4314 </p>
4315 !! html/parsoid
4316 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4317 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4318 !! end
4321 !! test
4322 External link containing a period in the anchor. (bug 63947)
4323 !! wikitext
4324 [//foo.org/bar#baz. bang]
4326 [//foo.org/bar. bang]
4327 !! html/php
4328 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4329 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4330 </p>
4331 !! html/parsoid
4332 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4333 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4334 !! end
4336 !! test
4337 External link containing a single quote. (bug 63947)
4338 !! wikitext
4339 [//foo.org/bar'baz]
4341 [//foo.org/bar'baz bang]
4342 !! html/php
4343 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4344 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4345 </p>
4346 !! html/parsoid
4347 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4348 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4349 !! end
4352 !! test
4353 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4354 !! wikitext
4355 Some [http://example.com/ pretty ''italics'' and stuff]!
4356 !! html
4357 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4358 </p>
4359 !! end
4361 !! test
4362 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4363 !! wikitext
4364 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4365 !! html
4366 <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>
4367 </p>
4368 !! end
4370 !! test
4371 External link containing double-single-quotes with no space separating the url from text in italics
4372 !! wikitext
4373 [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]].]
4374 !! html/php
4375 <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>
4376 </p>
4377 !! html/parsoid
4378 <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>
4379 !! end
4381 !! test
4382 External link with comments in link text
4383 !! wikitext
4384 [http://www.google.com Google <!-- comment -->]
4385 !! html
4386 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4387 </p>
4388 !! end
4390 !! test
4391 URL-encoding in URL functions (single parameter)
4392 !! wikitext
4393 {{localurl:Some page|amp=&}}
4394 !! html
4395 <p>/index.php?title=Some_page&amp;amp=&amp;
4396 </p>
4397 !! end
4399 !! test
4400 URL-encoding in URL functions (multiple parameters)
4401 !! wikitext
4402 {{localurl:Some page|q=?&amp=&}}
4403 !! html
4404 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4405 </p>
4406 !! end
4408 !! test
4409 Brackets in urls
4410 !! wikitext
4411 http://example.com/index.php?foozoid%5B%5D=bar
4413 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4414 !! html/php
4415 <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>
4416 </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>
4417 </p>
4418 !! html/parsoid
4419 <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>
4421 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4422 !! end
4424 !! test
4425 IPv6 urls (bug 21261)
4426 !! options
4427 disabled
4428 !! wikitext
4429 http://[2404:130:0:1000::187:2]/index.php
4430 !! html
4431 <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>
4432 </p>
4433 !! end
4435 !! test
4436 Non-extlinks in brackets
4437 !! wikitext
4438 [foo]
4439 [foo bar]
4440 [foo ''bar'']
4441 [fool's] errand
4442 [fool's errand]
4443 [{{echo|foo}}]
4444 [{{echo|foo}} bar]
4445 [{{echo|foo}} ''bar'']
4446 [{{echo|foo}}l's] errand
4447 [{{echo|foo}}l's errand]
4448 [url={{echo|foo}}]
4449 [url=http://example.com]
4450 !! html
4451 <p>[foo]
4452 [foo bar]
4453 [foo <i>bar</i>]
4454 [fool's] errand
4455 [fool's errand]
4456 [foo]
4457 [foo bar]
4458 [foo <i>bar</i>]
4459 [fool's] errand
4460 [fool's errand]
4461 [url=foo]
4462 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4463 </p>
4464 !! end
4466 !! test
4467 Percent encoding in external links
4468 !! wikitext
4469 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4470 !! html/php
4471 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4472 </p>
4473 !! html/parsoid
4474 <p><a rel="mw:ExtLink"
4475 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4476 !! end
4478 !! test
4479 Use url link syntax for links where the content is equal the link target
4480 !! wikitext
4481 http://example.com
4482 !! html/php
4483 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4484 </p>
4485 !! html/parsoid
4486 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4487 !! end
4489 !! test
4490 Parenthesis in external links, especially URL links
4491 !! wikitext
4492 http://example.com)
4494 http://example.com/test)
4496 http://example.com/(test)
4498 http://example.com/((test)
4500 (http://example.com/(test))
4502 (http://example.com/(test)))))
4504 http://example.com/a)b
4506 [http://example.com) foo]
4507 !! html/php
4508 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4509 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4510 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4511 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4512 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4513 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4514 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4515 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4516 </p>
4517 !! html/parsoid
4518 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4519 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4520 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4521 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4522 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4523 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4524 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4525 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4526 !! end
4528 !! test
4529 Parenthesis in external links, w/ transclusion or comment
4530 !! wikitext
4531 (http://example.com/{{echo|hi}})
4533 (http://example.com<!-- hi -->)
4534 !! html/php
4535 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4536 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4537 </p>
4538 !! html/parsoid
4539 <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>
4541 <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>
4542 !! end
4544 !! test
4545 Replace invalid link targets when serializing
4546 !! options
4547 parsoid=html2wt
4548 !! html
4549 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4550 !! wikitext
4551 [[MediaWiki:Badtitletext|Manual]]
4552 !! end
4555 ### Quotes
4558 !! test
4559 Quotes
4560 !! wikitext
4561 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4563 Normal text. '''''Bold italic text.''''' Normal text.
4564 !! html
4565 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4566 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4567 </p>
4568 !! end
4571 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
4572 # parser strips. The wikitext contains just the first half of the bold
4573 # quote pair.
4574 !! test
4575 Unclosed and unmatched quotes
4576 !! wikitext
4577 '''''Bold italic text '''with bold deactivated''' in between.'''''
4579 '''''Bold italic text ''with italic deactivated'' in between.'''''
4581 '''Bold text..
4583 ..spanning two paragraphs (should not work).'''
4585 '''Bold tag left open
4587 ''Italic tag left open
4589 Normal text.
4591 <!-- Unmatching number of opening, closing tags: -->
4592 '''This year''''s election ''should'' beat '''last year''''s.
4594 ''Tom'''s car is bigger than ''Susan'''s.
4596 Plain ''italic'''s plain
4597 !! html/php
4598 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4599 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4600 </p><p><b>Bold text..</b>
4601 </p><p>..spanning two paragraphs (should not work).
4602 </p><p><b>Bold tag left open</b>
4603 </p><p><i>Italic tag left open</i>
4604 </p><p>Normal text.
4605 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4606 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4607 </p><p>Plain <i>italic'</i>s plain
4608 </p>
4609 !! html/parsoid
4610 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
4611 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
4612 </p><p><b>Bold text..</b>
4613 </p><p>..spanning two paragraphs (should not work).<b></b>
4614 </p><p><b>Bold tag left open</b>
4615 </p><p><i>Italic tag left open</i>
4616 </p><p>Normal text.
4617 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
4618 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
4619 </p><p>Plain <i>italic'</i>s plain
4620 </p>
4621 !! end
4624 ### Tables
4626 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
4629 # This should not produce <table></table> as <table><tr><td></td></tr></table>
4630 # is the bare minimum required by the spec, see:
4631 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
4632 # Parsoid team replies: empty table tags are legal in HTML5
4633 !! test
4634 A table with no data.
4635 !! options
4636 parsoid=wt2html
4637 !! wikitext
4638 {||}
4639 !! html/php
4641 !! html/parsoid
4642 <table></table>
4644 !! end
4646 !! test
4647 A table with stray table end tags on start tag line (wt2html)
4648 !! options
4649 parsoid=wt2html
4650 !! wikitext
4651 {|style="color: red;"|}
4653 {|style="color: red;" |}
4654 |foo
4657 {|style="color: red;"|} id="foo"
4658 |foo
4661 {|style="color: red;" |} id="foo"
4662 |foo
4664 !! html
4665 <table style="color: red;"></table>
4667 <table style="color: red;">
4668 <tbody><tr>
4669 <td>foo</td>
4670 </tr></tbody>
4671 </table>
4673 <table style="color: red;" id="foo">
4674 <tbody><tr>
4675 <td>foo</td>
4676 </tr></tbody>
4677 </table>
4679 <table style="color: red;" id="foo">
4680 <tbody><tr>
4681 <td>foo</td>
4682 </tr></tbody>
4683 </table>
4685 !! end
4687 !! test
4688 A table with no data (take 2)
4689 !! wikitext
4692 !! html/parsoid
4693 <table></table>
4694 !! end
4696 # A table with nothing but a caption is invalid XHTML, we might want to render
4697 # this as <p>caption</p>
4698 # Parsoid team replies: table with only a caption is legal in HTML5
4699 !! test
4700 A table with nothing but a caption
4701 !! wikitext
4703 |+ caption
4705 !! html/php
4706 <table>
4707 <caption> caption
4708 </caption><tr><td></td></tr></table>
4710 !! html/parsoid
4711 <table><caption> caption</caption></table>
4712 !! end
4714 !! test
4715 A table with caption with default-spaced attributes and a table row
4716 !! wikitext
4718 |+ style="color: red;" | caption1
4720 | foo
4722 !! html
4723 <table>
4724 <caption style="color: red;"> caption1
4725 </caption>
4726 <tr>
4727 <td> foo
4728 </td></tr></table>
4730 !! end
4732 !! test
4733 A table with captions with non-default spaced attributes and a table row
4734 !! wikitext
4736 |+style="color: red;"|caption2
4737 |+ style="color: red;"| caption3
4739 | foo
4741 !! html
4742 <table>
4743 <caption style="color: red;">caption2
4744 </caption>
4745 <caption style="color: red;"> caption3
4746 </caption>
4747 <tr>
4748 <td> foo
4749 </td></tr></table>
4751 !! end
4753 !! test
4754 Table td-cell syntax variations
4755 !! wikitext
4757 | foo bar foo | baz
4758 | foo bar foo || baz
4759 | style='color:red;' | baz
4760 | style='color:red;' || baz
4762 !! html
4763 <table>
4764 <tr>
4765 <td> baz
4766 </td>
4767 <td> foo bar foo </td>
4768 <td> baz
4769 </td>
4770 <td style="color:red;"> baz
4771 </td>
4772 <td> style='color:red;' </td>
4773 <td> baz
4774 </td></tr></table>
4776 !! end
4778 !! test
4779 Simple table
4780 !! wikitext
4782 | 1 || 2
4784 | 3 || 4
4786 !! html
4787 <table>
4788 <tr>
4789 <td> 1 </td>
4790 <td> 2
4791 </td></tr>
4792 <tr>
4793 <td> 3 </td>
4794 <td> 4
4795 </td></tr></table>
4797 !! end
4799 !! test
4800 Simple table but with multiple dashes for row wikitext
4801 !! wikitext
4803 | foo
4804 |-----
4805 | bar
4807 !! html
4808 <table>
4809 <tr>
4810 <td> foo
4811 </td></tr>
4812 <tr>
4813 <td> bar
4814 </td></tr></table>
4816 !! end
4817 !! test
4818 Multiplication table
4819 !! wikitext
4820 {| border="1" cellpadding="2"
4821 |+Multiplication table
4823 ! &times; !! 1 !! 2 !! 3
4825 ! 1
4826 | 1 || 2 || 3
4828 ! 2
4829 | 2 || 4 || 6
4831 ! 3
4832 | 3 || 6 || 9
4834 ! 4
4835 | 4 || 8 || 12
4837 ! 5
4838 | 5 || 10 || 15
4840 !! html
4841 <table border="1" cellpadding="2">
4842 <caption>Multiplication table
4843 </caption>
4844 <tr>
4845 <th> &#215; </th>
4846 <th> 1 </th>
4847 <th> 2 </th>
4848 <th> 3
4849 </th></tr>
4850 <tr>
4851 <th> 1
4852 </th>
4853 <td> 1 </td>
4854 <td> 2 </td>
4855 <td> 3
4856 </td></tr>
4857 <tr>
4858 <th> 2
4859 </th>
4860 <td> 2 </td>
4861 <td> 4 </td>
4862 <td> 6
4863 </td></tr>
4864 <tr>
4865 <th> 3
4866 </th>
4867 <td> 3 </td>
4868 <td> 6 </td>
4869 <td> 9
4870 </td></tr>
4871 <tr>
4872 <th> 4
4873 </th>
4874 <td> 4 </td>
4875 <td> 8 </td>
4876 <td> 12
4877 </td></tr>
4878 <tr>
4879 <th> 5
4880 </th>
4881 <td> 5 </td>
4882 <td> 10 </td>
4883 <td> 15
4884 </td></tr></table>
4886 !! end
4888 !! test
4889 Accept "||" in table headings
4890 !! wikitext
4892 !h1 || h2
4894 !! html
4895 <table>
4896 <tr>
4897 <th>h1 </th>
4898 <th> h2
4899 </th></tr></table>
4901 !! end
4903 !! test
4904 Accept "!!" in table data
4905 !! wikitext
4907 | Foo!! ||
4909 !! html/parsoid
4910 <table data-parsoid='{}'>
4911 <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>
4912 </tbody></table>
4913 !! end
4915 !! test
4916 Accept "||" in indented table headings
4917 !! wikitext
4919 !h1 || h2
4921 !! html
4922 <dl><dd><table>
4923 <tr>
4924 <th>h1 </th>
4925 <th> h2
4926 </th></tr></table></dd></dl>
4928 !! end
4930 !! test
4931 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
4932 !! wikitext
4934 !| h1
4935 || a
4937 !! html
4938 <table>
4939 <tr>
4940 <th> h1
4941 </th>
4942 <td> a
4943 </td></tr></table>
4945 !! end
4947 !!test
4948 Accept "| !" at start of line in tables (ignore !-attribute)
4949 !! wikitext
4952 | !style="color:red" | bar
4954 !! html
4955 <table>
4957 <tr>
4958 <td> bar
4959 </td></tr></table>
4961 !!end
4963 !!test
4964 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 +/- 
4965 !! wikitext
4968 |style='color:red;'|+1
4969 |style='color:blue;'|-1
4971 | 1 || 2 || 3
4972 | 1 ||+2 ||-3
4974 | +1
4975 | -1
4977 !! html
4978 <table>
4980 <tr>
4981 <td style="color:red;">+1
4982 </td>
4983 <td style="color:blue;">-1
4984 </td></tr>
4985 <tr>
4986 <td> 1 </td>
4987 <td> 2 </td>
4988 <td> 3
4989 </td>
4990 <td> 1 </td>
4991 <td>+2 </td>
4992 <td>-3
4993 </td></tr>
4994 <tr>
4995 <td> +1
4996 </td>
4997 <td> -1
4998 </td></tr></table>
5000 !!end
5002 !! test
5003 Table rowspan
5004 !! wikitext
5005 {| border=1
5006 | Cell 1, row 1
5007 |rowspan=2| Cell 2, row 1 (and 2)
5008 | Cell 3, row 1
5010 | Cell 1, row 2
5011 | Cell 3, row 2
5013 !! html
5014 <table border="1">
5015 <tr>
5016 <td> Cell 1, row 1
5017 </td>
5018 <td rowspan="2"> Cell 2, row 1 (and 2)
5019 </td>
5020 <td> Cell 3, row 1
5021 </td></tr>
5022 <tr>
5023 <td> Cell 1, row 2
5024 </td>
5025 <td> Cell 3, row 2
5026 </td></tr></table>
5028 !! end
5030 !! test
5031 Nested table
5032 !! wikitext
5033 {| border=1
5034 | &alpha;
5036 {| bgcolor=#ABCDEF border=2
5037 |nested
5039 |table
5041 |the original table again
5043 !! html
5044 <table border="1">
5045 <tr>
5046 <td> &#945;
5047 </td>
5048 <td>
5049 <table bgcolor="#ABCDEF" border="2">
5050 <tr>
5051 <td>nested
5052 </td></tr>
5053 <tr>
5054 <td>table
5055 </td></tr></table>
5056 </td>
5057 <td>the original table again
5058 </td></tr></table>
5060 !! end
5062 !! test
5063 Invalid attributes in table cell (bug 1830)
5064 !! wikitext
5066 |Cell:|broken
5068 !! html
5069 <table>
5070 <tr>
5071 <td>broken
5072 </td></tr></table>
5074 !! end
5077 # The "|}" to close the table is missing from the input, so parsoid's
5078 # *2wt modes will fail.
5079 !! test
5080 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5081 !! options
5082 parsoid=wt2html,html2html
5083 !! wikitext
5085 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5086 !! html/php
5087 <table>
5088 <tr>
5089 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5090 <td>]" onmouseover="alert(document.cookie)"&gt;test
5091 </td>
5092 </tr>
5093 </table>
5095 !! html/parsoid
5096 <table><tbody>
5097 <tr>
5098 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5099 !! end
5102 !! test
5103 Indented table markup mixed with indented pre content (proposed in bug 6200)
5104 !! wikitext
5105  <table>
5106  <tr>
5107  <td>
5108  Text that should be rendered preformatted
5109  </td>
5110  </tr>
5111  </table>
5112 !! html
5113  <table>
5114  <tr>
5115  <td>
5116 <pre>Text that should be rendered preformatted
5117 </pre>
5118  </td>
5119  </tr>
5120  </table>
5122 !! end
5124 !! test
5125 Template-generated table cell attributes and cell content
5126 !! wikitext
5128 |{{table_attribs}}
5129 | {{table_attribs}}
5131 !! html
5132 <table>
5133 <tr>
5134 <td style="color: red"> Foo
5135 </td>
5136 <td style="color: red"> Foo
5137 </td></tr></table>
5139 !! end
5141 !! test
5142 Template-generated table cell attributes and cell content (2)
5143 !! wikitext
5145 |align=center {{table_attribs}}
5147 !! html
5148 <table>
5149 <tr>
5150 <td align="center" style="color: red"> Foo
5151 </td></tr></table>
5153 !! end
5155 !! test
5156 Template-generated table cell attributes and cell content (3)
5157 !! wikitext
5159 |align=center {{table_cells}}
5161 !! html
5162 <table>
5163 <tr>
5164 <td align="center" style="color: red"> Foo </td>
5165 <td> Bar </td>
5166 <td> Baz
5167 </td></tr></table>
5169 !! end
5171 !! test
5172 Table with row followed by newlines and table heading
5173 !! wikitext
5177 ! foo
5179 !! html
5180 <table>
5183 <tr>
5184 <th> foo
5185 </th></tr></table>
5187 !! end
5189 !! test
5190 Table with empty line following the start tag
5191 !! wikitext
5195 | foo
5197 !! html
5198 <table>
5201 <tr>
5202 <td> foo
5203 </td></tr></table>
5205 !! end
5207 # FIXME: Preserve the attribute properly (with an empty string as value) in
5208 # the PHP parser. Parsoid implements the behavior below.
5209 !! test
5210 Table attributes with empty value
5211 !! wikitext
5213 | style=| hello
5215 !! html/parsoid
5216 <table>
5217 <tbody>
5218 <tr>
5219 <td style=""> hello
5220 </td></tr></tbody></table>
5222 !! end
5224 !! test
5225 Wikitext table with a lot of comments
5226 !! wikitext
5228 <!-- c0 -->
5229 | foo
5230 <!-- c1 -->
5231 |- <!-- c2 -->
5232 <!-- c3 -->
5233 |<!-- c4 -->
5234 <!-- c5 -->
5236 !! html
5237 <table>
5238 <tr>
5239 <td> foo
5240 </td></tr>
5241 <tr>
5242 <td>
5243 </td></tr></table>
5245 !! end
5247 !! test
5248 Wikitext table with double-line table cell
5249 !! wikitext
5254 !! html
5255 <table>
5256 <tr>
5257 <td>a
5258 <p>b
5259 </p>
5260 </td></tr></table>
5262 !! end
5264 !! test
5265 Table cell with a single comment
5266 !! wikitext
5268 | <!-- c1 -->
5269 | a
5271 !! html
5272 <table>
5273 <tr>
5274 <td>
5275 </td>
5276 <td> a
5277 </td></tr></table>
5279 !! end
5281 !! test
5282 Table-cell after a comment-only-empty-line
5283 !! wikitext
5286 <!--c1-->
5287 <!--c2-->| b
5289 !! html/parsoid
5290 <table>
5291 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5292 <!--c1-->
5293 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5294 </tbody></table>
5296 !! end
5298 # The expected HTML structure in this test is debatable. The PHP parser does
5299 # not parse this kind of table at all. The main focus for Parsoid is on
5300 # round-tripping, so this output is ok for now. TODO: revisit!
5301 !! test
5302 Wikitext table with html-syntax row
5303 !! wikitext
5306 <td>foo</td>
5308 !! html/parsoid
5309 <table>
5310 <tbody>
5311 <tr>
5312 <td>foo</td></tr></tbody></table>
5313 !! end
5315 !! test
5316 Implicit <td> after a |-
5317 (PHP parser relies on Tidy to add the missing <td> tags)
5318 !! options
5319 parsoid=wt2html,wt2wt
5320 !! wikitext
5325 !! html
5326 <table>
5327 <tr><td>a</td></tr>
5328 </table>
5329 !! end
5331 !! test
5332 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
5333 (PHP parser relies on Tidy to add the missing <td> tags)
5334 !! options
5335 parsoid=wt2html,wt2wt
5336 !! wikitext
5344 !! html
5345 <table>
5346 <tbody>
5347 <tr><td><pre>a</pre></td></tr>
5348 <tr><td> b</td></tr>
5349 </tbody>
5350 </table>
5351 !! end
5353 !! test
5354 Lists should be recognized in an implicit <td> context
5355 (PHP parser relies on Tidy to add the missing <td> tags)
5356 !! options
5357 parsoid=wt2html,wt2wt
5358 !! wikitext
5363 !! html
5364 <table>
5365 <tr>
5366 <td><ul>
5367 <li>a</li>
5368 </ul></td>
5369 </tr>
5370 </table>
5371 !! end
5373 !! test
5374 Parsoid: Round-trip tables directly followed by content (bug 51219)
5375 !! options
5376 parsoid=wt2html,wt2wt
5377 !! wikitext
5379 |foo
5380 |} bar
5383 |baz
5384 |}<b>quux</b>
5385 !! html
5386 <table><tbody>
5387 <tr>
5388 <td>foo</td></tr></tbody></table> bar
5389 <table>
5390 <tbody>
5391 <tr>
5392 <td>baz</td></tr></tbody></table><b>quux</b>
5393 !! end
5395 !! test
5396 Parsoid: Default to a newline after tables in new content (bug 51219)
5397 !! options
5398 parsoid=html2wt
5399 !! wikitext
5401 |foo
5403 <nowiki> </nowiki>bar
5405 |baz
5407 '''quux'''
5408 !! html
5409 <table><tbody>
5410 <tr><td>foo</td></tr></tbody></table> bar
5411 <table><tbody>
5412 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5413 !! end
5415 !! test
5416 Parsoid: newline inducing block nodes don't suppress <nowiki>
5417 !! options
5418 parsoid=html2wt
5419 !! wikitext
5420 <nowiki> </nowiki>a
5422 = foo =
5423 !! html
5424  a<h1>foo</h1>
5425 !! end
5427 !! test
5428 Parsoid: Row-syntax table headings followed by comment & table cells
5429 !! options
5430 parsoid=wt2html,wt2wt
5431 !! wikitext
5433 ! foo || bar
5434 <!-- foo -->  || baz || quux
5436 !! html/parsoid
5437 <table>
5438 <tbody>
5439 <tr><th>foo </th><th>bar  </th>
5440 <td>baz </td>
5441 <td>quux</td></tr></tbody></table>
5442 !! end
5445 !!test
5446 Parsoid: Recover better from broken table attributes
5447 !!options
5448 parsoid=wt2html
5449 !!wikitext
5450 {| class="foo
5451 | class="bar" |
5454 !!html/parsoid
5455 <table class="foo">
5456 <tr>
5457 <td class="bar">
5458 <p>foo</p></td></tr>
5459 </tbody></table>
5460 !!end
5462 !! test
5463 Strip unsupported table tags
5464 !! options
5465 parsoid=html2wt
5466 !! html
5467 <table>
5468 <thead>
5469 <tr>
5470 <th>Month</th>
5471 <th>Savings</th>
5472 </tr>
5473 </thead>
5474 <tbody>
5475 <tr>
5476 <td>January</td>
5477 <td>$100</td>
5478 </tr>
5479 <tr>
5480 <td>February</td>
5481 <td>$80</td>
5482 </tr>
5483 </tbody>
5484 <tfoot>
5485 <tr>
5486 <td>Sum</td>
5487 <td>$180</td>
5488 </tr>
5489 </tfoot>
5490 </table>
5491 !! wikitext
5494 !Month
5495 !Savings
5497 |January
5498 |$100
5501 |February
5502 |$80
5504 |Sum
5505 |$180
5508 !! end
5511 ### Internal links
5513 !! test
5514 Plain link, capitalized
5515 !! wikitext
5516 [[Main Page]]
5517 !! html
5518 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5519 </p>
5520 !! end
5522 !! test
5523 Plain link, uncapitalized
5524 !! wikitext
5525 [[main Page]]
5526 !! html
5527 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
5528 </p>
5529 !! end
5531 !! test
5532 Piped link
5533 !! wikitext
5534 [[Main Page|The Main Page]]
5535 !! html
5536 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5537 </p>
5538 !! end
5540 !! test
5541 Piped link with comment in link text
5542 !! wikitext
5543 [[Main Page|The Main<!--front--> Page]]
5544 !! html
5545 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
5546 </p>
5547 !! end
5549 !! test
5550 Piped link with multiple pipe characters in link text
5551 !! wikitext
5552 [[Main Page||The|Main|Page|]]
5553 !! html/php
5554 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
5555 </p>
5556 !! html/parsoid
5557 <p><a rel="mw:WikiLink" href="Main_Page">|The|Main|Page|</a></p>
5558 !! end
5560 !! test
5561 Broken link
5562 !! wikitext
5563 [[Zigzagzogzagzig]]
5564 !! html
5565 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
5566 </p>
5567 !! end
5569 !! test
5570 Broken link with fragment
5571 !! wikitext
5572 [[Zigzagzogzagzig#zug]]
5573 !! html
5574 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
5575 </p>
5576 !! end
5578 !! test
5579 Special page link with fragment
5580 !! wikitext
5581 [[Special:Version#anchor]]
5582 !! html
5583 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
5584 </p>
5585 !! end
5587 !! test
5588 Nonexistent special page link with fragment
5589 !! wikitext
5590 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
5591 !! html
5592 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
5593 </p>
5594 !! end
5596 !! test
5597 Link with prefix
5598 !! wikitext
5599 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
5600 !! html
5601 <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>
5602 </p>
5603 !! end
5605 !! test
5606 Link with suffix
5607 !! wikitext
5608 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
5609 !! html
5610 <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>!!!
5611 </p>
5612 !! end
5614 !! article
5615 prefixed article
5616 !! text
5617 Some text
5618 !! endarticle
5620 !! test
5621 Bug 43661: Piped links with identical prefixes
5622 !! wikitext
5623 [[prefixed article|prefixed articles with spaces]]
5625 [[prefixed article|prefixed articlesaoeu]]
5627 [[Main Page|Main Page test]]
5628 !! html
5629 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
5630 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
5631 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
5632 </p>
5633 !! end
5636 !! test
5637 Link with HTML entity in suffix / tail
5638 !! wikitext
5639 [[Main Page]]&quot;, [[Main Page]]&#97;
5640 !! html
5641 <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;
5642 </p>
5643 !! end
5645 !! test
5646 Link with 3 brackets
5647 !! wikitext
5648 [[[Main Page]]]
5649 !! html
5650 <p>[[[Main Page]]]
5651 </p>
5652 !! end
5654 !! test
5655 Link with 4 brackets
5656 !! wikitext
5657 [[[[Main Page]]]]
5658 !! html
5659 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
5660 </p>
5661 !! end
5663 !! test
5664 Piped link with 3 brackets
5665 !! wikitext
5666 [[[main page|the main page]]]
5667 !! html
5668 <p>[[[main page|the main page]]]
5669 </p>
5670 !! end
5672 !! test
5673 Piped link with extlink-like text
5674 !! wikitext
5675 [[Main Page|[bar]]]
5676 [[Main Page|This is a [bar]]]
5677 !! html
5678 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
5679 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
5680 </p>
5681 !! end
5683 !! test
5684 Link with multiple pipes
5685 !! wikitext
5686 [[Main Page|The|Main|Page]]
5687 !! html
5688 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
5689 </p>
5690 !! end
5692 # Note that parsoid does not munge anchor text; all non-space
5693 # characters are valid in HTML5 ids.
5694 !! test
5695 Anchor containing a #. (bug 63430)
5696 !! wikitext
5697 [[Main Page#And#Link]]
5698 !! html/php
5699 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
5700 </p>
5701 !! html/parsoid
5702 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link">Main Page#And#Link</a></p>
5703 !! end
5705 !! test
5706 Link to namespaces
5707 !! wikitext
5708 [[Talk:Parser testing]], [[Meta:Disclaimers]]
5709 !! html
5710 <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>
5711 </p>
5712 !! end
5714 !! test
5715 Link with space in namespace
5716 !! wikitext
5717 [[User talk:Foo bar]]
5718 !! html
5719 <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>
5720 </p>
5721 !! end
5723 !! article
5724 MemoryAlpha:AlphaTest
5725 !! text
5726 This is an article in the MemoryAlpha namespace
5727 (which shadows the memoryalpha interwiki link).
5728 !! endarticle
5730 !! test
5731 Namespace takes precedence over interwiki link (bug 51680)
5732 !! wikitext
5733 [[MemoryAlpha:AlphaTest]]
5734 !! html
5735 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5736 </p>
5737 !! end
5739 # The previous test doesn't work correctly in html2*, due to not recognizing the
5740 # link as an internal one. This one checks for the correct behavior.
5741 !! test
5742 Link to namespace preferred over interwiki with correct rel attribute
5743 !! options
5744 parsoid=html2wt,html2html
5745 !! wikitext
5746 [[MemoryAlpha:AlphaTest]]
5747 !! html
5748 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
5749 </p>
5750 !! end
5752 !! test
5753 Piped link to namespace
5754 !! wikitext
5755 [[Meta:Disclaimers|The disclaimers]]
5756 !! html
5757 <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>
5758 </p>
5759 !! end
5761 !! test
5762 Link containing }
5763 !! wikitext
5764 [[Usually caused by a typo (oops}]]
5765 !! html
5766 <p>[[Usually caused by a typo (oops}]]
5767 </p>
5768 !! end
5770 !! article
5771 7% Solution
5772 !! text
5773 Just a test of an article title containing a percent.
5774 !! endarticle
5776 !! test
5777 Link containing % (not as a hex sequence)
5778 !! wikitext
5779 [[7% Solution]]
5780 !! html/php
5781 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5782 </p>
5783 !! html/parsoid
5784 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5785 !! end
5787 # note that the parsoid HTML is identical to the previous test output,
5788 # so the previous test ensures that the html2wt mode will generate the
5789 # "not as a hex sequence" wikitext.
5790 !! test
5791 Link containing % as a single hex sequence interpreted to char
5792 !! options
5793 parsoid=wt2wt,wt2html,html2html
5794 !! wikitext
5795 [[7%25 Solution]]
5796 !! html/php
5797 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
5798 </p>
5799 !! html/parsoid
5800 <p><a rel="mw:WikiLink" href="./7%25_Solution">7% Solution</a></p>
5801 !!end
5803 !! test
5804 Link containing % as a double hex sequence interpreted to hex sequence
5805 !! wikitext
5806 [[7%2525 Solution]]
5807 !! html
5808 <p>[[7%2525 Solution]]
5809 </p>
5810 !!end
5812 # note that parsoid does not munge anchor text; all non-space
5813 # characters are valid in HTML5 anchors.
5814 !! test
5815 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
5816 Example for such a section: == < ==
5817 !! wikitext
5818 [[%23%3c]][[%23%3e]]
5819 !! html/php
5820 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
5821 </p>
5822 !! html/parsoid
5823 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E">#></a></p>
5824 !! end
5826 !! test
5827 Link containing "<#" and ">#" as a hex sequences
5828 !! wikitext
5829 [[%3c%23]][[%3e%23]]
5830 !! html
5831 <p>[[%3c%23]][[%3e%23]]
5832 </p>
5833 !! end
5835 !! test
5836 Link containing an equals sign
5837 !! wikitext
5838 [[Special:BookSources/isbn=4-00-026157-6]]
5839 !! html/php
5840 <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>
5841 </p>
5842 !! html/parsoid
5843 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
5844 !! end
5846 !! article
5847 Foo~bar
5848 !! text
5849 Just a test of an article title containing a tilde.
5850 !! endarticle
5852 # note that links containing signatures, like [[Foo~~~~]], are
5853 # massaged by the pre-save transform (PST) and so the tildes are never
5854 # seen by the parser.
5855 !! test
5856 Link containing a tilde
5857 !! wikitext
5858 [[Foo~bar]]
5859 !! html/php
5860 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
5861 </p>
5862 !! html/parsoid
5863 <p><a rel="mw:WikiLink" href="./Foo~bar">Foo~bar</a></p>
5864 !! end
5866 !! test
5867 Link containing double-single-quotes '' (bug 4598)
5868 !! wikitext
5869 [[Lista d''e paise d''o munno]]
5870 !! html/php
5871 <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>
5872 </p>
5873 !! html/parsoid
5874 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno">Lista d''e paise d''o munno</a></p>
5875 !! end
5877 !! test
5878 Link containing double-single-quotes '' in text (bug 4598 sanity check)
5879 !! wikitext
5880 Some [[Link|pretty ''italics'' and stuff]]!
5881 !! html/php
5882 <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>!
5883 </p>
5884 !! html/parsoid
5885 <p>Some <a rel="mw:WikiLink" href="Link">pretty <i>italics</i> and stuff</a>!</p>
5886 !! end
5888 !! test
5889 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
5890 !! wikitext
5891 ''Some [[Link|pretty ''italics'' and stuff]]!''
5892 !! html
5893 <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>
5894 </p>
5895 !! end
5897 !! test
5898 Link with double quotes in title part (literal) and alternate part (interpreted)
5899 !! wikitext
5900 [[File:Denys Savchenko ''Pentecoste''.jpg]]
5902 [[''Pentecoste'']]
5904 [[''Pentecoste''|Pentecoste]]
5906 [[''Pentecoste''|''Pentecoste'']]
5907 !! html/php
5908 <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>
5909 </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>
5910 </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>
5911 </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>
5912 </p>
5913 !! html/parsoid
5914 <meta typeof="mw:Placeholder"/>
5915 <p><a rel="mw:WikiLink" href="''Pentecoste''">''Pentecoste''</a></p>
5916 <p><a rel="mw:WikiLink" href="''Pentecoste''">Pentecoste</a></p>
5917 <p><a rel="mw:WikiLink" href="''Pentecoste''"><i>Pentecoste</i></a></p>
5918 !! end
5920 !! test
5921 Broken image links with HTML captions (bug 39700)
5922 !! wikitext
5923 [[File:Nonexistent|<script></script>]]
5924 [[File:Nonexistent|100px|<script></script>]]
5925 [[File:Nonexistent|&lt;]]
5926 [[File:Nonexistent|a<i>b</i>c]]
5927 !! html
5928 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5929 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
5930 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
5931 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
5932 </p>
5933 !! end
5935 !! test
5936 Plain link to URL
5937 !! wikitext
5938 [[http://www.example.com]]
5939 !! html/php
5940 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
5941 </p>
5942 !! html/parsoid
5943 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
5944 !! end
5946 !! test
5947 Plain link to URL with link text
5948 !! wikitext
5949 [[http://www.example.com Link text]]
5950 !! html
5951 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
5952 </p>
5953 !! end
5955 !! test
5956 Plain link to protocol-relative URL
5957 !! wikitext
5958 [[//www.example.com]]
5959 !! html/php
5960 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
5961 </p>
5962 !! html/parsoid
5963 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
5964 !! end
5966 !! test
5967 Plain link to protocol-relative URL with link text
5968 !! wikitext
5969 [[//www.example.com Link text]]
5970 !! html
5971 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
5972 </p>
5973 !! end
5975 !! test
5976 Plain link to page with question mark in title
5977 !! wikitext
5978 [[A?b]]
5980 [[A?b|Baz]]
5981 !! html
5982 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
5983 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
5984 </p>
5985 !! end
5988 # I'm fairly sure the expected result here is wrong.
5989 # We want these to be URL links, not pseudo-pages with URLs for titles....
5990 # However the current output is also pretty screwy.
5992 # ----
5993 # I'm changing it to match the current output--it arguably makes more
5994 # sense in the light of the test above. Old expected result was:
5995 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
5996 #</p>
5997 # But I think this test is bordering on "garbage in, garbage out" anyway.
5998 # -- wtm
5999 !! test
6000 Piped link to URL
6001 !! wikitext
6002 Piped link to URL: [[http://www.example.com|an example URL]]
6003 !! html/php
6004 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6005 </p>
6006 !! html/parsoid
6007 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6008 !! end
6010 !! test
6011 BUG 2: [[page|http://url/]] should link to page, not http://url/
6012 !! wikitext
6013 [[Main Page|http://url/]]
6014 !! html/php
6015 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6016 </p>
6017 !! html/parsoid
6018 <p><a rel="mw:WikiLink" href="./Main_Page">http://url/</a></p>
6019 !! end
6021 # Parsoid does not mark self-links, by design.
6022 !! test
6023 BUG 337: Escaped self-links should be bold
6024 !! options
6025 title=[[Bug462]]
6026 !! wikitext
6027 [[Bu&#103;462]] [[Bug462]]
6028 !! html/php
6029 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6030 </p>
6031 !! html/parsoid
6032 <p><a rel="mw:WikiLink" href="./Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462">Bug462</a></p>
6033 !! end
6035 !! test
6036 Self-link to section should not be bold
6037 !! options
6038 title=[[Main Page]]
6039 !! wikitext
6040 [[Main Page#section]]
6041 !! html
6042 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6043 </p>
6044 !! end
6046 !! article
6048 !! text
6049 This is 00.
6050 !! endarticle
6052 !!test
6053 Self-link to numeric title
6054 !!options
6055 title=[[0]]
6056 !! wikitext
6057 [[0]]
6058 !! html
6059 <p><strong class="selflink">0</strong>
6060 </p>
6061 !!end
6063 !!test
6064 Link to numeric-equivalent title
6065 !!options
6066 title=[[0]]
6067 !! wikitext
6068 [[00]]
6069 !! html
6070 <p><a href="/wiki/00" title="00">00</a>
6071 </p>
6072 !!end
6074 !! test
6075 <nowiki> inside a link
6076 !! wikitext
6077 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6078 !! html
6079 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6080 </p>
6081 !! end
6083 !! test
6084 Non-breaking spaces in title
6085 !! wikitext
6086 [[&nbsp; Main &nbsp; Page &nbsp;]]
6087 !! html
6088 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6089 </p>
6090 !!end
6092 !! test
6093 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6094 !! options
6095 language=ca
6096 !! wikitext
6097 '''[[Main Page]]'''
6098 !! html
6099 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6100 </p>
6101 !! end
6103 !! test
6104 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6105 !! options
6106 language=ca
6107 !! wikitext
6108 ''[[Main Page]]''
6109 !! html
6110 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6111 </p>
6112 !! end
6114 !! test
6115 Internal link with en linktrail: no apostrophes (bug 27473)
6116 !! options
6117 language=en
6118 !! wikitext
6119 [[Something]]'nice
6120 !! html
6121 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6122 </p>
6123 !! end
6125 !! test
6126 Internal link with ca linktrail with apostrophes (bug 27473)
6127 !! options
6128 language=ca
6129 !! wikitext
6130 [[Something]]'nice
6131 !! html
6132 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6133 </p>
6134 !! end
6136 !! test
6137 Internal link with kaa linktrail with apostrophes (bug 27473)
6138 !! options
6139 language=kaa
6140 !! wikitext
6141 [[Something]]'nice
6142 !! html
6143 <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>
6144 </p>
6145 !! end
6147 !! test
6148 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6149 !! wikitext
6150 [[User:Foo/Test/63636:Bar|Test]]
6151 !! html/php
6152 <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>
6153 </p>
6154 !! html/parsoid
6155 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar">Test</a></p>
6156 !! end
6158 !! test
6159 Purely hash wikilink
6160 !! options
6161 title=[[User:test/123]]
6162 !! wikitext
6163 [[#a|b]]
6164 !! html/parsoid
6165 <p data-parsoid='{}'><a rel="mw:WikiLink" href="../User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"../User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
6166 !! end
6168 !! test
6169 1. Interaction of linktrail and template encapsulation
6170 !! options
6171 parsoid
6172 !! wikitext
6173 {{echo|[[Foo]]}}l
6174 !! html
6175 <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>
6176 !! end
6178 !! test
6179 2. Interaction of linktrail and template encapsulation
6180 !! options
6181 parsoid
6182 !! wikitext
6183 {{echo|Some [[Fool]]}}s
6184 !! html
6185 <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>
6186 !! end
6188 !! test
6189 3. Interaction of linktrail and template encapsulation
6190 !! options
6191 parsoid
6192 !! wikitext
6193 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6194 !! html
6195 <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>
6196 !! end
6198 !! article
6199 Söfnuður
6200 !! text
6201 Test.
6202 !! endarticle
6204 !! test
6205 Internal link with is link prefix
6206 !! options
6207 language=is
6208 !! wikitext
6209 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6210 !! html
6211 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6212 </p>
6213 !! end
6215 !! article
6216 Mótmælendatrú
6217 !! text
6218 Test.
6219 !! endarticle
6221 !! test
6222 Internal link with is link trail and link prefix
6223 !! options
6224 language=is
6225 !! wikitext
6226 [[mótmælendatrú|xxx]]ar
6227 [[mótmælendatrú]]ar
6228 mótmælenda[[söfnuður]]
6229 mótmælenda[[söfnuður|söfnuðir]]
6230 mótmælenda[[söfnuður|söfnuðir]]xxx
6231 !! html
6232 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6233 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6234 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6235 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6236 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6237 </p>
6238 !! end
6240 !! test
6241 Parsoid link trail escaping
6242 !! options
6243 parsoid=html2wt,html2html
6244 !! wikitext
6245 [[apple]]<nowiki/>s
6246 !! html
6247 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
6248 !! end
6250 !! test
6251 Parsoid link prefix escaping
6252 !! options
6253 language=is
6254 parsoid=html2wt,html2html
6255 !! wikitext
6256 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6257 !! html
6258 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
6259 !! end
6261 !! test
6262 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6263 !! wikitext
6264 [[Foo|  bar]]
6266 [[Foo|  ''bar'']]
6268 [http://wp.org   foo]
6270 [http://wp.org   ''foo'']
6271 !! html
6272 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
6273 </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>
6274 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6275 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6276 </p>
6277 !! end
6279 !! test
6280 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6281 !! options
6282 parsoid
6283 !! wikitext
6284 [[Foo|{{echo|a}} b {{echo|c}}]]
6285 !! html
6286 <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>
6287 !! end
6289 !! test
6290 Link with angle bracket after anchor
6291 !! wikitext
6292 [[Foo#<bar>]]
6293 !! html/parsoid
6294 <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>
6295 !! end
6298 ### Interwiki links (see maintenance/interwiki.sql)
6301 !! test
6302 Inline interwiki link
6303 !! wikitext
6304 [[MeatBall:SoftSecurity]]
6305 !! html
6306 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6307 </p>
6308 !! end
6310 !! test
6311 Inline interwiki link with empty title (bug 2372)
6312 !! wikitext
6313 [[MeatBall:]]
6314 !! html
6315 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6316 </p>
6317 !! end
6319 !! test
6320 Interwiki link encoding conversion (bug 1636)
6321 !! wikitext
6322 *[[Wikipedia:ro:Olteni&#0355;a]]
6323 *[[Wikipedia:ro:Olteni&#355;a]]
6324 !! html
6325 <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>
6326 <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>
6328 !! end
6330 !! test
6331 Interwiki link with fragment (bug 2130)
6332 !! wikitext
6333 [[MeatBall:SoftSecurity#foo]]
6334 !! html
6335 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6336 </p>
6337 !! end
6339 # Ideally the wikipedia: prefix here should be proto-relative too
6340 !! test
6341 Different interwiki prefixes mapping to the same URL
6342 !! wikitext
6343 [[:en:Foo]]
6345 [[:en:Foo|Foo]]
6347 [[wikipedia:Foo]]
6349 [[:wikipedia:Foo|Foo]]
6351 [[wikipedia:en:Foo]]
6353 [[:wikipedia:en:Foo]]
6354 !! html/parsoid
6355 <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>
6357 <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>
6359 <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>
6361 <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>
6363 <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>
6365 <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>
6366 !! end
6368 !! test
6369 Interwiki links that cannot be represented in wiki syntax
6370 !! wikitext
6371 [[meatball:ok]]
6372 [[meatball:ok#foo|ok with fragment]]
6373 [[meatball:ok_as_well?|ok ending with ? mark]]
6374 [http://de.wikipedia.org/wiki/Foo?action=history has query]
6375 [http://de.wikipedia.org/wiki/#foo is just fragment]
6377 !! html/parsoid
6378 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok">meatball:ok</a>
6379 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo">ok with fragment</a>
6380 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?">ok ending with ? mark</a>
6381 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
6382 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
6383 !! end
6385 !! test
6386 Interwiki links: trail
6387 !! options
6388 parsoid
6389 !! wikitext
6390 [[wikipedia:Foo|Ba]]r
6391 !! html
6392 <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>
6393 !! end
6396 ### Interlanguage links
6397 ### Language links (so that searching for '### language' matches..)
6400 !! test
6401 Interlanguage link
6402 !! wikitext
6403 Blah blah blah
6404 [[zh:Chinese]]
6405 !! html/php
6406 <p>Blah blah blah
6407 </p>
6408 !! html/parsoid
6409 <p>Blah blah blah
6410 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6411 !! end
6413 !! test
6414 Double interlanguage link
6415 !! wikitext
6416 Blah blah blah
6417 [[es:Spanish]]
6418 [[zh:Chinese]]
6419 !! html/php
6420 <p>Blah blah blah
6421 </p>
6422 !! html/parsoid
6423 <p>Blah blah blah
6424 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6425 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6426 !! end
6428 !! test
6429 Interlanguage link, with prefix links
6430 !! options
6431 language=ln
6432 !! wikitext
6433 Blah blah blah
6434 [[zh:Chinese]]
6435 !! html/php
6436 <p>Blah blah blah
6437 </p>
6438 !! html/parsoid
6439 <p>Blah blah blah
6440 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6441 !! end
6443 !! test
6444 Double interlanguage link, with prefix links (bug 8897)
6445 !! options
6446 language=ln
6447 !! wikitext
6448 Blah blah blah
6449 [[es:Spanish]]
6450 [[zh:Chinese]]
6451 !! html/php
6452 <p>Blah blah blah
6453 </p>
6454 !! html/parsoid
6455 <p>Blah blah blah
6456 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Spanish"/>
6457 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/Chinese"/></p>
6458 !! end
6460 !! test
6461 "Extra" interlanguage links (bug 32189 / gerrit 111390)
6462 !! wikitext
6463 Blah blah blah
6464 [[mul:Article]]
6465 !! html/php
6466 <p>Blah blah blah
6467 </p>
6468 !! html/parsoid
6469 <p>Blah blah blah
6470 <link rel="mw:PageProp/Language" title="Multilingual" href="//wikisource.org/wiki/Article"/></p>
6471 !! end
6473 !! test
6474 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
6475 !! options
6476 language=ln
6477 !! wikitext
6478 [[WW&nbsp;II]]
6479 !! html
6480 <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>
6481 </p>
6482 !! end
6484 !! test
6485 Parsoid bug 53221: Wikilinks should be properly entity-escaped
6486 !! options
6487 parsoid=html2wt
6488 !! wikitext
6489 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
6491 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
6492 !! html
6493 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6494 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
6495 !! end
6497 !! test
6498 Parsoid: handle constructor well
6499 !! options
6500 parsoid
6501 !! wikitext
6502 [[constructor]]
6504 [[constructor:foo]]
6505 !! html
6506 <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>
6508 <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>
6509 !! end
6511 !! test
6512 Parsoid: recognize interlanguage links without a target page
6513 !! options
6514 parsoid
6515 !! wikitext
6516 [[ko:]]
6517 !! html
6518 <p><link rel="mw:PageProp/Language" href="http://ko.wikipedia.org/wiki/"></p>
6519 !! end
6521 !! test
6522 Parsoid: recognize interwiki links without a target page
6523 !! options
6524 parsoid
6525 !! wikitext
6526 [[:ko:]]
6527 !! html
6528 <p><a rel="mw:ExtLink" href="//ko.wikipedia.org/wiki/">ko:</a></p>
6529 !! end
6531 !! test
6532 Parsoid: Bug #45209, handle interwiki links pointing to the current wiki as plain wiki links
6533 !! options
6534 parsoid
6535 !! wikitext
6536 [[en:Foo]]
6537 !! html
6538 <p><a rel="mw:WikiLink" href="./Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"en:Foo"}}'>Foo</a></p>
6539 !! end
6542 ### Redirects, Parsoid-only
6544 !! test
6545 1. Simple redirect to page
6546 !! options
6547 parsoid
6548 !! wikitext
6549 #REDIRECT [[Main Page]]
6550 !! html
6551 <link rel="mw:PageProp/redirect" href="./Main_Page">
6552 !! end
6554 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
6555 !! test
6556 2. Other redirect variants
6557 !! options
6558 parsoid=wt2html,wt2wt
6559 !! wikitext
6560 #REDIRECT [[Main_Page]]
6561 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
6562 !! html
6563 <link rel="mw:PageProp/redirect" href="./Main_Page">
6564 <link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
6565 !! end
6567 !! test
6568 Empty redirect
6569 !! options
6570 parsoid=wt2html,wt2wt
6571 !! wikitext
6572 #REDIRECT [[]]
6573 !! html
6574 <ol>
6575 <li>REDIRECT [[]]</li></ol>
6576 !! end
6578 !! test
6579 Optional colon in #REDIRECT
6580 !! options
6581 # the colon is archaic syntax.  we support it for wt2html, but we
6582 # don't care that it roundtrips back to the modern syntax.
6583 parsoid=wt2html,html2html
6584 !! wikitext
6585 #REDIRECT:[[Main Page]]
6586 !! html
6587 <link rel="mw:PageProp/redirect" href="./Main_Page">
6588 !! end
6590 !! test
6591 Whitespace in #REDIRECT with optional colon
6592 !! options
6593 # the colon and gratuitous whitespace is archaic syntax.  we support
6594 # it for wt2html, but we don't care that it roundtrips back to the
6595 # modern syntax (without extra whitespace)
6596 parsoid=wt2html,html2html
6597 !! wikitext
6599  #REDIRECT 
6601 [[Main Page]]
6602 !! html
6603 <link rel="mw:PageProp/redirect" href="./Main_Page">
6604 !! end
6606 !! test
6607 Piped link in #REDIRECT
6608 !! options
6609 # content after piped link is ignored.  we support this syntax,
6610 # but don't care that the piped link is lost when we roundtrip this.
6611 parsoid=wt2html
6612 !! wikitext
6613 #REDIRECT [[Main Page|bar]]
6614 !! html
6615 <link rel="mw:PageProp/redirect" href="./Main_Page">
6616 !! end
6618 !! test
6619 Redirect to category
6620 !! options
6621 parsoid=wt2html
6622 !! wikitext
6623 #REDIRECT [[Category:Foo]]
6624 !! html
6625 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6626 !! end
6628 !! test
6629 Redirect to category with URL encoding
6630 !! options
6631 parsoid=wt2html
6632 !! wikitext
6633 #REDIRECT [[Category%3AFoo]]
6634 !! html
6635 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
6636 !! end
6638 !! test
6639 Redirect to category page
6640 !! options
6641 parsoid=wt2html,html2html
6642 !! wikitext
6643 #REDIRECT [[:Category:Foo]]
6644 !! html
6645 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
6646 !! end
6648 !! test
6649 Redirect to image page (1)
6650 !! options
6651 parsoid
6652 !! wikitext
6653 #REDIRECT [[File:Wiki.png]]
6654 !! html
6655 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6656 !! end
6658 !! test
6659 Redirect to image page (2)
6660 !! options
6661 parsoid
6662 !! wikitext
6663 #REDIRECT [[Image:Wiki.png]]
6664 !! html
6665 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
6666 !! end
6668 !! test
6669 Redirect to language
6670 !! options
6671 parsoid
6672 !! wikitext
6673 #REDIRECT [[en:File:Wiki.png]]
6674 !! html
6675 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6676 !! end
6678 !! test
6679 Redirect to interwiki
6680 !! options
6681 parsoid
6682 !! wikitext
6683 #REDIRECT [[meatball:File:Wiki.png]]
6684 !! html
6685 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
6686 !! end
6688 !! test
6689 Non-English #REDIRECT
6690 !! options
6691 parsoid
6692 language=is
6693 !! wikitext
6694 #TILVÍSUN [[Main Page]]
6695 !! html
6696 <link rel="mw:PageProp/redirect" href="./Main_Page">
6697 !! end
6699 !! test
6700 New redirect
6701 !! options
6702 parsoid=html2wt
6703 !! wikitext
6705 #REDIRECT [[Foo]]
6706 !! html
6707 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
6708 !! end
6711 ## XHTML tidiness
6714 !! test
6715 <br> to <br />
6716 !! wikitext
6717 1<br>2<br />3
6718 !! html
6719 <p>1<br />2<br />3
6720 </p>
6721 !! end
6723 !! test
6724 Broken br tag sanitization
6725 !! wikitext
6726 </br>
6727 !! html/php
6728 <p>&lt;/br&gt;
6729 </p>
6730 !! end
6732 # TODO: Fix html2html mode (bug 51055)!
6733 !! test
6734 Parsoid: Broken br tag recognition
6735 !! options
6736 parsoid=wt2html
6737 !! wikitext
6738 </br>
6740 <br/ >
6741 !! html/parsoid
6742 <p><br></p>
6743 <p><br/></p>
6744 !! end
6746 !! test
6747 Incorrecly removing closing slashes from correctly formed XHTML
6748 !! wikitext
6749 <br style="clear:both;" />
6750 !! html
6751 <p><br style="clear:both;" />
6752 </p>
6753 !! end
6755 !! test
6756 Failing to transform badly formed HTML into correct XHTML
6757 !! wikitext
6758 <br style="clear: left;">
6759 <br style="clear: right;">
6760 <br style="clear: both;">
6761 !! html
6762 <p><br style="clear: left;" />
6763 <br style="clear: right;" />
6764 <br style="clear: both;" />
6765 </p>
6766 !!end
6768 !! test
6769 Handling html with a div self-closing tag
6770 !! wikitext
6771 <div title />
6772 <div title/>
6773 <div title/ >
6774 <div title=bar />
6775 <div title=bar/>
6776 <div title=bar/ >
6777 !! html
6778 <p>&lt;div title /&gt;
6779 &lt;div title/&gt;
6780 </p>
6781 <div>
6782 <p>&lt;div title=bar /&gt;
6783 &lt;div title=bar/&gt;
6784 </p>
6785 <div title="bar/"></div>
6786 </div>
6788 !! end
6790 !! test
6791 Handling html with a br self-closing tag
6792 !! wikitext
6793 <br title />
6794 <br title/>
6795 <br title/ >
6796 <br title=bar />
6797 <br title=bar/>
6798 <br title=bar/ >
6799 !! html
6800 <p><br title="title" />
6801 <br title="title" />
6802 <br />
6803 <br title="bar" />
6804 <br title="bar" />
6805 <br title="bar/" />
6806 </p>
6807 !! end
6809 !! test
6810 Horizontal ruler (should it add that extra space?)
6811 !! wikitext
6812 <hr>
6813 <hr >
6814 foo <hr
6815 > bar
6816 !! html
6817 <hr />
6818 <hr />
6819 foo <hr /> bar
6821 !! end
6823 !! test
6824 Horizontal ruler -- 4+ dashes render hr
6825 !! wikitext
6826 ----
6827 !! html
6828 <hr />
6830 !! end
6832 !! test
6833 Horizontal ruler -- eats additional dashes on the same line
6834 !! wikitext
6835 ---------
6836 !! html
6837 <hr />
6839 !! end
6841 !! test
6842 Horizontal ruler -- does not collapse dashes on consecutive lines
6843 !! wikitext
6844 ----
6845 ----
6846 !! html
6847 <hr />
6848 <hr />
6850 !! end
6852 !! test
6853 Horizontal ruler -- <4 dashes render as plain text
6854 !! wikitext
6856 !! html
6857 <p>---
6858 </p>
6859 !! end
6861 !! test
6862 Horizontal ruler -- Supports content following dashes on same line
6863 !! wikitext
6864 ---- Foo
6865 !! html
6866 <hr /> Foo
6868 !! end
6871 ### Block-level elements
6873 !! test
6874 Common list
6875 !! wikitext
6876 *Common list
6877 * item 2
6878 *item 3
6879 !! html
6880 <ul><li>Common list</li>
6881 <li> item 2</li>
6882 <li>item 3</li></ul>
6884 !! end
6886 !! test
6887 Numbered list
6888 !! wikitext
6889 #Numbered list
6890 #item 2
6891 # item 3
6892 !! html
6893 <ol><li>Numbered list</li>
6894 <li>item 2</li>
6895 <li> item 3</li></ol>
6897 !! end
6899 !! test
6900 Mixed list
6901 !! wikitext
6902 *Mixed list
6903 *# with numbers
6904 ** and bullets
6905 *# and numbers
6906 *bullets again
6907 **bullet level 2
6908 ***bullet level 3
6909 ***#Number on level 4
6910 **bullet level 2
6911 **#Number on level 3
6912 **#Number on level 3
6913 *#number level 2
6914 *Level 1
6915 *** Level 3
6916 #** Level 3, but ordered
6917 !! html
6918 <ul><li>Mixed list
6919 <ol><li> with numbers</li></ol>
6920 <ul><li> and bullets</li></ul>
6921 <ol><li> and numbers</li></ol></li>
6922 <li>bullets again
6923 <ul><li>bullet level 2
6924 <ul><li>bullet level 3
6925 <ol><li>Number on level 4</li></ol></li></ul></li>
6926 <li>bullet level 2
6927 <ol><li>Number on level 3</li>
6928 <li>Number on level 3</li></ol></li></ul>
6929 <ol><li>number level 2</li></ol></li>
6930 <li>Level 1
6931 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
6932 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
6934 !! end
6936 !! test
6937 Nested lists 1
6938 !! wikitext
6939 *foo
6940 **bar
6941 !! html
6942 <ul><li>foo
6943 <ul><li>bar</li></ul></li></ul>
6945 !! end
6947 !! test
6948 Nested lists 2
6949 !! wikitext
6950 **foo
6951 *bar
6952 !! html
6953 <ul><li><ul><li>foo</li></ul></li>
6954 <li>bar</li></ul>
6956 !! end
6958 !! test
6959 Nested lists 3 (first element empty)
6960 !! wikitext
6962 **bar
6963 !! html
6964 <ul><li>
6965 <ul><li>bar</li></ul></li></ul>
6967 !! end
6969 !! test
6970 Nested lists 4 (first element empty)
6971 !! wikitext
6973 *bar
6974 !! html
6975 <ul><li><ul><li></li></ul></li>
6976 <li>bar</li></ul>
6978 !! end
6980 !! test
6981 Nested lists 5 (both elements empty)
6982 !! wikitext
6985 !! html
6986 <ul><li><ul><li></li></ul></li>
6987 <li></li></ul>
6989 !! end
6991 !! test
6992 Nested lists 6 (both elements empty)
6993 !! wikitext
6996 !! html
6997 <ul><li>
6998 <ul><li></li></ul></li></ul>
7000 !! end
7002 !! test
7003 Nested lists 7 (skip initial nesting levels)
7004 !! wikitext
7005 *** foo
7006 !! html
7007 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7009 !! end
7011 !! test
7012 Nested lists 8 (multiple nesting transitions)
7013 !! wikitext
7014 * foo
7015 *** bar
7016 ** baz
7017 * boo
7018 !! html
7019 <ul><li> foo
7020 <ul><li><ul><li> bar</li></ul></li>
7021 <li> baz</li></ul></li>
7022 <li> boo</li></ul>
7024 !! end
7026 !! test
7027 1. Lists with start-of-line-transparent tokens before bullets: Comments
7028 !! wikitext
7029 *foo
7030 *<!--cmt-->bar
7031 <!--cmt-->*baz
7032 !! html
7033 <ul><li>foo</li>
7034 <li>bar</li>
7035 <li>baz</li></ul>
7037 !! end
7039 !! test
7040 2. Lists with start-of-line-transparent tokens before bullets: Template close
7041 !! wikitext
7042 *foo {{echo|bar
7043 }}*baz
7044 !! html
7045 <ul><li>foo bar</li>
7046 <li>baz</li></ul>
7048 !! end
7050 !! test
7051 List items are not parsed correctly following a <pre> block (bug 785)
7052 !! wikitext
7053 * <pre>foo</pre>
7054 * <pre>bar</pre>
7055 * zar
7056 !! html
7057 <ul><li> <pre>foo</pre></li>
7058 <li> <pre>bar</pre></li>
7059 <li> zar</li></ul>
7061 !! end
7063 !! test
7064 List items from template
7065 !! wikitext
7067 {{inner list}}
7068 * item 2
7070 * item 0
7071 {{inner list}}
7072 * item 2
7074 * item 0
7075 * notSOL{{inner list}}
7076 * item 2
7077 !! html
7078 <ul><li> item 1</li>
7079 <li> item 2</li></ul>
7080 <ul><li> item 0</li>
7081 <li> item 1</li>
7082 <li> item 2</li></ul>
7083 <ul><li> item 0</li>
7084 <li> notSOL</li>
7085 <li> item 1</li>
7086 <li> item 2</li></ul>
7088 !! end
7090 !! test
7091 List interrupted by empty line or heading
7092 !! wikitext
7093 * foo
7095 ** bar
7096 == A heading ==
7097 * Another list item
7098 !! html
7099 <ul><li> foo</li></ul>
7100 <ul><li><ul><li> bar</li></ul></li></ul>
7101 <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>
7102 <ul><li> Another list item</li></ul>
7104 !!end
7106 !!test
7107 Multiple list tags generated by templates
7108 !! wikitext
7109 {{echo|<li>}}a
7110 {{echo|<li>}}b
7111 {{echo|<li>}}c
7112 !! html
7113 <li>a
7114 <li>b
7115 <li>c</li>
7116 </li>
7117 </li>
7119 !!end
7121 !!test
7122 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7123 !! wikitext
7125 <!--This line will NOT split the list-->
7127  <!--This line will NOT split the list either-->
7129  <!--foo--> <!----> <!--This line NOT split the list either--> 
7131 !! html
7132 <ul><li>a</li>
7133 <li>b</li>
7134 <li>c</li>
7135 <li>d</li></ul>
7137 !!end
7139 !!test
7140 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7141 !! wikitext
7143 <!--This line will NOT split the list-->        
7145         <!--This line will NOT split the list either-->         
7147         <!--foo--> <!---->      <!--This line NOT split the list
7148         either-->        
7150 !! html
7151 <ul><li>a</li>
7152 <li>b</li>
7153 <li>c</li>
7154 <li>d</li></ul>
7156 !!end
7158 !!test
7159 Test the li-hack
7160 (Cannot test this with PHP parser since it relies on Tidy for the hack)
7161 !!options
7162 parsoid=wt2html,wt2wt
7163 !! wikitext
7164 * foo
7165 * <li>li-hack
7166 * {{echo|<li>templated li-hack}}
7167 * <!--foo--> <li> unsupported li-hack with preceding comments
7169 <ul>
7170 <li><li>not a li-hack
7171 </li>
7172 </ul>
7173 !! html
7174 <ul>
7175 <li> foo</li>
7176 <li>li-hack</li>
7177 <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>
7178 <li> <!--foo--> </li>
7179 <li> li-hack with preceding comments</li>
7180 </ul>
7182 <ul>
7183 <li></li>
7184 <li>not a li-hack
7185 </li>
7186 </ul>
7187 !!end
7189 !! test
7190 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
7191 !! options
7192 parsoid
7193 !! wikitext
7194 # foo
7195 ## bar
7196 * foo
7197 ** bar
7198 : foo
7199 :: bar
7200 !! html
7201 <ol>
7202 <li> foo<ol>
7203 <li> bar</li>
7204 </ol></li>
7205 </ol><ul>
7206 <li> foo<ul>
7207 <li> bar</li>
7208 </ul></li>
7209 </ul><dl>
7210 <dd> foo<dl>
7211 <dd> bar</dd>
7212 </dl></dd>
7213 </dl>
7214 !! end
7216 !! test
7217 Parsoid: Test of whitespace serialization with Templated bullets
7218 !! options
7219 parsoid
7220 !! wikitext
7221 * {{bullet}}
7222 !! html
7223 <ul>
7224 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
7225 </ul>
7226 !! end
7228 # ------------------------------------------------------------------------
7229 # The next set of tests are about Parsoid's ability to handle badly nested
7230 # tags (parse, minimize scope of fixup, and roundtrip back)
7231 # ------------------------------------------------------------------------
7233 !! test
7234 Unbalanced closing block tags break a list
7235 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7236 !! wikitext
7237 <div>
7238 *a</div><div>
7239 *b</div>
7240 !! html/parsoid
7241 <div>
7242 <ul>
7243 <li>a
7244 </li>
7245 </ul></div><div>
7246 <ul>
7247 <li>b
7248 </li>
7249 </ul></div>
7250 !! end
7252 !! test
7253 Unbalanced closing non-block tags don't break a list
7254 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7255 !! wikitext
7256 <span>
7257 *a</span><span>
7258 *b</span>
7259 !! html/parsoid
7260 <p><span></span>
7261 </p>
7262 <ul>
7263 <li>a<span></span>
7264 </li>
7265 <li>b
7266 </li>
7267 </ul>
7268 !! end
7270 !! test
7271 Unclosed formatting tags that straddle lists are closed and reopened
7272 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
7273 !! wikitext
7274 # <s> a
7275 # b </s>
7276 !! html/parsoid
7277 <ol>
7278 <li> <s> a </s>
7279 </li>
7280 <li> <s> b </s>
7281 </li>
7282 </ol>
7283 !! end
7285 !!test
7286 List embedded in a non-block tag
7287 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
7288 !! wikitext
7289 <small>
7290 * foo
7291 </small>
7292 !! html/parsoid
7293 <p><small></small></p>
7294 <small>
7295 <ul>
7296 <li> foo</li>
7297 </ul>
7298 </small>
7299 <p><small></small></p>
7300 !!end
7302 !! test
7303 Table with missing opening <tr> tag
7304 !! options
7305 parsoid=wt2html,wt2wt
7306 !! wikitext
7307 <table>
7308 <td>foo</td>
7309 </tr>
7310 </table>
7311 !! html/parsoid
7312 <table>
7313 <tr>
7314 <td>foo</td>
7315 </tr>
7316 </table>
7317 !! end
7320 ### Magic Words
7323 # Note that the current date is hard-coded as
7324 #   1970-01-01T00:02:03Z (a Thursday)
7325 # when running parser tests.  The timezone is also fixed to GMT, so
7326 # local date will be identical to current date.
7328 !! test
7329 Magic Word: {{CURRENTDAY}}
7330 !! wikitext
7331 {{CURRENTDAY}}
7332 !! html
7333 <p>1
7334 </p>
7335 !! end
7337 !! test
7338 Magic Word: {{CURRENTDAY2}}
7339 !! wikitext
7340 {{CURRENTDAY2}}
7341 !! html
7342 <p>01
7343 </p>
7344 !! end
7346 !! test
7347 Magic Word: {{CURRENTDAYNAME}}
7348 !! wikitext
7349 {{CURRENTDAYNAME}}
7350 !! html
7351 <p>Thursday
7352 </p>
7353 !! end
7355 !! test
7356 Magic Word: {{CURRENTDOW}}
7357 !! wikitext
7358 {{CURRENTDOW}}
7359 !! html
7360 <p>4
7361 </p>
7362 !! end
7364 !! test
7365 Magic Word: {{CURRENTMONTH}}
7366 !! wikitext
7367 {{CURRENTMONTH}}
7368 !! html
7369 <p>01
7370 </p>
7371 !! end
7373 !! test
7374 Magic Word: {{CURRENTMONTH1}}
7375 !! wikitext
7376 {{CURRENTMONTH1}}
7377 !! html
7378 <p>1
7379 </p>
7380 !! end
7382 !! test
7383 Magic Word: {{CURRENTMONTHABBREV}}
7384 !! wikitext
7385 {{CURRENTMONTHABBREV}}
7386 !! html
7387 <p>Jan
7388 </p>
7389 !! end
7391 !! test
7392 Magic Word: {{CURRENTMONTHNAME}}
7393 !! wikitext
7394 {{CURRENTMONTHNAME}}
7395 !! html
7396 <p>January
7397 </p>
7398 !! end
7400 !! test
7401 Magic Word: {{CURRENTMONTHNAMEGEN}}
7402 !! wikitext
7403 {{CURRENTMONTHNAMEGEN}}
7404 !! html
7405 <p>January
7406 </p>
7407 !! end
7409 !! test
7410 Magic Word: {{CURRENTTIME}}
7411 !! wikitext
7412 {{CURRENTTIME}}
7413 !! html
7414 <p>00:02
7415 </p>
7416 !! end
7418 !! test
7419 Magic Word: {{CURRENTHOUR}}
7420 !! wikitext
7421 {{CURRENTHOUR}}
7422 !! html
7423 <p>00
7424 </p>
7425 !! end
7427 !! test
7428 Magic Word: {{CURRENTWEEK}} (@bug 4594)
7429 !! wikitext
7430 {{CURRENTWEEK}}
7431 !! html
7432 <p>1
7433 </p>
7434 !! end
7436 !! test
7437 Magic Word: {{CURRENTYEAR}}
7438 !! wikitext
7439 {{CURRENTYEAR}}
7440 !! html
7441 <p>1970
7442 </p>
7443 !! end
7445 !! test
7446 Magic Word: {{CURRENTTIMESTAMP}}
7447 !! wikitext
7448 {{CURRENTTIMESTAMP}}
7449 !! html
7450 <p>19700101000203
7451 </p>
7452 !! end
7454 !! test
7455 Magic Words LOCAL (UTC)
7456 !! wikitext
7457 * {{LOCALMONTH}}
7458 * {{LOCALMONTH1}}
7459 * {{LOCALMONTHNAME}}
7460 * {{LOCALMONTHNAMEGEN}}
7461 * {{LOCALMONTHABBREV}}
7462 * {{LOCALDAY}}
7463 * {{LOCALDAY2}}
7464 * {{LOCALDAYNAME}}
7465 * {{LOCALYEAR}}
7466 * {{LOCALTIME}}
7467 * {{LOCALHOUR}}
7468 * {{LOCALWEEK}}
7469 * {{LOCALDOW}}
7470 * {{LOCALTIMESTAMP}}
7471 !! html
7472 <ul><li> 01</li>
7473 <li> 1</li>
7474 <li> January</li>
7475 <li> January</li>
7476 <li> Jan</li>
7477 <li> 1</li>
7478 <li> 01</li>
7479 <li> Thursday</li>
7480 <li> 1970</li>
7481 <li> 00:02</li>
7482 <li> 00</li>
7483 <li> 1</li>
7484 <li> 4</li>
7485 <li> 19700101000203</li></ul>
7487 !! end
7489 !! test
7490 Magic Word: {{FULLPAGENAME}}
7491 !! options
7492 title=[[User:Ævar Arnfjörð Bjarmason]]
7493 !! wikitext
7494 {{FULLPAGENAME}}
7495 !! html
7496 <p>User:Ævar Arnfjörð Bjarmason
7497 </p>
7498 !! end
7500 !! test
7501 Magic Word: {{FULLPAGENAMEE}}
7502 !! options
7503 title=[[User:Ævar Arnfjörð Bjarmason]]
7504 !! wikitext
7505 {{FULLPAGENAMEE}}
7506 !! html
7507 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7508 </p>
7509 !! end
7511 !! test
7512 Magic Word: {{TALKSPACE}}
7513 !! options
7514 title=[[User:Ævar Arnfjörð Bjarmason]]
7515 !! wikitext
7516 {{TALKSPACE}}
7517 !! html
7518 <p>User talk
7519 </p>
7520 !! end
7522 !! test
7523 Magic Word: {{TALKSPACE}}, same namespace
7524 !! options
7525 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7526 !! wikitext
7527 {{TALKSPACE}}
7528 !! html
7529 <p>User talk
7530 </p>
7531 !! end
7533 !! test
7534 Magic Word: {{TALKSPACE}}, main namespace
7535 !! options
7536 title=[[Parser Test]]
7537 !! wikitext
7538 {{TALKSPACE}}
7539 !! html
7540 <p>Talk
7541 </p>
7542 !! end
7544 !! test
7545 Magic Word: {{TALKSPACEE}}
7546 !! options
7547 title=[[User:Ævar Arnfjörð Bjarmason]]
7548 !! wikitext
7549 {{TALKSPACEE}}
7550 !! html
7551 <p>User_talk
7552 </p>
7553 !! end
7555 !! test
7556 Magic Word: {{SUBJECTSPACE}}
7557 !! options
7558 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7559 !! wikitext
7560 {{SUBJECTSPACE}}
7561 !! html
7562 <p>User
7563 </p>
7564 !! end
7566 !! test
7567 Magic Word: {{SUBJECTSPACE}}, same namespace
7568 !! options
7569 title=[[User:Ævar Arnfjörð Bjarmason]]
7570 !! wikitext
7571 {{SUBJECTSPACE}}
7572 !! html
7573 <p>User
7574 </p>
7575 !! end
7577 !! test
7578 Magic Word: {{SUBJECTSPACE}}, main namespace
7579 !! options
7580 title=[[Parser Test]]
7581 !! wikitext
7582 {{SUBJECTSPACE}}
7583 !! html
7585 !! end
7587 !! test
7588 Magic Word: {{SUBJECTSPACEE}}
7589 !! options
7590 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7591 !! wikitext
7592 {{SUBJECTSPACEE}}
7593 !! html
7594 <p>User
7595 </p>
7596 !! end
7598 !! test
7599 Magic Word: {{NAMESPACE}}
7600 !! options
7601 title=[[User:Ævar Arnfjörð Bjarmason]]
7602 !! wikitext
7603 {{NAMESPACE}}
7604 !! html
7605 <p>User
7606 </p>
7607 !! end
7609 !! test
7610 Magic Word: {{NAMESPACEE}}
7611 !! options
7612 title=[[User:Ævar Arnfjörð Bjarmason]]
7613 !! wikitext
7614 {{NAMESPACEE}}
7615 !! html
7616 <p>User
7617 </p>
7618 !! end
7620 !! test
7621 Magic Word: {{NAMESPACENUMBER}}
7622 !! options
7623 title=[[User:Ævar Arnfjörð Bjarmason]]
7624 !! wikitext
7625 {{NAMESPACENUMBER}}
7626 !! html
7627 <p>2
7628 </p>
7629 !! end
7631 !! test
7632 Magic Word: {{SUBPAGENAME}}
7633 !! options
7634 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7635 !! wikitext
7636 {{SUBPAGENAME}}
7637 !! html
7638 <p>sub ö
7639 </p>
7640 !! end
7642 !! test
7643 Magic Word: {{SUBPAGENAMEE}}
7644 !! options
7645 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
7646 !! wikitext
7647 {{SUBPAGENAMEE}}
7648 !! html
7649 <p>sub_%C3%B6
7650 </p>
7651 !! end
7653 !! test
7654 Magic Word: {{ROOTPAGENAME}}
7655 !! options
7656 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7657 !! wikitext
7658 {{ROOTPAGENAME}}
7659 !! html
7660 <p>Ævar Arnfjörð Bjarmason
7661 </p>
7662 !! end
7664 !! test
7665 Magic Word: {{ROOTPAGENAMEE}}
7666 !! options
7667 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
7668 !! wikitext
7669 {{ROOTPAGENAMEE}}
7670 !! html
7671 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7672 </p>
7673 !! end
7675 !! test
7676 Magic Word: {{BASEPAGENAME}}
7677 !! options
7678 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7679 !! wikitext
7680 {{BASEPAGENAME}}
7681 !! html
7682 <p>Ævar Arnfjörð Bjarmason
7683 </p>
7684 !! end
7686 !! test
7687 Magic Word: {{BASEPAGENAMEE}}
7688 !! options
7689 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
7690 !! wikitext
7691 {{BASEPAGENAMEE}}
7692 !! html
7693 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7694 </p>
7695 !! end
7697 !! test
7698 Magic Word: {{TALKPAGENAME}}
7699 !! options
7700 title=[[User:Ævar Arnfjörð Bjarmason]]
7701 !! wikitext
7702 {{TALKPAGENAME}}
7703 !! html
7704 <p>User talk:Ævar Arnfjörð Bjarmason
7705 </p>
7706 !! end
7708 !! test
7709 Magic Word: {{TALKPAGENAMEE}}
7710 !! options
7711 title=[[User:Ævar Arnfjörð Bjarmason]]
7712 !! wikitext
7713 {{TALKPAGENAMEE}}
7714 !! html
7715 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7716 </p>
7717 !! end
7719 !! test
7720 Magic Word: {{SUBJECTPAGENAME}}
7721 !! options
7722 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7723 !! wikitext
7724 {{SUBJECTPAGENAME}}
7725 !! html
7726 <p>User:Ævar Arnfjörð Bjarmason
7727 </p>
7728 !! end
7730 !! test
7731 Magic Word: {{SUBJECTPAGENAMEE}}
7732 !! options
7733 title=[[User talk:Ævar Arnfjörð Bjarmason]]
7734 !! wikitext
7735 {{SUBJECTPAGENAMEE}}
7736 !! html
7737 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7738 </p>
7739 !! end
7741 !! test
7742 Magic Word: {{NUMBEROFFILES}}
7743 !! wikitext
7744 {{NUMBEROFFILES}}
7745 !! html
7746 <p>5
7747 </p>
7748 !! end
7750 !! test
7751 Magic Word: {{PAGENAME}}
7752 !! options
7753 title=[[User:Ævar Arnfjörð Bjarmason]]
7754 !! wikitext
7755 {{PAGENAME}}
7756 !! html
7757 <p>Ævar Arnfjörð Bjarmason
7758 </p>
7759 !! end
7761 !! test
7762 Magic Word: {{PAGENAME}} with metacharacters
7763 !! options
7764 title=[['foo & bar = baz']]
7765 !! wikitext
7766 ''{{PAGENAME}}''
7767 !! html
7768 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
7769 </p>
7770 !! end
7772 !! test
7773 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
7774 !! options
7775 title=[[*RFC 1234 http://example.com/]]
7776 !! wikitext
7777 {{PAGENAME}}
7778 !! html
7779 <p>&#42;RFC&#32;1234 http&#58;//example.com/
7780 </p>
7781 !! end
7783 !! test
7784 Magic Word: {{PAGENAMEE}}
7785 !! options
7786 title=[[User:Ævar Arnfjörð Bjarmason]]
7787 !! wikitext
7788 {{PAGENAMEE}}
7789 !! html
7790 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
7791 </p>
7792 !! end
7794 !! test
7795 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
7796 !! options
7797 title=[[*RFC 1234 http://example.com/]]
7798 !! wikitext
7799 {{PAGENAMEE}}
7800 !! html
7801 <p>&#42;RFC_1234_http&#58;//example.com/
7802 </p>
7803 !! end
7805 !! test
7806 Magic Word: {{REVISIONID}}
7807 !! wikitext
7808 {{REVISIONID}}
7809 !! html
7810 <p>1337
7811 </p>
7812 !! end
7814 !! test
7815 Magic Word: {{SCRIPTPATH}}
7816 !! wikitext
7817 {{SCRIPTPATH}}
7818 !! html
7819 <p>/
7820 </p>
7821 !! end
7823 !! test
7824 Magic Word: {{STYLEPATH}}
7825 !! wikitext
7826 {{STYLEPATH}}
7827 !! html
7828 <p>/skins
7829 </p>
7830 !! end
7832 !! test
7833 Magic Word: {{SERVER}}
7834 !! wikitext
7835 {{SERVER}}
7836 !! html
7837 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7838 </p>
7839 !! end
7841 !! test
7842 Magic Word: {{SERVERNAME}}
7843 !! wikitext
7844 {{SERVERNAME}}
7845 !! html
7846 <p>example.org
7847 </p>
7848 !! end
7850 !! test
7851 Magic Word: {{SITENAME}}
7852 !! wikitext
7853 {{SITENAME}}
7854 !! html
7855 <p>MediaWiki
7856 </p>
7857 !! end
7859 !! test
7860 Case-sensitive magic words, when cased differently, should just be template transclusions
7861 !! wikitext
7862 {{CurrentMonth}}
7863 {{currentday}}
7864 {{cURreNTweEK}}
7865 {{currentHour}}
7866 !! html
7867 <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>
7868 <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>
7869 <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>
7870 <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>
7871 </p>
7872 !! end
7874 !! test
7875 Case-insensitive magic words should still work with weird casing.
7876 !! wikitext
7877 {{sErVeRNaMe}}
7878 {{LCFirst:AOEU}}
7879 {{ucFIRST:aoeu}}
7880 {{SERver}}
7881 !! html
7882 <p>example.org
7883 aOEU
7884 Aoeu
7885 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
7886 </p>
7887 !! end
7889 !! test
7890 Namespace 1 {{ns:1}}
7891 !! wikitext
7892 {{ns:1}}
7893 !! html
7894 <p>Talk
7895 </p>
7896 !! end
7898 !! test
7899 Namespace 1 {{ns:01}}
7900 !! wikitext
7901 {{ns:01}}
7902 !! html
7903 <p>Talk
7904 </p>
7905 !! end
7907 !! test
7908 Namespace 0 {{ns:0}} (bug 4783)
7909 !! wikitext
7910 {{ns:0}}
7911 !! html
7913 !! end
7915 !! test
7916 Namespace 0 {{ns:00}} (bug 4783)
7917 !! wikitext
7918 {{ns:00}}
7919 !! html
7921 !! end
7923 !! test
7924 Namespace -1 {{ns:-1}}
7925 !! wikitext
7926 {{ns:-1}}
7927 !! html
7928 <p>Special
7929 </p>
7930 !! end
7932 !! test
7933 Namespace User {{ns:User}}
7934 !! wikitext
7935 {{ns:User}}
7936 !! html
7937 <p>User
7938 </p>
7939 !! end
7941 !! test
7942 Namespace User talk {{ns:User_talk}}
7943 !! wikitext
7944 {{ns:User_talk}}
7945 !! html
7946 <p>User talk
7947 </p>
7948 !! end
7950 !! test
7951 Namespace User talk {{ns:uSeR tAlK}}
7952 !! wikitext
7953 {{ns:uSeR tAlK}}
7954 !! html
7955 <p>User talk
7956 </p>
7957 !! end
7959 !! test
7960 Namespace File {{ns:File}}
7961 !! wikitext
7962 {{ns:File}}
7963 !! html
7964 <p>File
7965 </p>
7966 !! end
7968 !! test
7969 Namespace File {{ns:Image}}
7970 !! wikitext
7971 {{ns:Image}}
7972 !! html
7973 <p>File
7974 </p>
7975 !! end
7977 !! test
7978 Namespace (lang=de) Benutzer {{ns:User}}
7979 !! options
7980 language=de
7981 !! wikitext
7982 {{ns:User}}
7983 !! html
7984 <p>Benutzer
7985 </p>
7986 !! end
7988 !! test
7989 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
7990 !! options
7991 language=de
7992 !! wikitext
7993 {{ns:3}}
7994 !! html
7995 <p>Benutzer Diskussion
7996 </p>
7997 !! end
8000 !! test
8001 Urlencode
8002 !! wikitext
8003 {{urlencode:hi world?!}}
8004 {{urlencode:hi world?!|WIKI}}
8005 {{urlencode:hi world?!|PATH}}
8006 {{urlencode:hi world?!|QUERY}}
8007 !! html
8008 <p>hi+world%3F%21
8009 hi_world%3F!
8010 hi%20world%3F%21
8011 hi+world%3F%21
8012 </p>
8013 !! end
8015 !! test
8016 Magic Word: prioritize type info over data-parsoid
8017 !! options
8018 parsoid=html2wt
8019 !! wikitext
8020 __FORCETOC__
8021 !! html
8022 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8023 !! end
8025 !! test
8026 Magic Word: serialize on separate line (parsoid)
8027 !! options
8028 parsoid=wt2wt,html2wt
8029 !! wikitext
8031 __NOTOC__
8033 !! html
8034 foo<meta property="mw:PageProp/notoc"/>bar
8035 !! end
8037 !! test
8038 Magic Word: rt non-english wikis
8039 !! options
8040 parsoid=wt2wt
8041 language=de
8042 !! wikitext
8043 __NOEDITSECTION__
8044 !! html
8045 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8046 !! end
8049 ### Magic links
8051 !! test
8052 Magic links: internal link to RFC (bug 479)
8053 !! wikitext
8054 [[RFC 123]]
8055 !! html
8056 <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>
8057 </p>
8058 !! end
8060 !! test
8061 Magic links: RFC (bug 479)
8062 !! wikitext
8063 RFC 822
8064 !! html
8065 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8066 </p>
8067 !! end
8069 !! test
8070 Magic links: ISBN (bug 1937)
8071 !! wikitext
8072 ISBN 0-306-40615-2
8073 !! html
8074 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8075 </p>
8076 !! end
8078 !! test
8079 Magic links: PMID incorrectly converts space to underscore
8080 !! wikitext
8081 PMID 1234
8082 !! html
8083 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8084 </p>
8085 !! end
8088 ### Templates
8089 ####
8091 !! test
8092 Nonexistent template
8093 !! wikitext
8094 {{thistemplatedoesnotexist}}
8095 !! html
8096 <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>
8097 </p>
8098 !! end
8100 !! test
8101 Template with invalid target containing tags
8102 !! wikitext
8103 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8104 !! html
8105 <p>{{a<b>b</b>|foo|a=b|a = b}}
8106 </p>
8107 !! end
8109 !! test
8110 Template with invalid target containing unclosed tag
8111 !! wikitext
8112 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
8113 !! html
8114 <p>{{a<b>|foo|a=b|a = b}}</b>
8115 </p>
8116 !! end
8118 !! test
8119 Template with invalid target containing wikilink
8120 !! wikitext
8121 {{[[Main Page]]}}
8122 !! html/php
8123 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
8124 </p>
8125 !! html/parsoid
8126 <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>
8127 !! end
8129 !! article
8130 Template:test
8131 !! text
8132 This is a test template
8133 !! endarticle
8135 !! test
8136 Simple template
8137 !! wikitext
8138 {{test}}
8139 !! html
8140 <p>This is a test template
8141 </p>
8142 !! end
8144 !! test
8145 Template with explicit namespace
8146 !! wikitext
8147 {{Template:test}}
8148 !! html
8149 <p>This is a test template
8150 </p>
8151 !! end
8154 !! article
8155 Template:paramtest
8156 !! text
8157 This is a test template with parameter {{{param}}}
8158 !! endarticle
8160 !! test
8161 Template parameter
8162 !! wikitext
8163 {{paramtest|param=foo}}
8164 !! html
8165 <p>This is a test template with parameter foo
8166 </p>
8167 !! end
8169 !! article
8170 Template:paramtestnum
8171 !! text
8172 [[{{{1}}}|{{{2}}}]]
8173 !! endarticle
8175 !! test
8176 Template unnamed parameter
8177 !! wikitext
8178 {{paramtestnum|Main Page|the main page}}
8179 !! html
8180 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
8181 </p>
8182 !! end
8184 !! article
8185 Template:templatesimple
8186 !! text
8187 (test)
8188 !! endarticle
8190 !! article
8191 Template:templateredirect
8192 !! text
8193 #redirect [[Template:templatesimple]]
8194 !! endarticle
8196 !! article
8197 Template:templateasargtestnum
8198 !! text
8199 {{{{{1}}}}}
8200 !! endarticle
8202 !! article
8203 Template:templateasargtest
8204 !! text
8205 {{template{{{templ}}}}}
8206 !! endarticle
8208 !! article
8209 Template:templateasargtest2
8210 !! text
8211 {{{{{templ}}}}}
8212 !! endarticle
8214 !! test
8215 Template with template name as unnamed argument
8216 !! wikitext
8217 {{templateasargtestnum|templatesimple}}
8218 !! html
8219 <p>(test)
8220 </p>
8221 !! end
8223 !! test
8224 Template with template name as argument
8225 !! wikitext
8226 {{templateasargtest|templ=simple}}
8227 !! html
8228 <p>(test)
8229 </p>
8230 !! end
8232 !! test
8233 Template with template name as argument (2)
8234 !! wikitext
8235 {{templateasargtest2|templ=templatesimple}}
8236 !! html
8237 <p>(test)
8238 </p>
8239 !! end
8241 !! article
8242 Template:templateasargtestdefault
8243 !! text
8244 {{{{{templ|templatesimple}}}}}
8245 !! endarticle
8247 !! article
8248 Template:templa
8249 !! text
8250 '''templ'''
8251 !! endarticle
8253 !! test
8254 Template with default value
8255 !! wikitext
8256 {{templateasargtestdefault}}
8257 !! html
8258 <p>(test)
8259 </p>
8260 !! end
8262 !! test
8263 Template with default value (value set)
8264 !! wikitext
8265 {{templateasargtestdefault|templ=templa}}
8266 !! html
8267 <p><b>templ</b>
8268 </p>
8269 !! end
8271 !! test
8272 Template redirect
8273 !! wikitext
8274 {{templateredirect}}
8275 !! html
8276 <p>(test)
8277 </p>
8278 !! end
8280 !! test
8281 Template with argument in separate line
8282 !! wikitext
8283 {{ templateasargtest  |
8284  templ = simple }}
8285 !! html
8286 <p>(test)
8287 </p>
8288 !! end
8290 !! test
8291 Template with complex template as argument
8292 !! wikitext
8293 {{paramtest|
8294   param ={{ templateasargtest  |
8295  templ = simple }}}}
8296 !! html
8297 <p>This is a test template with parameter (test)
8298 </p>
8299 !! end
8301 !! test
8302 Template with thumb image (with link in description)
8303 !! wikitext
8304 {{paramtest|
8305   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
8306 !! html
8307 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>
8309 !! end
8311 !! article
8312 Template:complextemplate
8313 !! text
8314 {{{1}}} {{paramtest|
8315   param ={{{param}}}}}
8316 !! endarticle
8318 !! test
8319 Template with complex arguments
8320 !! wikitext
8321 {{complextemplate|
8322   param ={{ templateasargtest  |
8323  templ = simple }}|[[Template:complextemplate|link]]}}
8324 !! html
8325 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
8326 </p>
8327 !! end
8329 !! test
8330 BUG 553: link with two variables in a piped link
8331 !! wikitext
8333 |[[{{{1}}}|{{{2}}}]]
8335 !! html
8336 <table>
8337 <tr>
8338 <td>[[{{{1}}}|{{{2}}}]]
8339 </td></tr></table>
8341 !! end
8343 !! test
8344 Magic variable as template parameter
8345 !! wikitext
8346 {{paramtest|param={{SITENAME}}}}
8347 !! html
8348 <p>This is a test template with parameter MediaWiki
8349 </p>
8350 !! end
8352 !! article
8353 Template:linktest
8354 !! text
8355 [[{{{param}}}|link]]
8356 !! endarticle
8358 !! test
8359 Template parameter as link source
8360 !! wikitext
8361 {{linktest|param=Main Page}}
8362 !! html
8363 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
8364 </p>
8365 !! end
8367 !!test
8368 Template-generated attribute string (k='v')
8369 !! wikitext
8370 <span {{attr_str|id|v1}}>bar</span>
8371 !! html
8372 <p><span id="v1">bar</span>
8373 </p>
8374 !!end
8376 !!article
8377 Template:paramtest2
8378 !! text
8379 including another template, {{paramtest|param={{{arg}}}}}
8380 !! endarticle
8382 !! test
8383 Template passing argument to another template
8384 !! wikitext
8385 {{paramtest2|arg='hmm'}}
8386 !! html
8387 <p>including another template, This is a test template with parameter 'hmm'
8388 </p>
8389 !! end
8391 !! article
8392 Template:Linktest2
8393 !! text
8394 Main Page
8395 !! endarticle
8397 !! test
8398 Template as link source
8399 !! wikitext
8400 [[{{linktest2}}]]
8402 [[{{linktest2}}|Main Page]]
8404 [[{{linktest2}}]]Page
8405 !! html
8406 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8407 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8408 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
8409 </p>
8410 !! end
8413 !! article
8414 Template:loop1
8415 !! text
8416 {{loop2}}
8417 !! endarticle
8419 !! article
8420 Template:loop2
8421 !! text
8422 {{loop1}}
8423 !! endarticle
8425 !! test
8426 Template infinite loop
8427 !! wikitext
8428 {{loop1}}
8429 !! html
8430 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
8431 </p>
8432 !! end
8434 !! test
8435 Template from main namespace
8436 !! wikitext
8437 {{:Main Page}}
8438 !! html
8439 <p>blah blah
8440 </p>
8441 !! end
8443 !! article
8444 Template:table
8445 !! text
8447 | 1 || 2
8449 | 3 || 4
8451 !! endarticle
8453 !! test
8454 BUG 529: Template with table, not included at beginning of line
8455 !! wikitext
8456 foo {{table}}
8457 !! html
8458 <p>foo 
8459 </p>
8460 <table>
8461 <tr>
8462 <td> 1 </td>
8463 <td> 2
8464 </td></tr>
8465 <tr>
8466 <td> 3 </td>
8467 <td> 4
8468 </td></tr></table>
8470 !! end
8472 !! test
8473 BUG 523: Template shouldn't eat newline (or add an extra one before table)
8474 !! wikitext
8476 {{table}}
8477 !! html
8478 <p>foo
8479 </p>
8480 <table>
8481 <tr>
8482 <td> 1 </td>
8483 <td> 2
8484 </td></tr>
8485 <tr>
8486 <td> 3 </td>
8487 <td> 4
8488 </td></tr></table>
8490 !! end
8492 !! test
8493 BUG 41: Template parameters shown as broken links
8494 !! wikitext
8495 {{{parameter}}}
8496 !! html
8497 <p>{{{parameter}}}
8498 </p>
8499 !! end
8501 !! test
8502 Template with targets containing wikilinks
8503 !! wikitext
8504 {{[[foo]]}}
8506 {{[[{{echo|foo}}]]}}
8508 {{{{echo|[[foo}}]]}}
8509 !! html
8510 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8511 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
8512 </p><p>{{[[foo}}]]
8513 </p>
8514 !! end
8516 !! article
8517 Template:MSGNW test
8518 !! text
8519 ''None'' of '''this''' should be 
8520 * interpreted
8521  but rather passed unmodified
8522 {{test}}
8523 <gallery>
8524 File:Foobar.jpg
8525 </gallery>
8526 !! endarticle
8528 # hmm, fix this or just deprecate msgnw and document its behavior?
8529 !! test
8530 msgnw keyword
8531 !! wikitext
8532 {{msgnw:MSGNW test}}
8533 !! html
8534 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
8535 &#42; interpreted
8536 &#32;but rather passed unmodified
8537 &#123;&#123;test&#125;&#125;
8538 &#60;gallery&#62;
8539 File:Foobar.jpg
8540 &#60;/gallery&#62;
8541 </p>
8542 !! end
8544 !! test
8545 int keyword
8546 !! wikitext
8547 {{int:youhavenewmessages|lots of money|not!}}
8548 !! html
8549 <p>You have lots of money (not!).
8550 </p>
8551 !! end
8553 !! article
8554 Template:Includes
8555 !! text
8556 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8557 !! endarticle
8559 !! test
8560 <includeonly> and <noinclude> being included
8561 !! wikitext
8562 {{Includes}}
8563 !! html
8564 <p>Foobar
8565 </p>
8566 !! end
8568 !! article
8569 Template:Includes2
8570 !! text
8571 <onlyinclude>Foo</onlyinclude>bar
8572 !! endarticle
8574 !! test
8575 <onlyinclude> being included
8576 !! wikitext
8577 {{Includes2}}
8578 !! html
8579 <p>Foo
8580 </p>
8581 !! end
8584 !! article
8585 Template:Includes3
8586 !! text
8587 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
8588 !! endarticle
8590 !! test
8591 <onlyinclude> and <includeonly> being included
8592 !! wikitext
8593 {{Includes3}}
8594 !! html
8595 <p>Foo
8596 </p>
8597 !! end
8599 !! test
8600 <includeonly> and <noinclude> on a page
8601 !! wikitext
8602 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
8603 !! html
8604 <p>Foozar
8605 </p>
8606 !! end
8608 !! test
8609 Un-closed <noinclude>
8610 !! wikitext
8611 <noinclude>
8612 !! html
8613 !! end
8615 !! test
8616 <onlyinclude> on a page
8617 !! wikitext
8618 <onlyinclude>Foo</onlyinclude>bar
8619 !! html
8620 <p>Foobar
8621 </p>
8622 !! end
8624 !! test
8625 Un-closed <onlyinclude>
8626 !! wikitext
8627 <onlyinclude>
8628 !! html
8629 !! end
8631 !!test
8632 Self-closed noinclude, includeonly, onlyinclude tags
8633 !! wikitext
8634 <noinclude />
8635 <includeonly />
8636 <onlyinclude />
8637 !! html
8638 <p><br />
8639 </p>
8640 !!end
8642 !!test
8643 Unbalanced includeonly and noinclude tags
8644 !! wikitext
8646 |a</noinclude>
8647 |b</noinclude></noinclude>
8648 |c</noinclude></includeonly>
8649 |d</includeonly></includeonly>
8651 !! html
8652 <table>
8653 <tr>
8654 <td>a
8655 </td>
8656 <td>b
8657 </td>
8658 <td>c&lt;/includeonly&gt;
8659 </td>
8660 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
8661 </td></tr></table>
8663 !!end
8665 !! article
8666 Template:Includeonly section
8667 !! text
8668 <includeonly>
8669 ==Includeonly section==
8670 </includeonly>
8671 ==Section T-1==
8672 !!endarticle
8674 !! test
8675 Bug 6563: Edit link generation for section shown by <includeonly>
8676 !! wikitext
8677 {{includeonly section}}
8678 !! html
8679 <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>
8680 <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>
8682 !! end
8684 # Uses same input as the contents of [[Template:Includeonly section]]
8685 !! test
8686 Bug 6563: Section extraction for section shown by <includeonly>
8687 !! options
8688 section=T-2
8689 !! wikitext
8690 <includeonly>
8691 ==Includeonly section==
8692 </includeonly>
8693 ==Section T-2==
8694 !! html
8695 ==Section T-2==
8696 !! end
8698 !! test
8699 Bug 6563: Edit link generation for section suppressed by <includeonly>
8700 !! wikitext
8701 <includeonly>
8702 ==Includeonly section==
8703 </includeonly>
8704 ==Section 1==
8705 !! html
8706 <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>
8708 !! end
8710 !! test
8711 Bug 6563: Section extraction for section suppressed by <includeonly>
8712 !! options
8713 section=1
8714 !! wikitext
8715 <includeonly>
8716 ==Includeonly section==
8717 </includeonly>
8718 ==Section 1==
8719 !! html
8720 ==Section 1==
8721 !! end
8723 !! test
8724 Un-closed <includeonly>
8725 !! wikitext
8726 <includeonly>
8727 !! html
8728 !! end
8730 !! test
8731 Includes and comments at SOL
8732 !! wikitext
8733 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
8735 <noinclude>
8736 some
8737 </noinclude>* stuff
8738 * here
8740 <includeonly>can have stuff</includeonly>=== here ===
8742 !! html/php
8743 <h2><span class="mw-headline" id="hu">hu</span></h2>
8744 <p>some
8745 </p>
8746 <ul><li> stuff</li>
8747 <li> here</li></ul>
8748 <h3><span class="mw-headline" id="here">here</span></h3>
8750 !! html/parsoid
8751 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment -->
8752 <h2 data-parsoid='{}'> hu </h2>
8754 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
8756 <p data-parsoid='{}'>some</p>
8757 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>
8758 <ul data-parsoid='{}'>
8759 <li data-parsoid='{}'> stuff</li>
8761 <li data-parsoid='{}'> here</li></ul>
8763 <h3 data-parsoid='{}'> here </h3>
8764 !! end
8766 # TODO: test with DOM fragment reuse!
8767 !! test
8768 Parsoid: DOM fragment reuse
8769 !! options
8770 parsoid=wt2wt,wt2html
8771 !! wikitext
8772 a{{echo|b<table></table>c}}d
8774 a{{echo|b
8775 <table></table>
8776 c}}d
8778 {{echo|a
8780 <table></table>
8783 !! html
8784 a<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b
8785 <table></table>c"}},"i":0}}]}'>b</span>
8786 <table about="#mwt1"></table><span about="#mwt1">c</span>d
8789 <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">
8790 </span>
8791 <table about="#mwt2"></table><span about="#mwt2">
8792 </span>
8793 <p about="#mwt2">cd</p>
8796 <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">
8798 </span>
8799 <table about="#mwt3"></table><span about="#mwt3">
8801 </span>
8802 <p about="#mwt3">b</p>
8803 !! end
8805 !! test
8806 Parsoid: Merge double tds (bug 50603)
8807 !! options
8808 parsoid
8809 !! wikitext
8811 |{{echo|{{!}} foo}}
8813 !! html
8814 <table><tbody>
8815 <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>
8816 </tbody></table>
8817 !! end
8819 !! test
8820 Parsoid: Merge double tds in nested transclusion content (bug 50603)
8821 !! options
8822 parsoid
8823 !! wikitext
8824 {{echo|<div>}}
8826 |{{echo|{{!}} foo}}
8828 {{echo|</div>}}
8829 !! html
8830 <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}}]}'>
8831 <table><tbody>
8832 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
8833 </tbody></table>
8834 </div>
8835 !! end
8838 ### <includeonly> and <noinclude> in attributes
8840 !!test
8841 0. includeonly around the entire attribute
8842 !! wikitext
8843 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
8844 !! html
8845 <p><span id="v2">bar</span>
8846 </p>
8847 !!end
8849 !!test
8850 1. includeonly in html attr key
8851 !! wikitext
8852 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
8853 !! html
8854 <p><span id="foo">bar</span>
8855 </p>
8856 !!end
8858 !!test
8859 2. includeonly in html attr value
8860 !! wikitext
8861 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
8862 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
8863 !! html
8864 <p><span id="v1">bar</span>
8865 <span id="v1">bar</span>
8866 </p>
8867 !!end
8869 !!test
8870 3. includeonly in part of an attr value
8871 !! wikitext
8872 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
8873 !! html
8874 <p><span style="color:red;">bar</span>
8875 </p>
8876 !!end
8878 !!test
8879 4. includeonly in table attributes
8880 !! wikitext
8882 |- <noinclude>
8885 </noinclude>
8886 |- <includeonly>
8889 </includeonly>
8891 !! html
8892 <table>
8895 <tr>
8896 <td>a
8897 </td></tr>
8898 </table>
8900 !!end
8903 ### Token Stream Patcher tests
8905 ### These tests won't always pass wt2wt and other modes because
8906 ### on serialization, the table will be output on a new line.
8907 ### For now, we are blacklisting them, and using this to test selser.
8910 !!test
8911 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
8912 !!options
8913 parsoid=wt2html,wt2wt
8914 !!wikitext
8915 {{echo|}}{| width = '100%'
8916 |foo
8918 !!html/parsoid
8919 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
8920 <table width="100%">
8921 <tbody>
8922 <tr>
8923 <td>foo</td></tr></tbody></table>
8924 !!end
8926 !!test
8927 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
8928 !!options
8929 parsoid=wt2html,wt2wt
8930 !!wikitext
8931 <includeonly>a</includeonly>{| {{{b}}}
8934 !!html/parsoid
8935 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
8936 <tbody><tr><td>c</td></tr>
8937 </tbody></table>
8939 !!end
8942 ### Testing parsing of templates where a template arg
8943 ### has the same name as the template itself.
8946 !! article
8947 Template:quote
8948 !! text
8949 {{{quote|{{{1}}}}}}
8950 !! endarticle
8952 !!test
8953 Templates: Template Name/Arg clash: 1. Use of positional param
8954 !! wikitext
8955 {{quote|foo}}
8956 !! html
8957 <p>foo
8958 </p>
8959 !!end
8961 !!test
8962 Templates: Template Name/Arg clash: 2. Use of named param
8963 !! wikitext
8964 {{quote|quote=foo}}
8965 !! html
8966 <p>foo
8967 </p>
8968 !!end
8970 !!test
8971 Templates: Template Name/Arg clash: 3. Use of named param with empty input
8972 !! wikitext
8973 {{quote|quote}}
8974 !! html
8975 <p>quote
8976 </p>
8977 !!end
8980 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
8983 !!test
8984 Templates: 1. Simple use
8985 !! wikitext
8986 {{echo|Foo}}
8987 !! html
8988 <p>Foo
8989 </p>
8990 !!end
8992 !!test
8993 Templates: 2. Inside a block tag
8994 !! wikitext
8995 <div>{{echo|Foo}}</div>
8996 <blockquote>{{echo|Foo}}</blockquote>
8997 !! html
8998 <div>Foo</div>
8999 <blockquote>Foo</blockquote>
9001 !!end
9003 !!test
9004 Templates: P-wrapping: 1a. Templates on consecutive lines
9005 !! wikitext
9006 {{echo|Foo}}
9007 {{echo|bar}}
9008 !! html
9009 <p>Foo
9011 </p>
9012 !!end
9014 !!test
9015 Templates: P-wrapping: 1b. Templates on consecutive lines
9016 !! wikitext
9019 {{echo|bar}}
9020 {{echo|baz}}
9021 !! html
9022 <p>Foo
9023 </p><p>bar
9025 </p>
9026 !!end
9028 !!test
9029 Templates: P-wrapping: 1c. Templates on consecutive lines
9030 !! wikitext
9031 {{echo|Foo}}
9032 {{echo|bar}} <div>baz</div>
9033 !! html
9034 <p>Foo
9035 </p>
9036 bar <div>baz</div>
9038 !!end
9040 !!test
9041 Templates: P-wrapping: 1d. Template preceded by comment-only line
9042 !!options
9043 parsoid
9044 !! wikitext
9045 <!-- foo -->
9046 {{echo|Bar}}
9047 !! html
9048 <!-- foo -->
9050 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9051 !!end
9053 !!test
9054 Templates: Inline Text: 1. Multiple template uses
9055 !! wikitext
9056 {{echo|Foo}}bar{{echo|baz}}
9057 !! html
9058 <p>Foobarbaz
9059 </p>
9060 !!end
9062 !!test
9063 Templates: Inline Text: 2. Back-to-back template uses
9064 !! wikitext
9065 {{echo|Foo}}{{echo|bar}}
9066 !! html
9067 <p>Foobar
9068 </p>
9069 !!end
9071 !!test
9072 Templates: Block Tags: 1. Multiple template uses
9073 !! wikitext
9074 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
9075 !! html
9076 <div>Foo</div><div>bar</div><div>baz</div>
9078 !!end
9080 !!test
9081 Templates: Block Tags: 2. Back-to-back template uses
9082 !! wikitext
9083 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
9084 !! html
9085 <div>Foo</div><div>bar</div>
9087 !!end
9089 !!test
9090 Templates: Links: 1. Simple example
9091 !! wikitext
9092 {{echo|[[Foo|bar]]}}
9093 !! html
9094 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9095 </p>
9096 !!end
9098 !!test
9099 Templates: Links: 2. Generation of link href
9100 !! wikitext
9101 [[{{echo|Foo}}|bar]]
9102 !! html
9103 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9104 </p>
9105 !!end
9107 !!test
9108 Templates: Links: 3. Generation of part of a link href
9109 !! wikitext
9110 [[Fo{{echo|o}}|bar]]
9112 [[Foo{{echo|bar}}]]
9114 [[Foo{{echo|bar}}baz]]
9116 [[Foo{{echo|bar}}|bar]]
9118 [[:Foo{{echo|bar}}]]
9120 [[:Foo{{echo|bar}}|bar]]
9121 !! html
9122 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9123 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9124 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
9125 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9126 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9127 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
9128 </p>
9129 !!end
9131 !!test
9132 Templates: Links: 4. Multiple templates generating link href
9133 !! wikitext
9134 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
9135 !! html
9136 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
9137 </p>
9138 !!end
9140 !!test
9141 Templates: Links: 5. Generation of link text
9142 !! wikitext
9143 [[Foo|{{echo|bar}}]]
9144 !! html
9145 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9146 </p>
9147 !!end
9149 !!test
9150 Templates: Links: 5. Nested templates (only outermost template should be marked)
9151 !! wikitext
9152 {{echo|[[{{echo|Foo}}|bar]]}}
9153 !! html
9154 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
9155 </p>
9156 !!end
9158 !!test
9159 Templates: HTML Tag: 1. Generation of HTML attr. key
9160 !! wikitext
9161 <div {{echo|style}}="color:red;">foo</div>
9162 !! html
9163 <div style="color:red;">foo</div>
9165 !!end
9167 !!test
9168 Templates: HTML Tag: 2. Generation of HTML attr. value
9169 !! wikitext
9170 <div style={{echo|'color:red;'}}>foo</div>
9171 !! html
9172 <div style="color:red;">foo</div>
9174 !!end
9176 !!test
9177 Templates: HTML Tag: 3. Generation of HTML attr key and value
9178 !! wikitext
9179 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
9180 !! html
9181 <div style="color:red;">foo</div>
9183 !!end
9185 !!test
9186 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
9187 !! wikitext
9188 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
9189 !! html
9190 <div title="This is a long title with just one piece templated">foo</div>
9192 !!end
9194 !!test
9195 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
9196 !! wikitext
9197 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
9198 !! html
9199 <div title="This is a long title with just one piece templated">foo</div>
9201 !!end
9203 !!test
9204 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
9205 !! wikitext
9206 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
9207 !! html
9208 <div title="This is a long title with just one piece templated">foo</div>
9210 !!end
9212 !!test
9213 Templates: HTML Tag: 7. Generation of partial attribute key string
9214 !! wikitext
9215 <div st{{echo|yle}}="color:red;">foo</div>
9216 !! html
9217 <div style="color:red;">foo</div>
9219 !!end
9221 !!test
9222 Templates: HTML Tables: 1. Generating start of a HTML table
9223 !! wikitext
9224 {{echo|<table><tr><td>foo</td>}}</tr></table>
9225 !! html
9226 <table><tr><td>foo</td></tr></table>
9228 !!end
9230 !!test
9231 Templates: HTML Tables: 2a. Generating middle of a HTML table
9232 !! wikitext
9233 <table><tr>{{echo|<td>foo</td>}}</tr></table>
9234 !! html
9235 <table><tr><td>foo</td></tr></table>
9237 !!end
9239 !!test
9240 Templates: HTML Tables: 2b. Generating middle of a HTML table
9241 !! wikitext
9242 <table>{{echo|<tr><td>foo</td></tr>}}</table>
9243 !! html
9244 <table><tr><td>foo</td></tr></table>
9246 !!end
9248 !!test
9249 Templates: HTML Tables: 3. Generating end of a HTML table
9250 !! wikitext
9251 <table><tr>{{echo|<td>foo</td></tr></table>}}
9252 !! html
9253 <table><tr><td>foo</td></tr></table>
9255 !!end
9257 !!test
9258 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
9259 !! wikitext
9260 {{echo|<table>}}<tr><td>foo</td></tr></table>
9261 !! html
9262 <table><tr><td>foo</td></tr></table>
9264 !!end
9266 !!test
9267 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
9268 !! wikitext
9269 <table>{{echo|<tr>}}<td>foo</td></tr></table>
9270 !! html
9271 <table><tr><td>foo</td></tr></table>
9273 !!end
9275 !!test
9276 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
9277 !! wikitext
9278 <table><tr>{{echo|<td>}}foo</td></tr></table>
9279 !! html
9280 <table><tr><td>foo</td></tr></table>
9282 !!end
9284 !!test
9285 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
9286 !! wikitext
9287 <table><tr><td>foo{{echo|</td>}}</tr></table>
9288 !! html
9289 <table><tr><td>foo</td></tr></table>
9291 !!end
9293 !!test
9294 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
9295 !! wikitext
9296 <table><tr><td>foo</td>{{echo|</tr>}}</table>
9297 !! html
9298 <table><tr><td>foo</td></tr></table>
9300 !!end
9302 !!test
9303 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
9304 !! wikitext
9305 <table><tr><td>foo</td></tr>{{echo|</table>}}
9306 !! html
9307 <table><tr><td>foo</td></tr></table>
9309 !!end
9311 !!test
9312 Templates: HTML Tables: 5. Proper fostering of categories from inside
9313 !!options
9314 parsoid=wt2html,wt2wt
9315 !! wikitext
9316 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
9317 <!--Two categories (Bug 50330)-->
9318 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
9319 !! html
9320 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
9321 <!--Two categories (Bug 50330)-->
9322 <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>
9323 !!end
9325 !!test
9326 Templates: Wiki Tables: 1a. Fostering of entire template content
9327 !! wikitext
9329 {{echo|a}}
9331 !! html
9332 <table>
9334 <tr><td></td></tr></table>
9336 !!end
9338 !!test
9339 Templates: Wiki Tables: 1b. Fostering of entire template content
9340 !! wikitext
9342 {{echo|<div>}}
9344 {{echo|</div>}}
9346 !! html
9347 <table>
9348 <div>
9349 <p>foo
9350 </p>
9351 </div>
9352 <tr><td></td></tr></table>
9354 !!end
9356 !!test
9357 Templates: Wiki Tables: 2. Fostering of partial template content
9358 !! wikitext
9360 {{echo|a
9361 <div>b</div>}}
9363 !! html
9364 <table>
9366 <div>b</div>
9367 <tr><td></td></tr></table>
9369 !!end
9371 !!test
9372 Templates: Wiki Tables: 3. td-content via multiple templates
9373 !! wikitext
9375 {{echo|{{pipe}}a}}{{echo|b}}
9377 !! html
9378 <table>
9379 <tr>
9380 <td>ab
9381 </td></tr></table>
9383 !!end
9385 !!test
9386 Templates: Wiki Tables: 4. Templated tags, no content
9387 !! wikitext
9388 {{tbl-start}}
9389 {{tbl-end}}
9390 !! html
9391 <table>
9392 <tr><td></td></tr></table>
9394 !!end
9396 !!test
9397 Templates: Wiki Tables: 5. Templated tags, regular td-tags
9398 !! wikitext
9399 {{tbl-start}}
9400 |foo
9401 {{tbl-end}}
9402 !! html
9403 <table>
9404 <tr>
9405 <td>foo
9406 </td></tr></table>
9408 !!end
9410 !!test
9411 Templates: Wiki Tables: 6. Templated tags, templated td-tags
9412 !! wikitext
9413 {{tbl-start}}
9414 {{!}}foo
9415 {{tbl-end}}
9416 !! html
9417 <table>
9418 <tr>
9419 <td>foo
9420 </td></tr></table>
9422 !!end
9424 !!test
9425 Templates: Lists: Multi-line list-items via templates
9426 !! wikitext
9427 *{{echo|a {{nonexistent|
9428 unused}}}}
9429 *{{echo|b {{nonexistent|
9430 unused}}}}
9431 !! html
9432 <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>
9433 <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>
9435 !!end
9437 !!test
9438 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
9439 !! wikitext
9440 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
9441 !! html
9442 <p><i>ab</i>c<i>d</i>e
9443 </p>
9444 !!end
9446 !!test
9447 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
9448 (PHP parser generates misnested html)
9449 !! wikitext
9450 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
9451 !! html/parsoid
9452 <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>
9453 !!end
9455 !!test
9456 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
9457 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
9458 !! options
9459 parsoid=wt2html,wt2wt
9460 !! wikitext
9461 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
9462 !! html
9463 <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>
9464 <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>
9465 <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>
9466 !!end
9468 !!test
9469 Templates: Ugly nesting: 4. Divs opened/closed across templates
9470 !! wikitext
9471 a<div>b{{echo|c</div>d}}e
9472 !! html
9473 a<div>bc</div>de
9475 !!end
9477 !!test
9478 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
9479 (Parsoid-centric)
9480 !! options
9481 parsoid
9482 !! wikitext
9484 |{{echo|foo</table>}}
9485 |bar
9487 !! html
9488 <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|}"]}'>
9490 <tbody>
9491 <tr>
9492 <td>foo</td></tr></tbody></table><span about="#mwt1">
9493 </span><span about="#mwt1">|bar</span><span about="#mwt1">
9494 |}</span>
9495 !!end
9497 !!test
9498 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
9499 (Parsoid-centric)
9500 !! options
9501 parsoid
9502 !! wikitext
9503 <table>
9504   <tr>
9505     <td>
9506     <table>
9507       <tr>
9508         <td>1. {{echo|foo </table>}}</td>
9509         <td> bar </td>
9510         <td>2. {{echo|baz </table>}}</td>
9511       </tr>
9512       <tr>
9513         <td>abc</td>
9514       </tr>
9515     </table>
9516     </td>
9517   </tr>
9518   <tr>
9519     <td>xyz</td>
9520   </tr>
9521 </table>
9522 !! html
9523 <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>"]}'>
9524   <tbody><tr>
9525     <td>
9526     <table>
9527       <tbody><tr>
9528         <td>1. foo </td></tr></tbody></table></td>
9529         <td> bar </td>
9530         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
9531       </span><span about="#mwt2">
9532       </span><span about="#mwt2">
9533         </span><span about="#mwt2">abc</span><span about="#mwt2">
9534       </span><span about="#mwt2">
9535     </span><span about="#mwt2">
9536     </span><span about="#mwt2">
9537   </span><span about="#mwt2">
9538   </span><span about="#mwt2">
9539     </span><span about="#mwt2">xyz</span><span about="#mwt2">
9540   </span><span about="#mwt2">
9541 </span>
9542 !!end
9544 !! test
9545 Templates: Ugly templates: 3. newline-only template parameter
9546 !! wikitext
9547 foo {{echo|
9549 !! html
9550 <p>foo 
9551 </p>
9552 !! end
9554 # This looks like a bug: a single newline triggers p/br for some reason.
9555 !! test
9556 Templates: Ugly templates: 4. newline-only template parameter inconsistency
9557 !! wikitext
9558 {{echo|
9560 !! html
9561 <p><br />
9562 </p>
9563 !! end
9565 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
9566 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
9567 !! test
9568 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
9569 !! wikitext
9570 {{echo|<table>}}
9571 {{echo|<div>foo}}
9572 {{echo|</table>}}
9573 !! html/parsoid
9574 <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
9575 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9576 </table>
9577 !! end
9579 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
9580 # that are "identical" and generate nesting cycles in the algorithm
9581 !! test
9582 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
9583 !! wikitext
9584 {{echo|<table><tr><td><table>}}
9585 {{echo|<div>}}
9586 {{echo|</div>}}
9587 !! html/parsoid
9588 <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"}'>
9589 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
9590 </table></td></tr></tbody></table>
9591 !! end
9593 !!test
9594 Parser Functions: 1. Simple example
9595 !! wikitext
9596 {{uc:foo}}
9597 !! html
9598 <p>FOO
9599 </p>
9600 !!end
9602 !!test
9603 Parser Functions: 2. Nested use (only outermost should be marked up)
9604 !! wikitext
9605 {{uc:{{lc:FOO}}}}
9606 !! html
9607 <p>FOO
9608 </p>
9609 !!end
9612 ### Pre-save transform tests
9614 !! test
9615 pre-save transform: subst:
9616 !! options
9618 !! wikitext
9619 {{subst:test}}
9620 !! html
9621 This is a test template
9622 !! end
9624 !! test
9625 pre-save transform: normal template
9626 !! options
9628 !! wikitext
9629 {{test}}
9630 !! html
9631 {{test}}
9632 !! end
9634 !! test
9635 pre-save transform: nonexistent template
9636 !! options
9638 !! wikitext
9639 {{thistemplatedoesnotexist}}
9640 !! html
9641 {{thistemplatedoesnotexist}}
9642 !! end
9645 !! test
9646 pre-save transform: subst magic variables
9647 !! options
9649 !! wikitext
9650 {{subst:SITENAME}}
9651 !! html
9652 MediaWiki
9653 !! end
9655 # This is bug 89, which I fixed. -- wtm
9656 !! test
9657 pre-save transform: subst: templates with parameters
9658 !! options
9660 !! wikitext
9661 {{subst:paramtest|param="something else"}}
9662 !! html
9663 This is a test template with parameter "something else"
9664 !! end
9666 !! article
9667 Template:nowikitest
9668 !! text
9669 <nowiki>'''not wiki'''</nowiki>
9670 !! endarticle
9672 !! test
9673 pre-save transform: nowiki in subst (bug 1188)
9674 !! options
9676 !! wikitext
9677 {{subst:nowikitest}}
9678 !! html
9679 <nowiki>'''not wiki'''</nowiki>
9680 !! end
9683 !! article
9684 Template:commenttest
9685 !! text
9686 This template has <!-- a comment --> in it.
9687 !! endarticle
9689 !! test
9690 pre-save transform: comment in subst (bug 1936)
9691 !! options
9693 !! wikitext
9694 {{subst:commenttest}}
9695 !! html
9696 This template has <!-- a comment --> in it.
9697 !! end
9699 !! test
9700 pre-save transform: unclosed tag
9701 !! options
9702 pst noxml
9703 !! wikitext
9704 <nowiki>'''not wiki'''
9705 !! html
9706 <nowiki>'''not wiki'''
9707 !! end
9709 !! test
9710 pre-save transform: mixed tag case
9711 !! options
9712 pst noxml
9713 !! wikitext
9714 <NOwiki>'''not wiki'''</noWIKI>
9715 !! html
9716 <NOwiki>'''not wiki'''</noWIKI>
9717 !! end
9719 !! test
9720 pre-save transform: unclosed comment in <nowiki>
9721 !! options
9722 pst noxml
9723 !! wikitext
9724 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9725 !! html
9726 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
9727 !!end
9729 # Leading @ in this template definition works around a limitation
9730 # in parsoid's parserTests which otherwise strips the <span> from the
9731 # result (confusing it for a template wrapper)
9732 !! article
9733 Template:dangerous
9734 !!text
9735 @<span onmouseover="alert('crap')">Oh no</span>
9736 !!endarticle
9738 !!test
9739 (confirming safety of fix for subst bug 1936)
9740 !! wikitext
9741 {{Template:dangerous}}
9742 !! html
9743 <p>@<span>Oh no</span>
9744 </p>
9745 !! end
9747 !! test
9748 pre-save transform: comment containing gallery (bug 5024)
9749 !! options
9751 !! wikitext
9752 <!-- <gallery>data</gallery> -->
9753 !! html
9754 <!-- <gallery>data</gallery> -->
9755 !!end
9757 !! test
9758 pre-save transform: comment containing extension
9759 !! options
9761 !! wikitext
9762 <!-- <tag>data</tag> -->
9763 !! html
9764 <!-- <tag>data</tag> -->
9765 !!end
9767 !! test
9768 pre-save transform: comment containing nowiki
9769 !! options
9771 !! wikitext
9772 <!-- <nowiki>data</nowiki> -->
9773 !! html
9774 <!-- <nowiki>data</nowiki> -->
9775 !!end
9777 !! test
9778 pre-save transform: <noinclude> in subst (bug 3298)
9779 !! options
9781 !! wikitext
9782 {{subst:Includes}}
9783 !! html
9784 Foobar
9785 !! end
9787 !! test
9788 pre-save transform: <onlyinclude> in subst (bug 3298)
9789 !! options
9791 !! wikitext
9792 {{subst:Includes2}}
9793 !! html
9795 !! end
9797 !! article
9798 Template:SubstTest
9799 !!text
9800 {{<includeonly>subst:</includeonly>Includes}}
9801 !! endarticle
9803 !! article
9804 Template:SafeSubstTest
9805 !! text
9806 {{<includeonly>safesubst:</includeonly>Includes}}
9807 !! endarticle
9809 !! test
9810 bug 22297: safesubst: works during PST
9811 !! options
9813 !! wikitext
9814 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
9815 !! html
9816 FoobarFoobar
9817 !! end
9819 !! test
9820 bug 22297: safesubst: works during normal parse
9821 !! wikitext
9822 {{SafeSubstTest}}
9823 !! html
9824 <p>Foobar
9825 </p>
9826 !! end
9828 !! test
9829 subst: does not work during normal parse
9830 !! wikitext
9831 {{SubstTest}}
9832 !! html
9833 <p>{{subst:Includes}}
9834 </p>
9835 !! end
9837 !! test
9838 pre-save transform: context links ("pipe trick")
9839 !! options
9841 !! wikitext
9842 [[Article (context)|]]
9843 [[Bar:Article|]]
9844 [[:Bar:Article|]]
9845 [[Bar:Article (context)|]]
9846 [[:Bar:Article (context)|]]
9847 [[|Article]]
9848 [[|Article (context)]]
9849 [[Bar:X (Y) Z|]]
9850 [[:Bar:X (Y) Z|]]
9851 !! html
9852 [[Article (context)|Article]]
9853 [[Bar:Article|Article]]
9854 [[:Bar:Article|Article]]
9855 [[Bar:Article (context)|Article]]
9856 [[:Bar:Article (context)|Article]]
9857 [[Article]]
9858 [[Article (context)]]
9859 [[Bar:X (Y) Z|X (Y) Z]]
9860 [[:Bar:X (Y) Z|X (Y) Z]]
9861 !! end
9863 !! test
9864 pre-save transform: context links ("pipe trick") with interwiki prefix
9865 !! options
9867 !! wikitext
9868 [[interwiki:Article|]]
9869 [[:interwiki:Article|]]
9870 [[interwiki:Bar:Article|]]
9871 [[:interwiki:Bar:Article|]]
9872 !! html
9873 [[interwiki:Article|Article]]
9874 [[:interwiki:Article|Article]]
9875 [[interwiki:Bar:Article|Bar:Article]]
9876 [[:interwiki:Bar:Article|Bar:Article]]
9877 !! end
9879 !! test
9880 pre-save transform: context links ("pipe trick") with parens in title
9881 !! options
9882 pst title=[[Somearticle (context)]]
9883 !! wikitext
9884 [[|Article]]
9885 !! html
9886 [[Article (context)|Article]]
9887 !! end
9889 !! test
9890 pre-save transform: context links ("pipe trick") with comma in title
9891 !! options
9892 pst title=[[Someplace, Somewhere]]
9893 !! wikitext
9894 [[|Otherplace]]
9895 [[Otherplace, Elsewhere|]]
9896 [[Otherplace, Elsewhere, Anywhere|]]
9897 !! html
9898 [[Otherplace, Somewhere|Otherplace]]
9899 [[Otherplace, Elsewhere|Otherplace]]
9900 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
9901 !! end
9903 !! test
9904 pre-save transform: context links ("pipe trick") with parens and comma
9905 !! options
9906 pst title=[[Someplace (IGNORED), Somewhere]]
9907 !! wikitext
9908 [[|Otherplace]]
9909 [[Otherplace (place), Elsewhere|]]
9910 !! html
9911 [[Otherplace, Somewhere|Otherplace]]
9912 [[Otherplace (place), Elsewhere|Otherplace]]
9913 !! end
9915 !! test
9916 pre-save transform: context links ("pipe trick") with comma and parens
9917 !! options
9918 pst title=[[Who, me? (context)]]
9919 !! wikitext
9920 [[|Yes, you.]]
9921 [[Me, Myself, and I (1937 song)|]]
9922 !! html
9923 [[Yes, you. (context)|Yes, you.]]
9924 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
9925 !! end
9927 !! test
9928 pre-save transform: context links ("pipe trick") with namespace
9929 !! options
9930 pst title=[[Ns:Somearticle]]
9931 !! wikitext
9932 [[|Article]]
9933 !! html
9934 [[Ns:Article|Article]]
9935 !! end
9937 !! test
9938 pre-save transform: context links ("pipe trick") with namespace and parens
9939 !! options
9940 pst title=[[Ns:Somearticle (context)]]
9941 !! wikitext
9942 [[|Article]]
9943 !! html
9944 [[Ns:Article (context)|Article]]
9945 !! end
9947 !! test
9948 pre-save transform: context links ("pipe trick") with namespace and comma
9949 !! options
9950 pst title=[[Ns:Somearticle, Context, Whatever]]
9951 !! wikitext
9952 [[|Article]]
9953 !! html
9954 [[Ns:Article, Context, Whatever|Article]]
9955 !! end
9957 !! test
9958 pre-save transform: context links ("pipe trick") with namespace, comma and parens
9959 !! options
9960 pst title=[[Ns:Somearticle, Context (context)]]
9961 !! wikitext
9962 [[|Article]]
9963 !! html
9964 [[Ns:Article (context)|Article]]
9965 !! end
9967 !! test
9968 pre-save transform: context links ("pipe trick") with namespace, parens and comma
9969 !! options
9970 pst title=[[Ns:Somearticle (IGNORED), Context]]
9971 !! wikitext
9972 [[|Article]]
9973 !! html
9974 [[Ns:Article, Context|Article]]
9975 !! end
9977 !! test
9978 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
9979 !! options
9981 !! wikitext
9982 [[Article(context)|]]
9983 [[Bar:Article(context)|]]
9984 [[:Bar:Article(context)|]]
9985 [[|Article(context)]]
9986 [[Bar:X(Y)Z|]]
9987 [[:Bar:X(Y)Z|]]
9988 !! html
9989 [[Article(context)|Article]]
9990 [[Bar:Article(context)|Article]]
9991 [[:Bar:Article(context)|Article]]
9992 [[Article(context)]]
9993 [[Bar:X(Y)Z|X(Y)Z]]
9994 [[:Bar:X(Y)Z|X(Y)Z]]
9995 !! end
9997 !! test
9998 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
9999 !! options
10001 !! wikitext
10002 [[Article (context)|]]
10003 [[Bar:Article (context)|]]
10004 [[:Bar:Article (context)|]]
10005 [[|Article (context)]]
10006 [[Bar:X (Y) Z|]]
10007 [[:Bar:X (Y) Z|]]
10008 !! html
10009 [[Article (context)|Article]]
10010 [[Bar:Article (context)|Article]]
10011 [[:Bar:Article (context)|Article]]
10012 [[Article (context)]]
10013 [[Bar:X (Y) Z|X (Y) Z]]
10014 [[:Bar:X (Y) Z|X (Y) Z]]
10015 !! end
10017 !! test
10018 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10019 !! options
10021 !! wikitext
10022 [[Article(context)|]]
10023 [[Bar:Article(context)|]]
10024 [[:Bar:Article(context)|]]
10025 [[|Article(context)]]
10026 [[Bar:X(Y)Z|]]
10027 [[:Bar:X(Y)Z|]]
10028 !! html
10029 [[Article(context)|Article]]
10030 [[Bar:Article(context)|Article]]
10031 [[:Bar:Article(context)|Article]]
10032 [[Article(context)]]
10033 [[Bar:X(Y)Z|X(Y)Z]]
10034 [[:Bar:X(Y)Z|X(Y)Z]]
10035 !! end
10037 !! test
10038 pre-save transform: context links ("pipe trick") with commas (bug 21660)
10039 !! options
10041 !! wikitext
10042 [[Article (context), context|]]
10043 [[Article (context),context|]]
10044 [[Bar:Article (context), context|]]
10045 [[Bar:Article (context),context|]]
10046 [[:Bar:Article (context), context|]]
10047 [[:Bar:Article (context),context|]]
10048 !! html
10049 [[Article (context), context|Article]]
10050 [[Article (context),context|Article]]
10051 [[Bar:Article (context), context|Article]]
10052 [[Bar:Article (context),context|Article]]
10053 [[:Bar:Article (context), context|Article]]
10054 [[:Bar:Article (context),context|Article]]
10055 !! end
10057 !! test
10058 pre-save transform: trim trailing empty lines
10059 !! options
10061 !! wikitext
10062 Empty lines are trimmed
10067 !! html
10068 Empty lines are trimmed
10069 !! end
10071 !! test
10072 pre-save transform: Signature expansion
10073 !! options
10075 !! wikitext
10076 * ~~~
10077 * <noinclude>~~~</noinclude>
10078 * <includeonly>~~~</includeonly>
10079 * <onlyinclude>~~~</onlyinclude>
10080 !! html
10081 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
10082 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
10083 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
10084 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
10085 !! end
10088 !! test
10089 pre-save transform: Signature expansion in nowiki tags (bug 93)
10090 !! options
10091 pst disabled
10092 !! wikitext
10093 Shall not expand:
10095 <nowiki>~~~~</nowiki>
10097 <includeonly><nowiki>~~~~</nowiki></includeonly>
10099 <noinclude><nowiki>~~~~</nowiki></noinclude>
10101 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10103 {{subst:Foo}} shall be converted to FOO
10105 As well as inside noinclude/onlyinclude
10106 <noinclude>{{subst:Foo}}</noinclude>
10107 <onlyinclude>{{subst:Foo}}</onlyinclude>
10109 But not inside includeonly
10110 <includeonly>{{subst:Foo}}</includeonly>
10111 !! html
10112 Shall not expand:
10114 <nowiki>~~~~</nowiki>
10116 <includeonly><nowiki>~~~~</nowiki></includeonly>
10118 <noinclude><nowiki>~~~~</nowiki></noinclude>
10120 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
10122 FOO shall be converted to FOO
10124 As well as inside noinclude/onlyinclude
10125 <noinclude>FOO</noinclude>
10126 <onlyinclude>FOO</onlyinclude>
10128 But not inside includeonly
10129 <includeonly>{{subst:Foo}}</includeonly>
10130 !! end
10132 !! test
10133 Parsoid: Recognize nowiki with trailing space in tags
10134 !! options
10135 parsoid=wt2html
10136 !! wikitext
10137 <nowiki ><div>[[foo]]</nowiki >
10139 a<nowiki / >b
10141 c<nowiki />d
10143 e<nowiki/ >f
10144 !! html
10145 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10146 <p>ab</p>
10147 <p>cd</p>
10148 <p>ef</p>
10149 !! end
10151 !! test
10152 Parsoid: Recognize nowiki with odd capitalization
10153 !! options
10154 parsoid=wt2html
10155 !! wikitext
10156 <noWikI ><div>[[foo]]</Nowiki >
10157 !! html
10158 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
10159 !! end
10162 !! test
10163 Parsoid: Escape nowiki with trailing space in tags
10164 !! options
10165 parsoid=html2wt
10166 !! wikitext
10167 &lt;nowiki &gt; foo &lt;/nowiki &gt;
10169 a&lt;nowiki /&gt;b
10171 c&lt;nowiki/ &gt;d
10172 !! html
10173 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
10174 <p>a&lt;nowiki /&gt;b</p>
10175 <p>c&lt;nowiki/ &gt;d</p>
10176 !! end
10178 !! test
10179 Parsoid: Escape weird noWikI capitalizations
10180 !! options
10181 parsoid=html2wt
10182 !! wikitext
10183 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
10184 !! html
10185 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
10186 !! end
10189 ### Message transform tests
10191 !! test
10192 message transform: magic variables
10193 !! options
10195 !! wikitext
10196 {{SITENAME}}
10197 !! html
10198 MediaWiki
10199 !! end
10201 !! test
10202 message transform: should not transform wiki markup
10203 !! options
10205 !! wikitext
10206 ''test''
10207 !! html
10208 ''test''
10209 !! end
10211 !! test
10212 message transform: <noinclude> in transcluded template (bug 4926)
10213 !! options
10215 !! wikitext
10216 {{Includes}}
10217 !! html
10218 Foobar
10219 !! end
10221 !! test
10222 message transform: <onlyinclude> in transcluded template (bug 4926)
10223 !! options
10225 !! wikitext
10226 {{Includes2}}
10227 !! html
10229 !! end
10231 !! test
10232 {{#special:}} page name, known
10233 !! options
10235 !! wikitext
10236 {{#special:Recentchanges}}
10237 !! html
10238 Special:RecentChanges
10239 !! end
10241 !! test
10242 {{#special:}} page name with subpage, known
10243 !! options
10245 !! wikitext
10246 {{#special:Recentchanges/param}}
10247 !! html
10248 Special:RecentChanges/param
10249 !! end
10251 !! test
10252 {{#special:}} page name, unknown
10253 !! options
10255 !! wikitext
10256 {{#special:foobar nonexistent}}
10257 !! html
10258 Special:Foobar nonexistent
10259 !! end
10261 !! test
10262 {{#speciale:}} page name, known
10263 !! options
10265 !! wikitext
10266 {{#speciale:Recentchanges}}
10267 !! html
10268 Special:RecentChanges
10269 !! end
10271 !! test
10272 {{#speciale:}} page name with subpage, known
10273 !! options
10275 !! wikitext
10276 {{#speciale:Recentchanges/param}}
10277 !! html
10278 Special:RecentChanges/param
10279 !! end
10281 !! test
10282 {{#speciale:}} page name, unknown
10283 !! options
10285 !! wikitext
10286 {{#speciale:foobar nonexistent}}
10287 !! html
10288 Special:Foobar_nonexistent
10289 !! end
10292 ### Images
10294 ### For Parsoid-specific tests, see
10295 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
10297 !! test
10298 Simple image
10299 !! options
10300 parsoid=wt2html,wt2wt,html2html
10301 !! wikitext
10302 [[Image:foobar.jpg]]
10303 !! html/php
10304 <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>
10305 </p>
10306 !! html/parsoid
10307 <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>
10308 </p>
10309 !! end
10311 !! test
10312 Simple image (using File: namespace, now canonical)
10313 !! wikitext
10314 [[File:Foobar.jpg]]
10315 !! html/php
10316 <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>
10317 </p>
10318 !! html/parsoid
10319 <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>
10320 </p>
10321 !! end
10323 !! test
10324 Right-aligned image
10325 !! wikitext
10326 [[File:Foobar.jpg|right]]
10327 !! html/php
10328 <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>
10330 !! html/parsoid
10331 <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>
10332 !! end
10334 !! test
10335 Image with caption
10336 !! wikitext
10337 [[File:Foobar.jpg|right|Caption text]]
10338 !! html/php
10339 <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>
10341 !! html/parsoid
10342 <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>
10343 !! end
10345 !! test
10346 Image with caption, bug 53312 #1
10347 !! wikitext
10348 [[File:Foobar.jpg|right|Caption page stuff]]
10349 !! html/php
10350 <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>
10352 !! html/parsoid
10353 <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>
10354 !! end
10356 !! test
10357 Image with caption, bug 53312 #2
10358 !! wikitext
10359 [[File:Foobar.jpg|right|Caption page=]]
10360 !! html/php
10361 <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>
10363 !! html/parsoid
10364 <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>
10365 !! end
10367 !! test
10368 Image with caption, bug 53312 #3
10369 !! wikitext
10370 [[File:Foobar.jpg|right|Caption page=stuff]]
10371 !! html/php
10372 <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>
10374 !! html/parsoid
10375 <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>
10376 !! end
10378 !! test
10379 Allow empty links in image captions (Bug 60753)
10380 !! options
10381 thumbsize=220
10382 !! wikitext
10383 [[File:Foobar.jpg|thumb|Caption [[Link1]]
10384 [[]]
10385 [[Link2]]
10387 !! html/php
10388 <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>
10390 !! html/parsoid
10391 <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>
10392 [[]]
10393 <a rel="mw:WikiLink" href="./Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"},"dsr":[47,56,2,2]}'>Link2</a>
10394 </figcaption></figure>
10395 !! end
10397 !! test
10398 Link with empty target
10399 !! wikitext
10400 [[]]
10401 !! html
10402 <p>[[]]
10403 </p>
10404 !! end
10406 !! test
10407 Image with empty attribute
10408 !! options
10409 parsoid=wt2html,wt2wt,html2html
10410 !! wikitext
10411 [[File:Foobar.jpg|right||Caption text]]
10412 !! html/php
10413 <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>
10415 !! html/parsoid
10416 <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>
10417 !! end
10419 !! test
10420 1. Block image with individual attributes from templates
10421 !! wikitext
10422 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
10423 !! html/php
10424 <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>
10426 !! html/parsoid
10427 <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>
10428 !! end
10430 !! test
10431 2. Block Image with individual attributes from templates
10432 !! wikitext
10433 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
10434 !! html/php
10435 <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>
10437 !! html/parsoid
10438 <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>
10439 !! end
10441 !! test
10442 3. Inline image with individual attributes from templates
10443 !! wikitext
10444 [[File:Foobar.jpg|{{echo|50px}}]]
10445 !! html/php
10446 <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>
10447 </p>
10448 !! html/parsoid
10449 <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>
10450 !! end
10452 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
10453 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
10454 !! test
10455 Image with multiple attributes from the same template
10456 !! wikitext
10457 [[File:Foobar.jpg|{{image_attribs}}]]
10458 !! html/php
10459 <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>
10461 !! html/parsoid
10462 <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>
10463 !! end
10465 !! test
10466 Image with link tails
10467 !! options
10468 thumbsize=220
10469 !! wikitext
10470 123[[File:Foobar.jpg]]456
10471 123[[File:Foobar.jpg|right]]456
10472 123[[File:Foobar.jpg|thumb]]456
10473 !! html/php
10474 <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
10475 </p>
10476 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
10477 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
10479 !! html/parsoid
10480 <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>
10481 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
10482 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
10483 !! end
10485 !! test
10486 Image with multiple captions -- only last one is accepted
10487 !! wikitext
10488 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
10489 !! html/php
10490 <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>
10492 !! html/parsoid
10493 <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>
10494 !! end
10496 !! test
10497 Image with multiple widths -- use last
10498 !! wikitext
10499 [[File:Foobar.jpg|200px|300px|caption]]
10500 !! html/php
10501 <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>
10502 </p>
10503 !! html/parsoid
10504 <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>
10505 !! end
10507 !! test
10508 Image with multiple alignments -- use first (bug 48664)
10509 !! options
10510 thumbsize=220
10511 !! wikitext
10512 [[File:Foobar.jpg|thumb|left|right|center|caption]]
10514 [[File:Foobar.jpg|middle|text-top|caption]]
10515 !! html/php
10516 <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>
10517 <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>
10518 </p>
10519 !! html/parsoid
10520 <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>
10521 <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>
10522 !! end
10524 !! test
10525 Image with width attribute at different positions
10526 !! wikitext
10527 [[File:Foobar.jpg|200px|right|Caption]]
10528 [[File:Foobar.jpg|right|200px|Caption]]
10529 [[File:Foobar.jpg|right|Caption|200px]]
10530 !! html/php
10531 <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>
10532 <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>
10533 <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>
10535 !! html/parsoid
10536 <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>
10537 <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>
10538 <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>
10539 !! end
10541 # a sad bit of backward-compatibility
10542 !! test
10543 Image with size specified with pxpx (bug 13500, 51628)
10544 !! options
10545 parsoid=wt2html,wt2wt,html2html
10546 !! wikitext
10547 [[File:Foobar.jpg|20pxpx]]
10548 [[File:Foobar.jpg|200x20pxpx]]
10549 !! html/php
10550 <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>
10551 <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>
10552 </p>
10553 !! html/parsoid
10554 <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>
10555 !! end
10557 !! test
10558 Image with link parameter, wiki target
10559 !! wikitext
10560 [[File:Foobar.jpg|link=Main Page]]
10561 !! html/php
10562 <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>
10563 </p>
10564 !! html/parsoid
10565 <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>
10566 !! end
10568 # parsoid bug 49293 (part 1)
10569 !! test
10570 Image with link parameter, URL target
10571 !! wikitext
10572 [[File:Foobar.jpg|link=http://example.com/]]
10573 !! html/php
10574 <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>
10575 </p>
10576 !! html/parsoid
10577 <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>
10578 !! end
10580 # parsoid bug 49293 (part 2)
10581 !! test
10582 Image with link parameter, protocol-less URL target
10583 !! wikitext
10584 [[File:Foobar.jpg|link=//example.com/]]
10585 !! html/php
10586 <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>
10587 </p>
10588 !! html/parsoid
10589 <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>
10590 !! end
10592 !! test
10593 Image with link parameter, wgExternalLinkTarget
10594 !! wikitext
10595 [[Image:foobar.jpg|link=http://example.com/]]
10596 !! config
10597 wgExternalLinkTarget='foobar'
10598 !! html
10599 <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>
10600 </p>
10601 !! end
10603 !! test
10604 Image with link parameter, wgNoFollowLinks set to false
10605 !! wikitext
10606 [[Image:foobar.jpg|link=http://example.com/]]
10607 !! config
10608 wgNoFollowLinks=false
10609 !! html
10610 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10611 </p>
10612 !! end
10614 !! test
10615 Image with link parameter, wgNoFollowDomainExceptions
10616 !! wikitext
10617 [[Image:foobar.jpg|link=http://example.com/]]
10618 !! config
10619 wgNoFollowDomainExceptions='example.com'
10620 !! html
10621 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
10622 </p>
10623 !! end
10625 !! test
10626 Image with link parameter, wgExternalLinkTarget, unnamed parameter
10627 !! wikitext
10628 [[Image:foobar.jpg|link=http://example.com/|Title]]
10629 !! config
10630 wgExternalLinkTarget='foobar'
10631 !! html
10632 <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>
10633 </p>
10634 !! end
10636 !! test
10637 Image with empty link parameter
10638 !! wikitext
10639 [[File:Foobar.jpg|link=]]
10640 !! html/php
10641 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
10642 </p>
10643 !! html/parsoid
10644 <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>
10645 !! end
10647 !! test
10648 Image with link parameter (wiki target) and unnamed parameter
10649 !! wikitext
10650 [[File:Foobar.jpg|link=Main_Page|Title]]
10651 !! html/php
10652 <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>
10653 </p>
10654 !! html/parsoid
10655 <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>
10656 !! end
10658 !! test
10659 Image with link parameter (URL target) and unnamed parameter
10660 !! wikitext
10661 [[File:Foobar.jpg|link=http://example.com/|Title]]
10662 !! html/php
10663 <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>
10664 </p>
10665 !! html/parsoid
10666 <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>
10667 !! end
10669 !! test
10670 Thumbnail image with link parameter
10671 !! options
10672 thumbsize=220
10673 parsoid=wt2html,wt2wt,html2html
10674 !! wikitext
10675 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
10676 !! html/php
10677 <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>
10679 !! html/parsoid
10680 <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>
10681 !! end
10683 !! test
10684 Manually-specified thumbnail image
10685 !! options
10686 thumbsize=220
10687 !! wikitext
10688 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
10689 !! html/php
10690 <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>
10692 !! html/parsoid
10693 <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>
10694 !! end
10696 !! test
10697 Manually-specified thumbnail image with explicit link to wiki page
10698 !! options
10699 thumbsize=220
10700 parsoid=wt2html,wt2wt,html2html
10701 !! wikitext
10702 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
10703 !! html/php
10704 <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>
10706 !! html/parsoid
10707 <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>
10708 !! end
10710 !! test
10711 Manually-specified thumbnail image with explicit link to url
10712 !! options
10713 thumbsize=220
10714 parsoid=wt2html,wt2wt,html2html
10715 !! wikitext
10716 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
10717 !! html/php
10718 <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>
10720 !! html/parsoid
10721 <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>
10722 !! end
10724 !! test
10725 Manually-specified thumbnail image with explicit no link
10726 !! options
10727 thumbsize=220
10728 parsoid=wt2html,wt2wt,html2html
10729 !! wikitext
10730 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
10731 !! html/php
10732 <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>
10734 !! html/parsoid
10735 <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>
10736 !! end
10738 !! test
10739 Manually-specified thumbnail image with explicit link and alt text
10740 !! options
10741 thumbsize=220
10742 parsoid=wt2html,wt2wt,html2html
10743 !! wikitext
10744 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
10745 !! html/php
10746 <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>
10748 !! html/parsoid
10749 <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>
10750 !! end
10752 !! test
10753 Image with frame and link
10754 !! options
10755 parsoid=wt2html,wt2wt,html2html
10756 !! wikitext
10757 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
10758 !! html/php
10759 <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>
10761 !! html/parsoid
10762 <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>
10763 !! end
10765 !! test
10766 Image with frame and link and explicit alt
10767 !! options
10768 parsoid=wt2html,wt2wt,html2html
10769 !! wikitext
10770 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
10771 !! html/php
10772 <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>
10774 !! html/parsoid
10775 <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>
10776 !! end
10778 !! test
10779 Image with wiki markup in implicit alt
10780 !! options
10781 parsoid=wt2html,wt2wt,html2html
10782 !! wikitext
10783 [[Image:Foobar.jpg|testing '''bold''' in alt]]
10785 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
10786 !! html/php
10787 <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>
10788 </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>
10789 </p>
10790 !! html/parsoid
10791 <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>
10792 <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>
10793 !! end
10795 ###################
10796 # Conflicting image format options.
10797 # First option specified should 'win'.
10798 # All three cases in each test should be identical.
10800 !! test
10801 Image with 'frameless' first.
10802 !! options
10803 parsoid=wt2html,wt2wt,html2html
10804 !! wikitext
10805 [[File:Foobar.jpg|frameless|caption]]
10807 [[File:Foobar.jpg|frameless|frame|caption]]
10809 [[File:Foobar.jpg|frameless|thumb|caption]]
10810 !! html/php
10811 <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>
10812 </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>
10813 </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>
10814 </p>
10815 !! html/parsoid
10816 <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>
10817 <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>
10818 <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>
10819 !! end
10821 !! test
10822 Image with 'frame' first.
10823 !! options
10824 parsoid=wt2html,wt2wt,html2html
10825 !! wikitext
10826 [[File:Foobar.jpg|frame|caption]]
10827 [[File:Foobar.jpg|frame|frameless|caption]]
10828 [[File:Foobar.jpg|frame|thumb|caption]]
10829 !! html/php
10830 <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>
10831 <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>
10832 <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>
10834 !! html/parsoid
10835 <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>
10836 !! end
10838 !! test
10839 Image with 'thumb' first.
10840 !! options
10841 parsoid=wt2html,wt2wt,html2html
10842 !! wikitext
10843 [[File:Foobar.jpg|thumb|caption]]
10844 [[File:Foobar.jpg|thumb|frameless|caption]]
10845 [[File:Foobar.jpg|thumb|frame|caption]]
10846 !! html/php
10847 <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>
10848 <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>
10849 <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>
10851 !! html/parsoid
10852 <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>
10853 !! end
10855 ###################
10856 # Image sizing.
10857 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
10858 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
10859 # Foobar has actual size of 1941x220
10860 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
10861 #    a scalable format.
10862 # 2. Framed images always ignore size options; always render at default size.
10863 # 3. "Unspecified format" and border are the only types which can be
10864 #    enlarged.
10866 !! test
10867 Image: "unspecified format" and border enlarge
10868 !! options
10869 parsoid=wt2html,wt2wt,html2html
10870 !! wikitext
10871 [[File:Foobar.jpg|2000px]]
10873 [[File:Foobar.jpg|border|2000px]]
10874 !! html/php
10875 <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>
10876 </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>
10877 </p>
10878 !! html/parsoid
10879 <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>
10880 <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>
10881 !! end
10883 !! test
10884 Image: "unspecified format" and border reduce
10885 !! options
10886 parsoid=wt2html,wt2wt,html2html
10887 !! wikitext
10888 [[File:Foobar.jpg|1000px]]
10890 [[File:Foobar.jpg|border|1000px]]
10891 !! html/php
10892 <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>
10893 </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>
10894 </p>
10895 !! html/parsoid
10896 <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>
10897 <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>
10898 !! end
10900 !! test
10901 Image: thumbs reduce
10902 !! options
10903 parsoid=wt2html,wt2wt,html2html
10904 !! wikitext
10905 [[File:Foobar.jpg|thumb|50px]]
10906 !! html/php
10907 <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>
10909 !! html/parsoid
10910 <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>
10911 !! end
10913 !! test
10914 Image: bitmap thumbs can't be enlarged past original size, but vector can.
10915 !! options
10916 parsoid=wt2html,wt2wt,html2html
10917 !! wikitext
10918 [[File:Foobar.jpg|thumb|2000px]]
10920 [[File:Foobar.svg|thumb|2000px]]
10921 !! html/php
10922 <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>
10923 <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>
10925 !! html/parsoid
10926 <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>
10927 <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>
10928 !! end
10930 !! test
10931 Image: frameless can reduce in size
10932 !! options
10933 parsoid=wt2html,wt2wt,html2html
10934 !! wikitext
10935 [[File:Foobar.jpg|frameless|50px]]
10936 !! html/php
10937 <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>
10938 </p>
10939 !! html/parsoid
10940 <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>
10941 !! end
10943 !! test
10944 Image: bitmap frameless can't be enlarged past original size, but vector can
10945 !! options
10946 parsoid=wt2html,wt2wt,html2html
10947 !! wikitext
10948 [[File:Foobar.jpg|frameless|2000px]]
10950 [[File:Foobar.svg|frameless|2000px]]
10951 !! html/php
10952 <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>
10953 </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>
10954 </p>
10955 !! html/parsoid
10956 <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>
10957 <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>
10958 !! end
10960 !! test
10961 Image: framed images are always unscaled.
10962 !! options
10963 parsoid=wt2html,wt2wt,html2html
10964 !! wikitext
10965 [[File:Foobar.jpg|frame]]
10967 [[File:Foobar.jpg|frame|50px]]
10969 [[File:Foobar.jpg|frame|50x50px]]
10971 [[File:Foobar.jpg|frame|2000px]]
10972 !! html/php
10973 <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>
10974 <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>
10975 <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>
10976 <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>
10978 !! html/parsoid
10979 <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>
10980 !! end
10982 ###################
10984 !! test
10985 Link to image page- image page normally doesn't exists, hence edit link
10986 Add test with existing image page
10987 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
10988 !! wikitext
10989 [[:Image:test]]
10990 !! html
10991 <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>
10992 </p>
10993 !! end
10995 !! test
10996 bug 18784  Link to non-existent image page with caption should use caption as link text
10997 !! wikitext
10998 [[:Image:test|caption]]
10999 !! html
11000 <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>
11001 </p>
11002 !! end
11004 !! test
11005 Frameless image caption with a free URL
11006 !! wikitext
11007 [[File:Foobar.jpg|http://example.com]]
11008 !! html/php
11009 <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>
11010 </p>
11011 !! html/parsoid
11012 <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>
11013 !! end
11015 !! test
11016 Thumbnail image caption with a free URL
11017 !! options
11018 thumbsize=220
11019 !! wikitext
11020 [[File:Foobar.jpg|thumb|http://example.com]]
11021 !! html/php
11022 <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>
11024 !! html/parsoid
11025 <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>
11026 !! end
11028 !! test
11029 Thumbnail image caption with a free URL and explicit alt
11030 !! options
11031 thumbsize=220
11032 parsoid=wt2html,wt2wt,html2html
11033 !! wikitext
11034 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
11035 !! html/php
11036 <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>
11038 !! html/parsoid
11039 <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>
11040 !! end
11042 !! test
11043 SVG thumbnails with no language set
11044 !! options
11045 !! wikitext
11046 [[File:Foobar.svg|thumb|caption]]
11047 !! html/php
11048 <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>
11050 !! html/parsoid
11051 <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>
11052 !! end
11054 !! test
11055 SVG thumbnails with language de
11056 !! options
11057 parsoid=wt2html,wt2wt,html2html
11058 !! wikitext
11059 [[File:Foobar.svg|thumb|caption|lang=de]]
11060 !! html/php
11061 <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>
11063 !! html/parsoid
11064 <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>
11065 !! end
11067 !! test
11068 SVG thumbnails with invalid language code
11069 !! options
11070 parsoid=wt2html,wt2wt,html2html
11071 !! wikitext
11072 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
11073 !! html/php
11074 <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>
11076 !! html/parsoid
11077 <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>
11078 !! end
11080 !! test
11081 BUG 1887: A ISBN with a thumbnail
11082 !! wikitext
11083 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
11084 !! html/php
11085 <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>
11087 !! html/parsoid
11088 <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>
11089 !! end
11091 !! test
11092 BUG 1887: A RFC with a thumbnail
11093 !! wikitext
11094 [[File:Foobar.jpg|thumb|This is RFC 12354]]
11095 !! html/php
11096 <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>
11098 !! html/parsoid
11099 <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>
11100 !! end
11102 !! test
11103 BUG 1887: A mailto link with a thumbnail
11104 !! wikitext
11105 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
11106 !! html/php
11107 <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>
11109 !! html/parsoid
11110 <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>
11111 !! end
11113 # Pending resolution to bug 368
11114 !! test
11115 BUG 648: Frameless image caption with a link
11116 !! wikitext
11117 [[File:Foobar.jpg|text with a [[link]] in it]]
11118 !! html/php
11119 <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>
11120 </p>
11121 !! html/parsoid
11122 <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>
11123 !! end
11125 !! test
11126 BUG 648: Frameless image caption with a link (suffix)
11127 !! wikitext
11128 [[File:Foobar.jpg|text with a [[link]]foo in it]]
11129 !! html/php
11130 <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>
11131 </p>
11132 !! html/parsoid
11133 <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>
11134 !! end
11136 !! test
11137 BUG 648: Frameless image caption with an interwiki link
11138 !! wikitext
11139 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
11140 !! html/php
11141 <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>
11142 </p>
11143 !! html/parsoid
11144 <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>
11145 !! end
11147 !! test
11148 BUG 648: Frameless image caption with a piped interwiki link
11149 !! wikitext
11150 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
11151 !! html/php
11152 <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>
11153 </p>
11154 !! html/parsoid
11155 <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>
11156 !! end
11158 !! test
11159 Escape HTML special chars in image alt text
11160 !! wikitext
11161 [[File:Foobar.jpg|& < > "]]
11162 !! html/php
11163 <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>
11164 </p>
11165 !! html/parsoid
11166 <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>
11167 !! end
11169 !! test
11170 BUG 499: Alt text should have &#1234;, not &amp;1234;
11171 !! wikitext
11172 [[File:Foobar.jpg|&#9792;]]
11173 !! html/php
11174 <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>
11175 </p>
11176 !! html/parsoid
11177 <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>
11178 !! end
11180 !! test
11181 Broken image caption with link
11182 !! options
11183 parsoid=wt2html,wt2wt,html2html
11184 !! wikitext
11185 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
11186 !! html/php
11187 <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.
11188 </p>
11189 !! html/parsoid
11190 <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>
11191 !! end
11193 !! test
11194 Image caption containing another image
11195 !! wikitext
11196 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
11197 !! html/php
11198 <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>
11200 !! html/parsoid
11201 <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>
11202 !! end
11204 !! test
11205 Image: caption containing a newline
11206 !! wikitext
11207 [[File:Foobar.jpg|This
11208 *is some text]]
11209 !! html/php
11210 <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>
11211 </p>
11212 !! html/parsoid
11213 <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>
11214 !!end
11216 !!test
11217 Image: caption containing leading space
11218 (The leading space should not trigger nowiki escaping in wt2wt mode)
11219 !! wikitext
11220 [[File:Foobar.jpg|thumb| bar]]
11221 !! html/php
11222 <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>
11224 !! html/parsoid
11225 <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>
11226 !!end
11228 !! test
11229 Image: caption containing a table
11230 !! options
11231 parsoid=wt2html,wt2wt,html2html
11232 !! wikitext
11233 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
11235 ! Foo !! Bar
11237 | Foo1 || Bar1
11239 and some more text.]]
11240 !! html/php
11241 <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>
11243 !! html/parsoid
11244 <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
11245 <table>
11246 <tbody>
11247 <tr><th>Foo </th><th>Bar</th></tr>
11248 <tr>
11249 <td>Foo1 </td>
11250 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
11251 !! end
11253 !! test
11254 Bug 3090: External links other than http: in image captions
11255 !! wikitext
11256 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
11257 !! html/php
11258 <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>
11260 !! html/parsoid
11261 <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>
11262 !! end
11264 !! test
11265 Custom class
11266 !! options
11267 parsoid=wt2html,wt2wt,html2html
11268 !! wikitext
11269 [[Image:foobar.jpg|a|class=b]]
11270 !! html/php
11271 <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>
11272 </p>
11273 !! html/parsoid
11274 <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>
11275 !! end
11277 !! test
11278 Localized image handling (1).
11279 !! options
11280 parsoid=wt2html,wt2wt,html2html
11281 language=es
11282 !! wikitext
11283 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
11284 !! html/php
11285 <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>
11287 !! html/parsoid
11288 <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>
11289 !! end
11291 !! test
11292 Localized image handling (2).
11293 !! options
11294 thumbsize=220
11295 parsoid=wt2html,wt2wt,html2html
11296 language=es
11297 !! wikitext
11298 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
11299 !! html/php
11300 <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>
11302 !! html/parsoid
11303 <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>
11304 !! end
11306 !! test
11307 "border", "frameless" and "class" attributes on an image.
11308 !! options
11309 thumbsize=220
11310 parsoid=wt2html,wt2wt,html2html
11311 !! wikitext
11312 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
11313 !! html/php
11314 <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>
11315 </p>
11316 !! html/parsoid
11317 <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>
11318 !! end
11320 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
11321 !! test
11322 Invalid image attributes (bug 62500)
11323 !! options
11324 thumbsize=220
11325 parsoid=wt2html,wt2wt,html2html
11326 !! wikitext
11327 [[File:Foobar.jpg|thumb|float|left|caption]]
11329 [[File:Foobar.jpg|thumb|righ|caption]]
11331 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
11332 !! html/php
11333 <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>
11334 <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>
11335 <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>
11337 !! html/parsoid
11338 <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>
11339 !! end
11341 !! article
11342 File:Barfoo.jpg
11343 !! text
11344 #REDIRECT [[File:Barfoo.jpg]]
11345 !! endarticle
11347 !! test
11348 Redirected image
11349 !! wikitext
11350 [[Image:Barfoo.jpg]]
11351 !! html
11352 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
11353 </p>
11354 !! end
11356 !! test
11357 Missing image with uploads disabled
11358 !! options
11359 wgEnableUploads=0
11360 !! wikitext
11361 [[Image:Foobaz.jpg]]
11362 !! html
11363 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
11364 </p>
11365 !! end
11367 # Parsoid-specific testing for images
11368 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11369 # Currently imperfect due to a flaw in the Parsoid testrunner
11370 # Work in progress
11371 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
11372 # image tests.
11374 !! test
11375 Parsoid-specific image handling - simple image with size and middle alignment
11376 !! wikitext
11377 [[File:Foobar.jpg|middle|50px]]
11378 !! html/parsoid
11379 <p><span class="mw-valign-middle" typeof="mw:Image">
11380 <a href="File:Foobar.jpg">
11381 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11382 </a>
11383 </span>
11384 </p>
11385 !! end
11387 !! test
11388 Parsoid-specific image handling - simple image with size, middle alignment,
11389 non-standard namespace alias
11390 !! options
11391 parsoid=wt2wt,wt2html,html2html
11392 !! wikitext
11393 [[Image:Foobar.jpg|middle|50px]]
11394 !! html/parsoid
11395 <p><span class="mw-valign-middle" typeof="mw:Image">
11396 <a href="File:Foobar.jpg">
11397 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11398 </a>
11399 </span>
11400 </p>
11401 !! end
11403 !! test
11404 Parsoid-specific image handling - simple image with size and middle alignment
11405 (existing content)
11406 !! wikitext
11407 [[File:Foobar.jpg|50px|middle]]
11408 !! html/parsoid
11409 <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>
11410 !! end
11412 !! test
11413 Parsoid-specific image handling - simple image with size and middle alignment
11414 and non-standard namespace name
11415 !! options
11416 parsoid=wt2html,wt2wt,html2html
11417 !! wikitext
11418 [[Image:Foobar.jpg|50px|middle]]
11419 !! html/parsoid
11420 <p><span class="mw-valign-middle" typeof="mw:Image">
11421 <a href="File:Foobar.jpg">
11422 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
11423 </a>
11424 </span>
11425 </p>
11426 !! end
11428 !! test
11429 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
11430 !! wikitext
11431 [[File:Foobar.jpg|500x10px|baseline|caption]]
11432 !! html/parsoid
11433 <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>
11434 !! end
11436 !! test
11437 Parsoid-specific image handling - simple image with border and size spec
11438 !! wikitext
11439 [[File:Foobar.jpg|50px|border|caption]]
11440 !! html/parsoid
11441 <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>
11442 !! end
11444 !! test
11445 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11446 !! wikitext
11447 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
11448 !! html/parsoid
11449 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
11450 <a href="File:Foobar.jpg">
11451 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" height="25" width="220" />
11452 </a>
11453 <figcaption>caption content</figcaption>
11454 </figure>
11455 !! end
11457 !! test
11458 Parsoid-specific image handling - thumbnail with halign, valign, and caption
11459 (existing content)
11460 !! wikitext
11461 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
11462 !! html/parsoid
11463 <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>
11464 !! end
11466 !! test
11467 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
11468 !! wikitext
11469 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
11470 !! html/parsoid
11471 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
11472 <a href="File:Foobar.jpg">
11473 <img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
11474 </a>
11475 <figcaption>caption</figcaption>
11476 </figure>
11477 !! end
11479 !! test
11480 Parsoid-specific image handling - thumbnail with specific size, halign,
11481 valign, and caption (existing content)
11482 !! wikitext
11483 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
11484 !! html/parsoid
11485 <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>
11486 !! end
11488 !! test
11489 Parsoid-specific image handling - framed image with specific size and caption
11490 (size is ignored)
11491 !! options
11492 parsoid=wt2html,wt2wt,html2html
11493 !! wikitext
11494 [[File:Foobar.jpg|frame|500x50px|caption]]
11495 !! html/parsoid
11496 <figure typeof="mw:Image/Frame">
11497 <a href="File:Foobar.jpg">
11498 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11499 </a>
11500 <figcaption>caption</figcaption>
11501 </figure>
11502 !! end
11504 !! test
11505 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
11506 (size is ignored)
11507 !! options
11508 parsoid=wt2html,wt2wt,html2html
11509 !! wikitext
11510 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
11511 !! html/parsoid
11512 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
11513 <a href="File:Foobar.jpg">
11514 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" />
11515 </a>
11516 <figcaption>caption</figcaption>
11517 </figure>
11518 !! end
11520 !! test
11521 Parsoid-specific image handling - frameless image with specific size, border, and caption
11522 !! wikitext
11523 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
11524 !! html/parsoid
11525 <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>
11526 !! end
11528 !! test
11529 Parsoid-specific image handling - simple image with a formatted caption
11530 !! wikitext
11531 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
11532 !! html/parsoid
11533 <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>"}'>
11534 <a href="File:Foobar.jpg">
11535 <img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941">
11536 </a></span></p>
11537 !! end
11539 !! test
11540 Parsoid-specific image handling - caption with a template in it
11541 !! wikitext
11542 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
11543 !! html/parsoid
11544 <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>
11545 !! end
11547 !! test
11548 Parsoid-specific image handling - caption with unbalanced tags in it
11549 !! options
11550 parsoid=wt2html,wt2wt,html2html
11551 !! wikitext
11553 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
11555 !! html/parsoid
11556 <p>foo</p>
11557 <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>
11558 <p>bar</p>
11559 !! end
11561 !! test
11562 Parsoid-specific image handling - empty caption (1)
11563 !! options
11564 parsoid=wt2html,wt2wt
11565 !! wikitext
11566 [[File:Foobar.jpg|thumb|]]
11567 !! html/parsoid
11568 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure>
11569 !! end
11571 # empty captions don't get serialized unless we're in the "round trip" case
11572 !! test
11573 Parsoid-specific image handling - empty caption (2)
11574 !! options
11575 parsoid=html2wt
11576 !! html/parsoid
11577 <figure class="mw-default-size" typeof="mw:Image/Thumb">
11578   <a href="File:Foobar.jpg">
11579     <img resource="./File:Foobar.jpg"
11580          src="//example.com/images/3/3a/Foobar.jpg"
11581          height="25" width="220"/>
11582   </a>
11583   <figcaption></figcaption>
11584 </figure>
11585 !! wikitext
11586 [[File:Foobar.jpg|thumb]]
11587 !! end
11589 !! test
11590 Parsoid-specific image handling - whitespace caption
11591 !! wikitext
11592 [[File:Foobar.jpg|thumb| ]]
11593 !! html/parsoid
11594 <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>
11595 !! end
11597 !! test
11598 Parsoid-specific image handling - lang option
11599 !! wikitext
11601 [[File:Foobar.svg|lang=de|caption]]
11603 !! html/parsoid
11604 <p>foo
11605 <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>
11606 bar</p>
11607 !! end
11611 ### Subpages
11613 !! article
11614 Subpage test/subpage
11615 !! text
11617 !! endarticle
11619 !! test
11620 Subpage link
11621 !! options
11622 subpage title=[[Subpage test]]
11623 !! wikitext
11624 [[/subpage]]
11625 !! html
11626 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
11627 </p>
11628 !! end
11630 !! test
11631 Subpage noslash link
11632 !! options
11633 subpage title=[[Subpage test]]
11634 !! wikitext
11635 [[/subpage/]]
11636 !! html
11637 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
11638 </p>
11639 !! end
11641 # TODO: make this PHP-parser compatible!
11642 !! test
11643 Relative subpage noslash link
11644 !! options
11645 parsoid=wt2wt,wt2html,html2html
11646 subpage title=[[Subpage test/1/2/3/4]]
11647 !! wikitext
11648 [[../../subpage/]]
11650 [[../../subpage]]
11651 !! html
11652 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
11653 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
11654 !! end
11656 !! test
11657 Parsoid: dot-slash prefixed wikilinks
11658 !! wikitext
11659 [[./foo]]
11661 [[././bar]]
11663 [[././baz/]]
11664 !! html/php
11665 <p>[[./foo]]
11666 </p><p>[[././bar]]
11667 </p><p>[[././baz/]]
11668 </p>
11669 !! html/parsoid
11670 <p>[[./foo]]
11671 </p><p>[[././bar]]
11672 </p><p>[[././baz/]]
11673 </p>
11674 !! end
11676 !! test
11677 Render invalid page names as plain text (bug 51090)
11678 !! wikitext
11679 [[./../foo|bar]]
11680 [[foo�|bar]]
11681 [[foo/.|bar]]
11682 [[foo/..|bar]]
11683 [[foo~~~bar]]
11684 [[foo>bar]]
11685 [[foo[bar]]
11686 [[.]]
11687 [[..]]
11688 [[foo././bar]]
11690 [[{{echo|./../foo}}|bar]]
11691 [[{{echo|foo/.}}|bar]]
11692 [[{{echo|foo/..}}|bar]]
11693 [[{{echo|foo~~~~bar}}]]
11694 [[{{echo|foo>bar}}]]
11695 [[{{echo|foo././bar}}]]
11696 [[{{echo|foo{bar}}]]
11697 [[{{echo|foo}bar}}]]
11698 [[{{echo|foo[bar}}]]
11699 [[{{echo|foo]bar}}]]
11700 [[{{echo|foo<bar}}]]
11701 !!html/php
11702 <p>[[./../foo|bar]]
11703 [[foo�|bar]]
11704 [[foo/.|bar]]
11705 [[foo/..|bar]]
11706 [[foo~~~bar]]
11707 [[foo&gt;bar]]
11708 [[foo[bar]]
11709 [[.]]
11710 [[..]]
11711 [[foo././bar]]
11712 </p><p>[[./../foo|bar]]
11713 [[foo/.|bar]]
11714 [[foo/..|bar]]
11715 [[foo~~~~bar]]
11716 [[foo&gt;bar]]
11717 [[foo././bar]]
11718 [[foo{bar]]
11719 [[foo}bar]]
11720 [[foo[bar]]
11721 [[foo]bar]]
11722 [[foo&lt;bar]]
11723 </p>
11724 !!html/parsoid
11725 <p>[[./../foo|bar]][[foo�|bar]][[foo/.|bar]][[foo/..|bar]][[foo~~~bar]][[foo>bar]][[foo[bar]][[.]][[..]][[foo././bar]]</p>
11726 <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>
11727 !!end
11729 !! test
11730 Disabled subpages
11731 !! wikitext
11732 [[/subpage]]
11733 !! html
11734 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
11735 </p>
11736 !! end
11738 !! test
11739 BUG 561: {{/Subpage}}
11740 !! options
11741 subpage title=[[Page]]
11742 !! wikitext
11743 {{/Subpage}}
11744 !! html
11745 <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>
11746 </p>
11747 !! end
11750 ### Categories
11752 !! article
11753 Category:MediaWiki User's Guide
11754 !! text
11755 blah
11756 !! endarticle
11758 !! test
11759 Link to category
11760 !! wikitext
11761 [[:Category:MediaWiki User's Guide]]
11762 !! html
11763 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
11764 </p>
11765 !! end
11767 !! test
11768 Simple category
11769 !! options
11771 !! wikitext
11772 [[Category:MediaWiki User's Guide]]
11773 !! html
11774 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11775 !! end
11777 !! test
11778 PAGESINCATEGORY invalid title fatal (r33546 fix)
11779 !! wikitext
11780 {{PAGESINCATEGORY:<bogus>}}
11781 !! html
11782 <p>0
11783 </p>
11784 !! end
11786 !! test
11787 Category with different sort key
11788 !! options
11790 !! wikitext
11791 [[Category:MediaWiki User's Guide|Foo]]
11792 !! html
11793 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11794 !! end
11796 !! test
11797 Category with identical sort key
11798 !! options
11800 !! wikitext
11801 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11802 !! html
11803 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
11804 !! end
11806 !! test
11807 Category with empty sort key
11808 !! options
11811 !! wikitext
11812 [[Category:MediaWiki User's Guide|]]
11813 !! html
11814 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
11815 !! end
11817 !! test
11818 Category with empty sort key and parentheses
11819 !! options
11822 !! wikitext
11823 [[Category:Foo (bar)|]]
11824 !! html
11825 [[Category:Foo (bar)|Foo]]
11826 !! end
11828 !! test
11829 Category with link tail
11830 !! options
11833 !! wikitext
11834 123[[Category:Foo]]456
11835 !! html
11836 123[[Category:Foo]]456
11837 !! end
11839 !! test
11840 Category with template
11841 !! options
11844 !! wikitext
11845 [[Category:{{echo|Foo}}]]
11846 !! html
11847 [[Category:{{echo|Foo}}]]
11848 !! end
11850 !! test
11851 Category with template in sort key
11852 !! options
11855 !! wikitext
11856 [[Category:Foo|{{echo|Bar}}]]
11857 !! html
11858 [[Category:Foo|{{echo|Bar}}]]
11859 !! end
11861 !! test
11862 Category with template in sort key and title
11863 !! options
11866 !! wikitext
11867 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11868 !! html
11869 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
11870 !! end
11872 !! test
11873 Category / paragraph interactions
11874 !! wikitext
11875 Foo [[Category:Baz]] Bar
11877 Foo [[Category:Baz]]
11881 [[Category:Baz]]
11885 [[Category:Baz]] Bar
11888 [[Category:Baz]]
11889  [[Category:Baz]]
11890 [[Category:Baz]]
11893 [[Category:Baz]]
11894  [[Category:Baz]]
11895 [[Category:Baz]]
11897 [[Category:Baz]]
11898  {{echo|[[Category:Baz]]}}
11899 [[Category:Baz]]
11900 !! html
11901 <p>Foo Bar
11902 </p><p>Foo
11904 </p><p>Foo
11906 </p><p>Foo Bar
11907 </p><p>Foo
11909 </p>
11910 !! end
11912 !! test
11913 Parsoid: Serialize link to category page with colon escape
11914 !! options
11915 parsoid
11916 !! wikitext
11918 [[:Category:Foo]]
11919 [[:Category:Foo|Bar]]
11920 !! html
11922 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
11923 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
11924 </p>
11925 !! end
11927 !! test
11928 Parsoid: Link prefix/suffixes aren't applied to category links
11929 !! options
11930 parsoid=wt2html,wt2wt,html2html
11931 language=is
11932 !! wikitext
11933 x[[Category:Foo]]y
11934 !! html
11935 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
11936 !! end
11938 !! test
11939 Parsoid: Serialize link to file page with colon escape
11940 !! options
11941 parsoid
11942 !! wikitext
11944 [[:File:Foo.png]]
11945 [[:File:Foo.png|Bar]]
11946 !! html
11948 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
11949 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
11950 </p>
11951 !! end
11953 !! test
11954 Parsoid: Serialize a genuine category link without colon escape
11955 !! options
11956 parsoid
11957 !! wikitext
11958 [[Category:Foo]]
11959 [[Category:Foo|Bar]]
11960 !! html
11961 <link rel="mw:PageProp/Category" href="Category:Foo">
11962 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
11963 !! end
11965 !! test
11966 Parsoid: Defaultsort
11967 !! options
11968 parsoid
11969 !! wikitext
11970 {{DEFAULTSORT:Foo}}
11971 !! html
11972 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
11973 !! end
11976 ### Inter-language links
11978 !! test
11979 Interlanguage links
11980 !! options
11982 !! wikitext
11983 [[es:Alimento]]
11984 [[fr:Nourriture]]
11985 [[zh:食品]]
11986 !! html/php
11987 es:Alimento fr:Nourriture zh:食品
11988 !! html/parsoid
11989 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/Alimento"/>
11990 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/Nourriture"/>
11991 <link rel="mw:PageProp/Language" href="//zh.wikipedia.org/wiki/食品"/></p>
11992 !! end
11994 !! test
11995 Duplicate interlanguage links (bug 24502)
11996 !! options
11998 !! wikitext
11999 [[es:1]]
12000 [[es:2]]
12001 [[fr:1]]
12002 [[fr:2]]
12003 !! html/php
12004 es:1 fr:1
12005 !! html/parsoid
12006 <p><link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/1"/>
12007 <link rel="mw:PageProp/Language" href="//es.wikipedia.org/wiki/2"/>
12008 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/1"/>
12009 <link rel="mw:PageProp/Language" href="//fr.wikipedia.org/wiki/2"/></p>
12010 !! end
12013 ### Sections
12015 !! test
12016 Basic section headings
12017 !! wikitext
12018 == Headline 1 ==
12019 Some text
12021 ==Headline 2==
12022 More
12023 ===Smaller headline===
12024 Blah blah
12025 !! html
12026 <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>
12027 <p>Some text
12028 </p>
12029 <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>
12030 <p>More
12031 </p>
12032 <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>
12033 <p>Blah blah
12034 </p>
12035 !! end
12037 !! test
12038 Section headings with TOC
12039 !! wikitext
12040 == Headline 1 ==
12041 === Subheadline 1 ===
12042 ===== Skipping a level =====
12043 ====== Skipping a level ======
12045 == Headline 2 ==
12046 Some text
12047 ===Another headline===
12048 !! html
12049 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12050 <ul>
12051 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
12052 <ul>
12053 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
12054 <ul>
12055 <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>
12056 <ul>
12057 <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>
12058 </ul>
12059 </li>
12060 </ul>
12061 </li>
12062 </ul>
12063 </li>
12064 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
12065 <ul>
12066 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
12067 </ul>
12068 </li>
12069 </ul>
12070 </div>
12072 <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>
12073 <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>
12074 <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>
12075 <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>
12076 <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>
12077 <p>Some text
12078 </p>
12079 <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>
12081 !! end
12083 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
12084 !! test
12085 Handling of sections up to level 6 and beyond
12086 !! wikitext
12087 = Level 1 Heading=
12088 == Level 2 Heading==
12089 === Level 3 Heading===
12090 ==== Level 4 Heading====
12091 ===== Level 5 Heading=====
12092 ====== Level 6 Heading======
12093 ======= Level 7 Heading=======
12094 ======== Level 8 Heading========
12095 ========= Level 9 Heading=========
12096 ========== Level 10 Heading==========
12097 !! html
12098 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12099 <ul>
12100 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
12101 <ul>
12102 <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>
12103 <ul>
12104 <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>
12105 <ul>
12106 <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>
12107 <ul>
12108 <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>
12109 <ul>
12110 <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>
12111 <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>
12112 <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>
12113 <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>
12114 <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>
12115 </ul>
12116 </li>
12117 </ul>
12118 </li>
12119 </ul>
12120 </li>
12121 </ul>
12122 </li>
12123 </ul>
12124 </li>
12125 </ul>
12126 </div>
12128 <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>
12129 <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>
12130 <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>
12131 <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>
12132 <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>
12133 <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>
12134 <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>
12135 <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>
12136 <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>
12137 <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>
12139 !! end
12141 !! test
12142 TOC regression (bug 9764)
12143 !! wikitext
12144 == title 1 ==
12145 === title 1.1 ===
12146 ==== title 1.1.1 ====
12147 === title 1.2 ===
12148 == title 2 ==
12149 === title 2.1 ===
12150 !! html
12151 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12152 <ul>
12153 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12154 <ul>
12155 <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>
12156 <ul>
12157 <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>
12158 </ul>
12159 </li>
12160 <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>
12161 </ul>
12162 </li>
12163 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12164 <ul>
12165 <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>
12166 </ul>
12167 </li>
12168 </ul>
12169 </div>
12171 <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>
12172 <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>
12173 <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>
12174 <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>
12175 <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>
12176 <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>
12178 !! end
12180 !! test
12181 TOC with wgMaxTocLevel=3 (bug 6204)
12182 !! options
12183 wgMaxTocLevel=3
12184 !! wikitext
12185 == title 1 ==
12186 === title 1.1 ===
12187 ==== title 1.1.1 ====
12188 === title 1.2 ===
12189 == title 2 ==
12190 === title 2.1 ===
12191 !! html
12192 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12193 <ul>
12194 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12195 <ul>
12196 <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>
12197 <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>
12198 </ul>
12199 </li>
12200 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
12201 <ul>
12202 <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>
12203 </ul>
12204 </li>
12205 </ul>
12206 </div>
12208 <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>
12209 <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>
12210 <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>
12211 <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>
12212 <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>
12213 <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>
12215 !! end
12217 !! test
12218 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
12219 !! options
12220 wgMaxTocLevel=3
12221 !! wikitext
12222 ==Section 1==
12223 ===Section 1.1===
12224 ====Section 1.1.1====
12225 ====Section 1.1.1.1====
12226 ==Section 2==
12227 !! html
12228 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12229 <ul>
12230 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
12231 <ul>
12232 <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>
12233 </ul>
12234 </li>
12235 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
12236 </ul>
12237 </div>
12239 <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>
12240 <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>
12241 <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>
12242 <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>
12243 <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>
12245 !! end
12248 !! test
12249 Resolving duplicate section names
12250 !! wikitext
12251 == Foo bar ==
12252 == Foo bar ==
12253 !! html
12254 <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>
12255 <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>
12257 !! end
12259 !! test
12260 Resolving duplicate section names with differing case (bug 10721)
12261 !! wikitext
12262 == Foo bar ==
12263 == Foo Bar ==
12264 !! html
12265 <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>
12266 <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>
12268 !! end
12270 !! article
12271 Template:sections
12272 !! text
12273 ===Section 1===
12274 ==Section 2==
12275 !! endarticle
12277 !! test
12278 Template with sections, __NOTOC__
12279 !! wikitext
12280 __NOTOC__
12281 ==Section 0==
12282 {{sections}}
12283 ==Section 4==
12284 !! html
12285 <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>
12286 <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>
12287 <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>
12288 <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>
12290 !! end
12292 !! test
12293 __NOEDITSECTION__ keyword
12294 !! wikitext
12295 __NOEDITSECTION__
12296 ==Section 1==
12297 ==Section 2==
12298 !! html
12299 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
12300 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
12302 !! end
12304 !! test
12305 Link inside a section heading
12306 !! wikitext
12307 ==Section with a [[Main Page|link]] in it==
12308 !! html
12309 <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>
12311 !! end
12313 !! test
12314 TOC regression (bug 12077)
12315 !! wikitext
12316 __TOC__
12317 == title 1 ==
12318 === title 1.1 ===
12319 == title 2 ==
12320 !! html
12321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12322 <ul>
12323 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
12324 <ul>
12325 <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>
12326 </ul>
12327 </li>
12328 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
12329 </ul>
12330 </div>
12332 <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>
12333 <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>
12334 <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>
12336 !! end
12338 !! test
12339 BUG 1219 URL next to image (good)
12340 !! wikitext
12341 http://example.com [[Image:foobar.jpg]]
12342 !! html
12343 <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>
12344 </p>
12345 !!end
12347 !! test
12348 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
12349 !! wikitext
12350 === 
12351 The line above must have a trailing space!
12352 === <!--
12353 --> <!-- -->
12354 But just in case it doesn't...
12355 !! html
12356 <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>
12357 <p>The line above must have a trailing space!
12358 </p>
12359 <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>
12360 <p>But just in case it doesn't...
12361 </p>
12362 !! end
12364 !! test
12365 Header with special characters (bug 25462)
12366 !! wikitext
12367 The tooltips shall not show entities to the user (ie. be double escaped)
12369 == text > text ==
12370 section 1
12372 == text < text ==
12373 section 2
12375 == text & text ==
12376 section 3
12378 == text ' text ==
12379 section 4
12381 == text " text ==
12382 section 5
12383 !! html
12384 <p>The tooltips shall not show entities to the user (ie. be double escaped)
12385 </p>
12386 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12387 <ul>
12388 <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>
12389 <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>
12390 <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>
12391 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
12392 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
12393 </ul>
12394 </div>
12396 <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>
12397 <p>section 1
12398 </p>
12399 <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>
12400 <p>section 2
12401 </p>
12402 <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>
12403 <p>section 3
12404 </p>
12405 <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>
12406 <p>section 4
12407 </p>
12408 <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>
12409 <p>section 5
12410 </p>
12411 !! end
12413 !! test
12414 Headers with excess '=' characters
12415 (Are similar tests necessary beyond the 1st level?)
12416 !! wikitext
12417 =foo==
12418 ==foo=
12419 =''italic'' heading==
12420 ==''italic'' heading=
12421 !! html
12422 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12423 <ul>
12424 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
12425 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
12426 <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>
12427 <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>
12428 </ul>
12429 </div>
12431 <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>
12432 <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>
12433 <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>
12434 <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>
12436 !! end
12438 !! test
12439 HTML headers vs TOC (bug 23393)
12440 (__NOEDITSECTION__ for clearer output, doesn't matter here)
12441 !! wikitext
12442 <h1>Header 1</h1>
12443 == Header 1.1 ==
12444 == Header 1.2 ==
12446 <h1>Header 2
12447 </h1>
12448 == Header 2.1 ==
12449 == Header 2.2 ==
12450 __NOEDITSECTION__
12451 !! html
12452 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12453 <ul>
12454 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
12455 <ul>
12456 <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>
12457 <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>
12458 </ul>
12459 </li>
12460 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
12461 <ul>
12462 <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>
12463 <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>
12464 </ul>
12465 </li>
12466 </ul>
12467 </div>
12469 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
12470 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
12471 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
12472 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
12473 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
12474 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
12476 !! end
12478 !! test
12479 Single-line or multiline-comments can follow headings
12480 !! options
12481 parsoid=wt2html,wt2wt
12482 !! wikitext
12483 ==foo==<!---->
12484 ==bar==<!--c1-->
12485 ==baz==<!--
12487 c3-->
12488 !! html
12489 <h2><span class="mw-headline" id="foo">foo</span></h2>
12490 <h2><span class="mw-headline" id="bar">bar</span></h2>
12491 <h2><span class="mw-headline" id="baz">baz</span></h2>
12493 !! end
12495 !! test
12496 BUG 1219 URL next to image (broken)
12497 !! wikitext
12498 http://example.com[[Image:foobar.jpg]]
12499 !! html
12500 <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>
12501 </p>
12502 !!end
12504 !! test
12505 Bug 1186 news: in the middle of text
12506 !! wikitext
12507 http://en.wikinews.org/wiki/Wikinews:Workplace
12508 !! html
12509 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
12510 </p>
12511 !!end
12514 !! test
12515 Namespaced link must have a title
12516 !! wikitext
12517 [[Project:]]
12518 !! html
12519 <p>[[Project:]]
12520 </p>
12521 !!end
12523 !! test
12524 Namespaced link must have a title (bad fragment version)
12525 !! wikitext
12526 [[Project:#fragment]]
12527 !! html
12528 <p>[[Project:#fragment]]
12529 </p>
12530 !!end
12534 ### HTML tags and HTML attributes
12537 !! test
12538 div with no attributes
12539 !! wikitext
12540 <div>HTML rocks</div>
12541 !! html
12542 <div>HTML rocks</div>
12544 !! end
12546 !! test
12547 div with double-quoted attribute
12548 !! wikitext
12549 <div id="rock">HTML rocks</div>
12550 !! html
12551 <div id="rock">HTML rocks</div>
12553 !! end
12555 !! test
12556 div with single-quoted attribute
12557 !! wikitext
12558 <div id='rock'>HTML rocks</div>
12559 !! html
12560 <div id="rock">HTML rocks</div>
12562 !! end
12564 !! test
12565 div with unquoted attribute
12566 !! wikitext
12567 <div id=rock>HTML rocks</div>
12568 !! html
12569 <div id="rock">HTML rocks</div>
12571 !! end
12573 !! test
12574 div with illegal double attributes
12575 !! wikitext
12576 <div id="a" id="b">HTML rocks</div>
12577 !! html
12578 <div id="b">HTML rocks</div>
12580 !!end
12582 # FIXME: produce empty string instead of "class" in the PHP parser, following
12583 # the HTML5 spec.
12584 !! test
12585 div with empty attribute value, space before equals
12586 !! options
12587 parsoid
12588 !! wikitext
12589 <div class =>HTML rocks</div>
12590 !! html
12591 <div class="">HTML rocks</div>
12593 !! end
12595 # The PHP parser escapes the opening brace to &#123; for some reason, so
12596 # disabled this test for it.
12597 !! test
12598 div with braces in attribute value
12599 !! options
12600 parsoid
12601 !! wikitext
12602 <div title="{}">Foo</div>
12603 !! html
12604 <div title="{}">Foo</div>
12605 !! end
12607 # This it very inconsistent in the PHP parser: it returns 
12608 # class="class" if there is a space between the name and the equal sign (see
12609 # 'div with empty attribute value, space before equals'), but strips the
12610 # attribute completely if the space is missing. We hope that not much content
12611 # depends on this, so are implementing the behavior below in Parsoid for
12612 # consistencies' sake. Disabled for the PHP parser. 
12613 # FIXME: fix this behavior in the PHP parser?
12614 !! test
12615 div with empty attribute value, no space before equals
12616 !! options
12617 parsoid
12618 !! wikitext
12619 <div class=>HTML rocks</div>
12620 !! html
12621 <div class="">HTML rocks</div>
12623 !! end
12625 !! test
12626 HTML multiple attributes correction
12627 !! wikitext
12628 <p class="error" class="awesome">Awesome!</p>
12629 !! html
12630 <p class="awesome">Awesome!</p>
12632 !!end
12634 !! test
12635 Table multiple attributes correction
12636 !! wikitext
12638 !+ class="error" class="awesome"| status
12640 !! html
12641 <table>
12642 <tr>
12643 <th class="awesome"> status
12644 </th></tr></table>
12646 !!end
12648 !! test
12649 DIV IN UPPERCASE
12650 !! wikitext
12651 <DIV ID="x">HTML ROCKS</DIV>
12652 !! html
12653 <div id="x">HTML ROCKS</div>
12655 !!end
12657 !! test
12658 Non-ASCII pseudo-tags are rendered as text
12659 !! wikitext
12660 <khyô>
12661 !! html
12662 <p>&lt;khyô&gt;
12663 </p>
12664 !! end
12666 !! test
12667 Pseudo-tag with URL 'name' renders as url link
12668 !! wikitext
12669 <http://example.com/>
12670 !! html
12671 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
12672 </p>
12673 !! end
12675 !! test
12676 text with amp in the middle of nowhere
12677 !! wikitext
12678 Remember AT&T?
12679 !! html
12680 <p>Remember AT&amp;T?
12681 </p>
12682 !! end
12684 !! test
12685 text with character entity: eacute
12686 !! wikitext
12687 I always thought &eacute; was a cute letter.
12688 !! html
12689 <p>I always thought &#233; was a cute letter.
12690 </p>
12691 !! end
12693 !! test
12694 text with entity-escaped character entity-like string: eacute
12695 !! wikitext
12696 I always thought &amp;eacute; was a cute letter.
12697 !! html
12698 <p>I always thought &amp;eacute; was a cute letter.
12699 </p>
12700 !! end
12702 !! test
12703 text with undefined character entity: xacute
12704 !! wikitext
12705 I always thought &xacute; was a cute letter.
12706 !! html
12707 <p>I always thought &amp;xacute; was a cute letter.
12708 </p>
12709 !! end
12711 # TODO: generalize to PHP parser?
12712 !! test
12713 HTML5 tags
12714 !! options
12715 parsoid
12716 !! wikitext
12717 <data value="5">five</data>
12718 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12719 <mark>This highlighted text</mark>
12720 !! html
12721 <p><data value="5">five</data>
12722 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
12723 <mark>This highlighted text</mark></p>
12724 !! end
12726 !! test
12727 HTML tag with leading space is parsed as text
12728 !! wikitext
12729 < div>foo< /div>
12730 !! html
12731 <p>&lt; div&gt;foo&lt; /div&gt;
12732 </p>
12733 !! end
12736 ### Nesting tests (see bug 41545, 50604, 51081)
12739 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
12740 # Note that html2wt is considerably more difficult if we use <b> in
12741 # the test case, instead of <big>
12742 !! test
12743 Ensure that HTML adoption agency algorithm is properly implemented.
12744 !! wikitext
12745 <big>X<big>Y</big>Z</big>
12746 !! html
12747 <p><big>X<big>Y</big>Z</big>
12748 </p>
12749 !! end
12751 # This was bug 41545 in the PHP parser.
12752 !! test
12753 Nesting of <kbd>
12754 !! wikitext
12755 <kbd>X<kbd>Y</kbd>Z</kbd>
12756 !! html
12757 <p><kbd>X<kbd>Y</kbd>Z</kbd>
12758 </p>
12759 !! end
12761 # The following cases were bug 51081 in the PHP parser.
12762 # Note that there are some other nestable tags (b, i, etc) which are
12763 # not covered; see bug 51081 for discussion.
12764 !! test
12765 Nesting of <em>
12766 !! wikitext
12767 <em>X<em>Y</em>Z</em>
12768 !! html
12769 <p><em>X<em>Y</em>Z</em>
12770 </p>
12771 !! end
12773 !! test
12774 Nesting of <strong>
12775 !! wikitext
12776 <strong>X<strong>Y</strong>Z</strong>
12777 !! html
12778 <p><strong>X<strong>Y</strong>Z</strong>
12779 </p>
12780 !! end
12782 !! test
12783 Nesting of <q>
12784 !! wikitext
12785 <q>X<q>Y</q>Z</q>
12786 !! html
12787 <p><q>X<q>Y</q>Z</q>
12788 </p>
12789 !! end
12791 !! test
12792 Nesting of <ruby>
12793 !! wikitext
12794 <ruby>X<ruby>Y</ruby>Z</ruby>
12795 !! html
12796 <p><ruby>X<ruby>Y</ruby>Z</ruby>
12797 </p>
12798 !! end
12800 !! test
12801 Nesting of <bdo>
12802 !! wikitext
12803 <bdo>X<bdo>Y</bdo>Z</bdo>
12804 !! html
12805 <p><bdo>X<bdo>Y</bdo>Z</bdo>
12806 </p>
12807 !! end
12811 ### Media links
12814 !! test
12815 Media link
12816 !! wikitext
12817 [[Media:Foobar.jpg]]
12818 !! html
12819 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
12820 </p>
12821 !! end
12823 !! test
12824 Media link with text
12825 !! wikitext
12826 [[Media:Foobar.jpg|A neat file to look at]]
12827 !! html
12828 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
12829 </p>
12830 !! end
12832 # FIXME: this is still bad HTML tag nesting
12833 !! test
12834 Media link with nasty text
12835 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
12836 !! wikitext
12837 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
12838 !! html
12839 <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>
12841 !! end
12843 !! test
12844 Media link to nonexistent file (bug 1702)
12845 !! wikitext
12846 [[Media:No such.jpg]]
12847 !! html
12848 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
12849 </p>
12850 !! end
12852 !! test
12853 Image link to nonexistent file (bug 1850 - good)
12854 !! wikitext
12855 [[Image:No such.jpg]]
12856 !! html
12857 <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>
12858 </p>
12859 !! end
12861 !! test
12862 :Image link to nonexistent file (bug 1850 - bad)
12863 !! wikitext
12864 [[:Image:No such.jpg]]
12865 !! html
12866 <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>
12867 </p>
12868 !! end
12872 !! test
12873 Character reference normalization in link text (bug 1938)
12874 !! wikitext
12875 [[Main Page|this&that]]
12876 !! html
12877 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
12878 </p>
12879 !!end
12881 !! article
12882 אַ
12883 !! text
12884 Test for unicode normalization
12886 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
12887 !! endarticle
12889 !! test
12890 (bug 19451) Links should refer to the normalized form.
12891 !! wikitext
12892 [[&#xFB2E;]]
12893 [[&#x5d0;&#x5b7;]]
12894 [[&#x5d0;ַ]]
12895 [[א&#x5b7;]]
12896 [[אַ]]
12897 !! html
12898 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
12899 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
12900 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
12901 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
12902 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
12903 </p>
12904 !! end
12906 !! test
12907 Empty attribute crash test (bug 2067)
12908 !! wikitext
12909 <font color="">foo</font>
12910 !! html
12911 <p><font color="">foo</font>
12912 </p>
12913 !! end
12915 !! test
12916 Empty attribute crash test single-quotes (bug 2067)
12917 !! wikitext
12918 <font color=''>foo</font>
12919 !! html
12920 <p><font color="">foo</font>
12921 </p>
12922 !! end
12924 !! test
12925 Attribute test: equals, then nothing
12926 !! wikitext
12927 <font color=>foo</font>
12928 !! html
12929 <p><font>foo</font>
12930 </p>
12931 !! end
12933 !! test
12934 Attribute test: unquoted value
12935 !! wikitext
12936 <font color=x>foo</font>
12937 !! html
12938 <p><font color="x">foo</font>
12939 </p>
12940 !! end
12942 !! test
12943 Attribute test: unquoted but illegal value (hash)
12944 !! wikitext
12945 <font color=#x>foo</font>
12946 !! html
12947 <p><font color="#x">foo</font>
12948 </p>
12949 !! end
12951 !! test
12952 Attribute test: no value
12953 !! wikitext
12954 <font color>foo</font>
12955 !! html
12956 <p><font color="color">foo</font>
12957 </p>
12958 !! end
12960 !! test
12961 Bug 2095: link with three closing brackets
12962 !! wikitext
12963 [[Main Page]]]
12964 !! html/php
12965 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
12966 </p>
12967 !! html/parsoid
12968 <p><a rel="mw:WikiLink" href="./Main_Page">Main Page</a>]</p>
12969 !! end
12971 !! test
12972 Bug 2095: link with pipe and three closing brackets
12973 !! wikitext
12974 [[Main Page|link]]]
12975 !! html/php
12976 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
12977 </p>
12978 !! html/parsoid
12979 <p><a rel="mw:WikiLink" href="./Main_Page">link</a>]</p>
12980 !! end
12982 !! test
12983 Bug 2095: link with pipe and three closing brackets, version 2
12984 !! wikitext
12985 [[Main Page|[http://example.com/]]]
12986 !! html/php
12987 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
12988 </p>
12989 !! html/parsoid
12990 <p><a rel="mw:WikiLink" href="./Main_Page">[http://example.com/]</a></p>
12991 !! end
12995 ### Safety
12998 !! article
12999 Template:Dangerous attribute
13000 !! text
13001 " onmouseover="alert(document.cookie)
13002 !! endarticle
13004 !! article
13005 Template:Dangerous style attribute
13006 !! text
13007 border-size: expression(alert(document.cookie))
13008 !! endarticle
13010 !! article
13011 Template:Div style
13012 !! text
13013 <div style="float: right; {{{1}}}">Magic div</div>
13014 !! endarticle
13016 !! test
13017 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
13018 !! wikitext
13019 <div title="{{test}}"></div>
13020 !! html
13021 <div title="This is a test template"></div>
13023 !! end
13025 !! test
13026 Bug 2304: HTML attribute safety (dangerous template; 2309)
13027 !! wikitext
13028 <div title="{{dangerous attribute}}"></div>
13029 !! html
13030 <div title=""></div>
13032 !! end
13034 !! test
13035 Bug 2304: HTML attribute safety (dangerous style template; 2309)
13036 !! wikitext
13037 <div style="{{dangerous style attribute}}"></div>
13038 !! html
13039 <div style="/* insecure input */"></div>
13041 !! end
13043 !! test
13044 Bug 2304: HTML attribute safety (safe parameter; 2309)
13045 !! wikitext
13046 {{div style|width: 200px}}
13047 !! html
13048 <div style="float: right; width: 200px">Magic div</div>
13050 !! end
13052 !! test
13053 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
13054 !! wikitext
13055 {{div style|width: expression(alert(document.cookie))}}
13056 !! html
13057 <div style="/* insecure input */">Magic div</div>
13059 !! end
13061 !! test
13062 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
13063 !! wikitext
13064 {{div style|"><script>alert(document.cookie)</script>}}
13065 !! html
13066 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13068 !! end
13070 !! test
13071 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
13072 !! wikitext
13073 {{div style|" ><script>alert(document.cookie)</script>}}
13074 !! html
13075 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
13077 !! end
13079 !! test
13080 Bug 2304: HTML attribute safety (link)
13081 !! wikitext
13082 <div title="[[Main Page]]"></div>
13083 !! html
13084 <div title="&#91;&#91;Main Page]]"></div>
13086 !! end
13088 !! test
13089 Bug 2304: HTML attribute safety (italics)
13090 !! wikitext
13091 <div title="''foobar''"></div>
13092 !! html
13093 <div title="&#39;&#39;foobar&#39;&#39;"></div>
13095 !! end
13097 !! test
13098 Bug 2304: HTML attribute safety (bold)
13099 !! wikitext
13100 <div title="'''foobar'''"></div>
13101 !! html
13102 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
13104 !! end
13107 !! test
13108 Bug 2304: HTML attribute safety (ISBN)
13109 !! wikitext
13110 <div title="ISBN 1234567890"></div>
13111 !! html
13112 <div title="&#73;SBN 1234567890"></div>
13114 !! end
13116 !! test
13117 Bug 2304: HTML attribute safety (RFC)
13118 !! wikitext
13119 <div title="RFC 1234"></div>
13120 !! html
13121 <div title="&#82;FC 1234"></div>
13123 !! end
13125 !! test
13126 Bug 2304: HTML attribute safety (PMID)
13127 !! wikitext
13128 <div title="PMID 1234567890"></div>
13129 !! html
13130 <div title="&#80;MID 1234567890"></div>
13132 !! end
13134 !! test
13135 Bug 2304: HTML attribute safety (web link)
13136 !! wikitext
13137 <div title="http://example.com/"></div>
13138 !! html
13139 <div title="http&#58;//example.com/"></div>
13141 !! end
13143 !! test
13144 Bug 2304: HTML attribute safety (named web link)
13145 !! wikitext
13146 <div title="[http://example.com/ link]"></div>
13147 !! html
13148 <div title="&#91;http&#58;//example.com/ link]"></div>
13150 !! end
13152 !! test
13153 Bug 3244: HTML attribute safety (extension; safe)
13154 !! wikitext
13155 <div style="<nowiki>background:blue</nowiki>"></div>
13156 !! html
13157 <div style="background:blue"></div>
13159 !! end
13161 !! test
13162 Bug 3244: HTML attribute safety (extension; unsafe)
13163 !! wikitext
13164 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
13165 !! html
13166 <div style="/* insecure input */"></div>
13168 !! end
13170 # More MSIE fun discovered by Tom Gilder
13172 !! test
13173 MSIE CSS safety test: spurious slash
13174 !! wikitext
13175 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
13176 !! html
13177 <div style="/* insecure input */">evil</div>
13179 !! end
13181 !! test
13182 MSIE CSS safety test: hex code
13183 !! wikitext
13184 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
13185 !! html
13186 <div style="/* insecure input */">evil</div>
13188 !! end
13190 !! test
13191 MSIE CSS safety test: comment in url
13192 !! wikitext
13193 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
13194 !! html
13195 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
13197 !! end
13199 !! test
13200 MSIE CSS safety test: comment in expression
13201 !! wikitext
13202 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
13203 !! html
13204 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
13206 !! end
13208 !! test
13209 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
13210 !! wikitext
13211 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
13212 !! html
13213 <p style="/* invalid control char */">A</p>
13215 !! end
13217 !! test
13218 MSIE 6 CSS safety test: Fullwidth (bug 55332)
13219 !! wikitext
13220 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
13221 <div style="top:EXPRESSION(alert())">B</div>
13222 !! html
13223 <p style="/* insecure input */">A</p>
13224 <div style="/* insecure input */">B</div>
13226 !! end
13228 !! test
13229 MSIE 6 CSS safety test: IPA extensions (bug 55332)
13230 !! wikitext
13231 <div style="background-image:uʀʟ(javascript:alert())">A</div>
13232 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
13233 !! html
13234 <div style="/* insecure input */">A</div>
13235 <p style="/* insecure input */">B</p>
13237 !! end
13239 !! test
13240 MSIE 6 CSS safety test: sup/sub script (bug 55332)
13241 !! wikitext
13242 <div style="background-image:url⁽javascript:alert())">A</div>
13243 <div style="background-image:url₍javascript:alert())">B</div>
13244 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
13245 !! html
13246 <div style="/* insecure input */">A</div>
13247 <div style="/* insecure input */">B</div>
13248 <p style="/* insecure input */">C</p>
13250 !! end
13252 !! test
13253 Opera -o-link CSS
13254 !! wikitext
13255 <div
13256 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;"
13257 style="-o-link:attr(title);-o-link-source:current">X</div>
13258 !! html
13259 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
13261 !! end
13263 !! test
13264 MSIE 6 CSS safety test: Repetition markers (bug 55332)
13265 !! wikitext
13266 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
13267 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
13268 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
13269 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
13270 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
13271 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
13272 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
13273 !! html
13274 <p style="/* insecure input */">A</p>
13275 <p style="/* insecure input */">B</p>
13276 <p style="/* insecure input */">C</p>
13277 <p style="/* insecure input */">D</p>
13278 <p style="/* insecure input */">E</p>
13279 <p style="/* insecure input */">F</p>
13280 <p style="/* insecure input */">G</p>
13282 !! end
13284 !! test
13285 Table attribute legitimate extension
13286 !! wikitext
13288 !+ style="<nowiki>color:blue</nowiki>"| status
13290 !! html
13291 <table>
13292 <tr>
13293 <th style="color:blue"> status
13294 </th></tr></table>
13296 !!end
13298 !! test
13299 Table attribute safety
13300 !! wikitext
13302 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
13304 !! html
13305 <table>
13306 <tr>
13307 <th style="/* insecure input */"> status
13308 </th></tr></table>
13310 !! end
13312 !! test
13313 CSS line continuation 1
13314 !! wikitext
13315 <div style="background-image: u\&#10;rl(test.jpg);"></div>
13316 !! html
13317 <div style="/* insecure input */"></div>
13319 !! end
13321 !! test
13322 CSS line continuation 2
13323 !! wikitext
13324 <div style="background-image: u\&#13;rl(test.jpg); "></div>
13325 !! html
13326 <div style="/* insecure input */"></div>
13328 !! end
13330 !! article
13331 Template:Identity
13332 !! text
13333 {{{1}}}
13334 !! endarticle
13336 !! test
13337 Expansion of multi-line templates in attribute values (bug 6255)
13338 !! wikitext
13339 <div style="background: {{identity|#00FF00}}">-</div>
13340 !! html
13341 <div style="background: #00FF00">-</div>
13343 !! end
13346 !! test
13347 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
13348 !! wikitext
13349 <div style="background: 
13350 #00FF00">-</div>
13351 !! html
13352 <div style="background: #00FF00">-</div>
13354 !! end
13356 !! test
13357 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
13358 !! wikitext
13359 <div style="background: &#10;#00FF00">-</div>
13360 !! html
13361 <div style="background: &#10;#00FF00">-</div>
13363 !! end
13366 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
13368 !! test
13369 Parser hook: empty input
13370 !! wikitext
13371 <tag></tag>
13372 !! html
13373 <pre>
13375 array (
13377 </pre>
13379 !! end
13381 !! test
13382 Parser hook: empty input using terminated empty elements
13383 !! wikitext
13384 <tag/>
13385 !! html
13386 <pre>
13387 NULL
13388 array (
13390 </pre>
13392 !! end
13394 !! test
13395 Parser hook: empty input using terminated empty elements (space before)
13396 !! wikitext
13397 <tag />
13398 !! html
13399 <pre>
13400 NULL
13401 array (
13403 </pre>
13405 !! end
13407 !! test
13408 Parser hook: basic input
13409 !! wikitext
13410 <tag>input</tag>
13411 !! html
13412 <pre>
13413 'input'
13414 array (
13416 </pre>
13418 !! end
13421 !! test
13422 Parser hook: case insensitive
13423 !! wikitext
13424 <TAG>input</TAG>
13425 !! html
13426 <pre>
13427 'input'
13428 array (
13430 </pre>
13432 !! end
13435 !! test
13436 Parser hook: case insensitive, redux
13437 !! wikitext
13438 <TaG>input</TAg>
13439 !! html
13440 <pre>
13441 'input'
13442 array (
13444 </pre>
13446 !! end
13448 !! test
13449 Parser hook: nested tags
13450 !! options
13451 noxml
13452 !! wikitext
13453 <tag><tag></tag></tag>
13454 !! html
13455 <pre>
13456 '<tag>'
13457 array (
13459 </pre>&lt;/tag&gt;
13461 !! end
13463 !! test
13464 Parser hook: basic arguments
13465 !! wikitext
13466 <tag width=200 height = "100" depth = '50' square></tag>
13467 !! html
13468 <pre>
13470 array (
13471   'width' => '200',
13472   'height' => '100',
13473   'depth' => '50',
13474   'square' => 'square',
13476 </pre>
13478 !! end
13480 !! test
13481 Parser hook: argument containing a forward slash (bug 5344)
13482 !! wikitext
13483 <tag filename='/tmp/bla'></tag>
13484 !! html
13485 <pre>
13487 array (
13488   'filename' => '/tmp/bla',
13490 </pre>
13492 !! end
13494 !! test
13495 Parser hook: empty input using terminated empty elements (bug 2374)
13496 !! wikitext
13497 <tag foo=bar/>text
13498 !! html
13499 <pre>
13500 NULL
13501 array (
13502   'foo' => 'bar',
13504 </pre>text
13506 !! end
13508 # </tag> should be output literally since there is no matching tag that begins it
13509 !! test
13510 Parser hook: basic arguments using terminated empty elements (bug 2374)
13511 !! wikitext
13512 <tag width=200 height = "100" depth = '50' square/>
13513 other stuff
13514 </tag>
13515 !! html
13516 <pre>
13517 NULL
13518 array (
13519   'width' => '200',
13520   'height' => '100',
13521   'depth' => '50',
13522   'square' => 'square',
13524 </pre>
13525 <p>other stuff
13526 &lt;/tag&gt;
13527 </p>
13528 !! end
13531 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
13534 !! test
13535 Parser hook: static parser hook not inside a comment
13536 !! wikitext
13537 <statictag>hello, world</statictag>
13538 <statictag action=flush/>
13539 !! html
13540 <p>hello, world
13541 </p>
13542 !! end
13545 !! test
13546 Parser hook: static parser hook inside a comment
13547 !! wikitext
13548 <!-- <statictag>hello, world</statictag> -->
13549 <statictag action=flush/>
13550 !! html
13551 <p><br />
13552 </p>
13553 !! end
13555 # Nested template calls; this case was broken by Parser.php rev 1.506,
13556 # since reverted.
13558 !! article
13559 Template:One-parameter
13560 !! text
13561 (My parameter is: {{{1}}})
13562 !! endarticle
13564 !! article
13565 Template:Map-one-parameter
13566 !! text
13567 {{{{{1}}}|{{{2}}}}}
13568 !! endarticle
13570 !! test
13571 Nested template calls
13572 !! wikitext
13573 {{Map-one-parameter|One-parameter|param}}
13574 !! html
13575 <p>(My parameter is: param)
13576 </p>
13577 !! end
13581 ### Sanitizer
13583 !! test
13584 Sanitizer: Closing of open tags
13585 !! wikitext
13586 <s></s><table></table>
13587 !! html
13588 <s></s><table></table>
13590 !! end
13592 !! test
13593 Sanitizer: Closing of open but not closed tags
13594 !! wikitext
13595 <s>foo
13596 !! html
13597 <p><s>foo</s>
13598 </p>
13599 !! end
13601 !! test
13602 Sanitizer: Closing of closed but not open tags
13603 !! wikitext
13604 </s>
13605 !! html
13606 <p>&lt;/s&gt;
13607 </p>
13608 !! end
13610 !! test
13611 Sanitizer: Closing of closed but not open table tags
13612 !! wikitext
13613 Table not started</td></tr></table>
13614 !! html
13615 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
13616 </p>
13617 !! end
13619 !! test
13620 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
13621 !! wikitext
13622 <span id="æ: v">byte</span>[[#æ: v|backlink]]
13623 !! html
13624 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
13625 </p>
13626 !! end
13628 !! test
13629 Sanitizer: Validating the contents of the id attribute (bug 4515)
13630 !! options
13631 disabled
13632 !! wikitext
13633 <br id=9 />
13634 !! html
13635 Something, but definitely not <br id="9" />...
13636 !! end
13638 !! test
13639 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
13640 !! options
13641 disabled
13642 !! wikitext
13643 <br id="foo" /><br id="foo" />
13644 !! html
13645 Something need to be done. foo-2 ? 
13646 !! end
13648 !! test
13649 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
13650 !! wikitext
13651 <div itemscope>
13652         <meta itemprop="hello" content="world">
13653         <meta http-equiv="refresh" content="5">
13654         <meta itemprop="hello" http-equiv="refresh" content="5">
13655         <link itemprop="hello" href="{{SERVER}}">
13656         <link rel="stylesheet" href="{{SERVER}}">
13657         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
13658 </div>
13659 !! html
13660 <div itemscope="itemscope">
13661 <p>     <meta itemprop="hello" content="world" />
13662         &lt;meta http-equiv="refresh" content="5"&gt;
13663         <meta itemprop="hello" content="5" />
13664 </p>
13665         <link itemprop="hello" href="http&#58;//example.org" />
13666         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
13667         <link itemprop="hello" href="http&#58;//example.org" />
13668 </div>
13670 !! end
13672 !! test
13673 Language converter: output gets cut off unexpectedly (bug 5757)
13674 !! options
13675 language=zh
13676 !! wikitext
13677 this bit is safe: }-
13679 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
13681 then we get cut off here: }-
13683 all additional text is vanished
13684 !! html
13685 <p>this bit is safe: }-
13686 </p><p>but if we add a conversion instance: xxx
13687 </p><p>then we get cut off here: }-
13688 </p><p>all additional text is vanished
13689 </p>
13690 !! end
13692 !! test
13693 Self closed html pairs (bug 5487)
13694 !! options
13695 !! wikitext
13696 <center><font id="bug" />Centered text</center>
13697 <div><font id="bug2" />In div text</div>
13698 !! html
13699 <center>&lt;font id="bug" /&gt;Centered text</center>
13700 <div>&lt;font id="bug2" /&gt;In div text</div>
13702 !! end
13708 !! test
13709 Punctuation: nbsp before exclamation
13710 !! wikitext
13711 C'est grave !
13712 !! html
13713 <p>C'est grave&#160;!
13714 </p>
13715 !! end
13717 !! test
13718 Punctuation: CSS !important (bug 11874)
13719 !! wikitext
13720 <div style="width:50% !important">important</div>
13721 !! html
13722 <div style="width:50% !important">important</div>
13724 !!end
13726 !! test
13727 Punctuation: CSS ! important (bug 11874; with space after)
13728 !! wikitext
13729 <div style="width:50% ! important">important</div>
13730 !! html
13731 <div style="width:50% ! important">important</div>
13733 !!end
13736 !! test
13737 HTML bullet list, closed tags (bug 5497)
13738 !! wikitext
13739 <ul>
13740 <li>One</li>
13741 <li>Two</li>
13742 </ul>
13743 !! html
13744 <ul>
13745 <li>One</li>
13746 <li>Two</li>
13747 </ul>
13749 !! end
13751 !! test
13752 HTML bullet list, unclosed tags (bug 5497)
13753 !! options
13754 disabled
13755 !! wikitext
13756 <ul>
13757 <li>One
13758 <li>Two
13759 </ul>
13760 !! html
13761 <ul>
13762 <li>One
13763 </li>
13764 <li>Two
13765 </li>
13766 </ul>
13768 !! end
13770 !! test
13771 HTML ordered list, closed tags (bug 5497)
13772 !! wikitext
13773 <ol>
13774 <li>One</li>
13775 <li>Two</li>
13776 </ol>
13777 !! html
13778 <ol>
13779 <li>One</li>
13780 <li>Two</li>
13781 </ol>
13783 !! end
13785 !! test
13786 HTML ordered list, unclosed tags (bug 5497)
13787 !! options
13788 disabled
13789 !! wikitext
13790 <ol>
13791 <li>One
13792 <li>Two
13793 </ol>
13794 !! html
13795 <ol>
13796 <li>One
13797 </li>
13798 <li>Two
13799 </li>
13800 </ol>
13802 !! end
13804 !! test
13805 HTML nested bullet list, closed tags (bug 5497)
13806 !! wikitext
13807 <ul>
13808 <li>One</li>
13809 <li>Two:
13810 <ul>
13811 <li>Sub-one</li>
13812 <li>Sub-two</li>
13813 </ul>
13814 </li>
13815 </ul>
13816 !! html
13817 <ul>
13818 <li>One</li>
13819 <li>Two:
13820 <ul>
13821 <li>Sub-one</li>
13822 <li>Sub-two</li>
13823 </ul>
13824 </li>
13825 </ul>
13827 !! end
13829 !! test
13830 HTML nested bullet list, open tags (bug 5497)
13831 !! options
13832 disabled
13833 !! wikitext
13834 <ul>
13835 <li>One
13836 <li>Two:
13837 <ul>
13838 <li>Sub-one
13839 <li>Sub-two
13840 </ul>
13841 </ul>
13842 !! html
13843 <ul>
13844 <li>One
13845 </li>
13846 <li>Two:
13847 <ul>
13848 <li>Sub-one
13849 </li>
13850 <li>Sub-two
13851 </li>
13852 </ul>
13853 </li>
13854 </ul>
13856 !! end
13858 !! test
13859 HTML nested ordered list, closed tags (bug 5497)
13860 !! wikitext
13861 <ol>
13862 <li>One</li>
13863 <li>Two:
13864 <ol>
13865 <li>Sub-one</li>
13866 <li>Sub-two</li>
13867 </ol>
13868 </li>
13869 </ol>
13870 !! html
13871 <ol>
13872 <li>One</li>
13873 <li>Two:
13874 <ol>
13875 <li>Sub-one</li>
13876 <li>Sub-two</li>
13877 </ol>
13878 </li>
13879 </ol>
13881 !! end
13883 !! test
13884 HTML nested ordered list, open tags (bug 5497)
13885 !! options
13886 disabled
13887 !! wikitext
13888 <ol>
13889 <li>One
13890 <li>Two:
13891 <ol>
13892 <li>Sub-one
13893 <li>Sub-two
13894 </ol>
13895 </ol>
13896 !! html
13897 <ol>
13898 <li>One
13899 </li>
13900 <li>Two:
13901 <ol>
13902 <li>Sub-one
13903 </li>
13904 <li>Sub-two
13905 </li>
13906 </ol>
13907 </li>
13908 </ol>
13910 !! end
13912 !! test
13913 HTML ordered list item with parameters oddity
13914 !! wikitext
13915 <ol><li id="fragment">One</li>
13916 </ol>
13917 !! html
13918 <ol><li id="fragment">One</li>
13919 </ol>
13921 !! end
13923 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
13924 !!test
13925 bug 5918: autonumbering
13926 !! wikitext
13927 [http://first/] [http://second] [ftp://ftp]
13929 ftp://inlineftp
13931 [mailto:enclosed@mail.tld With target]
13933 [mailto:enclosed@mail.tld]
13935 mailto:inline@mail.tld
13936 !! html/php
13937 <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>
13938 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
13939 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
13940 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
13941 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
13942 </p>
13943 !! html/parsoid
13944 <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>
13945 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
13946 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
13947 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
13948 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
13949 !! end
13953 # Security and HTML correctness
13954 # From Nick Jenkins' fuzz testing
13957 !! test
13958 Fuzz testing: Parser13
13959 !! wikitext
13960 {| 
13961 | http://a|
13962 !! html
13963 <table>
13964 <tr>
13965 <td>
13966 </td>
13967 </tr>
13968 </table>
13970 !! end
13972 !! test
13973 Fuzz testing: Parser14
13974 !! wikitext
13975 == onmouseover= ==
13976 http://__TOC__
13977 !! html
13978 <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>
13979 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13980 <ul>
13981 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
13982 </ul>
13983 </div>
13986 !! end
13988 !! test
13989 Fuzz testing: Parser14-table
13990 !! wikitext
13991 ==a==
13992 {| STYLE=__TOC__
13993 !! html
13994 <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>
13995 <table style="&#95;_TOC&#95;_">
13996 <tr><td></td></tr>
13997 </table>
13999 !! end
14001 # Known to produce bogus xml (extra </td>)
14002 !! test
14003 Fuzz testing: Parser16
14004 !! options
14005 noxml
14006 !! wikitext
14008 !https://||||||
14009 !! html
14010 <table>
14011 <tr>
14012 <th>https://</th>
14013 <th></th>
14014 <th></th>
14015 <th>
14016 </td>
14017 </tr>
14018 </table>
14020 !! end
14022 !! test
14023 Fuzz testing: Parser21
14024 !! wikitext
14026 ! irc://{{ftp://a" onmouseover="alert('hello world');"
14028 !! html
14029 <table>
14030 <tr>
14031 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
14032 </th>
14033 <td>
14034 </td>
14035 </tr>
14036 </table>
14038 !! end
14040 !! test
14041 Fuzz testing: Parser22
14042 !! wikitext
14043 http://===r:::https://b
14046 !! html
14047 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
14048 </p>
14049 <table>
14050 <tr><td></td></tr>
14051 </table>
14053 !! end
14055 # Known to produce bad XML for now
14056 !! test
14057 Fuzz testing: Parser24
14058 !! options
14059 noxml
14060 !! wikitext
14062 {{{|
14063 <u CLASS=
14064 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
14065 <br style="onmouseover='alert(document.cookie);' " />
14067 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14069 !! html
14070 <table>
14071 {{{|
14072 <u class="&#124;">}}}} &gt;
14073 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
14075 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
14076 <tr>
14077 <td></u>
14078 </td>
14079 </tr>
14080 </table>
14082 !! end
14084 # Note: the current result listed for this is not what the original one was,
14085 # but the original bug was JavaScript injection, which is fixed in any case.
14086 # It's not clear that the original result listed was any more correct than the
14087 # current one.  Original result:
14088 # <p>{{{| 
14089 # </p>
14090 # <li class="&#124;&#124;">
14091 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14092 !!test
14093 Fuzz testing: Parser25 (bug 6055)
14094 !! wikitext
14097 <LI CLASS=||
14099 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
14100 !! html
14101 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
14102 </p>
14103 !! end
14105 !!test
14106 Fuzz testing: URL adjacent extension (with space, clean)
14107 !! options
14108 !! wikitext
14109 http://example.com <nowiki>junk</nowiki>
14110 !! html
14111 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
14112 </p>
14113 !!end
14115 !!test
14116 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
14117 !! options
14118 !! wikitext
14119 http://example.com<nowiki>junk</nowiki>
14120 !! html
14121 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
14122 </p>
14123 !!end
14125 !!test
14126 Fuzz testing: URL adjacent extension (no space, dirty; pre)
14127 !! options
14128 !! wikitext
14129 http://example.com<pre>junk</pre>
14130 !! html
14131 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
14133 !!end
14135 !!test
14136 Fuzz testing: image with bogus manual thumbnail
14137 !! wikitext
14138 [[Image:foobar.jpg|thumbnail= ]]
14139 !! html/php
14140 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
14142 !! html/parsoid
14143 <meta typeof="mw:Placeholder" data-parsoid='{"src":"[[Image:foobar.jpg|thumbnail= ]]","optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,null,null]}'/>
14144 !!end
14146 !! test
14147 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
14148 !! wikitext
14149 <pre dir="&#10;"></pre>
14150 !! html
14151 <pre dir="&#10;"></pre>
14153 !! end
14155 !! test
14156 Parsing optional HTML elements (Bug 6171)
14157 !! options
14158 !! wikitext
14159 <table>
14160   <tr>
14161     <td> Some tabular data</td>
14162     <td> More tabular data ...
14163     <td> And yet som tabular data</td>
14164   </tr>
14165 </table>
14166 !! html
14167 <table>
14168   <tr>
14169     <td> Some tabular data</td>
14170     <td> More tabular data ...
14171     </td><td> And yet som tabular data</td>
14172   </tr>
14173 </table>
14175 !! end
14177 !! test
14178 Correct handling of <td>, <tr> (Bug 6171)
14179 !! options
14180 !! wikitext
14181 <table>
14182   <tr>
14183     <td> Some tabular data</td>
14184     <td> More tabular data ...</td>
14185     <td> And yet som tabular data</td>
14186   </tr>
14187 </table>
14188 !! html
14189 <table>
14190   <tr>
14191     <td> Some tabular data</td>
14192     <td> More tabular data ...</td>
14193     <td> And yet som tabular data</td>
14194   </tr>
14195 </table>
14197 !! end
14200 !! test
14201 Parsing crashing regression (fr:JavaScript)
14202 !! wikitext
14203 </body></x>
14204 !! html
14205 <p>&lt;/body&gt;&lt;/x&gt;
14206 </p>
14207 !! end
14209 !! test
14210 Inline wiki vs wiki block nesting
14211 !! wikitext
14212 '''Bold paragraph
14214 New wiki paragraph
14215 !! html
14216 <p><b>Bold paragraph</b>
14217 </p><p>New wiki paragraph
14218 </p>
14219 !! end
14221 !! test
14222 Inline HTML vs wiki block nesting
14223 !! options
14224 disabled
14225 !! wikitext
14226 <b>Bold paragraph
14228 New wiki paragraph
14229 !! html
14230 <p><b>Bold paragraph</b>
14231 </p><p>New wiki paragraph
14232 </p>
14233 !! end
14235 # Original result was this:
14236 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
14237 # </p>
14238 # While that might be marginally more intuitive, maybe, the six-apostrophe
14239 # construct is clearly pathological and the result stated here (which is what
14240 # the parser actually does) is about as reasonable as anything.
14241 !!test
14242 Mixing markup for italics and bold
14243 !! options
14244 !! wikitext
14245 '''bold''''''bold''bolditalics'''''
14246 !! html
14247 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
14248 </p>
14249 !! end
14252 !! article
14253 Xyzzyx
14254 !! text
14255 Article for special page transclusion test
14256 !! endarticle
14258 !! test
14259 Special page transclusion
14260 !! options
14261 !! wikitext
14262 {{Special:Prefixindex/Xyzzyx}}
14263 !! html
14264 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14266 !! end
14268 !! test
14269 Special page transclusion twice (bug 5021)
14270 !! options
14271 !! wikitext
14272 {{Special:Prefixindex/Xyzzyx}}
14273 {{Special:Prefixindex/Xyzzyx}}
14274 !! html
14275 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14276 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
14278 !! end
14280 !! test
14281 Transclusion of default MediaWiki message
14282 !! wikitext
14283 {{MediaWiki:Mainpage}}
14284 !! html
14285 <p>Main Page
14286 </p>
14287 !! end
14289 !! test
14290 Transclusion of nonexistent MediaWiki message
14291 !! wikitext
14292 {{MediaWiki:Mainpagexxx}}
14293 !! html
14294 <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>
14295 </p>
14296 !! end
14298 !! test
14299 Transclusion of MediaWiki message with underscore
14300 !! wikitext
14301 {{MediaWiki:history_short}}
14302 !! html
14303 <p>History
14304 </p>
14305 !! end
14307 !! test
14308 Transclusion of MediaWiki message with space
14309 !! wikitext
14310 {{MediaWiki:history short}}
14311 !! html
14312 <p>History
14313 </p>
14314 !! end
14316 !! test
14317 Invalid header with following text
14318 !! wikitext
14319 = x = y
14320 !! html
14321 <p>= x = y
14322 </p>
14323 !! end
14326 !! test
14327 Section extraction test (section 0)
14328 !! options
14329 section=0
14330 !! wikitext
14331 start
14332 ==a==
14333 ===aa===
14334 ====aaa====
14335 ==b==
14336 ===ba===
14337 ===bb===
14338 ====bba====
14339 ===bc===
14340 ==c==
14341 ===ca===
14342 !! html
14343 start
14344 !! end
14346 !! test
14347 Section extraction test (section 1)
14348 !! options
14349 section=1
14350 !! wikitext
14351 start
14352 ==a==
14353 ===aa===
14354 ====aaa====
14355 ==b==
14356 ===ba===
14357 ===bb===
14358 ====bba====
14359 ===bc===
14360 ==c==
14361 ===ca===
14362 !! html
14363 ==a==
14364 ===aa===
14365 ====aaa====
14366 !! end
14368 !! test
14369 Section extraction test (section 2)
14370 !! options
14371 section=2
14372 !! wikitext
14373 start
14374 ==a==
14375 ===aa===
14376 ====aaa====
14377 ==b==
14378 ===ba===
14379 ===bb===
14380 ====bba====
14381 ===bc===
14382 ==c==
14383 ===ca===
14384 !! html
14385 ===aa===
14386 ====aaa====
14387 !! end
14389 !! test
14390 Section extraction test (section 3)
14391 !! options
14392 section=3
14393 !! wikitext
14394 start
14395 ==a==
14396 ===aa===
14397 ====aaa====
14398 ==b==
14399 ===ba===
14400 ===bb===
14401 ====bba====
14402 ===bc===
14403 ==c==
14404 ===ca===
14405 !! html
14406 ====aaa====
14407 !! end
14409 !! test
14410 Section extraction test (section 4)
14411 !! options
14412 section=4
14413 !! wikitext
14414 start
14415 ==a==
14416 ===aa===
14417 ====aaa====
14418 ==b==
14419 ===ba===
14420 ===bb===
14421 ====bba====
14422 ===bc===
14423 ==c==
14424 ===ca===
14425 !! html
14426 ==b==
14427 ===ba===
14428 ===bb===
14429 ====bba====
14430 ===bc===
14431 !! end
14433 !! test
14434 Section extraction test (section 5)
14435 !! options
14436 section=5
14437 !! wikitext
14438 start
14439 ==a==
14440 ===aa===
14441 ====aaa====
14442 ==b==
14443 ===ba===
14444 ===bb===
14445 ====bba====
14446 ===bc===
14447 ==c==
14448 ===ca===
14449 !! html
14450 ===ba===
14451 !! end
14453 !! test
14454 Section extraction test (section 6)
14455 !! options
14456 section=6
14457 !! wikitext
14458 start
14459 ==a==
14460 ===aa===
14461 ====aaa====
14462 ==b==
14463 ===ba===
14464 ===bb===
14465 ====bba====
14466 ===bc===
14467 ==c==
14468 ===ca===
14469 !! html
14470 ===bb===
14471 ====bba====
14472 !! end
14474 !! test
14475 Section extraction test (section 7)
14476 !! options
14477 section=7
14478 !! wikitext
14479 start
14480 ==a==
14481 ===aa===
14482 ====aaa====
14483 ==b==
14484 ===ba===
14485 ===bb===
14486 ====bba====
14487 ===bc===
14488 ==c==
14489 ===ca===
14490 !! html
14491 ====bba====
14492 !! end
14494 !! test
14495 Section extraction test (section 8)
14496 !! options
14497 section=8
14498 !! wikitext
14499 start
14500 ==a==
14501 ===aa===
14502 ====aaa====
14503 ==b==
14504 ===ba===
14505 ===bb===
14506 ====bba====
14507 ===bc===
14508 ==c==
14509 ===ca===
14510 !! html
14511 ===bc===
14512 !! end
14514 !! test
14515 Section extraction test (section 9)
14516 !! options
14517 section=9
14518 !! wikitext
14519 start
14520 ==a==
14521 ===aa===
14522 ====aaa====
14523 ==b==
14524 ===ba===
14525 ===bb===
14526 ====bba====
14527 ===bc===
14528 ==c==
14529 ===ca===
14530 !! html
14531 ==c==
14532 ===ca===
14533 !! end
14535 !! test
14536 Section extraction test (section 10)
14537 !! options
14538 section=10
14539 !! wikitext
14540 start
14541 ==a==
14542 ===aa===
14543 ====aaa====
14544 ==b==
14545 ===ba===
14546 ===bb===
14547 ====bba====
14548 ===bc===
14549 ==c==
14550 ===ca===
14551 !! html
14552 ===ca===
14553 !! end
14555 !! test
14556 Section extraction test (nonexistent section 11)
14557 !! options
14558 section=11
14559 !! wikitext
14560 start
14561 ==a==
14562 ===aa===
14563 ====aaa====
14564 ==b==
14565 ===ba===
14566 ===bb===
14567 ====bba====
14568 ===bc===
14569 ==c==
14570 ===ca===
14571 !! html
14572 !! end
14574 !! test
14575 Section extraction test with bogus heading (section 1)
14576 !! options
14577 section=1
14578 !! wikitext
14579 ==a==
14580 ==bogus== not a legal section
14581 ==b==
14582 !! html
14583 ==a==
14584 ==bogus== not a legal section
14585 !! end
14587 !! test
14588 Section extraction test with bogus heading (section 2)
14589 !! options
14590 section=2
14591 !! wikitext
14592 ==a==
14593 ==bogus== not a legal section
14594 ==b==
14595 !! html
14596 ==b==
14597 !! end
14599 !! test
14600 Section extraction test with comment after heading (section 1)
14601 !! options
14602 section=1
14603 !! wikitext
14604 ==a==
14605 ==b== <!-- -->
14606 ==c==
14607 !! html
14608 ==a==
14609 !! end
14611 !! test
14612 Section extraction test with comment after heading (section 2)
14613 !! options
14614 section=2
14615 !! wikitext
14616 ==a==
14617 ==b== <!-- -->
14618 ==c==
14619 !! html
14620 ==b== <!-- -->
14621 !! end
14623 !! test
14624 Section extraction test with bogus <nowiki> heading (section 1)
14625 !! options
14626 section=1
14627 !! wikitext
14628 ==a==
14629 ==bogus== <nowiki>not a legal section</nowiki>
14630 ==b==
14631 !! html
14632 ==a==
14633 ==bogus== <nowiki>not a legal section</nowiki>
14634 !! end
14636 !! test
14637 Section extraction test with bogus <nowiki> heading (section 2)
14638 !! options
14639 section=2
14640 !! wikitext
14641 ==a==
14642 ==bogus== <nowiki>not a legal section</nowiki>
14643 ==b==
14644 !! html
14645 ==b==
14646 !! end
14649 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
14650 # instead of respecting commented sections
14651 !! test
14652 Section extraction prefixed by comment (section 1)
14653 !! options
14654 section=1
14655 !! wikitext
14656 <!-- -->==sec1==
14657 ==sec2==
14658 !! html
14659 ==sec2==
14660 !!end
14662 !! test
14663 Section extraction prefixed by comment (section 2)
14664 !! options
14665 section=2
14666 !! wikitext
14667 <!-- -->==sec1==
14668 ==sec2==
14669 !! html
14671 !!end
14674 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
14675 # instead of respecting HTML-style headings
14676 !! test
14677 Section extraction, mixed wiki and html (section 1)
14678 !! options
14679 section=1
14680 !! wikitext
14681 <h2>unmarked</h2>
14682 unmarked
14683 ==1==
14685 ==2==
14687 !! html
14688 ==1==
14690 !! end
14692 !! test
14693 Section extraction, mixed wiki and html (section 2)
14694 !! options
14695 section=2
14696 !! wikitext
14697 <h2>unmarked</h2>
14698 unmarked
14699 ==1==
14701 ==2==
14703 !! html
14704 ==2==
14706 !! end
14709 # Formerly testing for bug 3342
14710 !! test
14711 Section extraction, heading surrounded by <noinclude>
14712 !! options
14713 section=1
14714 !! wikitext
14715 <noinclude>==unmarked==</noinclude>
14716 ==marked==
14717 !! html
14718 ==marked==
14719 !!end
14721 # Test behavior of bug 19910
14722 !! test
14723 Sectiion with all-equals
14724 !! options
14725 section=2
14726 !! wikitext
14727 === 
14728 The line above must have a trailing space
14729 === <!--
14730 --> <!-- -->
14731 But just in case it doesn't...
14732 !! html
14733 === <!--
14734 --> <!-- -->
14735 But just in case it doesn't...
14736 !! end
14738 !! test
14739 Section replacement test (section 0)
14740 !! options
14741 replace=0,"xxx"
14742 !! wikitext
14743 start
14744 ==a==
14745 ===aa===
14746 ====aaa====
14747 ==b==
14748 ===ba===
14749 ===bb===
14750 ====bba====
14751 ===bc===
14752 ==c==
14753 ===ca===
14754 !! html
14757 ==a==
14758 ===aa===
14759 ====aaa====
14760 ==b==
14761 ===ba===
14762 ===bb===
14763 ====bba====
14764 ===bc===
14765 ==c==
14766 ===ca===
14767 !! end
14769 !! test
14770 Section replacement test (section 1)
14771 !! options
14772 replace=1,"xxx"
14773 !! wikitext
14774 start
14775 ==a==
14776 ===aa===
14777 ====aaa====
14778 ==b==
14779 ===ba===
14780 ===bb===
14781 ====bba====
14782 ===bc===
14783 ==c==
14784 ===ca===
14785 !! html
14786 start
14789 ==b==
14790 ===ba===
14791 ===bb===
14792 ====bba====
14793 ===bc===
14794 ==c==
14795 ===ca===
14796 !! end
14798 !! test
14799 Section replacement test (section 2)
14800 !! options
14801 replace=2,"xxx"
14802 !! wikitext
14803 start
14804 ==a==
14805 ===aa===
14806 ====aaa====
14807 ==b==
14808 ===ba===
14809 ===bb===
14810 ====bba====
14811 ===bc===
14812 ==c==
14813 ===ca===
14814 !! html
14815 start
14816 ==a==
14819 ==b==
14820 ===ba===
14821 ===bb===
14822 ====bba====
14823 ===bc===
14824 ==c==
14825 ===ca===
14826 !! end
14828 !! test
14829 Section replacement test (section 3)
14830 !! options
14831 replace=3,"xxx"
14832 !! wikitext
14833 start
14834 ==a==
14835 ===aa===
14836 ====aaa====
14837 ==b==
14838 ===ba===
14839 ===bb===
14840 ====bba====
14841 ===bc===
14842 ==c==
14843 ===ca===
14844 !! html
14845 start
14846 ==a==
14847 ===aa===
14850 ==b==
14851 ===ba===
14852 ===bb===
14853 ====bba====
14854 ===bc===
14855 ==c==
14856 ===ca===
14857 !! end
14859 !! test
14860 Section replacement test (section 4)
14861 !! options
14862 replace=4,"xxx"
14863 !! wikitext
14864 start
14865 ==a==
14866 ===aa===
14867 ====aaa====
14868 ==b==
14869 ===ba===
14870 ===bb===
14871 ====bba====
14872 ===bc===
14873 ==c==
14874 ===ca===
14875 !! html
14876 start
14877 ==a==
14878 ===aa===
14879 ====aaa====
14882 ==c==
14883 ===ca===
14884 !! end
14886 !! test
14887 Section replacement test (section 5)
14888 !! options
14889 replace=5,"xxx"
14890 !! wikitext
14891 start
14892 ==a==
14893 ===aa===
14894 ====aaa====
14895 ==b==
14896 ===ba===
14897 ===bb===
14898 ====bba====
14899 ===bc===
14900 ==c==
14901 ===ca===
14902 !! html
14903 start
14904 ==a==
14905 ===aa===
14906 ====aaa====
14907 ==b==
14910 ===bb===
14911 ====bba====
14912 ===bc===
14913 ==c==
14914 ===ca===
14915 !! end
14917 !! test
14918 Section replacement test (section 6)
14919 !! options
14920 replace=6,"xxx"
14921 !! wikitext
14922 start
14923 ==a==
14924 ===aa===
14925 ====aaa====
14926 ==b==
14927 ===ba===
14928 ===bb===
14929 ====bba====
14930 ===bc===
14931 ==c==
14932 ===ca===
14933 !! html
14934 start
14935 ==a==
14936 ===aa===
14937 ====aaa====
14938 ==b==
14939 ===ba===
14942 ===bc===
14943 ==c==
14944 ===ca===
14945 !! end
14947 !! test
14948 Section replacement test (section 7)
14949 !! options
14950 replace=7,"xxx"
14951 !! wikitext
14952 start
14953 ==a==
14954 ===aa===
14955 ====aaa====
14956 ==b==
14957 ===ba===
14958 ===bb===
14959 ====bba====
14960 ===bc===
14961 ==c==
14962 ===ca===
14963 !! html
14964 start
14965 ==a==
14966 ===aa===
14967 ====aaa====
14968 ==b==
14969 ===ba===
14970 ===bb===
14973 ===bc===
14974 ==c==
14975 ===ca===
14976 !! end
14978 !! test
14979 Section replacement test (section 8)
14980 !! options
14981 replace=8,"xxx"
14982 !! wikitext
14983 start
14984 ==a==
14985 ===aa===
14986 ====aaa====
14987 ==b==
14988 ===ba===
14989 ===bb===
14990 ====bba====
14991 ===bc===
14992 ==c==
14993 ===ca===
14994 !! html
14995 start
14996 ==a==
14997 ===aa===
14998 ====aaa====
14999 ==b==
15000 ===ba===
15001 ===bb===
15002 ====bba====
15005 ==c==
15006 ===ca===
15007 !!end
15009 !! test
15010 Section replacement test (section 9)
15011 !! options
15012 replace=9,"xxx"
15013 !! wikitext
15014 start
15015 ==a==
15016 ===aa===
15017 ====aaa====
15018 ==b==
15019 ===ba===
15020 ===bb===
15021 ====bba====
15022 ===bc===
15023 ==c==
15024 ===ca===
15025 !! html
15026 start
15027 ==a==
15028 ===aa===
15029 ====aaa====
15030 ==b==
15031 ===ba===
15032 ===bb===
15033 ====bba====
15034 ===bc===
15036 !! end
15038 !! test
15039 Section replacement test (section 10)
15040 !! options
15041 replace=10,"xxx"
15042 !! wikitext
15043 start
15044 ==a==
15045 ===aa===
15046 ====aaa====
15047 ==b==
15048 ===ba===
15049 ===bb===
15050 ====bba====
15051 ===bc===
15052 ==c==
15053 ===ca===
15054 !! html
15055 start
15056 ==a==
15057 ===aa===
15058 ====aaa====
15059 ==b==
15060 ===ba===
15061 ===bb===
15062 ====bba====
15063 ===bc===
15064 ==c==
15066 !! end
15068 !! test
15069 Section replacement test with initial whitespace (bug 13728)
15070 !! options
15071 replace=2,"xxx"
15072 !! wikitext
15073  Preformatted initial line
15074 ==a==
15075 ===a===
15076 !! html
15077  Preformatted initial line
15078 ==a==
15080 !! end
15083 !! test
15084 Section extraction, heading followed by pre with 20 spaces (bug 6398)
15085 !! options
15086 section=1
15087 !! wikitext
15088 ==a==
15089                     a
15090 !! html
15091 ==a==
15092                     a
15093 !! end
15095 !! test
15096 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
15097 !! options
15098 section=1
15099 !! wikitext
15100 ==a==
15101                    a
15102 !! html
15103 ==a==
15104                    a
15105 !! end
15108 !! test
15109 Section extraction, <pre> around bogus header (bug 10309)
15110 !! options
15111 noxml section=2
15112 !! wikitext
15113 == Section One ==
15114 <pre>
15115 =======
15116 </pre>
15118 == Section Two ==
15119 stuff
15120 !! html
15121 == Section Two ==
15122 stuff
15123 !! end
15125 !! test
15126 Section replacement, <pre> around bogus header (bug 10309)
15127 !! options
15128 noxml replace=2,"xxx"
15129 !! wikitext
15130 == Section One ==
15131 <pre>
15132 =======
15133 </pre>
15135 == Section Two ==
15136 stuff
15137 !! html
15138 == Section One ==
15139 <pre>
15140 =======
15141 </pre>
15144 !! end
15148 !! test
15149 Handling of &#x0A; in URLs
15150 !! wikitext
15151 ** irc://&#x0A;a
15152 !! html/php
15153 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15155 !! html/parsoid
15156 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
15157 a">irc://
15158 a</a></li></ul></li></ul>
15159 !! end
15161 !! test
15162 Handling of %0A in URLs
15163 !! wikitext
15164 ** irc://%0Aa
15165 !! html/php
15166 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15168 !! html/parsoid
15169 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
15170 !! end
15173 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
15174 !! test
15175 5 quotes, code coverage +1 line
15176 !! options
15177 parsoid=wt2html
15178 !! wikitext
15179 '''''
15180 !! html/php
15181 !! html/parsoid
15182 <p><b><i></i></b></p>
15183 !! end
15185 # same html as previous, but wikitext adjusted to match parsoid html2wt
15186 # note that wt2html and html2html will put the <i> before the <b>
15187 !! test
15188 5 quotes, code coverage +1 line w/ nowiki (1)
15189 !! options
15190 parsoid=wt2wt,html2wt
15191 !! wikitext
15192 '''''<nowiki/>'''''
15193 !! html/php
15194 <p><i></i>
15195 </p>
15196 !! html/parsoid
15197 <p><b><i></i></b></p>
15198 !! end
15200 # same as previous, just swapping the <i> and <b>
15201 !! test
15202 5 quotes, code coverage +1 line w/ nowiki (2)
15203 !! wikitext
15204 '''''<nowiki/>'''''
15205 !! html/php
15206 <p><i></i>
15207 </p>
15208 !! html/parsoid
15209 <p><i><b></b></i></p>
15210 !! end
15212 !! test
15213 Special:Search page linking.
15214 !! wikitext
15215 {{Special:search}}
15216 !! html
15217 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
15218 </p>
15219 !! end
15221 !! test
15222 Say the magic word
15223 !! options
15224 title=[[Parser test]]
15225 !! wikitext
15226 * {{PAGENAME}}
15227 * {{PAGENAMEE}}
15228 * {{FULLPAGENAME}}
15229 * {{FULLPAGENAMEE}}
15230 * {{BASEPAGENAME}}
15231 * {{BASEPAGENAMEE}}
15232 * {{SUBPAGENAME}}
15233 * {{SUBPAGENAMEE}}
15234 * {{ROOTPAGENAME}}
15235 * {{ROOTPAGENAMEE}}
15236 * {{TALKPAGENAME}}
15237 * {{TALKPAGENAMEE}}
15238 * {{SUBJECTPAGENAME}}
15239 * {{SUBJECTPAGENAMEE}}
15240 * {{NAMESPACEE}}
15241 * {{NAMESPACE}}
15242 * {{NAMESPACENUMBER}}
15243 * {{TALKSPACE}}
15244 * {{TALKSPACEE}}
15245 * {{SUBJECTSPACE}}
15246 * {{SUBJECTSPACEE}}
15247 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
15248 !! html
15249 <ul><li> Parser test</li>
15250 <li> Parser_test</li>
15251 <li> Parser test</li>
15252 <li> Parser_test</li>
15253 <li> Parser test</li>
15254 <li> Parser_test</li>
15255 <li> Parser test</li>
15256 <li> Parser_test</li>
15257 <li> Parser test</li>
15258 <li> Parser_test</li>
15259 <li> Talk:Parser test</li>
15260 <li> Talk:Parser_test</li>
15261 <li> Parser test</li>
15262 <li> Parser_test</li>
15263 <li> </li>
15264 <li> </li>
15265 <li> 0</li>
15266 <li> Talk</li>
15267 <li> Talk</li>
15268 <li> </li>
15269 <li> </li>
15270 <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>
15272 !! end
15273 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
15275 !! test
15276 Gallery
15277 !! wikitext
15278 <gallery>
15279 image1.png |
15280 image2.gif|||||
15282 image3|
15283 image4    |300px| centre
15284  image5.svg| http://///////
15285 [[x|xx]]]]
15286 * image6
15287 </gallery>
15288 !! html
15289 <ul class="gallery mw-gallery-traditional">
15290                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15291                         <div class="thumb" style="height: 150px;">Image1.png</div>
15292                         <div class="gallerytext">
15293                         </div>
15294                 </div></li>
15295                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15296                         <div class="thumb" style="height: 150px;">Image2.gif</div>
15297                         <div class="gallerytext">
15298 <p>||||
15299 </p>
15300                         </div>
15301                 </div></li>
15302                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15303                         <div class="thumb" style="height: 150px;">Image3</div>
15304                         <div class="gallerytext">
15305                         </div>
15306                 </div></li>
15307                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15308                         <div class="thumb" style="height: 150px;">Image4</div>
15309                         <div class="gallerytext">
15310 <p>300px| centre
15311 </p>
15312                         </div>
15313                 </div></li>
15314                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15315                         <div class="thumb" style="height: 150px;">Image5.svg</div>
15316                         <div class="gallerytext">
15317 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
15318 </p>
15319                         </div>
15320                 </div></li>
15321                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15322                         <div class="thumb" style="height: 150px;">* image6</div>
15323                         <div class="gallerytext">
15324                         </div>
15325                 </div></li>
15326 </ul>
15328 !! end
15330 !! test
15331 Gallery (with options)
15332 !! wikitext
15333 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
15334 File:Nonexistant.jpg|caption
15335 File:Nonexistant.jpg
15336 image:foobar.jpg|some '''caption''' [[Main Page]]
15337 image:foobar.jpg
15338 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
15339 </gallery>
15340 !! html
15341 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
15342         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
15343                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15344                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15345                         <div class="gallerytext">
15346 <p>caption
15347 </p>
15348                         </div>
15349                 </div></li>
15350                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15351                         <div class="thumb" style="height: 70px;">Nonexistant.jpg</div>
15352                         <div class="gallerytext">
15353                         </div>
15354                 </div></li>
15355                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15356                         <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>
15357                         <div class="gallerytext">
15358 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15359 </p>
15360                         </div>
15361                 </div></li>
15362                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15363                         <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>
15364                         <div class="gallerytext">
15365                         </div>
15366                 </div></li>
15367                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
15368                         <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>
15369                         <div class="gallerytext">
15370 <p>Blabla|blabla.
15371 </p>
15372                         </div>
15373                 </div></li>
15374 </ul>
15376 !! end
15378 !! test
15379 Gallery with link that has fragment
15380 !! wikitext
15381 <gallery>
15382 image:foobar.jpg|link=Main_Page
15383 image:foobar.jpg|link=Main_Page#section
15384 image:foobar.jpg|link=Main Page#section|caption
15385 </gallery>
15386 !! html
15387 <ul class="gallery mw-gallery-traditional">
15388                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15389                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15390                         <div class="gallerytext">
15391                         </div>
15392                 </div></li>
15393                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15394                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15395                         <div class="gallerytext">
15396                         </div>
15397                 </div></li>
15398                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15399                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
15400                         <div class="gallerytext">
15401 <p>caption
15402 </p>
15403                         </div>
15404                 </div></li>
15405 </ul>
15407 !! end
15409 !! test
15410 Gallery with wikitext inside caption
15411 !! wikitext
15412 <gallery>
15413 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
15414 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
15415 </gallery>
15416 !! html
15417 <ul class="gallery mw-gallery-traditional">
15418                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15419                         <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>
15420                         <div class="gallerytext">
15421 <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>
15422 </p>
15423                         </div>
15424                 </div></li>
15425                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15426                         <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>
15427                         <div class="gallerytext">
15428 <p>This is a test template
15429 </p>
15430                         </div>
15431                 </div></li>
15432 </ul>
15434 !! end
15436 !! test
15437 gallery (with showfilename option)
15438 !! wikitext
15439 <gallery showfilename>
15440 File:Nonexistant.jpg|caption
15441 File:Nonexistant.jpg
15442 image:foobar.jpg|some '''caption''' [[Main Page]]
15443 File:Foobar.jpg
15444 </gallery>
15445 !! html
15446 <ul class="gallery mw-gallery-traditional">
15447                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15448                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15449                         <div class="gallerytext">
15450 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15451 caption
15452 </p>
15453                         </div>
15454                 </div></li>
15455                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15456                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15457                         <div class="gallerytext">
15458 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
15459 </p>
15460                         </div>
15461                 </div></li>
15462                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15463                         <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>
15464                         <div class="gallerytext">
15465 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15466 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
15467 </p>
15468                         </div>
15469                 </div></li>
15470                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15471                         <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>
15472                         <div class="gallerytext">
15473 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
15474 </p>
15475                         </div>
15476                 </div></li>
15477 </ul>
15479 !! end
15481 !! test
15482 Gallery (with namespace-less filenames)
15483 !! wikitext
15484 <gallery>
15485 File:Nonexistant.jpg
15486 Nonexistant.jpg
15487 image:foobar.jpg
15488 foobar.jpg
15489 </gallery>
15490 !! html
15491 <ul class="gallery mw-gallery-traditional">
15492                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15493                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15494                         <div class="gallerytext">
15495                         </div>
15496                 </div></li>
15497                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15498                         <div class="thumb" style="height: 150px;">Nonexistant.jpg</div>
15499                         <div class="gallerytext">
15500                         </div>
15501                 </div></li>
15502                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15503                         <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>
15504                         <div class="gallerytext">
15505                         </div>
15506                 </div></li>
15507                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15508                         <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>
15509                         <div class="gallerytext">
15510                         </div>
15511                 </div></li>
15512 </ul>
15514 !! end
15516 !! test
15517 HTML Hex character encoding (spells the word "JavaScript")
15518 !! options
15519 parsoid=wt2html,wt2wt,html2html
15520 !! wikitext
15521 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
15522 !! html/php
15523 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
15524 </p>
15525 !! html/parsoid
15526 <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>
15527 !! end
15529 !! test
15530 HTML Hex character encoding bogus encoding (bug 26437 regression check)
15531 !! wikitext
15532 &#xsee;&#XSEE;
15533 !! html/php
15534 <p>&amp;#xsee;&amp;#XSEE;
15535 </p>
15536 !! html/parsoid
15537 <p>&amp;#xsee;&amp;#XSEE;</p>
15538 !! end
15540 !! test
15541 HTML Hex character encoding mixed case
15542 !! options
15543 parsoid=wt2html,wt2wt,html2html
15544 !! wikitext
15545 &#xEE;&#Xee;
15546 !! html/php
15547 <p>&#xee;&#xee;
15548 </p>
15549 !! html/parsoid
15550 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
15551 !! end
15553 !! test
15554 __FORCETOC__ override
15555 !! wikitext
15556 __NEWSECTIONLINK__
15557 __FORCETOC__
15558 !! html
15559 <p><br />
15560 </p>
15561 !! end
15563 !! test
15564 ISBN code coverage
15565 !! wikitext
15566 ISBN  978-0-1234-56&#x20;789
15567 !! html
15568 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
15569 </p>
15570 !! end
15572 !! test
15573 ISBN followed by 5 spaces
15574 !! wikitext
15575 ISBN    
15576 !! html
15577 <p>ISBN    
15578 </p>
15579 !! end
15581 !! test
15582 Double ISBN
15583 !! wikitext
15584 ISBN ISBN 1234567890
15585 !! html
15586 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
15587 </p>
15588 !! end
15590 !! test
15591 ISBN with an X
15592 !! wikitext
15593 ISBN 3-462-04561-X
15594 !! html
15595 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
15596 </p>
15597 !! end
15599 !! test
15600 ISBN with empty prefix (parsoid test)
15601 !! wikitext
15602 ISBN 1234567890
15603 !! html/parsoid
15604 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
15605 !! end
15607 !! test
15608 Bug 22905: <abbr> followed by ISBN followed by </a>
15609 !! wikitext
15610 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
15611 !! html
15612 <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>
15613 </p>
15614 !! end
15616 !! test
15617 Double RFC
15618 !! wikitext
15619 RFC RFC 1234
15620 !! html
15621 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
15622 </p>
15623 !! end
15625 !! test
15626 Double RFC with a wiki link
15627 !! wikitext
15628 RFC [[RFC 1234]]
15629 !! html
15630 <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>
15631 </p>
15632 !! end
15634 !! test
15635 RFC code coverage
15636 !! wikitext
15637 RFC   983&#x20;987
15638 !! html
15639 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
15640 </p>
15641 !! end
15643 !! test
15644 Centre-aligned image
15645 !! wikitext
15646 [[Image:foobar.jpg|centre]]
15647 !! html
15648 <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>
15650 !!end
15652 !! test
15653 None-aligned image
15654 !! wikitext
15655 [[Image:foobar.jpg|none]]
15656 !! html
15657 <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>
15659 !!end
15661 !! test
15662 Width + Height sized image (using px) (height is ignored)
15663 !! wikitext
15664 [[Image:foobar.jpg|640x480px]]
15665 !! html
15666 <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>
15667 </p>
15668 !!end
15670 !! test
15671 Width-sized image (using px, no following whitespace)
15672 !! wikitext
15673 [[Image:foobar.jpg|640px]]
15674 !! html
15675 <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>
15676 </p>
15677 !!end
15679 !! test
15680 Width-sized image (using px, with following whitespace - test regression from r39467)
15681 !! wikitext
15682 [[Image:foobar.jpg|640px ]]
15683 !! html
15684 <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>
15685 </p>
15686 !!end
15688 !! test
15689 Width-sized image (using px, with preceding whitespace - test regression from r39467)
15690 !! wikitext
15691 [[Image:foobar.jpg| 640px]]
15692 !! html
15693 <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>
15694 </p>
15695 !!end
15697 !! test
15698 Image with page parameter
15699 !! options
15700 djvu
15701 !! wikitext
15702 [[File:LoremIpsum.djvu|page=2]]
15703 !! html
15704 <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>
15705 </p>
15706 !! end
15708 !! test
15709 Another italics / bold test
15710 !! wikitext
15711  ''' ''x'
15712 !! html
15713 <pre>'<i> </i>x'
15714 </pre>
15715 !!end
15717 # Note the results may be incorrect, as parserTest output included this:
15718 # XML error: Mismatched tag at byte 6120:
15719 # ...<dd> </dt></dl> </dd...
15720 !! test
15721 dt/dd/dl test
15722 !! options
15723 disabled
15724 !! wikitext
15725 :;;;::
15726 !! html
15727 <dl>
15728 <dd><dl>
15729 <dt><dl>
15730 <dt><dl>
15731 <dt><dl>
15732 <dd><dl>
15733 <dd>
15734 </dd>
15735 </dl>
15736 </dd>
15737 </dl>
15738 </dt>
15739 </dl>
15740 </dt>
15741 </dl>
15742 </dt>
15743 </dl>
15744 </dd>
15745 </dl>
15747 !!end
15750 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
15751 !! test
15752 Images with the "|" character in the comment
15753 !! wikitext
15754 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
15755 !! html/php
15756 <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>
15758 !! html/parsoid
15759 <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>
15760 !! end
15762 !! test
15763 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
15764 !! wikitext
15765 <html><script>alert(1);</script></html>
15766 !! html
15767 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
15768 </p>
15769 !! end
15771 !! test
15772 HTML with raw HTML ($wgRawHtml==true)
15773 !! options
15774 wgRawHtml=1
15775 !! wikitext
15776 <html><script>alert(1);</script></html>
15777 !! html
15778 <p><script>alert(1);</script>
15779 </p>
15780 !! end
15782 !! test
15783 Parents of subpages, one level up
15784 !! options
15785 subpage title=[[Subpage test/L1/L2/L3]]
15786 !! wikitext
15787 [[../|L2]]
15788 !! html
15789 <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>
15790 </p>
15791 !! end
15794 !! test
15795 Parents of subpages, one level up, not named
15796 !! options
15797 subpage title=[[Subpage test/L1/L2/L3]]
15798 !! wikitext
15799 [[../]]
15800 !! html
15801 <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>
15802 </p>
15803 !! end
15807 !! test
15808 Parents of subpages, two levels up
15809 !! options
15810 subpage title=[[Subpage test/L1/L2/L3]]
15811 !! wikitext
15812 [[../../|L1]]2
15814 [[../../|L1]]l
15815 !! html
15816 <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
15817 </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>
15818 </p>
15819 !! end
15821 !! test
15822 Parents of subpages, two levels up, without trailing slash or name.
15823 !! options
15824 subpage title=[[Subpage test/L1/L2/L3]]
15825 !! wikitext
15826 [[../..]]
15827 !! html
15828 <p>[[../..]]
15829 </p>
15830 !! end
15832 !! test
15833 Parents of subpages, two levels up, with lots of extra trailing slashes.
15834 !! options
15835 subpage title=[[Subpage test/L1/L2/L3]]
15836 !! wikitext
15837 [[../../////]]
15838 !! html
15839 <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>
15840 </p>
15841 !! end
15843 !! article
15844 Subpage test/L1/L2/L3Sibling
15845 !! text
15846 Sibling article
15847 !! endarticle
15849 !! test
15850 Transclusion of a sibling page (one level up)
15851 !! options
15852 subpage title=[[Subpage test/L1/L2/L3]]
15853 !! wikitext
15854 {{../L3Sibling}}
15855 !! html
15856 <p>Sibling article
15857 </p>
15858 !! end
15860 !! test
15861 Transclusion of a child page
15862 !! options
15863 subpage title=[[Subpage test/L1/L2]]
15864 !! wikitext
15865 {{/L3Sibling}}
15866 !! html
15867 <p>Sibling article
15868 </p>
15869 !! end
15871 !! test
15872 Non-transclusion because of too many up levels
15873 !! options
15874 subpage title=[[Subpage test/L1/L2/L3]]
15875 !! wikitext
15876 {{../../../../More than parent}}
15877 !! html
15878 <p>{{../../../../More than parent}}
15879 </p>
15880 !! end
15882 !! test
15883 Definition list code coverage
15884 !! wikitext
15885 ; title   : def
15886 ; title : def
15887 ;title: def
15888 !! html
15889 <dl><dt> title  &#160;</dt>
15890 <dd> def</dd>
15891 <dt> title&#160;</dt>
15892 <dd> def</dd>
15893 <dt>title</dt>
15894 <dd> def</dd></dl>
15896 !! end
15898 !! test
15899 Don't fall for the self-closing div
15900 !! wikitext
15901 <div>hello world</div/>
15902 !! html
15903 <div>hello world</div>
15905 !! end
15907 !! test
15908 MSGNW magic word
15909 !! wikitext
15910 {{MSGNW:msg}}
15911 !! html
15912 <p>&#91;&#91;:Template:Msg&#93;&#93;
15913 </p>
15914 !! end
15916 !! test
15917 RAW magic word
15918 !! wikitext
15919 {{RAW:QUERTY}}
15920 !! html
15921 <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>
15922 </p>
15923 !! end
15925 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
15926 !! test
15927 Always escape literal '>' in output, not just after '<'
15928 !! wikitext
15930 !! html
15931 <p>&gt;&lt;&gt;
15932 </p>
15933 !! end
15935 !! test
15936 Template caching
15937 !! wikitext
15938 {{Test}}
15939 {{Test}}
15940 !! html
15941 <p>This is a test template
15942 This is a test template
15943 </p>
15944 !! end
15947 !! article
15948 MediaWiki:Fake
15949 !! text
15950 ==header==
15951 !! endarticle
15953 !! test
15954 Inclusion of !userCanEdit() content
15955 !! wikitext
15956 {{MediaWiki:Fake}}
15957 !! html
15958 <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>
15960 !! end
15963 !! test
15964 Out-of-order TOC heading levels
15965 !! wikitext
15966 ==2==
15967 ======6======
15968 ===3===
15970 =====5=====
15971 ==2==
15972 !! html
15973 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15974 <ul>
15975 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
15976 <ul>
15977 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
15978 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
15979 </ul>
15980 </li>
15981 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
15982 <ul>
15983 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
15984 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
15985 </ul>
15986 </li>
15987 </ul>
15988 </div>
15990 <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>
15991 <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>
15992 <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>
15993 <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>
15994 <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>
15995 <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>
15997 !! end
16000 !! test
16001 ISBN with a dummy number
16002 !! wikitext
16003 ISBN ---
16004 !! html
16005 <p>ISBN ---
16006 </p>
16007 !! end
16010 !! test
16011 ISBN with space-delimited number
16012 !! wikitext
16013 ISBN 92 9017 032 8
16014 !! html
16015 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
16016 </p>
16017 !! end
16020 !! test
16021 ISBN with multiple spaces, no number
16022 !! wikitext
16023 ISBN  foo
16024 !! html
16025 <p>ISBN  foo
16026 </p>
16027 !! end
16030 !! test
16031 ISBN length
16032 !! wikitext
16033 ISBN 123456789
16035 ISBN 1234567890
16037 ISBN 12345678901
16038 !! html
16039 <p>ISBN 123456789
16040 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16041 </p><p>ISBN 12345678901
16042 </p>
16043 !! end
16046 !! test
16047 ISBN with trailing year (bug 8110)
16048 !! wikitext
16049 ISBN 1-234-56789-0 - 2006
16051 ISBN 1 234 56789 0 - 2006
16052 !! html
16053 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
16054 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
16055 </p>
16056 !! end
16059 !! test
16060 anchorencode
16061 !! wikitext
16062 {{anchorencode:foo bar©#%n}}
16063 !! html
16064 <p>foo_bar.C2.A9.23.25n
16065 </p>
16066 !! end
16068 !! test
16069 anchorencode trims spaces
16070 !! wikitext
16071 {{anchorencode: __pretty__please__}}
16072 !! html
16073 <p>pretty_please
16074 </p>
16075 !! end
16077 !! test
16078 anchorencode deals with links
16079 !! wikitext
16080 {{anchorencode: [[hello|world]] [[hi]]}}
16081 !! html
16082 <p>world_hi
16083 </p>
16084 !! end
16086 !! test
16087 anchorencode deals with templates
16088 !! wikitext
16089 {{anchorencode: {{Foo}} }}
16090 !! html
16091 <p>FOO
16092 </p>
16093 !! end
16095 !! test
16096 anchorencode encodes like the TOC generator: (bug 18431)
16097 !! wikitext
16098 === _ +:.3A%3A&&amp;]] ===
16099 {{anchorencode: _ +:.3A%3A&&amp;]] }}
16100 __NOEDITSECTION__
16101 !! html
16102 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
16103 <p>.2B:.3A.253A.26.26.5D.5D
16104 </p>
16105 !! end
16107 !! test
16108 Bug 6200: blockquotes and paragraph formatting
16109 !! wikitext
16110 <blockquote>
16112 </blockquote>
16116  baz
16117 !! html
16118 <blockquote>
16119 <p>foo
16120 </p>
16121 </blockquote>
16122 <p>bar
16123 </p>
16124 <pre>baz
16125 </pre>
16126 !! end
16128 !! test
16129 Bug 8293: Use of center tag ruins paragraph formatting
16130 !! wikitext
16131 <center>
16133 </center>
16137  baz
16138 !! html
16139 <center>
16140 <p>foo
16141 </p>
16142 </center>
16143 <p>bar
16144 </p>
16145 <pre>baz
16146 </pre>
16147 !! end
16149 !!test
16150 Parsing of overlapping (improperly nested) inline html tags
16151 !! wikitext
16152 <span><s>x</span></s>
16153 !! html/php
16154 <p><span><s>x&lt;/span&gt;</s></span>
16155 </p>
16156 !! html/parsoid
16157 <p><span><s>x</s></span>
16158 </p>
16159 !!end
16162 ### Language variants related tests
16164 !! test
16165 Self-link in language variants
16166 !! options
16167 title=[[Dunav]] language=sr
16168 !! wikitext
16169 Both [[Dunav]] and [[Дунав]] are names for this river.
16170 !! html
16171 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
16172 </p>
16173 !!end
16175 !! article
16176 Дуна
16177 !! text
16178 content
16179 !! endarticle
16181 !! test
16182 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
16183 !! options
16184 title=[[Duna]] language=sr
16185 !! wikitext
16186 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
16187 !! html
16188 <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.
16189 </p>
16190 !! end
16192 !! test
16193 Link to a section of a variant of this title shouldn't be parsed as self-link
16194 !! options
16195 title=[[Duna]] language=sr
16196 !! wikitext
16197 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
16198 !! html
16199 <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.
16200 </p>
16201 !! end
16203 !! test
16204 Link to pages in language variants
16205 !! options
16206 language=sr
16207 !! wikitext
16208 Main Page can be written as [[Маин Паге]]
16209 !! html
16210 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
16211 </p>
16212 !!end
16215 !! test
16216 Multiple links to pages in language variants
16217 !! options
16218 language=sr
16219 !! wikitext
16220 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
16221 !! html
16222 <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>.
16223 </p>
16224 !!end
16227 !! test
16228 Simple template in language variants
16229 !! options
16230 language=sr
16231 !! wikitext
16232 {{тест}}
16233 !! html
16234 <p>This is a test template
16235 </p>
16236 !! end
16239 !! test
16240 Template with explicit namespace in language variants
16241 !! options
16242 language=sr
16243 !! wikitext
16244 {{Template:тест}}
16245 !! html
16246 <p>This is a test template
16247 </p>
16248 !! end
16251 !! test
16252 Basic test for template parameter in language variants
16253 !! options
16254 language=sr
16255 !! wikitext
16256 {{парамтест|param=foo}}
16257 !! html
16258 <p>This is a test template with parameter foo
16259 </p>
16260 !! end
16263 !! test
16264 Simple category in language variants
16265 !! options
16266 language=sr cat
16267 !! wikitext
16268 [[Category:МедиаWики Усер'с Гуиде]]
16269 !! html
16270 <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>
16271 !! end
16274 !! article
16275 Category:分类
16276 !! text
16277 blah
16278 !! endarticle
16280 !! article
16281 Category:分類
16282 !! text
16283 blah
16284 !! endarticle
16286 !! test
16287 Don't convert blue categorylinks to another variant (bug 33210)
16288 !! options
16289 language=zh cat
16290 !! wikitext
16291 [[A]][[Category:分类]]
16292 !! html
16293 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
16294 !! end
16297 !! test
16298 Stripping -{}- tags (language variants)
16299 !! options
16300 language=sr
16301 !! wikitext
16302 Latin proverb: -{Ne nuntium necare}-
16303 !! html
16304 <p>Latin proverb: Ne nuntium necare
16305 </p>
16306 !! end
16309 !! test
16310 Prevent conversion with -{}- tags (language variants)
16311 !! options
16312 language=sr variant=sr-ec
16313 !! wikitext
16314 Latinski: -{Ne nuntium necare}-
16315 !! html
16316 <p>Латински: Ne nuntium necare
16317 </p>
16318 !! end
16321 !! test
16322 Prevent conversion of text with -{}- tags (language variants)
16323 !! options
16324 language=sr variant=sr-ec
16325 !! wikitext
16326 Latinski: -{Ne nuntium necare}-
16327 !! html
16328 <p>Латински: Ne nuntium necare
16329 </p>
16330 !! end
16333 !! test
16334 Prevent conversion of links with -{}- tags (language variants)
16335 !! options
16336 language=sr variant=sr-ec
16337 !! wikitext
16338 -{[[Main Page]]}-
16339 !! html
16340 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16341 </p>
16342 !! end
16345 !! test
16346 -{}- tags within headlines (within html for parserConvert())
16347 !! options
16348 language=sr variant=sr-ec
16349 !! wikitext
16350 == -{Naslov}- ==
16351 !! html
16352 <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>
16354 !! end
16357 !! test
16358 Explicit definition of language variant alternatives
16359 !! options
16360 language=zh variant=zh-tw
16361 !! wikitext
16362 -{zh:China;zh-tw:Taiwan}-, not China
16363 !! html
16364 <p>Taiwan, not China
16365 </p>
16366 !! end
16369 !! test
16370 Conversion around HTML tags
16371 !! options
16372 language=sr variant=sr-ec
16373 !! wikitext
16374 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
16375 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
16376 !! html
16378 <span title="ЛаCтин">ски</span>
16379 </p>
16380 !! end
16383 !! test
16384 Explicit session-wise language variant mapping (A flag and - flag)
16385 !! options
16386 language=zh variant=zh-tw
16387 !! wikitext
16388 Taiwan is not China.
16389 But -{A|zh:China;zh-tw:Taiwan}- is China,
16390 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
16391 and -{China}- is China.
16392 !! html
16393 <p>Taiwan is not China.
16394 But Taiwan is Taiwan,
16395 (This should be stripped!)
16396 and China is China.
16397 </p>
16398 !! end
16400 !! test
16401 Explicit session-wise language variant mapping (H flag for hide)
16402 !! options
16403 language=zh variant=zh-tw
16404 !! wikitext
16405 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
16406 Taiwan is China.
16407 !! html
16408 <p>(This should be stripped!)
16409 Taiwan is Taiwan.
16410 </p>
16411 !! end
16413 !! test
16414 Adding explicit conversion rule for title (T flag)
16415 !! options
16416 language=zh variant=zh-tw showtitle
16417 !! wikitext
16418 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16419 !! html
16420 Taiwan
16421 <p>Should be stripped!
16422 </p>
16423 !! end
16425 !! test
16426 Testing that changing the language variant here in the tests actually works
16427 !! options
16428 language=zh variant=zh showtitle
16429 !! wikitext
16430 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16431 !! html
16432 China
16433 <p>Should be stripped!
16434 </p>
16435 !! end
16437 !! test
16438 Recursive conversion of alt and title attrs shouldn't clear converter state
16439 !! options
16440 language=zh variant=zh-cn showtitle
16441 !! wikitext
16442 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
16443 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
16444 !! html
16445 China
16447 Should be stripped<span title="Exclamation">!</span>
16448 </p>
16449 !! end
16451 !! test
16452 Bug 24072: more test on conversion rule for title
16453 !! options
16454 language=zh variant=zh-tw showtitle
16455 !! wikitext
16456 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
16457 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
16458 !! html
16459 Taiwan
16460 <p>This should be stripped!
16461 This won't take interferes with the title rule.
16462 </p>
16463 !! end
16465 !! test
16466 Partly disable title conversion if variant == main language code
16467 !! options
16468 language=zh variant=zh title=[[ZH]] showtitle
16469 !! wikitext
16470 -{T|zh-cn:CN;zh-tw:TW}-
16471 !! html
16474 </p>
16475 !! end
16477 !! test
16478 Partly disable title conversion if variant == main language code, more
16479 !! options
16480 language=zh variant=zh title=[[ZH]] showtitle
16481 !! wikitext
16482 -{T|TW}-
16483 !! html
16486 </p>
16487 !! end
16489 !! test
16490 Raw output of variant escape tags (R flag)
16491 !! options
16492 language=zh variant=zh-tw
16493 !! wikitext
16494 Raw: -{R|zh:China;zh-tw:Taiwan}-
16495 !! html
16496 <p>Raw: zh:China;zh-tw:Taiwan
16497 </p>
16498 !! end
16500 !! test
16501 Nested using of manual convert syntax
16502 !! options
16503 language=zh variant=zh-hk
16504 !! wikitext
16505 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
16506 !! html
16507 <p>Nested: Hello Hong Kong!
16508 </p>
16509 !! end
16511 !! test
16512 Proper conversion of text in external links
16513 !! options
16514 language=sr variant=sr-ec
16515 !! wikitext
16516 http://www.google.com
16517 gopher://www.google.com
16518 [http://www.google.com http://www.google.com]
16519 [gopher://www.google.com gopher://www.google.com]
16520 [https://www.google.com irc://www.google.com]
16521 [ftp://www.google.com www.google.com/ftp://dir]
16522 [//www.google.com www.google.com]
16523 !! html
16524 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16525 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16526 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
16527 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
16528 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
16529 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
16530 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
16531 </p>
16532 !! end
16534 !! test
16535 Do not convert roman numbers to language variants
16536 !! options
16537 language=sr variant=sr-ec
16538 !! wikitext
16539 Fridrih IV je car.
16540 !! html
16541 <p>Фридрих IV је цар.
16542 </p>
16543 !! end
16545 !! test
16546 Unclosed language converter markup "-{"
16547 !! options
16548 language=sr
16549 !! wikitext
16550 -{T|hello
16551 !! html
16552 <p>-{T|hello
16553 </p>
16554 !! end
16556 !! test
16557 Don't convert raw rule "-{R|=&gt;}-" to "=>"
16558 !! options
16559 language=sr
16560 !! wikitext
16561 -{R|=&gt;}-
16562 !! html
16563 <p>=&gt;
16564 </p>
16565 !!end
16567 !! test
16568 Don't break link parsing if language converter markup is in the caption.
16569 !! options
16570 language=sr variant=sr-ec
16571 !! wikitext
16572 [[Main Page|-{R|main page}-]]
16573 !! html
16574 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
16575 </p>
16576 !! end
16578 # This test is currently broken in the PHP parser (bug 52661)
16579 !! test
16580 Don't break image parsing if language converter markup is in the caption.
16581 !! options
16582 language=sr
16583 disabled
16584 !! wikitext
16585 [[File:Foobar.jpg|-{R|caption}-]]
16586 !! html
16587 <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>
16588 </p>
16589 !! end
16591 # This test is currently broken in the PHP parser (bug 52661)
16592 !! test
16593 Don't break list handling if language converter markup is in the item.
16594 !! options
16595 language=zh variant=zh-cn
16596 disabled
16597 !! wikitext
16598 ;-{zh-cn:AAA;zh-tw:BBB}-
16599 !! html
16600 <dl><dt>AAA
16601 </dt></dl>
16603 !! end
16605 # This test is currently broken in the PHP parser (bug 52661)
16606 !! test
16607 Don't break table handling if language converter markup is in the cell.
16608 !! options
16609 language=sr variant=sr-ec
16610 disabled
16611 !! wikitext
16614 | -{R|B}-
16616 !! html
16617 <table>
16619 <tr>
16620 <td> B
16621 </td></tr></table>
16623 !! end
16625 !! test
16626 Bug 529: Uncovered bullet
16627 !! wikitext
16628 * Foo {{bullet}}
16629 !! html
16630 <ul><li> Foo </li>
16631 <li> Bar</li></ul>
16633 !! end
16635 # Plain MediaWiki does not remove empty lists, but tidy actually does.
16636 # Templates in Wikipedia rely on this behavior, as tidy has always been
16637 # enabled there. These tests are normally run *without* tidy, so specify the
16638 # full output here. 
16639 # To test realistic parsing behavior, apply a tidy-like transformation to both
16640 # the expected output and your parser's output.
16641 !! test
16642 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
16643 !! wikitext
16644 ******* Foo {{bullet}}
16645 !! html
16646 <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>
16647 <li> Bar</li></ul>
16649 !! end
16651 !! test
16652 Bug 529: Uncovered table already at line-start
16653 !! wikitext
16656 {{table}}
16658 !! html
16659 <p>x
16660 </p>
16661 <table>
16662 <tr>
16663 <td> 1 </td>
16664 <td> 2
16665 </td></tr>
16666 <tr>
16667 <td> 3 </td>
16668 <td> 4
16669 </td></tr></table>
16670 <p>y
16671 </p>
16672 !! end
16674 !! test
16675 Bug 529: Uncovered bullet in parser function result
16676 !! wikitext
16677 * Foo {{lc:{{bullet}} }}
16678 !! html
16679 <ul><li> Foo </li>
16680 <li> bar</li></ul>
16682 !! end
16684 !! test
16685 Bug 5678: Double-parsed template argument
16686 !! wikitext
16687 {{lc:{{{1}}}|hello}}
16688 !! html
16689 <p>{{{1}}}
16690 </p>
16691 !! end
16693 !! test
16694 Bug 5678: Double-parsed template invocation
16695 !! wikitext
16696 {{lc:{{paramtest {{!}} param = hello }} }}
16697 !! html
16698 <p>{{paramtest | param = hello }}
16699 </p>
16700 !! end
16702 !! test
16703 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
16704 !! options
16705 language=cs
16706 title=[[Main Page]]
16707 !! wikitext
16708 {{PRVNÍVELKÉ:ěščř}}
16709 {{prvnívelké:ěščř}}
16710 {{PRVNÍMALÉ:ěščř}}
16711 {{prvnímalé:ěščř}}
16712 {{MALÁ:ěščř}}
16713 {{malá:ěščř}}
16714 {{VELKÁ:ěščř}}
16715 {{velká:ěščř}}
16716 !! html
16717 <p>Ěščř
16718 Ěščř
16719 ěščř
16720 ěščř
16721 ěščř
16722 ěščř
16723 ĚŠČŘ
16724 ĚŠČŘ
16725 </p>
16726 !! end
16728 !! test
16729 Morwen/13: Unclosed link followed by heading
16730 !! wikitext
16731 [[link
16732 ==heading==
16733 !! html
16734 <p>[[link
16735 </p>
16736 <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>
16738 !! end
16740 !! test
16741 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
16742 !! wikitext
16743 {{foo|
16744 =heading=
16745 !! html
16746 <p>{{foo|
16747 </p>
16748 <h1><span class="mw-headline" id="heading">heading</span></h1>
16750 !! end
16752 !! test
16753 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
16754 !! wikitext
16755 {{foo|
16756 ==heading==
16757 !! html
16758 <p>{{foo|
16759 </p>
16760 <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>
16762 !! end
16764 !! test
16765 Tildes in comments
16766 !! options
16768 !! wikitext
16769 <!-- ~~~~ -->
16770 !! html
16771 <!-- ~~~~ -->
16772 !! end
16774 !! test
16775 Paragraphs inside divs (no extra line breaks)
16776 !! wikitext
16777 <div>Line one
16779 Line two</div>
16780 !! html
16781 <div>Line one
16782 Line two</div>
16784 !! end
16786 !! test
16787 Paragraphs inside divs (extra line break on open)
16788 !! wikitext
16789 <div>
16790 Line one
16792 Line two</div>
16793 !! html
16794 <div>
16795 <p>Line one
16796 </p>
16797 Line two</div>
16799 !! end
16801 !! test
16802 Paragraphs inside divs (extra line break on close)
16803 !! wikitext
16804 <div>Line one
16806 Line two
16807 </div>
16808 !! html
16809 <div>Line one
16810 <p>Line two
16811 </p>
16812 </div>
16814 !! end
16816 !! test
16817 Paragraphs inside divs (extra line break on open and close)
16818 !! wikitext
16819 <div>
16820 Line one
16822 Line two
16823 </div>
16824 !! html
16825 <div>
16826 <p>Line one
16827 </p><p>Line two
16828 </p>
16829 </div>
16831 !! end
16833 !! test
16834 Nesting tags, paragraphs on lines which begin with <div>
16835 !! options
16836 disabled
16837 !! wikitext
16838 <div></div><strong>A
16839 B</strong>
16840 !! html
16841 <div></div>
16842 <p><strong>A
16843 B</strong>
16844 </p>
16845 !! end
16847 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
16848 !! test
16849 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
16850 !! wikitext
16851 <blockquote>Line one
16853 Line two</blockquote>
16854 !! html
16855 <blockquote>Line one
16856 Line two</blockquote>
16858 !! end
16860 !! test
16861 Bug 6200: paragraphs inside blockquotes (extra line break on open)
16862 !! wikitext
16863 <blockquote>
16864 Line one
16866 Line two</blockquote>
16867 !! html
16868 <blockquote>
16869 <p>Line one
16870 </p>
16871 Line two</blockquote>
16873 !! end
16875 !! test
16876 Bug 6200: paragraphs inside blockquotes (extra line break on close)
16877 !! wikitext
16878 <blockquote>Line one
16880 Line two
16881 </blockquote>
16882 !! html
16883 <blockquote>Line one
16884 <p>Line two
16885 </p>
16886 </blockquote>
16888 !! end
16890 !! test
16891 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
16892 !! wikitext
16893 <blockquote>
16894 Line one
16896 Line two
16897 </blockquote>
16898 !! html
16899 <blockquote>
16900 <p>Line one
16901 </p><p>Line two
16902 </p>
16903 </blockquote>
16905 !! end
16907 !! test
16908 Paragraphs inside blockquotes/divs (no extra line breaks)
16909 !! wikitext
16910 <blockquote><div>Line one
16912 Line two</div></blockquote>
16913 !! html
16914 <blockquote><div>Line one
16915 Line two</div></blockquote>
16917 !! end
16919 !! test
16920 Paragraphs inside blockquotes/divs (extra line break on open)
16921 !! wikitext
16922 <blockquote><div>
16923 Line one
16925 Line two</div></blockquote>
16926 !! html
16927 <blockquote><div>
16928 <p>Line one
16929 </p>
16930 Line two</div></blockquote>
16932 !! end
16934 !! test
16935 Paragraphs inside blockquotes/divs (extra line break on close)
16936 !! wikitext
16937 <blockquote><div>Line one
16939 Line two
16940 </div></blockquote>
16941 !! html
16942 <blockquote><div>Line one
16943 <p>Line two
16944 </p>
16945 </div></blockquote>
16947 !! end
16949 !! test
16950 Paragraphs inside blockquotes/divs (extra line break on open and close)
16951 !! wikitext
16952 <blockquote><div>
16953 Line one
16955 Line two
16956 </div></blockquote>
16957 !! html
16958 <blockquote><div>
16959 <p>Line one
16960 </p><p>Line two
16961 </p>
16962 </div></blockquote>
16964 !! end
16966 !! test
16967 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
16968 !! options
16969 wgLinkHolderBatchSize=0
16970 !! wikitext
16971 [[meatball:1]]
16972 [[meatball:2]]
16973 [[meatball:3]]
16974 !! html
16975 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
16976 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
16977 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
16978 </p>
16979 !! end
16981 !! test
16982 Free external link invading image caption
16983 !! wikitext
16984 [[Image:Foobar.jpg|thumb|http://x|hello]]
16985 !! html
16986 <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>
16988 !! end
16990 !! test
16991 Bug 15196: localised external link numbers
16992 !! options
16993 language=fa
16994 !! wikitext
16995 [http://en.wikipedia.org/]
16996 !! html/php
16997 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
16998 </p>
16999 !! html/parsoid
17000 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
17001 !! end
17003 !! test
17004 Multibyte character in padleft
17005 !! wikitext
17006 {{padleft:-Hello|7|Æ}}
17007 !! html
17008 <p>Æ-Hello
17009 </p>
17010 !! end
17012 !! test
17013 Multibyte character in padright
17014 !! wikitext
17015 {{padright:Hello-|7|Æ}}
17016 !! html
17017 <p>Hello-Æ
17018 </p>
17019 !! end
17021 !!test
17022 formatdate parser function
17023 !! wikitext
17024 {{#formatdate:2009-03-24}}
17025 !! html
17026 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
17027 </p>
17028 !! end
17030 !!test
17031 formatdate parser function, with default format
17032 !! wikitext
17033 {{#formatdate:2009-03-24|mdy}}
17034 !! html
17035 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
17036 </p>
17037 !! end
17039 !! test
17040 Spacing of numbers in formatted dates
17041 !! wikitext
17042 {{#formatdate:January 15}}
17043 !! html
17044 <p><span class="mw-formatted-date" title="01-15">January 15</span>
17045 </p>
17046 !! end
17048 !! test
17049 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
17050 !! options
17051 language=nl title=[[MediaWiki:Common.css]]
17052 !! wikitext
17053 {{#formatdate:2009-03-24|dmy}}
17054 !! html
17055 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
17056 </p>
17057 !! end
17064 # Edit comments
17067 !! test
17068 Edit comment with link
17069 !! options
17070 comment
17071 !! wikitext
17072 I like the [[Main Page]] a lot
17073 !! html
17074 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
17075 !!end
17077 !! test
17078 Edit comment with link and link text
17079 !! options
17080 comment
17081 !! wikitext
17082 I like the [[Main Page|best pages]] a lot
17083 !! html
17084 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17085 !!end
17087 !! test
17088 Edit comment with link and link text with suffix
17089 !! options
17090 comment
17091 !! wikitext
17092 I like the [[Main Page|best page]]s a lot
17093 !! html
17094 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
17095 !!end
17097 !! test
17098 Edit comment with section link (non-local, eg in history list)
17099 !! options
17100 comment title=[[Main Page]]
17101 !! wikitext
17102 /* External links */ removed bogus entries
17103 !! html
17104 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17105 !!end
17107 !! test
17108 Edit comment with section link and text before it (non-local, eg in history list)
17109 !! options
17110 comment title=[[Main Page]]
17111 !! wikitext
17112 pre-comment text /* External links */ removed bogus entries
17113 !! html
17114 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>
17115 !!end
17117 !! test
17118 Edit comment with section link (local, eg in diff view)
17119 !! options
17120 comment local title=[[Main Page]]
17121 !! wikitext
17122 /* External links */ removed bogus entries
17123 !! html
17124 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
17125 !!end
17127 !! test
17128 Edit comment with subpage link (bug 14080)
17129 !! options
17130 comment
17131 subpage
17132 title=[[Subpage test]]
17133 !! wikitext
17134 Poked at a [[/subpage]] here...
17135 !! html
17136 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
17137 !!end
17139 !! test
17140 Edit comment with subpage link and link text (bug 14080)
17141 !! options
17142 comment
17143 subpage
17144 title=[[Subpage test]]
17145 !! wikitext
17146 Poked at a [[/subpage|neat little page]] here...
17147 !! html
17148 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
17149 !!end
17151 !! test
17152 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
17153 !! options
17154 comment
17155 title=[[Subpage test]]
17156 !! wikitext
17157 Poked at a [[/subpage]] here...
17158 !! html
17159 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...
17160 !!end
17162 !! test
17163 Edit comment with bare anchor link (local, as on diff)
17164 !! options
17165 comment
17166 local
17167 title=[[Main Page]]
17168 !! wikitext
17169 [[#section]]
17170 !! html
17171 <a href="#section">#section</a>
17172 !! end
17174 !! test
17175 Edit comment with bare anchor link (non-local, as on history)
17176 !! options
17177 comment
17178 title=[[Main Page]]
17179 !! wikitext
17180 [[#section]]
17181 !! html
17182 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
17183 !! end
17185 !! test
17186 Anchor starting with underscore
17187 !! wikitext
17188 [[#_ref|One]]
17189 !! html
17190 <p><a href="#_ref">One</a>
17191 </p>
17192 !! end
17194 !! test
17195 Id starting with underscore
17196 !! wikitext
17197 <div id="_ref"></div>
17198 !! html
17199 <div id="_ref"></div>
17201 !! end
17203 !! test
17204 Space normalisation on autocomment (bug 22784)
17205 !! options
17206 comment
17207 title=[[Main Page]]
17208 !! wikitext
17209 /* __hello__world__ */
17210 !! html
17211 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
17212 !! end
17214 !! test
17215 percent-encoding and + signs in comments (Bug 26410)
17216 !! options
17217 comment
17218 !! wikitext
17219 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
17220 !! html
17221 <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>
17222 !! end
17224 !! test
17225 Bad images - basic functionality
17226 !! options
17227 disabled
17228 !! wikitext
17229 [[File:Bad.jpg]]
17230 !! html
17231 !! end
17233 !! test
17234 Bad images - bug 16039: text after bad image disappears
17235 !! options
17236 disabled
17237 !! wikitext
17238 Foo bar
17239 [[File:Bad.jpg]]
17240 Bar foo
17241 !! html
17242 <p>Foo bar
17243 </p><p>Bar foo
17244 </p>
17245 !! end
17247 !! test
17248 Verify that displaytitle works (bug #22501) no displaytitle
17249 !! options
17250 showtitle
17251 !! config
17252 wgAllowDisplayTitle=true
17253 wgRestrictDisplayTitle=false
17254 !! wikitext
17255 this is not the the title
17256 !! html
17257 Parser test
17258 <p>this is not the the title
17259 </p>
17260 !! end
17262 !! test
17263 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
17264 !! options
17265 showtitle
17266 title=[[Screen]]
17267 !! config
17268 wgAllowDisplayTitle=true
17269 wgRestrictDisplayTitle=false
17270 !! wikitext
17271 this is not the the title
17272 {{DISPLAYTITLE:whatever}}
17273 !! html
17274 whatever
17275 <p>this is not the the title
17276 </p>
17277 !! end
17279 !! test
17280 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
17281 !! options
17282 showtitle
17283 title=[[Screen]]
17284 !! config
17285 wgAllowDisplayTitle=true
17286 wgRestrictDisplayTitle=true
17287 !! wikitext
17288 this is not the the title
17289 {{DISPLAYTITLE:whatever}}
17290 !! html
17291 Screen
17292 <p>this is not the the title
17293 </p>
17294 !! end
17296 !! test
17297 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
17298 !! options
17299 showtitle
17300 title=[[Screen]]
17301 !! config
17302 wgAllowDisplayTitle=true
17303 wgRestrictDisplayTitle=true
17304 !! wikitext
17305 this is not the the title
17306 {{DISPLAYTITLE:screen}}
17307 !! html
17308 screen
17309 <p>this is not the the title
17310 </p>
17311 !! end
17313 !! test
17314 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
17315 !! options
17316 showtitle
17317 title=[[Screen]]
17318 !! config
17319 wgAllowDisplayTitle=false
17320 !! wikitext
17321 this is not the the title
17322 {{DISPLAYTITLE:screen}}
17323 !! html
17324 Screen
17325 <p>this is not the the title
17326 <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>
17327 </p>
17328 !! end
17330 !! test
17331 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
17332 !! options
17333 showtitle
17334 title=[[Screen]]
17335 !! config
17336 wgAllowDisplayTitle=false
17337 !! wikitext
17338 this is not the the title
17339 !! html
17340 Screen
17341 <p>this is not the the title
17342 </p>
17343 !! end
17345 !! test
17346 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
17347 !! options
17348 showtitle
17349 title=[[Screen]]
17350 !! config
17351 wgAllowDisplayTitle=true
17352 wgRestrictDisplayTitle=true
17353 !! wikitext
17354 this is not the the title
17355 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
17356 !! html
17357 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
17358 <p>this is not the the title
17359 </p>
17360 !! end
17362 !! test
17363 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
17364 !! options
17365 showtitle
17366 title=[[Screen]]
17367 !! config
17368 wgAllowDisplayTitle=true
17369 wgRestrictDisplayTitle=true
17370 !! wikitext
17371 this is not the the title
17372 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
17373 !! html
17374 <span style="color: red;">s</span>creen
17375 <p>this is not the the title
17376 </p>
17377 !! end
17379 !! test
17380 preload: check <noinclude> and <includeonly>
17381 !! options
17382 preload
17383 !! wikitext
17384 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
17385 !! html
17386 Hello kind world.
17387 !! end
17389 !! test
17390 preload: check <onlyinclude>
17391 !! options
17392 preload
17393 !! wikitext
17394 Goodbye <onlyinclude>Hello world</onlyinclude>
17395 !! html
17396 Hello world
17397 !! end
17399 !! test
17400 preload: can pass tags through if we want to
17401 !! options
17402 preload
17403 !! wikitext
17404 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
17405 !! html
17406 <includeonly>Hello world</includeonly>
17407 !! end
17409 !! test
17410 preload: check that it doesn't try to do tricks
17411 !! options
17412 preload
17413 !! wikitext
17414 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17415 !! html
17416 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
17417 !! end
17419 !! test
17420 Play a bit with r67090 and bug 3158
17421 !! options
17422 disabled
17423 !! wikitext
17424 <div style="width:50% !important">&nbsp;</div>
17425 <div style="width:50%&nbsp;!important">&nbsp;</div>
17426 <div style="width:50%&#160;!important">&nbsp;</div>
17427 <div style="border : solid;">&nbsp;</div>
17428 !! html
17429 <div style="width:50% !important">&nbsp;</div>
17430 <div style="width:50% !important">&nbsp;</div>
17431 <div style="width:50% !important">&nbsp;</div>
17432 <div style="border&#160;: solid;">&nbsp;</div>
17434 !! end
17436 !! test
17437 HTML5 data attributes
17438 !! wikitext
17439 <span data-foo="bar">Baz</span>
17440 <p data-abc-def_hij="">Quuz</p>
17441 !! html
17442 <p><span data-foo="bar">Baz</span>
17443 </p>
17444 <p data-abc-def_hij="">Quuz</p>
17446 !! end
17448 !! test
17449 percent-encoding and + signs in internal links (Bug 26410)
17450 !! wikitext
17451 [[User:+%]] [[Page+title%]]
17452 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
17453 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
17454 [[%33%45]] [[%33%45+]]
17455 !! html
17456 <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>
17457 <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>
17458 <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>
17459 <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>
17460 </p>
17461 !! end
17463 !! test
17464 Special characters in embedded file links (bug 27679)
17465 !! wikitext
17466 [[File:Contains & ampersand.jpg]]
17467 [[File:Does not exist.jpg|Title with & ampersand]]
17468 !! html
17469 <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>
17470 <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>
17471 </p>
17472 !! end
17475 !! test
17476 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
17477 !! wikitext
17478 Text&apos;s been normalized?
17479 !! html
17480 <p>Text&#39;s been normalized?
17481 </p>
17482 !! end
17484 !! test
17485 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
17486 !! wikitext
17487 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
17488 !! html
17489 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
17490 </p>
17491 !! end
17493 !! test
17494 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
17495 !! wikitext
17496 [http://www.example.org/ ideograms]
17497 !! html
17498 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
17499 </p>
17500 !! end
17502 !! test
17503 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
17504 !! wikitext
17505 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
17506 !! html
17507 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
17508 </p>
17509 !! end
17511 !! article
17512 Mediawiki:loop1
17513 !! text
17514 {{Identical|A}}
17515 !! endarticle
17517 !! article
17518 Mediawiki:loop2
17519 !! text
17520 {{Identical|B}}
17521 !! endarticle
17523 !! article
17524 Template:Identical
17525 !! text
17526 {{int:loop1}}
17527 {{int:loop2}}
17528 !! endarticle
17530 !! test
17531 Bug 31098 Template which includes system messages which includes the template
17532 !! wikitext
17533 {{Identical}}
17534 !! html
17535 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17536 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
17537 </p>
17538 !! end
17540 !! test
17541 Bug31490 Turkish: ucfirst 'blah'
17542 !! options
17543 language=tr
17544 !! wikitext
17545 {{ucfirst:blah}}
17546 !! html
17547 <p>Blah
17548 </p>
17549 !! end
17551 !! test
17552 Bug31490 Turkish: ucfirst 'ix'
17553 !! options
17554 language=tr
17555 !! wikitext
17556 {{ucfirst:ix}}
17557 !! html
17558 <p>İx
17559 </p>
17560 !! end
17562 !! test
17563 Bug31490 Turkish: lcfirst 'BLAH'
17564 !! options
17565 language=tr
17566 !! wikitext
17567 {{lcfirst:BLAH}}
17568 !! html
17569 <p>bLAH
17570 </p>
17571 !! end
17573 !! test
17574 Bug31490 Turkish: ucfırst (with a dotless i)
17575 !! options
17576 language=tr
17577 !! wikitext
17578 {{ucfırst:blah}}
17579 !! html
17580 <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>
17581 </p>
17582 !! end
17584 !! test
17585 Bug31490 ucfırst (with a dotless i) with English language
17586 !! options
17587 language=en
17588 !! wikitext
17589 {{ucfırst:blah}}
17590 !! html
17591 <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>
17592 </p>
17593 !! end
17595 !! test
17596 Bug 26375: TOC with italics
17597 !! options
17598 title=[[Main Page]]
17599 !! wikitext
17600 __TOC__
17601 == ''Lost'' episodes ==
17602 !! html
17603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17604 <ul>
17605 <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>
17606 </ul>
17607 </div>
17609 <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>
17611 !! end
17613 !! test
17614 Bug 26375: TOC with bold
17615 !! options
17616 title=[[Main Page]]
17617 !! wikitext
17618 __TOC__
17619 == '''should be bold''' then normal text ==
17620 !! html
17621 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17622 <ul>
17623 <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>
17624 </ul>
17625 </div>
17627 <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>
17629 !! end
17631 !! test
17632 Bug 33845: Headings become cursive in TOC when they contain an image
17633 !! options
17634 title=[[Main Page]]
17635 !! wikitext
17636 __TOC__
17637 == Image [[Image:foobar.jpg]] ==
17638 !! html
17639 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17640 <ul>
17641 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
17642 </ul>
17643 </div>
17645 <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>
17647 !! end
17649 !! test
17650 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
17651 !! options
17652 title=[[Main Page]]
17653 !! wikitext
17654 __TOC__
17655 == <blockquote>Quote</blockquote> ==
17656 !! html
17657 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17658 <ul>
17659 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
17660 </ul>
17661 </div>
17663 <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>
17665 !! end
17667 !! test
17668 Unclosed tags in TOC
17669 !! options
17670 title=[[Main Page]]
17671 !! wikitext
17672 __TOC__
17673 == Proof: 2 < 3 ==
17674 <small>Hanc marginis exiguitas non caperet.</small>
17676 !! html
17677 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17678 <ul>
17679 <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>
17680 </ul>
17681 </div>
17683 <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>
17684 <p><small>Hanc marginis exiguitas non caperet.</small>
17686 </p>
17687 !! end
17689 !! test
17690 Multiple tags in TOC
17691 !! wikitext
17692 __TOC__
17693 == <i>Foo</i> <b>Bar</b> ==
17695 == <i>Foo</i> <blockquote>Bar</blockquote> ==
17696 !! html
17697 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17698 <ul>
17699 <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>
17700 <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>
17701 </ul>
17702 </div>
17704 <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>
17705 <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>
17707 !! end
17709 !! test
17710 Tags with parameters in TOC
17711 !! wikitext
17712 __TOC__
17713 == <sup class="in-h2">Hello</sup> ==
17715 == <sup class="a > b">Evilbye</sup> ==
17716 !! html
17717 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17718 <ul>
17719 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
17720 <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>
17721 </ul>
17722 </div>
17724 <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>
17725 <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>
17727 !! end
17729 !! test
17730 span tags with directionality in TOC
17731 !! wikitext
17732 __TOC__
17733 == <span dir="ltr">C++</span> ==
17735 == <span dir="rtl">זבנג!</span> ==
17737 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
17739 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
17741 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
17742 !! html
17743 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17744 <ul>
17745 <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>
17746 <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>
17747 <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>
17748 <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>
17749 <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>
17750 </ul>
17751 </div>
17753 <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>
17754 <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>
17755 <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>
17756 <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>
17757 <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>
17759 !! end
17761 !! article
17762 MediaWiki:Bug32057
17763 !! text
17764 == {{int:headline_sample}} ==
17765 !! endarticle
17767 !! test
17768 Bug 32057: Title needed when expanding <h> nodes.
17769 !! options
17770 title=[[Main Page]]
17771 !! wikitext
17772 {{int:Bug32057}}
17773 !! html
17774 <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>
17776 !! end
17778 !! test
17779 Strip marker in urlencode
17780 !! wikitext
17781 {{urlencode:x<nowiki/>y}}
17782 {{urlencode:x<nowiki/>y|wiki}}
17783 {{urlencode:x<nowiki/>y|path}}
17784 !! html
17785 <p>xy
17788 </p>
17789 !! end
17791 !! test
17792 Strip marker in lc
17793 !! wikitext
17794 {{lc:x<nowiki/>y}}
17795 !! html
17796 <p>xy
17797 </p>
17798 !! end
17800 !! test
17801 Strip marker in uc
17802 !! wikitext
17803 {{uc:x<nowiki/>y}}
17804 !! html
17805 <p>XY
17806 </p>
17807 !! end
17809 !! test
17810 Strip marker in formatNum
17811 !! wikitext
17812 {{formatnum:1<nowiki/>2}}
17813 {{formatnum:1<nowiki/>2|R}}
17814 !! html
17815 <p>12
17817 </p>
17818 !! end
17820 !! test
17821 Check noCommafy in formatNum
17822 !! options
17823 language=be-tarask
17824 !! wikitext
17825 {{formatnum:123456.78}}
17826 {{formatnum:123456.78|NOSEP}}
17827 !! html
17828 <p>123 456,78
17829 123456.78
17830 </p>
17831 !! end
17833 !! test
17834 Wrong option for formatNum (bug 56199)
17835 !! wikitext
17836 {{formatnum:1,234.56|Random}}
17837 {{formatnum:1,234.56|EVERYTHING}}
17838 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
17839 !! html
17840 <p>1,234.56
17841 1,234.56
17842 1,234.56
17843 </p>
17844 !! end
17846 !! test
17847 Strip marker in grammar
17848 !! options
17849 language=fi
17850 !! wikitext
17851 {{grammar:elative|foo<nowiki/>bar}}
17852 !! html
17853 <p>foobarista
17854 </p>
17855 !! end
17857 !! test
17858 Strip marker in padleft
17859 !! wikitext
17860 {{padleft:|2|x<nowiki/>y}}
17861 !! html
17862 <p>xy
17863 </p>
17864 !! end
17866 !! test
17867 Strip marker in padright
17868 !! wikitext
17869 {{padright:|2|x<nowiki/>y}}
17870 !! html
17871 <p>xy
17872 </p>
17873 !! end
17875 !! test
17876 Strip marker in anchorencode
17877 !! wikitext
17878 {{anchorencode:x<nowiki/>y}}
17879 !! html
17880 <p>xy
17881 </p>
17882 !! end
17884 !! test
17885 nowiki inside link inside heading (bug 18295)
17886 !! wikitext
17887 ==[[foo|x<nowiki>y</nowiki>z]]==
17888 !! html
17889 <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>
17891 !! end
17893 !! test
17894 new support for bdi element (bug 31817)
17895 !! wikitext
17896 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17897 !! html
17898 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
17900 !!end
17902 !! test
17903 Ignore pipe between table row attributes
17904 !! wikitext
17906 | quux
17907 |- id=foo | style='color: red'
17908 | bar
17910 !! html
17911 <table>
17912 <tr>
17913 <td> quux
17914 </td></tr>
17915 <tr id="foo" style="color: red">
17916 <td> bar
17917 </td></tr></table>
17919 !! end
17921 !!test
17922 Gallery override link with WikiLink (bug 34852)
17923 !! wikitext
17924 <gallery>
17925 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
17926 </gallery>
17927 !! html
17928 <ul class="gallery mw-gallery-traditional">
17929                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17930                         <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>
17931                         <div class="gallerytext">
17932 <p>caption
17933 </p>
17934                         </div>
17935                 </div></li>
17936 </ul>
17938 !! end
17940 !!test
17941 Gallery override link with absolute external link (bug 34852)
17942 !! wikitext
17943 <gallery>
17944 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
17945 </gallery>
17946 !! html
17947 <ul class="gallery mw-gallery-traditional">
17948                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17949                         <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>
17950                         <div class="gallerytext">
17951 <p>caption
17952 </p>
17953                         </div>
17954                 </div></li>
17955 </ul>
17957 !! end
17959 !!test
17960 Gallery override link with malicious javascript (bug 34852)
17961 !! wikitext
17962 <gallery>
17963 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
17964 </gallery>
17965 !! html
17966 <ul class="gallery mw-gallery-traditional">
17967                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17968                         <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>
17969                         <div class="gallerytext">
17970 <p>caption
17971 </p>
17972                         </div>
17973                 </div></li>
17974 </ul>
17976 !! end
17978 !!test
17979 Gallery with invalid title as link (bug 43964)
17980 !! wikitext
17981 <gallery>
17982 File:foobar.jpg|link=<
17983 </gallery>
17984 !! html
17985 <ul class="gallery mw-gallery-traditional">
17986                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17987                         <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>
17988                         <div class="gallerytext">
17989                         </div>
17990                 </div></li>
17991 </ul>
17993 !! end
17995 !!test
17996 Language parser function
17997 !! wikitext
17998 {{#language:ar}}
17999 !! html
18000 <p>العربية
18001 </p>
18002 !! end
18004 !!test
18005 Padleft and padright as substr
18006 !! wikitext
18007 {{padleft:|3|abcde}}
18008 {{padright:|3|abcde}}
18009 !! html
18010 <p>abc
18012 </p>
18013 !! end
18015 !!test
18016 Special parser function
18017 !! wikitext
18018 {{#special:RandomPage}}
18019 {{#special:BaDtItLe}}
18020 {{#special:Foobar}}
18021 !! html
18022 <p>Special:Random
18023 Special:Badtitle
18024 Special:Foobar
18025 </p>
18026 !! end
18028 !!test
18029 Bug 34939 - Case insensitive link parsing ([HttP://])
18030 !! wikitext
18031 [HttP://MediaWiki.Org/]
18032 !! html/php
18033 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
18034 </p>
18035 !! html/parsoid
18036 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
18037 !! end
18039 !!test
18040 Bug 34939 - Case insensitive link parsing ([HttP:// title])
18041 !! wikitext
18042 [HttP://MediaWiki.Org/ MediaWiki]
18043 !! html
18044 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
18045 </p>
18046 !! end
18048 !!test
18049 Bug 34939 - Case insensitive link parsing (HttP://)
18050 !! wikitext
18051 HttP://MediaWiki.Org/
18052 !! html/php
18053 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
18054 </p>
18055 !! html/parsoid
18056 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
18057 !! end
18059 !!test
18060 Disable TOC
18061 !! options
18062 notoc
18063 !! wikitext
18064 Lead
18065 == Section 1 ==
18066 == Section 2 ==
18067 == Section 3 ==
18068 == Section 4 ==
18069 == Section 5 ==
18070 !! html
18071 <p>Lead
18072 </p>
18074 <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>
18075 <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>
18076 <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>
18077 <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>
18078 <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>
18080 !! end
18084 ### Parsoid-specific tests
18085 ### Parsoid-PHP parser incompatibilities
18087 !!test
18088 1. SOL-sensitive wikitext tokens as template-args
18089 !!options
18090 parsoid=wt2html,wt2wt
18091 !! wikitext
18092 {{echo|*a}}
18093 {{echo|#a}}
18094 {{echo|:a}}
18095 !! html
18096 <span about="#mwt1" typeof="mw:Transclusion">
18097 </span><ul about="#mwt1"><li>a</li>
18098 </ul>
18099 <span about="#mwt2" typeof="mw:Transclusion">
18100 </span><ol about="#mwt2"><li>a</li>
18101 </ol>
18102 <span about="#mwt3" typeof="mw:Transclusion">
18103 </span><dl about="#mwt3"><dd>a</dd>
18104 </dl>
18105 !!end
18107 #### -----------------------------------------------------------------
18108 #### Parsoid-specific functionality tests
18109 #### -----------------------------------------------------------------
18111 # Bug 63642: Formatting elt fixup is cleaned up.
18112 # We know wt2wt will fail, but we expect selser to pass.
18113 # Due to the nature of our testing, wt2wt and selser tests will enter the
18114 # blacklist and we'll catch selser regressions based on changes to the
18115 # blacklist entries for selser tests.
18116 !! test
18117 Bad treebuilder fixup of formatting elt is cleaned up
18118 !! options
18119 parsoid=wt2html,wt2wt
18120 !! wikitext
18123 <small>
18124 [[Image:Foobar.jpg|right|Test]]
18125 </small>
18127 !! html/parsoid
18128 <table>
18129 <tbody><tr><td>
18130 <p><small></small></p>
18131 <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>
18132 <p></p></td></tr>
18133 </tbody></table>
18134 !! end
18136 #### ----------------------------------------------------------------
18137 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
18138 #### tags. Parsoid's output for these tags differs from that of the
18139 #### PHP parser.
18140 #### ----------------------------------------------------------------
18142 !!test
18143 Ref: 1. ref-location should be replaced with an index span
18144 !!options
18145 parsoid
18146 !! wikitext
18147 A <ref>foo</ref>
18148 B <ref name="x">foo</ref>
18149 C <ref name="y" />
18150 !! html
18151 <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>
18152 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>
18153 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>
18154 !!end
18156 !!test
18157 Ref: 2. ref-tags with identical names should all get the same index
18158 !!options
18159 parsoid
18160 !! wikitext
18161 A <ref name="x">foo</ref>
18162 B <ref name="x" />
18163 !! html
18164 <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>
18165 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>
18166 !!end
18168 !!test
18169 Ref: 3. spaces in ref-names should be ignored
18170 !!options
18171 parsoid
18172 !! wikitext
18173 A <ref name="x">foo</ref>
18174 B <ref name=" x " />
18175 C <ref name= x  />
18176 !! html
18177 <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>
18178 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>
18179 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>
18180 !!end
18182 !!test
18183 Ref: 4. 'constructor' should be accepted as a valid ref-name
18184 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
18185 !!options
18186 parsoid
18187 !! wikitext
18188 A <ref name="constructor">foo</ref>
18189 !! html
18190 <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>
18191 !!end
18193 !!test
18194 Ref: 5. body should accept generic wikitext
18195 !!options
18196 parsoid
18197 !! wikitext
18198 A <ref>
18199  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
18200 </ref>
18202 <references />
18203 !! html
18204 <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>
18206 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
18207 <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>
18208 </li>
18209 </ol>
18210 !!end
18212 !!test
18213 Ref: 6. indent-pres should not be output in ref-body
18214 !!options
18215 parsoid
18216 !! wikitext
18217 A <ref>
18218  foo
18219  bar
18220  baz
18221 </ref>
18223 <references />
18224 !! html
18225 <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>
18227 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'>
18228 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18229  bar
18230  baz
18231 </li>
18232 </ol>
18233 !!end
18235 !!test
18236 Ref: 7. No p-wrapping in ref-body
18237 !!options
18238 parsoid
18239 !! wikitext
18240 A <ref>
18250 booz
18251 </ref>
18253 <references />
18254 !! html
18255 <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>
18257 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18258 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
18267 booz
18268 </li>
18269 </ol>
18270 !!end
18272 !!test
18273 Ref: 8. transclusion wikitext has lower precedence
18274 !!options
18275 parsoid
18276 !! wikitext
18277 A <ref> foo {{echo|</ref> B C}}
18279 <references />
18280 !! html
18281 <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>
18282 <ol class="references" typeof="mw:Extension/references" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
18283 <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>
18284 </ol>
18285 !!end
18287 !!test
18288 Ref: 9. unclosed comments should not leak out of ref-body
18289 !!options
18290 parsoid
18291 !! wikitext
18292 A <ref> foo <!--</ref> B C
18293 <references />
18294 !! html
18295 <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>
18296 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18297 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo </li>
18298 </ol>
18299 !!end
18301 !!test
18302 Ref: 10. Unclosed HTML tags should not leak out of ref-body
18303 !!options
18304 parsoid
18305 !! wikitext
18306 A <ref> <b> foo </ref> B C
18308 <references />
18309 !! html
18310 <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>
18313 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18314 <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>
18315 </ol>
18316 !!end
18318 !!test
18319 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
18320 !!options
18321 parsoid
18322 !! wikitext
18323 A <ref>foo</ref> B
18324 C <ref>bar</ref> D
18325 !! html
18326 <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
18327 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>
18328 !!end
18330 !!test
18331 Ref: 12. ref-tags act as trailing newline migration barrier
18332 !!options
18333 parsoid
18334 !! wikitext
18335 <!--the newline at the end of this line moves out of the p-tag-->a
18337 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
18338 <ref />
18341 !! html
18342 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
18345 <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>
18346 <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>
18349 <p>c</p>
18350 !!end
18352 !!test
18353 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
18354 !!options
18355 parsoid
18356 !! wikitext
18357 <ref>foo</ref> A
18358 <ref>bar
18359 </ref> B
18360 !! html
18361 <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
18362 <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>
18363 !!end
18365 !!test
18366 Ref: 14. A nested ref-tag should be emitted as plain text
18367 !!options
18368 parsoid
18369 !! wikitext
18370 <ref>foo <ref>bar</ref> baz</ref>
18372 <references />
18373 !! html
18374 <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>
18376 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'>
18377 <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>
18378 </ol>
18379 !!end
18381 !!test
18382 Ref: 15. ref-tags with identical names should get identical indexes
18383 !!options
18384 parsoid
18385 !! wikitext
18386 A1 <ref name="a">foo</ref> A2 <ref name="a" />
18387 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
18389 <references />
18390 !! html
18391 <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>
18392 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>
18394 <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>
18395 </ol>
18396 !!end
18398 ## We don't bother wt2wt-ing non-standard whitespace
18399 !!test
18400 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
18401 !!options
18402 parsoid=wt2html
18403 !! wikitext
18404 A <ref >foo</ref >
18406 <references />
18407 !! html
18408 <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>
18410 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
18411 <li id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
18412 !!end
18414 !!test
18415 References: 1. references tag without any refs should be handled properly
18416 !!options
18417 parsoid
18418 !! wikitext
18419 <references />
18420 !! html
18421 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
18422 !!end
18424 !!test
18425 References: 2. references tag with group only outputs references from that group
18426 !!options
18427 parsoid
18428 !! wikitext
18429 A <ref group="a">foo</ref>
18430 B <ref group="b">bar</ref>
18432 <references group="a" />
18433 !! html
18434 <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>
18435 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>
18437 <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>
18438 </ol>
18439 !!end
18441 !!test
18442 References: 3. ref list should be cleared after processing references
18443 !!options
18444 parsoid
18445 !! wikitext
18446 A <ref>foo</ref>
18448 <references />
18450 B <ref>bar</ref>
18452 <references />
18453 !! html
18454 <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>
18456 <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>
18457 </ol>
18459 <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>
18461 <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>
18462 </ol>
18463 !!end
18465 !!test
18466 References: 4. only referenced group should be cleared after processing references
18467 !!options
18468 parsoid
18469 !! wikitext
18470 A <ref group="a">afoo</ref>
18471 B <ref>bfoo</ref>
18473 <references group="a" />
18475 C <ref>cfoo</ref>
18477 <references />
18478 !! html
18479 <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>
18480 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>
18482 <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>
18483 </ol>
18485 <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>
18487 <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>
18488 </ol>
18489 !!end
18491 !!test
18492 References: 5. ref tags in references should be processed while ignoring all other content
18493 !!options
18494 parsoid
18495 !! wikitext
18496 A <ref name="a" />
18497 B <ref name="b">bar</ref>
18499 <references>
18500 <ref name="a">foo</ref>
18501 This should just get lost.
18502 </references>
18503 !! html
18504 <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>
18505 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>
18508 <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":{}}'>
18509 <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>
18510 <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>
18511 </ol>
18512 !!end
18514 !!test
18515 References: 6. <references /> from a transclusion
18516 !!options
18517 parsoid
18518 !! wikitext
18519 <ref>Foo</ref> {{echo|<references />}}
18520 !! html
18521 <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>
18522 !!end
18524 !! test
18525 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
18526 !! options
18527 parsoid
18528 !! wikitext
18529 A <ref>foo bar for a</ref>
18530 B <ref group="X" name="b" />
18532 <references />
18534 <references group="X">
18535 <ref name="b">foo</ref>
18536 </references>
18537 !! html
18538 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref>foo bar for a&lt;/ref>"}'><a href="#cite_note-1" data-parsoid="{}">[1]</a></span>
18539 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref group=\"X\" name=\"b\" />"}'><a href="#cite_note-b-2" data-parsoid="{}">[X 1]</a></span></p>
18541 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-parsoid='{"src":"&lt;references />"}' data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-1-0" data-parsoid="{}">↑</a></span> foo bar for a</li></ol>
18543 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-parsoid='{"src":"&lt;references group=\"X\">\n&lt;ref name=\"b\">foo&lt;/ref>\n&lt;/references>","group":"X"}' data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39; rel=\"dc:references\" typeof=\"mw:Extension/ref\">&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2" data-parsoid="{}"><span rel="mw:referencedBy" data-parsoid="{}"><a href="#cite_ref-b-2-0" data-parsoid="{}">↑</a></span> foo</li></ol>
18544 !! end
18546 !! test
18547 Entities in ref name
18548 !! options
18549 parsoid
18550 !! wikitext
18551 <ref name="test &amp; me">hi</ref>
18552 !! html
18553 <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>
18554 !! end
18556 # This test is wt2html only because we're permitting the serializer to produce
18557 # dirty diffs, normalizing the unclosed references to the self-closed version.
18558 !! test
18559 Generate references for unclosed references tag
18560 !! options
18561 parsoid=wt2html
18562 !! wikitext
18563 a<ref>foo</ref>
18565 <references>
18566 !! html
18567 <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>
18570 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-parsoid='{"src":"&lt;references>"}' data-mw='{"name":"references","attrs":{}}'>
18571 <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>
18572 !! end
18574 !! test
18575 New reference serializes on its own line
18576 !! options
18577 parsoid=wt2wt,html2wt
18578 !! wikitext
18580 <references />
18581 !! html
18582 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
18583 !! end
18585 #### ----------------------------------------------------------------
18586 #### The following section of tests are primarily to test
18587 #### wikitext escaping capabilities of Parsoid.  Given that
18588 #### escaping can be done any number of ways, the wikitext (input)
18589 #### is always adjusted to reflect how Parsoid adds nowiki
18590 #### escape tags.
18591 ####
18592 #### We are marking several tests as parsoid-only since the
18593 #### HTML in the result section is different from what the
18594 #### PHP parser generates for it.
18595 #### ----------------------------------------------------------------
18598 #### --------------- Headings ---------------
18599 #### 0. Unnested
18600 #### 1. Nested inside html <h1>=foo=</h1>
18601 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
18602 #### 3. Nested inside html with wikitext split by html tags
18603 #### 4. No escape needed
18604 #### 5. Empty headings <h1></h1>
18605 #### 6. Heading chars in SOL context
18606 #### ----------------------------------------
18607 !! test
18608 Headings: 0. Unnested
18609 !! options
18610 parsoid
18611 !! wikitext
18612 <nowiki>=foo=</nowiki>
18614 <nowiki> =foo= </nowiki>
18615 <!--cmt-->
18616 <nowiki>=foo=</nowiki>
18618 =foo''a''<nowiki>=</nowiki>
18619 !! html
18620 <p><span typeof="mw:Nowiki">=foo=</span></p>
18622 <p><span typeof="mw:Nowiki"> =foo= </span>
18623 <!--cmt-->
18624 <span typeof="mw:Nowiki">=foo=</span></p>
18626 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
18627 !!end
18629 !! test
18630 Headings: 1. Nested inside html
18631 (New headings and existing headings are handled differently)
18632 !! options
18633 parsoid=html2wt
18634 !! wikitext
18635 = =foo= =
18637 == =foo= ==
18639 === =foo= ===
18641 =<nowiki>=foo=</nowiki>=
18642 ==<nowiki>=foo=</nowiki>==
18643 ===<nowiki>=foo=</nowiki>===
18644 ====<nowiki>=foo=</nowiki>====
18645 =====<nowiki>=foo=</nowiki>=====
18646 ======<nowiki>=foo=</nowiki>======
18648 !! html
18649 <h1>=foo=</h1>
18650 <h2>=foo=</h2>
18651 <h3>=foo=</h3>
18653 <h1 data-parsoid='{}'>=foo=</h1>
18654 <h2 data-parsoid='{}'>=foo=</h2>
18655 <h3 data-parsoid='{}'>=foo=</h3>
18656 <h4 data-parsoid='{}'>=foo=</h4>
18657 <h5 data-parsoid='{}'>=foo=</h5>
18658 <h6 data-parsoid='{}'>=foo=</h6>
18659 !!end
18661 !! test
18662 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
18663 !! options
18664 parsoid=html2wt
18665 !! wikitext
18666 = foo =
18667 <nowiki>*</nowiki>bar
18669 = foo =
18670 =bar
18672 = foo =
18673 <nowiki>=bar=</nowiki>
18674 !! html
18675 <h1>foo</h1>*bar
18676 <h1>foo</h1>=bar
18677 <h1>foo</h1>=bar=
18678 !!end
18680 !! test
18681 Headings: 3. Nested inside html with wikitext split by html tags
18682 !! options
18683 parsoid=html2wt
18684 !! wikitext
18685 = ='''bold'''<nowiki>foo=</nowiki> =
18686 !! html
18687 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
18688 !!end
18690 !! test
18691 Headings: 4a. No escaping needed (testing just h1 and h2)
18692 !! options
18693 parsoid=html2wt
18694 !! wikitext
18695 = =foo =
18697 = foo= =
18699 = =foo= =
18701 = =foo= bar =
18703 == =foo ==
18705 == foo= ==
18707 = ''=''foo= =
18709 = <nowiki>=</nowiki> =
18710 !! html
18711 <h1>=foo</h1>
18712 <h1>foo=</h1>
18713 <h1> =foo= </h1>
18714 <h1>=foo= bar</h1>
18715 <h2>=foo</h2>
18716 <h2>foo=</h2>
18717 <h1><i>=</i>foo=</h1>
18718 <h1><span typeof="mw:Nowiki">=</span></h1>
18719 !!end
18721 !! test
18722 Headings: 4b. No escaping needed (inside p-tags)
18723 !! options
18724 parsoid=html2wt
18725 !! wikitext
18727 =foo= x
18728 =foo= <s></s>
18729 !! html
18730 <p>===
18731 =foo= x
18732 =foo= <s></s>
18733 </p>
18734 !!end
18736 !! test
18737 Headings: 5. Empty headings
18738 !! options
18739 parsoid
18740 !! wikitext
18741 =<nowiki/>=
18743 ==<nowiki/>==
18745 ===<nowiki/>===
18747 ====<nowiki/>====
18749 =====<nowiki/>=====
18751 ======<nowiki/>======
18752 !! html
18753 <h1></h1>
18754 <h2></h2>
18755 <h3></h3>
18756 <h4></h4>
18757 <h5></h5>
18758 <h6></h6>
18759 !!end
18761 !! test
18762 Headings: 6a. Heading chars in SOL context (with trailing spaces)
18763 !! options
18764 parsoid
18765 !! wikitext
18766 <nowiki>=a=</nowiki>
18768 <nowiki>=a=</nowiki> 
18770 <nowiki>=a=</nowiki>    
18772 <nowiki>=a=</nowiki>    
18773 !! html
18774 <p>=a=</p>
18775 <p>=a= </p>
18776 <p>=a=  </p>
18777 <p>=a=  </p>
18778 !!end
18780 !! test
18781 Headings: 6b. Heading chars in SOL context (with trailing newlines)
18782 !! options
18783 parsoid
18784 !! wikitext
18785 <nowiki>=a=
18786 b</nowiki>
18788 <nowiki>=a= 
18789 b</nowiki>
18791 <nowiki>=a=     
18792 b</nowiki>
18794 <nowiki>=a=      
18795 b</nowiki>
18796 !! html
18797 <p>=a=
18798 b</p>
18799 <p>=a= 
18800 b</p>
18801 <p>=a=  
18802 b</p>
18803 <p>=a=   
18804 b</p>
18805 </p>
18806 !!end
18808 !! test
18809 Headings: 6c. Heading chars in SOL context (leading newline break)
18810 !! options
18811 parsoid
18812 !! wikitext
18814 <nowiki>=b=</nowiki>
18815 !! html
18816 <p>a
18817 =b=</p>
18818 !!end
18820 !! test
18821 Headings: 6d. Heading chars in SOL context (with interspersed comments)
18822 !! options
18823 parsoid
18824 !! wikitext
18825 <!--c0--><nowiki>=a=</nowiki>
18827 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
18828 !! html
18829 <p><!--c0-->=a=</p>
18830 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
18831 !!end
18833 !! test
18834 Headings: 6d. Heading chars in SOL context (No escaping needed)
18835 !! options
18836 parsoid=html2wt
18837 !! wikitext
18838 =a=<div>b</div>
18839 !! html
18840 =a=<div>b</div>
18841 !!end
18843 #### --------------- Lists ---------------
18844 #### 0. Outside nests (*foo, etc.)
18845 #### 1. Nested inside html <ul><li>*foo</li></ul>
18846 #### 2. Inside definition lists
18847 #### 3. Only bullets at start should be escaped
18848 #### 4. No escapes needed
18849 #### 5. No unnecessary escapes
18850 #### 6. Escape bullets in SOL position
18851 #### 7. Escape bullets in a multi-line context
18852 #### ----------------------------------------
18854 !! test
18855 Lists: 0. Outside nests
18856 !! wikitext
18857 <nowiki>*</nowiki>foo
18859 <nowiki>#</nowiki>foo
18861 <nowiki>;Foo:</nowiki>bar
18862 !! html
18863 <p>*foo
18864 </p><p>#foo
18865 </p><p>;Foo:bar
18866 </p>
18867 !!end
18869 !! test
18870 Lists: 1. Nested inside html
18871 !! wikitext
18872 *<nowiki>*foo</nowiki>
18874 *<nowiki>#foo</nowiki>
18876 *<nowiki>:foo</nowiki>
18878 *<nowiki>;foo</nowiki>
18880 #<nowiki>*foo</nowiki>
18882 #<nowiki>#foo</nowiki>
18884 #<nowiki>:foo</nowiki>
18886 #<nowiki>;foo</nowiki>
18887 !! html
18888 <ul><li>*foo</li></ul>
18889 <ul><li>#foo</li></ul>
18890 <ul><li>:foo</li></ul>
18891 <ul><li>;foo</li></ul>
18892 <ol><li>*foo</li></ol>
18893 <ol><li>#foo</li></ol>
18894 <ol><li>:foo</li></ol>
18895 <ol><li>;foo</li></ol>
18897 !!end
18899 !! test
18900 Lists: 2. Inside definition lists
18901 !! wikitext
18902 ;<nowiki>;foo</nowiki>
18904 ;<nowiki>:foo</nowiki>
18906 ;<nowiki>:foo</nowiki>
18907 :bar
18909 :<nowiki>:foo</nowiki>
18910 !! html
18911 <dl><dt>;foo</dt></dl>
18912 <dl><dt>:foo</dt></dl>
18913 <dl><dt>:foo</dt>
18914 <dd>bar</dd></dl>
18915 <dl><dd>:foo</dd></dl>
18917 !!end
18919 !! test
18920 Lists: 3. Only bullets at start of text should be escaped
18921 !! wikitext
18922 *<nowiki>*foo*bar</nowiki>
18924 *<nowiki>*foo</nowiki>''it''*bar
18925 !! html
18926 <ul><li>*foo*bar</li></ul>
18927 <ul><li>*foo<i>it</i>*bar</li></ul>
18929 !!end
18931 !! test
18932 Lists: 4. No escapes needed
18933 !! options
18934 parsoid
18935 !! wikitext
18936 *foo*bar
18938 *''foo''*bar
18940 *[[Foo]]: bar
18942 *[[Foo]]*bar
18943 !! html
18944 <ul>
18945 <li>foo*bar
18946 </li>
18947 </ul>
18948 <ul>
18949 <li><i>foo</i>*bar
18950 </li>
18951 </ul>
18952 <ul>
18953 <li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
18954 </li>
18955 </ul>
18956 <ul>
18957 <li><a rel="mw:WikiLink" href="Foo">Foo</a>*bar
18958 </li>
18959 </ul>
18960 !!end
18962 !! test
18963 Lists: 5. No unnecessary escapes
18964 !! wikitext
18965 * bar <span><nowiki>[[foo]]</nowiki></span>
18967 *=bar <span><nowiki>[[foo]]</nowiki></span>
18969 *[[bar <span><nowiki>[[foo]]</nowiki></span>
18971 *]]bar <span><nowiki>[[foo]]</nowiki></span>
18973 *=bar <span>foo]]</span>=
18975 * <s></s>: a
18976 !! html
18977 <ul><li> bar <span>[[foo]]</span></li></ul>
18978 <ul><li>=bar <span>[[foo]]</span></li></ul>
18979 <ul><li>[[bar <span>[[foo]]</span></li></ul>
18980 <ul><li>]]bar <span>[[foo]]</span></li></ul>
18981 <ul><li>=bar <span>foo]]</span>=</li></ul>
18982 <ul><li> <s></s>: a</li></ul>
18984 !!end
18986 !! test
18987 Lists: 6. Escape bullets in SOL position
18988 !! options
18989 parsoid
18990 !! wikitext
18991 <!--cmt--><nowiki>*foo</nowiki>
18992 !! html
18993 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
18994 !!end
18996 !! test
18997 Lists: 7. Escape bullets in a multi-line context
18998 !! wikitext
19000 <nowiki>*</nowiki>b
19001 !! html
19002 <p>a
19004 </p>
19005 !!end
19007 #### --------------- HRs ---------------
19008 #### 1. Single line
19009 #### -----------------------------------
19011 !! test
19012 HRs: 1. Single line
19013 !! options
19014 parsoid
19015 !! wikitext
19016 ----<nowiki>----</nowiki>
19017 ----=foo=
19018 ----*foo
19019 !! html
19020 <hr><span typeof="mw:Nowiki">----</span>
19021 <hr>=foo=
19022 <hr>*foo
19023 !! end
19025 #### --------------- Tables ---------------
19026 #### 1a. Simple example
19027 #### 1b. No escaping needed (!foo)
19028 #### 1c. No escaping needed (|foo)
19029 #### 1d. No escaping needed (|}foo)
19030 ####
19031 #### 2a. Nested in td (<td>foo|bar</td>)
19032 #### 2b. Nested in td (<td>foo||bar</td>)
19033 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
19034 ####
19035 #### 3a. Nested in th (<th>foo!bar</th>)
19036 #### 3b. Nested in th (<th>foo!!bar</th>)
19037 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
19038 ####
19039 #### 4a. Escape -
19040 #### 4b. Escape +
19041 #### 4c. No escaping needed
19042 #### --------------------------------------
19044 !! test
19045 Tables: 1a. Simple example
19046 !! wikitext
19047 <nowiki>{|
19048 |}</nowiki>
19049 !! html
19050 <p>{|
19052 </p>
19053 !! end
19055 !! test
19056 Tables: 1b. No escaping needed
19057 !! wikitext
19058 !foo
19059 !! html
19060 <p>!foo
19061 </p>
19062 !! end
19064 !! test
19065 Tables: 1c. No escaping needed
19066 !! wikitext
19067 |foo
19068 !! html
19069 <p>|foo
19070 </p>
19071 !! end
19073 !! test
19074 Tables: 1d. No escaping needed
19075 !! wikitext
19076 |}foo
19077 !! html
19078 <p>|}foo
19079 </p>
19080 !! end
19082 !! test
19083 Tables: 2a. Nested in td
19084 !! options
19085 parsoid=html2wt
19086 !! wikitext
19088 |<nowiki>foo|bar</nowiki>
19090 |x<div><nowiki>a|b</nowiki></div>
19092 !! html
19093 <table><tbody><tr>
19094 <td>foo|bar</td></tr>
19095 <tr><td>x<div>a|b</div></td>
19096 </tbody></table>
19097 !! end
19099 !! test
19100 Tables: 2b. Nested in td
19101 !! options
19102 parsoid
19103 !! wikitext
19105 |<nowiki>foo||bar</nowiki>
19106 |''it''<nowiki>foo||bar</nowiki>
19108 !! html
19109 <table><tbody><tr>
19110 <td><span typeof="mw:Nowiki">foo||bar</span></td>
19111 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
19112 !! end
19114 !! test
19115 Tables: 2c. Nested in td -- no escaping needed
19116 !! options
19117 parsoid
19118 !! wikitext
19120 |foo!!bar
19122 !! html
19123 <table><tbody><tr><td>foo!!bar
19124 </td></tr></tbody></table>
19126 !! end
19128 !! test
19129 Tables: 3a. Nested in th
19130 !! options
19131 parsoid
19132 !! wikitext
19134 !foo!bar
19136 !! html
19137 <table><tbody><tr><th>foo!bar
19138 </th></tr></tbody></table>
19140 !! end
19142 !! test
19143 Tables: 3b. Nested in th
19144 !! options
19145 parsoid
19146 !! wikitext
19148 !<nowiki>foo!!bar</nowiki>
19150 !! html
19151 <table>
19152 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
19153 </tbody></table>
19154 !! end
19156 !! test
19157 Tables: 3c. Nested in th -- no escaping needed
19158 !! options
19159 parsoid
19160 !! wikitext
19162 !<nowiki>foo||bar</nowiki>
19164 !! html
19165 <table><tbody><tr>
19166 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
19167 !! end
19169 !! test
19170 Tables: 4a. Escape -
19171 !! options
19172 parsoid
19173 !! wikitext
19175 !-bar
19177 |<nowiki>-bar</nowiki>
19179 !! html
19180 <table><tbody>
19181 <tr><th>-bar</th></tr>
19182 <tr>
19183 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
19184 !! end
19186 !! test
19187 Tables: 4b. Escape +
19188 !! options
19189 parsoid
19190 !! wikitext
19192 !+bar
19194 |<nowiki>+bar</nowiki>
19196 !! html
19197 <table><tbody>
19198 <tr><th>+bar</th></tr>
19199 <tr>
19200 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
19201 !! end
19203 !! test
19204 Tables: 4c. No escaping needed
19205 !! options
19206 parsoid
19207 !! wikitext
19209 |foo-bar
19210 |foo+bar
19212 |''foo''-bar
19213 |''foo''+bar
19215 |foo
19216 bar|baz
19217 +bar
19218 -bar
19221 <div>a|b</div>
19223 !! html
19224 <table><tbody>
19225 <tr><td>foo-bar</td><td>foo+bar</td></tr>
19226 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
19227 <tr><td>foo
19228 <p>bar|baz
19229 +bar
19230 -bar</p></td></tr>
19231 <tr><td>x
19232 <div>a|b</div></td>
19233 </tbody></table>
19234 !! end
19236 !! test
19237 Tables: 4d. No escaping needed
19238 !! options
19239 parsoid
19240 !! wikitext
19242 |[[Foo]]-bar
19243 ||+1
19244 ||-2
19246 !! html
19247 <table>
19248 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo">Foo</a>-bar</td>
19249 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
19250 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
19251 </tbody></table>
19252 !! end
19254 !! test
19255 Tables: Digest broken attributes on table and tr tag
19256 !! options
19257 parsoid=wt2html
19258 !! wikitext
19259 {| || |} ++
19260 |- || || ++ --
19261 |- > [
19263 !! html
19264 <table>
19265 <tbody>
19266 <tr></tr>
19267 <tr></tr>
19268 </tbody></table>
19269 !! end
19271 #### --------------- Links ----------------
19272 #### 1. Quote marks in link text
19273 #### 2. Wikilinks: Escapes needed
19274 #### 3. Wikilinks: No escapes needed
19275 #### 4. Extlinks: Escapes needed
19276 #### 5. Extlinks: No escapes needed
19277 #### --------------------------------------
19278 !! test
19279 Links 1. Quote marks in link text
19280 !! options
19281 parsoid
19282 !! wikitext
19283 [[Foo|Foo<nowiki>''boo''</nowiki>]]
19284 !! html
19285 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
19286 !! end
19288 !! test
19289 Links 2. WikiLinks: Escapes needed
19290 !! options
19291 parsoid
19292 !! wikitext
19293 [[Foo|[Foobar]]]
19294 [[Foo|<nowiki>Foobar]</nowiki>]]
19295 [[Foo|x [Foobar] x]]
19296 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
19297 [[Foo|<nowiki>[[Bar]]</nowiki>]]
19298 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
19299 [[Foo|<nowiki>|Bar</nowiki>]]
19300 [[Foo|<nowiki>]]bar</nowiki>]]
19301 [[Foo|<nowiki>[[bar</nowiki>]]
19302 [[Foo|<nowiki>x [[ y</nowiki>]]
19303 [[Foo|<nowiki>x ]] y</nowiki>]]
19304 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
19305 !! html
19306 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
19307 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
19308 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
19309 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
19310 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
19311 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
19312 <a href="Foo" rel="mw:WikiLink">|Bar</a>
19313 <a href="Foo" rel="mw:WikiLink">]]bar</a>
19314 <a href="Foo" rel="mw:WikiLink">[[bar</a>
19315 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
19316 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
19317 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
19318 !! end
19320 !! test
19321 Links 3. WikiLinks: No escapes needed
19322 !! options
19323 parsoid
19324 !! wikitext
19325 [[Foo|[Foobar]]
19326 [[Foo|foo|bar]]
19327 !! html
19328 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
19329 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
19330 !! end
19332 !! test
19333 Links 4. ExtLinks: Escapes needed
19334 !! options
19335 parsoid
19336 !! wikitext
19337 [http://google.com <nowiki>[google]</nowiki>]
19338 [http://google.com <nowiki>google]</nowiki>]
19340 <nowiki>[http://google.com]</nowiki>
19342 <nowiki>[http://google.com google]</nowiki>
19344 !! html
19345 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
19346 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
19347 <p>[http://google.com]</p>
19348 <p>[http://google.com google]</p>
19349 !! end
19351 !! test
19352 Links 5. ExtLinks: No escapes needed
19353 !! options
19354 parsoid
19355 !! wikitext
19356 [http://google.com [google]
19357 !! html
19358 <a href="http://google.com" rel="mw:ExtLink">[google</a>
19359 !! end
19361 !! test
19362 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
19363 !! html/parsoid
19364 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
19365 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
19366 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
19367 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
19368 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
19369 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
19370 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19371 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
19372 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
19373 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
19374 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
19375 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
19376 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
19377 </p>
19378 !! wikitext
19379 x<nowiki/>http://example.com<nowiki/>y
19380 http://example.com<nowiki/>?x
19381 http://example.com<nowiki/>&x
19382 http://example.com<nowiki/>'x
19383 http://example.com<nowiki/>,x
19384 http://example.com<nowiki/>.x
19385 http://example.com<nowiki/>;x
19386 http://example.com<nowiki/>:x
19387 http://example.com<nowiki/>;x
19388 http://example.com<nowiki/>!x
19389 http://example.com<nowiki/>=x
19390 http://example.com<nowiki/>(x)
19391 http://example.com(x<nowiki/>)
19392 !! end
19394 !! test
19395 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19396 !! html/parsoid
19397 <p>x
19398 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
19400 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
19401 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
19402 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
19403 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
19404 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
19405 </p>
19406 !! wikitext
19408 http://example.com
19410 "http://example.com"
19411 (http://example.com)
19412 (http://example.com) foo
19413 http://example.com,
19414 http://example.com, foo
19415 !! end
19417 ## Parsoid currently fails wt2html on this one!
19418 !! test
19419 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
19420 !! html/parsoid
19421 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
19422 !! wikitext
19423 http://example.com.,;:!?
19424 !! end
19426 !! test
19427 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
19428 !! html/parsoid
19429 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
19430 !! wikitext
19431 RFC 123<nowiki/>4
19432 !! end
19434 !! test
19435 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
19436 !! html/parsoid
19437 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19438 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
19439 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
19440 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
19441 </p>
19442 !! wikitext
19443 xRFC 123y
19444 XRFC 123y
19445 RFC 123?foo
19446 RFC 123&foo
19447 !! end
19449 !! test
19450 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
19451 !! html/parsoid
19452 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
19453 !! wikitext
19454 PMID 123<nowiki/>4
19455 !! end
19457 !! test
19458 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
19459 !! html/parsoid
19460 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19461 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
19462 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
19463 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
19464 </p>
19465 !! wikitext
19466 xPMID 123y
19467 XPMID 123y
19468 PMID 123?foo
19469 PMID 123&foo
19470 !! end
19472 !! test
19473 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
19474 !! html/parsoid
19475 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
19476 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
19477 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
19478 </p>
19479 !! wikitext
19480 ISBN 1234567890<nowiki/>1
19481 ISBN 1234567890<nowiki/>x
19482 ISBN 1234567890<nowiki/>b
19483 !! end
19485 !! test
19486 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
19487 !! html/parsoid
19488 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
19489 !! wikitext
19490 ISBN 1234567890's
19491 !! end
19493 #### --------------- Quotes ---------------
19494 #### 1. Quotes inside <b> and <i>
19495 #### 2. Link fragments separated by <i> and <b> tags
19496 #### 3. Link fragments inside <i> and <b>
19497 #### 4. No escaping needed
19498 #### --------------------------------------
19499 !! test
19500 1. Quotes inside <b> and <i>
19501 !! options
19502 parsoid=html2wt,wt2wt
19503 !! wikitext
19504 ''<nowiki>'foo'</nowiki>''
19505 ''<nowiki>''foo''</nowiki>''
19506 ''<nowiki>'''foo'''</nowiki>''
19507 ''foo''<nowiki/>'s
19508 '''<nowiki>'foo'</nowiki>'''
19509 '''<nowiki>''foo''</nowiki>'''
19510 '''<nowiki>'''foo'''</nowiki>'''
19511 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
19512 '''foo'''<nowiki/>'s
19513 '''foo''
19514 ''foo''<nowiki/>'
19515 '<nowiki/>''foo''<nowiki/>'
19516 ''''foo'''
19517 '''foo'''<nowiki/>'
19518 '<nowiki/>'''foo'''<nowiki/>'
19519 ''fools'<span> errand</span>''
19520 ''<span>fool</span>'s errand''
19521 !! html
19522 <p><i>'foo'</i>
19523 <i>''foo''</i>
19524 <i>'''foo'''</i>
19525 <i>foo</i>'s
19526 <b>'foo'</b>
19527 <b>''foo''</b>
19528 <b>'''foo'''</b>
19529 <b>foo'<i>bar'</i>baz</b>
19530 <b>foo</b>'s
19531 '<i>foo</i>
19532 <i>foo</i>'
19533 '<i>foo</i>'
19534 '<b>foo</b>
19535 <b>foo</b>'
19536 '<b>foo</b>'</p>
19537 <i>fools'<span> errand</span></i>
19538 <i><span>fool</span>'s errand</i>
19539 !! end
19541 !! test
19542 2. Link fragments separated by <i> and <b> tags
19543 !! wikitext
19544 [[''foo''<nowiki>hello]]</nowiki>
19546 [['''foo'''<nowiki>hello]]</nowiki>
19547 !! html
19548 <p>[[<i>foo</i>hello]]
19549 </p><p>[[<b>foo</b>hello]]
19550 </p>
19551 !! end
19553 !! test
19554 3. Link fragments inside <i> and <b>
19555 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
19556  this is one of the shortcomings of this format)
19557 !! wikitext
19558 ''[[foo''<nowiki>]]</nowiki>
19560 '''[[foo'''<nowiki>]]</nowiki>
19561 !! html
19562 <p><i>[[foo</i>]]
19563 </p><p><b>[[foo</b>]]
19564 </p>
19565 !! end
19567 !! test
19568 4. No escaping needed
19569 !! wikitext
19570 '<span>''bar''</span>'
19571 '<span>'''bar'''</span>'
19572 !! html
19573 <p>'<span><i>bar</i></span>'
19574 '<span><b>bar</b></span>'
19575 </p>
19576 !! end
19578 #### ----------- Paragraphs ---------------
19579 #### 1. No unnecessary escapes
19580 #### --------------------------------------
19582 !! test
19583 1. No unnecessary escapes
19584 !! wikitext
19585 bar <span><nowiki>[[foo]]</nowiki></span>
19587 =bar <span><nowiki>[[foo]]</nowiki></span>
19589 [[bar <span><nowiki>[[foo]]</nowiki></span>
19591 ]]bar <span><nowiki>[[foo]]</nowiki></span>
19593 =bar <span>foo]]</span><nowiki>=</nowiki>
19594 !! html
19595 <p>bar <span>[[foo]]</span>
19596 </p><p>=bar <span>[[foo]]</span>
19597 </p><p>[[bar <span>[[foo]]</span>
19598 </p><p>]]bar <span>[[foo]]</span>
19599 </p><p>=bar <span>foo]]</span>=
19600 </p>
19601 !!end
19603 #### ----------------------- PRE --------------------------
19604 #### 1. Leading whitespace in SOL context should be escaped
19605 #### ------------------------------------------------------
19606 !! test
19607 1. Leading whitespace in SOL context should be escaped
19608 !! options
19609 parsoid
19610 !! wikitext
19611 <nowiki> </nowiki>a
19613 <nowiki> </nowiki> a
19615 <nowiki>        </nowiki>a(tab)
19617 <nowiki> </nowiki>      a
19618 <!--cmt-->
19619 <nowiki> </nowiki> a
19622 <nowiki> </nowiki>b
19625 <nowiki>        </nowiki>b
19628 <nowiki>        </nowiki> b
19629 !! html
19630 <p> a</p>
19631 <p>  a</p>
19632 <p>     a(tab)</p>
19633 <p>     a</p>
19634 <p><!--cmt-->  a</p>
19635 <p>a
19636  b</p>
19637 <p>a
19638         b</p>
19639 <p>a
19640          b</p>
19641 !! end
19643 !! test
19644 2. Leading whitespace in non-indent-pre contexts should not be escaped
19645 !! options
19646 parsoid
19647 !! wikitext
19648 foo <ref>''a''
19649  b</ref>
19650 !! html
19651 <p>foo <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
19652 !! end
19654 !! test
19655 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
19656 !! options
19657 parsoid
19658 !! wikitext
19659 <blockquote>
19661  <span>b</span>
19663 </blockquote>
19664 !! html
19665 <blockquote>
19668  <span>b</span>
19669  c</p>
19670 </blockquote>
19671 !! end
19673 !! test
19674 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
19675 !! options
19676 parsoid
19677 !! wikitext
19678  [[File:Foobar.jpg|thumb|caption]]
19679 !! html
19680 !! html/parsoid
19681  <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>
19682 !! end
19684 !! test
19685 5. Nowiki escaping should account for indent-pres
19686 !! options
19687 parsoid=html2wt
19688 !! html
19689 <pre>==foo==</pre>
19690 !! wikitext
19691  ==foo==
19692 !! end
19694 #### --------------- Behavior Switches --------------------
19695 !! test
19696 1. Valid behavior switches should be escaped
19697 !! options
19698 parsoid=html2wt
19699 !! wikitext
19700 <nowiki>__TOC__</nowiki>
19701 ''<nowiki>__TOC__</nowiki>''
19702 !! html
19703 __TOC__
19704 <i>__TOC__</i>
19705 !! end
19707 !! test
19708 2. Invalid behavior switches should not be escaped
19709 !! options
19710 parsoid=html2wt
19711 !! wikitext
19712 __TOO__
19713 __|__
19714 !! html
19715 __TOO__
19716 __|__
19717 !! end
19719 #### --------------- HTML tags ---------------
19720 #### 1. a tags
19721 #### 2. other tags
19722 #### 3. multi-line html tag
19723 #### 4. extension tags
19724 #### -----------------------------------------
19725 !! test
19726 1. a tags
19727 !! options
19728 parsoid
19729 !! wikitext
19730 <a href="http://google.com">google</a>
19731 !! html
19732 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
19733 !! end
19735 !! test
19736 2. other tags
19737 !! wikitext
19738 <nowiki><div>foo</div>
19739 <div style="color:red">foo</div></nowiki>
19740 !! html
19741 <p>&lt;div&gt;foo&lt;/div&gt;
19742 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
19743 </p>
19744 !! end
19746 !! test
19747 3. multi-line html tag
19748 !! wikitext
19749 <nowiki><div
19750 >foo</div
19751 ></nowiki>
19752 !! html
19753 <p>&lt;div
19754 &gt;foo&lt;/div
19755 &gt;
19756 </p>
19757 !! end
19759 !! test
19760 4. extension tags
19761 !! wikitext
19762 <nowiki><ref>foo</ref></nowiki>
19764 <nowiki><ref>bar</nowiki>
19766 baz<nowiki></ref></nowiki>
19767 !! html
19768 <p>&lt;ref&gt;foo&lt;/ref&gt;
19769 </p><p>&lt;ref&gt;bar
19770 </p><p>baz&lt;/ref&gt;
19771 </p>
19772 !! end
19774 #### --------------- Others ---------------
19775 !! test
19776 Escaping nowikis
19777 !! wikitext
19778 &lt;nowiki&gt;foo&lt;/nowiki&gt;
19779 !! html
19780 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
19781 </p>
19782 !! end
19784 ## The quote-char in the input is necessary for triggering the bug
19785 !! test
19786 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
19787 !! options
19788 parsoid=wt2wt,html2wt
19789 !! wikitext
19790 foo's bar :
19791 !! html
19792 <p>foo's bar :</p>
19793 !! end
19795 !! test
19797 Tag-like HTML structures are passed through as text
19798 !! wikitext
19799 <x y>
19801 <x.y>
19803 <x-y>
19811 1<d e>f
19812 !! html
19813 <p>&lt;x y&gt;
19814 </p><p>&lt;x.y&gt;
19815 </p><p>&lt;x-y&gt;
19816 </p><p>1&gt;2
19817 </p><p>x&lt;y
19818 </p><p>a&gt;b
19819 </p><p>1&lt;d e&gt;f
19820 </p>
19821 !! end
19824 # This was a bug in the PHP parser (see bug 17663 and its dups,
19825 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
19826 !! test
19827 Tag names followed by punctuation should not be recognized as tags
19828 !! wikitext
19829 <s.ome> text
19830 !! html
19831 <p>&lt;s.ome&gt; text
19832 </p>
19833 !! end
19835 !! test
19836 HTML tag with necessary entities in attributes
19837 !! wikitext
19838 <span title="&amp;amp;">foo</span>
19839 !! html
19840 <p><span title="&amp;amp;">foo</span>
19841 </p>
19842 !! end
19844 !! test
19845 HTML tag with 'unnecessary' entity encoding in attributes
19846 !! wikitext
19847 <span title="&amp;">foo</span>
19848 !! html
19849 <p><span title="&amp;">foo</span>
19850 </p>
19851 !! end
19853 !! test
19854 HTML tag with broken attribute value quoting
19855 !! wikitext
19856 <span title="Hello world>Foo</span>
19857 !! html
19858 <p><span>Foo</span>
19859 </p>
19860 !! end
19862 !! test
19863 Parsoid-only: HTML tag with broken attribute value quoting
19864 !! options
19865 parsoid
19866 !! wikitext
19867 <span title="Hello world>Foo</span>
19868 !! html
19869 <p><span title="Hello world">Foo</span>
19870 </p>
19871 !! end
19873 !! test
19874 Table with broken attribute value quoting
19875 !! wikitext
19877 | title="Hello world|Foo
19879 !! html
19880 <table>
19881 <tr>
19882 <td>Foo
19883 </td></tr></table>
19885 !! end
19887 !! test
19888 Table with broken attribute value quoting on consecutive lines
19889 !! wikitext
19891 | title="Hello world|Foo
19892 | style="color:red|Bar
19894 !! html
19895 <table>
19896 <tr>
19897 <td>Foo
19898 </td>
19899 <td>Bar
19900 </td></tr></table>
19902 !! end
19904 !! test
19905 Parsoid-only: Table with broken attribute value quoting on consecutive lines
19906 !! options
19907 parsoid
19908 !! wikitext
19910 | title="Hello world|Foo
19911 | style="color:red|Bar
19913 !! html
19914 <table><tbody>
19915 <tr>
19916 <td title="Hello world">Foo
19917 </td><td style="color: red">Bar
19918 </td></tr></tbody></table>
19920 !! end
19922 !! test
19923 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19924 !! options
19925 parsoid
19926 !! wikitext
19927 {{}}
19928 !! html
19929 {{}}
19930 !! end
19932 !! test
19933 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
19934 !! options
19935 parsoid
19936 !! wikitext
19937 }}{{
19938 !! html
19939 }}{{
19940 !! end
19942 !!test
19943 Accept empty td cell attribute
19944 !! wikitext
19946 | align="center" | foo ||  |
19948 !! html
19949 <table>
19950 <tr>
19951 <td align="center"> foo </td>
19952 <td>
19953 </td></tr></table>
19955 !!end
19957 !!test
19958 Non-empty attributes in th-cells
19959 !! wikitext
19961 ! Foo !! style="color: red" | Bar
19963 !! html
19964 <table>
19965 <tr>
19966 <th> Foo </th>
19967 <th style="color: red"> Bar
19968 </th></tr></table>
19970 !!end
19972 !!test
19973 Accept empty attributes in th-cells
19974 !! wikitext
19976 !| foo !!| bar
19978 !! html
19979 <table>
19980 <tr>
19981 <th> foo </th>
19982 <th> bar
19983 </th></tr></table>
19985 !!end
19987 !!test
19988 Empty table rows go away
19989 !! wikitext
19991 | Hello
19992 | there
19993 |- class="foo"
19996 !! html
19997 <table>
19998 <tr>
19999 <td> Hello
20000 </td>
20001 <td> there
20002 </td></tr>
20004 </table>
20006 !! end
20009 ### Parsoid-centric tests for testing RTing of inter-element separators
20010 ### Edge cases not tested by existing parser tests and specific to
20011 ### Parsoid-specific serialization strategies.
20014 !!test
20015 RT-ed inter-element separators should be valid separators
20016 !! wikitext
20018 |- [[foo]]
20020 !! html
20021 <table>
20023 </table>
20025 !!end
20027 !!test
20028 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
20029 (Parsoid-only since PHP parser relies on Tidy for correct output)
20030 !!options
20031 parsoid
20032 !! wikitext
20034 |<small>foo
20039 |<small>foo<small>
20041 !! html
20042 !!end
20044 !!test
20045 Empty TD followed by TD with tpl-generated attribute
20046 !! wikitext
20050 |{{echo|style='color:red'}}|foo
20052 !! html
20053 <table>
20055 <tr>
20056 <td>
20057 </td>
20058 <td>foo
20059 </td></tr></table>
20061 !!end
20063 !!test
20064 Indented table with an empty td
20065 !! wikitext
20066  {|
20067  |-
20069  |foo
20070  |}
20071 !! html
20072 <table>
20074 <tr>
20075 <td>
20076 </td>
20077 <td>foo
20078 </td></tr></table>
20080 !!end
20082 !!test
20083 Indented block & table
20084 !! wikitext
20085  <div>foo</div>
20086  {|
20087  |foo
20088  |}
20089 !! html/parsoid
20090  <div data-parsoid='{"stx":"html"}'>foo</div>
20091  <table><tbody>
20092  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
20093  </tbody></table>
20094 !!end
20096 !! test
20097 Indent and comment before table row
20098 !! wikitext
20100  <!--hi-->|-
20101  | there
20103 !! html/parsoid
20104 <table data-parsoid='{}'>
20105  <!--hi--><tbody data-parsoid='{}'><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
20106  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
20107 </tbody></table>
20108 !! end
20110 !!test
20111 Empty TR followed by a template-generated TR
20112 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
20113 !!options
20114 parsoid
20115 !! wikitext
20118 {{echo|<tr><td>foo</td></tr>}}
20120 !! html
20121 <table>
20122 <tbody>
20123 <tr></tr>
20124 <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}}]}'>
20125 <td>foo</td></tr>
20126 </tbody></table>
20127 !!end
20129 ## PHP and parsoid output differ for this, and since this is primarily
20130 ## for testing Parsoid's serializer, marking this Parsoid only
20131 !!test
20132 Empty TR followed by mixed-ws-comment line should RT correctly
20133 !!options
20134 parsoid
20135 !! wikitext
20138  <!--c-->
20140 <!--c--> <!--d-->
20142 !! html
20143 <table>
20144 <tbody>
20145 <tr></tr>
20146  <!--c-->
20147 <tr>
20148 <!--c--> </tr><!--d-->
20149 </tbody></table>
20151 !!end
20153 !!test
20154 Multi-line image caption generated by templates with/without trailing newlines
20155 !!options
20156 parsoid
20157 !! wikitext
20158 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
20159 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
20160 !! html
20161 <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>
20162 <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>
20164 !!end
20166 !! test
20167 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
20168 !! options
20169 parsoid=html2wt
20170 !! wikitext
20171 <includeonly>foo</includeonly>
20172 new para
20174 [[./Category:Foo]]
20176 = new heading =
20177 !! html
20178 <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>
20180 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
20181 !! end
20183 ## PHP emits broken html for this, and since this is primarily
20184 ## a Parsoid serializer test, marking this Parsoid only
20185 !!test
20186 Improperly nested inline or quotes tags with whitespace in between
20187 !!options
20188 parsoid
20189 !! wikitext
20190 <span> <s>x</span> </s>
20191 ''' ''x''' ''
20192 !! html
20193 <p><span> <s>x</s></span><s> </s>
20194 <b> <i>x</i></b><i> </i>
20195 </p>
20196 !!end
20198 !!test
20199 Encapsulate protected attributes from wt
20200 !!options
20201 parsoid
20202 !! wikitext
20203 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
20204 !! html
20205 <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>
20206 </body>
20207 !!end
20209 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
20210 ## Having nested or stray pre tags results in the attempt to add duplicates,
20211 ## causing an assertion fail. This test tries to prevent that situation.
20212 !!test
20213 Ensure ParagraphWrapper can deal with stray closing pre tags
20214 !!options
20215 parsoid=wt2html
20216 !! wikitext
20217 plain text</pre>
20218 !! html
20219 plain text
20220 !!end
20222 !!test
20223 1. Ensure fostered text content is wrapped in spans
20224 !!options
20225 parsoid=wt2html
20226 !! wikitext
20227 <table>hi</table><table>ho</table>
20228 !! html
20229 <span>hi</span>
20230 <table></table>
20231 <span>ho</span>
20232 <table></table>
20233 !!end
20235 !!test
20236 2. Ensure fostered text content is wrapped in spans (traps regressions around fostered marker on the span getting lost)
20237 !!options
20238 parsoid=wt2html,wt2wt
20239 !! wikitext
20240 <table>
20241 <tr> || ||
20242 <td> a
20243 </table>
20244 !! html
20245 <span> || ||</span>
20246 <table>
20247 <tbody>
20248 <tr>
20249 <td> a</td></tr>
20250 </tbody></table>
20251 !!end
20253 !!test
20254 Encapsulation properly handles null DSR information from foster box
20255 !!options
20256 parsoid=wt2html,wt2wt
20257 !! wikitext
20258 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
20259 !! html
20260 <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;
20261 <table>foo
20262 <tr>
20263 <td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span>
20264 <table>
20265 <tbody>
20266 <tr>
20267 <td>bar</td></tr></tbody></table>
20268 !!end
20270 !!test
20271 1. Encapsulate foster-parented transclusion content
20272 !!options
20273 parsoid=wt2wt,wt2html
20274 !! wikitext
20275 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
20276 !! html
20277 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20278 <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
20279 <tr>
20280 <td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</span>
20281 <table>
20282 <tbody>
20283 <tr>
20284 <td>bar</td></tr></tbody></table>
20285 !!end
20287 !!test
20288 2. Encapsulate foster-parented transclusion content
20289 !!options
20290 parsoid=wt2wt,wt2html
20291 !! wikitext
20292 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
20293 !! html
20294 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20295 <table>
20296 <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>
20297 <tr>
20298 <td>bar</td></tr></table>&quot;]}">foo</div>
20299 <table>
20300 <tbody>
20301 <tr>
20302 <td>bar</td></tr></tbody></table>
20303 !!end
20305 !!test
20306 3. Encapsulate foster-parented transclusion content
20307 !!options
20308 parsoid=wt2wt,wt2html
20309 !! wikitext
20310 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20311 !! html
20312 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20313 <table>
20314 <div>
20315 <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>
20316 <tr>
20317 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20318 <p>foo</p></div>
20319 <table>
20320 <tbody>
20321 <tr>
20322 <td>bar</td></tr></tbody></table>
20323 !!end
20325 !!test
20326 4. Encapsulate foster-parented transclusion content
20327 !!options
20328 parsoid=wt2wt,wt2html
20329 !! wikitext
20330 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
20331 !! html
20332 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20333 <table>
20334 <div>
20335 <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>
20336 <tr>
20337 <td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
20338 <p>foo</p></div>
20339 <table>
20340 <tbody>
20341 <tr>
20342 <td>bar</td></tr></tbody></table>
20343 !!end
20345 !!test
20346 5. Encapsulate foster-parented transclusion content
20347 !!options
20348 parsoid=wt2wt,wt2html
20349 !! wikitext
20350 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
20351 !! html
20352 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20353 <table>
20354 <tr>
20355 <td>
20356 <div>
20357 <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>
20358 <table>
20359 <tbody>
20360 <tr>
20361 <td>
20362 <div>
20363 <p>foo</p></div></td></tr></tbody></table>
20364 !!end
20366 !!test
20367 6. Encapsulate foster-parented transclusion content
20368 !!options
20369 parsoid=wt2wt,wt2html
20370 !! wikitext
20371 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
20372 !! html
20373 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20374 <table>
20375 <tr>
20376 <td>
20377 <div>
20378 <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>
20379 <table>
20380 <tbody>
20381 <tr>
20382 <td>
20383 <div>
20384 <p>foo</p></div></td></tr></tbody></table>
20385 <p>ok</p>
20386 !!end
20388 !!test
20389 7. Encapsulate foster-parented transclusion content
20390 !!options
20391 parsoid=wt2wt,wt2html
20392 !! wikitext
20393 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
20394 !! html
20395 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;
20396 <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;
20397 <p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;
20398 <td>bar</td></table>&quot;]}">foo</p>
20399 <table>
20400 <tbody>
20401 <tr>
20402 <td>bar</td></tr></tbody></table>
20403 !!end
20405 !!test
20406 8. Encapsulate foster-parented transclusion content
20407 !!options
20408 parsoid=wt2wt,wt2html
20409 !! wikitext
20410 {{echo|a
20411 }}{|{{echo|style='color:red'}}
20415 !! html
20416 <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>
20417 <table>
20418 <tbody>
20419 <tr>
20420 <td>b</td></tr></tbody></table>
20421 !!end
20423 !!test
20424 9. Encapsulate foster-parented transclusion content
20425 !!options
20426 parsoid=wt2wt,wt2html
20427 !! wikitext
20428 <table>{{echo|hi</table>hello}}
20429 !! html
20430 <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>
20431 <table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2" data-parsoid="{}">hello</span>
20432 !!end
20434 !!test
20435 Table in fosterable position
20436 !!options
20437 parsoid=wt2html,wt2wt
20438 !! wikitext
20439 {{OpenTable}}
20440 <div>
20443 </div>
20445 !! html
20446 <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="{}">
20447 </span>
20448 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
20450 <table>
20451 </table>
20452 !!end
20454 # Parsoid only for bug 64747
20455 !! test
20456 Properly encapsulate empty-content transclusions in fosterable positions
20457 !! wikitext
20458 <table>
20459 {{#if:|
20460 <td>foo</td>
20462 </table>
20463 !! html/parsoid
20464 <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>"}'>
20466 </table>
20467 !! end
20469 !!test
20470 Support <object> element with .data attribute
20471 !!options
20472 parsoid=html2wt
20473 !! wikitext
20474 <object data="test.swf"></object>
20475 !! html
20476 <object data="test.swf"></object>
20477 !!end
20479 # -----------------------------------------------------------------
20480 # The following section of tests are primarily to spec requirements
20481 # around serialization of new/edited content.
20483 # All these tests are marked Parsoid html2wt and html2html only
20484 # ----------------------------------------------------------------
20486 !! test
20487 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
20488 !! options
20489 parsoid=html2wt
20490 language=es
20491 !! wikitext
20492 [[Foo]]
20493 !! html
20494 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Foo">Foo</a></p>
20495 !! end
20497 !! test
20498 Image: Modifying size of an image (1)
20499 !! options
20500 parsoid={
20501   "modes": ["wt2wt"],
20502   "changes": [
20503     ["img[height]", "attr", "height", "22"],
20504     ["img[width]", "attr", "width", "200"]
20505   ]
20507 !! wikitext
20508 [[Image:Foobar.jpg|230x230px]]
20509 !! wikitext/edited
20510 [[Image:Foobar.jpg|200x200px]]
20511 !!end
20513 !! test
20514 Image: Modifying size of an image (2)
20515 !! options
20516 parsoid={
20517   "modes": ["wt2wt"],
20518   "changes": [
20519     ["img[height]", "attr", "height", "100"],
20520     ["img[width]", "attr", "width", "500"]
20521   ]
20523 !! wikitext
20524 [[Image:Foobar.jpg|230x230px]]
20525 !! wikitext/edited
20526 [[Image:Foobar.jpg|500x500px]]
20527 !!end
20529 # Change in size is ignored so long as class='mw-default-size'
20530 !! test
20531 Image: Modifying size of an image (3)
20532 !! options
20533 parsoid={
20534   "modes": ["wt2wt"],
20535   "changes": [
20536     ["figure[class]", "removeClass", "mw-default-size"],
20537     ["figure img", "attr", "height", "19"],
20538     ["figure img", "attr", "width", "170"]
20539   ]
20541 !! wikitext
20542 [[Image:Foobar.jpg|thumb]]
20543 !! wikitext/edited
20544 [[Image:Foobar.jpg|thumb|170x170px]]
20545 !!end
20547 !! test
20548 Image: Modifying alignment of an image (bug 48665)
20549 !! options
20550 parsoid={
20551   "modes": ["wt2wt"],
20552   "changes": [
20553     ["figure[class]", "removeClass", "mw-halign-right"],
20554     ["figure[class]", "addClass", "mw-halign-left"]
20555   ]
20557 !! wikitext
20558 [[Image:Foobar.jpg|thumb|caption|right]]
20559 !! wikitext/edited
20560 [[Image:Foobar.jpg|thumb|caption|left]]
20561 !! end
20563 !! test
20564 Image: Modifying mw-default-size of an frameless image (bug 62805)
20565 !! options
20566 parsoid={
20567   "modes": ["wt2wt"],
20568   "changes": [
20569     ["figure.mw-default-size", "removeClass", "mw-default-size"]
20570   ]
20572 !! wikitext
20573 [[Image:Foobar.jpg|frameless|right]]
20574 !! wikitext/edited
20575 [[Image:Foobar.jpg|frameless|right|220x220px]]
20576 !! end
20578 !! test
20579 Image: Modifying valign of an image (bug 49221)
20580 !! options
20581 parsoid={
20582   "modes": ["wt2wt"],
20583   "changes": [
20584     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
20585     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
20586   ]
20588 !! wikitext
20589 [[File:Foobar.jpg|20px|middle]]
20590 !! wikitext/edited
20591 [[File:Foobar.jpg|20px|text-top]]
20592 !! end
20594 !! test
20595 Image: Modifying alt attribute of an image (bug 56400)
20596 !! options
20597 parsoid={
20598   "modes": ["wt2wt"],
20599   "changes": [
20600     ["img[alt]", "attr", "alt", "some alternate edited text"]
20601   ]
20603 !! wikitext
20604 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
20605 !! wikitext/edited
20606 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
20607 !!end
20609 !! test
20610 Image: Modifying caption of an image
20611 !! options
20612 parsoid={
20613   "modes": ["wt2wt"],
20614   "changes": [
20615     ["figcaption", "text", "new caption"]
20616   ]
20618 !! wikitext
20619 [[Image:Foobar.jpg|thumb|original caption]]
20620 !! wikitext/edited
20621 [[Image:Foobar.jpg|thumb|new caption]]
20622 !!end
20624 !! test
20625 Image: empty alt attribute (bug 48924)
20626 !! options
20627 parsoid
20628 !! wikitext
20629 [[File:Foobar.jpg|thumb|alt=|bar]]
20630 !! html
20631 <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>
20632 !! end
20634 #!! test
20635 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
20636 #!! options
20637 #parsoid=html2wt
20638 #language=ar
20639 #!! input
20640 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
20641 #!! result
20642 #<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>
20643 #!! end
20645 !! test
20646 Image: Block level image should have \n before and after
20647 !! options
20648 parsoid
20649 !! wikitext
20651 [[File:Foobar.jpg|right|thumb|150x150px]]
20653 !! html
20654 <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>
20655 !!end
20657 !! test
20658 Image: New block level image should have \n before and after (existing
20659 content)
20660 !! options
20661 parsoid
20662 !! wikitext
20664 [[File:Foobar.jpg|right|thumb|150x150px]]
20666 !! html
20667 <p data-parsoid='{"dsr":[0,3,0,0]}'>123</p>
20668 <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>
20669 <p data-parsoid='{"dsr":[46,49,0,0]}'>456</p>
20670 !!end
20672 !! test
20673 Image: upright option (parsoid)
20674 !! options
20675 parsoid
20676 !! wikitext
20677 [[File:Foobar.jpg|thumb|upright|caption]]
20678 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
20679 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
20680 !! html
20681 <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>
20682 !!end
20684 !! test
20685 Image: upright option is ignored on inline and frame images (parsoid)
20686 !! options
20687 parsoid
20688 !! wikitext
20689 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
20690 !! html
20691 <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>
20692 !!end
20694 !! test
20695 Image: from basic HTML (1)
20696 !! options
20697 parsoid=html2wt
20698 !! html/parsoid
20699 <span typeof="mw:Image">
20700   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20701 </span>
20702 !! wikitext
20703 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20704 !! end
20706 !! test
20707 Image: from basic HTML (2)
20708 !! options
20709 parsoid=html2wt
20710 !! html/parsoid
20711 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
20712 !! wikitext
20713 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
20714 !! end
20716 !! test
20717 Image: from basic HTML (3)
20718 !! options
20719 parsoid=html2wt
20720 !! html/parsoid
20721 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
20722 !! wikitext
20723 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
20724 !! end
20726 !! test
20727 Image: from basic HTML (4)
20728 !! options
20729 parsoid=html2wt
20730 !! html/parsoid
20731 <img src="File:Foobar.jpg">
20732 !! wikitext
20733 [[File:Foobar.jpg|link=]]
20734 !! end
20736 !! test
20737 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
20738 !! options
20739 parsoid=html2wt
20740 !! wikitext
20741 * foo
20742 !! html
20743 <ul>
20744 <li><p>foo</p></li>
20745 </ul>
20746 !! end
20748 !! test
20749 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
20750 !! options
20751 parsoid=html2wt
20752 !! wikitext
20753 * foo
20754 !! html
20755 <ul> <li>foo</li></ul>
20756 !! end
20758 !! test
20759 Don't strip leading whitespace when handling indent-pre suppressing tags
20760 !! options
20761 parsoid=html2wt
20762 !! wikitext
20764   | indented row
20766 <blockquote>
20767  '''This is very bold of you!'''
20771  indented cell (no pre-wrapping!)
20773 </blockquote>
20775  <div>bar</div>
20776 !! html
20777 <table>
20778   <tr><td> indented row</td></tr>
20779 </table>
20780 <blockquote><p>
20781  <b>This is very bold of you!</b>
20782 </p>
20783 <table><tr><td>
20784  indented cell (no pre-wrapping!)
20785 </td></tr></table>
20786 </blockquote>
20787 <p>foo</p>
20788  <div>bar</div>
20789 !! end
20791 !! test
20792 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
20793 !! options
20794 parsoid=html2wt
20795 !! wikitext
20797 <nowiki> </nowiki><span>bar</span>
20799 <span>foo2
20800 <nowiki> </nowiki></span>bar2
20802 <div>foo</div>
20803 <nowiki> </nowiki><span>bar</span>
20805 <div>
20806 <nowiki> </nowiki><span>foo</span>
20807 </div>
20808 !! html
20809 <p>foo</p>
20810  <span>bar</span>
20812 <span>foo2
20813  </span>bar2
20815 <div>foo</div>
20816  <span>bar</span>
20818 <div>
20819  <span>foo</span>
20820 </div>
20821 !! end
20823 !! test
20824 Lists: Add space after bullets
20825 !! options
20826 parsoid=html2wt
20827 !! wikitext
20828 * foo
20829 * bar
20830 * <span> baz</span>
20831 !! html
20832 <ul>
20833 <li>foo</li>
20834 <li> bar</li>
20835 <li><span> baz</span></li>
20836 </ul>
20837 !! end
20839 !! test
20840 Lists: Dont insert newlines in a serialized list item.
20841 !! options
20842 parsoid=html2wt
20843 !! wikitext
20844 * a<br>b
20845 * c
20846 !! html
20847 <ul><li>a<br>b</li><li>c</li></ul>
20848 !! end
20850 !! test
20851 Headings: Add space before/after == (Bug 51744)
20852 !! options
20853 parsoid=html2wt
20854 !! wikitext
20855 == foo ==
20857 == bar ==
20859 == baz ==
20861 == <span> baz</span> ==
20862 !! html
20863 <h2>foo</h2>
20864 <h2> bar</h2>
20865 <h2>baz </h2>
20866 <h2><span> baz</span></h2>
20867 !! end
20869 !! test
20870 Parsoid: Serialize positional parameters with = in them as named parameter
20871 !! options
20872 parsoid=html2wt
20873 !! wikitext
20874 {{echo|1 = f=oo}}
20876 {{echo|1 = f=oo|2 = bar}}
20878 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20879 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20880 {{echo|<nowiki>f=oo</nowiki>|bar}}
20881 !! html
20882 <p about="#mwt1" typeof="mw:Transclusion"
20883 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
20885 <p about="#mwt1" typeof="mw:Transclusion"
20886 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
20888 <!--Orig params with data-parsoid has heuristics for handling = chars-->
20889 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
20890 <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>
20891 !! end
20893 !! test
20894 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
20895 !! options
20896 parsoid=html2wt
20897 !! wikitext
20898 <div>a
20900 </div>
20901 <div>a
20903 </div>
20904 <div>
20908 </div>
20909 !! html
20910 <div>a<p>b</p></div>
20911 <div>a
20912 <p>b</p></div>
20913 <div>
20915 <p>b</p></div>
20916 !! end
20918 !! test
20919 Substrings resembling wikitext in hrefs should not get nowiki escapes
20920 !! options
20921 parsoid=html2wt
20922 !! wikitext
20923 [[Foo''bar''baz]]
20924 !! html
20925 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
20926 !! end
20928 #-----------------------------
20929 # I/B quote minimization tests
20930 #-----------------------------
20932 !! test
20933 1. I/B quote minimization: wikitext-only tags should be combined
20934 !! options
20935 parsoid=html2wt
20936 !! wikitext
20937 ''AB''
20939 '''AB'''
20941 ''A'''B'''''
20943 '''A''B'''''
20945 '''A''BC''D'''
20947 '''''AB'''''
20949 '''''AB'''''
20951 '''''AB'''''
20952 !! html
20953 <p><i>A</i><i>B</i></p>
20954 <p><b>A</b><b>B</b></p>
20955 <p><i>A</i><b><i>B</i></b></p>
20956 <p><b>A</b><i><b>B</b></i></p>
20957 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
20958 <p><i><b>A</b></i><i><b>B</b></i></p>
20959 <p><i><b>A</b></i><b><i>B</i></b></p>
20960 <p><b><i>A</i></b><i><b>B</b></i></p>
20961 !! end
20963 !! test
20964 2. I/B quote minimization: wikitext and html tags should not be combined
20965 !! options
20966 parsoid=html2wt
20967 !! wikitext
20968 ''A''<i>B</i>
20970 ''A'''''<i>B</i>'''
20971 !! html
20972 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
20973 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
20974 !! end
20976 !! test
20977 3. I/B quote minimization: templated content stops minimization
20978 !! options
20979 parsoid=html2wt
20980 !! wikitext
20981 ''A''{{echo|''B''}}
20983 ''A''{{echo|'''''B'''''}}
20984 !! html
20985 <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>
20986 <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>
20987 !! end
20989 !! test
20990 4. I/B quote minimization: new content should be mimimized with adjacent old content
20991 !! options
20992 parsoid=html2wt
20993 !! wikitext
20994 ''AB''
20996 '''AB'''
20998 ''A'''B'''''
20999 !! html
21000 <p><i>A</i><i data-parsoid='{}'>B</i></p>
21001 <p><b data-parsoid='{}'>A</b><b>B</b></p>
21002 <p><i>A</i><b data-parsoid='{}'><i data-parsoid='{}'>B</i></b></p>
21003 !! end
21005 #------------------------------------
21006 # End of I/B quote minimization tests
21007 #------------------------------------
21009 !!test
21010 Bug 54262: New entities
21011 !! options
21012 parsoid=html2wt
21013 !! wikitext
21014 &nbsp;
21015 !! html
21016 <span typeof="mw:Entity">&nbsp;</span>
21017 !! end
21019 ## Note that there is no wikitext output for 'unknownproperty' ##
21020 ## Unknown magic words are silently dropped ##
21022 !! test
21023 Magic words
21024 !! options
21025 parsoid=html2wt
21026 !! wikitext
21027 __TOC__
21028 __NOTOC__
21029 __FORCETOC__
21030 __INDEX__
21031 __NOINDEX__
21032 __NOGALLERY__
21033 __NOEDITSECTION__
21034 __NOTITLECONVERT__
21035 __NOCONTENTCONVERT__
21036 !! html
21037 <meta property='mw:PageProp/toc' />
21038 <meta property='mw:PageProp/notoc' />
21039 <meta property='mw:PageProp/forcetoc' />
21040 <meta property='mw:PageProp/index' />
21041 <meta property='mw:PageProp/noindex' />
21042 <meta property='mw:PageProp/nogallery' />
21043 <meta property='mw:PageProp/noeditsection' />
21044 <meta property='mw:PageProp/notitleconvert' />
21045 <meta property='mw:PageProp/nocontentconvert' />
21046 <meta property='mw:PageProp/unknownproperty' />
21047 !! end
21049 !! test
21050 Consecutive <pre>s should not get merged
21051 !! options
21052 parsoid=html2wt,html2html
21053 !! wikitext
21067 !! html
21068 <pre>a</pre><pre>b</pre>
21070 <pre>c
21071 </pre><pre>
21072 d</pre>
21074 <pre>e
21076 </pre><pre>
21078 f</pre>
21079 !! end
21081 !! test
21082 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
21083 !! options
21084 parsoid=html2wt
21085 !! wikitext
21086 [[Special:BookSources/1234567890|ISBN 1234567895]]
21087 !! html
21088 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
21089 !! end
21091 !! test
21092 Edited RFC links not serializable as RFC links should serialize as extlinks
21093 !! options
21094 parsoid=html2wt
21095 !! wikitext
21096 [//tools.ietf.org/html/rfc123 New RFC]
21097 !! html
21098 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
21099 !! end
21101 !! test
21102 Edited PMID links not serializable as PMID links should serialize as extlinks
21103 !! options
21104 parsoid=html2wt
21105 !! wikitext
21106 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
21107 !! html
21108 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
21109 !! end
21111 !! test
21112 Edited Redirect link should emit a non-piped wikitext link
21113 !! options
21114 parsoid=html2wt
21115 !! wikitext
21116 #REDIRECT [[Bar]]
21117 !! html
21118 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
21119 !! end
21121 # -----------------------------------------------------------------
21122 # End of section for Parsoid-only html2wt tests for serialization
21123 # of new content
21124 # -----------------------------------------------------------------
21126 TODO:
21127 more images
21128 more tables
21129 character entities
21130 and much more
21131 Try for 100% code coverage