Parser: Don't generate an external link on "http://)" and similar
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
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
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_header_cells
165 !! text
166 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
167 !! endarticle
168
169 !! article
170 Template:table_cells
171 !! text
172 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
173 !! endarticle
174
175 !! article
176 Template:PartialTable
177 !! text
178 {|
179 |-
180 !! endarticle
181
182 !! article
183 Template:image_attribs
184 !! text
185 <noinclude>
186 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
187 !! endarticle
188
189 ## See T48811 for details
190 !! article
191 Template:mixed_attr_content_template
192 !! text
193 style="color:red;" title="T48811"
194 |-
195 |foo
196 !! endarticle
197
198 !! article
199 Template:definition_list
200 !! text
201 one
202 ::two
203 !! endarticle
204
205 !! article
206 A?b
207 !! text
208 Weirdo titles!
209 !! endarticle
210
211 !!article
212 Template:Bullet
213 !!text
214 * Bar
215 !!endarticle
216
217 !!article
218 Template:OpenTable
219 !!text
220 {|
221 !!endarticle
222
223 !!article
224 Template:EmptyLITest
225 !!text
226 *a
227 *
228 *
229 *b
230 !!endarticle
231
232 !!article
233 Template:EmptyTRTest
234 !!text
235 {|
236 |-
237 |-
238 |foo
239 |-
240 |-
241 |bar
242 |}
243 !!endarticle
244
245 !!article
246 Template:EmptyTRWithHTMLAttrTest
247 !!text
248 <table>
249 <tr align="center"></tr>
250 <tr><td>foo</td></tr>
251 <tr align="center"></tr>
252 <tr><td>bar</td></tr>
253 </table>
254 !!endarticle
255
256 ###
257 ### Basic tests
258 ###
259 !! test
260 Blank input
261 !! wikitext
262 !! html
263 !! end
264
265
266 !! test
267 Simple paragraph
268 !! wikitext
269 This is a simple paragraph.
270 !! html
271 <p>This is a simple paragraph.
272 </p>
273 !! end
274
275 !! test
276 Paragraphs with extra newline spacing
277 !! wikitext
278 foo
279
280 bar
281
282
283 baz
284
285
286
287 booz
288 !! html
289 <p>foo
290 </p><p>bar
291 </p><p><br />
292 baz
293 </p><p><br />
294 </p><p>booz
295 </p>
296 !! end
297
298 !! test
299 Paragraphs with newline spacing with comment lines in between
300 !! wikitext
301 ----
302 a
303 <!--foo-->
304 b
305 ----
306 a
307 <!--foo--><!--More than 1 comment, still stripped-->
308 b
309 ----
310 a
311 <!--foo--> <!----> <!-- bar -->
312 b
313 ----
314 a
315 <!--foo-->
316
317 b
318 ----
319 a
320
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo-->
326
327
328 b
329 ----
330 a
331
332
333 <!--foo-->
334 b
335 ----
336 !! html
337 <hr />
338 <p>a
339 b
340 </p>
341 <hr />
342 <p>a
343 b
344 </p>
345 <hr />
346 <p>a
347 b
348 </p>
349 <hr />
350 <p>a
351 </p><p>b
352 </p>
353 <hr />
354 <p>a
355 </p><p>b
356 </p>
357 <hr />
358 <p>a
359 </p><p><br />
360 b
361 </p>
362 <hr />
363 <p>a
364 </p><p><br />
365 b
366 </p>
367 <hr />
368
369 !! end
370
371 !! test
372 Paragraphs with newline spacing with non-empty white-space lines in between
373 !! wikitext
374 ----
375 a
376
377 b
378 ----
379 a
380
381
382 b
383 ----
384 !! html
385 <hr />
386 <p>a
387 </p><p>b
388 </p>
389 <hr />
390 <p>a
391 </p><p><br />
392 b
393 </p>
394 <hr />
395
396 !! end
397
398 !! test
399 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
400 !! wikitext
401 ----
402 a
403 <!--foo-->
404 b
405 ----
406 a
407 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
408 b
409 ----
410 a
411
412 <!--foo-->
413 <!--bar-->
414 b
415 ----
416 a
417
418 <!--foo-->
419 <!--bar-->
420
421 b
422 ----
423 !! html
424 <hr />
425 <p>a
426 b
427 </p>
428 <hr />
429 <p>a
430 b
431 </p>
432 <hr />
433 <p>a
434 </p><p>b
435 </p>
436 <hr />
437 <p>a
438 </p><p><br />
439 b
440 </p>
441 <hr />
442
443 !! end
444
445 !! test
446 Extra newlines: More paragraphs with indented comment
447 !! wikitext
448 a
449
450 <!--boo-->
451
452 b
453 !! html
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 !!end
459
460 !! test
461 Extra newlines followed by heading
462 !! wikitext
463 a
464
465
466
467 =b=
468 [[a]]
469
470
471 =b=
472 !! html
473 <p>a
474 </p><p><br />
475 </p>
476 <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>
477 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
478 </p><p><br />
479 </p>
480 <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>
481
482 !! end
483
484 !! test
485 Extra newlines between heading and content are swallowed
486 !! wikitext
487 =b=
488
489
490
491 [[a]]
492 !! html
493 <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>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p>
496 !! end
497
498 !! test
499 Parsing an URL
500 !! wikitext
501 http://fr.wikipedia.org/wiki/🍺
502 <!-- EasterEgg we love beer, better be able be able to link to it -->
503 !! html
504 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
505 </p>
506 !! end
507
508 # Note that the html+tidy output removes the spaces after the <li>,
509 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
510 # This is an issue for all tests with lists. We intentionally do
511 # *not* add html+tidy clauses for these, as we don't want to
512 # document/test the broken behavior. (Parsoid matches the non-tidy
513 # output in these cases.)
514
515 !! test
516 Simple list
517 !! wikitext
518 * Item 1
519 * Item 2
520 !! html
521 <ul><li> Item 1</li>
522 <li> Item 2</li></ul>
523
524 !! end
525
526 !! test
527 Italics and bold
528 !! wikitext
529 * plain
530 * plain''italic''plain
531 * plain''italic''plain''italic''plain
532 * plain'''bold'''plain
533 * plain'''bold'''plain'''bold'''plain
534 * plain''italic''plain'''bold'''plain
535 * plain'''bold'''plain''italic''plain
536 * plain''italic'''bold-italic'''italic''plain
537 * plain'''bold''bold-italic''bold'''plain
538 * plain'''''bold-italic'''italic''plain
539 * plain'''''bold-italic''bold'''plain
540 * plain''italic'''bold-italic'''''plain
541 * plain'''bold''bold-italic'''''plain
542 * plain l'''italic''plain
543 * plain l''''bold''' plain
544 !! html
545 <ul><li> plain</li>
546 <li> plain<i>italic</i>plain</li>
547 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
548 <li> plain<b>bold</b>plain</li>
549 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
550 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
551 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
552 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
553 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
554 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
555 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
556 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
557 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
558 <li> plain l'<i>italic</i>plain</li>
559 <li> plain l'<b>bold</b> plain</li></ul>
560
561 !! end
562
563 # this example taken from the [[simple:Moon]] article (bug 47326)
564 !! test
565 Italics and possessives (1)
566 !! wikitext
567 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
568 !! html
569 <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
570 </p>
571 !! end
572
573 # this example taken from [[en:Flaming Pie]] (bug 49926)
574 !! test
575 Italics and possessives (2)
576 !! wikitext
577 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
578 !! html
579 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
580 </p>
581 !! end
582
583 # this example taken from [[en:Dictionary]] (bug 49926)
584 !! test
585 Italics and possessives (3)
586 !! wikitext
587 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''.
588 !! html
589 <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>.
590 </p>
591 !! end
592
593
594 ###
595 ### 2-quote opening sequence tests
596 ###
597 !! test
598 Italics and bold: 2-quote opening sequence: (2,2)
599 !! wikitext
600 ''foo''
601 !! html
602 <p><i>foo</i>
603 </p>
604 !!end
605
606 !! test
607 Italics and bold: 2-quote opening sequence: (2,3)
608 !! wikitext
609 ''foo'''
610 !! html/*
611 <p><i>foo'</i>
612 </p>
613 !!end
614
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,4)
617 !! options
618 parsoid=wt2html
619 !! wikitext
620 ''foo''''
621 !! html/*
622 <p><i>foo''</i>
623 </p>
624 !!end
625
626 # same html as previous, but wikitext adjusted to match parsoid html2wt
627 !! test
628 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
629 !! wikitext
630 ''foo<nowiki>''</nowiki>''
631 !! html
632 <p><i>foo''</i>
633 </p>
634 !! end
635
636 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
637 !! test
638 Italics and bold: 2-quote opening sequence: (2,5)
639 !! options
640 parsoid=wt2html
641 !! wikitext
642 ''foo'''''
643 !! html/php
644 <p><i>foo</i>
645 </p>
646 !! html/parsoid
647 <p><i>foo</i><b></b>
648 </p>
649 !!end
650
651 # same html as previous, but wikitext adjusted to match parsoid html2wt
652 !! test
653 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
654 !! wikitext
655 ''foo'''''<nowiki/>'''
656 !! html/php
657 <p><i>foo</i>
658 </p>
659 !! html/parsoid
660 <p><i>foo</i><b></b>
661 </p>
662 !! end
663
664
665 ###
666 ### 3-quote opening sequence tests
667 ###
668
669 !! test
670 Italics and bold: 3-quote opening sequence: (3,2)
671 !! wikitext
672 '''foo''
673 !! html/*
674 <p>'<i>foo</i>
675 </p>
676 !!end
677
678 !! test
679 Italics and bold: 3-quote opening sequence: (3,3)
680 !! wikitext
681 '''foo'''
682 !! html
683 <p><b>foo</b>
684 </p>
685 !!end
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,4)
689 !! wikitext
690 '''foo''''
691 !! html/*
692 <p><b>foo'</b>
693 </p>
694 !!end
695
696 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
697 !! test
698 Italics and bold: 3-quote opening sequence: (3,5)
699 !! options
700 parsoid=wt2html
701 !! wikitext
702 '''foo'''''
703 !! html/php
704 <p><b>foo</b>
705 </p>
706 !! html/parsoid
707 <p><b>foo</b><i></i>
708 </p>
709 !!end
710
711 # same html as previous, but wikitext adjusted to match parsoid html2wt
712 !! test
713 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
714 !! wikitext
715 '''foo'''''<nowiki/>''
716 !! html/php
717 <p><b>foo</b>
718 </p>
719 !! html/parsoid
720 <p><b>foo</b><i></i>
721 </p>
722 !! end
723
724
725 ###
726 ### 4-quote opening sequence tests
727 ###
728
729 !! test
730 Italics and bold: 4-quote opening sequence: (4,2)
731 !! options
732 parsoid=wt2html
733 !! wikitext
734 ''''foo''
735 !! html/*
736 <p>''<i>foo</i>
737 </p>
738 !!end
739
740 # same html as previous, but wikitext adjusted to match parsoid html2wt
741 !! test
742 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
743 !! wikitext
744 <nowiki>''</nowiki>''foo''
745 !! html
746 <p>''<i>foo</i>
747 </p>
748 !! end
749
750 !! test
751 Italics and bold: 4-quote opening sequence: (4,3)
752 !! wikitext
753 ''''foo'''
754 !! html/*
755 <p>'<b>foo</b>
756 </p>
757 !!end
758
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,4)
761 !! options
762 parsoid=wt2html
763 !! wikitext
764 ''''foo''''
765 !! html/*
766 <p>'<b>foo'</b>
767 </p>
768 !!end
769
770 # same html as previous, but wikitext adjusted to match parsoid html2wt
771 !! test
772 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
773 !! wikitext
774 '<nowiki/>'''foo''''
775 !! html
776 <p>'<b>foo'</b>
777 </p>
778 !! end
779
780 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
781 !! test
782 Italics and bold: 4-quote opening sequence: (4,5)
783 !! options
784 parsoid=wt2html
785 !! wikitext
786 ''''foo'''''
787 !! html/php
788 <p>'<b>foo</b>
789 </p>
790 !! html/parsoid
791 <p>'<b>foo</b><i></i>
792 </p>
793 !!end
794
795 # same html as previous, but wikitext adjusted to match parsoid html2wt
796 !! test
797 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
798 !! wikitext
799 '<nowiki/>'''foo'''''<nowiki/>''
800 !! html/php
801 <p>'<b>foo</b>
802 </p>
803 !! html/parsoid
804 <p>'<b>foo</b><i></i>
805 </p>
806 !! end
807
808
809 ###
810 ### 5-quote opening sequence tests
811 ###
812
813 !! test
814 Italics and bold: 5-quote opening sequence: (5,2)
815 !! options
816 parsoid=wt2html
817 !! wikitext
818 '''''foo''
819 !! html/*
820 <p><b><i>foo</i></b>
821 </p>
822 !!end
823
824 # same html as previous, but wikitext adjusted to match parsoid html2wt
825 # skipping wt2html and html2html because it wants to put <i> before <b>
826 !! test
827 Italics and bold: 5-quote opening sequence: (5,2+3)
828 !! options
829 parsoid=wt2wt,html2wt
830 !! wikitext
831 '''''foo'''''
832 !! html
833 <p><b><i>foo</i></b>
834 </p>
835 !! end
836
837 !! test
838 Italics and bold: 5-quote opening sequence: (5,3)
839 !! options
840 parsoid=wt2html
841 !! wikitext
842 '''''foo'''
843 !! html/*
844 <p><i><b>foo</b></i>
845 </p>
846 !!end
847
848 # same html as previous, but wikitext adjusted to match parsoid html2wt
849 !! test
850 Italics and bold: 5-quote opening sequence: (5,3+2)
851 !! wikitext
852 '''''foo'''''
853 !! html
854 <p><i><b>foo</b></i>
855 </p>
856 !! end
857
858 !! test
859 Italics and bold: 5-quote opening sequence: (5,4)
860 !! options
861 parsoid=wt2html
862 !! wikitext
863 '''''foo''''
864 !! html/*
865 <p><i><b>foo'</b></i>
866 </p>
867 !!end
868
869 !! test
870 Italics and bold: 5-quote opening sequence: (5,5)
871 !! wikitext
872 '''''foo'''''
873 !! html
874 <p><i><b>foo</b></i>
875 </p>
876 !!end
877
878 !! test
879 Italics and bold: 5-quote opening sequence: (5,6)
880 !! wikitext
881 '''''foo''''''
882 !! html/*
883 <p><i><b>foo'</b></i>
884 </p>
885 !! end
886
887 ###
888 ### multiple quote sequences in a line
889 ###
890 !! test
891 Italics and bold: multiple quote sequences: (2,4,2)
892 !! options
893 parsoid=wt2html
894 !! wikitext
895 ''foo''''bar''
896 !! html/*
897 <p><i>foo'<b>bar</b></i>
898 </p>
899 !!end
900
901
902 # same html as previous, but wikitext adjusted to match parsoid html2wt
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
905 !! wikitext
906 ''foo'<nowiki/>'''bar'''''
907 !! html
908 <p><i>foo'<b>bar</b></i>
909 </p>
910 !! end
911
912
913 !! test
914 Italics and bold: multiple quote sequences: (2,4,3)
915 !! options
916 parsoid=wt2html
917 !! wikitext
918 ''foo''''bar'''
919 !! html/*
920 <p><i>foo'<b>bar</b></i>
921 </p>
922 !!end
923
924
925 # same html as previous, but wikitext adjusted to match parsoid html2wt
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
928 !! wikitext
929 ''foo'<nowiki/>'''bar'''''
930 !! html
931 <p><i>foo'<b>bar</b></i>
932 </p>
933 !! end
934
935
936 !! test
937 Italics and bold: multiple quote sequences: (2,4,4)
938 !! options
939 parsoid=wt2html
940 !! wikitext
941 ''foo''''bar''''
942 !! html/*
943 <p><i>foo'<b>bar'</b></i>
944 </p>
945 !!end
946
947
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'<nowiki/>'''''
953 !! html
954 <p><i>foo'<b>bar'</b></i>
955 </p>
956 !! end
957
958
959 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
960 !! test
961 Italics and bold: multiple quote sequences: (3,4,2)
962 !! options
963 parsoid=wt2html
964 !! wikitext
965 '''foo''''bar''
966 !! html/php
967 <p><b>foo'</b>bar
968 </p>
969 !! html/parsoid
970 <p><b>foo'</b>bar<i></i>
971 </p>
972 !!end
973
974 # same html as previous, but wikitext adjusted to match parsoid html2wt
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
977 !! options
978 parsoid
979 !! wikitext
980 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
986 </p>
987 !! end
988
989
990 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
991 !! test
992 Italics and bold: multiple quote sequences: (3,4,3)
993 !! options
994 parsoid=wt2html
995 !! wikitext
996 '''foo''''bar'''
997 !! html/php
998 <p><b>foo'</b>bar
999 </p>
1000 !! html/parsoid
1001 <p><b>foo'</b>bar<b></b>
1002 </p>
1003 !!end
1004
1005 # same html as previous, but wikitext adjusted to match parsoid html2wt
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1008 !! wikitext
1009 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1015 </p>
1016 !! end
1017
1018 ###
1019 ### other quote tests
1020 ###
1021 !! test
1022 Italics and bold: other quote tests: (2,3,5)
1023 !! wikitext
1024 ''this is about '''foo's family'''''
1025 !! html
1026 <p><i>this is about <b>foo's family</b></i>
1027 </p>
1028 !!end
1029
1030
1031 !! test
1032 Italics and bold: other quote tests: (2,(3,3),2)
1033 !! wikitext
1034 ''this is about '''foo's''' family''
1035 !! html
1036 <p><i>this is about <b>foo's</b> family</i>
1037 </p>
1038 !!end
1039
1040
1041 !! test
1042 Italics and bold: other quote tests: (3,2,3,2)
1043 !! options
1044 parsoid=wt2html
1045 !! wikitext
1046 '''this is about ''foo'''s family''
1047 !! html/*
1048 <p><b>this is about <i>foo</i></b><i>s family</i>
1049 </p>
1050 !!end
1051
1052
1053 # same html as previous, but wikitext adjusted to match parsoid html2wt
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3+2+2,2)
1056 !! wikitext
1057 '''this is about ''foo'''''<nowiki/>''s family''
1058 !! html
1059 <p><b>this is about <i>foo</i></b><i>s family</i>
1060 </p>
1061 !! end
1062
1063
1064 !! test
1065 Italics and bold: other quote tests: (3,2,3,3)
1066 !! wikitext
1067 '''this is about ''foo'''s family'''
1068 !! html/*
1069 <p>'<i>this is about </i>foo<b>s family</b>
1070 </p>
1071 !!end
1072
1073
1074 !! test
1075 Italics and bold: other quote tests: (3,(2,2),3)
1076 !! wikitext
1077 '''this is about ''foo's'' family'''
1078 !! html
1079 <p><b>this is about <i>foo's</i> family</b>
1080 </p>
1081 !!end
1082
1083
1084 !! test
1085 Italicized possessive
1086 !! wikitext
1087 The ''[[Main Page]]'''s talk page.
1088 !! html/php
1089 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1090 </p>
1091 !! html/parsoid
1092 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1093 !! end
1094
1095 !! test
1096 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1097 (Requires tidy for PHP parser output to be fixed up)
1098 !! options
1099 parsoid=wt2html,wt2wt
1100 !! wikitext
1101 {|
1102 !''a!!''b
1103 |''a||''b
1104 |}
1105 !! html/php+tidy
1106 <table>
1107 <tr>
1108 <th><i>a</i></th>
1109 <th><i>b</i></th>
1110 <td><i>a</i></td>
1111 <td><i>b</i></td>
1112 </tr>
1113 </table>
1114 !! html/parsoid
1115 <table>
1116 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1117 <td><i>a</i></td><td><i>b</i></td></tr>
1118 </tbody></table>
1119 !! end
1120
1121 ###
1122 ### Non-html5 tags
1123 ###
1124
1125 !! test
1126 Non-html5 tags should be accepted
1127 !! wikitext
1128 <center>''foo''</center>
1129 <big>''foo''</big>
1130 <font>''foo''</font>
1131 <strike>''foo''</strike>
1132 <tt>''foo''</tt>
1133 !! html
1134 <center><i>foo</i></center>
1135 <p><big><i>foo</i></big>
1136 <font><i>foo</i></font>
1137 <strike><i>foo</i></strike>
1138 <tt><i>foo</i></tt>
1139 </p>
1140 !! end
1141
1142 !! test
1143 <wbr> is valid wikitext (bug 52468)
1144 !! wikitext
1145 <wbr>
1146 !! html
1147 <p><wbr />
1148 </p>
1149 !! end
1150
1151 # <strike> is HTML4, <s> is HTML4/5.
1152 !! test
1153 <s> or <strike> for strikethrough
1154 !! wikitext
1155 <strike>strike</strike>
1156
1157 <s>s</s>
1158 !! html
1159 <p><strike>strike</strike>
1160 </p><p><s>s</s>
1161 </p>
1162 !! end
1163
1164 ## a not permitted
1165 ## i,b,br omitted
1166 !! test
1167 Text-level semantic html elements in wikitext
1168 !! wikitext
1169 <em>text</em>
1170 <strong>text</strong>
1171 <small>text</small>
1172 <s>text</s>
1173 <cite>text</cite>
1174 <q>text</q>
1175 <dfn>text</dfn>
1176 <abbr>text</abbr>
1177 <data>text</data>
1178 <time>text</time>
1179 <code>text</code>
1180 <var>text</var>
1181 <samp>text</samp>
1182 <kbd>text</kbd>
1183 <sub>text</sub>
1184 <u>text</u>
1185 <mark>text</mark>
1186 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1187 <bdi>text</bdi>
1188 <bdo>text</bdo>
1189 <span>text</span>
1190 <wbr />
1191 !! html
1192 <p><em>text</em>
1193 <strong>text</strong>
1194 <small>text</small>
1195 <s>text</s>
1196 <cite>text</cite>
1197 <q>text</q>
1198 <dfn>text</dfn>
1199 <abbr>text</abbr>
1200 <data>text</data>
1201 <time>text</time>
1202 <code>text</code>
1203 <var>text</var>
1204 <samp>text</samp>
1205 <kbd>text</kbd>
1206 <sub>text</sub>
1207 <u>text</u>
1208 <mark>text</mark>
1209 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1210 <bdi>text</bdi>
1211 <bdo>text</bdo>
1212 <span>text</span>
1213 <wbr />
1214 </p>
1215 !! end
1216
1217 # test cases taken from
1218 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1219 !! test
1220 Ruby markup (W3C-style)
1221 !! wikitext
1222 ; Mono-ruby for individual base characters
1223 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1224 ; Group ruby
1225 : <ruby>今日<rt>きょう</rt></ruby>
1226 ; Jukugo ruby
1227 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1228 ; Inline ruby
1229 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1230 ; Double-sided ruby
1231 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1232 <ruby>
1233 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1234 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1235 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1236 </ruby>
1237 !! html
1238 <dl><dt> Mono-ruby for individual base characters</dt>
1239 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1240 <dt> Group ruby</dt>
1241 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1242 <dt> Jukugo ruby</dt>
1243 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1244 <dt> Inline ruby</dt>
1245 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1246 <dt> Double-sided ruby</dt>
1247 <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>
1248 <p><ruby>
1249 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1250 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1251 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1252 </ruby>
1253 </p>
1254 !! end
1255
1256 # The next two test different paths in the sanitizer.
1257 !! test
1258 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1259 !! wikitext
1260 <blockquote|>a</blockquote>
1261
1262 <b→> doesn't terminate </b→>
1263
1264 <bä> doesn't terminate </bä>
1265
1266 <boo> doesn't terminate </boo>
1267
1268 <s.foo> doesn't terminate </s.foo>
1269
1270 <sub-ID#1>
1271 !! html
1272 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1273 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1274 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1275 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1276 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1277 </p><p>&lt;sub-ID#1&gt;
1278 </p>
1279 !! end
1280
1281 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1282 # If the non-word-character tag made it through the sanitizer, tidy
1283 # would munge it up.
1284 !! test
1285 Non-word characters don't terminate tag names + tidy
1286 !! wikitext
1287 <blockquote|>a</blockquote>
1288
1289 <b→> doesn't terminate </b→>
1290
1291 <bä> doesn't terminate </bä>
1292
1293 <boo> doesn't terminate </boo>
1294
1295 <s.foo> doesn't terminate </s.foo>
1296
1297 <sub-ID#1>
1298 !! html+tidy
1299 <p>&lt;blockquote|&gt;a</p>
1300 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1301 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1302 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1303 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1304 <p>&lt;sub-ID#1&gt;</p>
1305 !! end
1306
1307 ###
1308 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1309 ### This checks that HTML5 tags (with non-word characters in the tag
1310 ### name) make it safely through the parser -- the Sanitizer will
1311 ### munge them later, as it should.
1312 ###
1313 !! test
1314 Non-word characters are valid in extension tags (T19663)
1315 !! wikitext
1316 <tåg>tåg</tåg>
1317 !! html
1318 <pre>
1319 'tåg'
1320 array (
1321 )
1322 </pre>
1323
1324 !! end
1325
1326 !! test
1327 Isolated close tags should be treated as literal text (bug 52760)
1328 !! wikitext
1329 </b>
1330
1331 <s.foo>s</s>
1332 !! html+tidy
1333 <p>&lt;s.foo&gt;s</p>
1334 !! end
1335
1336 ###
1337 ### Special characters
1338 ###
1339
1340 !! test
1341 Bare pipe character (bug 52363)
1342 !! wikitext
1343 |
1344 !! html
1345 <p>|
1346 </p>
1347 !! end
1348
1349 !! test
1350 Bare pipe character from a template (bug 52363)
1351 !! wikitext
1352 {{pipe}}
1353 !! html
1354 <p>|
1355 </p>
1356 !! end
1357
1358 ###
1359 ### <nowiki> test cases
1360 ###
1361
1362 !! test
1363 <nowiki> unordered list
1364 !! wikitext
1365 <nowiki>* This is not an unordered list item.</nowiki>
1366 !! html
1367 <p>* This is not an unordered list item.
1368 </p>
1369 !! end
1370
1371 !! test
1372 <nowiki> spacing
1373 !! wikitext
1374 <nowiki>Lorem ipsum dolor
1375
1376 sed abit.
1377 sed nullum.
1378
1379 :and a colon
1380 </nowiki>
1381 !! html
1382 <p>Lorem ipsum dolor
1383
1384 sed abit.
1385 sed nullum.
1386
1387 :and a colon
1388
1389 </p>
1390 !! end
1391
1392 !! test
1393 nowiki 3
1394 !! wikitext
1395 :There is not nowiki.
1396 :There is <nowiki>nowiki</nowiki>.
1397
1398 #There is not nowiki.
1399 #There is <nowiki>nowiki</nowiki>.
1400
1401 *There is not nowiki.
1402 *There is <nowiki>nowiki</nowiki>.
1403 !! html
1404 <dl><dd>There is not nowiki.</dd>
1405 <dd>There is nowiki.</dd></dl>
1406 <ol><li>There is not nowiki.</li>
1407 <li>There is nowiki.</li></ol>
1408 <ul><li>There is not nowiki.</li>
1409 <li>There is nowiki.</li></ul>
1410
1411 !! end
1412
1413 !! test
1414 Entities inside <nowiki>
1415 !! wikitext
1416 <nowiki>&lt;</nowiki>
1417 !! html
1418 <p>&lt;
1419 </p>
1420 !! end
1421
1422 !! test
1423 Entities inside template parameters
1424 !! options
1425 parsoid
1426 !! wikitext
1427 {{echo|&ndash;}}
1428 !! html
1429 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1430 !! end
1431
1432 !! test
1433 Properly escape nowiki when combined with other wiki markup
1434 !! options
1435 parsoid=html2wt
1436 !! html
1437 <p>* &lt;/nowiki&gt; tag</p>
1438 !! wikitext
1439 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1440 !! end
1441
1442 !! test
1443 T93824: Put escaped HTML tags inside nowiki
1444 !! options
1445 parsoid=html2wt
1446 !! html
1447 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1448 !! wikitext
1449 <nowiki><h2>foo</h2></nowiki>
1450 !! end
1451
1452 !! test
1453 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1454 !! options
1455 parsoid=html2wt
1456 !! html
1457 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1458 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1459 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1460 !! wikitext
1461 This text: L'[[Foo]]
1462 This text: L<nowiki>''</nowiki>[[Foo]]
1463 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1464 !! end
1465
1466 # This test fails because wikitext whitespace is not normalized before comparing.
1467 !! test
1468 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1469 !! options
1470 parsoid=html2wt
1471 !! html
1472 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1473 </p>
1474 !! wikitext
1475 This text : L<nowiki>''</nowiki>[[Foo]]
1476 !! end
1477
1478 # This test and the next one are html2wt only as they test that incorrect wikitext
1479 # passed in template arguments gets escaped or wrapped in nowikis where required.
1480 !! test
1481 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1482 !! options
1483 parsoid=html2wt
1484 !! html/parsoid
1485 <p><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;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1486 <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;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1487 !! wikitext
1488 {{echo|foo{{!}}bar}}
1489 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1490 !! end
1491
1492 !! test
1493 T53961: Output correct nowikis in template arguments
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p><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;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1498 <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;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1499 <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;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1500 <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;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1501 <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;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1502 !! wikitext
1503 {{echo|a [ b}}
1504 {{echo|a <nowiki>}}</nowiki> b}}
1505 {{echo|<nowiki>a [[ b</nowiki>}}
1506 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1507 {{echo|a <nowiki>}</nowiki>}}
1508 !! end
1509
1510 !! test
1511 Cases where "!!" needs nowiki protection
1512 !! options
1513 parsoid=html2wt
1514 !! html
1515 <table>
1516 <tr><th>this needs protection !! here</th></tr>
1517 </table>
1518
1519 <table>
1520 <tr><th>this does not need
1521 protection !! here</th></tr>
1522 </table>
1523 !! wikitext
1524 {|
1525 !<nowiki>this needs protection !! here</nowiki>
1526 |}
1527
1528 {|
1529 !this does not need
1530 protection !! here
1531 |}
1532 !! end
1533
1534 ###
1535 ### Comments
1536 ###
1537 !! test
1538 Comments and Indent-Pre
1539 !! wikitext
1540 <!-- comment 1 --> asdf
1541
1542 <!-- comment 1 --> asdf
1543 <!-- comment 2 -->
1544
1545 <!-- comment 1 --> asdf
1546 <!-- comment 2 -->xyz
1547
1548 <!-- comment 1 --> asdf
1549 <!-- comment 2 --> xyz
1550 !! html
1551 <pre>asdf
1552 </pre>
1553 <pre>asdf
1554 </pre>
1555 <pre>asdf
1556 </pre>
1557 <p>xyz
1558 </p>
1559 <pre>asdf
1560 xyz
1561 </pre>
1562 !! end
1563
1564 !! test
1565 Comment test 2a
1566 !! wikitext
1567 asdf
1568 <!-- comment 1 -->
1569 jkl
1570 !! html
1571 <p>asdf
1572 jkl
1573 </p>
1574 !! end
1575
1576 !! test
1577 Comment test 2b
1578 !! wikitext
1579 asdf
1580 <!-- comment 1 -->
1581
1582 jkl
1583 !! html
1584 <p>asdf
1585 </p><p>jkl
1586 </p>
1587 !! end
1588
1589 !! test
1590 Comment test 3
1591 !! wikitext
1592 asdf
1593 <!-- comment 1 -->
1594 <!-- comment 2 -->
1595 jkl
1596 !! html
1597 <p>asdf
1598 jkl
1599 </p>
1600 !! end
1601
1602 !! test
1603 Comment test 4
1604 !! wikitext
1605 asdf<!-- comment 1 -->jkl
1606 !! html
1607 <p>asdfjkl
1608 </p>
1609 !! end
1610
1611 !! test
1612 Comment spacing
1613 !! wikitext
1614 a
1615 <!-- foo --> b <!-- bar -->
1616 c
1617 !! html
1618 <p>a
1619 </p>
1620 <pre> b
1621 </pre>
1622 <p>c
1623 </p>
1624 !! end
1625
1626 !! test
1627 Comment whitespace
1628 !! wikitext
1629 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1630 !! html
1631
1632 !! end
1633
1634 !! test
1635 Comment semantics and delimiters
1636 !! wikitext
1637 <!-- --><!----><!-----><!------>
1638 !! html/php
1639
1640 !! html/parsoid
1641 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1642 !! end
1643
1644 !! test
1645 Comment semantics and delimiters, redux
1646 !! wikitext
1647 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1648 -- foo -- funky huh? ... -->
1649 !! html/php
1650
1651 !! html/parsoid
1652 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1653 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1654 !! end
1655
1656 !! test
1657 Comment semantics and delimiters: directors cut
1658 !! wikitext
1659 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1660 everything starting with < followed by !-- until the first -- and > we see,
1661 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1662 -->-->
1663 !! html/php
1664 <p>--&gt;
1665 </p>
1666 !! html/parsoid
1667 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1668 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1669 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1670 --><p>--></p>
1671 !! end
1672
1673 !! test
1674 Comment semantics: nesting
1675 !! wikitext
1676 <!--<!-- no, we're not going to do anything fancy here -->-->
1677 !! html/php
1678 <p>--&gt;
1679 </p>
1680 !! html/parsoid
1681 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1682 !! end
1683
1684 # Parsoid closes the unclosed comment, even if it means a slight
1685 # round-trip diff.
1686 !! test
1687 Comment semantics: unclosed comment at end
1688 !! options
1689 parsoid=wt2html,html2html
1690 !! wikitext
1691 <!--This comment will run out to the end of the document
1692 !! html/php
1693
1694 !! html/parsoid
1695 <!--This comment will run out to the end of the document-->
1696 !! end
1697
1698 !! test
1699 Comment semantics: normalize comments to play nice with XML and browsers
1700 !! wikitext
1701 <!-- Browsers --!> think this is closed -->
1702 <!--> This would normally be text -->
1703 <!---> As would this -->
1704 <!-- XML doesn't like trailing dashes -------->
1705 <!-- Nor doubled hyphens -- anywhere in the data -->
1706 But this is not a comment.
1707 !! html/php
1708 <p>But this is not a comment.
1709 </p>
1710 !! html/parsoid
1711 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1712 <!--&#x3E; This would normally be text -->
1713 <!--&#x2D;&#x3E; As would this -->
1714 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1715 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1716 <p>But this is not a comment.</p>
1717 !! end
1718
1719 !! test
1720 Comment semantics: round-trip even text which contains encoded -->
1721 !! wikitext
1722 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1723 !! html/parsoid
1724 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1725 !! end
1726
1727 !! test
1728 Comment in template title
1729 !! wikitext
1730 {{f<!---->oo}}
1731 !! html
1732 <p>FOO
1733 </p>
1734 !! end
1735
1736 !! test
1737 Comment on its own line post-expand
1738 !! wikitext
1739 a
1740 {{blank}}<!---->
1741 b
1742 !! html
1743 <p>a
1744 </p><p>b
1745 </p>
1746 !! end
1747
1748 !! test
1749 Comment on its own line post-expand with non-significant whitespace
1750 !! wikitext
1751 a
1752 {{blank}} <!---->
1753 b
1754 !! html
1755 <p>a
1756 </p><p>b
1757 </p>
1758 !! end
1759
1760 !! test
1761 Multiple comments should still parse as SOL-transparent
1762 !! options
1763 parsoid=wt2html,wt2wt
1764 !! wikitext
1765 <!--c1-->*a
1766 <!--c2--><!--c3--><!--c4-->*b
1767 !! html
1768 <!--c1--><ul>
1769 <li>a
1770 </li>
1771 <!--c2--><!--c3--><!--c4-->
1772 <li>b
1773 </li>
1774 </ul>
1775 !! end
1776
1777 ###
1778 ### paragraph wrapping tests
1779 ###
1780 !! test
1781 No block tags
1782 !! wikitext
1783 a
1784
1785 b
1786 !! html
1787 <p>a
1788 </p><p>b
1789 </p>
1790 !! end
1791
1792 !! test
1793 Block tag on one line (<div>)
1794 !! wikitext
1795 a <div>foo</div>
1796
1797 b
1798 !! html
1799 a <div>foo</div>
1800 <p>b
1801 </p>
1802 !! html+tidy
1803 <p>a</p>
1804 <div>foo</div>
1805 <p>b</p>
1806 !! end
1807
1808 !! test
1809 Block tag on one line (<blockquote>)
1810 !! wikitext
1811 a <blockquote>foo</blockquote>
1812
1813 b
1814 !! html
1815 a <blockquote>foo</blockquote>
1816 <p>b
1817 </p>
1818 !! html+tidy
1819 <p>a</p>
1820 <blockquote>
1821 <p>foo</p>
1822 </blockquote>
1823 <p>b</p>
1824 !! end
1825
1826 !! test
1827 Block tag on both lines (<div>)
1828 !! wikitext
1829 a <div>foo</div>
1830
1831 b <div>foo</div>
1832 !! html
1833 a <div>foo</div>
1834 b <div>foo</div>
1835
1836 !! html+tidy
1837 <p>a</p>
1838 <div>foo</div>
1839 <p>b</p>
1840 <div>foo</div>
1841 !! end
1842
1843 !! test
1844 Block tag on both lines (<blockquote>)
1845 !! wikitext
1846 a <blockquote>foo</blockquote>
1847
1848 b <blockquote>foo</blockquote>
1849 !! html
1850 a <blockquote>foo</blockquote>
1851 b <blockquote>foo</blockquote>
1852
1853 !! html+tidy
1854 <p>a</p>
1855 <blockquote>
1856 <p>foo</p>
1857 </blockquote>
1858 <p>b</p>
1859 <blockquote>
1860 <p>foo</p>
1861 </blockquote>
1862 !! end
1863
1864 !! test
1865 Multiple lines without block tags
1866 !! wikitext
1867 <div>foo</div> a
1868 b
1869 c
1870 d<!--foo--> e
1871 x <div>foo</div> z
1872 !! html
1873 <div>foo</div> a
1874 <p>b
1875 c
1876 d e
1877 </p>
1878 x <div>foo</div> z
1879
1880 !! html+tidy
1881 <div>foo</div>
1882 <p>a</p>
1883 <p>b c d e</p>
1884 <p>x</p>
1885 <div>foo</div>
1886 <p>z</p>
1887 !! end
1888
1889 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1890 # So, we have a separate section for Parsoid. We don't want
1891 # to mimic this stripping behavior in Parsoid. It affects
1892 # editing experience and also requires us to maintain additional
1893 # info for RT-ing.
1894 !! test
1895 Empty lines between lines with block tags
1896 !! wikitext
1897 <div></div>
1898
1899
1900 <div></div>a
1901
1902 b
1903 <div>a</div>b
1904
1905 <div>b</div>d
1906
1907
1908 <div>e</div>
1909 !! html
1910 <div></div>
1911 <p><br />
1912 </p>
1913 <div></div>a
1914 <p>b
1915 </p>
1916 <div>a</div>b
1917 <div>b</div>d
1918 <p><br />
1919 </p>
1920 <div>e</div>
1921
1922 !! html+tidy
1923 <p><br /></p>
1924 <p>a</p>
1925 <p>b</p>
1926 <div>a</div>
1927 <p>b</p>
1928 <div>b</div>
1929 <p>d</p>
1930 <p><br /></p>
1931 <div>e</div>
1932 !! html/parsoid
1933 <div data-parsoid='{"stx":"html"}'></div>
1934
1935 <p><br /></p>
1936 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1937
1938 <p>b</p>
1939 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1940
1941 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1942
1943 <p><br /></p>
1944 <div data-parsoid='{"stx":"html"}'>e</div>
1945 !! end
1946
1947 ## PHP parser emits output which is broken
1948 !! test
1949 Unclosed HTML p-tags should be handled properly
1950 !! wikitext
1951 <div><p>foo</div>
1952 a
1953
1954 b
1955 !! html/php+tidy
1956 <div>
1957 <p>foo</p>
1958 </div>
1959 <p>a</p>
1960 <p>b</p>
1961 !! html/parsoid
1962 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1963 <p>a</p>
1964 <p>b</p>
1965 !! end
1966
1967 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1968 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1969 ## them for now.
1970 !! test
1971 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1972 !! options
1973 parsoid=wt2html
1974 !! wikitext
1975 a [[Category:A1]] [[Category:A2]]
1976 [[Category:A3]]
1977 [[Category:A4]]
1978 !! html/parsoid
1979 <p>a</p>
1980 <link rel="mw:PageProp/Category" href="Category:A1"/> <link rel="mw:PageProp/Category" href="Category:A2"/> <link rel="mw:PageProp/Category" href="Category:A3"/> <link rel="mw:PageProp/Category" href="Category:A4"/>
1981 !! end
1982
1983 !! test
1984 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1985 !! options
1986 parsoid=wt2html
1987 !! wikitext
1988 [[Category:A1]]a
1989 !! html/parsoid
1990 <link rel="mw:PageProp/Category" href="Category:A1"/><p>a</p>
1991 !! end
1992
1993 ###
1994 ### Preformatted text
1995 ###
1996 !! test
1997 Preformatted text
1998 !! wikitext
1999 This is some
2000 Preformatted text
2001 With ''italic''
2002 And '''bold'''
2003 And a [[Main Page|link]]
2004 !! html
2005 <pre>This is some
2006 Preformatted text
2007 With <i>italic</i>
2008 And <b>bold</b>
2009 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2010 </pre>
2011 !! end
2012
2013 !! test
2014 Tabs don't trigger preformatted text
2015 !! wikitext
2016 This is not
2017 preformatted text.
2018 This is preformatted text.
2019 So is this.
2020 !! html
2021 <p> This is not
2022 preformatted text.
2023 </p>
2024 <pre>This is preformatted text.
2025 So is this.
2026 </pre>
2027 !! end
2028
2029 !! test
2030 Ident preformatting with inline content
2031 !! wikitext
2032 a
2033 ''b''
2034 !! html
2035 <pre>a
2036 <i>b</i>
2037 </pre>
2038 !! end
2039
2040 !! test
2041 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2042 !! wikitext
2043 <pre><nowiki>
2044 <b>
2045 <cite>
2046 <em>
2047 </nowiki></pre>
2048 !! html
2049 <pre>
2050 &lt;b&gt;
2051 &lt;cite&gt;
2052 &lt;em&gt;
2053 </pre>
2054
2055 !! end
2056
2057 !! test
2058 Regression with preformatted in <center>
2059 !! wikitext
2060 <center>
2061 Blah
2062 </center>
2063 !! html
2064 <center>
2065 <pre>Blah
2066 </pre>
2067 </center>
2068
2069 !! end
2070
2071 !! test
2072 Bug 52763: Preformatted in <blockquote>
2073 !! wikitext
2074 <blockquote>
2075 Blah
2076 {|
2077 |
2078 indented cell (no pre-wrapping!)
2079 |}
2080 </blockquote>
2081 !! html
2082 <blockquote>
2083 <p> Blah
2084 </p>
2085 <table>
2086 <tr>
2087 <td>
2088 <p> indented cell (no pre-wrapping!)
2089 </p>
2090 </td></tr></table>
2091 </blockquote>
2092
2093 !! end
2094
2095 !! test
2096 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2097 !! wikitext
2098 <blockquote>
2099 Foo
2100
2101 Bar
2102 </blockquote>
2103 !! html
2104 <blockquote>
2105 <p>Foo
2106 </p><p>Bar
2107 </p>
2108 </blockquote>
2109
2110 !! end
2111
2112 !! test
2113 Bug 15491: <ins>/<del> in blockquote
2114 !! wikitext
2115 <blockquote>
2116 Foo <del>bar</del> <ins>baz</ins> quux
2117 </blockquote>
2118 !! html
2119 <blockquote>
2120 <p>Foo <del>bar</del> <ins>baz</ins> quux
2121 </p>
2122 </blockquote>
2123
2124 !! end
2125
2126 # Note that the p-wrapping is newline sensitive, which could be
2127 # considered a bug: tidy will wrap only the 'Foo' in the example
2128 # below in a <p> tag. (see comment 23-25 of bug #6200)
2129 !! test
2130 Bug 15491: <ins>/<del> in blockquote (2)
2131 !! wikitext
2132 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2133 </blockquote>
2134 !! html
2135 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2136 </blockquote>
2137
2138 !! html+tidy
2139 <blockquote>
2140 <p>Foo</p>
2141 <del>bar</del> <ins>baz</ins> quux</blockquote>
2142 !! end
2143
2144 !! test
2145 <pre> with attributes (bug 3202)
2146 !! wikitext
2147 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2148 !! html
2149 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2150
2151 !! end
2152
2153 !! test
2154 <pre> with width attribute (bug 3202)
2155 !! wikitext
2156 <pre width="8">Narrow screen goodies</pre>
2157 !! html
2158 <pre width="8">Narrow screen goodies</pre>
2159
2160 !! end
2161
2162 !! test
2163 <pre> with forbidden attribute (bug 3202)
2164 !! wikitext
2165 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2166 !! html
2167 <pre width="8">Narrow screen goodies</pre>
2168
2169 !! end
2170
2171 !! test
2172 Entities inside <pre>
2173 !! wikitext
2174 <pre>&lt;</pre>
2175 !! html
2176 <pre>&lt;</pre>
2177
2178 !! end
2179
2180 !! test
2181 <pre> with forbidden attribute values (bug 3202)
2182 !! wikitext
2183 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2184 !! html
2185 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2186
2187 !! end
2188
2189 !! test
2190 <nowiki> inside <pre> (bug 13238)
2191 !! wikitext
2192 <pre>
2193 <nowiki>
2194 </pre>
2195 <pre>
2196 <nowiki></nowiki>
2197 </pre>
2198 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2199 !! html
2200 <pre>
2201 &lt;nowiki&gt;
2202 </pre>
2203 <pre>
2204
2205 </pre>
2206 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2207
2208 !! end
2209
2210 !! test
2211 <nowiki> and <pre> preference (first one wins)
2212 !! wikitext
2213 <pre>
2214 <nowiki>
2215 </pre>
2216 </nowiki>
2217 </pre>
2218
2219 <nowiki>
2220 <pre>
2221 <nowiki>
2222 </pre>
2223 </nowiki>
2224 </pre>
2225
2226 !! html
2227 <pre>
2228 &lt;nowiki&gt;
2229 </pre>
2230 <p>&lt;/nowiki&gt;
2231 &lt;/pre&gt;
2232 </p><p>
2233 &lt;pre&gt;
2234 &lt;nowiki&gt;
2235 &lt;/pre&gt;
2236
2237 &lt;/pre&gt;
2238 </p>
2239 !! end
2240
2241 !! test
2242 </pre> inside nowiki
2243 !! wikitext
2244 <nowiki></pre></nowiki>
2245 !! html
2246 <p>&lt;/pre&gt;
2247 </p>
2248 !! end
2249
2250 # Parsoid doesn't strip empty tags, like Tidy does.
2251 !! test
2252 Empty pre; pre inside other HTML tags (bug 54946)
2253 !! options
2254 parsoid=wt2html,wt2wt
2255 !! wikitext
2256 a
2257
2258 <div><pre>
2259 foo
2260 </pre></div>
2261 <pre></pre>
2262 !! html/php
2263 <p>a
2264 </p>
2265 <div><pre>
2266 foo
2267 </pre></div>
2268 <pre></pre>
2269
2270 !! html/php+tidy
2271 <p>a</p>
2272 <div>
2273 <pre>
2274 foo
2275 </pre></div>
2276 !! html/parsoid
2277 <p>a</p>
2278
2279 <div><pre>foo
2280 </pre></div>
2281 <pre></pre>
2282 !! end
2283
2284 !! test
2285 HTML pre followed by indent-pre
2286 !! wikitext
2287 <pre>foo</pre>
2288 bar
2289 !! html
2290 <pre>foo</pre>
2291 <pre>bar
2292 </pre>
2293 !! end
2294
2295 !!test
2296 Block tag pre
2297 !!options
2298 parsoid
2299 !! wikitext
2300 <p><pre>foo</pre></p>
2301 !! html
2302 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2303 !!end
2304
2305 !!test
2306 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2307 !! wikitext
2308 {{echo|}}
2309 !! html
2310
2311 !!end
2312
2313 !!test
2314 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2315 !! wikitext
2316 {{echo|
2317 foo}}
2318 !! html
2319 <p>foo
2320 </p>
2321 !!end
2322
2323 !! test
2324 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2325 !! wikitext
2326 {{echo|a
2327 b}}
2328 !! html
2329 <pre>a
2330 </pre>
2331 <p>b
2332 </p>
2333 !!end
2334
2335 !! test
2336 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2337 !! wikitext
2338 {{echo|a
2339 b
2340 c
2341 d
2342 e
2343 }}
2344 !! html
2345 <pre>a
2346 </pre>
2347 <p>b
2348 c
2349 </p>
2350 <pre>d
2351 </pre>
2352 <p>e
2353 </p>
2354 !!end
2355
2356 !!test
2357 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2358 !! wikitext
2359 {{echo| foo}}
2360
2361 {{echo| foo}}{{echo| bar}}
2362
2363 {{echo| foo}}
2364 {{echo| bar}}
2365
2366 {{echo|<!--cmt--> foo}}
2367
2368 <!--cmt-->{{echo| foo}}
2369
2370 {{echo|{{echo| }}bar}}
2371 !! html
2372 <pre>foo
2373 </pre>
2374 <pre>foo bar
2375 </pre>
2376 <pre>foo
2377 bar
2378 </pre>
2379 <pre>foo
2380 </pre>
2381 <pre>foo
2382 </pre>
2383 <pre>bar
2384 </pre>
2385 !!end
2386
2387 !! test
2388 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2389 !! wikitext
2390 {{echo| }}a
2391
2392 {{echo|
2393 }}a
2394
2395 {{echo|
2396 b}}
2397
2398 {{echo|a
2399 }}b
2400
2401 {{echo|a
2402 }} b
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p><br />
2407 </p>
2408 <pre>a
2409 </pre>
2410 <p><br />
2411 </p>
2412 <pre>b
2413 </pre>
2414 <p>a
2415 </p>
2416 <pre>b
2417 </pre>
2418 <p>a
2419 </p>
2420 <pre>b
2421 </pre>
2422 !!end
2423
2424 !! test
2425 Things that look like <pre> tags aren't treated as such
2426 !! wikitext
2427 Barack Obama <President> of the United States
2428 <President></President>
2429 !! html
2430 <p>Barack Obama &lt;President&gt; of the United States
2431 &lt;President&gt;&lt;/President&gt;
2432 </p>
2433 !! end
2434
2435 ## PHP parser discards the "<pre " string
2436 !! test
2437 Handle broken pre-like tags (bug 64025)
2438 !! options
2439 parsoid=wt2html
2440 !! wikitext
2441 {{echo|<pre <pre>x</pre>}}
2442
2443 <table><pre </table>
2444 !! html/php
2445 <pre>x</pre>
2446 <table><pre></pre></table>
2447
2448 !! html/parsoid
2449 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2450
2451
2452 <p>&lt;pre </p>
2453
2454 <table></table>
2455 !! end
2456
2457 !! test
2458 Parsoid: handle pre with space after attribute
2459 !! options
2460 parsoid=wt2html
2461 !! wikitext
2462 <pre style="width:50%;" >{{echo|foo}}</pre>
2463 !! html
2464 <pre style="width:50%;">{{echo|foo}}</pre>
2465 !! end
2466
2467 # TODO / maybe: fix wt2wt for this
2468 !! test
2469 Parsoid: Don't paragraph-wrap fosterable content
2470 !! options
2471 parsoid=wt2html
2472 !! wikitext
2473 {|
2474 <td></td>
2475 <td></td>
2476
2477
2478
2479 |}
2480 !! html
2481 <table>
2482
2483 <tbody>
2484 <tr>
2485 <td></td>
2486
2487 <td></td></tr>
2488
2489
2490
2491 </tbody></table>
2492 !! end
2493
2494 !! test
2495 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2496 !! options
2497 parsoid=wt2html
2498 !! wikitext
2499 {|
2500 <td>
2501 <td>
2502 </td>
2503
2504
2505
2506 |}
2507 !! html
2508 <table>
2509
2510 <tbody>
2511 <tr>
2512 <td></td>
2513
2514 <td>
2515 </td></tr>
2516
2517
2518
2519 </tbody></table>
2520 !! end
2521
2522
2523 #--------------------------------------------------------------------
2524 # Transclusion parameter whitespace stripping tests
2525 # Behavior is different for positional and named parameters
2526 #--------------------------------------------------------------------
2527 !! test
2528 Templates: Strip leading and trailing whitespace from named-param values
2529 !! wikitext
2530 {{echo|1= a }}
2531
2532 {{echo|1= {{echo|b}} }}
2533
2534 {{echo| 1 =
2535 c }}
2536
2537 {{echo| 1 =
2538 * d
2539 }}
2540 !! html
2541 <p>a
2542 </p><p>b
2543 </p><p>c
2544 </p>
2545 <ul><li> d</li></ul>
2546
2547 !! end
2548
2549 !! test
2550 Templates: Don't strip whitespace from positional-param values
2551 !! wikitext
2552 {{echo|a }}
2553
2554 {{echo|{{echo|b}} }}
2555
2556 {{echo| c
2557 }}
2558
2559 {{echo| {{echo|d}}
2560 }}
2561
2562 {{echo|
2563 e}}
2564
2565 {{echo|
2566 * f}}
2567
2568 {{echo|
2569 }}g
2570 !! html
2571 <p>a
2572 </p><p>b
2573 </p>
2574 <pre>c
2575 </pre>
2576 <p><br />
2577 </p>
2578 <pre>d
2579 </pre>
2580 <p><br />
2581 </p>
2582 <pre>e
2583 </pre>
2584 <p><br />
2585 </p>
2586 <ul><li> f</li></ul>
2587 <p><br />
2588 </p>
2589 <pre>g
2590 </pre>
2591 !! end
2592
2593 !! test
2594 Templates: Handle empty comment-and-ws-only lines correctly
2595 !! wikitext
2596 {{echo|foo
2597 <!--should be ignored-->
2598 <!--should be ignored as well-->
2599 bar}}
2600 !! html
2601 <p>foo
2602 bar
2603 </p>
2604 !! end
2605
2606 !! test
2607 Templates: Handle comments in the target
2608 !! wikitext
2609 {{echo
2610 <!-- should be ignored -->
2611 |foo}}
2612
2613 {{echo<!-- should be ignored -->
2614 |foo}}
2615
2616 {{echo<!-- should be ignored -->|foo}}
2617
2618 {{<!-- should be ignored -->echo|foo}}
2619 !!html/parsoid
2620 <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>
2621
2622 <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>
2623
2624 <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>
2625
2626 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2627 !!end
2628
2629 !! test
2630 Templates: Handle comments in parameter names (bug 67657)
2631 !! wikitext
2632 {{echo|1
2633 <!-- should be ignored -->
2634 =foo}}
2635
2636 {{echo|
2637 <!-- should be ignored -->
2638 1 = foo}}
2639
2640 {{echo|1<!-- should be ignored --> = foo}}
2641
2642 {{echo|<!-- should be ignored -->1 = foo}}
2643 !!html/parsoid
2644 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2645
2646 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2647
2648 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2649
2650 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2651 !!end
2652
2653 !! test
2654 Templates: Other wikitext in parameter names (bug 67657)
2655 !! wikitext
2656 {{echo|''1''=foo}}
2657 !!html/parsoid
2658 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2659 !!html/php
2660 <p>{{{1}}}
2661 </p>
2662 !!end
2663
2664 #--------------------------------------------------------------------
2665 # Transclusion parameter escaping tests
2666 #--------------------------------------------------------------------
2667 !! test
2668 Templates: Parsoid parameter escaping test 1
2669 !! options
2670 parsoid
2671 !! wikitext
2672 {{echo|[foo]|{{echo|[bar]}}}}
2673 !! html
2674 <p about="#mwt1" typeof="mw:Transclusion"
2675 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2676 !! end
2677
2678 !! test
2679 Parsoid: Pipes in external links in template parameter
2680 !! options
2681 parsoid
2682 !! wikitext
2683 {{echo|[{{echo|http://example.com}} link]}}
2684 !! html
2685 <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>
2686 !! end
2687
2688 !! test
2689 Parsoid: pipe in transclusion parameter
2690 !! options
2691 parsoid
2692 !! wikitext
2693 {{echo|http://foo.com/a&#124;b}}
2694 !! html
2695 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2696 typeof="mw:Transclusion"
2697 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>
2698 !! end
2699
2700 !! test
2701 Parsoid: Pipe in external link target and content in template parameter
2702 !! options
2703 parsoid=html2wt,wt2wt
2704 !! wikitext
2705 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2706 !! html
2707 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2708 typeof="mw:Transclusion"
2709 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2710 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2711 !! end
2712
2713 !! test
2714 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2715 !! options
2716 parsoid
2717 !! wikitext
2718 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2719 !! html
2720 <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>
2721 !! end
2722
2723 !! test
2724 Templates: Don't escape already nowiki-escaped text in template parameters
2725 !! options
2726 parsoid=html2wt,wt2wt
2727 !! wikitext
2728 {{echo|foo<nowiki>|</nowiki>bar}}
2729 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2730 {{echo|<nowiki></nowiki>}}
2731 !! html
2732 <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>
2733 <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>
2734 <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>
2735 </p>
2736 !! end
2737
2738 ## Bug 52824
2739 !! test
2740 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2741 !! options
2742 parsoid=html2wt,wt2wt
2743 !! wikitext
2744 {{echo|{{echo|1=bar}}}}
2745 !! html
2746 <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>
2747 !! end
2748
2749 ## Bug 56733
2750 !! test
2751 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2752 !! options
2753 parsoid
2754 !! wikitext
2755 {{echo|a : b}}
2756 !! html
2757 <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:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2758 !! end
2759
2760 ## Bug T73412
2761 !! test
2762 Templates: Preserve blank parameter names
2763 !! wikitext
2764 {{echo|=foo}}
2765 !! html/php
2766 <p>{{{1}}}
2767 </p>
2768 !! html/parsoid
2769 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2770 !! end
2771
2772 !! test
2773 Templates: Preserve blank parameter names in other positions
2774 !! wikitext
2775 {{blank_param|bar|=foo}}
2776 !! html/php
2777 <p>bar
2778 foo
2779 </p>
2780 !! html/parsoid
2781 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2782 foo</p>
2783 !! end
2784
2785 ###
2786 ### Parsoid-centric tests for testing RT edge cases for pre
2787 ###
2788
2789 !!test
2790 1a. Indent-Pre and Comments
2791 !! wikitext
2792 a
2793 <!--a-->
2794 c
2795 !! html
2796 <pre>a
2797 </pre>
2798 <p>c
2799 </p>
2800 !!end
2801
2802 !!test
2803 1b. Indent-Pre and Comments
2804 !! wikitext
2805 a
2806 <!--a-->
2807 c
2808 !! html
2809 <pre>a
2810 </pre>
2811 <p>c
2812 </p>
2813 !!end
2814
2815 !!test
2816 1c. Indent-Pre and Comments
2817 !! wikitext
2818 <!--a--> a
2819
2820 <!--a--> a
2821 !! html
2822 <pre> a
2823 </pre>
2824 <pre> a
2825 </pre>
2826 !!end
2827
2828 !!test
2829 1d. Indent-Pre and Comments
2830 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2831 !! wikitext
2832 <!--a--> a
2833
2834 <!--b-->b
2835 !! html
2836 <pre>a
2837 </pre>
2838 <pre>b
2839 </pre>
2840 !!end
2841
2842 !!test
2843 2a. Indent-Pre and tables
2844 !! wikitext
2845 {|
2846 |-
2847 !h1!!h2
2848 |foo||bar
2849 |}
2850 !! html
2851 <table>
2852
2853 <tr>
2854 <th>h1</th>
2855 <th>h2
2856 </th>
2857 <td>foo</td>
2858 <td>bar
2859 </td></tr></table>
2860
2861 !!end
2862
2863 !!test
2864 2b. Indent-Pre and tables
2865 !! wikitext
2866 {|
2867 |-
2868 |foo
2869 |}
2870 !! html
2871 <table>
2872
2873 <tr>
2874 <td>foo
2875 </td></tr></table>
2876
2877 !!end
2878
2879 !!test
2880 2c. Indent-Pre and tables (bug 42252)
2881 !! wikitext
2882 {|
2883 |+ foo
2884 ! | bar
2885 |}
2886 !! html
2887 <table>
2888 <caption> foo
2889 </caption>
2890 <tr>
2891 <th> bar
2892 </th></tr></table>
2893
2894 !!end
2895
2896 !!test
2897 2d. Indent-Pre and tables
2898 !! wikitext
2899 a
2900 {|
2901 | b
2902 |}
2903 !! html/php
2904 <pre>a
2905 </pre>
2906 <table>
2907 <tr>
2908 <td> b
2909 </td></tr></table>
2910
2911 !! html/parsoid
2912 <pre>a</pre>
2913 <table>
2914 <tbody><tr><td> b</td></tr>
2915 </tbody></table>
2916 !!end
2917
2918 !!test
2919 2e. Indent-Pre and table-line syntax
2920 !! wikitext
2921 a
2922 | b
2923 | c
2924 !! html/php
2925 <pre>a
2926 | b
2927 | c
2928 </pre>
2929 !!end
2930
2931 !!test
2932 2f. Indent-pre started by table-line syntax
2933 !! wikitext
2934 a
2935 | b
2936 | c
2937 !! html/php
2938 <p>a
2939 </p>
2940 <pre>| b
2941 | c
2942 </pre>
2943 !! html/parsoid
2944 <p>a</p>
2945 <pre>
2946 | b
2947 | c</pre>
2948 !!end
2949
2950 !!test
2951 3a. Indent-Pre and block tags (single-line html)
2952 !! wikitext
2953 a <p> foo </p>
2954 b <div> foo </div>
2955 c <blockquote> foo </blockquote>
2956 <span> foo </span>
2957 !! html
2958 a <p> foo </p>
2959 b <div> foo </div>
2960 c <blockquote> foo </blockquote>
2961 <pre><span> foo </span>
2962 </pre>
2963 !! html/parsoid
2964 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2965 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2966 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2967 <pre><span> foo </span>
2968 </pre>
2969 !! html+tidy
2970 <p>a</p>
2971 <p>foo</p>
2972 <p>b</p>
2973 <div>foo</div>
2974 <p>c</p>
2975 <blockquote>
2976 <p>foo</p>
2977 </blockquote>
2978 <pre>
2979 <span> foo </span>
2980 </pre>
2981 !! end
2982
2983 !!test
2984 3b. Indent-Pre and block tags (multi-line html)
2985 !! wikitext
2986 a <span>foo</span>
2987 b <div> foo </div>
2988 !! html
2989 <pre>a <span>foo</span>
2990 </pre>
2991 b <div> foo </div>
2992
2993 !! html/parsoid
2994 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2995 b <div data-parsoid='{"stx":"html"}'> foo </div>
2996 !! html+tidy
2997 <pre>
2998 a <span>foo</span>
2999 </pre>
3000 <p>b</p>
3001 <div>foo</div>
3002 !!end
3003
3004 !!test
3005 3c. Indent-Pre and block tags (pre-content on separate line)
3006 !! wikitext
3007 <p>
3008 foo
3009 </p>
3010
3011 <div>
3012 foo
3013 </div>
3014
3015 <center>
3016 foo
3017 </center>
3018
3019 <blockquote>
3020 foo
3021 </blockquote>
3022
3023 <blockquote>
3024 <pre>
3025 foo
3026 </pre>
3027 </blockquote>
3028
3029 <table><tr><td>
3030 foo
3031 </td></tr></table>
3032
3033 <ul><li>
3034 foo
3035 </li></ul>
3036
3037 !! html
3038 <p>
3039 foo
3040 </p>
3041 <div>
3042 <pre>foo
3043 </pre>
3044 </div>
3045 <center>
3046 <pre>foo
3047 </pre>
3048 </center>
3049 <blockquote>
3050 <p> foo
3051 </p>
3052 </blockquote>
3053 <blockquote>
3054 <pre>
3055 foo
3056 </pre>
3057 </blockquote>
3058 <table><tr><td>
3059 <pre>foo
3060 </pre>
3061 </td></tr></table>
3062 <ul><li>
3063 foo
3064 </li></ul>
3065
3066 !!end
3067
3068 !!test
3069 4. Indent-Pre and extension tags
3070 !! wikitext
3071 a <gallery>
3072 File:foobar.jpg
3073 </gallery>
3074 !! html
3075 a <ul class="gallery mw-gallery-traditional">
3076 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3077 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3078 <div class="gallerytext">
3079 </div>
3080 </div></li>
3081 </ul>
3082
3083 !! html+tidy
3084 <p>a</p>
3085 <ul class="gallery mw-gallery-traditional">
3086 <li class="gallerybox" style="width: 155px">
3087 <div style="width: 155px">
3088 <div class="thumb" style="width: 150px;">
3089 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3090 </div>
3091 <div class="gallerytext"></div>
3092 </div>
3093 </li>
3094 </ul>
3095 !!end
3096
3097 !! test
3098 Table wikitext syntax outside wiki-tables
3099 !! wikitext
3100 a
3101 ! not a table heading
3102 |- not a table row
3103 | not a table cell
3104 | class="foo bar" | baz
3105 b
3106 |}
3107 |-
3108 c
3109 !! html
3110 <p>a
3111 ! not a table heading
3112 |- not a table row
3113 | not a table cell
3114 | class="foo bar" | baz
3115 b
3116 |}
3117 |-
3118 c
3119 </p>
3120 !! end
3121
3122 !!test
3123 Render paragraphs when indent-pre is suppressed in blocklevels
3124 !! wikitext
3125 <blockquote>
3126 foo
3127
3128 bar
3129 </blockquote>
3130 !! html
3131 <blockquote>
3132 <p> foo
3133 </p><p> bar
3134 </p>
3135 </blockquote>
3136
3137 !!end
3138
3139 !!test
3140 4. Multiple spaces at start-of-line
3141 !! wikitext
3142 <p> foo </p>
3143 foo
3144 {|
3145 |foo
3146 |}
3147 !! html
3148 <p> foo </p>
3149 <pre> foo
3150 </pre>
3151 <table>
3152 <tr>
3153 <td>foo
3154 </td></tr></table>
3155
3156 !!end
3157
3158 ## NOTE: the leading white-space chars on empty line are significant
3159 !! test
3160 5a. White-space in indent-pre
3161 !! wikitext
3162 a<br />
3163
3164 b
3165 !! html
3166 <pre>a<br />
3167
3168 b
3169 </pre>
3170 !! end
3171
3172 ## NOTE: the leading white-space chars on empty line are significant
3173 !! test
3174 5b. White-space in indent-pre
3175 !! wikitext
3176 a
3177
3178 b
3179
3180
3181 c
3182 !! html
3183 <pre>a
3184
3185 b
3186
3187
3188 c
3189 </pre>
3190 !! end
3191
3192 !! test
3193 5c. White-space in indent-pre
3194 !! wikitext
3195 ''a''
3196 ''b''
3197 ''c''
3198 !! html
3199 <pre><i>a</i>
3200 <i>b</i>
3201 <i>c</i>
3202 </pre>
3203 !! end
3204
3205 !! test
3206 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3207 !! wikitext
3208 a
3209
3210 <!-- continue -->
3211 b
3212
3213 c
3214
3215 d
3216 !! html
3217 <pre>a
3218
3219 b
3220 </pre>
3221 <pre>c
3222
3223 </pre>
3224 <p>d
3225 </p>
3226 !! end
3227
3228 !! test
3229 7a. Indent-pre and category links
3230 !! options
3231 parsoid=wt2html,wt2wt
3232 !! wikitext
3233 [[Category:foo]] <!-- No pre-wrapping -->
3234 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3235 !! html/parsoid
3236 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3237 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3238 !! end
3239
3240 !! test
3241 7b. Indent-pre and category links
3242 !! options
3243 parsoid=wt2html,wt2wt
3244 !! wikitext
3245 [[Category:foo]] a
3246 [[Category:foo]] {{echo|b}}
3247 !! html
3248 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3249 <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>
3250 !! end
3251
3252 !! test
3253 Indent-Pre: Newlines in comments shouldn't affect sol state
3254 !! wikitext
3255 a <!--
3256 foo
3257 --> b
3258 !! html/parsoid
3259 <p>a <!--
3260 foo
3261 --> b</p>
3262 !! end
3263
3264 ###
3265 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3266 ###
3267
3268 !!test
3269 HTML-pre: 1. embedded newlines
3270 !! wikitext
3271 <pre>foo</pre>
3272
3273 <pre>
3274 foo
3275 </pre>
3276
3277 <pre>
3278
3279 foo
3280 </pre>
3281
3282 <pre>
3283
3284
3285 foo
3286 </pre>
3287 !! html
3288 <pre>foo</pre>
3289 <pre>
3290 foo
3291 </pre>
3292 <pre>
3293
3294 foo
3295 </pre>
3296 <pre>
3297
3298
3299 foo
3300 </pre>
3301
3302 !! html/parsoid
3303 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3304
3305 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3306 foo
3307 </pre>
3308
3309 <pre data-parsoid='{"stx":"html"}'>
3310
3311 foo
3312 </pre>
3313
3314 <pre data-parsoid='{"stx":"html"}'>
3315
3316
3317 foo
3318 </pre>
3319 !!end
3320
3321 !! test
3322 HTML-pre: big spaces
3323 !! wikitext
3324 <pre>
3325
3326
3327
3328
3329 haha
3330
3331
3332
3333
3334 haha
3335
3336
3337
3338
3339 </pre>
3340 !! html
3341 <pre>
3342
3343
3344
3345
3346 haha
3347
3348
3349
3350
3351 haha
3352
3353
3354
3355
3356 </pre>
3357
3358 !! html/parsoid
3359 <pre data-parsoid='{"stx":"html"}'>
3360
3361
3362
3363
3364 haha
3365
3366
3367
3368
3369 haha
3370
3371
3372
3373
3374 </pre>
3375 !! end
3376
3377 !!test
3378 HTML-pre: 2: indented text
3379 !! wikitext
3380 <pre>
3381 foo
3382 </pre>
3383 !! html
3384 <pre>
3385 foo
3386 </pre>
3387
3388 !!end
3389
3390 !!test
3391 HTML-pre: 3: other wikitext
3392 !! wikitext
3393 <pre>
3394 * foo
3395 # bar
3396 = no-h =
3397 '' no-italic ''
3398 [[ NoLink ]]
3399 </pre>
3400 !! html
3401 <pre>
3402 * foo
3403 # bar
3404 = no-h =
3405 '' no-italic ''
3406 [[ NoLink ]]
3407 </pre>
3408
3409 !!end
3410
3411 ###
3412 ### Definition lists
3413 ###
3414 !! test
3415 Simple definition
3416 !! wikitext
3417 ; name : Definition
3418 !! html
3419 <dl><dt> name&#160;</dt>
3420 <dd> Definition</dd></dl>
3421
3422 !! end
3423
3424 !! test
3425 Definition list for indentation only
3426 !! wikitext
3427 : Indented text
3428 !! html
3429 <dl><dd> Indented text</dd></dl>
3430
3431 !! end
3432
3433 !! test
3434 Definition list with no space
3435 !! wikitext
3436 ;name:Definition
3437 !! html
3438 <dl><dt>name</dt>
3439 <dd>Definition</dd></dl>
3440
3441 !!end
3442
3443 !! test
3444 Definition list with URL link
3445 !! wikitext
3446 ; http://example.com/ : definition
3447 !! html
3448 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3449 <dd> definition</dd></dl>
3450
3451 !! end
3452
3453 !! test
3454 Definition list with bracketed URL link
3455 !! wikitext
3456 ;[http://www.example.com/ Example]:Something about it
3457 !! html
3458 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3459 <dd>Something about it</dd></dl>
3460
3461 !! end
3462
3463 !! test
3464 Definition list with wikilink containing colon
3465 !! wikitext
3466 ; [[Help:FAQ]]: The least-read page on Wikipedia
3467 !! html
3468 <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>
3469 <dd> The least-read page on Wikipedia</dd></dl>
3470
3471 !! end
3472
3473 # At Brion's and JeLuF's insistence... :)
3474 !! test
3475 Definition list with news link containing colon
3476 !! wikitext
3477 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3478 !! html/php
3479 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3480 <dd> This isn't even a real newsgroup!</dd></dl>
3481
3482 !! html/parsoid
3483 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3484 !! end
3485
3486 !! test
3487 Malformed definition list with colon
3488 !! wikitext
3489 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3490 !! html
3491 <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>
3492
3493 !! end
3494
3495 !! test
3496 Definition lists: colon in external link text
3497 !! wikitext
3498 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3499 !! html
3500 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3501 <dd> OK, I made that up</dd></dl>
3502
3503 !! end
3504
3505 !! test
3506 Definition lists: colon in HTML attribute
3507 !! wikitext
3508 ;<b style="display: inline">bold</b>
3509 !! html
3510 <dl><dt><b style="display: inline">bold</b></dt></dl>
3511
3512 !! end
3513
3514 !! test
3515 Definition lists: self-closed tag
3516 !! wikitext
3517 ;one<br/>two : two-line fun
3518 !! html
3519 <dl><dt>one<br />two&#160;</dt>
3520 <dd> two-line fun</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Bug 11748: Literal closing tags
3526 !! wikitext
3527 <dl>
3528 <dt>test 1</dt>
3529 <dd>test test test test test</dd>
3530 <dt>test 2</dt>
3531 <dd>test test test test test</dd>
3532 </dl>
3533 !! html
3534 <dl>
3535 <dt>test 1</dt>
3536 <dd>test test test test test</dd>
3537 <dt>test 2</dt>
3538 <dd>test test test test test</dd>
3539 </dl>
3540
3541 !! end
3542
3543 !! test
3544 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3545 !! wikitext
3546 <ul><li>
3547 ; term : description
3548 * unordered
3549 </li></ul>
3550 !! html
3551 <ul><li>
3552 <dl><dt> term&#160;</dt>
3553 <dd> description</dd></dl>
3554 <ul><li> unordered</li></ul>
3555 </li></ul>
3556
3557 !! end
3558
3559 !! test
3560
3561 Definition list with empty definition and following paragraph
3562 !! wikitext
3563 ; term:
3564 Paragraph text
3565 !! html
3566 <dl><dt> term</dt>
3567 <dd></dd></dl>
3568 <p>Paragraph text
3569 </p>
3570 !! end
3571
3572 !! test
3573 Nested definition lists using html syntax
3574 !! wikitext
3575 <dl><dt>x</dt>
3576 <dd>a</dd>
3577 <dd>b</dd></dl>
3578
3579 !! end
3580
3581 !! test
3582 Definition Lists: No nesting: Multiple dd's
3583 !! wikitext
3584 ;x
3585 :a
3586 :b
3587 !! html
3588 <dl><dt>x</dt>
3589 <dd>a</dd>
3590 <dd>b</dd></dl>
3591
3592 !! end
3593
3594 !! test
3595 Definition Lists: Indentation: Regular
3596 !! wikitext
3597 :i1
3598 ::i2
3599 :::i3
3600 !! html
3601 <dl><dd>i1
3602 <dl><dd>i2
3603 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3604
3605 !! end
3606
3607 !! test
3608 Definition Lists: Indentation: Missing 1st level
3609 !! wikitext
3610 ::i2
3611 :::i3
3612 !! html
3613 <dl><dd><dl><dd>i2
3614 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3615
3616 !! end
3617
3618 !! test
3619 Definition Lists: Indentation: Multi-level indent
3620 !! wikitext
3621 :::i3
3622 !! html
3623 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3624
3625 !! end
3626
3627 !! test
3628 Definition Lists: Hacky use to indent tables
3629 !! wikitext
3630 ::{|
3631 |foo
3632 |bar
3633 |}
3634 this text
3635 should be left alone
3636 !! html
3637 <dl><dd><dl><dd><table>
3638 <tr>
3639 <td>foo
3640 </td>
3641 <td>bar
3642 </td></tr></table></dd></dl></dd></dl>
3643 <p>this text
3644 should be left alone
3645 </p>
3646 !! end
3647
3648 !! test
3649 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3650 !! wikitext
3651 <!-- foo -->
3652 ::{|
3653 |foo
3654 |bar
3655 |}<!-- bar -->
3656 this text
3657 should be left alone
3658 !! html/parsoid
3659 <!-- foo -->
3660 <dl><dd><dl><dd><table><tr>
3661 <td>foo</td>
3662 <td>bar</td>
3663 </tr></table><!-- bar --></dd></dl></dd></dl>
3664 <p>this text
3665 should be left alone</p>
3666 !! end
3667
3668 !! test
3669 Definition Lists: Hacky use to indent tables, with comment before table
3670 !! wikitext
3671 ::<!-- foo -->{|
3672 |foo
3673 |}
3674 !! html/parsoid
3675 <dl><dd><dl><dd><!-- foo --><table><tr>
3676 <td>foo</td>
3677 </tr></table></dd></dl></dd></dl>
3678 !! end
3679
3680 # The trailing whitespace in this test is to catch a regression in
3681 # Parsoid after T54473.
3682 !! test
3683 Definition Lists: Hacky use to indent tables (WS-insensitive)
3684 !! wikitext
3685 : {|
3686 |a
3687 |}
3688 !! html/php
3689 <dl><dd><table>
3690 <tr>
3691 <td>a
3692 </td></tr></table></dd></dl>
3693
3694 !! html/parsoid
3695 <dl><dd> <table>
3696 <tbody><tr><td>a</td></tr>
3697 </tbody></table> </dd></dl>
3698 !! end
3699
3700 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3701 ## as an empty dt item. It also ignores all but the last ";" when followed
3702 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3703 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3704 ## ";"s.
3705 ##
3706 ## Ex: ";;t2 ::d2" is transformed into:
3707 ##
3708 ## <dl>
3709 ## <dt>t2 </dt>
3710 ## <dd>
3711 ## <dl>
3712 ## <dt></dt>
3713 ## <dd>d2</dd>
3714 ## </dl>
3715 ## </dd>
3716 ## </dl>
3717 ##
3718 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3719 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3720 ##
3721 ## <dl>
3722 ## <dt>
3723 ## <dl>
3724 ## <dt>t2 </dt>
3725 ## <dd>:d2</dd>
3726 ## </dl>
3727 ## </dt>
3728 ## </dl>
3729 ##
3730 ## All Parsoid only definition list tests have this difference.
3731 ##
3732 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3733 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3734
3735 !! test
3736 Table / list interaction: indented table with lists in table contents
3737 !! wikitext
3738 :{|
3739 |-
3740 | a
3741 * b
3742 |-
3743 | c
3744 * d
3745 |}
3746 !! html
3747 <dl><dd><table>
3748
3749 <tr>
3750 <td> a
3751 <ul><li> b</li></ul>
3752 </td></tr>
3753 <tr>
3754 <td> c
3755 <ul><li> d</li></ul>
3756 </td></tr></table></dd></dl>
3757
3758 !! end
3759
3760 !!test
3761 Table / list interaction: lists nested in tables nested in indented lists
3762 !! wikitext
3763 :{|
3764 |
3765 :a
3766 :b
3767 |
3768 *c
3769 *d
3770 |}
3771
3772 *e
3773 *f
3774 !! html
3775 <dl><dd><table>
3776 <tr>
3777 <td>
3778 <dl><dd>a</dd>
3779 <dd>b</dd></dl>
3780 </td>
3781 <td>
3782 <ul><li>c</li>
3783 <li>d</li></ul>
3784 </td></tr></table></dd></dl>
3785 <ul><li>e</li>
3786 <li>f</li></ul>
3787
3788 !!end
3789
3790 !! test
3791 Definition Lists: Nesting: Multi-level (Parsoid only)
3792 !! options
3793 parsoid
3794 !! wikitext
3795 ;t1 :d1
3796 ;;t2 ::d2
3797 ;;;t3 :::d3
3798 !! html
3799 <dl>
3800 <dt>t1 </dt>
3801 <dd>d1</dd>
3802 <dt>
3803 <dl>
3804 <dt>t2 </dt>
3805 <dd>:d2</dd>
3806 <dt>
3807 <dl>
3808 <dt>t3 </dt>
3809 <dd>::d3</dd>
3810 </dl>
3811 </dt>
3812 </dl>
3813 </dt>
3814 </dl>
3815
3816
3817 !! end
3818
3819
3820 !! test
3821 Definition Lists: Nesting: Test 2 (Parsoid only)
3822 !! options
3823 parsoid
3824 !! wikitext
3825 ;t1
3826 ::d2
3827 !! html
3828 <dl>
3829 <dt>t1</dt>
3830 <dd>
3831 <dl>
3832 <dd>d2</dd>
3833 </dl>
3834 </dd>
3835 </dl>
3836
3837 !! end
3838
3839
3840 !! test
3841 Definition Lists: Nesting: Test 3 (Parsoid only)
3842 !! options
3843 parsoid
3844 !! wikitext
3845 :;t1
3846 ::::d2
3847 !! html
3848 <dl>
3849 <dd>
3850 <dl>
3851 <dt>t1</dt>
3852 <dd>
3853 <dl>
3854 <dd>
3855 <dl>
3856 <dd>d2</dd>
3857 </dl>
3858 </dd>
3859 </dl>
3860 </dd>
3861 </dl>
3862 </dd>
3863 </dl>
3864
3865 !! end
3866
3867
3868 !! test
3869 Definition Lists: Nesting: Test 4
3870 !! wikitext
3871 ::;t3
3872 :::d3
3873 !! html
3874 <dl><dd><dl><dd><dl><dt>t3</dt>
3875 <dd>d3</dd></dl></dd></dl></dd></dl>
3876
3877 !! end
3878
3879
3880 ## The Parsoid team believes the following three test exposes a
3881 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3882 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3883 ## It also exposes a "misfeature" in tidy, which doesn't like
3884 ## <dl> tags with a single <dt> child; it converts the <dt> into
3885 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3886 !! test
3887 Definition Lists: Mixed Lists: Test 1
3888 !! wikitext
3889 :;* foo
3890 ::* bar
3891 :; baz
3892 !! html/php
3893 <dl><dd><dl><dt><ul><li> foo</li>
3894 <li> bar</li></ul></dt></dl>
3895 <dl><dt> baz</dt></dl></dd></dl>
3896
3897 !! html/php+tidy
3898 <dl>
3899 <dd>
3900 <dl>
3901 <dd>
3902 <ul>
3903 <li>foo</li>
3904 <li>bar</li>
3905 </ul>
3906 </dd>
3907 </dl>
3908 <dl>
3909 <dt>baz</dt>
3910 </dl>
3911 </dd>
3912 </dl>
3913 !! html/parsoid
3914 <dl>
3915 <dd><dl>
3916 <dt><ul>
3917 <li> foo
3918 </li>
3919 </ul></dt>
3920 <dd><ul>
3921 <li> bar
3922 </li>
3923 </ul></dd>
3924 <dt> baz</dt>
3925 </dl></dd>
3926 </dl>
3927 !! end
3928
3929 !! test
3930 Definition Lists: Mixed Lists: Test 2
3931 !! wikitext
3932 *: d1
3933 *: d2
3934 !! html
3935 <ul><li><dl><dd> d1</dd>
3936 <dd> d2</dd></dl></li></ul>
3937
3938 !! end
3939
3940
3941 !! test
3942 Definition Lists: Mixed Lists: Test 3
3943 !! wikitext
3944 *::: d1
3945 *::: d2
3946 !! html
3947 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3948 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3949
3950 !! end
3951
3952
3953 !! test
3954 Definition Lists: Mixed Lists: Test 4
3955 !! wikitext
3956 *;d1 :d2
3957 *;d3 :d4
3958 !! html
3959 <ul><li><dl><dt>d1&#160;</dt>
3960 <dd>d2</dd>
3961 <dt>d3&#160;</dt>
3962 <dd>d4</dd></dl></li></ul>
3963
3964 !! end
3965
3966
3967 !! test
3968 Definition Lists: Mixed Lists: Test 5
3969 !! wikitext
3970 *:d1
3971 *:: d2
3972 !! html
3973 <ul><li><dl><dd>d1
3974 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3975
3976 !! end
3977
3978
3979 !! test
3980 Definition Lists: Mixed Lists: Test 6
3981 !! wikitext
3982 #*:d1
3983 #*::: d3
3984 !! html
3985 <ol><li><ul><li><dl><dd>d1
3986 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3987
3988 !! end
3989
3990
3991 !! test
3992 Definition Lists: Mixed Lists: Test 7
3993 !! wikitext
3994 :* d1
3995 :* d2
3996 !! html
3997 <dl><dd><ul><li> d1</li>
3998 <li> d2</li></ul></dd></dl>
3999
4000 !! end
4001
4002
4003 !! test
4004 Definition Lists: Mixed Lists: Test 8
4005 !! wikitext
4006 :* d1
4007 ::* d2
4008 !! html
4009 <dl><dd><ul><li> d1</li></ul>
4010 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4011
4012 !! end
4013
4014
4015 !! test
4016 Definition Lists: Mixed Lists: Test 9
4017 !! wikitext
4018 *;foo :bar
4019 !! html
4020 <ul><li><dl><dt>foo&#160;</dt>
4021 <dd>bar</dd></dl></li></ul>
4022
4023 !! end
4024
4025
4026 !! test
4027 Definition Lists: Mixed Lists: Test 10
4028 !! wikitext
4029 *#;foo :bar
4030 !! html
4031 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4032 <dd>bar</dd></dl></li></ol></li></ul>
4033
4034 !! end
4035
4036 # The Parsoid team disagrees with the PHP parser's seemingly-random
4037 # rules regarding dd/dt on the next two tests. Parsoid is more
4038 # consistent, and recognizes the shared nesting and keeps the
4039 # still-open tags around until the nesting is complete.
4040 # (And tidy again converts <dt> to <dd> before 'bar'.)
4041
4042 !! test
4043 Definition Lists: Mixed Lists: Test 11
4044 !! wikitext
4045 *#*#;*;;foo :bar
4046 *#*#;boo :baz
4047 !! html/php
4048 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4049 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4050 <dl><dt>boo&#160;</dt>
4051 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4052
4053 !! html/php+tidy
4054 <ul>
4055 <li>
4056 <ol>
4057 <li>
4058 <ul>
4059 <li>
4060 <ol>
4061 <li>
4062 <dl>
4063 <dt>foo&#160;</dt>
4064 <dd>
4065 <ul>
4066 <li>
4067 <dl>
4068 <dd>
4069 <dl>
4070 <dt>bar</dt>
4071 </dl>
4072 </dd>
4073 </dl>
4074 </li>
4075 </ul>
4076 </dd>
4077 </dl>
4078 <dl>
4079 <dt>boo&#160;</dt>
4080 <dd>baz</dd>
4081 </dl>
4082 </li>
4083 </ol>
4084 </li>
4085 </ul>
4086 </li>
4087 </ol>
4088 </li>
4089 </ul>
4090 !! html/parsoid
4091 <ul>
4092 <li>
4093 <ol>
4094 <li>
4095 <ul>
4096 <li>
4097 <ol>
4098 <li>
4099 <dl>
4100 <dt>
4101 <ul>
4102 <li>
4103 <dl>
4104 <dt>
4105 <dl>
4106 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4107 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4108 </dl></dt>
4109 </dl></li>
4110 </ul></dt>
4111 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4112 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4113 </dl></li>
4114 </ol></li>
4115 </ul></li>
4116 </ol></li>
4117 </ul>
4118 !! end
4119
4120
4121 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4122 # From whitelist:
4123 # * The test is wrong, there are two colons where there should be :;
4124 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4125 !! test
4126 Definition Lists: Weird Ones: Test 1
4127 !! wikitext
4128 *#;*::;; foo : bar (who uses this?)
4129 !! html/php
4130 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4131 <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>
4132
4133 !! html/php+tidy
4134 <ul>
4135 <li>
4136 <ol>
4137 <li>
4138 <dl>
4139 <dt>foo&#160;</dt>
4140 <dd>
4141 <ul>
4142 <li>
4143 <dl>
4144 <dd>
4145 <dl>
4146 <dd>
4147 <dl>
4148 <dd>
4149 <dl>
4150 <dt>bar (who uses this?)</dt>
4151 </dl>
4152 </dd>
4153 </dl>
4154 </dd>
4155 </dl>
4156 </dd>
4157 </dl>
4158 </li>
4159 </ul>
4160 </dd>
4161 </dl>
4162 </li>
4163 </ol>
4164 </li>
4165 </ul>
4166 !! html/parsoid
4167 <ul>
4168 <li>
4169 <ol>
4170 <li>
4171 <dl>
4172 <dt>
4173 <ul>
4174 <li>
4175 <dl>
4176 <dd>
4177 <dl>
4178 <dd>
4179 <dl>
4180 <dt>
4181 <dl>
4182 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4183 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4184 </dl></dt>
4185 </dl></dd>
4186 </dl></dd>
4187 </dl></li>
4188 </ul></dt>
4189 </dl></li>
4190 </ol></li>
4191 </ul>
4192 !! end
4193
4194 !! test
4195 Definition Lists: colons occurring in tags
4196 !! wikitext
4197 ;a:b
4198 ;'''a:b'''
4199 ;<i>a:b</i>
4200 ;<span>a:b</span>
4201 ;<div>a:b</div>
4202 ;<div>a
4203 :b</div>
4204 ;{{echo|a:b}}
4205 ;{{echo|''a:b''}}
4206 ;;;''a:b''
4207 !! html+tidy
4208 <dl>
4209 <dt>a</dt>
4210 <dd>b</dd>
4211 <dt><b>a:b</b></dt>
4212 <dt><i>a:b</i></dt>
4213 <dt><span>a:b</span></dt>
4214 <dd>
4215 <div>a:b</div>
4216 </dd>
4217 <dd>
4218 <div>a
4219 <dl>
4220 <dd>b</dd>
4221 </dl>
4222 </div>
4223 </dd>
4224 <dt>a</dt>
4225 <dd>b</dd>
4226 <dt><i>a:b</i></dt>
4227 </dl>
4228 <dl>
4229 <dd>
4230 <dl>
4231 <dd>
4232 <dl>
4233 <dt><i>a:b</i></dt>
4234 </dl>
4235 </dd>
4236 </dl>
4237 </dd>
4238 </dl>
4239 !! end
4240
4241 !! test
4242 Definition Lists: colons and tables 1
4243 !! wikitext
4244 :{|
4245 | x
4246 |}
4247 :{|
4248 | y
4249 |}
4250 !! html
4251 <dl><dd><table>
4252 <tr>
4253 <td> x
4254 </td></tr></table></dd></dl>
4255 <dl><dd><table>
4256 <tr>
4257 <td> y
4258 </td></tr></table></dd></dl>
4259
4260 !! end
4261
4262 # Parsoid's output (as documented below) differs from php's in this case.
4263 # This is probably a bug. If we fixup parsoid to match php's output, the
4264 # above test should pass and the below test case can be removed. It is
4265 # unclear which output is more desirable.
4266
4267 !! test
4268 Definition Lists: colons and tables 2
4269 !! wikitext
4270 :{|
4271 | x
4272 |}
4273 :{|
4274 | y
4275 |}
4276 !! html/parsoid
4277 <dl><dd><table>
4278 <tr>
4279 <td> x
4280 </td></tr></table></dd>
4281 <dd><table>
4282 <tr>
4283 <td> y
4284 </td></tr></table></dd></dl>
4285 !! end
4286
4287 !! test
4288 Definition Lists: template interaction
4289 !! wikitext
4290 ::{{definition_list}}
4291
4292 :one
4293 ::{{definition_list}}
4294 :::two
4295 :::three
4296 ::four
4297 !! html/parsoid
4298 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4299 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4300
4301 <dl><dd data-parsoid='{}'>one
4302 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4303 </span><dd about="#mwt2">two
4304 <dl><dd>two</dd>
4305 <dd>three</dd></dl></dd>
4306 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4307 !! end
4308
4309
4310 ###
4311 ### External links
4312 ###
4313 !! test
4314 External links: non-bracketed
4315 !! wikitext
4316 Non-bracketed: http://example.com
4317 !! html
4318 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4319 </p>
4320 !! end
4321
4322 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4323 !! test
4324 External links: numbered
4325 !! wikitext
4326 Numbered: [http://example.com]
4327 Numbered: [http://example.net]
4328 Numbered: [http://example.com]
4329 !! html/php
4330 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4331 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4332 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4333 </p>
4334 !! html/parsoid
4335 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4336 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4337 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4338 !!end
4339
4340 !! test
4341 External links: specified text
4342 !! wikitext
4343 Specified text: [http://example.com link]
4344 !! html
4345 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4346 </p>
4347 !!end
4348
4349 !! test
4350 External links: trail
4351 !! wikitext
4352 Linktrails should not work for external links: [http://example.com link]s
4353 !! html
4354 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4355 </p>
4356 !! end
4357
4358 !! test
4359 External links: dollar sign in URL
4360 !! wikitext
4361 http://example.com/1$2345
4362 !! html
4363 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4364 </p>
4365 !! end
4366
4367 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4368 !! test
4369 External links: dollar sign in URL (autonumber)
4370 !! wikitext
4371 [http://example.com/1$2345]
4372 !! html/php
4373 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4374 </p>
4375 !! html/parsoid
4376 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4377 !!end
4378
4379 !! test
4380 External links: open square bracket forbidden in URL (bug 4377)
4381 !! options
4382 parsoid=wt2html,wt2wt,html2html
4383 !! wikitext
4384 http://example.com/1[2345
4385 !! html/php
4386 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4387 </p>
4388 !! html/parsoid
4389 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4390 !! end
4391
4392 !! test
4393 External links: open square bracket forbidden in URL (named) (bug 4377)
4394 !! options
4395 parsoid=wt2html,html2html
4396 !! wikitext
4397 [http://example.com/1[2345]
4398 !! html/php
4399 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4400 </p>
4401 !! html/parsoid
4402 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4403 !!end
4404
4405 # parsoid adds a space before the link name
4406 !! test
4407 External links: open square bracket forbidden in URL (named) (bug 4377)
4408 Parsoid variant.
4409 !! wikitext
4410 [http://example.com/1 [2345]
4411 !! html
4412 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4413 </p>
4414 !!end
4415
4416 !! test
4417 External links: nowiki in URL link text (bug 6230)
4418 !! wikitext
4419 [http://example.com/ <nowiki>''example site''</nowiki>]
4420 !! html
4421 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4422 </p>
4423 !! end
4424
4425 !! test
4426 External links: newline forbidden in text (bug 6230 regression check)
4427 !! wikitext
4428 [http://example.com/ first
4429 second]
4430 !! html
4431 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4432 second]
4433 </p>
4434 !!end
4435
4436 !! test
4437 External links: Pipe char between url and text
4438 !! wikitext
4439 [http://example.com | link]
4440 !! html
4441 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4442 </p>
4443 !!end
4444
4445 !! test
4446 External links: protocol-relative URL in brackets
4447 !! wikitext
4448 [//example.com/ Test]
4449 !! html
4450 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4451 </p>
4452 !! end
4453
4454 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4455 !! test
4456 External links: protocol-relative URL in brackets without text
4457 !! wikitext
4458 [//example.com]
4459 !! html/php
4460 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4461 </p>
4462 !! html/parsoid
4463 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4464 !! end
4465
4466 !! test
4467 External links: protocol-relative URL in free text is left alone
4468 !! wikitext
4469 //example.com/Foo
4470 !! html
4471 <p>//example.com/Foo
4472 </p>
4473 !!end
4474
4475 !! test
4476 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4477 !! wikitext
4478 foo//example.com/Foo
4479 !! html
4480 <p>foo//example.com/Foo
4481 </p>
4482 !! end
4483
4484 !! test
4485 External links: with no contents
4486 !! wikitext
4487 [http://en.wikipedia.org/wiki/Foo]
4488
4489 [[wikipedia:Foo|Bar]]
4490
4491 [[wikipedia:Foo|<span>Bar</span>]]
4492 !! html/php
4493 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4494 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4495 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4496 </p>
4497 !! html/parsoid
4498 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4499 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4500 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4501 !! end
4502
4503 !! test
4504 External links: Free with trailing punctuation
4505 !! wikitext
4506 http://example.com,
4507 http://example.com;
4508 http://example.com\
4509 http://example.com.
4510 http://example.com:
4511 http://example.com!
4512 http://example.com?
4513 http://example.com)
4514 http://example.com/url_with_(brackets)
4515 (http://example.com/url_without_brackets)
4516 http://example.com/url_with_entity&nbsp;
4517 http://example.com/url_with_entity&#xA0;
4518 http://example.com/url_with_entity&#160;
4519 http://example.com/url_with_entity&lt;
4520 http://example.com/url_with_entity&#x3C;
4521 http://example.com/url_with_entity&#60;
4522 !! html/php
4523 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4524 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4525 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4526 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4527 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4528 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4529 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4530 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4531 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4532 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4533 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4534 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4535 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4536 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4537 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4538 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4539 </p>
4540 !! html/parsoid
4541 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4542 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4543 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4544 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4545 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4546 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4547 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4548 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4549 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4550 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4551 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4552 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4553 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4554 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4555 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4556 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4557 !! end
4558
4559 !! test
4560 External links: Lone protocols are never linked (T105697)
4561 !! wikitext
4562 http://
4563 http://;
4564 (http://)
4565 bitcoin:
4566 bitcoin:;
4567 (bitcoin:)
4568 !! html
4569 <p>http://
4570 http://;
4571 (http://)
4572 bitcoin:
4573 bitcoin:;
4574 (bitcoin:)
4575 </p>
4576 !! end
4577
4578 !! test
4579 External links: No preceding word characters allowed (bug 65278)
4580 !! wikitext
4581 NOPEhttp://example.com
4582 N0http://example.com
4583 ok:http://example.com
4584 ok-http://example.com
4585 !! html
4586 <p>NOPEhttp://example.com
4587 N0http://example.com
4588 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4589 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4590 </p>
4591 !! end
4592
4593 !! test
4594 External image
4595 !! wikitext
4596 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4597 !! html
4598 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4599 </p>
4600 !! end
4601
4602 !! test
4603 External image from https
4604 !! wikitext
4605 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4606 !! html
4607 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4608 </p>
4609 !! end
4610
4611 !! test
4612 External image (when not allowed)
4613 !! options
4614 wgAllowExternalImages=0
4615 !! wikitext
4616 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4617 !! html
4618 <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>
4619 </p>
4620 !! end
4621
4622 !! test
4623 Link to non-http image, no img tag
4624 !! wikitext
4625 Link to non-http image, no img tag: ftp://example.com/test.jpg
4626 !! html
4627 <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>
4628 </p>
4629 !! end
4630
4631 !! test
4632 External links: terminating separator
4633 !! wikitext
4634 Terminating separator: http://example.com/thing,
4635 !! html
4636 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4637 </p>
4638 !! end
4639
4640 !! test
4641 External links: intervening separator
4642 !! wikitext
4643 Intervening separator: http://example.com/1,2,3
4644 !! html
4645 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4646 </p>
4647 !! end
4648
4649 !! test
4650 External links: old bug with URL in query
4651 !! wikitext
4652 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4653 !! html
4654 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4655 </p>
4656 !! end
4657
4658 !! test
4659 External links: old URL-in-URL bug, mixed protocols
4660 !! wikitext
4661 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4662 !! html
4663 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4664 </p>
4665 !!end
4666
4667 !! test
4668 External links: URL in text
4669 !! wikitext
4670 URL in text: [http://example.com http://example.com]
4671 !! html
4672 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4673 </p>
4674 !! end
4675
4676 !! test
4677 External links: Clickable images
4678 !! wikitext
4679 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4680 !! html/php
4681 <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>
4682 </p>
4683 !! html/parsoid
4684 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4685 !! end
4686
4687 !! test
4688 External links: raw ampersand
4689 !! wikitext
4690 Old &amp; use: http://x&y
4691 !! html
4692 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4693 </p>
4694 !! end
4695
4696 !! test
4697 External links: encoded ampersand
4698 !! wikitext
4699 Old &amp; use: http://x&amp;y
4700 !! html/php
4701 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4702 </p>
4703 !! html/parsoid
4704 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4705 !! end
4706
4707 !! test
4708 External links: encoded equals (bug 6102)
4709 !! wikitext
4710 http://example.com/?foo&#61;bar
4711 !! html/php
4712 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4713 </p>
4714 !! html/parsoid
4715 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4716 !! end
4717
4718 ##
4719 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4720 ## does it number them. As discussed in bug 53505, we can identify
4721 ## autonumbered links via CSS.
4722 ##
4723
4724 !! test
4725 External links: [raw ampersand]
4726 !! wikitext
4727 Old &amp; use: [http://x&y]
4728 !! html/php
4729 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4730 </p>
4731 !! html/parsoid
4732 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4733 !! end
4734
4735 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4736 # mode will return the [raw ampersand] wikitext
4737 !! test
4738 External links: [encoded ampersand]
4739 !! options
4740 parsoid=wt2html,wt2wt,html2html
4741 !! wikitext
4742 Old &amp; use: [http://x&amp;y]
4743 !! html/php
4744 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4745 </p>
4746 !! html/parsoid
4747 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4748 !! end
4749
4750 !! test
4751 External links: [raw equals]
4752 !! wikitext
4753 [http://example.com/?foo=bar]
4754 !! html/php
4755 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4756 </p>
4757 !! html/parsoid
4758 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4759 !! end
4760
4761 # note that parsoid html is identical to [raw equals] case; so html2wt
4762 # mode will return the [raw equals] wikitext
4763 !! test
4764 External links: [encoded equals] (bug 6102)
4765 !! options
4766 parsoid=wt2html,wt2wt,html2html
4767 !! wikitext
4768 [http://example.com/?foo&#61;bar]
4769 !! html/php
4770 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4771 </p>
4772 !! html/parsoid
4773 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4774 !! end
4775
4776 # xxx parsoid strips the IDN character, so the round-trip tests will
4777 # obviously fail and are disabled. --cscott
4778 !! test
4779 External links: [IDN ignored character reference in hostname; strip it right off]
4780 !! options
4781 parsoid=wt2html,wt2wt,html2html
4782 !! wikitext
4783 [http://e&zwnj;xample.com/]
4784 !! html/php
4785 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4786 </p>
4787 !! html/parsoid
4788 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4789 !! end
4790
4791 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4792 # Where an external link could easily circumvent the sanitization of the text of
4793 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4794 # test demands a higher standard. That's a bit strange.
4795 #
4796 # Example:
4797 #
4798 # http://e‌xample.com -> [http://example.com|http://example.com]
4799 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4800 #
4801 # The first example is sanitized, but the second is not. Any security benefits
4802 # from this production are trivial to circumvent. Either remove this test and
4803 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4804 # the test accordingly.
4805 #
4806 # All our love,
4807 # The Parsoid team.
4808 # xxx parsoid strips the IDN character, so the round-trip tests will
4809 # obviously fail and are disabled. --cscott
4810 !! test
4811 External links: IDN ignored character reference in hostname; strip it right off
4812 !! options
4813 parsoid=wt2html,html2html
4814 !! wikitext
4815 http://e&zwnj;xample.com/
4816 !! html/php
4817 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4818 </p>
4819 !! html/parsoid
4820 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4821 !! end
4822
4823 !! test
4824 External links: www.jpeg.org (bug 554)
4825 !! wikitext
4826 http://www.jpeg.org
4827 !! html
4828 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4829 </p>
4830 !! end
4831
4832 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4833 !! test
4834 External links: URL within URL (original bug 2)
4835 !! wikitext
4836 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4837 !! html/php
4838 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4839 </p>
4840 !! html/parsoid
4841 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4842 !! end
4843
4844 !! test
4845 BUG 361: URL inside bracketed URL
4846 !! wikitext
4847 [http://www.example.com/foo http://www.example.com/bar]
4848 !! html
4849 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4850 </p>
4851 !! end
4852
4853 !! test
4854 BUG 361: URL within URL, not bracketed
4855 !! wikitext
4856 http://www.example.com/foo?=http://www.example.com/bar
4857 !! html
4858 <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>
4859 </p>
4860 !! end
4861
4862 !! test
4863 BUG 289: ">"-token in URL-tail
4864 !! wikitext
4865 http://www.example.com/<hello>
4866 !! html
4867 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4868 </p>
4869 !!end
4870
4871 !! test
4872 BUG 289: literal ">"-token in URL-tail
4873 !! wikitext
4874 http://www.example.com/<b>html</b>
4875 !! html/php
4876 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4877 </p>
4878 !! html/parsoid
4879 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4880 !! end
4881
4882 !! test
4883 BUG 289: ">"-token in bracketed URL
4884 !! wikitext
4885 [http://www.example.com/<hello> stuff]
4886 !! html
4887 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4888 </p>
4889 !!end
4890
4891 !! test
4892 BUG 289: literal ">"-token in bracketed URL
4893 !! wikitext
4894 [http://www.example.com/<b>html</b> stuff]
4895 !! html
4896 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4897 </p>
4898 !!end
4899
4900 !! test
4901 BUG 289: literal double quote at end of URL
4902 !! wikitext
4903 http://www.example.com/"hello"
4904 !! html
4905 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4906 </p>
4907 !!end
4908
4909 !! test
4910 BUG 289: literal double quote in bracketed URL
4911 !! wikitext
4912 [http://www.example.com/"hello" stuff]
4913 !! html
4914 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4915 </p>
4916 !!end
4917
4918 !! test
4919 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4920 !! wikitext
4921 [http://www.example.com test]
4922 !! html
4923 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4924 </p>
4925 !! end
4926
4927 !! test
4928 External links: link text with spaces
4929 !! wikitext
4930 [http://www.example.com a b c]
4931 [http://www.example.com ''a'' ''b'']
4932 !! html
4933 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4934 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4935 </p>
4936 !! end
4937
4938 !! test
4939 External links: wiki links within external link (Bug 3695)
4940 !! wikitext
4941 [http://example.com [[wikilink]] embedded in ext link]
4942 !! html/php
4943 <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>
4944 </p>
4945 !! html/parsoid
4946 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
4947 !! end
4948
4949 !! test
4950 BUG 787: Links with one slash after the url protocol are invalid
4951 !! wikitext
4952 http:/example.com
4953
4954 [http:/example.com title]
4955 !! html
4956 <p>http:/example.com
4957 </p><p>[http:/example.com title]
4958 </p>
4959 !! end
4960
4961 !! test
4962 Bracketed external links with template-generated invalid target
4963 !! wikitext
4964 [{{echo|http:/example.com}} title]
4965 !! html
4966 <p>[http:/example.com title]
4967 </p>
4968 !! end
4969
4970 !! test
4971 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4972 !! wikitext
4973 ''[http://example.com text'']
4974 [http://example.com '''text]'''
4975 ''Something [http://example.com in italic'']
4976 ''Something [http://example.com mixed''''', even bold]'''
4977 '''''Now [http://example.com both''''']
4978 !! html
4979 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4980 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4981 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4982 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4983 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4984 </p>
4985 !! end
4986
4987
4988 !! test
4989 Bug 4781: %26 in URL
4990 !! wikitext
4991 http://www.example.com/?title=AT%26T
4992 !! html/php
4993 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4994 </p>
4995 !! html/parsoid
4996 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4997 !! end
4998
4999 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5000 # % is actually legal in HTML5. Any change in output would need testing though.
5001 !! test
5002 Bug 4781, 5267: %25 in URL
5003 !! wikitext
5004 http://www.example.com/?title=100%25_Bran
5005 !! html/php
5006 <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>
5007 </p>
5008 !! html/parsoid
5009 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5010 !! end
5011
5012 !! test
5013 Bug 4781, 5267: %28, %29 in URL
5014 !! wikitext
5015 http://www.example.com/?title=Ben-Hur_%281959_film%29
5016 !! html/php
5017 <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>
5018 </p>
5019 !! html/parsoid
5020 <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>
5021 !! end
5022
5023
5024 !! test
5025 Bug 4781: %26 in autonumber URL
5026 !! wikitext
5027 [http://www.example.com/?title=AT%26T]
5028 !! html/php
5029 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5030 </p>
5031 !! html/parsoid
5032 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5033 !! end
5034
5035 !! test
5036 Bug 4781, 5267: %26 in autonumber URL
5037 !! wikitext
5038 [http://www.example.com/?title=100%25_Bran]
5039 !! html/php
5040 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5041 </p>
5042 !! html/parsoid
5043 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5044 !! end
5045
5046 !! test
5047 Bug 4781, 5267: %28, %29 in autonumber URL
5048 !! wikitext
5049 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5050 !! html/php
5051 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5052 </p>
5053 !! html/parsoid
5054 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5055 !! end
5056
5057
5058 !! test
5059 Bug 4781: %26 in bracketed URL
5060 !! wikitext
5061 [http://www.example.com/?title=AT%26T link]
5062 !! html/php
5063 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5064 </p>
5065 !! html/parsoid
5066 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5067 !! end
5068
5069 !! test
5070 Bug 4781, 5267: %25 in bracketed URL
5071 !! wikitext
5072 [http://www.example.com/?title=100%25_Bran link]
5073 !! html
5074 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5075 </p>
5076 !! end
5077
5078 !! test
5079 Bug 4781, 5267: %28, %29 in bracketed URL
5080 !! wikitext
5081 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5082 !! html/php
5083 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5084 </p>
5085 !! html/parsoid
5086 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5087 !! end
5088
5089 !! test
5090 External link containing a period in the anchor. (bug 63947)
5091 !! wikitext
5092 [//foo.org/bar#baz. bang]
5093
5094 [//foo.org/bar. bang]
5095 !! html/php
5096 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5097 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5098 </p>
5099 !! html/parsoid
5100 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5101 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5102 !! end
5103
5104 !! test
5105 External link containing a single quote. (bug 63947)
5106 !! wikitext
5107 [//foo.org/bar'baz]
5108
5109 [//foo.org/bar'baz bang]
5110 !! html/php
5111 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5112 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5113 </p>
5114 !! html/parsoid
5115 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5116 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5117 !! end
5118
5119
5120 !! test
5121 External link containing a period in the anchor. (bug 63947)
5122 !! wikitext
5123 [//foo.org/bar#baz. bang]
5124
5125 [//foo.org/bar. bang]
5126 !! html/php
5127 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5128 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5129 </p>
5130 !! html/parsoid
5131 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5132 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5133 !! end
5134
5135 !! test
5136 External link containing a single quote. (bug 63947)
5137 !! wikitext
5138 [//foo.org/bar'baz]
5139
5140 [//foo.org/bar'baz bang]
5141 !! html/php
5142 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5143 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5144 </p>
5145 !! html/parsoid
5146 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5147 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5148 !! end
5149
5150
5151 !! test
5152 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5153 !! wikitext
5154 Some [http://example.com/ pretty ''italics'' and stuff]!
5155 !! html
5156 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5157 </p>
5158 !! end
5159
5160 !! test
5161 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5162 !! wikitext
5163 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5164 !! html
5165 <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>
5166 </p>
5167 !! end
5168
5169 !! test
5170 External link containing double-single-quotes with no space separating the url from text in italics
5171 !! wikitext
5172 [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]].]
5173 !! html/php
5174 <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>
5175 </p>
5176 !! html/php+tidy
5177 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5178 !! html/parsoid
5179 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5180 !! end
5181
5182 !! test
5183 External link with comments in link text
5184 !! wikitext
5185 [http://www.google.com Google <!-- comment -->]
5186 !! html
5187 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5188 </p>
5189 !! end
5190
5191 !! test
5192 URL-encoding in URL functions (single parameter)
5193 !! wikitext
5194 {{localurl:Some page|amp=&}}
5195 !! html
5196 <p>/index.php?title=Some_page&amp;amp=&amp;
5197 </p>
5198 !! end
5199
5200 !! test
5201 URL-encoding in URL functions (multiple parameters)
5202 !! wikitext
5203 {{localurl:Some page|q=?&amp=&}}
5204 !! html
5205 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5206 </p>
5207 !! end
5208
5209 !! test
5210 Brackets in urls
5211 !! wikitext
5212 http://example.com/index.php?foozoid%5B%5D=bar
5213
5214 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5215 !! html/php
5216 <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>
5217 </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>
5218 </p>
5219 !! html/parsoid
5220 <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>
5221
5222 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5223 !! end
5224
5225 !! test
5226 IPv6 urls (bug 21261)
5227 !! options
5228 disabled
5229 !! wikitext
5230 http://[2404:130:0:1000::187:2]/index.php
5231 !! html
5232 <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>
5233 </p>
5234 !! end
5235
5236 !! test
5237 Non-extlinks in brackets
5238 !! wikitext
5239 [foo]
5240 [foo bar]
5241 [foo ''bar'']
5242 [fool's] errand
5243 [fool's errand]
5244 [{{echo|foo}}]
5245 [{{echo|foo}} bar]
5246 [{{echo|foo}} ''bar'']
5247 [{{echo|foo}}l's] errand
5248 [{{echo|foo}}l's errand]
5249 [url={{echo|foo}}]
5250 [url=http://example.com]
5251 !! html
5252 <p>[foo]
5253 [foo bar]
5254 [foo <i>bar</i>]
5255 [fool's] errand
5256 [fool's errand]
5257 [foo]
5258 [foo bar]
5259 [foo <i>bar</i>]
5260 [fool's] errand
5261 [fool's errand]
5262 [url=foo]
5263 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5264 </p>
5265 !! end
5266
5267 !! test
5268 Percent encoding in external links
5269 !! wikitext
5270 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5271 !! html/php
5272 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5273 </p>
5274 !! html/parsoid
5275 <p><a rel="mw:ExtLink"
5276 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5277 !! end
5278
5279 !! test
5280 Use url link syntax for links where the content is equal the link target
5281 !! wikitext
5282 http://example.com
5283 !! html/php
5284 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5285 </p>
5286 !! html/parsoid
5287 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5288 !! end
5289
5290 !! test
5291 Parenthesis in external links, especially URL links
5292 !! wikitext
5293 http://example.com)
5294
5295 http://example.com/test)
5296
5297 http://example.com/(test)
5298
5299 http://example.com/((test)
5300
5301 (http://example.com/(test))
5302
5303 (http://example.com/(test)))))
5304
5305 http://example.com/a)b
5306
5307 [http://example.com) foo]
5308 !! html/php
5309 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5310 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5311 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5312 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5313 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5314 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5315 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5316 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5317 </p>
5318 !! html/parsoid
5319 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5320 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5321 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5322 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5323 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5324 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5325 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5326 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5327 !! end
5328
5329 !! test
5330 Parenthesis in external links, w/ transclusion or comment
5331 !! wikitext
5332 (http://example.com/{{echo|hi}})
5333
5334 (http://example.com<!-- hi -->)
5335 !! html/php
5336 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5337 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5338 </p>
5339 !! html/parsoid
5340 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5341
5342 <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>
5343 !! end
5344
5345 !! test
5346 Serialize <a> tags with invalid link targets as plain text
5347 !! options
5348 parsoid=html2wt
5349 !! html
5350 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5351 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5352 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5353 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5354 !! wikitext
5355 text
5356 <nowiki>*</nowiki>text
5357 <nowiki>[[foo]]</nowiki>
5358 <nowiki>*a [[foo]]</nowiki>
5359 !! end
5360
5361 !! test
5362 mw:ExtLink -vs- mw:WikiLink (T94723)
5363 !! options
5364 parsoid=html2wt
5365 !! html/parsoid
5366 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5367 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5368 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5369 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5370 <p>
5371 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5372 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5373 </p>
5374 !! wikitext
5375 [[Foo|Bar]]
5376 [[Foo|Bar]]
5377 [[wikipedia:Foo|Bar]]
5378 [[wikipedia:Foo|Bar]]
5379
5380 [[wikipedia:European_Robin|European Robin]]
5381 [[wikipedia:European_Robin|European Robin]]
5382 !! end
5383
5384 !! test
5385 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5386 !! options
5387 parsoid=wt2wt
5388 !! wikitext
5389 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5390 !! html/parsoid
5391 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5392 !! end
5393
5394
5395 ###
5396 ### Quotes
5397 ###
5398
5399 !! test
5400 Quotes
5401 !! wikitext
5402 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5403
5404 Normal text. '''''Bold italic text.''''' Normal text.
5405 !! html
5406 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5407 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5408 </p>
5409 !! end
5410
5411
5412 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5413 # parser strips. The wikitext contains just the first half of the bold
5414 # quote pair.
5415 !! test
5416 Unclosed and unmatched quotes
5417 !! wikitext
5418 '''''Bold italic text '''with bold deactivated''' in between.'''''
5419
5420 '''''Bold italic text ''with italic deactivated'' in between.'''''
5421
5422 '''Bold text..
5423
5424 ..spanning two paragraphs (should not work).'''
5425
5426 '''Bold tag left open
5427
5428 ''Italic tag left open
5429
5430 Normal text.
5431
5432 <!-- Unmatching number of opening, closing tags: -->
5433 '''This year''''s election ''should'' beat '''last year''''s.
5434
5435 ''Tom'''s car is bigger than ''Susan'''s.
5436
5437 Plain ''italic'''s plain
5438 !! html/php
5439 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5440 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5441 </p><p><b>Bold text..</b>
5442 </p><p>..spanning two paragraphs (should not work).
5443 </p><p><b>Bold tag left open</b>
5444 </p><p><i>Italic tag left open</i>
5445 </p><p>Normal text.
5446 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5447 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5448 </p><p>Plain <i>italic'</i>s plain
5449 </p>
5450 !! html/parsoid
5451 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5452 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5453 </p><p><b>Bold text..</b>
5454 </p><p>..spanning two paragraphs (should not work).<b></b>
5455 </p><p><b>Bold tag left open</b>
5456 </p><p><i>Italic tag left open</i>
5457 </p><p>Normal text.
5458 </p>
5459 <!-- Unmatching number of opening, closing tags: -->
5460 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5461 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5462 </p><p>Plain <i>italic'</i>s plain
5463 </p>
5464 !! end
5465
5466 ###
5467 ### Tables
5468 ###
5469 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5470 ###
5471
5472 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5473 # is the bare minimum required by the spec, see:
5474 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5475 # Parsoid team replies: empty table tags are legal in HTML5
5476 !! test
5477 A table with no data.
5478 !! options
5479 parsoid=wt2html
5480 !! wikitext
5481 {||}
5482 !! html/php
5483
5484 !! html/parsoid
5485 <table></table>
5486
5487 !! end
5488
5489 !! test
5490 A table with stray table end tags on start tag line (wt2html)
5491 !! options
5492 parsoid=wt2html
5493 !! wikitext
5494 {|style="color: red;"|}
5495
5496 {|style="color: red;" |}
5497 |foo
5498 |}
5499
5500 {|style="color: red;"|} id="foo"
5501 |foo
5502 |}
5503
5504 {|style="color: red;" |} id="foo"
5505 |foo
5506 |}
5507 !! html
5508 <table style="color: red;"></table>
5509
5510 <table style="color: red;">
5511 <tbody><tr>
5512 <td>foo</td>
5513 </tr></tbody>
5514 </table>
5515
5516 <table style="color: red;" id="foo">
5517 <tbody><tr>
5518 <td>foo</td>
5519 </tr></tbody>
5520 </table>
5521
5522 <table style="color: red;" id="foo">
5523 <tbody><tr>
5524 <td>foo</td>
5525 </tr></tbody>
5526 </table>
5527
5528 !! end
5529
5530 !! test
5531 A table with no data (take 2)
5532 !! wikitext
5533 {|
5534 |}
5535 !! html/parsoid
5536 <table></table>
5537 !! end
5538
5539 # A table with nothing but a caption is invalid XHTML, we might want to render
5540 # this as <p>caption</p>
5541 # Parsoid team replies: table with only a caption is legal in HTML5
5542 !! test
5543 A table with nothing but a caption
5544 !! wikitext
5545 {|
5546 |+ caption
5547 |}
5548 !! html/php
5549 <table>
5550 <caption> caption
5551 </caption><tr><td></td></tr></table>
5552
5553 !! html/parsoid
5554 <table><caption> caption</caption></table>
5555 !! end
5556
5557 !! test
5558 A table with caption with default-spaced attributes and a table row
5559 !! wikitext
5560 {|
5561 |+ style="color: red;" | caption1
5562 |-
5563 | foo
5564 |}
5565 !! html
5566 <table>
5567 <caption style="color: red;"> caption1
5568 </caption>
5569 <tr>
5570 <td> foo
5571 </td></tr></table>
5572
5573 !! end
5574
5575 !! test
5576 A table with captions with non-default spaced attributes and a table row
5577 !! wikitext
5578 {|
5579 |+style="color: red;"|caption2
5580 |+ style="color: red;"| caption3
5581 |-
5582 | foo
5583 |}
5584 !! html
5585 <table>
5586 <caption style="color: red;">caption2
5587 </caption>
5588 <caption style="color: red;"> caption3
5589 </caption>
5590 <tr>
5591 <td> foo
5592 </td></tr></table>
5593
5594 !! end
5595
5596 !! test
5597 Table td-cell syntax variations
5598 !! wikitext
5599 {|
5600 | foo bar foo | baz
5601 | foo bar foo || baz
5602 | style='color:red;' | baz
5603 | style='color:red;' || baz
5604 |}
5605 !! html
5606 <table>
5607 <tr>
5608 <td> baz
5609 </td>
5610 <td> foo bar foo </td>
5611 <td> baz
5612 </td>
5613 <td style="color:red;"> baz
5614 </td>
5615 <td> style='color:red;' </td>
5616 <td> baz
5617 </td></tr></table>
5618
5619 !! end
5620
5621 !! test
5622 Simple table
5623 !! wikitext
5624 {|
5625 | 1 || 2
5626 |-
5627 | 3 || 4
5628 |}
5629 !! html
5630 <table>
5631 <tr>
5632 <td> 1 </td>
5633 <td> 2
5634 </td></tr>
5635 <tr>
5636 <td> 3 </td>
5637 <td> 4
5638 </td></tr></table>
5639
5640 !! end
5641
5642 !! test
5643 Simple table but with multiple dashes for row wikitext
5644 !! wikitext
5645 {|
5646 | foo
5647 |-----
5648 | bar
5649 |}
5650 !! html
5651 <table>
5652 <tr>
5653 <td> foo
5654 </td></tr>
5655 <tr>
5656 <td> bar
5657 </td></tr></table>
5658
5659 !! end
5660
5661 !! test
5662 Multiplication table
5663 !! wikitext
5664 {| border="1" cellpadding="2"
5665 |+Multiplication table
5666 |-
5667 ! &times; !! 1 !! 2 !! 3
5668 |-
5669 ! 1
5670 | 1 || 2 || 3
5671 |-
5672 ! 2
5673 | 2 || 4 || 6
5674 |-
5675 ! 3
5676 | 3 || 6 || 9
5677 |-
5678 ! 4
5679 | 4 || 8 || 12
5680 |-
5681 ! 5
5682 | 5 || 10 || 15
5683 |}
5684 !! html
5685 <table border="1" cellpadding="2">
5686 <caption>Multiplication table
5687 </caption>
5688 <tr>
5689 <th> &#215; </th>
5690 <th> 1 </th>
5691 <th> 2 </th>
5692 <th> 3
5693 </th></tr>
5694 <tr>
5695 <th> 1
5696 </th>
5697 <td> 1 </td>
5698 <td> 2 </td>
5699 <td> 3
5700 </td></tr>
5701 <tr>
5702 <th> 2
5703 </th>
5704 <td> 2 </td>
5705 <td> 4 </td>
5706 <td> 6
5707 </td></tr>
5708 <tr>
5709 <th> 3
5710 </th>
5711 <td> 3 </td>
5712 <td> 6 </td>
5713 <td> 9
5714 </td></tr>
5715 <tr>
5716 <th> 4
5717 </th>
5718 <td> 4 </td>
5719 <td> 8 </td>
5720 <td> 12
5721 </td></tr>
5722 <tr>
5723 <th> 5
5724 </th>
5725 <td> 5 </td>
5726 <td> 10 </td>
5727 <td> 15
5728 </td></tr></table>
5729
5730 !! end
5731
5732 !! test
5733 Accept "||" in table headings
5734 !! wikitext
5735 {|
5736 !h1 || h2
5737 |}
5738 !! html
5739 <table>
5740 <tr>
5741 <th>h1 </th>
5742 <th> h2
5743 </th></tr></table>
5744
5745 !! end
5746
5747 !! test
5748 Accept "!!" in table data
5749 !! wikitext
5750 {|
5751 | Foo!! ||
5752 |}
5753 !! html
5754 <table>
5755 <tr>
5756 <td> Foo!! </td>
5757 <td>
5758 </td></tr></table>
5759
5760 !! html/parsoid
5761 <table>
5762 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5763 </tbody></table>
5764 !! end
5765
5766 !! test
5767 Accept "||" in indented table headings
5768 !! wikitext
5769 :{|
5770 !h1 || h2
5771 |}
5772 !! html
5773 <dl><dd><table>
5774 <tr>
5775 <th>h1 </th>
5776 <th> h2
5777 </th></tr></table></dd></dl>
5778
5779 !! end
5780
5781 !! test
5782 Accept "!!" in templates
5783 !! wikitext
5784 {|
5785 !a {{echo|b!!c}}
5786 |}
5787 !! html/php
5788 <table>
5789 <tr>
5790 <th>a b</th>
5791 <th>c
5792 </th></tr></table>
5793
5794 !! html/parsoid
5795 <table>
5796 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
5797 !! end
5798
5799 !! test
5800 Accept "!!" in table headings after newline
5801 !! wikitext
5802 {|
5803 !a
5804 b!!c
5805 |}
5806 !! html/php
5807 <table>
5808 <tr>
5809 <th>a
5810 <p>b!!c
5811 </p>
5812 </th></tr></table>
5813
5814 !! html/parsoid
5815 <table>
5816 <tbody><tr><th>a
5817 <p>b!!c</p></th></tr>
5818 </tbody></table>
5819 !! end
5820
5821 !! test
5822 Accept "!!" in table data of mixed wikitext / html syntax
5823 !! wikitext
5824 {|
5825 !a
5826 <tr><td>b!!c</td></tr>
5827 |}
5828 !! html+tidy
5829 <table>
5830 <tr>
5831 <th>a</th>
5832 </tr>
5833 <tr>
5834 <td>b!!c</td>
5835 </tr>
5836 </table>
5837 !! html/parsoid
5838 <table>
5839 <tbody><tr><th>a</th></tr>
5840 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
5841 </tbody></table>
5842 !! end
5843
5844 !! test
5845 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5846 !! wikitext
5847 {|
5848 !| h1
5849 || a
5850 |}
5851 !! html
5852 <table>
5853 <tr>
5854 <th> h1
5855 </th>
5856 <td> a
5857 </td></tr></table>
5858
5859 !! end
5860
5861 !!test
5862 Accept "| !" at start of line in tables (ignore !-attribute)
5863 !! wikitext
5864 {|
5865 |-
5866 | !style="color:red" | bar
5867 |}
5868 !! html
5869 <table>
5870
5871 <tr>
5872 <td> bar
5873 </td></tr></table>
5874
5875 !!end
5876
5877 !!test
5878 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 +/-
5879 !! wikitext
5880 {|
5881 |-
5882 |style='color:red;'|+1
5883 |style='color:blue;'|-1
5884 |-
5885 | 1 || 2 || 3
5886 | 1 ||+2 ||-3
5887 |-
5888 | +1
5889 | -1
5890 |}
5891 !! html
5892 <table>
5893
5894 <tr>
5895 <td style="color:red;">+1
5896 </td>
5897 <td style="color:blue;">-1
5898 </td></tr>
5899 <tr>
5900 <td> 1 </td>
5901 <td> 2 </td>
5902 <td> 3
5903 </td>
5904 <td> 1 </td>
5905 <td>+2 </td>
5906 <td>-3
5907 </td></tr>
5908 <tr>
5909 <td> +1
5910 </td>
5911 <td> -1
5912 </td></tr></table>
5913
5914 !!end
5915
5916 !! test
5917 Table rowspan
5918 !! wikitext
5919 {| border=1
5920 | Cell 1, row 1
5921 |rowspan=2| Cell 2, row 1 (and 2)
5922 | Cell 3, row 1
5923 |-
5924 | Cell 1, row 2
5925 | Cell 3, row 2
5926 |}
5927 !! html
5928 <table border="1">
5929 <tr>
5930 <td> Cell 1, row 1
5931 </td>
5932 <td rowspan="2"> Cell 2, row 1 (and 2)
5933 </td>
5934 <td> Cell 3, row 1
5935 </td></tr>
5936 <tr>
5937 <td> Cell 1, row 2
5938 </td>
5939 <td> Cell 3, row 2
5940 </td></tr></table>
5941
5942 !! end
5943
5944 !! test
5945 Nested table
5946 !! wikitext
5947 {| border=1
5948 | &alpha;
5949 |
5950 {| bgcolor=#ABCDEF border=2
5951 |nested
5952 |-
5953 |table
5954 |}
5955 |the original table again
5956 |}
5957 !! html
5958 <table border="1">
5959 <tr>
5960 <td> &#945;
5961 </td>
5962 <td>
5963 <table bgcolor="#ABCDEF" border="2">
5964 <tr>
5965 <td>nested
5966 </td></tr>
5967 <tr>
5968 <td>table
5969 </td></tr></table>
5970 </td>
5971 <td>the original table again
5972 </td></tr></table>
5973
5974 !! end
5975
5976 !! test
5977 Invalid attributes in table cell (bug 1830)
5978 !! wikitext
5979 {|
5980 |Cell:|broken
5981 |}
5982 !! html
5983 <table>
5984 <tr>
5985 <td>broken
5986 </td></tr></table>
5987
5988 !! end
5989
5990 !! test
5991 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
5992 !! wikitext
5993 {|
5994 | title="foo" |bar
5995 | title="foo<nowiki>|</nowiki>" |bar
5996 | title="foo<nowiki>|</nowiki>" bar
5997 |}
5998 !! html
5999 <table>
6000 <tr>
6001 <td title="foo">bar
6002 </td>
6003 <td title="foo&#124;">bar
6004 </td>
6005 <td> title="foo|" bar
6006 </td></tr></table>
6007
6008 !! end
6009
6010 # The "|}" to close the table is missing from the input, so parsoid's
6011 # *2wt modes will fail.
6012 !! test
6013 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6014 !! options
6015 parsoid=wt2html,html2html
6016 !! wikitext
6017 {|
6018 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6019 !! html/php
6020 <table>
6021 <tr>
6022 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6023 <td>]" onmouseover="alert(document.cookie)"&gt;test
6024 </td>
6025 </tr>
6026 </table>
6027
6028 !! html/parsoid
6029 <table><tbody>
6030 <tr>
6031 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6032 !! end
6033
6034 # FIXME: The php output is broken.
6035 !! test
6036 ! and || in td attributes should not be parsed as <th>/<td>
6037 !! wikitext
6038 {|
6039 | style="color: red !important;" data-contrived="put this here ||" | foo
6040 |}
6041 !! html/php
6042 <table>
6043 <tr>
6044 <td> style="color: red !important;" data-contrived="put this here </td>
6045 <td> foo
6046 </td></tr></table>
6047
6048 !! html/parsoid
6049 <table>
6050 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6051 </tbody></table>
6052 !! end
6053
6054 !! test
6055 Indented table markup mixed with indented pre content (proposed in bug 6200)
6056 !! wikitext
6057 <table>
6058 <tr>
6059 <td>
6060 Text that should be rendered preformatted
6061 </td>
6062 </tr>
6063 </table>
6064 !! html
6065 <table>
6066 <tr>
6067 <td>
6068 <pre>Text that should be rendered preformatted
6069 </pre>
6070 </td>
6071 </tr>
6072 </table>
6073
6074 !! end
6075
6076 !! test
6077 1. Template-generated table cell attributes and cell content
6078 !! wikitext
6079 {|
6080 |{{table_attribs}}
6081 | {{table_attribs}}
6082 || {{table_attribs_5}}
6083 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6084 |align=center {{table_attribs}}
6085 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6086 |}
6087 !! html
6088 <table>
6089 <tr>
6090 <td style="color:red;">Foo
6091 </td>
6092 <td style="color:red;">Foo
6093 </td>
6094 <td> style="color:red;"</td>
6095 <td>Bar
6096 </td>
6097 <td style="color:red;">Foo
6098 </td>
6099 <td align="center" style="color:red;">Foo
6100 </td>
6101 <td align="center" style="color:red;">Foo
6102 </td></tr></table>
6103
6104 !! end
6105
6106 !! test
6107 2. Template-generated table cell attributes and cell content
6108 !! wikitext
6109 {|
6110 |{{table_attribs_2}}
6111 |}
6112 !! html/php
6113 <table>
6114 <tr>
6115 <td style="color:red;">Foo
6116 </td>
6117 <td>Bar</td>
6118 <td>Baz
6119 </td></tr></table>
6120
6121 !! html/parsoid
6122 <table>
6123 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6124 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6125 </tbody></table>
6126 !! end
6127
6128 !! test
6129 3. Template-generated table cell attributes and cell content
6130 !! wikitext
6131 {|
6132 !align=center {{table_header_cells}}
6133 |-
6134 |align=center {{table_cells}}
6135 |}
6136 !! html/php
6137 <table>
6138 <tr>
6139 <th align="center" style="color:red;">Foo</th>
6140 <th style="color:red;"><i>Bar</i></th>
6141 <th style="color:brown;"><i>Foo</i> and Baz
6142 </th></tr>
6143 <tr>
6144 <td align="center" style="color:red;">Foo</td>
6145 <td style="color:red;"><i>Bar</i></td>
6146 <td style="color:brown;"><i>Foo</i> and Baz
6147 </td></tr></table>
6148
6149 !! html/parsoid
6150 <table>
6151 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6152 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6153 </tbody></table>
6154 !! end
6155
6156 !! test
6157 4. Template-generated table cell attributes and cell content inside a templated table
6158 !! wikitext
6159 {{tbl-start}}
6160 !align=center {{table_header_cells}}
6161 |-
6162 |align=center {{table_cells}}
6163 {{tbl-end}}
6164 !! html/php
6165 <table>
6166 <tr>
6167 <th align="center" style="color:red;">Foo</th>
6168 <th style="color:red;"><i>Bar</i></th>
6169 <th style="color:brown;"><i>Foo</i> and Baz
6170 </th></tr>
6171 <tr>
6172 <td align="center" style="color:red;">Foo</td>
6173 <td style="color:red;"><i>Bar</i></td>
6174 <td style="color:brown;"><i>Foo</i> and Baz
6175 </td></tr></table>
6176
6177 !! html/parsoid
6178 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6179 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6180 <tr>
6181 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6182 </tbody></table>
6183 !! end
6184
6185 !! test
6186 Table with row followed by newlines and table heading
6187 !! wikitext
6188 {|
6189 |-
6190
6191 ! foo
6192 |}
6193 !! html
6194 <table>
6195
6196
6197 <tr>
6198 <th> foo
6199 </th></tr></table>
6200
6201 !! end
6202
6203 !! test
6204 Table with empty line following the start tag
6205 !! wikitext
6206 {|
6207
6208 |-
6209 | foo
6210 |}
6211 !! html
6212 <table>
6213
6214
6215 <tr>
6216 <td> foo
6217 </td></tr></table>
6218
6219 !! end
6220
6221 # FIXME: Preserve the attribute properly (with an empty string as value) in
6222 # the PHP parser. Parsoid implements the behavior below.
6223 !! test
6224 Table attributes with empty value
6225 !! wikitext
6226 {|
6227 | style=| hello
6228 |}
6229 !! html/parsoid
6230 <table>
6231 <tbody>
6232 <tr>
6233 <td style=""> hello
6234 </td></tr></tbody></table>
6235
6236 !! end
6237
6238 !! test
6239 Wikitext table with a lot of comments
6240 !! wikitext
6241 {|
6242 <!-- c0 -->
6243 | foo
6244 <!-- c1 -->
6245 |-<!-- c2 -->
6246 <!-- c3 -->
6247 |<!-- c4 -->
6248 <!-- c5 -->
6249 |}
6250 !! html
6251 <table>
6252 <tr>
6253 <td> foo
6254 </td></tr>
6255 <tr>
6256 <td>
6257 </td></tr></table>
6258
6259 !! end
6260
6261 !! test
6262 Wikitext table comments represented in parsoid dom
6263 !! wikitext
6264 {|<!--c1--><!--c2-->
6265 |-<!--c3-->
6266 | x
6267 |}
6268 !! html/php+tidy
6269 <table>
6270 <tr>
6271 <td>x</td>
6272 </tr>
6273 </table>
6274 !! html/parsoid
6275 <table><!--c1--><!--c2-->
6276 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6277 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6278 </tbody></table>
6279 !! end
6280
6281 !! test
6282 Wikitext table with double-line table cell
6283 !! wikitext
6284 {|
6285 |a
6286 b
6287 |}
6288 !! html
6289 <table>
6290 <tr>
6291 <td>a
6292 <p>b
6293 </p>
6294 </td></tr></table>
6295
6296 !! end
6297
6298 !! test
6299 Table cell with a single comment
6300 !! wikitext
6301 {|
6302 | <!-- c1 -->
6303 | a
6304 |}
6305 !! html
6306 <table>
6307 <tr>
6308 <td>
6309 </td>
6310 <td> a
6311 </td></tr></table>
6312
6313 !! end
6314
6315 !! test
6316 Table-cell after a comment-only-empty-line
6317 !! wikitext
6318 {|
6319 |a
6320 <!--c1-->
6321 <!--c2-->| b
6322 |}
6323 !! html
6324 <table>
6325 <tr>
6326 <td>a
6327 </td>
6328 <td> b
6329 </td></tr></table>
6330
6331 !! html/parsoid
6332 <table>
6333 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6334 <!--c1-->
6335 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6336 </tbody></table>
6337
6338 !! end
6339
6340 !! test
6341 Build table with {{!}}
6342 !! wikitext
6343 {{{!}} class="wikitable"
6344 ! header
6345 ! second header
6346 {{!}}- style="color:red;"
6347 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6348 {{!}}}
6349 !! html
6350 <table class="wikitable">
6351 <tr>
6352 <th> header
6353 </th>
6354 <th> second header
6355 </th></tr>
6356 <tr style="color:red;">
6357 <td> data </td>
6358 <td style="color:red;"> second data
6359 </td></tr></table>
6360
6361 !! end
6362
6363 !! test
6364 Build table with pipe as data
6365 !! wikitext
6366 {| class="wikitable"
6367 ! header
6368 ! second header
6369 |- style="color:red;"
6370 | data || style="color:red;" | second data
6371 |-
6372 | style="color:red;" | data with | || style="color:red;" | second data with |
6373 |-
6374 || data with | ||| second data with |
6375 |}
6376 !! html
6377 <table class="wikitable">
6378 <tr>
6379 <th> header
6380 </th>
6381 <th> second header
6382 </th></tr>
6383 <tr style="color:red;">
6384 <td> data </td>
6385 <td style="color:red;"> second data
6386 </td></tr>
6387 <tr>
6388 <td style="color:red;"> data with | </td>
6389 <td style="color:red;"> second data with |
6390 </td></tr>
6391 <tr>
6392 <td> data with | </td>
6393 <td> second data with |
6394 </td></tr></table>
6395
6396 !! end
6397
6398 !! test
6399 Build table with wikilink
6400 !! wikitext
6401 {| class="wikitable"
6402 ! header || second header
6403 |- style="color:red;"
6404 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6405 |-
6406 | data || second data [[Main Page|link|text with pipe]]
6407 |}
6408 !! html
6409 <table class="wikitable">
6410 <tr>
6411 <th> header </th>
6412 <th> second header
6413 </th></tr>
6414 <tr style="color:red;">
6415 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6416 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6417 </td></tr>
6418 <tr>
6419 <td> data </td>
6420 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6421 </td></tr></table>
6422
6423 !! end
6424
6425 # The expected HTML structure in this test is debatable. The PHP parser does
6426 # not parse this kind of table at all. The main focus for Parsoid is on
6427 # round-tripping, so this output is ok for now. TODO: revisit!
6428 !! test
6429 Wikitext table with html-syntax row
6430 !! wikitext
6431 {|
6432 |-
6433 <td>foo</td>
6434 |}
6435 !! html/parsoid
6436 <table>
6437 <tbody>
6438 <tr>
6439 <td>foo</td></tr></tbody></table>
6440 !! end
6441
6442 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6443 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6444 ## PHP parser, which tidy then compounds by fostering the content
6445 ## entirely out of the table. Parsoid recognizes the table context
6446 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6447 ## depends on PHP's treatment of broken table markup!
6448 !! test
6449 Implicit <td> after a |-
6450 !! options
6451 parsoid=wt2html,html2html
6452 !! wikitext
6453 {|
6454 |-
6455 a
6456 |}
6457 !! html/php
6458 <table>
6459
6460 a
6461 </table>
6462
6463 !! html/php+tidy
6464 <p>a</p>
6465 !! html/parsoid
6466 <table>
6467 <tr><td>a</td></tr>
6468 </table>
6469 !! end
6470
6471 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6472 !! test
6473 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6474 !! options
6475 parsoid=wt2html,html2html
6476 !! wikitext
6477 {|
6478 |-
6479 |
6480 a
6481 |-
6482 b
6483 |}
6484 !! html/php
6485 <table>
6486
6487 <tr>
6488 <td>
6489 <pre>a
6490 </pre>
6491 </td></tr>
6492 b
6493 </table>
6494
6495 !! html/php+tidy
6496 <p>b</p>
6497 <table>
6498 <tr>
6499 <td>
6500 <pre>
6501 a
6502 </pre></td>
6503 </tr>
6504 </table>
6505 !! html/parsoid
6506 <table>
6507 <tbody>
6508 <tr><td><pre>a</pre></td></tr>
6509 <tr><td> b</td></tr>
6510 </tbody>
6511 </table>
6512 !! end
6513
6514 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6515 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6516 !! test
6517 Lists should be recognized in an implicit <td> context
6518 !! options
6519 parsoid=wt2html,html2html
6520 !! wikitext
6521 {|
6522 |-
6523 *a
6524 |}
6525 !! html/php
6526 <table>
6527
6528 <ul><li>a</li></ul>
6529 </table>
6530
6531 !! html/php+tidy
6532 <ul>
6533 <li>a</li>
6534 </ul>
6535 !! html/parsoid
6536 <table>
6537 <tr>
6538 <td><ul>
6539 <li>a</li>
6540 </ul></td>
6541 </tr>
6542 </table>
6543 !! end
6544
6545 !! test
6546 Table cells not properly parsed in an implicit-td context
6547 !! wikitext
6548 {|
6549 |-
6550 {{table_attribs_4}} || a || b
6551 |}
6552 !! html/php+tidy
6553 <table>
6554 <tr>
6555 <td style="background-color:#DC241f;" width="10px"></td>
6556 <td>a</td>
6557 <td>b</td>
6558 </tr>
6559 </table>
6560 !! html/parsoid
6561 <table>
6562 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6563 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6564 </tbody></table>
6565 !! end
6566
6567 !! test
6568 Parsoid: Round-trip tables directly followed by content (bug 51219)
6569 !! options
6570 parsoid=wt2html,wt2wt
6571 !! wikitext
6572 {|
6573 |foo
6574 |} bar
6575
6576 {|
6577 |baz
6578 |}<b>quux</b>
6579 !! html+tidy
6580 <table>
6581 <tr>
6582 <td>foo</td>
6583 </tr>
6584 </table>
6585 <p>bar</p>
6586 <table>
6587 <tr>
6588 <td>baz</td>
6589 </tr>
6590 </table>
6591 <p><b>quux</b></p>
6592 !! end
6593
6594 !! test
6595 Parsoid: Default to a newline after tables in new content (bug 51219)
6596 !! options
6597 parsoid=html2wt
6598 !! html
6599 <table><tbody>
6600 <tr><td>foo</td></tr></tbody></table> bar
6601 <table><tbody>
6602 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6603 !! wikitext
6604 {|
6605 |foo
6606 |}
6607 <nowiki> </nowiki>bar
6608 {|
6609 |baz
6610 |}
6611 '''quux'''
6612 !! end
6613
6614 !! test
6615 Parsoid: newline inducing block nodes don't suppress <nowiki>
6616 !! options
6617 parsoid=html2wt
6618 !! html
6619 a<h1>foo</h1>
6620 !! wikitext
6621 <nowiki> </nowiki>a
6622
6623 = foo =
6624 !! end
6625
6626 !! test
6627 Parsoid: Row-syntax table headings followed by comment & table cells
6628 !! options
6629 parsoid=wt2html,wt2wt
6630 !! wikitext
6631 {|
6632 ! foo || bar
6633 <!-- foo --> || baz || quux
6634 |}
6635 !! html/php
6636 <table>
6637 <tr>
6638 <th> foo </th>
6639 <th> bar
6640 </th>
6641 <td> baz </td>
6642 <td> quux
6643 </td></tr></table>
6644
6645 !! html/parsoid
6646 <table>
6647 <tbody><tr><th> foo </th><th> bar
6648 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6649 </tbody></table>
6650 !! end
6651
6652
6653 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6654 # preserves it.
6655 !!test
6656 Parsoid: Recover better from broken table attributes
6657 !!options
6658 parsoid=wt2html
6659 !!wikitext
6660 {| class="foo
6661 | class="bar" |
6662 foo
6663 |}
6664 !!html/php+tidy
6665 <table>
6666 <tr>
6667 <td class="bar">
6668 <p>foo</p>
6669 </td>
6670 </tr>
6671 </table>
6672 !!html/parsoid
6673 <table class="foo">
6674 <tr>
6675 <td class="bar">
6676 <p>foo</p></td></tr>
6677 </tbody></table>
6678 !!end
6679
6680 !! test
6681 Strip unsupported table tags
6682 !! options
6683 parsoid=html2wt
6684 !! html
6685 <table>
6686 <thead>
6687 <tr>
6688 <th>Month</th>
6689 <th>Savings</th>
6690 </tr>
6691 </thead>
6692 <tbody>
6693 <tr>
6694 <td>January</td>
6695 <td>$100</td>
6696 </tr>
6697 <tr>
6698 <td>February</td>
6699 <td>$80</td>
6700 </tr>
6701 </tbody>
6702 <tfoot>
6703 <tr>
6704 <td>Sum</td>
6705 <td>$180</td>
6706 </tr>
6707 </tfoot>
6708 </table>
6709 !! wikitext
6710 {|
6711
6712 !Month
6713 !Savings
6714
6715 |January
6716 |$100
6717
6718 |-
6719 |February
6720 |$80
6721
6722 |Sum
6723 |$180
6724
6725 |}
6726 !! end
6727
6728 !!test
6729 Testing serialization after deletion of table cells
6730 !!options
6731 parsoid={
6732 "modes": ["wt2wt", "selser"],
6733 "changes": [
6734 ["#x", "remove"]
6735 ]
6736 }
6737 !!wikitext
6738 {|
6739 !h1 !!h2 !!h3
6740 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6741 |}
6742 !! wikitext/edited
6743 {|
6744 !h1 !!h2 !!h3
6745 |c2 |||c3
6746 |}
6747 !!end
6748
6749 ###
6750 ### Internal links
6751 ###
6752 !! test
6753 Plain link, capitalized
6754 !! wikitext
6755 [[Main Page]]
6756 !! html
6757 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6758 </p>
6759 !! end
6760
6761 !! test
6762 Plain link, uncapitalized
6763 !! wikitext
6764 [[main Page]]
6765 !! html
6766 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6767 </p>
6768 !! end
6769
6770 !! test
6771 Piped link
6772 !! wikitext
6773 [[Main Page|The Main Page]]
6774 !! html
6775 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6776 </p>
6777 !! end
6778
6779 !! test
6780 Piped link with comment in link text
6781 !! wikitext
6782 [[Main Page|The Main<!--front--> Page]]
6783 !! html
6784 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6785 </p>
6786 !! end
6787
6788 !! test
6789 Piped link with multiple pipe characters in link text
6790 !! wikitext
6791 [[Main Page||The|Main|Page|]]
6792 !! html/php
6793 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6794 </p>
6795 !! html/parsoid
6796 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6797 !! end
6798
6799 !! test
6800 Broken link
6801 !! wikitext
6802 [[Zigzagzogzagzig]]
6803 !! html
6804 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6805 </p>
6806 !! end
6807
6808 !! test
6809 Broken link with fragment
6810 !! wikitext
6811 [[Zigzagzogzagzig#zug]]
6812 !! html
6813 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6814 </p>
6815 !! end
6816
6817 !! test
6818 Special page link with fragment
6819 !! wikitext
6820 [[Special:Version#anchor]]
6821 !! html
6822 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6823 </p>
6824 !! end
6825
6826 !! test
6827 Nonexistent special page link with fragment
6828 !! wikitext
6829 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6830 !! html
6831 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6832 </p>
6833 !! end
6834
6835 !! test
6836 Link with prefix
6837 !! wikitext
6838 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6839 !! html
6840 <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>
6841 </p>
6842 !! end
6843
6844 !! test
6845 Link with suffix
6846 !! wikitext
6847 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6848 !! html
6849 <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>!!!
6850 </p>
6851 !! end
6852
6853 !! article
6854 prefixed article
6855 !! text
6856 Some text
6857 !! endarticle
6858
6859 !! test
6860 Bug 43661: Piped links with identical prefixes
6861 !! wikitext
6862 [[prefixed article|prefixed articles with spaces]]
6863
6864 [[prefixed article|prefixed articlesaoeu]]
6865
6866 [[Main Page|Main Page test]]
6867 !! html
6868 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6869 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6870 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6871 </p>
6872 !! end
6873
6874
6875 !! test
6876 Link with HTML entity in suffix / tail
6877 !! wikitext
6878 [[Main Page]]&quot;, [[Main Page]]&#97;
6879 !! html/php
6880 <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;
6881 </p>
6882 !! html/parsoid
6883 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
6884 !! end
6885
6886 !! test
6887 Link with 3 brackets
6888 !! wikitext
6889 [[[Main Page]]]
6890 !! html
6891 <p>[[[Main Page]]]
6892 </p>
6893 !! end
6894
6895 !! test
6896 Link with 4 brackets
6897 !! wikitext
6898 [[[[Main Page]]]]
6899 !! html
6900 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6901 </p>
6902 !! end
6903
6904 !! test
6905 Piped link with 3 brackets
6906 !! wikitext
6907 [[[main page|the main page]]]
6908 !! html
6909 <p>[[[main page|the main page]]]
6910 </p>
6911 !! end
6912
6913 !! test
6914 Piped link with extlink-like text
6915 !! wikitext
6916 [[Main Page|[bar]]]
6917 [[Main Page|This is a [bar]]]
6918 !! html/php
6919 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6920 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6921 </p>
6922 !! html/parsoid
6923 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
6924 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
6925 !! end
6926
6927 !! test
6928 Link with multiple pipes
6929 !! wikitext
6930 [[Main Page|The|Main|Page]]
6931 !! html
6932 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6933 </p>
6934 !! end
6935
6936 # Note that parsoid does not munge anchor text; all non-space
6937 # characters are valid in HTML5 ids.
6938 !! test
6939 Anchor containing a #. (bug 63430)
6940 !! wikitext
6941 [[Main Page#And#Link]]
6942 !! html/php
6943 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6944 </p>
6945 !! html/parsoid
6946 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6947 !! end
6948
6949 !! test
6950 Link to namespaces
6951 !! wikitext
6952 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6953 !! html
6954 <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>
6955 </p>
6956 !! end
6957
6958 !! test
6959 Link with space in namespace
6960 !! wikitext
6961 [[User talk:Foo bar]]
6962 !! html
6963 <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>
6964 </p>
6965 !! end
6966
6967 !! article
6968 MemoryAlpha:AlphaTest
6969 !! text
6970 This is an article in the MemoryAlpha namespace
6971 (which shadows the memoryalpha interwiki link).
6972 !! endarticle
6973
6974 !! test
6975 Namespace takes precedence over interwiki link (bug 51680)
6976 !! wikitext
6977 [[MemoryAlpha:AlphaTest]]
6978 !! html
6979 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6980 </p>
6981 !! end
6982
6983 # The previous test doesn't work correctly in html2*, due to not recognizing the
6984 # link as an internal one. This one checks for the correct behavior.
6985 !! test
6986 Link to namespace preferred over interwiki with correct rel attribute
6987 !! options
6988 parsoid=html2wt,html2html
6989 !! html
6990 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
6991 !! wikitext
6992 [[MemoryAlpha:AlphaTest]]
6993 !! end
6994
6995 !! test
6996 Piped link to namespace
6997 !! wikitext
6998 [[Meta:Disclaimers|The disclaimers]]
6999 !! html
7000 <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>
7001 </p>
7002 !! end
7003
7004 !! test
7005 Link containing }
7006 !! wikitext
7007 [[Usually caused by a typo (oops}]]
7008 !! html
7009 <p>[[Usually caused by a typo (oops}]]
7010 </p>
7011 !! end
7012
7013 !! article
7014 7% Solution
7015 !! text
7016 Just a test of an article title containing a percent.
7017 !! endarticle
7018
7019 !! test
7020 Link containing % (not as a hex sequence)
7021 !! wikitext
7022 [[7% Solution]]
7023 !! html/php
7024 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7025 </p>
7026 !! html/parsoid
7027 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7028 !! end
7029
7030 # note that the parsoid HTML is identical to the previous test output,
7031 # so the previous test ensures that the html2wt mode will generate the
7032 # "not as a hex sequence" wikitext.
7033 !! test
7034 Link containing % as a single hex sequence interpreted to char
7035 !! options
7036 parsoid=wt2wt,wt2html,html2html
7037 !! wikitext
7038 [[7%25 Solution]]
7039 !! html/php
7040 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7041 </p>
7042 !! html/parsoid
7043 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7044 !!end
7045
7046 !! test
7047 Link containing % as a double hex sequence interpreted to hex sequence
7048 !! wikitext
7049 [[7%2525 Solution]]
7050 !! html
7051 <p>[[7%2525 Solution]]
7052 </p>
7053 !!end
7054
7055 # note that parsoid does not munge anchor text; all non-space
7056 # characters are valid in HTML5 anchors.
7057 !! test
7058 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7059 Example for such a section: == < ==
7060 !! wikitext
7061 [[%23%3c]][[%23%3e]]
7062 !! html/php
7063 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7064 </p>
7065 !! html/parsoid
7066 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7067 !! end
7068
7069 !! test
7070 Link containing "<#" and ">#" as a hex sequences
7071 !! wikitext
7072 [[%3c%23]][[%3e%23]]
7073 !! html
7074 <p>[[%3c%23]][[%3e%23]]
7075 </p>
7076 !! end
7077
7078 !! test
7079 Link containing an equals sign
7080 !! wikitext
7081 [[Special:BookSources/isbn=4-00-026157-6]]
7082 !! html/php
7083 <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>
7084 </p>
7085 !! html/parsoid
7086 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7087 !! end
7088
7089 !! article
7090 Foo~bar
7091 !! text
7092 Just a test of an article title containing a tilde.
7093 !! endarticle
7094
7095 # note that links containing signatures, like [[Foo~~~~]], are
7096 # massaged by the pre-save transform (PST) and so the tildes are never
7097 # seen by the parser.
7098 !! test
7099 Link containing a tilde
7100 !! wikitext
7101 [[Foo~bar]]
7102 !! html/php
7103 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7104 </p>
7105 !! html/parsoid
7106 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7107 !! end
7108
7109 !! test
7110 Link containing double-single-quotes '' (bug 4598)
7111 !! wikitext
7112 [[Lista d''e paise d''o munno]]
7113 !! html/php
7114 <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>
7115 </p>
7116 !! html/parsoid
7117 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7118 !! end
7119
7120 !! test
7121 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7122 !! wikitext
7123 Some [[Link|pretty ''italics'' and stuff]]!
7124 !! html/php
7125 <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>!
7126 </p>
7127 !! html/parsoid
7128 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7129 !! end
7130
7131 !! test
7132 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7133 !! wikitext
7134 ''Some [[Link|pretty ''italics'' and stuff]]!''
7135 !! html
7136 <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>
7137 </p>
7138 !! end
7139
7140 !! test
7141 Link with double quotes in title part (literal) and alternate part (interpreted)
7142 !! wikitext
7143 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7144
7145 [[''Pentecoste'']]
7146
7147 [[''Pentecoste''|Pentecoste]]
7148
7149 [[''Pentecoste''|''Pentecoste'']]
7150 !! html/php
7151 <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>
7152 </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>
7153 </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>
7154 </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>
7155 </p>
7156 !! html/parsoid
7157 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7158 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7159 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7160 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7161 !! end
7162
7163 !! test
7164 Broken image links with HTML captions (bug 39700)
7165 !! wikitext
7166 [[File:Nonexistent|<script></script>]]
7167 [[File:Nonexistent|100x100px|<script></script>]]
7168 [[File:Nonexistent|&lt;]]
7169 [[File:Nonexistent|a<i>b</i>c]]
7170 !! html/php
7171 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7172 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7173 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7174 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7175 </p>
7176 !! html/parsoid
7177 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7178 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7179 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7180 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7181 !! end
7182
7183 !! test
7184 Plain link to URL
7185 !! wikitext
7186 [[http://www.example.com]]
7187 !! html/php
7188 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7189 </p>
7190 !! html/parsoid
7191 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7192 !! end
7193
7194 !! test
7195 Plain link to URL with link text
7196 !! wikitext
7197 [[http://www.example.com Link text]]
7198 !! html
7199 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7200 </p>
7201 !! end
7202
7203 !! test
7204 Plain link to protocol-relative URL
7205 !! wikitext
7206 [[//www.example.com]]
7207 !! html/php
7208 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7209 </p>
7210 !! html/parsoid
7211 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7212 !! end
7213
7214 !! test
7215 Plain link to protocol-relative URL with link text
7216 !! wikitext
7217 [[//www.example.com Link text]]
7218 !! html
7219 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7220 </p>
7221 !! end
7222
7223 !! test
7224 Plain link to page with question mark in title
7225 !! wikitext
7226 [[A?b]]
7227
7228 [[A?b|Baz]]
7229 !! html
7230 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7231 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7232 </p>
7233 !! end
7234
7235
7236 # I'm fairly sure the expected result here is wrong.
7237 # We want these to be URL links, not pseudo-pages with URLs for titles....
7238 # However the current output is also pretty screwy.
7239 #
7240 # ----
7241 # I'm changing it to match the current output--it arguably makes more
7242 # sense in the light of the test above. Old expected result was:
7243 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7244 #</p>
7245 # But I think this test is bordering on "garbage in, garbage out" anyway.
7246 # -- wtm
7247 !! test
7248 Piped link to URL
7249 !! wikitext
7250 Piped link to URL: [[http://www.example.com|an example URL]]
7251 !! html/php
7252 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7253 </p>
7254 !! html/parsoid
7255 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7256 !! end
7257
7258 !! test
7259 BUG 2: [[page|http://url/]] should link to page, not http://url/
7260 !! wikitext
7261 [[Main Page|http://url/]]
7262 !! html/php
7263 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7264 </p>
7265 !! html/parsoid
7266 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7267 !! end
7268
7269 # Parsoid does not mark self-links, by design.
7270 !! test
7271 BUG 337: Escaped self-links should be bold
7272 !! options
7273 title=[[Bug462]]
7274 !! wikitext
7275 [[Bu&#103;462]] [[Bug462]]
7276 !! html/php
7277 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7278 </p>
7279 !! html/php+tidy
7280 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7281 !! html/parsoid
7282 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7283 !! end
7284
7285 !! test
7286 Self-link to section should not be bold
7287 !! options
7288 title=[[Main Page]]
7289 !! wikitext
7290 [[Main Page#section]]
7291 !! html
7292 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7293 </p>
7294 !! end
7295
7296 !! article
7297 00
7298 !! text
7299 This is 00.
7300 !! endarticle
7301
7302 !!test
7303 Self-link to numeric title
7304 !!options
7305 title=[[0]]
7306 !! wikitext
7307 [[0]]
7308 !! html
7309 <p><strong class="selflink">0</strong>
7310 </p>
7311 !!end
7312
7313 !!test
7314 Link to numeric-equivalent title
7315 !!options
7316 title=[[0]]
7317 !! wikitext
7318 [[00]]
7319 !! html
7320 <p><a href="/wiki/00" title="00">00</a>
7321 </p>
7322 !!end
7323
7324 !! test
7325 <nowiki> inside a link
7326 !! wikitext
7327 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7328 !! html
7329 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7330 </p>
7331 !! end
7332
7333 !! test
7334 Non-breaking spaces in title
7335 !! wikitext
7336 [[&nbsp; Main &nbsp; Page &nbsp;]]
7337 !! html
7338 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7339 </p>
7340 !!end
7341
7342 !! test
7343 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7344 !! options
7345 language=ca
7346 !! wikitext
7347 '''[[Main Page]]'''
7348 !! html
7349 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7350 </p>
7351 !! end
7352
7353 !! test
7354 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7355 !! options
7356 language=ca
7357 !! wikitext
7358 ''[[Main Page]]''
7359 !! html
7360 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7361 </p>
7362 !! end
7363
7364 !! test
7365 Internal link with en linktrail: no apostrophes (bug 27473)
7366 !! options
7367 language=en
7368 !! wikitext
7369 [[Something]]'nice
7370 !! html
7371 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7372 </p>
7373 !! end
7374
7375 !! test
7376 Internal link with ca linktrail with apostrophes (bug 27473)
7377 !! options
7378 language=ca
7379 !! wikitext
7380 [[Something]]'nice
7381 !! html
7382 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7383 </p>
7384 !! end
7385
7386 !! test
7387 Internal link with kaa linktrail with apostrophes (bug 27473)
7388 !! options
7389 language=kaa
7390 !! wikitext
7391 [[Something]]'nice
7392 !! html
7393 <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>
7394 </p>
7395 !! end
7396
7397 !! test
7398 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7399 !! wikitext
7400 [[User:Foo/Test/63636:Bar|Test]]
7401 !! html/php
7402 <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>
7403 </p>
7404 !! html/parsoid
7405 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7406 !! end
7407
7408 !! test
7409 Purely hash wikilink
7410 !! options
7411 title=[[User:test/123]]
7412 !! wikitext
7413 [[#a|b]]
7414 !! html/php
7415 <p><a href="#a">b</a>
7416 </p>
7417 !! html/parsoid
7418 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
7419 !! end
7420
7421 !! test
7422 1. Interaction of linktrail and template encapsulation
7423 !! options
7424 parsoid
7425 !! wikitext
7426 {{echo|[[Foo]]}}l
7427 !! html
7428 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
7429 !! end
7430
7431 !! test
7432 2. Interaction of linktrail and template encapsulation
7433 !! options
7434 parsoid
7435 !! wikitext
7436 {{echo|Some [[Fool]]}}s
7437 !! html
7438 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7439 !! end
7440
7441 !! test
7442 3. Interaction of linktrail and template encapsulation
7443 !! options
7444 parsoid
7445 !! wikitext
7446 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7447 !! html
7448 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7449 !! end
7450
7451 !! article
7452 Söfnuður
7453 !! text
7454 Test.
7455 !! endarticle
7456
7457 !! test
7458 Internal link with is link prefix
7459 !! options
7460 language=is
7461 !! wikitext
7462 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7463 !! html
7464 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7465 </p>
7466 !! end
7467
7468 !! article
7469 Mótmælendatrú
7470 !! text
7471 Test.
7472 !! endarticle
7473
7474 !! test
7475 Internal link with is link trail and link prefix
7476 !! options
7477 language=is
7478 !! wikitext
7479 [[mótmælendatrú|xxx]]ar
7480 [[mótmælendatrú]]ar
7481 mótmælenda[[söfnuður]]
7482 mótmælenda[[söfnuður|söfnuðir]]
7483 mótmælenda[[söfnuður|söfnuðir]]xxx
7484 !! html
7485 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7486 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7487 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7488 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7489 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7490 </p>
7491 !! end
7492
7493 !! test
7494 Parsoid link trail escaping
7495 !! options
7496 parsoid=html2wt,html2html
7497 !! html
7498 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7499 !! wikitext
7500 [[apple]]<nowiki/>s
7501 !! end
7502
7503 !! test
7504 Parsoid link prefix escaping
7505 !! options
7506 language=is
7507 parsoid=html2wt,html2html
7508 !! html
7509 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7510 !! wikitext
7511 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7512 !! end
7513
7514 !! test
7515 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7516 !! wikitext
7517 [[Foo| bar]]
7518
7519 [[Foo| ''bar'']]
7520
7521 [http://wp.org foo]
7522
7523 [http://wp.org ''foo'']
7524 !! html
7525 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7526 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7527 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7528 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7529 </p>
7530 !! end
7531
7532 !! test
7533 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7534 !! options
7535 parsoid
7536 !! wikitext
7537 [[Foo|{{echo|a}} b {{echo|c}}]]
7538 !! html
7539 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
7540 !! end
7541
7542 !! test
7543 Link with angle bracket after anchor
7544 !! wikitext
7545 [[Foo#<bar>]]
7546 !! html/php
7547 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7548 </p>
7549 !! html/parsoid
7550 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
7551 !! end
7552
7553 ###
7554 ### Interwiki links (see maintenance/interwiki.sql)
7555 ###
7556
7557 !! test
7558 Inline interwiki link
7559 !! options
7560 parsoid=wt2html,wt2wt,html2html
7561 !! wikitext
7562 [[MeatBall:SoftSecurity]]
7563 !! html/php
7564 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7565 </p>
7566 !! html/parsoid
7567 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7568 !! end
7569
7570 !! test
7571 Inline interwiki link with empty title (bug 2372)
7572 !! options
7573 parsoid=wt2html,wt2wt,html2html
7574 !! wikitext
7575 [[MeatBall:]]
7576 !! html/php
7577 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7578 </p>
7579 !! html/parsoid
7580 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7581 !! end
7582
7583 !! test
7584 Interwiki link encoding conversion (bug 1636)
7585 !! wikitext
7586 *[[Wikipedia:ro:Olteni&#0355;a]]
7587 *[[Wikipedia:ro:Olteni&#355;a]]
7588 !! html
7589 <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>
7590 <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>
7591
7592 !! html+tidy
7593 <ul>
7594 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7595 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7596 </ul>
7597 !! end
7598
7599 !! test
7600 Interwiki link with fragment (bug 2130)
7601 !! wikitext
7602 [[MeatBall:SoftSecurity#foo]]
7603 !! html
7604 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7605 </p>
7606 !! end
7607
7608 # Ideally the wikipedia: prefix here should be proto-relative too
7609 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7610 # define the 'en' prefix, and originally the test used 'wikipedia',
7611 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7612 # article.
7613 !! test
7614 Different interwiki prefixes mapping to the same URL
7615 !! wikitext
7616 [[:en:Foo]]
7617
7618 [[:en:Foo|Foo]]
7619
7620 [[wikipedia:Foo]]
7621
7622 [[:wikipedia:Foo|Foo]]
7623
7624 [[wikipedia:en:Foo]]
7625
7626 [[:wikipedia:en:Foo]]
7627
7628 [[ wikiPEdia :Foo]]
7629 !! html/parsoid
7630 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
7631
7632 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
7633
7634 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
7635
7636 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
7637
7638 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7639
7640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7641
7642 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
7643 !! end
7644
7645 !! test
7646 Interwiki links that cannot be represented in wiki syntax
7647 !! wikitext
7648 [[meatball:ok]]
7649 [[meatball:ok#foo|ok with fragment]]
7650 [[meatball:ok_as_well?|ok ending with ? mark]]
7651 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7652 [http://de.wikipedia.org/wiki/#foo is just fragment]
7653
7654 !! html/php
7655 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7656 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7657 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
7658 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7659 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7660 </p>
7661 !! html/parsoid
7662 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7663 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7664 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
7665 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7666 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7667 !! end
7668
7669 !! test
7670 Interwiki links: trail
7671 !! wikitext
7672 [[wikipedia:Foo|Ba]]r
7673 !! html/php
7674 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7675 </p>
7676 !! html/parsoid
7677 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7678 !! end
7679
7680 !! test
7681 Local interwiki link
7682 !! options
7683 parsoid=wt2html,wt2wt,html2html
7684 !! wikitext
7685 [[local:Template:Foo]]
7686 !! html/php
7687 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7688 </p>
7689 !! html/parsoid
7690 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7691 !! end
7692
7693 # Parsoid does not mark self-links, by design.
7694 !! test
7695 Local interwiki link: self-link to current page
7696 !! options
7697 title=[[Main Page]]
7698 parsoid=wt2html,wt2wt,html2html
7699 !! wikitext
7700 [[local:Main Page]]
7701 !! html/php
7702 <p><strong class="selflink">local:Main Page</strong>
7703 </p>
7704 !! html/parsoid
7705 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7706 !! end
7707
7708 !! test
7709 Local interwiki link: prefix only (bug 64167)
7710 !! options
7711 parsoid=wt2html,wt2wt,html2html
7712 !! wikitext
7713 [[local:]]
7714 !! html/php
7715 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7716 </p>
7717 !! html/parsoid
7718 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7719 !! end
7720
7721 !! test
7722 Local interwiki link: with additional interwiki prefix (bug 61357)
7723 !! options
7724 parsoid=wt2html,wt2wt,html2html
7725 !! wikitext
7726 [[local:meatball:Hello]]
7727 !! html/php
7728 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7729 </p>
7730 !! html/parsoid
7731 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7732 !! end
7733
7734 !! test
7735 Multiple local interwiki link prefixes
7736 !! wikitext
7737 [[local:local:local:local:mi:local:Foo]]
7738 !! options
7739 parsoid=wt2html,wt2wt,html2html
7740 !! html/php
7741 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7742 </p>
7743 !! html/parsoid
7744 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7745 !! end
7746
7747 ###
7748 ### Interlanguage links
7749 ### Language links (so that searching for '### language' matches..)
7750 ###
7751
7752 !! test
7753 Interlanguage link
7754 !! options
7755 parsoid=wt2html,wt2wt,html2html
7756 !! wikitext
7757 Blah blah blah
7758 [[zh:Chinese]]
7759 !! html/php
7760 <p>Blah blah blah
7761 </p>
7762 !! html/parsoid
7763 <p>Blah blah blah</p>
7764 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7765 !! end
7766
7767 !! test
7768 Interlanguage link with spacing
7769 !! options
7770 parsoid=wt2html,wt2wt,html2html
7771 !! wikitext
7772 Blah blah blah
7773 [[ zh : Chinese ]]
7774 !! html/php
7775 <p>Blah blah blah
7776 </p>
7777 !! html/parsoid
7778 <p>Blah blah blah</p>
7779 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7780 !! end
7781
7782 !! test
7783 Double interlanguage link
7784 !! options
7785 parsoid=wt2html,wt2wt,html2html
7786 !! wikitext
7787 Blah blah blah
7788 [[es:Spanish]]
7789 [[zh:Chinese]]
7790 !! html/php
7791 <p>Blah blah blah
7792 </p>
7793 !! html/parsoid
7794 <p>Blah blah blah</p>
7795 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7796 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7797 !! end
7798
7799 !! test
7800 Interlanguage link variations
7801 !! options
7802 parsoid=wt2html,wt2wt,html2html
7803 !! wikitext
7804 Blah blah blah
7805 [[ es :Spanish]]
7806 [[ ZH :Chinese]]
7807 [[es:Foo_bar]]
7808 !! html/php
7809 <p>Blah blah blah
7810 </p>
7811 !! html/parsoid
7812 <p>Blah blah blah</p>
7813 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7814 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7815 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7816 !! end
7817
7818 !! test
7819 Space and question mark encoding in interlanguage links (T95473)
7820 !! options
7821 parsoid=wt2html,wt2wt,html2html
7822 !! wikitext
7823 Blah blah blah
7824 [[es:Foo bar?]]
7825 !! html/php
7826 <p>Blah blah blah
7827 </p>
7828 !! html/parsoid
7829 <p>Blah blah blah</p>
7830 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
7831 !! end
7832
7833 !! test
7834 Interlanguage link, with prefix links
7835 !! options
7836 language=ln
7837 !! wikitext
7838 Blah blah blah
7839 [[zh:Chinese]]
7840 !! html/php
7841 <p>Blah blah blah
7842 </p>
7843 !! html/parsoid
7844 <p>Blah blah blah</p>
7845 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7846 !! end
7847
7848 !! test
7849 Double interlanguage link, with prefix links (bug 8897)
7850 !! options
7851 language=ln
7852 !! wikitext
7853 Blah blah blah
7854 [[es:Spanish]]
7855 [[zh:Chinese]]
7856 !! html/php
7857 <p>Blah blah blah
7858 </p>
7859 !! html/parsoid
7860 <p>Blah blah blah</p>
7861 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7862 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7863 !! end
7864
7865 !! test
7866 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7867 !! wikitext
7868 Blah blah blah
7869 [[mul:Article]]
7870 !! html/php
7871 <p>Blah blah blah
7872 </p>
7873 !! html/parsoid
7874 <p>Blah blah blah</p>
7875 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7876 !! end
7877
7878 !! test
7879 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7880 !! options
7881 language=ln
7882 !! wikitext
7883 [[WW&nbsp;II]]
7884 !! html
7885 <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>
7886 </p>
7887 !! end
7888
7889 !! test
7890 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7891 !! options
7892 parsoid=html2wt
7893 !! html
7894 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7895 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7896 !! wikitext
7897 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7898
7899 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7900 !! end
7901
7902 !! test
7903 Parsoid: handle constructor well
7904 !! wikitext
7905 [[constructor]]
7906
7907 [[constructor:foo]]
7908 !! html/php
7909 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7910 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
7911 </p>
7912 !! html/parsoid
7913 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7914
7915 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7916 !! end
7917
7918 !! article
7919 ko:
7920 !! text
7921 Test.
7922 !! endarticle
7923
7924 # Note that `ko` isn't a known interlanguage prefix
7925 !! test
7926 Parsoid: recognize interlanguage links without a target page
7927 !! options
7928 ill
7929 !! wikitext
7930 [[es:]]
7931
7932 [[ko:]]
7933 !! html/php
7934 es:
7935 !! html/parsoid
7936 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7937
7938 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7939 !! end
7940
7941 # Note that `ko` isn't a known interwiki prefix
7942 !! test
7943 Parsoid: recognize interwiki links without a target page
7944 !! options
7945 parsoid=wt2html,wt2wt,html2html
7946 !! wikitext
7947 [[:es:]]
7948
7949 [[:ko:]]
7950 !! html/php
7951 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7952 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7953 </p>
7954 !! html/parsoid
7955 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7956 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7957 !! end
7958
7959 !! test
7960 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7961 !! wikitext
7962 [[mi:Foo]]
7963 !! html/php
7964 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7965 </p>
7966 !! html/parsoid
7967 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7968 !! end
7969
7970 !! test
7971 Interlanguage link with preceding local interwiki link (bug 68085)
7972 !! options
7973 parsoid=wt2html,wt2wt,html2html
7974 !! wikitext
7975 Blah blah blah
7976 [[local:es:Spanish]]
7977 !! html/php
7978 <p>Blah blah blah
7979 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7980 </p>
7981 !! html/parsoid
7982 <p>Blah blah blah
7983 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7984 !! end
7985
7986 !! test
7987 Looks like an interlanguage link, but is actually a local interwiki
7988 !! options
7989 parsoid=wt2html,wt2wt,html2html
7990 !! wikitext
7991 Blah blah blah
7992 [[mi:Template:Foo]]
7993 !! html/php
7994 <p>Blah blah blah
7995 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7996 </p>
7997 !! html/parsoid
7998 <p>Blah blah blah
7999 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8000 !! end
8001
8002 ###
8003 ### Redirects, Parsoid-only
8004 ###
8005
8006 !! test
8007 1. Simple redirect to page
8008 !! wikitext
8009 #REDIRECT [[Main Page]]
8010 !! html/parsoid
8011 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8012 !! end
8013
8014 !! test
8015 2. Other redirect variants
8016 !! wikitext
8017 #REDIRECT [[Main_Page]]
8018 !! html/parsoid
8019 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8020 !! end
8021
8022 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8023 # This tests the Parsoid bail-out code.
8024 !! test
8025 3. Other redirect variants
8026 !! wikitext
8027 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8028 !! html/parsoid
8029 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8030 !! end
8031
8032 !! test
8033 4. Redirect to a templated destination
8034 !! wikitext
8035 #REDIRECT [[{{echo|Foo}}bar]]
8036 !! html/parsoid
8037 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8038 !! end
8039
8040 !! test
8041 Empty redirect
8042 !! options
8043 parsoid=wt2html,wt2wt
8044 !! wikitext
8045 #REDIRECT [[]]
8046 !! html/parsoid
8047 <ol>
8048 <li>REDIRECT [[]]</li></ol>
8049 !! end
8050
8051 !! test
8052 Optional colon in #REDIRECT
8053 !! options
8054 # the colon is archaic syntax. we support it for wt2html, but we
8055 # don't care that it roundtrips back to the modern syntax.
8056 parsoid=wt2html,html2html
8057 !! wikitext
8058 #REDIRECT:[[Main Page]]
8059 !! html/parsoid
8060 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8061 !! end
8062
8063 !! test
8064 Whitespace in #REDIRECT with optional colon
8065 !! options
8066 # the colon and gratuitous whitespace is archaic syntax. we support
8067 # it for wt2html, but we don't care that it roundtrips back to the
8068 # modern syntax (without extra whitespace)
8069 parsoid=wt2html,html2html
8070 !! wikitext
8071
8072 #REDIRECT
8073 :
8074 [[Main Page]]
8075 !! html/parsoid
8076 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8077 !! end
8078
8079 !! test
8080 Piped link in #REDIRECT
8081 !! options
8082 # content after piped link is ignored. we support this syntax,
8083 # but don't care that the piped link is lost when we roundtrip this.
8084 parsoid=wt2html
8085 !! wikitext
8086 #REDIRECT [[Main Page|bar]]
8087 !! html/parsoid
8088 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8089 !! end
8090
8091 !! test
8092 Redirect to category (T104502)
8093 !! options
8094 parsoid=wt2html,wt2wt
8095 !! wikitext
8096 #REDIRECT [[Category:Foo]]
8097 !! html/parsoid
8098 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8099 !! end
8100
8101 !! test
8102 Redirect to category with URL encoding (T104502)
8103 !! options
8104 parsoid=wt2html
8105 !! wikitext
8106 #REDIRECT [[Category%3AFoo]]
8107 !! html/parsoid
8108 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8109 !! end
8110
8111 !! test
8112 Redirect to category page
8113 !! wikitext
8114 #REDIRECT [[:Category:Foo]]
8115 !! html/parsoid
8116 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8117 !! end
8118
8119 !! test
8120 Redirect to image page (1)
8121 !! wikitext
8122 #REDIRECT [[File:Wiki.png]]
8123 !! html/parsoid
8124 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8125 !! end
8126
8127 !! test
8128 Redirect to image page (2)
8129 !! wikitext
8130 #REDIRECT [[Image:Wiki.png]]
8131 !! html/parsoid
8132 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8133 !! end
8134
8135 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8136 # Next test confirms this.
8137 !! test
8138 Redirect to language (1) (T104918)
8139 !! options
8140 parsoid=wt2html,wt2wt,html2html
8141 !! wikitext
8142 #REDIRECT [[en:File:Wiki.png]]
8143 !! html/parsoid
8144 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8145 !! end
8146
8147 !! test
8148 Redirect to language (2) (T104918)
8149 !! wikitext
8150 #REDIRECT [[:en:File:Wiki.png]]
8151 !! html/parsoid
8152 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8153 !! end
8154
8155 !! test
8156 Redirect to interwiki (T104918)
8157 !! wikitext
8158 #REDIRECT [[meatball:File:Wiki.png]]
8159 !! html/parsoid
8160 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8161 !! end
8162
8163 !! test
8164 Non-English #REDIRECT
8165 !! options
8166 language=is
8167 !! wikitext
8168 #TILVÍSUN [[Main Page]]
8169 !! html/parsoid
8170 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8171 !! end
8172
8173 !! test
8174 Redirect syntax under text isn't considered a redirect
8175 !! wikitext
8176 some text
8177 #redirect [[Main Page]]
8178 !! html/parsoid
8179 <p>some text</p>
8180 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8181 !! end
8182
8183 # FIXME: Should hoist the redirect to the top of the page and ensure there
8184 # is only one.
8185 !! test
8186 New redirect
8187 !! options
8188 parsoid=html2wt
8189 !! html/parsoid
8190 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8191 !! wikitext
8192 Foo
8193 #REDIRECT [[Foo]]
8194 !! end
8195
8196 ##
8197 ## XHTML tidiness
8198 ###
8199
8200 !! test
8201 <br> to <br />
8202 !! wikitext
8203 1<br>2<br />3
8204 !! html
8205 <p>1<br />2<br />3
8206 </p>
8207 !! end
8208
8209 !! test
8210 Broken br tag sanitization
8211 !! wikitext
8212 </br>
8213 !! html/php
8214 <p>&lt;/br&gt;
8215 </p>
8216 !! end
8217
8218 # TODO: Fix html2html mode (bug 51055)!
8219 !! test
8220 Parsoid: Broken br tag recognition
8221 !! options
8222 parsoid=wt2html
8223 !! wikitext
8224 </br>
8225
8226 <br/ >
8227 !! html+tidy
8228 <p><br /></p>
8229 <p><br /></p>
8230 !! end
8231
8232 !! test
8233 Incorrecly removing closing slashes from correctly formed XHTML
8234 !! wikitext
8235 <br style="clear:both;" />
8236 !! html
8237 <p><br style="clear:both;" />
8238 </p>
8239 !! end
8240
8241 !! test
8242 Failing to transform badly formed HTML into correct XHTML
8243 !! wikitext
8244 <br style="clear: left;">
8245 <br style="clear: right;">
8246 <br style="clear: both;">
8247 !! html
8248 <p><br style="clear: left;" />
8249 <br style="clear: right;" />
8250 <br style="clear: both;" />
8251 </p>
8252 !!end
8253
8254 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8255 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8256 !! test
8257 Handling html with a div self-closing tag
8258 !! wikitext
8259 <div title />
8260 <div title/>
8261 <div title/ >
8262 <div title=bar />
8263 <div title=bar/>
8264 <div title=bar/ >
8265 !! html/php
8266 <p>&lt;div title /&gt;
8267 &lt;div title/&gt;
8268 </p>
8269 <div>
8270 <p>&lt;div title=bar /&gt;
8271 &lt;div title=bar/&gt;
8272 </p>
8273 <div title="bar/"></div>
8274 </div>
8275
8276 !! html/parsoid
8277 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8278 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8279 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8280 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8281 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8282 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8283 !! end
8284
8285 !! test
8286 Handling html with a br self-closing tag
8287 !! wikitext
8288 <br title />
8289 <br title/>
8290 <br title/ >
8291 <br title=bar />
8292 <br title=bar/>
8293 <br title=bar/ >
8294 !! html/php
8295 <p><br title="" />
8296 <br title="" />
8297 <br />
8298 <br title="bar" />
8299 <br title="bar" />
8300 <br title="bar/" />
8301 </p>
8302 !! html/parsoid
8303 <p><br title="" />
8304 <br title="" />
8305 <br title="" />
8306 <br title="bar" />
8307 <br title="bar" />
8308 <br title="bar/" />
8309 </p>
8310 !! end
8311
8312 !! test
8313 Horizontal ruler (should it add that extra space?)
8314 !! wikitext
8315 <hr>
8316 <hr >
8317 foo <hr
8318 > bar
8319 !! html+tidy
8320 <hr />
8321 <hr />
8322 <p>foo</p>
8323 <hr />
8324 <p>bar</p>
8325 !! end
8326
8327 !! test
8328 Horizontal ruler -- 4+ dashes render hr
8329 !! wikitext
8330 ----
8331 !! html
8332 <hr />
8333
8334 !! end
8335
8336 !! test
8337 Horizontal ruler -- eats additional dashes on the same line
8338 !! wikitext
8339 ---------
8340 !! html
8341 <hr />
8342
8343 !! end
8344
8345 !! test
8346 Horizontal ruler -- does not collapse dashes on consecutive lines
8347 !! wikitext
8348 ----
8349 ----
8350 !! html
8351 <hr />
8352 <hr />
8353
8354 !! end
8355
8356 !! test
8357 Horizontal ruler -- <4 dashes render as plain text
8358 !! wikitext
8359 ---
8360 !! html
8361 <p>---
8362 </p>
8363 !! end
8364
8365 !! test
8366 Horizontal ruler -- Supports content following dashes on same line
8367 !! wikitext
8368 ---- Foo
8369 !! html
8370 <hr /> Foo
8371
8372 !! html+tidy
8373 <hr />
8374 <p>Foo</p>
8375 !! end
8376
8377 ###
8378 ### Block-level elements
8379 ###
8380 !! test
8381 Common list
8382 !! wikitext
8383 *Common list
8384 * item 2
8385 *item 3
8386 !! html
8387 <ul><li>Common list</li>
8388 <li> item 2</li>
8389 <li>item 3</li></ul>
8390
8391 !! end
8392
8393 !! test
8394 Numbered list
8395 !! wikitext
8396 #Numbered list
8397 #item 2
8398 # item 3
8399 !! html
8400 <ol><li>Numbered list</li>
8401 <li>item 2</li>
8402 <li> item 3</li></ol>
8403
8404 !! end
8405
8406 !! test
8407 Mixed list
8408 !! wikitext
8409 *Mixed list
8410 *# with numbers
8411 ** and bullets
8412 *# and numbers
8413 *bullets again
8414 **bullet level 2
8415 ***bullet level 3
8416 ***#Number on level 4
8417 **bullet level 2
8418 **#Number on level 3
8419 **#Number on level 3
8420 *#number level 2
8421 *Level 1
8422 *** Level 3
8423 #** Level 3, but ordered
8424 !! html
8425 <ul><li>Mixed list
8426 <ol><li> with numbers</li></ol>
8427 <ul><li> and bullets</li></ul>
8428 <ol><li> and numbers</li></ol></li>
8429 <li>bullets again
8430 <ul><li>bullet level 2
8431 <ul><li>bullet level 3
8432 <ol><li>Number on level 4</li></ol></li></ul></li>
8433 <li>bullet level 2
8434 <ol><li>Number on level 3</li>
8435 <li>Number on level 3</li></ol></li></ul>
8436 <ol><li>number level 2</li></ol></li>
8437 <li>Level 1
8438 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8439 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8440
8441 !! end
8442
8443 !! test
8444 Nested lists 1
8445 !! wikitext
8446 *foo
8447 **bar
8448 !! html
8449 <ul><li>foo
8450 <ul><li>bar</li></ul></li></ul>
8451
8452 !! end
8453
8454 !! test
8455 Nested lists 2
8456 !! wikitext
8457 **foo
8458 *bar
8459 !! html
8460 <ul><li><ul><li>foo</li></ul></li>
8461 <li>bar</li></ul>
8462
8463 !! end
8464
8465 !! test
8466 Nested lists 3 (first element empty)
8467 !! wikitext
8468 *
8469 **bar
8470 !! html
8471 <ul><li>
8472 <ul><li>bar</li></ul></li></ul>
8473
8474 !! end
8475
8476 !! test
8477 Nested lists 4 (first element empty)
8478 !! wikitext
8479 **
8480 *bar
8481 !! html
8482 <ul><li><ul><li></li></ul></li>
8483 <li>bar</li></ul>
8484
8485 !! end
8486
8487 !! test
8488 Nested lists 5 (both elements empty)
8489 !! wikitext
8490 **
8491 *
8492 !! html
8493 <ul><li><ul><li></li></ul></li>
8494 <li></li></ul>
8495
8496 !! end
8497
8498 !! test
8499 Nested lists 6 (both elements empty)
8500 !! wikitext
8501 *
8502 **
8503 !! html
8504 <ul><li>
8505 <ul><li></li></ul></li></ul>
8506
8507 !! end
8508
8509 !! test
8510 Nested lists 7 (skip initial nesting levels)
8511 !! wikitext
8512 *** foo
8513 !! html
8514 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8515
8516 !! end
8517
8518 !! test
8519 Nested lists 8 (multiple nesting transitions)
8520 !! wikitext
8521 * foo
8522 *** bar
8523 ** baz
8524 * boo
8525 !! html
8526 <ul><li> foo
8527 <ul><li><ul><li> bar</li></ul></li>
8528 <li> baz</li></ul></li>
8529 <li> boo</li></ul>
8530
8531 !! end
8532
8533 !! test
8534 Nested lists 9 (extension interaction)
8535 !! options
8536 parsoid
8537 !! wikitext
8538 *<references />
8539 !! html/parsoid
8540 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8541 !! end
8542
8543 !! test
8544 1. Lists with start-of-line-transparent tokens before bullets: Comments
8545 !! wikitext
8546 *foo
8547 *<!--cmt-->bar
8548 <!--cmt-->*baz
8549 !! html
8550 <ul><li>foo</li>
8551 <li>bar</li>
8552 <li>baz</li></ul>
8553
8554 !! end
8555
8556 !! test
8557 2. Lists with start-of-line-transparent tokens before bullets: Template close
8558 !! wikitext
8559 *foo {{echo|bar
8560 }}*baz
8561 !! html
8562 <ul><li>foo bar</li>
8563 <li>baz</li></ul>
8564
8565 !! end
8566
8567 !! test
8568 List items are not parsed correctly following a <pre> block (bug 785)
8569 !! wikitext
8570 * <pre>foo</pre>
8571 * <pre>bar</pre>
8572 * zar
8573 !! html/php
8574 <ul><li> <pre>foo</pre></li>
8575 <li> <pre>bar</pre></li>
8576 <li> zar</li></ul>
8577
8578 !! html/parsoid
8579 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8580 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8581 <li> zar</li></ul>
8582 !! end
8583
8584 !! test
8585 List items from template
8586 !! wikitext
8587
8588 {{inner list}}
8589 * item 2
8590
8591 * item 0
8592 {{inner list}}
8593 * item 2
8594
8595 * item 0
8596 * notSOL{{inner list}}
8597 * item 2
8598 !! html
8599 <ul><li> item 1</li>
8600 <li> item 2</li></ul>
8601 <ul><li> item 0</li>
8602 <li> item 1</li>
8603 <li> item 2</li></ul>
8604 <ul><li> item 0</li>
8605 <li> notSOL</li>
8606 <li> item 1</li>
8607 <li> item 2</li></ul>
8608
8609 !! end
8610
8611 !! test
8612 List interrupted by empty line or heading
8613 !! wikitext
8614 * foo
8615
8616 ** bar
8617 == A heading ==
8618 * Another list item
8619 !! html
8620 <ul><li> foo</li></ul>
8621 <ul><li><ul><li> bar</li></ul></li></ul>
8622 <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>
8623 <ul><li> Another list item</li></ul>
8624
8625 !!end
8626
8627 !!test
8628 Multiple list tags generated by templates
8629 !! wikitext
8630 {{echo|<li>}}a
8631 {{echo|<li>}}b
8632 {{echo|<li>}}c
8633 !! html
8634 <li>a
8635 <li>b
8636 <li>c</li>
8637 </li>
8638 </li>
8639
8640 !! html+tidy
8641 <ul>
8642 <li>a</li>
8643 <li>b</li>
8644 <li>c</li>
8645 </ul>
8646 !!end
8647
8648 !!test
8649 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8650 !! wikitext
8651 *a
8652 <!--This line will NOT split the list-->
8653 *b
8654 <!--This line will NOT split the list either-->
8655 *c
8656 <!--foo--> <!----> <!--This line NOT split the list either-->
8657 *d
8658 !! html
8659 <ul><li>a</li>
8660 <li>b</li>
8661 <li>c</li>
8662 <li>d</li></ul>
8663
8664 !!end
8665
8666 !!test
8667 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8668 !! wikitext
8669 *a
8670 <!--This line will NOT split the list-->
8671 *b
8672 <!--This line will NOT split the list either-->
8673 *c
8674 <!--foo--> <!----> <!--This line NOT split the list
8675 either-->
8676 *d
8677 !! html
8678 <ul><li>a</li>
8679 <li>b</li>
8680 <li>c</li>
8681 <li>d</li></ul>
8682
8683 !!end
8684
8685 !!test
8686 Test the li-hack
8687 (The PHP parser relies on Tidy for the hack)
8688 !!options
8689 parsoid=wt2html,wt2wt
8690 !! wikitext
8691 * foo
8692 * <li>li-hack
8693 * {{echo|<li>templated li-hack}}
8694 * <!--foo--> <li> unsupported li-hack with preceding comments
8695
8696 <ul>
8697 <li><li>not a li-hack
8698 </li>
8699 </ul>
8700 !! html+tidy
8701 <ul>
8702 <li>foo</li>
8703 <li>li-hack</li>
8704 <li>templated li-hack</li>
8705 <li>unsupported li-hack with preceding comments</li>
8706 </ul>
8707 <ul>
8708 <li>not a li-hack</li>
8709 </ul>
8710 !!end
8711
8712 !! test
8713 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8714 !! options
8715 parsoid
8716 !! wikitext
8717 # foo
8718 ## bar
8719 * foo
8720 ** bar
8721 : foo
8722 :: bar
8723 !! html
8724 <ol>
8725 <li> foo<ol>
8726 <li> bar</li>
8727 </ol></li>
8728 </ol><ul>
8729 <li> foo<ul>
8730 <li> bar</li>
8731 </ul></li>
8732 </ul><dl>
8733 <dd> foo<dl>
8734 <dd> bar</dd>
8735 </dl></dd>
8736 </dl>
8737 !! end
8738
8739 !! test
8740 Parsoid: Test of whitespace serialization with Templated bullets
8741 !! options
8742 parsoid
8743 !! wikitext
8744 * {{bullet}}
8745 !! html
8746 <ul>
8747 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8748 </ul>
8749 !! end
8750
8751 # ------------------------------------------------------------------------
8752 # The next set of tests are about Parsoid's ability to handle badly nested
8753 # tags (parse, minimize scope of fixup, and roundtrip back)
8754 # ------------------------------------------------------------------------
8755
8756 !! test
8757 Unbalanced closing block tags break a list
8758 (php parser relies on Tidy to fix up)
8759 !! wikitext
8760 <div>
8761 *a</div><div>
8762 *b</div>
8763 !! html+tidy
8764 <div>
8765 <ul>
8766 <li>a</li>
8767 </ul>
8768 </div>
8769 <div>
8770 <ul>
8771 <li>b</li>
8772 </ul>
8773 </div>
8774 !! end
8775
8776 # Parsoid fails this test, but it might be tricky to support properly.
8777 # See bug 68395.
8778 !! test
8779 Unbalanced closing non-block tags don't break a list
8780 (php parser relies on Tidy to fix up)
8781 !! wikitext
8782 <span>
8783 *a</span><span>
8784 *b</span>
8785 !! html/php+tidy
8786 <ul>
8787 <li><span>a</span></li>
8788 <li><span>b</span></li>
8789 </ul>
8790 !! html/parsoid
8791 <span>
8792 <ul>
8793 <li>a<span></span>
8794 </li>
8795 <li>b
8796 </li>
8797 </ul>
8798 </span>
8799 !! end
8800
8801 !! test
8802 Unclosed formatting tags that straddle lists are closed and reopened
8803 (php parser relies on Tidy to fix up)
8804 !! options
8805 parsoid=wt2html,wt2wt,html2html
8806 !! wikitext
8807 # <s> a
8808 # b </s>
8809 !! html/php+tidy
8810 <ol>
8811 <li><s>a</s></li>
8812 <li><s>b</s></li>
8813 </ol>
8814 !! html/parsoid
8815 <ol><li> <s> a</s></li>
8816 <li><s> b </s></li></ol>
8817 !! end
8818
8819 # See bug 68395.
8820 !!test
8821 1. List embedded in a formatting tag
8822 !! wikitext
8823 <small>
8824 * foo
8825 </small>
8826 !! html/php+tidy
8827 <ul>
8828 <li><small>foo</small></li>
8829 </ul>
8830 !! html/parsoid
8831 <small>
8832 <ul>
8833 <li> foo</li>
8834 </ul>
8835 </small>
8836 !!end
8837
8838 ## Ugly Parsoid output here
8839 ## Not sure what the right output is.
8840 !!test
8841 2. List embedded in a formatting tag
8842 !! wikitext
8843 <small>
8844 *a
8845 *b</small>
8846 !! html/php+tidy
8847 <ul>
8848 <li><small>a</small></li>
8849 <li><small>b</small></li>
8850 </ul>
8851 !! html/parsoid
8852 <small></small>
8853 <ul><small>
8854 <li>a</li>
8855 </small>
8856 <li><small>b</small></li>
8857 </ul>
8858 !!end
8859
8860 # Ugly Parsoid and PHP parser output here
8861 # Not sure if we want to make this a test!
8862 #
8863 ## !!test
8864 ## 3. Unclosed formatting tags in list elements
8865 ## !! wikitext
8866 ## *<small>a
8867 ## *<small>b
8868 ## !! html/php+tidy
8869 ## <ul>
8870 ## <li><small>a</small></li>
8871 ## <li><small><small>b</small></small></li>
8872 ## </ul>
8873 ## !! html/parsoid
8874 ## <ul>
8875 ## <li><small>a</small></li>
8876 ## <small>
8877 ## <li><small>b</small></li>
8878 ## </small></ul>
8879 ## !!end
8880
8881 # This is a bug in the PHP parser + tidy combination.
8882 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8883 # and then fostered out of the table by tidy.)
8884 # We believe the Parsoid output to be correct.
8885 !! test
8886 Table with missing opening <tr> tag
8887 !! options
8888 parsoid=wt2html,wt2wt
8889 !! wikitext
8890 <table>
8891 <td>foo</td>
8892 </tr>
8893 </table>
8894 !! html+tidy
8895 <table>
8896 <tr>
8897 <td>foo</td>
8898 </tr>
8899 </table>
8900 !! end
8901
8902 ###
8903 ### Magic Words
8904 ###
8905
8906 # Note that the current date is hard-coded as
8907 # 1970-01-01T00:02:03Z (a Thursday)
8908 # when running parser tests. The timezone is also fixed to GMT, so
8909 # local date will be identical to current date.
8910
8911 !! test
8912 Magic Word: {{CURRENTDAY}}
8913 !! wikitext
8914 {{CURRENTDAY}}
8915 !! html
8916 <p>1
8917 </p>
8918 !! end
8919
8920 !! test
8921 Magic Word: {{CURRENTDAY2}}
8922 !! wikitext
8923 {{CURRENTDAY2}}
8924 !! html
8925 <p>01
8926 </p>
8927 !! end
8928
8929 !! test
8930 Magic Word: {{CURRENTDAYNAME}}
8931 !! wikitext
8932 {{CURRENTDAYNAME}}
8933 !! html
8934 <p>Thursday
8935 </p>
8936 !! end
8937
8938 !! test
8939 Magic Word: {{CURRENTDOW}}
8940 !! wikitext
8941 {{CURRENTDOW}}
8942 !! html
8943 <p>4
8944 </p>
8945 !! end
8946
8947 !! test
8948 Magic Word: {{CURRENTMONTH}}
8949 !! wikitext
8950 {{CURRENTMONTH}}
8951 !! html
8952 <p>01
8953 </p>
8954 !! end
8955
8956 !! test
8957 Magic Word: {{CURRENTMONTH1}}
8958 !! wikitext
8959 {{CURRENTMONTH1}}
8960 !! html
8961 <p>1
8962 </p>
8963 !! end
8964
8965 !! test
8966 Magic Word: {{CURRENTMONTHABBREV}}
8967 !! wikitext
8968 {{CURRENTMONTHABBREV}}
8969 !! html
8970 <p>Jan
8971 </p>
8972 !! end
8973
8974 !! test
8975 Magic Word: {{CURRENTMONTHNAME}}
8976 !! wikitext
8977 {{CURRENTMONTHNAME}}
8978 !! html
8979 <p>January
8980 </p>
8981 !! end
8982
8983 !! test
8984 Magic Word: {{CURRENTMONTHNAMEGEN}}
8985 !! wikitext
8986 {{CURRENTMONTHNAMEGEN}}
8987 !! html
8988 <p>January
8989 </p>
8990 !! end
8991
8992 !! test
8993 Magic Word: {{CURRENTTIME}}
8994 !! wikitext
8995 {{CURRENTTIME}}
8996 !! html
8997 <p>00:02
8998 </p>
8999 !! end
9000
9001 !! test
9002 Magic Word: {{CURRENTHOUR}}
9003 !! wikitext
9004 {{CURRENTHOUR}}
9005 !! html
9006 <p>00
9007 </p>
9008 !! end
9009
9010 !! test
9011 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9012 !! wikitext
9013 {{CURRENTWEEK}}
9014 !! html
9015 <p>1
9016 </p>
9017 !! end
9018
9019 !! test
9020 Magic Word: {{CURRENTYEAR}}
9021 !! wikitext
9022 {{CURRENTYEAR}}
9023 !! html
9024 <p>1970
9025 </p>
9026 !! end
9027
9028 !! test
9029 Magic Word: {{CURRENTTIMESTAMP}}
9030 !! wikitext
9031 {{CURRENTTIMESTAMP}}
9032 !! html
9033 <p>19700101000203
9034 </p>
9035 !! end
9036
9037 !! test
9038 Magic Words LOCAL (UTC)
9039 !! wikitext
9040 * {{LOCALMONTH}}
9041 * {{LOCALMONTH1}}
9042 * {{LOCALMONTHNAME}}
9043 * {{LOCALMONTHNAMEGEN}}
9044 * {{LOCALMONTHABBREV}}
9045 * {{LOCALDAY}}
9046 * {{LOCALDAY2}}
9047 * {{LOCALDAYNAME}}
9048 * {{LOCALYEAR}}
9049 * {{LOCALTIME}}
9050 * {{LOCALHOUR}}
9051 * {{LOCALWEEK}}
9052 * {{LOCALDOW}}
9053 * {{LOCALTIMESTAMP}}
9054 !! html
9055 <ul><li> 01</li>
9056 <li> 1</li>
9057 <li> January</li>
9058 <li> January</li>
9059 <li> Jan</li>
9060 <li> 1</li>
9061 <li> 01</li>
9062 <li> Thursday</li>
9063 <li> 1970</li>
9064 <li> 00:02</li>
9065 <li> 00</li>
9066 <li> 1</li>
9067 <li> 4</li>
9068 <li> 19700101000203</li></ul>
9069
9070 !! end
9071
9072 !! test
9073 Magic Word: {{FULLPAGENAME}}
9074 !! options
9075 title=[[User:Ævar Arnfjörð Bjarmason]]
9076 !! wikitext
9077 {{FULLPAGENAME}}
9078 !! html
9079 <p>User:Ævar Arnfjörð Bjarmason
9080 </p>
9081 !! end
9082
9083 !! test
9084 Magic Word: {{FULLPAGENAMEE}}
9085 !! options
9086 title=[[User:Ævar Arnfjörð Bjarmason]]
9087 !! wikitext
9088 {{FULLPAGENAMEE}}
9089 !! html
9090 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9091 </p>
9092 !! end
9093
9094 !! test
9095 Magic Word: {{TALKSPACE}}
9096 !! options
9097 title=[[User:Ævar Arnfjörð Bjarmason]]
9098 !! wikitext
9099 {{TALKSPACE}}
9100 !! html
9101 <p>User talk
9102 </p>
9103 !! end
9104
9105 !! test
9106 Magic Word: {{TALKSPACE}}, same namespace
9107 !! options
9108 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9109 !! wikitext
9110 {{TALKSPACE}}
9111 !! html
9112 <p>User talk
9113 </p>
9114 !! end
9115
9116 !! test
9117 Magic Word: {{TALKSPACE}}, main namespace
9118 !! options
9119 title=[[Parser Test]]
9120 !! wikitext
9121 {{TALKSPACE}}
9122 !! html
9123 <p>Talk
9124 </p>
9125 !! end
9126
9127 !! test
9128 Magic Word: {{TALKSPACEE}}
9129 !! options
9130 title=[[User:Ævar Arnfjörð Bjarmason]]
9131 !! wikitext
9132 {{TALKSPACEE}}
9133 !! html
9134 <p>User_talk
9135 </p>
9136 !! end
9137
9138 !! test
9139 Magic Word: {{SUBJECTSPACE}}
9140 !! options
9141 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9142 !! wikitext
9143 {{SUBJECTSPACE}}
9144 !! html
9145 <p>User
9146 </p>
9147 !! end
9148
9149 !! test
9150 Magic Word: {{SUBJECTSPACE}}, same namespace
9151 !! options
9152 title=[[User:Ævar Arnfjörð Bjarmason]]
9153 !! wikitext
9154 {{SUBJECTSPACE}}
9155 !! html
9156 <p>User
9157 </p>
9158 !! end
9159
9160 !! test
9161 Magic Word: {{SUBJECTSPACE}}, main namespace
9162 !! options
9163 title=[[Parser Test]]
9164 !! wikitext
9165 {{SUBJECTSPACE}}
9166 !! html
9167
9168 !! end
9169
9170 !! test
9171 Magic Word: {{SUBJECTSPACEE}}
9172 !! options
9173 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9174 !! wikitext
9175 {{SUBJECTSPACEE}}
9176 !! html
9177 <p>User
9178 </p>
9179 !! end
9180
9181 !! test
9182 Magic Word: {{NAMESPACE}}
9183 !! options
9184 title=[[User:Ævar Arnfjörð Bjarmason]]
9185 !! wikitext
9186 {{NAMESPACE}}
9187 !! html
9188 <p>User
9189 </p>
9190 !! end
9191
9192 !! test
9193 Magic Word: {{NAMESPACEE}}
9194 !! options
9195 title=[[User:Ævar Arnfjörð Bjarmason]]
9196 !! wikitext
9197 {{NAMESPACEE}}
9198 !! html
9199 <p>User
9200 </p>
9201 !! end
9202
9203 !! test
9204 Magic Word: {{NAMESPACENUMBER}}
9205 !! options
9206 title=[[User:Ævar Arnfjörð Bjarmason]]
9207 !! wikitext
9208 {{NAMESPACENUMBER}}
9209 !! html
9210 <p>2
9211 </p>
9212 !! end
9213
9214 !! test
9215 Magic Word: {{SUBPAGENAME}}
9216 !! options
9217 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9218 !! wikitext
9219 {{SUBPAGENAME}}
9220 !! html
9221 <p>sub ö
9222 </p>
9223 !! end
9224
9225 !! test
9226 Magic Word: {{SUBPAGENAMEE}}
9227 !! options
9228 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9229 !! wikitext
9230 {{SUBPAGENAMEE}}
9231 !! html
9232 <p>sub_%C3%B6
9233 </p>
9234 !! end
9235
9236 !! test
9237 Magic Word: {{ROOTPAGENAME}}
9238 !! options
9239 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9240 !! wikitext
9241 {{ROOTPAGENAME}}
9242 !! html
9243 <p>Ævar Arnfjörð Bjarmason
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Word: {{ROOTPAGENAMEE}}
9249 !! options
9250 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9251 !! wikitext
9252 {{ROOTPAGENAMEE}}
9253 !! html
9254 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9255 </p>
9256 !! end
9257
9258 !! test
9259 Magic Word: {{BASEPAGENAME}}
9260 !! options
9261 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9262 !! wikitext
9263 {{BASEPAGENAME}}
9264 !! html
9265 <p>Ævar Arnfjörð Bjarmason
9266 </p>
9267 !! end
9268
9269 !! test
9270 Magic Word: {{BASEPAGENAMEE}}
9271 !! options
9272 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9273 !! wikitext
9274 {{BASEPAGENAMEE}}
9275 !! html
9276 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9277 </p>
9278 !! end
9279
9280 !! test
9281 Magic Word: {{TALKPAGENAME}}
9282 !! options
9283 title=[[User:Ævar Arnfjörð Bjarmason]]
9284 !! wikitext
9285 {{TALKPAGENAME}}
9286 !! html
9287 <p>User talk:Ævar Arnfjörð Bjarmason
9288 </p>
9289 !! end
9290
9291 !! test
9292 Magic Word: {{TALKPAGENAMEE}}
9293 !! options
9294 title=[[User:Ævar Arnfjörð Bjarmason]]
9295 !! wikitext
9296 {{TALKPAGENAMEE}}
9297 !! html
9298 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9299 </p>
9300 !! end
9301
9302 !! test
9303 Magic Word: {{SUBJECTPAGENAME}}
9304 !! options
9305 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9306 !! wikitext
9307 {{SUBJECTPAGENAME}}
9308 !! html
9309 <p>User:Ævar Arnfjörð Bjarmason
9310 </p>
9311 !! end
9312
9313 !! test
9314 Magic Word: {{SUBJECTPAGENAMEE}}
9315 !! options
9316 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9317 !! wikitext
9318 {{SUBJECTPAGENAMEE}}
9319 !! html
9320 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9321 </p>
9322 !! end
9323
9324 !! test
9325 Magic Word: {{NUMBEROFFILES}}
9326 !! wikitext
9327 {{NUMBEROFFILES}}
9328 !! html
9329 <p>5
9330 </p>
9331 !! end
9332
9333 !! test
9334 Magic Word: {{PAGENAME}}
9335 !! options
9336 title=[[User:Ævar Arnfjörð Bjarmason]]
9337 !! wikitext
9338 {{PAGENAME}}
9339 !! html
9340 <p>Ævar Arnfjörð Bjarmason
9341 </p>
9342 !! end
9343
9344 !! test
9345 Magic Word: {{PAGENAME}} with metacharacters
9346 !! options
9347 title=[['foo & bar = baz']]
9348 !! wikitext
9349 ''{{PAGENAME}}''
9350 !! html/php
9351 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9352 </p>
9353 !! html+tidy
9354 <p><i>'foo &amp; bar = baz'</i></p>
9355 !! end
9356
9357 !! test
9358 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9359 !! options
9360 title=[[*RFC 1234 http://example.com/]]
9361 !! wikitext
9362 {{PAGENAME}}
9363 !! html/php
9364 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9365 </p>
9366 !! html+tidy
9367 <p>*RFC 1234 http://example.com/</p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{PAGENAMEE}}
9372 !! options
9373 title=[[User:Ævar Arnfjörð Bjarmason]]
9374 !! wikitext
9375 {{PAGENAMEE}}
9376 !! html
9377 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9378 </p>
9379 !! end
9380
9381 !! test
9382 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9383 !! options
9384 title=[[*RFC 1234 http://example.com/]]
9385 !! wikitext
9386 {{PAGENAMEE}}
9387 !! html/php
9388 <p>&#42;RFC_1234_http&#58;//example.com/
9389 </p>
9390 !! html+tidy
9391 <p>*RFC_1234_http://example.com/</p>
9392 !! end
9393
9394 !! test
9395 Magic Word: {{REVISIONID}}
9396 !! wikitext
9397 {{REVISIONID}}
9398 !! html
9399 <p>1337
9400 </p>
9401 !! end
9402
9403 !! test
9404 Magic Word: {{SCRIPTPATH}}
9405 !! wikitext
9406 {{SCRIPTPATH}}
9407 !! html
9408 <p>/
9409 </p>
9410 !! end
9411
9412 !! test
9413 Magic Word: {{STYLEPATH}}
9414 !! wikitext
9415 {{STYLEPATH}}
9416 !! html
9417 <p>/skins
9418 </p>
9419 !! end
9420
9421 !! test
9422 Magic Word: {{SERVER}}
9423 !! wikitext
9424 {{SERVER}}
9425 !! html
9426 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9427 </p>
9428 !! end
9429
9430 !! test
9431 Magic Word: {{SERVERNAME}}
9432 !! wikitext
9433 {{SERVERNAME}}
9434 !! html
9435 <p>example.org
9436 </p>
9437 !! end
9438
9439 !! test
9440 Magic Word: {{SITENAME}}
9441 !! wikitext
9442 {{SITENAME}}
9443 !! html
9444 <p>MediaWiki
9445 </p>
9446 !! end
9447
9448 !! test
9449 Case-sensitive magic words, when cased differently, should just be template transclusions
9450 !! wikitext
9451 {{CurrentMonth}}
9452 {{currentday}}
9453 {{cURreNTweEK}}
9454 {{currentHour}}
9455 !! html
9456 <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>
9457 <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>
9458 <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>
9459 <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>
9460 </p>
9461 !! end
9462
9463 !! test
9464 Case-insensitive magic words should still work with weird casing.
9465 !! wikitext
9466 {{sErVeRNaMe}}
9467 {{LCFirst:AOEU}}
9468 {{ucFIRST:aoeu}}
9469 {{SERver}}
9470 !! html
9471 <p>example.org
9472 aOEU
9473 Aoeu
9474 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9475 </p>
9476 !! end
9477
9478 # From plwiki:PLOS_ONE
9479 !! test
9480 Parsoid: Page property magic word with magic word contents
9481 !! wikitext
9482 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9483 !! html/parsoid
9484 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9485 !! end
9486
9487 !! test
9488 Parsoid: Template-generated DISPLAYTITLE
9489 !! wikitext
9490 {{{{echo|DISPLAYTITLE}}:Foo}}
9491 !! html/parsoid
9492 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9493 !! end
9494
9495 !! test
9496 Namespace 1 {{ns:1}}
9497 !! wikitext
9498 {{ns:1}}
9499 !! html
9500 <p>Talk
9501 </p>
9502 !! end
9503
9504 !! test
9505 Namespace 1 {{ns:01}}
9506 !! wikitext
9507 {{ns:01}}
9508 !! html
9509 <p>Talk
9510 </p>
9511 !! end
9512
9513 !! test
9514 Namespace 0 {{ns:0}} (bug 4783)
9515 !! wikitext
9516 {{ns:0}}
9517 !! html
9518
9519 !! end
9520
9521 !! test
9522 Namespace 0 {{ns:00}} (bug 4783)
9523 !! wikitext
9524 {{ns:00}}
9525 !! html
9526
9527 !! end
9528
9529 !! test
9530 Namespace -1 {{ns:-1}}
9531 !! wikitext
9532 {{ns:-1}}
9533 !! html
9534 <p>Special
9535 </p>
9536 !! end
9537
9538 !! test
9539 Namespace User {{ns:User}}
9540 !! wikitext
9541 {{ns:User}}
9542 !! html
9543 <p>User
9544 </p>
9545 !! end
9546
9547 !! test
9548 Namespace User talk {{ns:User_talk}}
9549 !! wikitext
9550 {{ns:User_talk}}
9551 !! html
9552 <p>User talk
9553 </p>
9554 !! end
9555
9556 !! test
9557 Namespace User talk {{ns:uSeR tAlK}}
9558 !! wikitext
9559 {{ns:uSeR tAlK}}
9560 !! html
9561 <p>User talk
9562 </p>
9563 !! end
9564
9565 !! test
9566 Namespace File {{ns:File}}
9567 !! wikitext
9568 {{ns:File}}
9569 !! html
9570 <p>File
9571 </p>
9572 !! end
9573
9574 !! test
9575 Namespace File {{ns:Image}}
9576 !! wikitext
9577 {{ns:Image}}
9578 !! html
9579 <p>File
9580 </p>
9581 !! end
9582
9583 !! test
9584 Namespace (lang=de) Benutzer {{ns:User}}
9585 !! options
9586 language=de
9587 !! wikitext
9588 {{ns:User}}
9589 !! html
9590 <p>Benutzer
9591 </p>
9592 !! end
9593
9594 !! test
9595 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9596 !! options
9597 language=de
9598 !! wikitext
9599 {{ns:3}}
9600 !! html
9601 <p>Benutzer Diskussion
9602 </p>
9603 !! end
9604
9605
9606 !! test
9607 Urlencode
9608 !! wikitext
9609 {{urlencode:hi world?!}}
9610 {{urlencode:hi world?!|WIKI}}
9611 {{urlencode:hi world?!|PATH}}
9612 {{urlencode:hi world?!|QUERY}}
9613 !! html
9614 <p>hi+world%3F%21
9615 hi_world%3F!
9616 hi%20world%3F%21
9617 hi+world%3F%21
9618 </p>
9619 !! end
9620
9621 !! test
9622 Magic Word: prioritize type info over data-parsoid
9623 !! options
9624 parsoid=html2wt
9625 !! html/parsoid
9626 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9627 !! wikitext
9628 __FORCETOC__
9629 !! end
9630
9631 !! test
9632 Magic Word: serialize on separate line (parsoid)
9633 !! options
9634 parsoid=wt2wt,html2wt
9635 !! wikitext
9636 foo
9637 __NOTOC__
9638 bar
9639 !! html
9640 foo<meta property="mw:PageProp/notoc"/>bar
9641 !! end
9642
9643 !! test
9644 Magic Word: rt non-english wikis
9645 !! options
9646 parsoid=wt2wt
9647 language=de
9648 !! wikitext
9649 __NOEDITSECTION__
9650 !! html
9651 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9652 !! end
9653
9654 ###
9655 ### Magic links
9656 ###
9657 !! test
9658 Magic links: internal link to RFC (bug 479)
9659 !! wikitext
9660 [[RFC 123]]
9661 !! html
9662 <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>
9663 </p>
9664 !! end
9665
9666 !! test
9667 Magic links: RFC (bug 479)
9668 !! wikitext
9669 RFC 822
9670 !! html
9671 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9672 </p>
9673 !! end
9674
9675 !! test
9676 Magic links: RFC (bug 65278)
9677 !! wikitext
9678 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9679 !! html
9680 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9681 </p>
9682 !! end
9683
9684 !! test
9685 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9686 !! wikitext
9687 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9688 RFC
9689 822
9690 !! html
9691 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9692 RFC
9693 822
9694 </p>
9695 !! end
9696
9697 !! test
9698 Magic links: ISBN (bug 1937)
9699 !! wikitext
9700 ISBN 0-306-40615-2
9701 !! html
9702 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9703 </p>
9704 !! end
9705
9706 !! test
9707 Magic links: ISBN (bug 65278)
9708 !! wikitext
9709 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9710 !! html/php
9711 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9712 </p>
9713 !! html/parsoid
9714 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9715 !! end
9716
9717 !! test
9718 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9719 !! wikitext
9720 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9721 ISBN
9722 9780316098113
9723 ISBN 978
9724 0316098113
9725 !! html
9726 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9727 ISBN
9728 9780316098113
9729 ISBN 978
9730 0316098113
9731 </p>
9732 !! end
9733
9734 !! test
9735 Magic links: PMID incorrectly converts space to underscore
9736 !! wikitext
9737 PMID 1234
9738 !! html
9739 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic links: PMID (bug 65278)
9745 !! wikitext
9746 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9747 !! html
9748 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9749 </p>
9750 !! end
9751
9752 !! test
9753 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9754 !! wikitext
9755 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9756 PMID
9757 1234
9758 !! html
9759 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9760 PMID
9761 1234
9762 </p>
9763 !! end
9764
9765 ###
9766 ### Templates
9767 ####
9768
9769 !! test
9770 Nonexistent template
9771 !! wikitext
9772 {{thistemplatedoesnotexist}}
9773 !! html
9774 <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>
9775 </p>
9776 !! end
9777
9778 !! test
9779 Template with invalid target containing tags
9780 !! wikitext
9781 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9782 !! html
9783 <p>{{a<b>b</b>|foo|a=b|a = b}}
9784 </p>
9785 !! end
9786
9787 !! test
9788 Template with invalid target containing unclosed tag
9789 !! wikitext
9790 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9791 !! html
9792 <p>{{a<b>|foo|a=b|a = b}}</b>
9793 </p>
9794 !! end
9795
9796 !! test
9797 Template with invalid target containing wikilink
9798 !! wikitext
9799 {{[[Main Page]]}}
9800 !! html/php
9801 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9802 </p>
9803 !! html/parsoid
9804 <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>
9805 !! end
9806
9807 !! test
9808 Template with just whitespace in it, bug #68421
9809 !! wikitext
9810 {{echo|{{ }}}}
9811 !! html/parsoid
9812 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9813 !! end
9814
9815 !! article
9816 Template:test
9817 !! text
9818 This is a test template
9819 !! endarticle
9820
9821 !! test
9822 Simple template
9823 !! wikitext
9824 {{test}}
9825 !! html
9826 <p>This is a test template
9827 </p>
9828 !! end
9829
9830 !! test
9831 Template with explicit namespace
9832 !! wikitext
9833 {{Template:test}}
9834 !! html
9835 <p>This is a test template
9836 </p>
9837 !! end
9838
9839
9840 !! article
9841 Template:paramtest
9842 !! text
9843 This is a test template with parameter {{{param}}}
9844 !! endarticle
9845
9846 !! test
9847 Template parameter
9848 !! wikitext
9849 {{paramtest|param=foo}}
9850 !! html
9851 <p>This is a test template with parameter foo
9852 </p>
9853 !! end
9854
9855 !! article
9856 Template:paramtestnum
9857 !! text
9858 [[{{{1}}}|{{{2}}}]]
9859 !! endarticle
9860
9861 !! test
9862 Template unnamed parameter
9863 !! wikitext
9864 {{paramtestnum|Main Page|the main page}}
9865 !! html
9866 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9867 </p>
9868 !! end
9869
9870 !! article
9871 Template:templatesimple
9872 !! text
9873 (test)
9874 !! endarticle
9875
9876 !! article
9877 Template:templateredirect
9878 !! text
9879 #redirect [[Template:templatesimple]]
9880 !! endarticle
9881
9882 !! article
9883 Template:templateasargtestnum
9884 !! text
9885 {{{{{1}}}}}
9886 !! endarticle
9887
9888 !! article
9889 Template:templateasargtest
9890 !! text
9891 {{template{{{templ}}}}}
9892 !! endarticle
9893
9894 !! article
9895 Template:templateasargtest2
9896 !! text
9897 {{{{{templ}}}}}
9898 !! endarticle
9899
9900 !! test
9901 Template with template name as unnamed argument
9902 !! wikitext
9903 {{templateasargtestnum|templatesimple}}
9904 !! html
9905 <p>(test)
9906 </p>
9907 !! end
9908
9909 !! test
9910 Template with template name as argument
9911 !! wikitext
9912 {{templateasargtest|templ=simple}}
9913 !! html
9914 <p>(test)
9915 </p>
9916 !! end
9917
9918 !! test
9919 Template with template name as argument (2)
9920 !! wikitext
9921 {{templateasargtest2|templ=templatesimple}}
9922 !! html
9923 <p>(test)
9924 </p>
9925 !! end
9926
9927 !! article
9928 Template:templateasargtestdefault
9929 !! text
9930 {{{{{templ|templatesimple}}}}}
9931 !! endarticle
9932
9933 !! article
9934 Template:templa
9935 !! text
9936 '''templ'''
9937 !! endarticle
9938
9939 !! test
9940 Template with default value
9941 !! wikitext
9942 {{templateasargtestdefault}}
9943 !! html
9944 <p>(test)
9945 </p>
9946 !! end
9947
9948 !! test
9949 Template with default value (value set)
9950 !! wikitext
9951 {{templateasargtestdefault|templ=templa}}
9952 !! html
9953 <p><b>templ</b>
9954 </p>
9955 !! end
9956
9957 !! test
9958 Template redirect
9959 !! wikitext
9960 {{templateredirect}}
9961 !! html/php
9962 <p>(test)
9963 </p>
9964 !! html/parsoid
9965 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
9966 !! end
9967
9968 !! test
9969 Template with argument in separate line
9970 !! wikitext
9971 {{ templateasargtest |
9972 templ = simple }}
9973 !! html
9974 <p>(test)
9975 </p>
9976 !! end
9977
9978 !! test
9979 Template with complex template as argument
9980 !! wikitext
9981 {{paramtest|
9982 param ={{ templateasargtest |
9983 templ = simple }}}}
9984 !! html
9985 <p>This is a test template with parameter (test)
9986 </p>
9987 !! end
9988
9989 !! test
9990 Template with thumb image (with link in description)
9991 !! wikitext
9992 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9993 !! html/php
9994 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>
9995
9996 !! html+tidy
9997 <p>This is a test template with parameter</p>
9998 <div class="thumb tright">
9999 <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>
10000 <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>
10001 </div>
10002 </div>
10003 !! html/parsoid
10004 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10005 !! end
10006
10007 !! article
10008 Template:complextemplate
10009 !! text
10010 {{{1}}} {{paramtest|
10011 param ={{{param}}}}}
10012 !! endarticle
10013
10014 !! test
10015 Template with complex arguments
10016 !! wikitext
10017 {{complextemplate|
10018 param ={{ templateasargtest |
10019 templ = simple }}|[[Template:complextemplate|link]]}}
10020 !! html
10021 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10022 </p>
10023 !! end
10024
10025 !! test
10026 BUG 553: link with two variables in a piped link
10027 !! wikitext
10028 {|
10029 |[[{{{1}}}|{{{2}}}]]
10030 |}
10031 !! html
10032 <table>
10033 <tr>
10034 <td>[[{{{1}}}|{{{2}}}]]
10035 </td></tr></table>
10036
10037 !! end
10038
10039 !! test
10040 Magic variable as template parameter
10041 !! wikitext
10042 {{paramtest|param={{SITENAME}}}}
10043 !! html
10044 <p>This is a test template with parameter MediaWiki
10045 </p>
10046 !! end
10047
10048 !! article
10049 Template:linktest
10050 !! text
10051 [[{{{param}}}|link]]
10052 !! endarticle
10053
10054 !! test
10055 Template parameter as link source
10056 !! wikitext
10057 {{linktest|param=Main Page}}
10058 !! html
10059 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10060 </p>
10061 !! end
10062
10063 !!article
10064 Template:paramtest2
10065 !! text
10066 including another template, {{paramtest|param={{{arg}}}}}
10067 !! endarticle
10068
10069 !! test
10070 Template passing argument to another template
10071 !! wikitext
10072 {{paramtest2|arg='hmm'}}
10073 !! html
10074 <p>including another template, This is a test template with parameter 'hmm'
10075 </p>
10076 !! end
10077
10078 !! article
10079 Template:Linktest2
10080 !! text
10081 Main Page
10082 !! endarticle
10083
10084 !! test
10085 Template as link source
10086 !! wikitext
10087 [[{{linktest2}}]]
10088
10089 [[{{linktest2}}|Main Page]]
10090
10091 [[{{linktest2}}]]Page
10092 !! html
10093 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10094 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10095 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10096 </p>
10097 !! end
10098
10099
10100 !! article
10101 Template:loop1
10102 !! text
10103 {{loop2}}
10104 !! endarticle
10105
10106 !! article
10107 Template:loop2
10108 !! text
10109 {{loop1}}
10110 !! endarticle
10111
10112 !! test
10113 Template infinite loop
10114 !! wikitext
10115 {{loop1}}
10116 !! html
10117 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10118 </p>
10119 !! end
10120
10121 !! test
10122 Template from main namespace
10123 !! wikitext
10124 {{:Main Page}}
10125 !! html
10126 <p>blah blah
10127 </p>
10128 !! end
10129
10130 !! article
10131 Template:table
10132 !! text
10133 {|
10134 | 1 || 2
10135 |-
10136 | 3 || 4
10137 |}
10138 !! endarticle
10139
10140 !! test
10141 BUG 529: Template with table, not included at beginning of line
10142 !! wikitext
10143 foo {{table}}
10144 !! html
10145 <p>foo
10146 </p>
10147 <table>
10148 <tr>
10149 <td> 1 </td>
10150 <td> 2
10151 </td></tr>
10152 <tr>
10153 <td> 3 </td>
10154 <td> 4
10155 </td></tr></table>
10156
10157 !! end
10158
10159 !! test
10160 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10161 !! wikitext
10162 foo
10163 {{table}}
10164 !! html
10165 <p>foo
10166 </p>
10167 <table>
10168 <tr>
10169 <td> 1 </td>
10170 <td> 2
10171 </td></tr>
10172 <tr>
10173 <td> 3 </td>
10174 <td> 4
10175 </td></tr></table>
10176
10177 !! end
10178
10179 !! test
10180 BUG 41: Template parameters shown as broken links
10181 !! wikitext
10182 {{{parameter}}}
10183 !! html
10184 <p>{{{parameter}}}
10185 </p>
10186 !! end
10187
10188 !! test
10189 Template with targets containing wikilinks
10190 !! wikitext
10191 {{[[foo]]}}
10192
10193 {{[[{{echo|foo}}]]}}
10194
10195 {{{{echo|[[foo}}]]}}
10196 !! html
10197 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10198 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10199 </p><p>{{[[foo}}]]
10200 </p>
10201 !! end
10202
10203 !! article
10204 Template:''
10205 !! text
10206 bar
10207 !! endarticle
10208
10209 !! test
10210 Templates: Double quotes as template target
10211 !! wikitext
10212 foo {{''}} baz
10213 !! html/php
10214 <p>foo bar baz
10215 </p>
10216 !! html/parsoid
10217 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10218 </p>
10219 !! end
10220
10221 !! article
10222 Template:MSGNW test
10223 !! text
10224 ''None'' of '''this''' should be
10225 * interpreted
10226 but rather passed unmodified
10227 {{test}}
10228 <gallery>
10229 File:Foobar.jpg
10230 </gallery>
10231 !! endarticle
10232
10233 # hmm, fix this or just deprecate msgnw and document its behavior?
10234 !! test
10235 msgnw keyword
10236 !! wikitext
10237 {{msgnw:MSGNW test}}
10238 !! html
10239 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10240 &#42; interpreted
10241 &#32;but rather passed unmodified
10242 &#123;&#123;test&#125;&#125;
10243 &#60;gallery&#62;
10244 File:Foobar.jpg
10245 &#60;/gallery&#62;
10246 </p>
10247 !! end
10248
10249 !! test
10250 int keyword
10251 !! wikitext
10252 {{int:youhavenewmessages|lots of money|not!}}
10253 !! html
10254 <p>You have lots of money (not!).
10255 </p>
10256 !! end
10257
10258 !! article
10259 Template:Includes
10260 !! text
10261 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10262 !! endarticle
10263
10264 !! test
10265 <includeonly> and <noinclude> being included
10266 !! wikitext
10267 {{Includes}}
10268 !! html
10269 <p>Foobar
10270 </p>
10271 !! end
10272
10273 !! article
10274 Template:Includes2
10275 !! text
10276 <onlyinclude>Foo</onlyinclude>bar
10277 !! endarticle
10278
10279 !! test
10280 <onlyinclude> being included
10281 !! wikitext
10282 {{Includes2}}
10283 !! html
10284 <p>Foo
10285 </p>
10286 !! end
10287
10288
10289 !! article
10290 Template:Includes3
10291 !! text
10292 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10293 !! endarticle
10294
10295 !! test
10296 <onlyinclude> and <includeonly> being included
10297 !! wikitext
10298 {{Includes3}}
10299 !! html
10300 <p>Foo
10301 </p>
10302 !! end
10303
10304 !! test
10305 <includeonly> and <noinclude> on a page
10306 !! wikitext
10307 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10308 !! html
10309 <p>Foozar
10310 </p>
10311 !! end
10312
10313 !! test
10314 Un-closed <noinclude>
10315 !! wikitext
10316 <noinclude>
10317 !! html
10318 !! end
10319
10320 !! test
10321 <onlyinclude> on a page
10322 !! wikitext
10323 <onlyinclude>Foo</onlyinclude>bar
10324 !! html
10325 <p>Foobar
10326 </p>
10327 !! end
10328
10329 !! test
10330 Un-closed <onlyinclude>
10331 !! wikitext
10332 <onlyinclude>
10333 !! html
10334 !! end
10335
10336 !!test
10337 Self-closed noinclude, includeonly, onlyinclude tags
10338 !! wikitext
10339 <noinclude />
10340 <includeonly />
10341 <onlyinclude />
10342 !! html
10343 <p><br />
10344 </p>
10345 !!end
10346
10347 !!test
10348 Unbalanced includeonly and noinclude tags
10349 !! wikitext
10350 {|
10351 |a</noinclude>
10352 |b</noinclude></noinclude>
10353 |c</noinclude></includeonly>
10354 |d</includeonly></includeonly>
10355 |}
10356 !! html
10357 <table>
10358 <tr>
10359 <td>a
10360 </td>
10361 <td>b
10362 </td>
10363 <td>c&lt;/includeonly&gt;
10364 </td>
10365 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10366 </td></tr></table>
10367
10368 !!end
10369
10370 !! article
10371 Template:Includeonly section
10372 !! text
10373 <includeonly>
10374 ==Includeonly section==
10375 </includeonly>
10376 ==Section T-1==
10377 !!endarticle
10378
10379 !! test
10380 Bug 6563: Edit link generation for section shown by <includeonly>
10381 !! wikitext
10382 {{includeonly section}}
10383 !! html
10384 <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>
10385 <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>
10386
10387 !! end
10388
10389 # Uses same input as the contents of [[Template:Includeonly section]]
10390 !! test
10391 Bug 6563: Section extraction for section shown by <includeonly>
10392 !! options
10393 section=T-2
10394 !! wikitext
10395 <includeonly>
10396 ==Includeonly section==
10397 </includeonly>
10398 ==Section T-2==
10399 !! html
10400 ==Section T-2==
10401 !! end
10402
10403 !! test
10404 Bug 6563: Edit link generation for section suppressed by <includeonly>
10405 !! wikitext
10406 <includeonly>
10407 ==Includeonly section==
10408 </includeonly>
10409 ==Section 1==
10410 !! html
10411 <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>
10412
10413 !! end
10414
10415 !! test
10416 Bug 6563: Section extraction for section suppressed by <includeonly>
10417 !! options
10418 section=1
10419 !! wikitext
10420 <includeonly>
10421 ==Includeonly section==
10422 </includeonly>
10423 ==Section 1==
10424 !! html
10425 ==Section 1==
10426 !! end
10427
10428 !! test
10429 Un-closed <includeonly>
10430 !! wikitext
10431 <includeonly>
10432 !! html
10433 !! end
10434
10435 !! test
10436 Includes and comments at SOL
10437 !! wikitext
10438 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10439
10440 <noinclude>
10441 some
10442 </noinclude>* stuff
10443 * here
10444
10445 <includeonly>can have stuff</includeonly>=== here ===
10446
10447 !! html/php
10448 <h2><span class="mw-headline" id="hu">hu</span></h2>
10449 <p>some
10450 </p>
10451 <ul><li> stuff</li>
10452 <li> here</li></ul>
10453 <h3><span class="mw-headline" id="here">here</span></h3>
10454
10455 !! html/parsoid
10456 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
10457
10458 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10459 <p>some</p>
10460 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10461 <li> here</li></ul>
10462
10463 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
10464
10465 !! end
10466
10467 # TODO: test with DOM fragment reuse!
10468 !! test
10469 Parsoid: DOM fragment reuse
10470 !! options
10471 parsoid=wt2wt,wt2html
10472 !! wikitext
10473 a{{echo|b<table></table>c}}d
10474
10475 a{{echo|b
10476 <table></table>
10477 c}}d
10478
10479 {{echo|a
10480
10481 <table></table>
10482
10483 b}}
10484 !! html
10485 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10486
10487 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10488 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10489 </span><p about="#mwt2">cd</p>
10490
10491 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10492
10493 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10494
10495 </span><p about="#mwt3">b</p>
10496 !! end
10497
10498 !! test
10499 Parsoid: Merge double tds (bug 50603)
10500 !! options
10501 parsoid
10502 !! wikitext
10503 {|
10504 |{{echo|{{!}} foo}}
10505 |}
10506 !! html
10507 <table><tbody>
10508 <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>
10509 </tbody></table>
10510 !! end
10511
10512 !! test
10513 Parsoid: Merge double tds in nested transclusion content (bug 50603)
10514 !! options
10515 parsoid
10516 !! wikitext
10517 {{echo|<div>}}
10518 {|
10519 |{{echo|{{!}} foo}}
10520 |}
10521 {{echo|</div>}}
10522 !! html
10523 <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}}]}'>
10524 <table><tbody>
10525 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10526 </tbody></table>
10527 </div>
10528 !! end
10529
10530 ###
10531 ### <includeonly> and <noinclude> in attributes
10532 ###
10533 !!test
10534 0. includeonly around the entire attribute
10535 !! wikitext
10536 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10537 !! html
10538 <p><span id="v2">bar</span>
10539 </p>
10540 !!end
10541
10542 !!test
10543 1. includeonly in html attr key
10544 !! wikitext
10545 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10546 !! html
10547 <p><span id="foo">bar</span>
10548 </p>
10549 !!end
10550
10551 !!test
10552 2. includeonly in html attr value
10553 !! wikitext
10554 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10555 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10556 !! html
10557 <p><span id="v1">bar</span>
10558 <span id="v1">bar</span>
10559 </p>
10560 !!end
10561
10562 !!test
10563 3. includeonly in part of an attr value
10564 !! wikitext
10565 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10566 !! html
10567 <p><span style="color:red;">bar</span>
10568 </p>
10569 !!end
10570
10571 !!test
10572 4. includeonly in table attributes
10573 !! wikitext
10574 {|
10575 |- <noinclude>
10576 |-
10577 |a
10578 </noinclude>
10579 |- <includeonly>
10580 |-
10581 |b
10582 </includeonly>
10583 |}
10584 !! html
10585 <table>
10586
10587
10588 <tr>
10589 <td>a
10590 </td></tr>
10591 </table>
10592
10593 !!end
10594
10595 ###
10596 ### Token Stream Patcher tests
10597 ###
10598 ### These tests won't always pass wt2wt and other modes because
10599 ### on serialization, the table will be output on a new line.
10600 ### For now, we are blacklisting them, and using this to test selser.
10601 ###
10602
10603 !!test
10604 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10605 !!options
10606 parsoid=wt2html,wt2wt
10607 !!wikitext
10608 {{echo|}}{| width = '100%'
10609 |foo
10610 |}
10611 !!html/parsoid
10612 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10613 <tbody><tr><td>foo</td></tr>
10614 </tbody></table>
10615 !!end
10616
10617 !!test
10618 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10619 !!options
10620 parsoid=wt2html,wt2wt
10621 !!wikitext
10622 <includeonly>a</includeonly>{| {{{b}}}
10623 |c
10624 |}
10625 !!html/parsoid
10626 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10627 <tbody><tr><td>c</td></tr>
10628 </tbody></table>
10629
10630 !!end
10631
10632 ###
10633 ### Testing parsing of templates where a template arg
10634 ### has the same name as the template itself.
10635 ###
10636
10637 !! article
10638 Template:quote
10639 !! text
10640 {{{quote|{{{1}}}}}}
10641 !! endarticle
10642
10643 !!test
10644 Templates: Template Name/Arg clash: 1. Use of positional param
10645 !! wikitext
10646 {{quote|foo}}
10647 !! html
10648 <p>foo
10649 </p>
10650 !!end
10651
10652 !!test
10653 Templates: Template Name/Arg clash: 2. Use of named param
10654 !! wikitext
10655 {{quote|quote=foo}}
10656 !! html
10657 <p>foo
10658 </p>
10659 !!end
10660
10661 !!test
10662 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10663 !! wikitext
10664 {{quote|quote}}
10665 !! html
10666 <p>quote
10667 </p>
10668 !!end
10669
10670 ###
10671 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10672 ###
10673
10674 !!test
10675 Templates: 1. Simple use
10676 !! wikitext
10677 {{echo|Foo}}
10678 !! html
10679 <p>Foo
10680 </p>
10681 !!end
10682
10683 !!test
10684 Templates: 2. Inside a block tag
10685 !! wikitext
10686 <div>{{echo|Foo}}</div>
10687 <blockquote>{{echo|Foo}}</blockquote>
10688 !! html
10689 <div>Foo</div>
10690 <blockquote>Foo</blockquote>
10691
10692 !! html+tidy
10693 <div>Foo</div>
10694 <blockquote>
10695 <p>Foo</p>
10696 </blockquote>
10697 !!end
10698
10699 !!test
10700 Templates: P-wrapping: 1a. Templates on consecutive lines
10701 !! wikitext
10702 {{echo|Foo}}
10703 {{echo|bar}}
10704 !! html
10705 <p>Foo
10706 bar
10707 </p>
10708 !!end
10709
10710 !!test
10711 Templates: P-wrapping: 1b. Templates on consecutive lines
10712 !! wikitext
10713 Foo
10714
10715 {{echo|bar}}
10716 {{echo|baz}}
10717 !! html
10718 <p>Foo
10719 </p><p>bar
10720 baz
10721 </p>
10722 !!end
10723
10724 !!test
10725 Templates: P-wrapping: 1c. Templates on consecutive lines
10726 !! wikitext
10727 {{echo|Foo}}
10728 {{echo|bar}} <div>baz</div>
10729 !! html
10730 <p>Foo
10731 </p>
10732 bar <div>baz</div>
10733
10734 !! html+tidy
10735 <p>Foo</p>
10736 <p>bar</p>
10737 <div>baz</div>
10738 !! end
10739
10740 !!test
10741 Templates: P-wrapping: 1d. Template preceded by comment-only line
10742 !!options
10743 parsoid
10744 !! wikitext
10745 <!-- foo -->
10746 {{echo|Bar}}
10747 !! html
10748 <!-- foo -->
10749
10750 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10751 !!end
10752
10753 !!test
10754 Templates: Inline Text: 1. Multiple template uses
10755 !! wikitext
10756 {{echo|Foo}}bar{{echo|baz}}
10757 !! html
10758 <p>Foobarbaz
10759 </p>
10760 !!end
10761
10762 !!test
10763 Templates: Inline Text: 2. Back-to-back template uses
10764 !! wikitext
10765 {{echo|Foo}}{{echo|bar}}
10766 !! html
10767 <p>Foobar
10768 </p>
10769 !!end
10770
10771 !!test
10772 Templates: Block Tags: 1. Multiple template uses
10773 !! wikitext
10774 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10775 !! html
10776 <div>Foo</div><div>bar</div><div>baz</div>
10777
10778 !!end
10779
10780 !!test
10781 Templates: Block Tags: 2. Back-to-back template uses
10782 !! wikitext
10783 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10784 !! html
10785 <div>Foo</div><div>bar</div>
10786
10787 !!end
10788
10789 # This is an edge case relating to paragraph wrapping.
10790 !!test
10791 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10792 !! wikitext
10793 {{echo|a
10794 b</p>}}
10795 !! html/parsoid
10796 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
10797 b</p>
10798 !!end
10799
10800 !!test
10801 Templates: Links: 1. Simple example
10802 !! wikitext
10803 {{echo|[[Foo|bar]]}}
10804 !! html
10805 <p><a href="/wiki/Foo" title="Foo">bar</a>
10806 </p>
10807 !!end
10808
10809 !!test
10810 Templates: Links: 2. Generation of link href
10811 !! wikitext
10812 [[{{echo|Foo}}|bar]]
10813 !! html
10814 <p><a href="/wiki/Foo" title="Foo">bar</a>
10815 </p>
10816 !!end
10817
10818 !!test
10819 Templates: Links: 3. Generation of part of a link href
10820 !! wikitext
10821 [[Fo{{echo|o}}|bar]]
10822
10823 [[Foo{{echo|bar}}]]
10824
10825 [[Foo{{echo|bar}}baz]]
10826
10827 [[Foo{{echo|bar}}|bar]]
10828
10829 [[:Foo{{echo|bar}}]]
10830
10831 [[:Foo{{echo|bar}}|bar]]
10832 !! html
10833 <p><a href="/wiki/Foo" title="Foo">bar</a>
10834 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10835 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10836 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10837 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10838 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10839 </p>
10840 !!end
10841
10842 !!test
10843 Templates: Links: 4. Multiple templates generating link href
10844 !! wikitext
10845 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10846 !! html
10847 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10848 </p>
10849 !!end
10850
10851 !!test
10852 Templates: Links: 5. Generation of link text
10853 !! wikitext
10854 [[Foo|{{echo|bar}}]]
10855 !! html
10856 <p><a href="/wiki/Foo" title="Foo">bar</a>
10857 </p>
10858 !!end
10859
10860 !!test
10861 Templates: Links: 5. Nested templates (only outermost template should be marked)
10862 !! wikitext
10863 {{echo|[[{{echo|Foo}}|bar]]}}
10864 !! html
10865 <p><a href="/wiki/Foo" title="Foo">bar</a>
10866 </p>
10867 !!end
10868
10869 !!test
10870 Templates: HTML Tag: 1. Generation of HTML attr. key
10871 !! wikitext
10872 <div {{echo|style}}="color:red;">foo</div>
10873 !! html
10874 <div style="color:red;">foo</div>
10875
10876 !!end
10877
10878 !!test
10879 Templates: HTML Tag: 2. Generation of HTML attr. value
10880 !! wikitext
10881 <div style={{echo|'color:red;'}}>foo</div>
10882 !! html
10883 <div style="color:red;">foo</div>
10884
10885 !!end
10886
10887 !!test
10888 Templates: HTML Tag: 3. Generation of HTML attr key and value
10889 !! wikitext
10890 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10891 !! html
10892 <div style="color:red;">foo</div>
10893
10894 !!end
10895
10896 !!test
10897 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10898 !! wikitext
10899 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10900 !! html
10901 <div title="This is a long title with just one piece templated">foo</div>
10902
10903 !!end
10904
10905 !!test
10906 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10907 !! wikitext
10908 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10909 !! html
10910 <div title="This is a long title with just one piece templated">foo</div>
10911
10912 !!end
10913
10914 !!test
10915 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10916 !! wikitext
10917 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10918 !! html
10919 <div title="This is a long title with just one piece templated">foo</div>
10920
10921 !!end
10922
10923 # SSS FIXME: While it is great we added support for all this,
10924 # do we want to make this part of the spec? Maybe we want to
10925 # deprecate this kind of usage in the future?
10926 !!test
10927 Templates: HTML Tag: 7. Generation of partial attribute key string
10928 !! wikitext
10929 <div st{{echo|yle}}="color:red;">foo</div>
10930 !! html
10931 <div style="color:red;">foo</div>
10932
10933 !!end
10934
10935 !! test
10936 Templates: HTML Tag: 8. Template-generated attribute (k=v)
10937 !! wikitext
10938 <div {{echo|1=id="v1"}}>bar</div>
10939 !! html
10940 <div id="v1">bar</div>
10941
10942 !!end
10943
10944 !! test
10945 Templates: HTML Tag: 9. Multiple template-generated attributes
10946 !! wikitext
10947 <div {{echo|1=id="v1" title="foo"}}>bar</div>
10948 !! html
10949 <div id="v1" title="foo">bar</div>
10950
10951 !!end
10952
10953 !! test
10954 Templates: Support for templates generating attributes and content
10955 !! wikitext
10956 {| {{mixed_attr_content_template}}
10957 |-
10958 |bar
10959 |}
10960 !! html/php
10961 <table style="color:red;" title="T48811">
10962
10963 <tr>
10964 <td>foo
10965 </td></tr>
10966 <tr>
10967 <td>bar
10968 </td></tr></table>
10969
10970 !! html/parsoid
10971 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
10972 <tbody><tr>
10973 <td>foo</td></tr>
10974 <tr>
10975 <td>bar</td></tr>
10976 </tbody></table>
10977 !!end
10978
10979 !! test
10980 1. Entities and nowikis inside templated attributes should be handled correctly
10981 !! wikitext
10982 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
10983 !! html/php
10984 <div style="background:#f9f9f9;">foo</div>
10985
10986 !! html/parsoid
10987 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
10988 !! end
10989
10990 !! test
10991 2. Entities and nowikis inside templated attributes should be handled correctly
10992 !! wikitext
10993 {|
10994 |{{table_attribs_3}}
10995 |}
10996 !! html/php
10997 <table>
10998 <tr>
10999 <td style="background:#f9f9f9;">Foo
11000 </td></tr></table>
11001
11002 !! html/parsoid
11003 <table>
11004 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
11005 </tbody></table>
11006 !! end
11007
11008 !! test
11009 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11010 !! wikitext
11011 {{tbl-start}}
11012 |{{table_attribs_3}}
11013 {{tbl-end}}
11014 !! html/php
11015 <table>
11016 <tr>
11017 <td style="background:#f9f9f9;">Foo
11018 </td></tr></table>
11019
11020 !! html/parsoid
11021 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
11022 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11023 </tbody></table>
11024 !! end
11025
11026 !!test
11027 Templates: HTML Tables: 1. Generating start of a HTML table
11028 !! wikitext
11029 {{echo|<table><tr><td>foo</td>}}</tr></table>
11030 !! html
11031 <table><tr><td>foo</td></tr></table>
11032
11033 !!end
11034
11035 !!test
11036 Templates: HTML Tables: 2a. Generating middle of a HTML table
11037 !! wikitext
11038 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11039 !! html
11040 <table><tr><td>foo</td></tr></table>
11041
11042 !!end
11043
11044 !!test
11045 Templates: HTML Tables: 2b. Generating middle of a HTML table
11046 !! wikitext
11047 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11048 !! html
11049 <table><tr><td>foo</td></tr></table>
11050
11051 !!end
11052
11053 !!test
11054 Templates: HTML Tables: 3. Generating end of a HTML table
11055 !! wikitext
11056 <table><tr>{{echo|<td>foo</td></tr></table>}}
11057 !! html
11058 <table><tr><td>foo</td></tr></table>
11059
11060 !!end
11061
11062 !!test
11063 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11064 !! wikitext
11065 {{echo|<table>}}<tr><td>foo</td></tr></table>
11066 !! html
11067 <table><tr><td>foo</td></tr></table>
11068
11069 !!end
11070
11071 !!test
11072 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11073 !! wikitext
11074 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11075 !! html
11076 <table><tr><td>foo</td></tr></table>
11077
11078 !!end
11079
11080 !!test
11081 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11082 !! wikitext
11083 <table><tr>{{echo|<td>}}foo</td></tr></table>
11084 !! html
11085 <table><tr><td>foo</td></tr></table>
11086
11087 !!end
11088
11089 !!test
11090 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11091 !! wikitext
11092 <table><tr><td>foo{{echo|</td>}}</tr></table>
11093 !! html
11094 <table><tr><td>foo</td></tr></table>
11095
11096 !!end
11097
11098 !!test
11099 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11100 !! wikitext
11101 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11102 !! html
11103 <table><tr><td>foo</td></tr></table>
11104
11105 !!end
11106
11107 !!test
11108 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11109 !! wikitext
11110 <table><tr><td>foo</td></tr>{{echo|</table>}}
11111 !! html
11112 <table><tr><td>foo</td></tr></table>
11113
11114 !!end
11115
11116 !!test
11117 Templates: HTML Tables: 5. Proper fostering of categories from inside
11118 !!options
11119 parsoid=wt2html,wt2wt
11120 !! wikitext
11121 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11122 <!--Two categories (Bug 50330)-->
11123 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11124 !! html
11125 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11126 <!--Two categories (Bug 50330)-->
11127 <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>
11128 !!end
11129
11130 !!test
11131 Templates: Wiki Tables: 1a. Fostering of entire template content
11132 !! wikitext
11133 {|
11134 {{echo|a}}
11135 |}
11136 !! html
11137 <table>
11138 a
11139 <tr><td></td></tr></table>
11140
11141 !! html+tidy
11142 <p>a</p>
11143 <table>
11144 <tr>
11145 <td></td>
11146 </tr>
11147 </table>
11148 !! end
11149
11150 !!test
11151 Templates: Wiki Tables: 1b. Fostering of entire template content
11152 !! wikitext
11153 {|
11154 {{echo|<div>}}
11155 foo
11156 {{echo|</div>}}
11157 |}
11158 !! html
11159 <table>
11160 <div>
11161 <p>foo
11162 </p>
11163 </div>
11164 <tr><td></td></tr></table>
11165
11166 !! html+tidy
11167 <div>
11168 <p>foo</p>
11169 </div>
11170 <table>
11171 <tr>
11172 <td></td>
11173 </tr>
11174 </table>
11175 !! end
11176
11177 !!test
11178 Templates: Wiki Tables: 2. Fostering of partial template content
11179 !! wikitext
11180 {|
11181 {{echo|a
11182 <div>b</div>}}
11183 |}
11184 !! html
11185 <table>
11186 a
11187 <div>b</div>
11188 <tr><td></td></tr></table>
11189
11190 !! html+tidy
11191 <p>a</p>
11192 <div>b</div>
11193 <table>
11194 <tr>
11195 <td></td>
11196 </tr>
11197 </table>
11198 !! end
11199
11200 !!test
11201 Templates: Wiki Tables: 3. td-content via multiple templates
11202 !! wikitext
11203 {|
11204 {{echo|{{pipe}}a}}{{echo|b}}
11205 |}
11206 !! html
11207 <table>
11208 <tr>
11209 <td>ab
11210 </td></tr></table>
11211
11212 !!end
11213
11214 !!test
11215 Templates: Wiki Tables: 4. Templated tags, no content
11216 !! wikitext
11217 {{tbl-start}}
11218 {{tbl-end}}
11219 !! html
11220 <table>
11221 <tr><td></td></tr></table>
11222
11223 !!end
11224
11225 !!test
11226 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11227 !! wikitext
11228 {{tbl-start}}
11229 |foo
11230 {{tbl-end}}
11231 !! html
11232 <table>
11233 <tr>
11234 <td>foo
11235 </td></tr></table>
11236
11237 !!end
11238
11239 !!test
11240 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11241 !! wikitext
11242 {{tbl-start}}
11243 {{!}}foo
11244 {{tbl-end}}
11245 !! html
11246 <table>
11247 <tr>
11248 <td>foo
11249 </td></tr></table>
11250
11251 !!end
11252
11253 ## This test case is very specific to Parsoid's internals
11254 ## and is hence only tested for Parsoid's code. Parsoid uses
11255 ## a <meta> marker tag for <ref> tags and they are expanded
11256 ## much later. We are verifying that this <meta> tag usage
11257 ## doesn't prevent foster parenting.
11258 !!test
11259 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11260 !!wikitext
11261 {{PartialTable}}<ref>foo</ref>
11262 |}
11263
11264 <references />
11265 !!html/parsoid
11266 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
11267 <tbody>
11268 </tbody></table>
11269
11270 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
11271 !!end
11272
11273 !! test
11274 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11275 !! wikitext
11276 {{echo|
11277 {{{!}}
11278 {{!}}-}}
11279 <onlyinclude>
11280 |foo
11281 </onlyinclude>
11282 {{!}}}
11283 !! html/parsoid
11284 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
11285 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11286 <tbody><tr>
11287
11288 <td>foo
11289 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11290 </tbody></table>
11291 !! end
11292
11293 !!test
11294 Templates: Lists: Multi-line list-items via templates
11295 !! wikitext
11296 *{{echo|a {{nonexistent|
11297 unused}}}}
11298 *{{echo|b {{nonexistent|
11299 unused}}}}
11300 !! html
11301 <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>
11302 <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>
11303
11304 !!end
11305
11306 !!test
11307 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11308 !! wikitext
11309 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11310 !! html
11311 <p><i>ab</i>c<i>d</i>e
11312 </p>
11313 !!end
11314
11315 !!test
11316 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11317 (PHP parser generates misnested html)
11318 !! wikitext
11319 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11320 !! html/parsoid
11321 <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>
11322 !!end
11323
11324 !!test
11325 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11326 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11327 !! options
11328 parsoid=wt2html,wt2wt
11329 !! wikitext
11330 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11331 !! html
11332 <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>
11333 <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>
11334 <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>
11335 !!end
11336
11337 !!test
11338 Templates: Ugly nesting: 4. Divs opened/closed across templates
11339 !! wikitext
11340 a<div>b{{echo|c</div>d}}e
11341 !! html
11342 a<div>bc</div>de
11343
11344 !! html+tidy
11345 <p>a</p>
11346 <div>bc</div>
11347 <p>de</p>
11348 !! end
11349
11350 !!test
11351 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11352 (Parsoid-centric)
11353 !! options
11354 parsoid
11355 !! wikitext
11356 {|
11357 |{{echo|foo</table>}}
11358 |bar
11359 |}
11360 !! html
11361 <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|}"]}'>
11362
11363 <tbody>
11364 <tr>
11365 <td>foo</td></tr></tbody></table><span about="#mwt1">
11366 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11367 |}</span>
11368 !!end
11369
11370 !!test
11371 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11372 (Parsoid-centric)
11373 !! options
11374 parsoid
11375 !! wikitext
11376 <table>
11377 <tr>
11378 <td>
11379 <table>
11380 <tr>
11381 <td>1. {{echo|foo </table>}}</td>
11382 <td> bar </td>
11383 <td>2. {{echo|baz </table>}}</td>
11384 </tr>
11385 <tr>
11386 <td>abc</td>
11387 </tr>
11388 </table>
11389 </td>
11390 </tr>
11391 <tr>
11392 <td>xyz</td>
11393 </tr>
11394 </table>
11395 !! html
11396 <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>"]}'>
11397 <tbody><tr>
11398 <td>
11399 <table>
11400 <tbody><tr>
11401 <td>1. foo </td></tr></tbody></table></td>
11402 <td> bar </td>
11403 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11404 </span><span about="#mwt2">
11405 </span><span about="#mwt2">
11406 </span><span about="#mwt2">abc</span><span about="#mwt2">
11407 </span><span about="#mwt2">
11408 </span><span about="#mwt2">
11409 </span><span about="#mwt2">
11410 </span><span about="#mwt2">
11411 </span><span about="#mwt2">
11412 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11413 </span><span about="#mwt2">
11414 </span>
11415 !!end
11416
11417 !! test
11418 Templates: Ugly templates: 3. newline-only template parameter
11419 !! wikitext
11420 foo {{echo|
11421 }}
11422 !! html
11423 <p>foo
11424 </p>
11425 !! end
11426
11427 # This looks like a bug: a single newline triggers p/br for some reason.
11428 !! test
11429 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11430 !! wikitext
11431 {{echo|
11432 }}
11433 !! html
11434 <p><br />
11435 </p>
11436 !! end
11437
11438 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11439 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11440 !! test
11441 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11442 !! wikitext
11443 {{echo|<table>}}
11444 {{echo|<div>foo}}
11445 {{echo|</table>}}
11446 !! html/parsoid
11447 <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
11448 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11449 </table>
11450 !! end
11451
11452 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11453 # that are "identical" and generate nesting cycles in the algorithm
11454 !! test
11455 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11456 !! wikitext
11457 {{echo|<table><tr><td><table>}}
11458 {{echo|<div>}}
11459 {{echo|</div>}}
11460 !! html/parsoid
11461 <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"}'>
11462 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11463 </table></td></tr></tbody></table>
11464 !! end
11465
11466 !!test
11467 Parser Functions: 1. Simple example
11468 !! wikitext
11469 {{uc:foo}}
11470 !! html
11471 <p>FOO
11472 </p>
11473 !!end
11474
11475 !!test
11476 Parser Functions: 2. Nested use (only outermost should be marked up)
11477 !! wikitext
11478 {{uc:{{lc:FOO}}}}
11479 !! html
11480 <p>FOO
11481 </p>
11482 !!end
11483
11484 ###
11485 ### Pre-save transform tests
11486 ###
11487 !! test
11488 pre-save transform: subst:
11489 !! options
11490 PST
11491 !! wikitext
11492 {{subst:test}}
11493 !! html
11494 This is a test template
11495 !! end
11496
11497 !! test
11498 pre-save transform: normal template
11499 !! options
11500 PST
11501 !! wikitext
11502 {{test}}
11503 !! html
11504 {{test}}
11505 !! end
11506
11507 !! test
11508 pre-save transform: nonexistent template
11509 !! options
11510 PST
11511 !! wikitext
11512 {{thistemplatedoesnotexist}}
11513 !! html
11514 {{thistemplatedoesnotexist}}
11515 !! end
11516
11517
11518 !! test
11519 pre-save transform: subst magic variables
11520 !! options
11521 PST
11522 !! wikitext
11523 {{subst:SITENAME}}
11524 !! html
11525 MediaWiki
11526 !! end
11527
11528 # This is bug 89, which I fixed. -- wtm
11529 !! test
11530 pre-save transform: subst: templates with parameters
11531 !! options
11532 pst
11533 !! wikitext
11534 {{subst:paramtest|param="something else"}}
11535 !! html
11536 This is a test template with parameter "something else"
11537 !! end
11538
11539 !! article
11540 Template:nowikitest
11541 !! text
11542 <nowiki>'''not wiki'''</nowiki>
11543 !! endarticle
11544
11545 !! test
11546 pre-save transform: nowiki in subst (bug 1188)
11547 !! options
11548 pst
11549 !! wikitext
11550 {{subst:nowikitest}}
11551 !! html
11552 <nowiki>'''not wiki'''</nowiki>
11553 !! end
11554
11555
11556 !! article
11557 Template:commenttest
11558 !! text
11559 This template has <!-- a comment --> in it.
11560 !! endarticle
11561
11562 !! test
11563 pre-save transform: comment in subst (bug 1936)
11564 !! options
11565 pst
11566 !! wikitext
11567 {{subst:commenttest}}
11568 !! html
11569 This template has <!-- a comment --> in it.
11570 !! end
11571
11572 !! test
11573 pre-save transform: unclosed tag
11574 !! options
11575 pst noxml
11576 !! wikitext
11577 <nowiki>'''not wiki'''
11578 !! html
11579 <nowiki>'''not wiki'''
11580 !! end
11581
11582 !! test
11583 pre-save transform: mixed tag case
11584 !! options
11585 pst noxml
11586 !! wikitext
11587 <NOwiki>'''not wiki'''</noWIKI>
11588 !! html
11589 <NOwiki>'''not wiki'''</noWIKI>
11590 !! end
11591
11592 !! test
11593 pre-save transform: unclosed comment in <nowiki>
11594 !! options
11595 pst noxml
11596 !! wikitext
11597 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11598 !! html
11599 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11600 !!end
11601
11602 # Leading @ in this template definition works around a limitation
11603 # in parsoid's parserTests which otherwise strips the <span> from the
11604 # result (confusing it for a template wrapper)
11605 !! article
11606 Template:dangerous
11607 !!text
11608 @<span onmouseover="alert('crap')">Oh no</span>
11609 !!endarticle
11610
11611 !!test
11612 (confirming safety of fix for subst bug 1936)
11613 !! wikitext
11614 {{Template:dangerous}}
11615 !! html
11616 <p>@<span>Oh no</span>
11617 </p>
11618 !! end
11619
11620 !! test
11621 pre-save transform: comment containing gallery (bug 5024)
11622 !! options
11623 pst
11624 !! wikitext
11625 <!-- <gallery>data</gallery> -->
11626 !! html
11627 <!-- <gallery>data</gallery> -->
11628 !!end
11629
11630 !! test
11631 pre-save transform: comment containing extension
11632 !! options
11633 pst
11634 !! wikitext
11635 <!-- <tag>data</tag> -->
11636 !! html
11637 <!-- <tag>data</tag> -->
11638 !!end
11639
11640 !! test
11641 pre-save transform: comment containing nowiki
11642 !! options
11643 pst
11644 !! wikitext
11645 <!-- <nowiki>data</nowiki> -->
11646 !! html
11647 <!-- <nowiki>data</nowiki> -->
11648 !!end
11649
11650 !! test
11651 pre-save transform: <noinclude> in subst (bug 3298)
11652 !! options
11653 pst
11654 !! wikitext
11655 {{subst:Includes}}
11656 !! html
11657 Foobar
11658 !! end
11659
11660 !! test
11661 pre-save transform: <onlyinclude> in subst (bug 3298)
11662 !! options
11663 pst
11664 !! wikitext
11665 {{subst:Includes2}}
11666 !! html
11667 Foo
11668 !! end
11669
11670 !! article
11671 Template:SubstTest
11672 !!text
11673 {{<includeonly>subst:</includeonly>Includes}}
11674 !! endarticle
11675
11676 !! article
11677 Template:SafeSubstTest
11678 !! text
11679 {{<includeonly>safesubst:</includeonly>Includes}}
11680 !! endarticle
11681
11682 !! test
11683 bug 22297: safesubst: works during PST
11684 !! options
11685 pst
11686 !! wikitext
11687 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11688 !! html
11689 FoobarFoobar
11690 !! end
11691
11692 !! test
11693 bug 22297: safesubst: works during normal parse
11694 !! wikitext
11695 {{SafeSubstTest}}
11696 !! html
11697 <p>Foobar
11698 </p>
11699 !! end
11700
11701 !! test
11702 subst: does not work during normal parse
11703 !! wikitext
11704 {{SubstTest}}
11705 !! html
11706 <p>{{subst:Includes}}
11707 </p>
11708 !! end
11709
11710 !! test
11711 pre-save transform: context links ("pipe trick")
11712 !! options
11713 pst
11714 !! wikitext
11715 [[Article (context)|]]
11716 [[Bar:Article|]]
11717 [[:Bar:Article|]]
11718 [[Bar:Article (context)|]]
11719 [[:Bar:Article (context)|]]
11720 [[|Article]]
11721 [[|Article (context)]]
11722 [[Bar:X (Y) Z|]]
11723 [[:Bar:X (Y) Z|]]
11724 !! html
11725 [[Article (context)|Article]]
11726 [[Bar:Article|Article]]
11727 [[:Bar:Article|Article]]
11728 [[Bar:Article (context)|Article]]
11729 [[:Bar:Article (context)|Article]]
11730 [[Article]]
11731 [[Article (context)]]
11732 [[Bar:X (Y) Z|X (Y) Z]]
11733 [[:Bar:X (Y) Z|X (Y) Z]]
11734 !! end
11735
11736 !! test
11737 pre-save transform: context links ("pipe trick") with interwiki prefix
11738 !! options
11739 pst
11740 !! wikitext
11741 [[interwiki:Article|]]
11742 [[:interwiki:Article|]]
11743 [[interwiki:Bar:Article|]]
11744 [[:interwiki:Bar:Article|]]
11745 !! html
11746 [[interwiki:Article|Article]]
11747 [[:interwiki:Article|Article]]
11748 [[interwiki:Bar:Article|Bar:Article]]
11749 [[:interwiki:Bar:Article|Bar:Article]]
11750 !! end
11751
11752 !! test
11753 pre-save transform: context links ("pipe trick") with parens in title
11754 !! options
11755 pst title=[[Somearticle (context)]]
11756 !! wikitext
11757 [[|Article]]
11758 !! html
11759 [[Article (context)|Article]]
11760 !! end
11761
11762 !! test
11763 pre-save transform: context links ("pipe trick") with comma in title
11764 !! options
11765 pst title=[[Someplace, Somewhere]]
11766 !! wikitext
11767 [[|Otherplace]]
11768 [[Otherplace, Elsewhere|]]
11769 [[Otherplace, Elsewhere, Anywhere|]]
11770 !! html
11771 [[Otherplace, Somewhere|Otherplace]]
11772 [[Otherplace, Elsewhere|Otherplace]]
11773 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11774 !! end
11775
11776 !! test
11777 pre-save transform: context links ("pipe trick") with parens and comma
11778 !! options
11779 pst title=[[Someplace (IGNORED), Somewhere]]
11780 !! wikitext
11781 [[|Otherplace]]
11782 [[Otherplace (place), Elsewhere|]]
11783 !! html
11784 [[Otherplace, Somewhere|Otherplace]]
11785 [[Otherplace (place), Elsewhere|Otherplace]]
11786 !! end
11787
11788 !! test
11789 pre-save transform: context links ("pipe trick") with comma and parens
11790 !! options
11791 pst title=[[Who, me? (context)]]
11792 !! wikitext
11793 [[|Yes, you.]]
11794 [[Me, Myself, and I (1937 song)|]]
11795 !! html
11796 [[Yes, you. (context)|Yes, you.]]
11797 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11798 !! end
11799
11800 !! test
11801 pre-save transform: context links ("pipe trick") with namespace
11802 !! options
11803 pst title=[[Ns:Somearticle]]
11804 !! wikitext
11805 [[|Article]]
11806 !! html
11807 [[Ns:Article|Article]]
11808 !! end
11809
11810 !! test
11811 pre-save transform: context links ("pipe trick") with namespace and parens
11812 !! options
11813 pst title=[[Ns:Somearticle (context)]]
11814 !! wikitext
11815 [[|Article]]
11816 !! html
11817 [[Ns:Article (context)|Article]]
11818 !! end
11819
11820 !! test
11821 pre-save transform: context links ("pipe trick") with namespace and comma
11822 !! options
11823 pst title=[[Ns:Somearticle, Context, Whatever]]
11824 !! wikitext
11825 [[|Article]]
11826 !! html
11827 [[Ns:Article, Context, Whatever|Article]]
11828 !! end
11829
11830 !! test
11831 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11832 !! options
11833 pst title=[[Ns:Somearticle, Context (context)]]
11834 !! wikitext
11835 [[|Article]]
11836 !! html
11837 [[Ns:Article (context)|Article]]
11838 !! end
11839
11840 !! test
11841 pre-save transform: context links ("pipe trick") with namespace, parens and comma
11842 !! options
11843 pst title=[[Ns:Somearticle (IGNORED), Context]]
11844 !! wikitext
11845 [[|Article]]
11846 !! html
11847 [[Ns:Article, Context|Article]]
11848 !! end
11849
11850 !! test
11851 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
11852 !! options
11853 pst
11854 !! wikitext
11855 [[Article(context)|]]
11856 [[Bar:Article(context)|]]
11857 [[:Bar:Article(context)|]]
11858 [[|Article(context)]]
11859 [[Bar:X(Y)Z|]]
11860 [[:Bar:X(Y)Z|]]
11861 !! html
11862 [[Article(context)|Article]]
11863 [[Bar:Article(context)|Article]]
11864 [[:Bar:Article(context)|Article]]
11865 [[Article(context)]]
11866 [[Bar:X(Y)Z|X(Y)Z]]
11867 [[:Bar:X(Y)Z|X(Y)Z]]
11868 !! end
11869
11870 !! test
11871 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
11872 !! options
11873 pst
11874 !! wikitext
11875 [[Article (context)|]]
11876 [[Bar:Article (context)|]]
11877 [[:Bar:Article (context)|]]
11878 [[|Article (context)]]
11879 [[Bar:X (Y) Z|]]
11880 [[:Bar:X (Y) Z|]]
11881 !! html
11882 [[Article (context)|Article]]
11883 [[Bar:Article (context)|Article]]
11884 [[:Bar:Article (context)|Article]]
11885 [[Article (context)]]
11886 [[Bar:X (Y) Z|X (Y) Z]]
11887 [[:Bar:X (Y) Z|X (Y) Z]]
11888 !! end
11889
11890 !! test
11891 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
11892 !! options
11893 pst
11894 !! wikitext
11895 [[Article(context)|]]
11896 [[Bar:Article(context)|]]
11897 [[:Bar:Article(context)|]]
11898 [[|Article(context)]]
11899 [[Bar:X(Y)Z|]]
11900 [[:Bar:X(Y)Z|]]
11901 !! html
11902 [[Article(context)|Article]]
11903 [[Bar:Article(context)|Article]]
11904 [[:Bar:Article(context)|Article]]
11905 [[Article(context)]]
11906 [[Bar:X(Y)Z|X(Y)Z]]
11907 [[:Bar:X(Y)Z|X(Y)Z]]
11908 !! end
11909
11910 !! test
11911 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11912 !! options
11913 pst
11914 !! wikitext
11915 [[Article (context), context|]]
11916 [[Article (context),context|]]
11917 [[Bar:Article (context), context|]]
11918 [[Bar:Article (context),context|]]
11919 [[:Bar:Article (context), context|]]
11920 [[:Bar:Article (context),context|]]
11921 !! html
11922 [[Article (context), context|Article]]
11923 [[Article (context),context|Article]]
11924 [[Bar:Article (context), context|Article]]
11925 [[Bar:Article (context),context|Article]]
11926 [[:Bar:Article (context), context|Article]]
11927 [[:Bar:Article (context),context|Article]]
11928 !! end
11929
11930 !! test
11931 pre-save transform: trim trailing empty lines
11932 !! options
11933 pst
11934 !! wikitext
11935 Empty lines are trimmed
11936
11937
11938
11939
11940 !! html
11941 Empty lines are trimmed
11942 !! end
11943
11944 !! test
11945 pre-save transform: Signature expansion
11946 !! options
11947 pst
11948 !! wikitext
11949 * ~~~
11950 * <noinclude>~~~</noinclude>
11951 * <includeonly>~~~</includeonly>
11952 * <onlyinclude>~~~</onlyinclude>
11953 !! html
11954 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11955 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11956 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11957 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11958 !! end
11959
11960
11961 !! test
11962 pre-save transform: Signature expansion in nowiki tags (bug 93)
11963 !! options
11964 pst disabled
11965 !! wikitext
11966 Shall not expand:
11967
11968 <nowiki>~~~~</nowiki>
11969
11970 <includeonly><nowiki>~~~~</nowiki></includeonly>
11971
11972 <noinclude><nowiki>~~~~</nowiki></noinclude>
11973
11974 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11975
11976 {{subst:Foo}} shall be converted to FOO
11977
11978 As well as inside noinclude/onlyinclude
11979 <noinclude>{{subst:Foo}}</noinclude>
11980 <onlyinclude>{{subst:Foo}}</onlyinclude>
11981
11982 But not inside includeonly
11983 <includeonly>{{subst:Foo}}</includeonly>
11984 !! html
11985 Shall not expand:
11986
11987 <nowiki>~~~~</nowiki>
11988
11989 <includeonly><nowiki>~~~~</nowiki></includeonly>
11990
11991 <noinclude><nowiki>~~~~</nowiki></noinclude>
11992
11993 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11994
11995 FOO shall be converted to FOO
11996
11997 As well as inside noinclude/onlyinclude
11998 <noinclude>FOO</noinclude>
11999 <onlyinclude>FOO</onlyinclude>
12000
12001 But not inside includeonly
12002 <includeonly>{{subst:Foo}}</includeonly>
12003 !! end
12004
12005 !! test
12006 Parsoid: Recognize nowiki with trailing space in tags
12007 !! options
12008 parsoid=wt2html
12009 !! wikitext
12010 <nowiki ><div>[[foo]]</nowiki >
12011
12012 a<nowiki / >b
12013
12014 c<nowiki />d
12015
12016 e<nowiki/ >f
12017 !! html
12018 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12019 <p>ab</p>
12020 <p>cd</p>
12021 <p>ef</p>
12022 !! end
12023
12024 !! test
12025 Parsoid: Recognize nowiki with odd capitalization
12026 !! options
12027 parsoid=wt2html
12028 !! wikitext
12029 <noWikI ><div>[[foo]]</Nowiki >
12030 !! html
12031 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12032 !! end
12033
12034
12035 !! test
12036 Parsoid: Escape nowiki with trailing space in tags
12037 !! options
12038 parsoid=html2wt
12039 !! html
12040 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12041 <p>a&lt;nowiki /&gt;b</p>
12042 <p>c&lt;nowiki/ &gt;d</p>
12043 !! wikitext
12044 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12045
12046 a&lt;nowiki /&gt;b
12047
12048 c&lt;nowiki/ &gt;d
12049 !! end
12050
12051 !! test
12052 Parsoid: Escape weird noWikI capitalizations
12053 !! options
12054 parsoid=html2wt
12055 !! html
12056 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12057 !! wikitext
12058 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12059 !! end
12060
12061 ###
12062 ### Message transform tests
12063 ###
12064 !! test
12065 message transform: magic variables
12066 !! options
12067 msg
12068 !! wikitext
12069 {{SITENAME}}
12070 !! html
12071 MediaWiki
12072 !! end
12073
12074 !! test
12075 message transform: should not transform wiki markup
12076 !! options
12077 msg
12078 !! wikitext
12079 ''test''
12080 !! html
12081 ''test''
12082 !! end
12083
12084 !! test
12085 message transform: <noinclude> in transcluded template (bug 4926)
12086 !! options
12087 msg
12088 !! wikitext
12089 {{Includes}}
12090 !! html
12091 Foobar
12092 !! end
12093
12094 !! test
12095 message transform: <onlyinclude> in transcluded template (bug 4926)
12096 !! options
12097 msg
12098 !! wikitext
12099 {{Includes2}}
12100 !! html
12101 Foo
12102 !! end
12103
12104 !! test
12105 {{#special:}} page name, known
12106 !! options
12107 msg
12108 !! wikitext
12109 {{#special:Recentchanges}}
12110 !! html
12111 Special:RecentChanges
12112 !! end
12113
12114 !! test
12115 {{#special:}} page name with subpage, known
12116 !! options
12117 msg
12118 !! wikitext
12119 {{#special:Recentchanges/param}}
12120 !! html
12121 Special:RecentChanges/param
12122 !! end
12123
12124 !! test
12125 {{#special:}} page name, unknown
12126 !! options
12127 msg
12128 !! wikitext
12129 {{#special:foobar nonexistent}}
12130 !! html
12131 Special:Foobar nonexistent
12132 !! end
12133
12134 !! test
12135 {{#speciale:}} page name, known
12136 !! options
12137 msg
12138 !! wikitext
12139 {{#speciale:Recentchanges}}
12140 !! html
12141 Special:RecentChanges
12142 !! end
12143
12144 !! test
12145 {{#speciale:}} page name with subpage, known
12146 !! options
12147 msg
12148 !! wikitext
12149 {{#speciale:Recentchanges/param}}
12150 !! html
12151 Special:RecentChanges/param
12152 !! end
12153
12154 !! test
12155 {{#speciale:}} page name, unknown
12156 !! options
12157 msg
12158 !! wikitext
12159 {{#speciale:foobar nonexistent}}
12160 !! html
12161 Special:Foobar_nonexistent
12162 !! end
12163
12164 ###
12165 ### Images
12166 ###
12167 ### For Parsoid-specific tests, see
12168 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12169
12170 !! test
12171 Simple image
12172 !! options
12173 parsoid=wt2html,wt2wt,html2html
12174 !! wikitext
12175 [[Image:foobar.jpg]]
12176 !! html/php
12177 <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>
12178 </p>
12179 !! html/parsoid
12180 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12181 !! end
12182
12183 !! test
12184 Simple image (using File: namespace, now canonical)
12185 !! wikitext
12186 [[File:Foobar.jpg]]
12187 !! html/php
12188 <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>
12189 </p>
12190 !! html/parsoid
12191 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12192 !! end
12193
12194 !! test
12195 Right-aligned image
12196 !! wikitext
12197 [[File:Foobar.jpg|right]]
12198 !! html/php
12199 <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>
12200
12201 !! html/parsoid
12202 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12203 !! end
12204
12205 !! test
12206 Image with caption
12207 !! wikitext
12208 [[File:Foobar.jpg|right|Caption text]]
12209 !! html/php
12210 <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>
12211
12212 !! html/parsoid
12213 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12214 !! end
12215
12216 !! test
12217 Image with caption, bug 53312 #1
12218 !! wikitext
12219 [[File:Foobar.jpg|right|Caption page stuff]]
12220 !! html/php
12221 <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>
12222
12223 !! html/parsoid
12224 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
12225 !! end
12226
12227 !! test
12228 Image with caption, bug 53312 #2
12229 !! wikitext
12230 [[File:Foobar.jpg|right|Caption page=]]
12231 !! html/php
12232 <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>
12233
12234 !! html/parsoid
12235 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
12236 !! end
12237
12238 !! test
12239 Image with caption, bug 53312 #3
12240 !! wikitext
12241 [[File:Foobar.jpg|right|Caption page=stuff]]
12242 !! html/php
12243 <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>
12244
12245 !! html/parsoid
12246 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
12247 !! end
12248
12249 !! test
12250 Allow empty links in image captions (Bug 60753)
12251 !! options
12252 thumbsize=220
12253 !! wikitext
12254 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12255 [[]]
12256 [[Link2]]
12257 ]]
12258 !! html/php
12259 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
12260
12261 !! html/parsoid
12262 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
12263 [[]]
12264 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12265 </figcaption></figure>
12266 !! end
12267
12268 !! test
12269 Titles in unlinked images (T23454)
12270 !! wikitext
12271 [[File:Foobar.jpg|link=|stuff]]
12272 !! html/php
12273 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12274 </p>
12275 !! end
12276
12277 !! test
12278 Link with empty target
12279 !! wikitext
12280 [[]]
12281 !! html
12282 <p>[[]]
12283 </p>
12284 !! end
12285
12286 !! test
12287 Image with link trail
12288 !! wikitext
12289 Linktrails should not work for images: [[File:Foobar.jpg]]s
12290 !! html/php
12291 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
12292 </p>
12293 !! html/parsoid
12294 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
12295 !! end
12296
12297 !! test
12298 Image with empty attribute
12299 !! options
12300 parsoid=wt2html,wt2wt,html2html
12301 !! wikitext
12302 [[File:Foobar.jpg|right||Caption text]]
12303 !! html/php
12304 <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>
12305
12306 !! html/parsoid
12307 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12308 !! end
12309
12310 !! test
12311 1. Block image with individual attributes from templates
12312 !! wikitext
12313 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12314 !! html/php
12315 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12316
12317 !! html/parsoid
12318 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12319 !! end
12320
12321 !! test
12322 2. Block Image with individual attributes from templates
12323 !! wikitext
12324 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12325 !! html/php
12326 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12327
12328 !! html/parsoid
12329 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12330 !! end
12331
12332 !! test
12333 3. Inline image with individual attributes from templates
12334 !! wikitext
12335 [[File:Foobar.jpg|{{echo|50px}}]]
12336 !! html/php
12337 <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>
12338 </p>
12339 !! html/parsoid
12340 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12341 !! end
12342
12343 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12344 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12345 !! test
12346 Image with multiple attributes from the same template
12347 !! wikitext
12348 [[File:Foobar.jpg|{{image_attribs}}]]
12349 !! html/php
12350 <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>
12351
12352 !! html/parsoid
12353 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12354 !! end
12355
12356 !! test
12357 Image with link tails
12358 !! options
12359 thumbsize=220
12360 !! wikitext
12361 123[[File:Foobar.jpg]]456
12362 123[[File:Foobar.jpg|right]]456
12363 123[[File:Foobar.jpg|thumb]]456
12364 !! html/php
12365 <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
12366 </p>
12367 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
12368 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
12369
12370 !! html/php+tidy
12371 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
12372 <p>123</p>
12373 <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>
12374 <p>456 123</p>
12375 <div class="thumb tright">
12376 <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>
12377 <div class="thumbcaption">
12378 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12379 </div>
12380 </div>
12381 </div>
12382 <p>456</p>
12383 !! html/parsoid
12384 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
12385 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
12386 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
12387 !! end
12388
12389 !! test
12390 Image with multiple captions -- only last one is accepted
12391 !! wikitext
12392 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12393 !! html/php
12394 <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>
12395
12396 !! html/parsoid
12397 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
12398 !! end
12399
12400 !! test
12401 Image with multiple widths -- use last
12402 !! wikitext
12403 [[File:Foobar.jpg|200px|300px|caption]]
12404 !! html/php
12405 <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>
12406 </p>
12407 !! html/parsoid
12408 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
12409 !! end
12410
12411 !! test
12412 Image with multiple alignments -- use first (bug 48664)
12413 !! options
12414 thumbsize=220
12415 !! wikitext
12416 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12417
12418 [[File:Foobar.jpg|middle|text-top|caption]]
12419 !! html/php
12420 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12421 <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>
12422 </p>
12423 !! html/parsoid
12424 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12425 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12426 !! end
12427
12428 !! test
12429 Image with width attribute at different positions
12430 !! wikitext
12431 [[File:Foobar.jpg|200px|right|Caption]]
12432 [[File:Foobar.jpg|right|200px|Caption]]
12433 [[File:Foobar.jpg|right|Caption|200px]]
12434 !! html/php
12435 <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>
12436 <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>
12437 <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>
12438
12439 !! html/parsoid
12440 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12441 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12442 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12443 !! end
12444
12445 # a sad bit of backward-compatibility
12446 !! test
12447 Image with size specified with pxpx (bug 13500, 51628)
12448 !! options
12449 parsoid=wt2html,wt2wt,html2html
12450 !! wikitext
12451 [[File:Foobar.jpg|20pxpx]]
12452 [[File:Foobar.jpg|200x20pxpx]]
12453 !! html/php
12454 <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>
12455 <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>
12456 </p>
12457 !! html/parsoid
12458 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
12459 !! end
12460
12461 !! test
12462 Image with link parameter, wiki target
12463 !! wikitext
12464 [[File:Foobar.jpg|link=Main Page]]
12465 !! html/php
12466 <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>
12467 </p>
12468 !! html/parsoid
12469 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12470 !! end
12471
12472 # parsoid bug 49293 (part 1)
12473 !! test
12474 Image with link parameter, URL target
12475 !! wikitext
12476 [[File:Foobar.jpg|link=http://example.com/]]
12477 !! html/php
12478 <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>
12479 </p>
12480 !! html/parsoid
12481 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12482 !! end
12483
12484 # parsoid bug 49293 (part 2)
12485 !! test
12486 Image with link parameter, protocol-less URL target
12487 !! wikitext
12488 [[File:Foobar.jpg|link=//example.com/]]
12489 !! html/php
12490 <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>
12491 </p>
12492 !! html/parsoid
12493 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12494 !! end
12495
12496 !! test
12497 Image with link parameter, wgExternalLinkTarget
12498 !! wikitext
12499 [[Image:foobar.jpg|link=http://example.com/]]
12500 !! config
12501 wgExternalLinkTarget='foobar'
12502 !! html
12503 <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>
12504 </p>
12505 !! end
12506
12507 !! test
12508 Image with link parameter, wgNoFollowLinks set to false
12509 !! wikitext
12510 [[Image:foobar.jpg|link=http://example.com/]]
12511 !! config
12512 wgNoFollowLinks=false
12513 !! html
12514 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12515 </p>
12516 !! end
12517
12518 !! test
12519 Image with link parameter, wgNoFollowDomainExceptions
12520 !! wikitext
12521 [[Image:foobar.jpg|link=http://example.com/]]
12522 !! config
12523 wgNoFollowDomainExceptions='example.com'
12524 !! html
12525 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12526 </p>
12527 !! end
12528
12529 !! test
12530 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12531 !! wikitext
12532 [[Image:foobar.jpg|link=http://example.com/|Title]]
12533 !! config
12534 wgExternalLinkTarget='foobar'
12535 !! html
12536 <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>
12537 </p>
12538 !! end
12539
12540 !! test
12541 Image with empty link parameter
12542 !! wikitext
12543 [[File:Foobar.jpg|link=]]
12544 !! html/php
12545 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12546 </p>
12547 !! html/parsoid
12548 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
12549 !! end
12550
12551 !! test
12552 Image with link parameter (wiki target) and unnamed parameter
12553 !! wikitext
12554 [[File:Foobar.jpg|link=Main_Page|Title]]
12555 !! html/php
12556 <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>
12557 </p>
12558 !! html/parsoid
12559 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12560 !! end
12561
12562 !! test
12563 Image with link parameter (URL target) and unnamed parameter
12564 !! wikitext
12565 [[File:Foobar.jpg|link=http://example.com/|Title]]
12566 !! html/php
12567 <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>
12568 </p>
12569 !! html/parsoid
12570 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12571 !! end
12572
12573 !! test
12574 Thumbnail image with link parameter
12575 !! options
12576 thumbsize=220
12577 parsoid=wt2html,wt2wt,html2html
12578 !! wikitext
12579 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12580 !! html/php
12581 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12582
12583 !! html/parsoid
12584 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
12585 !! end
12586
12587 !! test
12588 Manually-specified thumbnail image
12589 !! options
12590 thumbsize=220
12591 !! wikitext
12592 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12593 !! html/php
12594 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12595
12596 !! html/parsoid
12597 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12598 !! end
12599
12600 !! test
12601 Manually-specified thumbnail image with explicit link to wiki page
12602 !! options
12603 thumbsize=220
12604 parsoid=wt2html,wt2wt,html2html
12605 !! wikitext
12606 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12607 !! html/php
12608 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12609
12610 !! html/parsoid
12611 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12612 !! end
12613
12614 !! test
12615 Manually-specified thumbnail image with explicit link to url
12616 !! options
12617 thumbsize=220
12618 parsoid=wt2html,wt2wt,html2html
12619 !! wikitext
12620 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12621 !! html/php
12622 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12623
12624 !! html/parsoid
12625 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12626 !! end
12627
12628 !! test
12629 Manually-specified thumbnail image with explicit no link
12630 !! options
12631 thumbsize=220
12632 parsoid=wt2html,wt2wt,html2html
12633 !! wikitext
12634 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12635 !! html/php
12636 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12637
12638 !! html/parsoid
12639 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
12640 !! end
12641
12642 !! test
12643 Manually-specified thumbnail image with explicit link and alt text
12644 !! options
12645 thumbsize=220
12646 parsoid=wt2html,wt2wt,html2html
12647 !! wikitext
12648 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12649 !! html/php
12650 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12651
12652 !! html/parsoid
12653 <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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12654 !! end
12655
12656 !! test
12657 Image with frame and link
12658 !! options
12659 parsoid=wt2html,wt2wt,html2html
12660 !! wikitext
12661 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12662 !! html/php
12663 <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>
12664
12665 !! html/parsoid
12666 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12667 !! end
12668
12669 !! test
12670 Image with frame and link and explicit alt
12671 !! options
12672 parsoid=wt2html,wt2wt,html2html
12673 !! wikitext
12674 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12675 !! html/php
12676 <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>
12677
12678 !! html/parsoid
12679 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12680 !! end
12681
12682 !! test
12683 Image with wiki markup in implicit alt
12684 !! options
12685 parsoid=wt2html,wt2wt,html2html
12686 !! wikitext
12687 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12688
12689 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12690 !! html/php
12691 <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>
12692 </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>
12693 </p>
12694 !! html/parsoid
12695 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12696 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12697 !! end
12698
12699 !! test
12700 Alt image option should handle most kinds of wikitext without barfing
12701 !! wikitext
12702 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12703 !! html/php
12704 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
12705
12706 !! html/parsoid
12707 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" 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;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
12708 !! end
12709
12710 ###################
12711 # Conflicting image format options.
12712 # First option specified should 'win'.
12713 # All three cases in each test should be identical.
12714
12715 !! test
12716 Image with 'frameless' first.
12717 !! options
12718 parsoid=wt2html,wt2wt,html2html
12719 !! wikitext
12720 [[File:Foobar.jpg|frameless|caption]]
12721
12722 [[File:Foobar.jpg|frameless|frame|caption]]
12723
12724 [[File:Foobar.jpg|frameless|thumb|caption]]
12725 !! html/php
12726 <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>
12727 </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>
12728 </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>
12729 </p>
12730 !! html/parsoid
12731 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12732 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12733 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12734 !! end
12735
12736 !! test
12737 Image with 'frame' first.
12738 !! options
12739 parsoid=wt2html,wt2wt,html2html
12740 !! wikitext
12741 [[File:Foobar.jpg|frame|caption]]
12742 [[File:Foobar.jpg|frame|frameless|caption]]
12743 [[File:Foobar.jpg|frame|thumb|caption]]
12744 !! html/php
12745 <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>
12746 <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>
12747 <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>
12748
12749 !! html/parsoid
12750 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12751 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12752 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12753 !! end
12754
12755 !! test
12756 Image with 'thumb' first.
12757 !! options
12758 parsoid=wt2html,wt2wt,html2html
12759 !! wikitext
12760 [[File:Foobar.jpg|thumb|caption]]
12761 [[File:Foobar.jpg|thumb|frameless|caption]]
12762 [[File:Foobar.jpg|thumb|frame|caption]]
12763 !! html/php
12764 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12765 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12766 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12767
12768 !! html/parsoid
12769 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12770 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12771 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12772 !! end
12773
12774 ###################
12775 # Image sizing.
12776 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12777 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
12778 # Foobar has actual size of 1941x220
12779 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12780 # a scalable format.
12781 # 2. Framed images always ignore size options; always render at default size.
12782 # 3. "Unspecified format" and border are the only types which can be
12783 # enlarged.
12784
12785 !! test
12786 Image: "unspecified format" and border enlarge
12787 !! options
12788 parsoid=wt2html,wt2wt,html2html
12789 !! wikitext
12790 [[File:Foobar.jpg|2000px]]
12791
12792 [[File:Foobar.jpg|border|2000px]]
12793 !! html/php
12794 <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>
12795 </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>
12796 </p>
12797 !! html/parsoid
12798 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12799 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12800 !! end
12801
12802 !! test
12803 Image: "unspecified format" and border reduce
12804 !! options
12805 parsoid=wt2html,wt2wt,html2html
12806 !! wikitext
12807 [[File:Foobar.jpg|1000px]]
12808
12809 [[File:Foobar.jpg|border|1000px]]
12810 !! html/php
12811 <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>
12812 </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>
12813 </p>
12814 !! html/parsoid
12815 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12816 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12817 !! end
12818
12819 !! test
12820 Image: thumbs reduce
12821 !! options
12822 parsoid=wt2html,wt2wt,html2html
12823 !! wikitext
12824 [[File:Foobar.jpg|thumb|50px]]
12825 !! html/php
12826 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12827
12828 !! html/parsoid
12829 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
12830 !! end
12831
12832 !! test
12833 Image: bitmap thumbs can't be enlarged past original size, but vector can.
12834 !! options
12835 parsoid=wt2html,wt2wt,html2html
12836 !! wikitext
12837 [[File:Foobar.jpg|thumb|2000px]]
12838
12839 [[File:Foobar.svg|thumb|2000px]]
12840 !! html/php
12841 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
12842 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
12843
12844 !! html/parsoid
12845 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12846 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
12847 !! end
12848
12849 !! test
12850 Image: frameless can reduce in size
12851 !! options
12852 parsoid=wt2html,wt2wt,html2html
12853 !! wikitext
12854 [[File:Foobar.jpg|frameless|50px]]
12855 !! html/php
12856 <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>
12857 </p>
12858 !! html/parsoid
12859 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12860 !! end
12861
12862 !! test
12863 Image: bitmap frameless can't be enlarged past original size, but vector can
12864 !! options
12865 parsoid=wt2html,wt2wt,html2html
12866 !! wikitext
12867 [[File:Foobar.jpg|frameless|2000px]]
12868
12869 [[File:Foobar.svg|frameless|2000px]]
12870 !! html/php
12871 <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>
12872 </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>
12873 </p>
12874 !! html/parsoid
12875 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12876 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
12877 !! end
12878
12879 !! test
12880 Image: framed images are always unscaled.
12881 !! options
12882 parsoid=wt2html,wt2wt,html2html
12883 !! wikitext
12884 [[File:Foobar.jpg|frame]]
12885
12886 [[File:Foobar.jpg|frame|50px]]
12887
12888 [[File:Foobar.jpg|frame|50x50px]]
12889
12890 [[File:Foobar.jpg|frame|2000px]]
12891 !! html/php
12892 <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>
12893 <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>
12894 <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>
12895 <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>
12896
12897 !! html/parsoid
12898 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12899 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12900 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12901 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12902 !! end
12903
12904 ###################
12905
12906 !! test
12907 Link to image page- image page normally doesn't exists, hence edit link
12908 Add test with existing image page
12909 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
12910 !! wikitext
12911 [[:Image:test]]
12912 !! html
12913 <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>
12914 </p>
12915 !! end
12916
12917 !! test
12918 bug 18784 Link to non-existent image page with caption should use caption as link text
12919 !! wikitext
12920 [[:Image:test|caption]]
12921 !! html
12922 <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>
12923 </p>
12924 !! end
12925
12926 !! test
12927 Frameless image caption with a free URL
12928 !! wikitext
12929 [[File:Foobar.jpg|http://example.com]]
12930 !! html/php
12931 <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>
12932 </p>
12933 !! html/parsoid
12934 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12935 !! end
12936
12937 !! test
12938 Thumbnail image caption with a free URL
12939 !! options
12940 thumbsize=220
12941 !! wikitext
12942 [[File:Foobar.jpg|thumb|http://example.com]]
12943 !! html/php
12944 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
12945
12946 !! html/parsoid
12947 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12948 !! end
12949
12950 !! test
12951 Thumbnail image caption with a free URL and explicit alt
12952 !! options
12953 thumbsize=220
12954 parsoid=wt2html,wt2wt,html2html
12955 !! wikitext
12956 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12957 !! html/php
12958 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
12959
12960 !! html/parsoid
12961 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12962 !! end
12963
12964 !! test
12965 SVG thumbnails with no language set
12966 !! options
12967 !! wikitext
12968 [[File:Foobar.svg|thumb|caption]]
12969 !! html/php
12970 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12971
12972 !! html/parsoid
12973 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12974 !! end
12975
12976 !! test
12977 SVG thumbnails with language de
12978 !! options
12979 parsoid=wt2html,wt2wt,html2html
12980 !! wikitext
12981 [[File:Foobar.svg|thumb|caption|lang=de]]
12982 !! html/php
12983 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12984
12985 !! html/parsoid
12986 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12987 !! end
12988
12989 !! test
12990 SVG thumbnails with invalid language code
12991 !! options
12992 parsoid=wt2html,wt2wt,html2html
12993 !! wikitext
12994 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12995 !! html/php
12996 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
12997
12998 !! html/parsoid
12999 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
13000 !! end
13001
13002 !! test
13003 BUG 1887: A ISBN with a thumbnail
13004 !! wikitext
13005 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13006 !! html/php
13007 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
13008
13009 !! html/parsoid
13010 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
13011 !! end
13012
13013 !! test
13014 BUG 1887: A RFC with a thumbnail
13015 !! wikitext
13016 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13017 !! html/php
13018 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
13019
13020 !! html/parsoid
13021 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13022 !! end
13023
13024 !! test
13025 BUG 1887: A mailto link with a thumbnail
13026 !! wikitext
13027 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13028 !! html/php
13029 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
13030
13031 !! html/parsoid
13032 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13033 !! end
13034
13035 # Pending resolution to bug 368
13036 !! test
13037 BUG 648: Frameless image caption with a link
13038 !! wikitext
13039 [[File:Foobar.jpg|text with a [[link]] in it]]
13040 !! html/php
13041 <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>
13042 </p>
13043 !! html/parsoid
13044 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13045 !! end
13046
13047 !! test
13048 BUG 648: Frameless image caption with a link (suffix)
13049 !! wikitext
13050 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13051 !! html/php
13052 <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>
13053 </p>
13054 !! html/parsoid
13055 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13056 !! end
13057
13058 !! test
13059 BUG 648: Frameless image caption with an interwiki link
13060 !! wikitext
13061 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13062 !! html/php
13063 <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>
13064 </p>
13065 !! html/parsoid
13066 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13067 !! end
13068
13069 !! test
13070 BUG 648: Frameless image caption with a piped interwiki link
13071 !! wikitext
13072 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13073 !! html/php
13074 <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>
13075 </p>
13076 !! html/parsoid
13077 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13078 !! end
13079
13080 !! test
13081 Escape HTML special chars in image alt text
13082 !! wikitext
13083 [[File:Foobar.jpg|& < > "]]
13084 !! html/php
13085 <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>
13086 </p>
13087 !! html/parsoid
13088 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13089 !! end
13090
13091 !! test
13092 BUG 499: Alt text should have &#1234;, not &amp;1234;
13093 !! wikitext
13094 [[File:Foobar.jpg|&#9792;]]
13095 !! html/php
13096 <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>
13097 </p>
13098 !! html/parsoid
13099 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13100 !! end
13101
13102 !! test
13103 Broken image caption with link
13104 !! options
13105 parsoid=wt2html,wt2wt,html2html
13106 !! wikitext
13107 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13108 !! html/php
13109 <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.
13110 </p>
13111 !! html/parsoid
13112 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
13113 !! end
13114
13115 !! test
13116 Image caption containing another image
13117 !! wikitext
13118 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13119 !! html/php
13120 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
13121
13122 !! html/parsoid
13123 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
13124 !! end
13125
13126 !! test
13127 Image: caption containing a newline
13128 !! wikitext
13129 [[File:Foobar.jpg|This
13130 *is some text]]
13131 !! html/php
13132 <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>
13133 </p>
13134 !! html/parsoid
13135 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13136 !!end
13137
13138 !!test
13139 Image: caption containing leading space
13140 (The leading space should not trigger nowiki escaping in wt2wt mode)
13141 !! wikitext
13142 [[File:Foobar.jpg|thumb| bar]]
13143 !! html/php
13144 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
13145
13146 !! html/parsoid
13147 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13148 !!end
13149
13150 !! test
13151 Image: caption containing a table
13152 !! options
13153 parsoid=wt2html,wt2wt,html2html
13154 !! wikitext
13155 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13156 {|
13157 ! Foo !! Bar
13158 |-
13159 | Foo1 || Bar1
13160 |}
13161 and some more text.]]
13162 !! html/php
13163 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
13164
13165 !! html/parsoid
13166 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
13167 <table>
13168 <tbody>
13169 <tr><th>Foo </th><th>Bar</th></tr>
13170 <tr>
13171 <td>Foo1 </td>
13172 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13173 !! end
13174
13175 !! test
13176 Bug 3090: External links other than http: in image captions
13177 !! wikitext
13178 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13179 !! html/php
13180 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
13181
13182 !! html/parsoid
13183 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
13184 !! end
13185
13186 !! test
13187 Custom class
13188 !! options
13189 parsoid=wt2html,wt2wt,html2html
13190 !! wikitext
13191 [[Image:foobar.jpg|a|class=b]]
13192 !! html/php
13193 <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>
13194 </p>
13195 !! html/parsoid
13196 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13197 !! end
13198
13199 !! test
13200 Localized image handling (1).
13201 !! options
13202 parsoid=wt2html,wt2wt,html2html
13203 language=es
13204 !! wikitext
13205 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13206 !! html/php
13207 <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>
13208
13209 !! html/parsoid
13210 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13211 !! end
13212
13213 !! test
13214 Localized image handling (2).
13215 !! options
13216 thumbsize=220
13217 parsoid=wt2html,wt2wt,html2html
13218 language=es
13219 !! wikitext
13220 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13221 !! html/php
13222 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
13223
13224 !! html/parsoid
13225 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13226 !! end
13227
13228 !! test
13229 "border", "frameless" and "class" attributes on an image.
13230 !! options
13231 thumbsize=220
13232 parsoid=wt2html,wt2wt,html2html
13233 !! wikitext
13234 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13235 !! html/php
13236 <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>
13237 </p>
13238 !! html/parsoid
13239 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13240 !! end
13241
13242 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13243 !! test
13244 Invalid image attributes (bug 62500)
13245 !! options
13246 thumbsize=220
13247 parsoid=wt2html,wt2wt,html2html
13248 !! wikitext
13249 [[File:Foobar.jpg|thumb|float|left|caption]]
13250
13251 [[File:Foobar.jpg|thumb|righ|caption]]
13252
13253 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13254 !! html/php
13255 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13256 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13257 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13258
13259 !! html/parsoid
13260 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13261 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13262 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13263 !! end
13264
13265 !! article
13266 File:Barfoo.jpg
13267 !! text
13268 #REDIRECT [[File:Barfoo.jpg]]
13269 !! endarticle
13270
13271 # FIXME: Parsoid should run this test -- but we'd need to teach the
13272 # mockAPI about the redirected Barfoo.jpg image.
13273 !! test
13274 Redirected image
13275 !! wikitext
13276 [[Image:Barfoo.jpg]]
13277 !! html/php
13278 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13279 </p>
13280 !! end
13281
13282 !! test
13283 Missing image with uploads disabled
13284 !! options
13285 wgEnableUploads=0
13286 !! wikitext
13287 [[File:Foobaz.jpg]]
13288 !! html/php
13289 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13290 </p>
13291 !! html/parsoid
13292 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
13293 !! end
13294
13295 # Parsoid-specific testing for images
13296 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13297 # Currently imperfect due to a flaw in the Parsoid testrunner
13298 # Work in progress
13299 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13300 # image tests.
13301
13302 !! test
13303 Parsoid-specific image handling - simple image with size and middle alignment
13304 !! wikitext
13305 [[File:Foobar.jpg|middle|50px]]
13306 !! html/parsoid
13307 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13308 !! end
13309
13310 !! test
13311 Parsoid-specific image handling - simple image with size, middle alignment,
13312 non-standard namespace alias
13313 !! options
13314 parsoid=wt2wt,wt2html,html2html
13315 !! wikitext
13316 [[Image:Foobar.jpg|middle|50px]]
13317 !! html/parsoid
13318 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13319 !! end
13320
13321 !! test
13322 Parsoid-specific image handling - simple image with size and middle alignment
13323 (existing content)
13324 !! wikitext
13325 [[File:Foobar.jpg|50px|middle]]
13326 !! html/parsoid
13327 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13328 !! end
13329
13330 !! test
13331 Parsoid-specific image handling - simple image with size and middle alignment
13332 and non-standard namespace name
13333 !! options
13334 parsoid=wt2html,wt2wt,html2html
13335 !! wikitext
13336 [[Image:Foobar.jpg|50px|middle]]
13337 !! html/parsoid
13338 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13339 !! end
13340
13341 !! test
13342 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13343 !! wikitext
13344 [[File:Foobar.jpg|500x10px|baseline|caption]]
13345 !! html/parsoid
13346 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13347 !! end
13348
13349 !! test
13350 Parsoid-specific image handling - simple image with border and size spec
13351 !! wikitext
13352 [[File:Foobar.jpg|50px|border|caption]]
13353 !! html/parsoid
13354 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13355 !! end
13356
13357 !! test
13358 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13359 !! wikitext
13360 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13361 !! html/parsoid
13362 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
13363 !! end
13364
13365 !! test
13366 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13367 (existing content)
13368 !! wikitext
13369 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13370 !! html/parsoid
13371 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
13372 !! end
13373
13374 !! test
13375 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13376 !! wikitext
13377 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13378 !! html/parsoid
13379 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
13380 !! end
13381
13382 !! test
13383 Parsoid-specific image handling - thumbnail with specific size, halign,
13384 valign, and caption (existing content)
13385 !! wikitext
13386 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13387 !! html/parsoid
13388 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
13389 !! end
13390
13391 !! test
13392 Parsoid-specific image handling - framed image with specific size and caption
13393 (size is ignored)
13394 !! options
13395 parsoid=wt2html,wt2wt,html2html
13396 !! wikitext
13397 [[File:Foobar.jpg|frame|500x50px|caption]]
13398 !! html/parsoid
13399 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13400 !! end
13401
13402 !! test
13403 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13404 (size is ignored)
13405 !! options
13406 parsoid=wt2html,wt2wt,html2html
13407 !! wikitext
13408 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13409 !! html/parsoid
13410 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13411 !! end
13412
13413 !! test
13414 Parsoid-specific image handling - frameless image with specific size, border, and caption
13415 !! wikitext
13416 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13417 !! html/parsoid
13418 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13419 !! end
13420
13421 !! test
13422 Parsoid-specific image handling - simple image with a formatted caption
13423 !! wikitext
13424 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13425 !! html/parsoid
13426 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13427 !! end
13428
13429 !! test
13430 Parsoid-specific image handling - caption with a template in it
13431 !! wikitext
13432 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13433 !! html/parsoid
13434 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
13435 !! end
13436
13437 !! test
13438 Parsoid-specific image handling - caption with unbalanced tags in it
13439 !! options
13440 parsoid=wt2html,wt2wt,html2html
13441 !! wikitext
13442 foo
13443 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13444 bar
13445 !! html/parsoid
13446 <p>foo</p>
13447 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
13448 <p>bar</p>
13449 !! end
13450
13451 !! test
13452 Parsoid-specific image handling - empty caption (1)
13453 !! options
13454 parsoid=wt2html,wt2wt
13455 !! wikitext
13456 [[File:Foobar.jpg|thumb|]]
13457 !! html/parsoid
13458 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
13459 !! end
13460
13461 # empty captions don't get serialized unless we're in the "round trip" case
13462 !! test
13463 Parsoid-specific image handling - empty caption (2)
13464 !! options
13465 parsoid=html2wt
13466 !! html/parsoid
13467 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13468 <a href="./File:Foobar.jpg">
13469 <img resource="./File:Foobar.jpg"
13470 src="//example.com/images/3/3a/Foobar.jpg"
13471 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13472 height="25" width="220"/>
13473 </a>
13474 <figcaption></figcaption>
13475 </figure>
13476 !! wikitext
13477 [[File:Foobar.jpg|thumb]]
13478 !! end
13479
13480 !! test
13481 Parsoid-specific image handling - whitespace caption
13482 !! wikitext
13483 [[File:Foobar.jpg|thumb| ]]
13484 !! html/parsoid
13485 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
13486 !! end
13487
13488 !! test
13489 Parsoid-specific image handling - lang option
13490 !! wikitext
13491 foo
13492 [[File:Foobar.svg|lang=de|caption]]
13493 bar
13494 !! html/parsoid
13495 <p>foo
13496 <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" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
13497 bar</p>
13498 !! end
13499
13500
13501 ###
13502 ### Subpages
13503 ###
13504 !! article
13505 Subpage test/subpage
13506 !! text
13507 foo
13508 !! endarticle
13509
13510 !! test
13511 Subpage link
13512 !! options
13513 subpage title=[[Subpage test]]
13514 !! wikitext
13515 [[/subpage]]
13516 !! html
13517 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13518 </p>
13519 !! end
13520
13521 !! test
13522 Subpage noslash link
13523 !! options
13524 subpage title=[[Subpage test]]
13525 !! wikitext
13526 [[/subpage/]]
13527 !! html
13528 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13529 </p>
13530 !! end
13531
13532 !! article
13533 Subpage test/1/2/subpage
13534 !! text
13535 blah
13536 !! endarticle
13537
13538 !! test
13539 Relative subpage noslash link
13540 !! options
13541 parsoid=wt2wt,wt2html,html2html
13542 subpage title=[[Subpage test/1/2/3/4]]
13543 !! wikitext
13544 [[../../subpage/]]
13545
13546 [[../../subpage]]
13547 !! html/php
13548 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13549 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13550 </p>
13551 !! html/parsoid
13552 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13553 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13554 !! end
13555
13556 !! test
13557 Parsoid: dot-slash prefixed wikilinks
13558 !! wikitext
13559 [[./foo]]
13560
13561 [[././bar]]
13562
13563 [[././baz/]]
13564 !! html/php
13565 <p>[[./foo]]
13566 </p><p>[[././bar]]
13567 </p><p>[[././baz/]]
13568 </p>
13569 !! html/parsoid
13570 <p>[[./foo]]
13571 </p><p>[[././bar]]
13572 </p><p>[[././baz/]]
13573 </p>
13574 !! end
13575
13576 !! test
13577 Render invalid page names as plain text (bug 51090)
13578 !! wikitext
13579 [[./../foo|bar]]
13580 [[foo�|bar]]
13581 [[foo/.|bar]]
13582 [[foo/..|bar]]
13583 [[foo~~~bar]]
13584 [[foo>bar]]
13585 [[foo[bar]]
13586 [[.]]
13587 [[..]]
13588 [[foo././bar]]
13589
13590 [[{{echo|./../foo}}|bar]]
13591 [[{{echo|foo/.}}|bar]]
13592 [[{{echo|foo/..}}|bar]]
13593 [[{{echo|foo~~~~bar}}]]
13594 [[{{echo|foo>bar}}]]
13595 [[{{echo|foo././bar}}]]
13596 [[{{echo|foo{bar}}]]
13597 [[{{echo|foo}bar}}]]
13598 [[{{echo|foo[bar}}]]
13599 [[{{echo|foo]bar}}]]
13600 [[{{echo|foo<bar}}]]
13601 !!html/php
13602 <p>[[./../foo|bar]]
13603 [[foo�|bar]]
13604 [[foo/.|bar]]
13605 [[foo/..|bar]]
13606 [[foo~~~bar]]
13607 [[foo&gt;bar]]
13608 [[foo[bar]]
13609 [[.]]
13610 [[..]]
13611 [[foo././bar]]
13612 </p><p>[[./../foo|bar]]
13613 [[foo/.|bar]]
13614 [[foo/..|bar]]
13615 [[foo~~~~bar]]
13616 [[foo&gt;bar]]
13617 [[foo././bar]]
13618 [[foo{bar]]
13619 [[foo}bar]]
13620 [[foo[bar]]
13621 [[foo]bar]]
13622 [[foo&lt;bar]]
13623 </p>
13624 !!html/parsoid
13625 <p>[[./../foo|bar]]
13626 [[foo�|bar]]
13627 [[foo/.|bar]]
13628 [[foo/..|bar]]
13629 [[foo~~~bar]]
13630 [[foo>bar]]
13631 [[foo[bar]]
13632 [[.]]
13633 [[..]]
13634 [[foo././bar]]</p>
13635
13636 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13637 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13638 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13639 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13640 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13641 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13642 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13643 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13644 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13645 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13646 [[<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>
13647 !!end
13648
13649 !! test
13650 Disabled subpages
13651 !! wikitext
13652 [[/subpage]]
13653 !! html
13654 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13655 </p>
13656 !! end
13657
13658 !! test
13659 BUG 561: {{/Subpage}}
13660 !! options
13661 subpage title=[[Page]]
13662 !! wikitext
13663 {{/Subpage}}
13664 !! html
13665 <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>
13666 </p>
13667 !! end
13668
13669 ###
13670 ### Categories
13671 ###
13672 !! article
13673 Category:MediaWiki User's Guide
13674 !! text
13675 blah
13676 !! endarticle
13677
13678 !! test
13679 Link to category
13680 !! wikitext
13681 [[:Category:MediaWiki User's Guide]]
13682 !! html
13683 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13684 </p>
13685 !! end
13686
13687 !! test
13688 Simple category
13689 !! options
13690 cat
13691 !! wikitext
13692 [[Category:MediaWiki User's Guide]]
13693 !! html
13694 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13695 !! end
13696
13697 !! test
13698 PAGESINCATEGORY invalid title fatal (r33546 fix)
13699 !! wikitext
13700 {{PAGESINCATEGORY:<bogus>}}
13701 !! html
13702 <p>0
13703 </p>
13704 !! end
13705
13706 !! test
13707 Category with different sort key
13708 !! options
13709 cat
13710 !! wikitext
13711 [[Category:MediaWiki User's Guide|Foo]]
13712 !! html
13713 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13714 !! end
13715
13716 !! test
13717 Category with identical sort key
13718 !! options
13719 cat
13720 !! wikitext
13721 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13722 !! html
13723 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13724 !! end
13725
13726 !! test
13727 Category with empty sort key
13728 !! options
13729 cat
13730 pst
13731 !! wikitext
13732 [[Category:MediaWiki User's Guide|]]
13733 !! html
13734 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13735 !! end
13736
13737 !! test
13738 Category with empty sort key and parentheses
13739 !! options
13740 cat
13741 pst
13742 !! wikitext
13743 [[Category:Foo (bar)|]]
13744 !! html
13745 [[Category:Foo (bar)|Foo]]
13746 !! end
13747
13748 !! test
13749 Category with link tail
13750 !! options
13751 cat
13752 pst
13753 !! wikitext
13754 123[[Category:Foo]]456
13755 !! html
13756 123[[Category:Foo]]456
13757 !! end
13758
13759 !! test
13760 Category with template
13761 !! options
13762 cat
13763 pst
13764 !! wikitext
13765 [[Category:{{echo|Foo}}]]
13766 !! html
13767 [[Category:{{echo|Foo}}]]
13768 !! end
13769
13770 !! test
13771 Category with template in sort key
13772 !! options
13773 cat
13774 pst
13775 !! wikitext
13776 [[Category:Foo|{{echo|Bar}}]]
13777 !! html
13778 [[Category:Foo|{{echo|Bar}}]]
13779 !! end
13780
13781 !! test
13782 Category with template in sort key and title
13783 !! options
13784 cat
13785 pst
13786 !! wikitext
13787 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13788 !! html
13789 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13790 !! end
13791
13792 !! test
13793 Category / paragraph interactions
13794 !! wikitext
13795 Foo [[Category:Baz]] Bar
13796
13797 Foo [[Category:Baz]]
13798 Bar
13799
13800 Foo
13801 [[Category:Baz]]
13802 Bar
13803
13804 Foo
13805 [[Category:Baz]] Bar
13806
13807 Foo
13808 [[Category:Baz]]
13809 [[Category:Baz]]
13810 [[Category:Baz]]
13811 Bar
13812
13813 [[Category:Baz]]
13814 [[Category:Baz]]
13815 [[Category:Baz]]
13816
13817 [[Category:Baz]]
13818 {{echo|[[Category:Baz]]}}
13819 [[Category:Baz]]
13820 !! html
13821 <p>Foo Bar
13822 </p><p>Foo
13823 Bar
13824 </p><p>Foo
13825 Bar
13826 </p><p>Foo Bar
13827 </p><p>Foo
13828 Bar
13829 </p>
13830 !! end
13831
13832 ## The whitespace on the empty line is part of the test. Please do not delete
13833 !! test
13834 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13835 !! options
13836 parsoid=wt2html,wt2wt
13837 !! wikitext
13838 This
13839
13840 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
13841
13842 {{echo|[[Category:Foo]] and so should this!}}
13843 !! html
13844 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
13845 </p>
13846 !! html/parsoid
13847 <p>This
13848
13849 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
13850
13851 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
13852 !! end
13853
13854 ## Parsoid will not try to wt2wt this while preserving newlines because
13855 ## it suppresses excess newlines within list items -- and we don't want to
13856 ## introduce a special case just for categories, which is, in reality somewhat
13857 ## odd behavior -- categories are unlikely to be used in list items like this
13858 ## in top-level pages and are only likely to show up in template-generated
13859 ## list items where this RT-ing is a non-issue.
13860 ##
13861 ## The whitespace on the empty line is part of the test. Please do not delete
13862 !! test
13863 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
13864 !! options
13865 parsoid=wt2html
13866 !! wikitext
13867 * This
13868
13869 [[Category:Foo]] and this should be part of the same list item
13870 * So should this
13871
13872 {{echo|[[Category:Foo]] and this should be part of the same list item}}
13873 !! html
13874 <ul><li>This and this should be part of the same list item</li>
13875 <li>So should this and this should be part of the same list item</li></ul>
13876 !! html/parsoid
13877 <ul>
13878 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
13879 <li>So should this <link rel="mw:PageProp/Category" href="Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
13880 </ul>
13881 !! end
13882
13883 ## Newlines and categories that follow the last item of a list
13884 ## are treated differently because this (list followed by categories)
13885 ## is an extremely common pattern on wikis.
13886 !! test
13887 3. Categories and newlines: newline suppression for last list item should RT properly
13888 !! wikitext
13889 * a
13890 * b
13891
13892 [[Category:Foo]]
13893
13894 [[Category:Bar]]
13895 [[Category:Baz]]
13896 !! html/parsoid
13897 <ul><li> a</li>
13898 <li> b</li></ul>
13899
13900 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13901
13902 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13903 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13904 !! end
13905
13906 !! test
13907 4. Categories and newlines: newline suppression for last list item should RT properly
13908 !! wikitext
13909 * a
13910 **** b
13911
13912 [[Category:Foo]]
13913 !! html/parsoid
13914 <ul><li> a
13915 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
13916
13917 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13918 !! end
13919
13920 ## only wt2html for this to make sure the algo only applies to the rightmost path
13921 !! test
13922 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
13923 !! options
13924 parsoid=wt2html
13925 !! wikitext
13926 * a
13927 ** b
13928 [[Category:Foo]]
13929 * c
13930 ** d
13931 [[Category:Foo]]
13932 !! html/parsoid
13933 <ul><li> a
13934 <ul><li> b
13935 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
13936 <li> c
13937 <ul><li> d</li></ul></li></ul>
13938 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
13939 !! end
13940
13941 !! test
13942 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
13943 !! wikitext
13944 * a [[Category:Foo]]
13945 !! html/parsoid
13946 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
13947 !! end
13948
13949 # This test also demonstrates because of newline+category tunneling
13950 # through the list hander, template wrapping doesn't expand to the
13951 # containing list when the list item swallows the category.
13952 !! test
13953 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
13954 !! wikitext
13955 * {{echo|a
13956 [[Category:Foo]]}}
13957 !! html/parsoid
13958 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a</span><span about="#mwt1">
13959 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
13960 !! end
13961
13962 !! test
13963 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
13964 !! wikitext
13965 * a
13966
13967 {{echo|[[Category:Foo]]
13968 [[Category:Bar]]}}
13969 [[Category:Baz]]
13970 !! html/parsoid
13971 <ul><li> a</li></ul>
13972
13973 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
13974 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
13975 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
13976 !! end
13977
13978 !! test
13979 Parsoid: Serialize link to category page with colon escape
13980 !! options
13981 parsoid
13982 !! wikitext
13983
13984 [[:Category:Foo]]
13985 [[:Category:Foo|Bar]]
13986 !! html
13987 <p>
13988 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
13989 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
13990 </p>
13991 !! end
13992
13993 # html2wt localizes the "Category" namespace.
13994 # XXX the <link> element needs an empty data-parsoid attribute, or
13995 # else the html2html test fails because spaces are inserted.
13996 !! test
13997 Link prefix/suffixes aren't applied to category links
13998 !! options
13999 parsoid=wt2html,wt2wt,html2html
14000 language=is
14001 !! wikitext
14002 x[[Category:Foo]]y
14003 !! html/php
14004 <p>xy
14005 </p>
14006 !! html/parsoid
14007 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14008 !! end
14009
14010 !! test
14011 Parsoid: Serialize link to file page with colon escape
14012 !! options
14013 parsoid
14014 !! wikitext
14015
14016 [[:File:Foo.png]]
14017 [[:File:Foo.png|Bar]]
14018 !! html
14019 <p>
14020 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14021 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14022 </p>
14023 !! end
14024
14025 !! test
14026 Parsoid: Serialize a genuine category link without colon escape
14027 !! options
14028 parsoid
14029 !! wikitext
14030 [[Category:Foo]]
14031 [[Category:Foo|Bar]]
14032 !! html
14033 <link rel="mw:PageProp/Category" href="Category:Foo">
14034 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
14035 !! end
14036
14037 !! test
14038 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14039 !! options
14040 parsoid=html2wt
14041 !! html
14042 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14043 !! wikitext
14044 [[Category:Toxine bactérienne]]
14045 !! end
14046
14047 !! test
14048 Parsoid: Defaultsort
14049 !! wikitext
14050 {{DEFAULTSORT:Foo}}
14051 !! html/parsoid
14052 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14053 !! end
14054
14055 !! test
14056 Parsoid: Defaultsort (template-generated)
14057 !! wikitext
14058 {{{{echo|DEFAULTSORT}}:Foo}}
14059 !! html/parsoid
14060 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14061 !! end
14062
14063 ###
14064 ### Inter-language links
14065 ###
14066 !! test
14067 Interlanguage links
14068 !! options
14069 ill
14070 !! wikitext
14071 [[es:Alimento]]
14072 [[fr:Nourriture]]
14073 [[zh:食品]]
14074 !! html/php
14075 es:Alimento fr:Nourriture zh:食品
14076 !! html/parsoid
14077 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14078 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14079 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14080 !! end
14081
14082 !! test
14083 Duplicate interlanguage links (bug 24502)
14084 !! options
14085 ill
14086 !! wikitext
14087 [[es:1]]
14088 [[es:2]]
14089 [[fr:1]]
14090 [[fr:2]]
14091 !! html/php
14092 es:1 fr:1
14093 !! html/parsoid
14094 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14095 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14096 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14097 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14098 !! end
14099
14100 ###
14101 ### Sections
14102 ###
14103 !! test
14104 Basic section headings
14105 !! wikitext
14106 == Headline 1 ==
14107 Some text
14108
14109 ==Headline 2==
14110 More
14111 ===Smaller headline===
14112 Blah blah
14113 !! html
14114 <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>
14115 <p>Some text
14116 </p>
14117 <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>
14118 <p>More
14119 </p>
14120 <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>
14121 <p>Blah blah
14122 </p>
14123 !! end
14124
14125 !! test
14126 Section headings with TOC
14127 !! wikitext
14128 == Headline 1 ==
14129 === Subheadline 1 ===
14130 ===== Skipping a level =====
14131 ====== Skipping a level ======
14132
14133 == Headline 2 ==
14134 Some text
14135 ===Another headline===
14136 !! html
14137 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14138 <ul>
14139 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14140 <ul>
14141 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14142 <ul>
14143 <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>
14144 <ul>
14145 <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>
14146 </ul>
14147 </li>
14148 </ul>
14149 </li>
14150 </ul>
14151 </li>
14152 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14153 <ul>
14154 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14155 </ul>
14156 </li>
14157 </ul>
14158 </div>
14159
14160 <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>
14161 <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>
14162 <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>
14163 <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>
14164 <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>
14165 <p>Some text
14166 </p>
14167 <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>
14168
14169 !! end
14170
14171 !! test
14172 TOC anchors don't collide
14173 !! wikitext
14174 __FORCETOC__
14175 == Headline 2 ==
14176 == Headline ==
14177 == Headline 2 ==
14178 == Headline ==
14179 !! html/php
14180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14181 <ul>
14182 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14183 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14184 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14185 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14186 </ul>
14187 </div>
14188
14189 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14190 <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14191 <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14192 <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14193
14194 !! end
14195
14196 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14197 !! test
14198 Handling of sections up to level 6 and beyond
14199 !! wikitext
14200 = Level 1 Heading=
14201 == Level 2 Heading==
14202 === Level 3 Heading===
14203 ==== Level 4 Heading====
14204 ===== Level 5 Heading=====
14205 ====== Level 6 Heading======
14206 ======= Level 7 Heading=======
14207 ======== Level 8 Heading========
14208 ========= Level 9 Heading=========
14209 ========== Level 10 Heading==========
14210 !! html
14211 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14212 <ul>
14213 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14214 <ul>
14215 <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>
14216 <ul>
14217 <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>
14218 <ul>
14219 <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>
14220 <ul>
14221 <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>
14222 <ul>
14223 <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>
14224 <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>
14225 <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>
14226 <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>
14227 <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>
14228 </ul>
14229 </li>
14230 </ul>
14231 </li>
14232 </ul>
14233 </li>
14234 </ul>
14235 </li>
14236 </ul>
14237 </li>
14238 </ul>
14239 </div>
14240
14241 <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>
14242 <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>
14243 <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>
14244 <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>
14245 <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>
14246 <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>
14247 <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>
14248 <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>
14249 <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>
14250 <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>
14251
14252 !! end
14253
14254 !! test
14255 TOC regression (T11764)
14256 !! wikitext
14257 == title 1 ==
14258 === title 1.1 ===
14259 ==== title 1.1.1 ====
14260 === title 1.2 ===
14261 == title 2 ==
14262 === title 2.1 ===
14263 !! html
14264 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14265 <ul>
14266 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14267 <ul>
14268 <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>
14269 <ul>
14270 <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>
14271 </ul>
14272 </li>
14273 <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>
14274 </ul>
14275 </li>
14276 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14277 <ul>
14278 <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>
14279 </ul>
14280 </li>
14281 </ul>
14282 </div>
14283
14284 <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>
14285 <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>
14286 <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>
14287 <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>
14288 <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>
14289 <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>
14290
14291 !! end
14292
14293 !! test
14294 TOC for heading containing <span id="..."></span> (T96153)
14295 !! wikitext
14296 __FORCETOC__
14297 ==<span id="old-anchor"></span>New title==
14298 !! html/php
14299 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14300 <ul>
14301 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14302 </ul>
14303 </div>
14304
14305 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</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: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14306
14307 !! end
14308
14309 !! test
14310 TOC with wgMaxTocLevel=3 (bug 6204)
14311 !! options
14312 wgMaxTocLevel=3
14313 !! wikitext
14314 == title 1 ==
14315 === title 1.1 ===
14316 ==== title 1.1.1 ====
14317 === title 1.2 ===
14318 == title 2 ==
14319 === title 2.1 ===
14320 !! html
14321 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14322 <ul>
14323 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14324 <ul>
14325 <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>
14326 <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>
14327 </ul>
14328 </li>
14329 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14330 <ul>
14331 <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>
14332 </ul>
14333 </li>
14334 </ul>
14335 </div>
14336
14337 <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>
14338 <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>
14339 <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>
14340 <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>
14341 <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>
14342 <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>
14343
14344 !! end
14345
14346 !! test
14347 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14348 !! options
14349 wgMaxTocLevel=3
14350 !! wikitext
14351 ==Section 1==
14352 ===Section 1.1===
14353 ====Section 1.1.1====
14354 ====Section 1.1.1.1====
14355 ==Section 2==
14356 !! html
14357 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14358 <ul>
14359 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14360 <ul>
14361 <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>
14362 </ul>
14363 </li>
14364 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14365 </ul>
14366 </div>
14367
14368 <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>
14369 <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>
14370 <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>
14371 <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>
14372 <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>
14373
14374 !! end
14375
14376
14377 !! test
14378 Resolving duplicate section names
14379 !! wikitext
14380 == Foo bar ==
14381 == Foo bar ==
14382 !! html
14383 <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>
14384 <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>
14385
14386 !! end
14387
14388 !! test
14389 Resolving duplicate section names with differing case (bug 10721)
14390 !! wikitext
14391 == Foo bar ==
14392 == Foo Bar ==
14393 !! html
14394 <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>
14395 <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>
14396
14397 !! end
14398
14399 !! article
14400 Template:sections
14401 !! text
14402 ===Section 1===
14403 ==Section 2==
14404 !! endarticle
14405
14406 !! test
14407 Template with sections, __NOTOC__
14408 !! wikitext
14409 __NOTOC__
14410 ==Section 0==
14411 {{sections}}
14412 ==Section 4==
14413 !! html
14414 <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>
14415 <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>
14416 <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>
14417 <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>
14418
14419 !! end
14420
14421 !! test
14422 __NOEDITSECTION__ keyword
14423 !! wikitext
14424 __NOEDITSECTION__
14425 ==Section 1==
14426 ==Section 2==
14427 !! html
14428 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14429 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14430
14431 !! end
14432
14433 !! test
14434 Link inside a section heading
14435 !! wikitext
14436 ==Section with a [[Main Page|link]] in it==
14437 !! html
14438 <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>
14439
14440 !! end
14441
14442 !! test
14443 TOC regression (T14077)
14444 !! wikitext
14445 __TOC__
14446 == title 1 ==
14447 === title 1.1 ===
14448 == title 2 ==
14449 !! html
14450 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14451 <ul>
14452 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14453 <ul>
14454 <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>
14455 </ul>
14456 </li>
14457 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14458 </ul>
14459 </div>
14460
14461 <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>
14462 <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>
14463 <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>
14464
14465 !! end
14466
14467 !! test
14468 BUG 1219 URL next to image (good)
14469 !! wikitext
14470 http://example.com [[File:Foobar.jpg]]
14471 !! html/php
14472 <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>
14473 </p>
14474 !! html/parsoid
14475 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14476 !!end
14477
14478 !! test
14479 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14480 !! wikitext
14481 ===
14482 The line above must have a trailing space!
14483 === <!--
14484 --> <!-- -->
14485 But just in case it doesn't...
14486 !! html
14487 <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>
14488 <p>The line above must have a trailing space!
14489 </p>
14490 <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>
14491 <p>But just in case it doesn't...
14492 </p>
14493 !! end
14494
14495 !! test
14496 Header with special characters (bug 25462)
14497 !! wikitext
14498 The tooltips shall not show entities to the user (ie. be double escaped)
14499
14500 == text > text ==
14501 section 1
14502
14503 == text < text ==
14504 section 2
14505
14506 == text & text ==
14507 section 3
14508
14509 == text ' text ==
14510 section 4
14511
14512 == text " text ==
14513 section 5
14514 !! html
14515 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14516 </p>
14517 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14518 <ul>
14519 <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>
14520 <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>
14521 <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>
14522 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14523 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14524 </ul>
14525 </div>
14526
14527 <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 &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14528 <p>section 1
14529 </p>
14530 <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>
14531 <p>section 2
14532 </p>
14533 <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>
14534 <p>section 3
14535 </p>
14536 <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>
14537 <p>section 4
14538 </p>
14539 <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>
14540 <p>section 5
14541 </p>
14542 !! end
14543
14544 !! test
14545 Header with space, plus and underscore as entity
14546 !! wikitext
14547 Id should not contain + for spaces
14548
14549 == Space between Text ==
14550 section 1
14551
14552 == Space-Entity&#32;between&#32;Text ==
14553 section 2
14554
14555 == Plus+between+Text ==
14556 section 3
14557
14558 == Plus-Entity&#43;between&#43;Text ==
14559 section 4
14560
14561 == Underscore_between_Text ==
14562 section 5
14563
14564 == Underscore-Entity&#95;between&#95;Text ==
14565 section 6
14566
14567 [[#Space between Text]]
14568 [[#Space-Entity&#32;between&#32;Text]]
14569 [[#Plus+between+Text]]
14570 [[#Plus-Entity&#43;between&#43;Text]]
14571 [[#Underscore_between_Text]]
14572 [[#Underscore-Entity&#95;between&#95;Text]]
14573 !! html
14574 <p>Id should not contain + for spaces
14575 </p>
14576 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14577 <ul>
14578 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
14579 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
14580 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
14581 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
14582 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
14583 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
14584 </ul>
14585 </div>
14586
14587 <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14588 <p>section 1
14589 </p>
14590 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14591 <p>section 2
14592 </p>
14593 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14594 <p>section 3
14595 </p>
14596 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14597 <p>section 4
14598 </p>
14599 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14600 <p>section 5
14601 </p>
14602 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14603 <p>section 6
14604 </p><p><a href="#Space_between_Text">#Space between Text</a>
14605 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14606 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14607 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14608 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14609 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14610 </p>
14611 !! end
14612
14613 !! test
14614 Headers with excess '=' characters
14615 (Are similar tests necessary beyond the 1st level?)
14616 !! wikitext
14617 =foo==
14618 ==foo=
14619 =''italic'' heading==
14620 ==''italic'' heading=
14621 !! html
14622 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14623 <ul>
14624 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14625 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14626 <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>
14627 <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>
14628 </ul>
14629 </div>
14630
14631 <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>
14632 <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>
14633 <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>
14634 <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>
14635
14636 !! end
14637
14638 !! test
14639 HTML headers vs TOC (bug 23393)
14640 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14641 !! wikitext
14642 <h1>Header 1</h1>
14643 == Header 1.1 ==
14644 == Header 1.2 ==
14645
14646 <h1>Header 2
14647 </h1>
14648 == Header 2.1 ==
14649 == Header 2.2 ==
14650 __NOEDITSECTION__
14651 !! html
14652 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14653 <ul>
14654 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14655 <ul>
14656 <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>
14657 <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>
14658 </ul>
14659 </li>
14660 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14661 <ul>
14662 <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>
14663 <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>
14664 </ul>
14665 </li>
14666 </ul>
14667 </div>
14668
14669 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14670 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14671 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14672 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14673 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14674 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14675
14676 !! end
14677
14678 !! test
14679 Single-line or multiline-comments can follow headings
14680 !! options
14681 parsoid=wt2html,wt2wt
14682 !! wikitext
14683 ==foo==<!---->
14684 ==bar==<!--c1-->
14685 ==baz==<!--
14686 c2
14687 c3-->
14688 !! html
14689 <h2><span class="mw-headline" id="foo">foo</span></h2>
14690 <h2><span class="mw-headline" id="bar">bar</span></h2>
14691 <h2><span class="mw-headline" id="baz">baz</span></h2>
14692
14693 !! end
14694
14695 !! test
14696 BUG 1219 URL next to image (broken)
14697 !! wikitext
14698 http://example.com[[File:Foobar.jpg]]
14699 !! html/php
14700 <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>
14701 </p>
14702 !! html/parsoid
14703 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14704 !!end
14705
14706 !! test
14707 Bug 1186 news: in the middle of text
14708 !! wikitext
14709 http://en.wikinews.org/wiki/Wikinews:Workplace
14710 !! html
14711 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14712 </p>
14713 !!end
14714
14715
14716 !! test
14717 Namespaced link must have a title
14718 !! wikitext
14719 [[Project:]]
14720 !! html
14721 <p>[[Project:]]
14722 </p>
14723 !!end
14724
14725 !! test
14726 Namespaced link must have a title (bad fragment version)
14727 !! wikitext
14728 [[Project:#fragment]]
14729 !! html
14730 <p>[[Project:#fragment]]
14731 </p>
14732 !!end
14733
14734
14735 ###
14736 ### HTML tags and HTML attributes
14737 ###
14738
14739 !! test
14740 div with no attributes
14741 !! wikitext
14742 <div>HTML rocks</div>
14743 !! html
14744 <div>HTML rocks</div>
14745
14746 !! end
14747
14748 !! test
14749 div with double-quoted attribute
14750 !! wikitext
14751 <div id="rock">HTML rocks</div>
14752 !! html
14753 <div id="rock">HTML rocks</div>
14754
14755 !! end
14756
14757 !! test
14758 div with single-quoted attribute
14759 !! wikitext
14760 <div id='rock'>HTML rocks</div>
14761 !! html
14762 <div id="rock">HTML rocks</div>
14763
14764 !! end
14765
14766 !! test
14767 div with unquoted attribute
14768 !! wikitext
14769 <div id=rock>HTML rocks</div>
14770 !! html
14771 <div id="rock">HTML rocks</div>
14772
14773 !! end
14774
14775 !! test
14776 div with illegal double attributes
14777 !! wikitext
14778 <div id="a" id="b">HTML rocks</div>
14779 !! html
14780 <div id="b">HTML rocks</div>
14781
14782 !!end
14783
14784 # FIXME: produce empty string instead of "class" in the PHP parser, following
14785 # the HTML5 spec.
14786 !! test
14787 div with empty attribute value, space before equals
14788 !! options
14789 parsoid
14790 !! wikitext
14791 <div class =>HTML rocks</div>
14792 !! html
14793 <div class="">HTML rocks</div>
14794
14795 !! end
14796
14797 !! test
14798 div with multiple empty attribute values
14799 !! options
14800 parsoid
14801 !! wikitext
14802 <div id= title=>HTML rocks</div>
14803 !! html
14804 <div id="" title="">HTML rocks</div>
14805
14806 !! end
14807
14808 !! test
14809 table with multiple empty attribute values
14810 !! options
14811 parsoid
14812 !! wikitext
14813 {| title= id=
14814 | hi
14815 |}
14816 !! html
14817 <table title="" id="">
14818 <tbody><tr><td> hi</td></tr>
14819 </tbody></table>
14820 !! end
14821
14822 !! test
14823 div with braces in attribute value
14824 !! wikitext
14825 <div title="{}">Foo</div>
14826 !! html/php
14827 <div title="&#123;}">Foo</div>
14828
14829 !! html/parsoid
14830 <div title="{}">Foo</div>
14831 !! end
14832
14833 # This it very inconsistent in the PHP parser: it returns
14834 # class="class" if there is a space between the name and the equal sign (see
14835 # 'div with empty attribute value, space before equals'), but strips the
14836 # attribute completely if the space is missing. We hope that not much content
14837 # depends on this, so are implementing the behavior below in Parsoid for
14838 # consistencies' sake.
14839 # FIXME: fix this behavior in the PHP parser?
14840 !! test
14841 div with empty attribute value, no space before equals
14842 !! options
14843 parsoid=wt2html,html2html
14844 !! wikitext
14845 <div class=>HTML rocks</div>
14846 !! html/php
14847 <div>HTML rocks</div>
14848
14849 !! html/parsoid
14850 <div class="">HTML rocks</div>
14851 !! end
14852
14853 !! test
14854 HTML multiple attributes correction
14855 !! wikitext
14856 <p class="error" class="awesome">Awesome!</p>
14857 !! html
14858 <p class="awesome">Awesome!</p>
14859
14860 !!end
14861
14862 !! test
14863 Table multiple attributes correction
14864 !! wikitext
14865 {|
14866 !+ class="error" class="awesome"| status
14867 |}
14868 !! html
14869 <table>
14870 <tr>
14871 <th class="awesome"> status
14872 </th></tr></table>
14873
14874 !!end
14875
14876 !! test
14877 DIV IN UPPERCASE
14878 !! wikitext
14879 <DIV ID="x">HTML ROCKS</DIV>
14880 !! html
14881 <div id="x">HTML ROCKS</div>
14882
14883 !!end
14884
14885 !! test
14886 Non-ASCII pseudo-tags are rendered as text
14887 !! wikitext
14888 <khyô>
14889 !! html
14890 <p>&lt;khyô&gt;
14891 </p>
14892 !! end
14893
14894 !! test
14895 Pseudo-tag with URL 'name' renders as url link
14896 !! wikitext
14897 <http://example.com/>
14898 !! html
14899 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
14900 </p>
14901 !! end
14902
14903 !! test
14904 text with amp in the middle of nowhere
14905 !! wikitext
14906 Remember AT&T?
14907 !! html
14908 <p>Remember AT&amp;T?
14909 </p>
14910 !! end
14911
14912 !! test
14913 text with character entity: eacute
14914 !! wikitext
14915 I always thought &eacute; was a cute letter.
14916 !! html
14917 <p>I always thought &#233; was a cute letter.
14918 </p>
14919 !! html+tidy
14920 <p>I always thought é was a cute letter.</p>
14921 !! end
14922
14923 !! test
14924 text with entity-escaped character entity-like string: eacute
14925 !! wikitext
14926 I always thought &amp;eacute; was a cute letter.
14927 !! html
14928 <p>I always thought &amp;eacute; was a cute letter.
14929 </p>
14930 !! end
14931
14932 !! test
14933 text with undefined character entity: xacute
14934 !! wikitext
14935 I always thought &xacute; was a cute letter.
14936 !! html
14937 <p>I always thought &amp;xacute; was a cute letter.
14938 </p>
14939 !! end
14940
14941 # TODO: generalize to PHP parser?
14942 !! test
14943 HTML5 tags
14944 !! options
14945 parsoid
14946 !! wikitext
14947 <data value="5">five</data>
14948 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14949 <mark>This highlighted text</mark>
14950 !! html
14951 <p><data value="5">five</data>
14952 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
14953 <mark>This highlighted text</mark></p>
14954 !! end
14955
14956 !! test
14957 HTML tag with leading space is parsed as text
14958 !! wikitext
14959 < div>foo< /div>
14960 !! html
14961 <p>&lt; div&gt;foo&lt; /div&gt;
14962 </p>
14963 !! end
14964
14965 ###
14966 ### Nesting tests (see bug 41545, 50604, 51081)
14967 ###
14968
14969 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
14970 # Note that html2wt is considerably more difficult if we use <b> in
14971 # the test case, instead of <big>
14972 !! test
14973 Ensure that HTML adoption agency algorithm is properly implemented.
14974 !! wikitext
14975 <big>X<big>Y</big>Z</big>
14976 !! html
14977 <p><big>X<big>Y</big>Z</big>
14978 </p>
14979 !! end
14980
14981 # This was bug 41545 in the PHP parser.
14982 # Note that tidy doesn't handle this correctly.
14983 !! test
14984 Nesting of <kbd>
14985 !! wikitext
14986 <kbd>X<kbd>Y</kbd>Z</kbd>
14987 !! html
14988 <p><kbd>X<kbd>Y</kbd>Z</kbd>
14989 </p>
14990 !! end
14991
14992 # The following cases were bug 51081 in the PHP parser.
14993 # Note that there are some other nestable tags (b, i, etc) which are
14994 # not covered; see bug 51081 for discussion.
14995
14996 # Note that tidy doesn't handle this correctly.
14997 !! test
14998 Nesting of <em>
14999 !! wikitext
15000 <em>X<em>Y</em>Z</em>
15001 !! html
15002 <p><em>X<em>Y</em>Z</em>
15003 </p>
15004 !! end
15005
15006 # Note that tidy doesn't handle this correctly.
15007 !! test
15008 Nesting of <strong>
15009 !! wikitext
15010 <strong>X<strong>Y</strong>Z</strong>
15011 !! html
15012 <p><strong>X<strong>Y</strong>Z</strong>
15013 </p>
15014 !! end
15015
15016 !! test
15017 Nesting of <q>
15018 !! wikitext
15019 <q>X<q>Y</q>Z</q>
15020 !! html+tidy
15021 <p><q>X<q>Y</q>Z</q></p>
15022 !! end
15023
15024 # Note that tidy doesn't handle this correctly.
15025 !! test
15026 Nesting of <ruby>
15027 !! wikitext
15028 <ruby>X<ruby>Y</ruby>Z</ruby>
15029 !! html
15030 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15031 </p>
15032 !! end
15033
15034 # Note that tidy doesn't handle this correctly.
15035 !! test
15036 Nesting of <bdo>
15037 !! wikitext
15038 <bdo>X<bdo>Y</bdo>Z</bdo>
15039 !! html
15040 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15041 </p>
15042 !! end
15043
15044
15045 ###
15046 ### Media links
15047 ###
15048
15049 !! test
15050 Media link
15051 !! wikitext
15052 [[Media:Foobar.jpg]]
15053 !! html
15054 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15055 </p>
15056 !! end
15057
15058 !! test
15059 Media link with text
15060 !! wikitext
15061 [[Media:Foobar.jpg|A neat file to look at]]
15062 !! html
15063 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15064 </p>
15065 !! end
15066
15067 # FIXME: this is still bad HTML tag nesting
15068 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15069 !! test
15070 Media link with nasty text
15071 !! wikitext
15072 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15073 !! html
15074 <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>
15075
15076 !! html+tidy
15077 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15078 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15079 !! end
15080
15081 !! test
15082 Media link to nonexistent file (bug 1702)
15083 !! wikitext
15084 [[Media:No such.jpg]]
15085 !! html
15086 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15087 </p>
15088 !! end
15089
15090 !! test
15091 Image link to nonexistent file (bug 1850 - good)
15092 !! wikitext
15093 [[File:No_such.jpg]]
15094 !! html/php
15095 <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>
15096 </p>
15097 !! html/parsoid
15098 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
15099 !! end
15100
15101 !! test
15102 :Image link to nonexistent file (bug 1850 - bad)
15103 !! wikitext
15104 [[:Image:No such.jpg]]
15105 !! html/php
15106 <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>
15107 </p>
15108 !! html/parsoid
15109 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15110 !! end
15111
15112
15113
15114 !! test
15115 Character reference normalization in link text (bug 1938)
15116 !! wikitext
15117 [[Main Page|this&that]]
15118 !! html
15119 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15120 </p>
15121 !!end
15122
15123 !! article
15124 אַ
15125 !! text
15126 Test for unicode normalization
15127
15128 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15129 !! endarticle
15130
15131 !! test
15132 (bug 19451) Links should refer to the normalized form.
15133 !! wikitext
15134 [[&#xFB2E;]]
15135 [[&#x5d0;&#x5b7;]]
15136 [[&#x5d0;ַ]]
15137 [[א&#x5b7;]]
15138 [[אַ]]
15139 !! html
15140 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15141 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15142 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15143 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15144 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15145 </p>
15146 !! end
15147
15148 !! test
15149 Empty attribute crash test (bug 2067)
15150 !! wikitext
15151 <font color="">foo</font>
15152 !! html
15153 <p><font color="">foo</font>
15154 </p>
15155 !! end
15156
15157 !! test
15158 Empty attribute crash test single-quotes (bug 2067)
15159 !! wikitext
15160 <font color=''>foo</font>
15161 !! html
15162 <p><font color="">foo</font>
15163 </p>
15164 !! end
15165
15166 !! test
15167 Attribute test: equals, then nothing
15168 !! wikitext
15169 <font color=>foo</font>
15170 !! html
15171 <p><font>foo</font>
15172 </p>
15173 !! end
15174
15175 !! test
15176 Attribute test: unquoted value
15177 !! wikitext
15178 <font color=x>foo</font>
15179 !! html
15180 <p><font color="x">foo</font>
15181 </p>
15182 !! end
15183
15184 !! test
15185 Attribute test: unquoted but illegal value (hash)
15186 !! wikitext
15187 <font color=#x>foo</font>
15188 !! html
15189 <p><font color="#x">foo</font>
15190 </p>
15191 !! end
15192
15193 # Parsoid does not serialize to empty attribute syntax,
15194 # so wt2wt and html2wt cases are skipped
15195 !! test
15196 Attribute test: no value (T54330)
15197 !! options
15198 parsoid=wt2html,html2html
15199 !! wikitext
15200 <font color>foo</font>
15201 !! html/php
15202 <p><font color="">foo</font>
15203 </p>
15204 !! html/parsoid
15205 <p><font color="">foo</font></p>
15206 !! end
15207
15208 !! test
15209 Bug 2095: link with three closing brackets
15210 !! wikitext
15211 [[Main Page]]]
15212 !! html/php
15213 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15214 </p>
15215 !! html/parsoid
15216 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15217 !! end
15218
15219 !! test
15220 Bug 2095: link with pipe and three closing brackets
15221 !! wikitext
15222 [[Main Page|link]]]
15223 !! html/php
15224 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15225 </p>
15226 !! html/parsoid
15227 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15228 !! end
15229
15230 !! test
15231 Bug 2095: link with pipe and three closing brackets, version 2
15232 !! wikitext
15233 [[Main Page|[http://example.com/]]]
15234 !! html/php
15235 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15236 </p>
15237 !! html/parsoid
15238 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15239 !! end
15240
15241
15242 ###
15243 ### Safety
15244 ###
15245
15246 !! article
15247 Template:Dangerous attribute
15248 !! text
15249 " onmouseover="alert(document.cookie)
15250 !! endarticle
15251
15252 !! article
15253 Template:Dangerous style attribute
15254 !! text
15255 border-size: expression(alert(document.cookie))
15256 !! endarticle
15257
15258 !! article
15259 Template:Div style
15260 !! text
15261 <div style="float: right; {{{1}}}">Magic div</div>
15262 !! endarticle
15263
15264 !! test
15265 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15266 !! wikitext
15267 <div title="{{test}}"></div>
15268 !! html
15269 <div title="This is a test template"></div>
15270
15271 !! end
15272
15273 # Parsoid has enough context to handle this case
15274 !! test
15275 Bug 2304: HTML attribute safety (dangerous template; 2309)
15276 !! wikitext
15277 <div title="{{dangerous attribute}}"></div>
15278 !! html/php
15279 <div title=""></div>
15280
15281 !! html/parsoid
15282 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15283 !! end
15284
15285 !! test
15286 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15287 !! wikitext
15288 <div style="{{dangerous style attribute}}"></div>
15289 !! html
15290 <div style="/* insecure input */"></div>
15291
15292 !! end
15293
15294 !! test
15295 Bug 2304: HTML attribute safety (safe parameter; 2309)
15296 !! wikitext
15297 {{div style|width: 200px}}
15298 !! html
15299 <div style="float: right; width: 200px">Magic div</div>
15300
15301 !! end
15302
15303 !! test
15304 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15305 !! wikitext
15306 {{div style|width: expression(alert(document.cookie))}}
15307 !! html
15308 <div style="/* insecure input */">Magic div</div>
15309
15310 !! end
15311
15312 !! test
15313 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15314 !! wikitext
15315 {{div style|"><script>alert(document.cookie)</script>}}
15316 !! html
15317 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15318
15319 !! end
15320
15321 !! test
15322 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15323 !! wikitext
15324 {{div style|" ><script>alert(document.cookie)</script>}}
15325 !! html
15326 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15327
15328 !! end
15329
15330 !! test
15331 Bug 2304: HTML attribute safety (link)
15332 !! wikitext
15333 <div title="[[Main Page]]"></div>
15334 !! html
15335 <div title="&#91;&#91;Main Page]]"></div>
15336
15337 !! end
15338
15339 !! test
15340 Bug 2304: HTML attribute safety (italics)
15341 !! wikitext
15342 <div title="''foobar''"></div>
15343 !! html
15344 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15345
15346 !! end
15347
15348 !! test
15349 Bug 2304: HTML attribute safety (bold)
15350 !! wikitext
15351 <div title="'''foobar'''"></div>
15352 !! html
15353 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15354
15355 !! end
15356
15357
15358 !! test
15359 Bug 2304: HTML attribute safety (ISBN)
15360 !! wikitext
15361 <div title="ISBN 1234567890"></div>
15362 !! html
15363 <div title="&#73;SBN 1234567890"></div>
15364
15365 !! end
15366
15367 !! test
15368 Bug 2304: HTML attribute safety (RFC)
15369 !! wikitext
15370 <div title="RFC 1234"></div>
15371 !! html
15372 <div title="&#82;FC 1234"></div>
15373
15374 !! end
15375
15376 !! test
15377 Bug 2304: HTML attribute safety (PMID)
15378 !! wikitext
15379 <div title="PMID 1234567890"></div>
15380 !! html
15381 <div title="&#80;MID 1234567890"></div>
15382
15383 !! end
15384
15385 !! test
15386 Bug 2304: HTML attribute safety (web link)
15387 !! wikitext
15388 <div title="http://example.com/"></div>
15389 !! html
15390 <div title="http&#58;//example.com/"></div>
15391
15392 !! end
15393
15394 !! test
15395 Bug 2304: HTML attribute safety (named web link)
15396 !! wikitext
15397 <div title="[http://example.com/ link]"></div>
15398 !! html
15399 <div title="&#91;http&#58;//example.com/ link]"></div>
15400
15401 !! end
15402
15403 !! test
15404 Bug 3244: HTML attribute safety (extension; safe)
15405 !! wikitext
15406 <div style="<nowiki>background:blue</nowiki>"></div>
15407 !! html
15408 <div style="background:blue"></div>
15409
15410 !! end
15411
15412 !! test
15413 Bug 3244: HTML attribute safety (extension; unsafe)
15414 !! wikitext
15415 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15416 !! html
15417 <div style="/* insecure input */"></div>
15418
15419 !! end
15420
15421 # More MSIE fun discovered by Tom Gilder
15422
15423 !! test
15424 MSIE CSS safety test: spurious slash
15425 !! wikitext
15426 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15427 !! html
15428 <div style="/* insecure input */">evil</div>
15429
15430 !! end
15431
15432 !! test
15433 MSIE CSS safety test: hex code
15434 !! wikitext
15435 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15436 !! html
15437 <div style="/* insecure input */">evil</div>
15438
15439 !! end
15440
15441 !! test
15442 MSIE CSS safety test: comment in url
15443 !! wikitext
15444 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15445 !! html
15446 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15447
15448 !! end
15449
15450 !! test
15451 MSIE CSS safety test: comment in expression
15452 !! wikitext
15453 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15454 !! html
15455 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15456
15457 !! end
15458
15459 !! test
15460 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15461 !! wikitext
15462 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15463 !! html
15464 <p style="/* invalid control char */">A</p>
15465
15466 !! end
15467
15468 !! test
15469 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15470 !! wikitext
15471 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15472 <div style="top:EXPRESSION(alert())">B</div>
15473 !! html
15474 <p style="/* insecure input */">A</p>
15475 <div style="/* insecure input */">B</div>
15476
15477 !! end
15478
15479 !! test
15480 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15481 !! wikitext
15482 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15483 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15484 !! html
15485 <div style="/* insecure input */">A</div>
15486 <p style="/* insecure input */">B</p>
15487
15488 !! end
15489
15490 !! test
15491 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15492 !! wikitext
15493 <div style="background-image:url⁽javascript:alert())">A</div>
15494 <div style="background-image:url₍javascript:alert())">B</div>
15495 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15496 !! html
15497 <div style="/* insecure input */">A</div>
15498 <div style="/* insecure input */">B</div>
15499 <p style="/* insecure input */">C</p>
15500
15501 !! end
15502
15503 !! test
15504 Opera -o-link CSS
15505 !! wikitext
15506 <div
15507 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;"
15508 style="-o-link:attr(title);-o-link-source:current">X</div>
15509 !! html
15510 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15511
15512 !! end
15513
15514 !! test
15515 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15516 !! wikitext
15517 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15518 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15519 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15520 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15521 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15522 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15523 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15524 !! html
15525 <p style="/* insecure input */">A</p>
15526 <p style="/* insecure input */">B</p>
15527 <p style="/* insecure input */">C</p>
15528 <p style="/* insecure input */">D</p>
15529 <p style="/* insecure input */">E</p>
15530 <p style="/* insecure input */">F</p>
15531 <p style="/* insecure input */">G</p>
15532
15533 !! end
15534
15535 !! test
15536 Table attribute legitimate extension
15537 !! wikitext
15538 {|
15539 !+ style="<nowiki>color:blue</nowiki>"| status
15540 |}
15541 !! html
15542 <table>
15543 <tr>
15544 <th style="color:blue"> status
15545 </th></tr></table>
15546
15547 !!end
15548
15549 !! test
15550 Table attribute safety
15551 !! wikitext
15552 {|
15553 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15554 |}
15555 !! html
15556 <table>
15557 <tr>
15558 <th style="/* insecure input */"> status
15559 </th></tr></table>
15560
15561 !! end
15562
15563 !! test
15564 CSS line continuation 1
15565 !! wikitext
15566 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15567 !! html
15568 <div style="/* insecure input */"></div>
15569
15570 !! end
15571
15572 !! test
15573 CSS line continuation 2
15574 !! wikitext
15575 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15576 !! html
15577 <div style="/* insecure input */"></div>
15578
15579 !! end
15580
15581 !! article
15582 Template:Identity
15583 !! text
15584 {{{1}}}
15585 !! endarticle
15586
15587 !! test
15588 Expansion of multi-line templates in attribute values (bug 6255)
15589 !! wikitext
15590 <div style="background: {{identity|#00FF00}}">-</div>
15591 !! html
15592 <div style="background: #00FF00">-</div>
15593
15594 !! end
15595
15596
15597 !! test
15598 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15599 !! wikitext
15600 <div style="background:
15601 #00FF00">-</div>
15602 !! html/php
15603 <div style="background: #00FF00">-</div>
15604
15605 !! html/parsoid
15606 <div style="background:
15607 #00FF00">-</div>
15608 !! end
15609
15610 !! test
15611 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15612 !! wikitext
15613 <div style="background: &#10;#00FF00">-</div>
15614 !! html
15615 <div style="background: &#10;#00FF00">-</div>
15616
15617 !! end
15618
15619 !! test
15620 evil <math>-wiki-tags without Extension:Math enabled
15621 !! wikitext
15622 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15623 !! html+tidy
15624 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
15625 !! end
15626
15627 ###
15628 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15629 ###
15630 !! test
15631 Parser hook: empty input
15632 !! wikitext
15633 <tag></tag>
15634 !! html
15635 <pre>
15636 ''
15637 array (
15638 )
15639 </pre>
15640
15641 !! end
15642
15643 !! test
15644 Parser hook: empty input using terminated empty elements
15645 !! wikitext
15646 <tag/>
15647 !! html
15648 <pre>
15649 NULL
15650 array (
15651 )
15652 </pre>
15653
15654 !! end
15655
15656 !! test
15657 Parser hook: empty input using terminated empty elements (space before)
15658 !! wikitext
15659 <tag />
15660 !! html
15661 <pre>
15662 NULL
15663 array (
15664 )
15665 </pre>
15666
15667 !! end
15668
15669 !! test
15670 Parser hook: basic input
15671 !! wikitext
15672 <tag>input</tag>
15673 !! html
15674 <pre>
15675 'input'
15676 array (
15677 )
15678 </pre>
15679
15680 !! end
15681
15682
15683 !! test
15684 Parser hook: case insensitive
15685 !! wikitext
15686 <TAG>input</TAG>
15687 !! html
15688 <pre>
15689 'input'
15690 array (
15691 )
15692 </pre>
15693
15694 !! end
15695
15696
15697 !! test
15698 Parser hook: case insensitive, redux
15699 !! wikitext
15700 <TaG>input</TAg>
15701 !! html
15702 <pre>
15703 'input'
15704 array (
15705 )
15706 </pre>
15707
15708 !! end
15709
15710 !! test
15711 Parser hook: nested tags
15712 !! options
15713 noxml
15714 !! wikitext
15715 <tag><tag></tag></tag>
15716 !! html
15717 <pre>
15718 '<tag>'
15719 array (
15720 )
15721 </pre>&lt;/tag&gt;
15722
15723 !! end
15724
15725 !! test
15726 Parser hook: basic arguments
15727 !! wikitext
15728 <tag width=200 height = "100" depth = '50' square></tag>
15729 !! html
15730 <pre>
15731 ''
15732 array (
15733 'width' => '200',
15734 'height' => '100',
15735 'depth' => '50',
15736 'square' => '',
15737 )
15738 </pre>
15739
15740 !! end
15741
15742 !! test
15743 Parser hook: argument containing a forward slash (bug 5344)
15744 !! wikitext
15745 <tag filename='/tmp/bla'></tag>
15746 !! html
15747 <pre>
15748 ''
15749 array (
15750 'filename' => '/tmp/bla',
15751 )
15752 </pre>
15753
15754 !! end
15755
15756 !! test
15757 Parser hook: empty input using terminated empty elements (bug 2374)
15758 !! wikitext
15759 <tag foo=bar/>text
15760 !! html
15761 <pre>
15762 NULL
15763 array (
15764 'foo' => 'bar',
15765 )
15766 </pre>text
15767
15768 !! end
15769
15770 # </tag> should be output literally since there is no matching tag that begins it
15771 !! test
15772 Parser hook: basic arguments using terminated empty elements (bug 2374)
15773 !! wikitext
15774 <tag width=200 height = "100" depth = '50' square/>
15775 other stuff
15776 </tag>
15777 !! html
15778 <pre>
15779 NULL
15780 array (
15781 'width' => '200',
15782 'height' => '100',
15783 'depth' => '50',
15784 'square' => '',
15785 )
15786 </pre>
15787 <p>other stuff
15788 &lt;/tag&gt;
15789 </p>
15790 !! end
15791
15792 ###
15793 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15794 ###
15795
15796 !! test
15797 Parser hook: static parser hook not inside a comment
15798 !! wikitext
15799 <statictag>hello, world</statictag>
15800 <statictag action=flush/>
15801 !! html
15802 <p>hello, world
15803 </p>
15804 !! end
15805
15806
15807 !! test
15808 Parser hook: static parser hook inside a comment
15809 !! wikitext
15810 <!-- <statictag>hello, world</statictag> -->
15811 <statictag action=flush/>
15812 !! html
15813 <p><br />
15814 </p>
15815 !! end
15816
15817 # Nested template calls; this case was broken by Parser.php rev 1.506,
15818 # since reverted.
15819
15820 !! article
15821 Template:One-parameter
15822 !! text
15823 (My parameter is: {{{1}}})
15824 !! endarticle
15825
15826 !! article
15827 Template:Map-one-parameter
15828 !! text
15829 {{{{{1}}}|{{{2}}}}}
15830 !! endarticle
15831
15832 !! test
15833 Nested template calls
15834 !! wikitext
15835 {{Map-one-parameter|One-parameter|param}}
15836 !! html
15837 <p>(My parameter is: param)
15838 </p>
15839 !! end
15840
15841
15842 ###
15843 ### Sanitizer
15844 ###
15845
15846 # HTML+Tidy effectively strips out the empty tags completely
15847 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
15848 # which Tidy would have done for the PHP parser had there been content inside it.
15849 !! test
15850 Sanitizer: Closing of open tags
15851 !! wikitext
15852 <s></s><table></table>
15853 !! html
15854 <s></s><table></table>
15855
15856 !! html/parsoid
15857 <p><s></s></p><table></table>
15858 !! end
15859
15860 !! test
15861 Sanitizer: Closing of open but not closed tags
15862 !! wikitext
15863 <s>foo
15864 !! html
15865 <p><s>foo</s>
15866 </p>
15867 !! end
15868
15869 !! test
15870 Sanitizer: Closing of closed but not open tags
15871 !! wikitext
15872 </s>
15873 !! html
15874 <p>&lt;/s&gt;
15875 </p>
15876 !! end
15877
15878 !! test
15879 Sanitizer: Closing of closed but not open table tags
15880 !! wikitext
15881 Table not started</td></tr></table>
15882 !! html
15883 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
15884 </p>
15885 !! end
15886
15887 !! test
15888 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
15889 !! wikitext
15890 <span id="æ: v">byte</span>[[#æ: v|backlink]]
15891 !! html
15892 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
15893 </p>
15894 !! end
15895
15896 # In HTML5, the restrictions are that id must contain at least one character,
15897 # and must not contain any space characters.
15898 !! test
15899 Sanitizer: Validating the contents of the id attribute (bug 4515)
15900 !! options
15901 disabled
15902 !! wikitext
15903 <br id="" /><br id="a space" />
15904 !! html
15905 Something ...
15906 !! end
15907
15908 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
15909 !! test
15910 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
15911 !! options
15912 disabled
15913 !! wikitext
15914 <br id="foo" /><br id="foo" />
15915 !! html
15916 Something need to be done. foo-2 ?
15917 !! end
15918
15919 !! test
15920 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
15921 !! wikitext
15922 <div itemscope>
15923 <meta itemprop="hello" content="world">
15924 <meta http-equiv="refresh" content="5">
15925 <meta itemprop="hello" http-equiv="refresh" content="5">
15926 <link itemprop="hello" href="{{SERVER}}">
15927 <link rel="stylesheet" href="{{SERVER}}">
15928 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
15929 </div>
15930 !! html
15931 <div itemscope="">
15932 <p> <meta itemprop="hello" content="world" />
15933 &lt;meta http-equiv="refresh" content="5"&gt;
15934 <meta itemprop="hello" content="5" />
15935 </p>
15936 <link itemprop="hello" href="http&#58;//example.org" />
15937 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
15938 <link itemprop="hello" href="http&#58;//example.org" />
15939 </div>
15940
15941 !! end
15942
15943 !! test
15944 Language converter: output gets cut off unexpectedly (bug 5757)
15945 !! options
15946 language=zh
15947 !! wikitext
15948 this bit is safe: }-
15949
15950 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
15951
15952 then we get cut off here: }-
15953
15954 all additional text is vanished
15955 !! html
15956 <p>this bit is safe: }-
15957 </p><p>but if we add a conversion instance: xxx
15958 </p><p>then we get cut off here: }-
15959 </p><p>all additional text is vanished
15960 </p>
15961 !! end
15962
15963 !! test
15964 Self closed html pairs (bug 5487)
15965 !! options
15966 !! wikitext
15967 <center><font id="bug" />Centered text</center>
15968 <div><font id="bug2" />In div text</div>
15969 !! html
15970 <center>&lt;font id="bug" /&gt;Centered text</center>
15971 <div>&lt;font id="bug2" /&gt;In div text</div>
15972
15973 !! end
15974
15975 #
15976 #
15977 #
15978
15979 !! test
15980 Punctuation: nbsp before exclamation
15981 !! wikitext
15982 C'est grave !
15983 !! html
15984 <p>C'est grave&#160;!
15985 </p>
15986 !! end
15987
15988 !! test
15989 Punctuation: CSS !important (bug 11874)
15990 !! wikitext
15991 <div style="width:50% !important">important</div>
15992 !! html
15993 <div style="width:50% !important">important</div>
15994
15995 !!end
15996
15997 !! test
15998 Punctuation: CSS ! important (bug 11874; with space after)
15999 !! wikitext
16000 <div style="width:50% ! important">important</div>
16001 !! html
16002 <div style="width:50% ! important">important</div>
16003
16004 !!end
16005
16006 !! test
16007 HTML bullet list, closed tags (bug 5497)
16008 !! wikitext
16009 <ul>
16010 <li>One</li>
16011 <li>Two</li>
16012 </ul>
16013 !! html/php
16014 <ul>
16015 <li>One</li>
16016 <li>Two</li>
16017 </ul>
16018
16019 !! html/parsoid
16020 <ul data-parsoid='{"stx":"html"}'>
16021 <li data-parsoid='{"stx":"html"}'>One</li>
16022 <li data-parsoid='{"stx":"html"}'>Two</li>
16023 </ul>
16024
16025 !! end
16026
16027 !! test
16028 HTML bullet list, unclosed tags (bug 5497)
16029 !! wikitext
16030 <ul>
16031 <li>One
16032 <li>Two
16033 </ul>
16034 !! html/php+tidy
16035 <ul>
16036 <li>One</li>
16037 <li>Two</li>
16038 </ul>
16039 !! html/parsoid
16040 <ul data-parsoid='{"stx":"html"}'>
16041 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16042 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16043 </ul>
16044
16045 !! end
16046
16047 !! test
16048 HTML ordered list, closed tags (bug 5497)
16049 !! wikitext
16050 <ol>
16051 <li>One</li>
16052 <li>Two</li>
16053 </ol>
16054 !! html/php
16055 <ol>
16056 <li>One</li>
16057 <li>Two</li>
16058 </ol>
16059
16060 !! html/parsoid
16061 <ol data-parsoid='{"stx":"html"}'>
16062 <li data-parsoid='{"stx":"html"}'>One</li>
16063 <li data-parsoid='{"stx":"html"}'>Two</li>
16064 </ol>
16065
16066 !! end
16067
16068 !! test
16069 HTML ordered list, unclosed tags (bug 5497)
16070 !! options
16071 !! wikitext
16072 <ol>
16073 <li>One
16074 <li>Two
16075 </ol>
16076 !! html/php+tidy
16077 <ol>
16078 <li>One</li>
16079 <li>Two</li>
16080 </ol>
16081 !! html/parsoid
16082 <ol data-parsoid='{"stx":"html"}'>
16083 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16084 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16085 </ol>
16086
16087 !! end
16088
16089 !! test
16090 HTML nested bullet list, closed tags (bug 5497)
16091 !! wikitext
16092 <ul>
16093 <li>One</li>
16094 <li>Two:
16095 <ul>
16096 <li>Sub-one</li>
16097 <li>Sub-two</li>
16098 </ul>
16099 </li>
16100 </ul>
16101 !! html
16102 <ul>
16103 <li>One</li>
16104 <li>Two:
16105 <ul>
16106 <li>Sub-one</li>
16107 <li>Sub-two</li>
16108 </ul>
16109 </li>
16110 </ul>
16111
16112 !! end
16113
16114 !! test
16115 HTML nested bullet list, open tags (bug 5497)
16116 !! wikitext
16117 <ul>
16118 <li>One
16119 <li>Two:
16120 <ul>
16121 <li>Sub-one
16122 <li>Sub-two
16123 </ul>
16124 </ul>
16125 !! html/php+tidy
16126 <ul>
16127 <li>One</li>
16128 <li>Two:
16129 <ul>
16130 <li>Sub-one</li>
16131 <li>Sub-two</li>
16132 </ul>
16133 </li>
16134 </ul>
16135 !! html/parsoid
16136 <ul>
16137 <li>One
16138 </li>
16139 <li>Two:
16140 <ul>
16141 <li>Sub-one
16142 </li>
16143 <li>Sub-two
16144 </li>
16145 </ul>
16146 </li>
16147 </ul>
16148
16149 !! end
16150
16151 !! test
16152 HTML nested ordered list, closed tags (bug 5497)
16153 !! wikitext
16154 <ol>
16155 <li>One</li>
16156 <li>Two:
16157 <ol>
16158 <li>Sub-one</li>
16159 <li>Sub-two</li>
16160 </ol>
16161 </li>
16162 </ol>
16163 !! html
16164 <ol>
16165 <li>One</li>
16166 <li>Two:
16167 <ol>
16168 <li>Sub-one</li>
16169 <li>Sub-two</li>
16170 </ol>
16171 </li>
16172 </ol>
16173
16174 !! end
16175
16176 !! test
16177 HTML nested ordered list, open tags (bug 5497)
16178 !! wikitext
16179 <ol>
16180 <li>One
16181 <li>Two:
16182 <ol>
16183 <li>Sub-one
16184 <li>Sub-two
16185 </ol>
16186 </ol>
16187 !! html/php
16188 <ol>
16189 <li>One
16190 <li>Two:
16191 <ol>
16192 <li>Sub-one
16193 <li>Sub-two
16194 </ol>
16195 </ol>
16196
16197 !! html/parsoid
16198 <ol>
16199 <li>One
16200 </li>
16201 <li>Two:
16202 <ol>
16203 <li>Sub-one
16204 </li>
16205 <li>Sub-two
16206 </li>
16207 </ol>
16208 </li>
16209 </ol>
16210
16211 !! end
16212
16213 !! test
16214 HTML ordered list item with parameters oddity
16215 !! wikitext
16216 <ol><li id="fragment">One</li>
16217 </ol>
16218 !! html
16219 <ol><li id="fragment">One</li>
16220 </ol>
16221
16222 !! end
16223
16224 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16225 !!test
16226 bug 5918: autonumbering
16227 !! wikitext
16228 [http://first/] [http://second] [ftp://ftp]
16229
16230 ftp://inlineftp
16231
16232 [mailto:enclosed@mail.tld With target]
16233
16234 [mailto:enclosed@mail.tld]
16235
16236 mailto:inline@mail.tld
16237 !! html/php
16238 <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>
16239 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16240 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16241 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16242 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16243 </p>
16244 !! html/parsoid
16245 <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>
16246 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16247 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16248 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16249 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16250 !! end
16251
16252
16253 #
16254 # Security and HTML correctness
16255 # From Nick Jenkins' fuzz testing
16256 #
16257
16258 !! test
16259 Fuzz testing: Parser13
16260 !! wikitext
16261 {|
16262 | http://a|
16263 !! html
16264 <table>
16265 <tr>
16266 <td>
16267 </td>
16268 </tr>
16269 </table>
16270
16271 !! end
16272
16273 !! test
16274 Fuzz testing: Parser14
16275 !! wikitext
16276 == onmouseover= ==
16277 http://__TOC__
16278 !! html
16279 <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>
16280 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16281 <ul>
16282 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16283 </ul>
16284 </div>
16285
16286
16287 !! html+tidy
16288 <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>
16289 <p>http://</p>
16290 <div id="toc" class="toc">
16291 <div id="toctitle">
16292 <h2>Contents</h2>
16293 </div>
16294 <ul>
16295 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16296 </ul>
16297 </div>
16298 <p></p>
16299 !! end
16300
16301 !! test
16302 Fuzz testing: Parser14-table
16303 !! wikitext
16304 ==a==
16305 {| STYLE=__TOC__
16306 !! html
16307 <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>
16308 <table style="&#95;_TOC&#95;_">
16309 <tr><td></td></tr>
16310 </table>
16311
16312 !! html+tidy
16313 <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>
16314 <table style="__TOC__">
16315 <tr>
16316 <td></td>
16317 </tr>
16318 </table>
16319 !! end
16320
16321 # Known to produce bogus xml (extra </td>)
16322 !! test
16323 Fuzz testing: Parser16
16324 !! options
16325 noxml
16326 !! wikitext
16327 {|
16328 !https://||||||
16329 !! html
16330 <table>
16331 <tr>
16332 <th>https://</th>
16333 <th></th>
16334 <th></th>
16335 <th>
16336 </td>
16337 </tr>
16338 </table>
16339
16340 !! html+tidy
16341 <table>
16342 <tr>
16343 <th>https://</th>
16344 <th></th>
16345 <th></th>
16346 <th></th>
16347 </tr>
16348 </table>
16349 !! end
16350
16351 !! test
16352 Fuzz testing: Parser21
16353 !! wikitext
16354 {|
16355 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16356 |
16357 !! html
16358 <table>
16359 <tr>
16360 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16361 </th>
16362 <td>
16363 </td>
16364 </tr>
16365 </table>
16366
16367 !! end
16368
16369 !! test
16370 Fuzz testing: Parser22
16371 !! wikitext
16372 http://===r:::https://b
16373
16374 {|
16375 !! html
16376 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16377 </p>
16378 <table>
16379 <tr><td></td></tr>
16380 </table>
16381
16382 !! end
16383
16384 # Known to produce bad XML for now
16385 !! test
16386 Fuzz testing: Parser24
16387 !! options
16388 noxml
16389 !! wikitext
16390 {|
16391 {{{|
16392 <u CLASS=
16393 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16394 <br style="onmouseover='alert(document.cookie);' " />
16395
16396 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16397 |
16398 !! html
16399 <table>
16400 {{{|
16401 <u class="&#124;">}}}} &gt;
16402 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16403
16404 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16405 <tr>
16406 <td></u>
16407 </td>
16408 </tr>
16409 </table>
16410
16411 !! end
16412
16413 # Note: the current result listed for this is not what the original one was,
16414 # but the original bug was JavaScript injection, which is fixed in any case.
16415 # It's not clear that the original result listed was any more correct than the
16416 # current one. Original result:
16417 # <p>{{{|
16418 # </p>
16419 # <li class="&#124;&#124;">
16420 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16421 !!test
16422 Fuzz testing: Parser25 (bug 6055)
16423 !! wikitext
16424 {{{
16425 |
16426 <LI CLASS=||
16427 >
16428 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16429 !! html
16430 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16431 </p>
16432 !! end
16433
16434 !!test
16435 Fuzz testing: URL adjacent extension (with space, clean)
16436 !! wikitext
16437 http://example.com <nowiki>junk</nowiki>
16438 !! html/php
16439 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16440 </p>
16441 !! html/parsoid
16442 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16443 !! end
16444
16445 !!test
16446 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16447 !! wikitext
16448 http://example.com<nowiki>junk</nowiki>
16449 !! html/php
16450 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16451 </p>
16452 !! html/parsoid
16453 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16454 !! end
16455
16456 !!test
16457 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16458 !! wikitext
16459 http://example.com<pre>junk</pre>
16460 !! html/php
16461 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16462
16463 !! html/php+tidy
16464 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16465 <pre>
16466 junk
16467 </pre>
16468 !! html/parsoid
16469 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
16470 !!end
16471
16472 !!test
16473 Fuzz testing: image with bogus manual thumbnail
16474 !! wikitext
16475 [[Image:foobar.jpg|thumbnail= ]]
16476 !! html/php
16477 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16478
16479 !! html/parsoid
16480 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
16481 !!end
16482
16483 !! test
16484 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16485 !! wikitext
16486 <pre dir="&#10;"></pre>
16487 !! html
16488 <pre dir="&#10;"></pre>
16489
16490 !! end
16491
16492 !! test
16493 Parsing optional HTML elements (Bug 6171)
16494 !! options
16495 !! wikitext
16496 <table>
16497 <tr>
16498 <td> Some tabular data</td>
16499 <td> More tabular data ...
16500 <td> And yet som tabular data</td>
16501 </tr>
16502 </table>
16503 !! html
16504 <table>
16505 <tr>
16506 <td> Some tabular data</td>
16507 <td> More tabular data ...
16508 </td><td> And yet som tabular data</td>
16509 </tr>
16510 </table>
16511
16512 !! end
16513
16514 !! test
16515 Correct handling of <td>, <tr> (Bug 6171)
16516 !! options
16517 !! wikitext
16518 <table>
16519 <tr>
16520 <td> Some tabular data</td>
16521 <td> More tabular data ...</td>
16522 <td> And yet som tabular data</td>
16523 </tr>
16524 </table>
16525 !! html
16526 <table>
16527 <tr>
16528 <td> Some tabular data</td>
16529 <td> More tabular data ...</td>
16530 <td> And yet som tabular data</td>
16531 </tr>
16532 </table>
16533
16534 !! end
16535
16536
16537 !! test
16538 Parsing crashing regression (fr:JavaScript)
16539 !! wikitext
16540 </body></x>
16541 !! html
16542 <p>&lt;/body&gt;&lt;/x&gt;
16543 </p>
16544 !! end
16545
16546 !! test
16547 Inline wiki vs wiki block nesting
16548 !! wikitext
16549 '''Bold paragraph
16550
16551 New wiki paragraph
16552 !! html
16553 <p><b>Bold paragraph</b>
16554 </p><p>New wiki paragraph
16555 </p>
16556 !! end
16557
16558 # FIXME: The current php output is documented
16559 # and desired output is the parsoid target.
16560 !! test
16561 Inline HTML vs wiki block nesting
16562 !! wikitext
16563 <b>Bold paragraph
16564
16565 New wiki paragraph
16566 !! html/php
16567 <p><b>Bold paragraph
16568 </p><p>New wiki paragraph</b>
16569 </p>
16570 !! html/parsoid
16571 <p><b>Bold paragraph</b>
16572 </p><p>New wiki paragraph
16573 </p>
16574 !! end
16575
16576 # Original result was this:
16577 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16578 # </p>
16579 # While that might be marginally more intuitive, maybe, the six-apostrophe
16580 # construct is clearly pathological and the result stated here (which is what
16581 # the parser actually does) is about as reasonable as anything.
16582 !!test
16583 Mixing markup for italics and bold
16584 !! options
16585 !! wikitext
16586 '''bold''''''bold''bolditalics'''''
16587 !! html
16588 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16589 </p>
16590 !! end
16591
16592
16593 !! article
16594 Xyzzyx
16595 !! text
16596 Article for special page transclusion test
16597 !! endarticle
16598
16599 !! test
16600 Special page transclusion
16601 !! options
16602 !! wikitext
16603 {{Special:Prefixindex/Xyzzyx}}
16604 !! html
16605 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16606
16607 !! end
16608
16609 !! test
16610 Special page transclusion twice (bug 5021)
16611 !! options
16612 !! wikitext
16613 {{Special:Prefixindex/Xyzzyx}}
16614 {{Special:Prefixindex/Xyzzyx}}
16615 !! html
16616 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16617 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16618
16619 !! end
16620
16621 !! test
16622 Transclusion of default MediaWiki message
16623 !! wikitext
16624 {{MediaWiki:Mainpage}}
16625 !! html
16626 <p>Main Page
16627 </p>
16628 !! end
16629
16630 !! test
16631 Transclusion of nonexistent MediaWiki message
16632 !! wikitext
16633 {{MediaWiki:Mainpagexxx}}
16634 !! html
16635 <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>
16636 </p>
16637 !! end
16638
16639 !! test
16640 Transclusion of MediaWiki message with underscore
16641 !! wikitext
16642 {{MediaWiki:history_short}}
16643 !! html
16644 <p>History
16645 </p>
16646 !! end
16647
16648 !! test
16649 Transclusion of MediaWiki message with space
16650 !! wikitext
16651 {{MediaWiki:history short}}
16652 !! html
16653 <p>History
16654 </p>
16655 !! end
16656
16657 !! test
16658 Invalid header with following text
16659 !! wikitext
16660 = x = y
16661 !! html
16662 <p>= x = y
16663 </p>
16664 !! end
16665
16666
16667 !! test
16668 Section extraction test (section 0)
16669 !! options
16670 section=0
16671 !! wikitext
16672 start
16673 ==a==
16674 ===aa===
16675 ====aaa====
16676 ==b==
16677 ===ba===
16678 ===bb===
16679 ====bba====
16680 ===bc===
16681 ==c==
16682 ===ca===
16683 !! html
16684 start
16685 !! end
16686
16687 !! test
16688 Section extraction test (section 1)
16689 !! options
16690 section=1
16691 !! wikitext
16692 start
16693 ==a==
16694 ===aa===
16695 ====aaa====
16696 ==b==
16697 ===ba===
16698 ===bb===
16699 ====bba====
16700 ===bc===
16701 ==c==
16702 ===ca===
16703 !! html
16704 ==a==
16705 ===aa===
16706 ====aaa====
16707 !! end
16708
16709 !! test
16710 Section extraction test (section 2)
16711 !! options
16712 section=2
16713 !! wikitext
16714 start
16715 ==a==
16716 ===aa===
16717 ====aaa====
16718 ==b==
16719 ===ba===
16720 ===bb===
16721 ====bba====
16722 ===bc===
16723 ==c==
16724 ===ca===
16725 !! html
16726 ===aa===
16727 ====aaa====
16728 !! end
16729
16730 !! test
16731 Section extraction test (section 3)
16732 !! options
16733 section=3
16734 !! wikitext
16735 start
16736 ==a==
16737 ===aa===
16738 ====aaa====
16739 ==b==
16740 ===ba===
16741 ===bb===
16742 ====bba====
16743 ===bc===
16744 ==c==
16745 ===ca===
16746 !! html
16747 ====aaa====
16748 !! end
16749
16750 !! test
16751 Section extraction test (section 4)
16752 !! options
16753 section=4
16754 !! wikitext
16755 start
16756 ==a==
16757 ===aa===
16758 ====aaa====
16759 ==b==
16760 ===ba===
16761 ===bb===
16762 ====bba====
16763 ===bc===
16764 ==c==
16765 ===ca===
16766 !! html
16767 ==b==
16768 ===ba===
16769 ===bb===
16770 ====bba====
16771 ===bc===
16772 !! end
16773
16774 !! test
16775 Section extraction test (section 5)
16776 !! options
16777 section=5
16778 !! wikitext
16779 start
16780 ==a==
16781 ===aa===
16782 ====aaa====
16783 ==b==
16784 ===ba===
16785 ===bb===
16786 ====bba====
16787 ===bc===
16788 ==c==
16789 ===ca===
16790 !! html
16791 ===ba===
16792 !! end
16793
16794 !! test
16795 Section extraction test (section 6)
16796 !! options
16797 section=6
16798 !! wikitext
16799 start
16800 ==a==
16801 ===aa===
16802 ====aaa====
16803 ==b==
16804 ===ba===
16805 ===bb===
16806 ====bba====
16807 ===bc===
16808 ==c==
16809 ===ca===
16810 !! html
16811 ===bb===
16812 ====bba====
16813 !! end
16814
16815 !! test
16816 Section extraction test (section 7)
16817 !! options
16818 section=7
16819 !! wikitext
16820 start
16821 ==a==
16822 ===aa===
16823 ====aaa====
16824 ==b==
16825 ===ba===
16826 ===bb===
16827 ====bba====
16828 ===bc===
16829 ==c==
16830 ===ca===
16831 !! html
16832 ====bba====
16833 !! end
16834
16835 !! test
16836 Section extraction test (section 8)
16837 !! options
16838 section=8
16839 !! wikitext
16840 start
16841 ==a==
16842 ===aa===
16843 ====aaa====
16844 ==b==
16845 ===ba===
16846 ===bb===
16847 ====bba====
16848 ===bc===
16849 ==c==
16850 ===ca===
16851 !! html
16852 ===bc===
16853 !! end
16854
16855 !! test
16856 Section extraction test (section 9)
16857 !! options
16858 section=9
16859 !! wikitext
16860 start
16861 ==a==
16862 ===aa===
16863 ====aaa====
16864 ==b==
16865 ===ba===
16866 ===bb===
16867 ====bba====
16868 ===bc===
16869 ==c==
16870 ===ca===
16871 !! html
16872 ==c==
16873 ===ca===
16874 !! end
16875
16876 !! test
16877 Section extraction test (section 10)
16878 !! options
16879 section=10
16880 !! wikitext
16881 start
16882 ==a==
16883 ===aa===
16884 ====aaa====
16885 ==b==
16886 ===ba===
16887 ===bb===
16888 ====bba====
16889 ===bc===
16890 ==c==
16891 ===ca===
16892 !! html
16893 ===ca===
16894 !! end
16895
16896 !! test
16897 Section extraction test (nonexistent section 11)
16898 !! options
16899 section=11
16900 !! wikitext
16901 start
16902 ==a==
16903 ===aa===
16904 ====aaa====
16905 ==b==
16906 ===ba===
16907 ===bb===
16908 ====bba====
16909 ===bc===
16910 ==c==
16911 ===ca===
16912 !! html
16913 !! end
16914
16915 !! test
16916 Section extraction test with bogus heading (section 1)
16917 !! options
16918 section=1
16919 !! wikitext
16920 ==a==
16921 ==bogus== not a legal section
16922 ==b==
16923 !! html
16924 ==a==
16925 ==bogus== not a legal section
16926 !! end
16927
16928 !! test
16929 Section extraction test with bogus heading (section 2)
16930 !! options
16931 section=2
16932 !! wikitext
16933 ==a==
16934 ==bogus== not a legal section
16935 ==b==
16936 !! html
16937 ==b==
16938 !! end
16939
16940 !! test
16941 Section extraction test with comment after heading (section 1)
16942 !! options
16943 section=1
16944 !! wikitext
16945 ==a==
16946 ==b== <!-- -->
16947 ==c==
16948 !! html
16949 ==a==
16950 !! end
16951
16952 !! test
16953 Section extraction test with comment after heading (section 2)
16954 !! options
16955 section=2
16956 !! wikitext
16957 ==a==
16958 ==b== <!-- -->
16959 ==c==
16960 !! html
16961 ==b== <!-- -->
16962 !! end
16963
16964 !! test
16965 Section extraction test with bogus <nowiki> heading (section 1)
16966 !! options
16967 section=1
16968 !! wikitext
16969 ==a==
16970 ==bogus== <nowiki>not a legal section</nowiki>
16971 ==b==
16972 !! html
16973 ==a==
16974 ==bogus== <nowiki>not a legal section</nowiki>
16975 !! end
16976
16977 !! test
16978 Section extraction test with bogus <nowiki> heading (section 2)
16979 !! options
16980 section=2
16981 !! wikitext
16982 ==a==
16983 ==bogus== <nowiki>not a legal section</nowiki>
16984 ==b==
16985 !! html
16986 ==b==
16987 !! end
16988
16989
16990 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
16991 # instead of respecting commented sections
16992 !! test
16993 Section extraction prefixed by comment (section 1)
16994 !! options
16995 section=1
16996 !! wikitext
16997 <!-- -->==sec1==
16998 ==sec2==
16999 !! html
17000 ==sec2==
17001 !!end
17002
17003 !! test
17004 Section extraction prefixed by comment (section 2)
17005 !! options
17006 section=2
17007 !! wikitext
17008 <!-- -->==sec1==
17009 ==sec2==
17010 !! html
17011
17012 !!end
17013
17014
17015 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17016 # instead of respecting HTML-style headings
17017 !! test
17018 Section extraction, mixed wiki and html (section 1)
17019 !! options
17020 section=1
17021 !! wikitext
17022 <h2>unmarked</h2>
17023 unmarked
17024 ==1==
17025 one
17026 ==2==
17027 two
17028 !! html
17029 ==1==
17030 one
17031 !! end
17032
17033 !! test
17034 Section extraction, mixed wiki and html (section 2)
17035 !! options
17036 section=2
17037 !! wikitext
17038 <h2>unmarked</h2>
17039 unmarked
17040 ==1==
17041 one
17042 ==2==
17043 two
17044 !! html
17045 ==2==
17046 two
17047 !! end
17048
17049
17050 # Formerly testing for bug 3342
17051 !! test
17052 Section extraction, heading surrounded by <noinclude>
17053 !! options
17054 section=1
17055 !! wikitext
17056 <noinclude>==unmarked==</noinclude>
17057 ==marked==
17058 !! html
17059 ==marked==
17060 !!end
17061
17062 # Test behavior of bug 19910
17063 !! test
17064 Sectiion with all-equals
17065 !! options
17066 section=2
17067 !! wikitext
17068 ===
17069 The line above must have a trailing space
17070 === <!--
17071 --> <!-- -->
17072 But just in case it doesn't...
17073 !! html
17074 === <!--
17075 --> <!-- -->
17076 But just in case it doesn't...
17077 !! end
17078
17079 !! test
17080 Section replacement test (section 0)
17081 !! options
17082 replace=0,"xxx"
17083 !! wikitext
17084 start
17085 ==a==
17086 ===aa===
17087 ====aaa====
17088 ==b==
17089 ===ba===
17090 ===bb===
17091 ====bba====
17092 ===bc===
17093 ==c==
17094 ===ca===
17095 !! html
17096 xxx
17097
17098 ==a==
17099 ===aa===
17100 ====aaa====
17101 ==b==
17102 ===ba===
17103 ===bb===
17104 ====bba====
17105 ===bc===
17106 ==c==
17107 ===ca===
17108 !! end
17109
17110 !! test
17111 Section replacement test (section 1)
17112 !! options
17113 replace=1,"xxx"
17114 !! wikitext
17115 start
17116 ==a==
17117 ===aa===
17118 ====aaa====
17119 ==b==
17120 ===ba===
17121 ===bb===
17122 ====bba====
17123 ===bc===
17124 ==c==
17125 ===ca===
17126 !! html
17127 start
17128 xxx
17129
17130 ==b==
17131 ===ba===
17132 ===bb===
17133 ====bba====
17134 ===bc===
17135 ==c==
17136 ===ca===
17137 !! end
17138
17139 !! test
17140 Section replacement test (section 2)
17141 !! options
17142 replace=2,"xxx"
17143 !! wikitext
17144 start
17145 ==a==
17146 ===aa===
17147 ====aaa====
17148 ==b==
17149 ===ba===
17150 ===bb===
17151 ====bba====
17152 ===bc===
17153 ==c==
17154 ===ca===
17155 !! html
17156 start
17157 ==a==
17158 xxx
17159
17160 ==b==
17161 ===ba===
17162 ===bb===
17163 ====bba====
17164 ===bc===
17165 ==c==
17166 ===ca===
17167 !! end
17168
17169 !! test
17170 Section replacement test (section 3)
17171 !! options
17172 replace=3,"xxx"
17173 !! wikitext
17174 start
17175 ==a==
17176 ===aa===
17177 ====aaa====
17178 ==b==
17179 ===ba===
17180 ===bb===
17181 ====bba====
17182 ===bc===
17183 ==c==
17184 ===ca===
17185 !! html
17186 start
17187 ==a==
17188 ===aa===
17189 xxx
17190
17191 ==b==
17192 ===ba===
17193 ===bb===
17194 ====bba====
17195 ===bc===
17196 ==c==
17197 ===ca===
17198 !! end
17199
17200 !! test
17201 Section replacement test (section 4)
17202 !! options
17203 replace=4,"xxx"
17204 !! wikitext
17205 start
17206 ==a==
17207 ===aa===
17208 ====aaa====
17209 ==b==
17210 ===ba===
17211 ===bb===
17212 ====bba====
17213 ===bc===
17214 ==c==
17215 ===ca===
17216 !! html
17217 start
17218 ==a==
17219 ===aa===
17220 ====aaa====
17221 xxx
17222
17223 ==c==
17224 ===ca===
17225 !! end
17226
17227 !! test
17228 Section replacement test (section 5)
17229 !! options
17230 replace=5,"xxx"
17231 !! wikitext
17232 start
17233 ==a==
17234 ===aa===
17235 ====aaa====
17236 ==b==
17237 ===ba===
17238 ===bb===
17239 ====bba====
17240 ===bc===
17241 ==c==
17242 ===ca===
17243 !! html
17244 start
17245 ==a==
17246 ===aa===
17247 ====aaa====
17248 ==b==
17249 xxx
17250
17251 ===bb===
17252 ====bba====
17253 ===bc===
17254 ==c==
17255 ===ca===
17256 !! end
17257
17258 !! test
17259 Section replacement test (section 6)
17260 !! options
17261 replace=6,"xxx"
17262 !! wikitext
17263 start
17264 ==a==
17265 ===aa===
17266 ====aaa====
17267 ==b==
17268 ===ba===
17269 ===bb===
17270 ====bba====
17271 ===bc===
17272 ==c==
17273 ===ca===
17274 !! html
17275 start
17276 ==a==
17277 ===aa===
17278 ====aaa====
17279 ==b==
17280 ===ba===
17281 xxx
17282
17283 ===bc===
17284 ==c==
17285 ===ca===
17286 !! end
17287
17288 !! test
17289 Section replacement test (section 7)
17290 !! options
17291 replace=7,"xxx"
17292 !! wikitext
17293 start
17294 ==a==
17295 ===aa===
17296 ====aaa====
17297 ==b==
17298 ===ba===
17299 ===bb===
17300 ====bba====
17301 ===bc===
17302 ==c==
17303 ===ca===
17304 !! html
17305 start
17306 ==a==
17307 ===aa===
17308 ====aaa====
17309 ==b==
17310 ===ba===
17311 ===bb===
17312 xxx
17313
17314 ===bc===
17315 ==c==
17316 ===ca===
17317 !! end
17318
17319 !! test
17320 Section replacement test (section 8)
17321 !! options
17322 replace=8,"xxx"
17323 !! wikitext
17324 start
17325 ==a==
17326 ===aa===
17327 ====aaa====
17328 ==b==
17329 ===ba===
17330 ===bb===
17331 ====bba====
17332 ===bc===
17333 ==c==
17334 ===ca===
17335 !! html
17336 start
17337 ==a==
17338 ===aa===
17339 ====aaa====
17340 ==b==
17341 ===ba===
17342 ===bb===
17343 ====bba====
17344 xxx
17345
17346 ==c==
17347 ===ca===
17348 !!end
17349
17350 !! test
17351 Section replacement test (section 9)
17352 !! options
17353 replace=9,"xxx"
17354 !! wikitext
17355 start
17356 ==a==
17357 ===aa===
17358 ====aaa====
17359 ==b==
17360 ===ba===
17361 ===bb===
17362 ====bba====
17363 ===bc===
17364 ==c==
17365 ===ca===
17366 !! html
17367 start
17368 ==a==
17369 ===aa===
17370 ====aaa====
17371 ==b==
17372 ===ba===
17373 ===bb===
17374 ====bba====
17375 ===bc===
17376 xxx
17377 !! end
17378
17379 !! test
17380 Section replacement test (section 10)
17381 !! options
17382 replace=10,"xxx"
17383 !! wikitext
17384 start
17385 ==a==
17386 ===aa===
17387 ====aaa====
17388 ==b==
17389 ===ba===
17390 ===bb===
17391 ====bba====
17392 ===bc===
17393 ==c==
17394 ===ca===
17395 !! html
17396 start
17397 ==a==
17398 ===aa===
17399 ====aaa====
17400 ==b==
17401 ===ba===
17402 ===bb===
17403 ====bba====
17404 ===bc===
17405 ==c==
17406 xxx
17407 !! end
17408
17409 !! test
17410 Section replacement test with initial whitespace (bug 13728)
17411 !! options
17412 replace=2,"xxx"
17413 !! wikitext
17414 Preformatted initial line
17415 ==a==
17416 ===a===
17417 !! html
17418 Preformatted initial line
17419 ==a==
17420 xxx
17421 !! end
17422
17423
17424 !! test
17425 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17426 !! options
17427 section=1
17428 !! wikitext
17429 ==a==
17430 a
17431 !! html
17432 ==a==
17433 a
17434 !! end
17435
17436 !! test
17437 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17438 !! options
17439 section=1
17440 !! wikitext
17441 ==a==
17442 a
17443 !! html
17444 ==a==
17445 a
17446 !! end
17447
17448
17449 !! test
17450 Section extraction, <pre> around bogus header (bug 10309)
17451 !! options
17452 noxml section=2
17453 !! wikitext
17454 == Section One ==
17455 <pre>
17456 =======
17457 </pre>
17458
17459 == Section Two ==
17460 stuff
17461 !! html
17462 == Section Two ==
17463 stuff
17464 !! end
17465
17466 !! test
17467 Section replacement, <pre> around bogus header (bug 10309)
17468 !! options
17469 noxml replace=2,"xxx"
17470 !! wikitext
17471 == Section One ==
17472 <pre>
17473 =======
17474 </pre>
17475
17476 == Section Two ==
17477 stuff
17478 !! html
17479 == Section One ==
17480 <pre>
17481 =======
17482 </pre>
17483
17484 xxx
17485 !! end
17486
17487
17488
17489 !! test
17490 Handling of &#x0A; in URLs
17491 !! wikitext
17492 ** irc://&#x0A;a
17493 !! html/php
17494 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17495
17496 !! html/parsoid
17497 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17498 a">irc://
17499 a</a></li></ul></li></ul>
17500 !! end
17501
17502 !! test
17503 Handling of %0A in URLs
17504 !! wikitext
17505 ** irc://%0Aa
17506 !! html/php
17507 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17508
17509 !! html/parsoid
17510 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17511 !! end
17512
17513
17514 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17515 !! test
17516 5 quotes, code coverage +1 line
17517 !! options
17518 parsoid=wt2html
17519 !! wikitext
17520 '''''
17521 !! html/php
17522 !! html/parsoid
17523 <p><b><i></i></b></p>
17524 !! end
17525
17526 # same html as previous, but wikitext adjusted to match parsoid html2wt
17527 # note that wt2html and html2html will put the <i> before the <b>
17528 !! test
17529 5 quotes, code coverage +1 line w/ nowiki (1)
17530 !! options
17531 parsoid=wt2wt,html2wt
17532 !! wikitext
17533 '''''<nowiki/>'''''
17534 !! html/php
17535 <p><i></i>
17536 </p>
17537 !! html/parsoid
17538 <p><b><i></i></b></p>
17539 !! end
17540
17541 # same as previous, just swapping the <i> and <b>
17542 !! test
17543 5 quotes, code coverage +1 line w/ nowiki (2)
17544 !! wikitext
17545 '''''<nowiki/>'''''
17546 !! html/php
17547 <p><i></i>
17548 </p>
17549 !! html/parsoid
17550 <p><i><b></b></i></p>
17551 !! end
17552
17553 !! test
17554 Special:Search page linking.
17555 !! wikitext
17556 {{Special:search}}
17557 !! html
17558 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17559 </p>
17560 !! end
17561
17562 !! test
17563 {{!}} is a magic word
17564 !! wikitext
17565 {{!}} is a magic word there and {{!}} is still a magic word here
17566 !! html/php
17567 <p>| is a magic word there and | is still a magic word here
17568 </p>
17569 !! html/parsoid
17570 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
17571 !! end
17572
17573 !! test
17574 Say the magic word
17575 !! options
17576 title=[[Parser test]]
17577 !! wikitext
17578 * {{PAGENAME}}
17579 * {{PAGENAMEE}}
17580 * {{FULLPAGENAME}}
17581 * {{FULLPAGENAMEE}}
17582 * {{BASEPAGENAME}}
17583 * {{BASEPAGENAMEE}}
17584 * {{SUBPAGENAME}}
17585 * {{SUBPAGENAMEE}}
17586 * {{ROOTPAGENAME}}
17587 * {{ROOTPAGENAMEE}}
17588 * {{TALKPAGENAME}}
17589 * {{TALKPAGENAMEE}}
17590 * {{SUBJECTPAGENAME}}
17591 * {{SUBJECTPAGENAMEE}}
17592 * {{NAMESPACEE}}
17593 * {{NAMESPACE}}
17594 * {{NAMESPACENUMBER}}
17595 * {{TALKSPACE}}
17596 * {{TALKSPACEE}}
17597 * {{SUBJECTSPACE}}
17598 * {{SUBJECTSPACEE}}
17599 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17600 !! html
17601 <ul><li> Parser test</li>
17602 <li> Parser_test</li>
17603 <li> Parser test</li>
17604 <li> Parser_test</li>
17605 <li> Parser test</li>
17606 <li> Parser_test</li>
17607 <li> Parser test</li>
17608 <li> Parser_test</li>
17609 <li> Parser test</li>
17610 <li> Parser_test</li>
17611 <li> Talk:Parser test</li>
17612 <li> Talk:Parser_test</li>
17613 <li> Parser test</li>
17614 <li> Parser_test</li>
17615 <li> </li>
17616 <li> </li>
17617 <li> 0</li>
17618 <li> Talk</li>
17619 <li> Talk</li>
17620 <li> </li>
17621 <li> </li>
17622 <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>
17623
17624 !! end
17625 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17626
17627 !! test
17628 Gallery
17629 !! wikitext
17630 <gallery>
17631 image1.png |
17632 image2.gif|||||
17633
17634 image3|
17635 image4 |300px| centre
17636 image5.svg| http://///////
17637 [[x|xx]]]]
17638 * image6
17639 </gallery>
17640 !! html
17641 <ul class="gallery mw-gallery-traditional">
17642 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17643 <div class="thumb" style="height: 150px;">Image1.png</div>
17644 <div class="gallerytext">
17645 </div>
17646 </div></li>
17647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17648 <div class="thumb" style="height: 150px;">Image2.gif</div>
17649 <div class="gallerytext">
17650 <p>||||
17651 </p>
17652 </div>
17653 </div></li>
17654 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17655 <div class="thumb" style="height: 150px;">Image3</div>
17656 <div class="gallerytext">
17657 </div>
17658 </div></li>
17659 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17660 <div class="thumb" style="height: 150px;">Image4</div>
17661 <div class="gallerytext">
17662 <p>300px| centre
17663 </p>
17664 </div>
17665 </div></li>
17666 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17667 <div class="thumb" style="height: 150px;">Image5.svg</div>
17668 <div class="gallerytext">
17669 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17670 </p>
17671 </div>
17672 </div></li>
17673 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17674 <div class="thumb" style="height: 150px;">* image6</div>
17675 <div class="gallerytext">
17676 </div>
17677 </div></li>
17678 </ul>
17679
17680 !! end
17681
17682 !! test
17683 Gallery (with options)
17684 !! wikitext
17685 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17686 File:Nonexistent.jpg|caption
17687 File:Nonexistent.jpg
17688 image:foobar.jpg|some '''caption''' [[Main Page]]
17689 image:foobar.jpg
17690 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17691 </gallery>
17692 !! html
17693 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17694 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17695 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17696 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17697 <div class="gallerytext">
17698 <p>caption
17699 </p>
17700 </div>
17701 </div></li>
17702 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17703 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17704 <div class="gallerytext">
17705 </div>
17706 </div></li>
17707 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17708 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17709 <div class="gallerytext">
17710 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17711 </p>
17712 </div>
17713 </div></li>
17714 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17715 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17716 <div class="gallerytext">
17717 </div>
17718 </div></li>
17719 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17720 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
17721 <div class="gallerytext">
17722 <p>Blabla|blabla.
17723 </p>
17724 </div>
17725 </div></li>
17726 </ul>
17727
17728 !! end
17729
17730 !! test
17731 Gallery with link that has fragment
17732 !! wikitext
17733 <gallery>
17734 image:foobar.jpg|link=Main_Page
17735 image:foobar.jpg|link=Main_Page#section
17736 image:foobar.jpg|link=Main Page#section|caption
17737 </gallery>
17738 !! html
17739 <ul class="gallery mw-gallery-traditional">
17740 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17741 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17742 <div class="gallerytext">
17743 </div>
17744 </div></li>
17745 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17746 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17747 <div class="gallerytext">
17748 </div>
17749 </div></li>
17750 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17751 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17752 <div class="gallerytext">
17753 <p>caption
17754 </p>
17755 </div>
17756 </div></li>
17757 </ul>
17758
17759 !! end
17760
17761 !! test
17762 Gallery with wikitext inside caption
17763 !! wikitext
17764 <gallery>
17765 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17766 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17767 </gallery>
17768 !! html
17769 <ul class="gallery mw-gallery-traditional">
17770 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17771 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17772 <div class="gallerytext">
17773 <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>
17774 </p>
17775 </div>
17776 </div></li>
17777 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17778 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17779 <div class="gallerytext">
17780 <p>This is a test template
17781 </p>
17782 </div>
17783 </div></li>
17784 </ul>
17785
17786 !! end
17787
17788 !! test
17789 gallery (with showfilename option)
17790 !! wikitext
17791 <gallery showfilename>
17792 File:Nonexistent.jpg|caption
17793 File:Nonexistent.jpg
17794 image:foobar.jpg|some '''caption''' [[Main Page]]
17795 File:Foobar.jpg
17796 </gallery>
17797 !! html
17798 <ul class="gallery mw-gallery-traditional">
17799 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17800 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17801 <div class="gallerytext">
17802 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17803 caption
17804 </p>
17805 </div>
17806 </div></li>
17807 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17808 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17809 <div class="gallerytext">
17810 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17811 </p>
17812 </div>
17813 </div></li>
17814 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17815 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17816 <div class="gallerytext">
17817 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17818 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17819 </p>
17820 </div>
17821 </div></li>
17822 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17823 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17824 <div class="gallerytext">
17825 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17826 </p>
17827 </div>
17828 </div></li>
17829 </ul>
17830
17831 !! end
17832
17833 !! test
17834 Gallery (with namespace-less filenames)
17835 !! wikitext
17836 <gallery>
17837 File:Nonexistent.jpg
17838 Nonexistent.jpg
17839 image:foobar.jpg
17840 foobar.jpg
17841 </gallery>
17842 !! html
17843 <ul class="gallery mw-gallery-traditional">
17844 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17845 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17846 <div class="gallerytext">
17847 </div>
17848 </div></li>
17849 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17850 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17851 <div class="gallerytext">
17852 </div>
17853 </div></li>
17854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17855 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17856 <div class="gallerytext">
17857 </div>
17858 </div></li>
17859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17860 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
17861 <div class="gallerytext">
17862 </div>
17863 </div></li>
17864 </ul>
17865
17866 !! end
17867
17868 !! test
17869 HTML Hex character encoding (spells the word "JavaScript")
17870 !! options
17871 parsoid=wt2html,wt2wt,html2html
17872 !! wikitext
17873 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
17874 !! html/php
17875 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
17876 </p>
17877 !! html/php+tidy
17878 <p>JavaScript</p>
17879 !! html/parsoid
17880 <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>
17881 !! end
17882
17883 !! test
17884 HTML Hex character encoding bogus encoding (bug 26437 regression check)
17885 !! wikitext
17886 &#xsee;&#XSEE;
17887 !! html/php
17888 <p>&amp;#xsee;&amp;#XSEE;
17889 </p>
17890 !! html/parsoid
17891 <p>&amp;#xsee;&amp;#XSEE;</p>
17892 !! end
17893
17894 !! test
17895 HTML Hex character encoding mixed case
17896 !! options
17897 parsoid=wt2html,wt2wt,html2html
17898 !! wikitext
17899 &#xEE;&#Xee;
17900 !! html/php
17901 <p>&#xee;&#xee;
17902 </p>
17903 !! html/php+tidy
17904 <p>îî</p>
17905 !! html/parsoid
17906 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
17907 !! end
17908
17909 !! test
17910 __FORCETOC__ override
17911 !! wikitext
17912 __NEWSECTIONLINK__
17913 __FORCETOC__
17914 !! html/php
17915 <p><br />
17916 </p>
17917 !! end
17918
17919 !! test
17920 ISBN code coverage
17921 !! wikitext
17922 ISBN 978-0-1234-56&#x20;789
17923 !! html
17924 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
17925 </p>
17926 !! html+tidy
17927 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
17928 !! html/parsoid
17929 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
17930 !! end
17931
17932 !! test
17933 ISBN followed by 5 spaces
17934 !! wikitext
17935 ISBN
17936 !! html
17937 <p>ISBN
17938 </p>
17939 !! end
17940
17941 !! test
17942 Double ISBN
17943 !! wikitext
17944 ISBN ISBN 1234567890
17945 !! html/php
17946 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17947 </p>
17948 !! html/parsoid
17949 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
17950 !! end
17951
17952 !! test
17953 ISBN with an X
17954 !! wikitext
17955 ISBN 3-462-04561-X
17956 ISBN 080442957X
17957 ISBN 978080442957X
17958 !! html/php
17959 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
17960 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
17961 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
17962 </p>
17963 !! html/parsoid
17964 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
17965 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
17966 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a></p>
17967 !! end
17968
17969 !! test
17970 ISBN with empty prefix (parsoid test)
17971 !! wikitext
17972 ISBN 1234567890
17973 !! html/php
17974 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17975 </p>
17976 !! html/parsoid
17977 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
17978 !! end
17979
17980 !! test
17981 Bug 22905: <abbr> followed by ISBN followed by </a>
17982 !! wikitext
17983 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
17984 !! html/php
17985 <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>
17986 </p>
17987 !! html/parsoid
17988 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
17989 !! end
17990
17991 !! test
17992 Double RFC
17993 !! wikitext
17994 RFC RFC 1234
17995 !! html
17996 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
17997 </p>
17998 !! end
17999
18000 !! test
18001 Double RFC with a wiki link
18002 !! wikitext
18003 RFC [[RFC 1234]]
18004 !! html
18005 <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>
18006 </p>
18007 !! end
18008
18009 !! test
18010 RFC code coverage
18011 !! wikitext
18012 RFC 983&#x20;987
18013 !! html
18014 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18015 </p>
18016 !! html+tidy
18017 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18018 !! end
18019
18020 !! test
18021 Centre-aligned image
18022 !! wikitext
18023 [[Image:foobar.jpg|centre]]
18024 !! html
18025 <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>
18026
18027 !!end
18028
18029 !! test
18030 None-aligned image
18031 !! wikitext
18032 [[Image:foobar.jpg|none]]
18033 !! html
18034 <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>
18035
18036 !!end
18037
18038 !! test
18039 Width + Height sized image (using px) (height is ignored)
18040 !! wikitext
18041 [[Image:foobar.jpg|640x480px]]
18042 !! html
18043 <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>
18044 </p>
18045 !!end
18046
18047 !! test
18048 Width-sized image (using px, no following whitespace)
18049 !! wikitext
18050 [[Image:foobar.jpg|640px]]
18051 !! html
18052 <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>
18053 </p>
18054 !!end
18055
18056 !! test
18057 Width-sized image (using px, with following whitespace - test regression from r39467)
18058 !! wikitext
18059 [[Image:foobar.jpg|640px ]]
18060 !! html
18061 <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>
18062 </p>
18063 !!end
18064
18065 !! test
18066 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18067 !! wikitext
18068 [[Image:foobar.jpg| 640px]]
18069 !! html
18070 <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>
18071 </p>
18072 !!end
18073
18074 !! test
18075 Image with page parameter
18076 !! options
18077 djvu
18078 !! wikitext
18079 [[File:LoremIpsum.djvu|page=2]]
18080 !! html/php
18081 <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>
18082 </p>
18083 !! html/parsoid
18084 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
18085 !! end
18086
18087 !! test
18088 Another italics / bold test
18089 !! wikitext
18090 ''' ''x'
18091 !! html
18092 <pre>'<i> </i>x'
18093 </pre>
18094 !!end
18095
18096 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18097 !! test
18098 dt/dd/dl test
18099 !! wikitext
18100 :;;;::
18101 !! html/php
18102 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18103
18104 !! html/parsoid
18105 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18106
18107 !!end
18108
18109
18110 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18111 !! test
18112 Images with the "|" character in the comment
18113 !! wikitext
18114 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18115 !! html/php
18116 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
18117
18118 !! html/parsoid
18119 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
18120 !! end
18121
18122 !! test
18123 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18124 !! wikitext
18125 <html><script>alert(1);</script></html>
18126 !! html
18127 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18128 </p>
18129 !! end
18130
18131 !! test
18132 HTML with raw HTML ($wgRawHtml==true)
18133 !! options
18134 wgRawHtml=1
18135 !! wikitext
18136 <html><script>alert(1);</script></html>
18137 !! html
18138 <p><script>alert(1);</script>
18139 </p>
18140 !! end
18141
18142 !! test
18143 Parents of subpages, one level up
18144 !! options
18145 subpage title=[[Subpage test/L1/L2/L3]]
18146 !! wikitext
18147 [[../|L2]]
18148 !! html
18149 <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>
18150 </p>
18151 !! end
18152
18153
18154 !! test
18155 Parents of subpages, one level up, not named
18156 !! options
18157 subpage title=[[Subpage test/L1/L2/L3]]
18158 !! wikitext
18159 [[../]]
18160 !! html
18161 <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>
18162 </p>
18163 !! end
18164
18165
18166
18167 !! test
18168 Parents of subpages, two levels up
18169 !! options
18170 subpage title=[[Subpage test/L1/L2/L3]]
18171 !! wikitext
18172 [[../../|L1]]2
18173
18174 [[../../|L1]]l
18175 !! html
18176 <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
18177 </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>
18178 </p>
18179 !! end
18180
18181 !! test
18182 Parents of subpages, two levels up, without trailing slash or name.
18183 !! options
18184 subpage title=[[Subpage test/L1/L2/L3]]
18185 !! wikitext
18186 [[../..]]
18187 !! html
18188 <p>[[../..]]
18189 </p>
18190 !! end
18191
18192 !! test
18193 Parents of subpages, two levels up, with lots of extra trailing slashes.
18194 !! options
18195 subpage title=[[Subpage test/L1/L2/L3]]
18196 !! wikitext
18197 [[../../////]]
18198 !! html
18199 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
18200 </p>
18201 !! end
18202
18203 !! article
18204 Subpage test/L1/L2/L3Sibling
18205 !! text
18206 Sibling article
18207 !! endarticle
18208
18209 !! test
18210 Transclusion of a sibling page (one level up)
18211 !! options
18212 subpage title=[[Subpage test/L1/L2/L3]]
18213 !! wikitext
18214 {{../L3Sibling}}
18215 !! html
18216 <p>Sibling article
18217 </p>
18218 !! end
18219
18220 !! test
18221 Transclusion of a child page
18222 !! options
18223 subpage title=[[Subpage test/L1/L2]]
18224 !! wikitext
18225 {{/L3Sibling}}
18226 !! html
18227 <p>Sibling article
18228 </p>
18229 !! end
18230
18231 !! test
18232 Non-transclusion because of too many up levels
18233 !! options
18234 subpage title=[[Subpage test/L1/L2/L3]]
18235 !! wikitext
18236 {{../../../../More than parent}}
18237 !! html
18238 <p>{{../../../../More than parent}}
18239 </p>
18240 !! end
18241
18242 !! test
18243 Definition list code coverage
18244 !! wikitext
18245 ; title : def
18246 ; title : def
18247 ;title: def
18248 !! html/php
18249 <dl><dt> title &#160;</dt>
18250 <dd> def</dd>
18251 <dt> title&#160;</dt>
18252 <dd> def</dd>
18253 <dt>title</dt>
18254 <dd> def</dd></dl>
18255
18256 !! html/parsoid
18257 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18258 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18259 <dt>title</dt><dd> def</dd></dl>
18260 !! end
18261
18262 !! test
18263 Don't fall for the self-closing div
18264 !! wikitext
18265 <div>hello world</div/>
18266 !! html
18267 <div>hello world</div>
18268
18269 !! end
18270
18271 !! test
18272 MSGNW magic word
18273 !! wikitext
18274 {{MSGNW:msg}}
18275 !! html
18276 <p>&#91;&#91;:Template:Msg&#93;&#93;
18277 </p>
18278 !! end
18279
18280 !! test
18281 RAW magic word
18282 !! wikitext
18283 {{RAW:QUERTY}}
18284 !! html
18285 <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>
18286 </p>
18287 !! end
18288
18289 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18290 !! test
18291 Always escape literal '>' in output, not just after '<'
18292 !! wikitext
18293 ><>
18294 !! html
18295 <p>&gt;&lt;&gt;
18296 </p>
18297 !! end
18298
18299 !! test
18300 Template caching
18301 !! wikitext
18302 {{Test}}
18303 {{Test}}
18304 !! html
18305 <p>This is a test template
18306 This is a test template
18307 </p>
18308 !! end
18309
18310
18311 !! article
18312 MediaWiki:Fake
18313 !! text
18314 ==header==
18315 !! endarticle
18316
18317 !! test
18318 Inclusion of !userCanEdit() content
18319 !! wikitext
18320 {{MediaWiki:Fake}}
18321 !! html
18322 <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>
18323
18324 !! end
18325
18326
18327 !! test
18328 Out-of-order TOC heading levels
18329 !! wikitext
18330 ==2==
18331 ======6======
18332 ===3===
18333 =1=
18334 =====5=====
18335 ==2==
18336 !! html
18337 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18338 <ul>
18339 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18340 <ul>
18341 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18342 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18343 </ul>
18344 </li>
18345 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18346 <ul>
18347 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18348 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18349 </ul>
18350 </li>
18351 </ul>
18352 </div>
18353
18354 <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>
18355 <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>
18356 <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>
18357 <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>
18358 <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>
18359 <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>
18360
18361 !! end
18362
18363
18364 !! test
18365 ISBN with a dummy number
18366 !! wikitext
18367 ISBN ---
18368 !! html
18369 <p>ISBN ---
18370 </p>
18371 !! end
18372
18373
18374 !! test
18375 ISBN with space-delimited number
18376 !! wikitext
18377 ISBN 92 9017 032 8
18378 !! html
18379 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18380 </p>
18381 !! end
18382
18383
18384 !! test
18385 ISBN with multiple spaces, no number
18386 !! wikitext
18387 ISBN foo
18388 !! html
18389 <p>ISBN foo
18390 </p>
18391 !! end
18392
18393
18394 !! test
18395 ISBN length
18396 !! wikitext
18397 ISBN 123456789
18398
18399 ISBN 1234567890
18400
18401 ISBN 12345678901
18402 !! html
18403 <p>ISBN 123456789
18404 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18405 </p><p>ISBN 12345678901
18406 </p>
18407 !! end
18408
18409
18410 !! test
18411 ISBN with trailing year (bug 8110)
18412 !! wikitext
18413 ISBN 1-234-56789-0 - 2006
18414
18415 ISBN 1 234 56789 0 - 2006
18416 !! html
18417 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18418 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18419 </p>
18420 !! end
18421
18422
18423 !! test
18424 anchorencode
18425 !! wikitext
18426 {{anchorencode:foo bar©#%n}}
18427 !! html
18428 <p>foo_bar.C2.A9.23.25n
18429 </p>
18430 !! end
18431
18432 !! test
18433 anchorencode trims spaces
18434 !! wikitext
18435 {{anchorencode: __pretty__please__}}
18436 !! html
18437 <p>pretty_please
18438 </p>
18439 !! end
18440
18441 !! test
18442 anchorencode deals with links
18443 !! wikitext
18444 {{anchorencode: [[hello|world]] [[hi]]}}
18445 !! html
18446 <p>world_hi
18447 </p>
18448 !! end
18449
18450 !! test
18451 anchorencode deals with templates
18452 !! wikitext
18453 {{anchorencode: {{Foo}} }}
18454 !! html
18455 <p>FOO
18456 </p>
18457 !! end
18458
18459 !! test
18460 anchorencode encodes like the TOC generator: (bug 18431)
18461 !! wikitext
18462 === _ +:.3A%3A&&amp;]] ===
18463 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18464 __NOEDITSECTION__
18465 !! html
18466 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18467 <p>.2B:.3A.253A.26.26.5D.5D
18468 </p>
18469 !! end
18470
18471 !! test
18472 Bug 6200: blockquotes and paragraph formatting
18473 !! wikitext
18474 <blockquote>
18475 foo
18476 </blockquote>
18477
18478 bar
18479
18480 baz
18481 !! html
18482 <blockquote>
18483 <p>foo
18484 </p>
18485 </blockquote>
18486 <p>bar
18487 </p>
18488 <pre>baz
18489 </pre>
18490 !! end
18491
18492 !! test
18493 Bug 8293: Use of center tag ruins paragraph formatting
18494 !! wikitext
18495 <center>
18496 foo
18497 </center>
18498
18499 bar
18500
18501 baz
18502 !! html
18503 <center>
18504 <p>foo
18505 </p>
18506 </center>
18507 <p>bar
18508 </p>
18509 <pre>baz
18510 </pre>
18511 !! end
18512
18513 !!test
18514 Parsing of overlapping (improperly nested) inline html tags
18515 !! wikitext
18516 <span><s>x</span></s>
18517 !! html/php
18518 <p><span><s>x&lt;/span&gt;</s></span>
18519 </p>
18520 !! html/parsoid
18521 <p><span><s>x</s></span>
18522 </p>
18523 !!end
18524
18525 ###
18526 ### Language variants related tests
18527 ###
18528 !! test
18529 Self-link in language variants
18530 !! options
18531 title=[[Dunav]] language=sr
18532 !! wikitext
18533 Both [[Dunav]] and [[Дунав]] are names for this river.
18534 !! html
18535 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18536 </p>
18537 !!end
18538
18539 !! article
18540 Дуна
18541 !! text
18542 content
18543 !! endarticle
18544
18545 !! test
18546 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18547 !! options
18548 title=[[Duna]] language=sr
18549 !! wikitext
18550 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18551 !! html
18552 <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.
18553 </p>
18554 !! end
18555
18556 !! test
18557 Link to a section of a variant of this title shouldn't be parsed as self-link
18558 !! options
18559 title=[[Duna]] language=sr
18560 !! wikitext
18561 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18562 !! html
18563 <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.
18564 </p>
18565 !! end
18566
18567 !! test
18568 Link to pages in language variants
18569 !! options
18570 language=sr
18571 !! wikitext
18572 Main Page can be written as [[Маин Паге]]
18573 !! html
18574 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18575 </p>
18576 !!end
18577
18578
18579 !! test
18580 Multiple links to pages in language variants
18581 !! options
18582 language=sr
18583 !! wikitext
18584 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18585 !! html
18586 <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>.
18587 </p>
18588 !!end
18589
18590
18591 !! test
18592 Simple template in language variants
18593 !! options
18594 language=sr
18595 !! wikitext
18596 {{тест}}
18597 !! html
18598 <p>This is a test template
18599 </p>
18600 !! end
18601
18602
18603 !! test
18604 Template with explicit namespace in language variants
18605 !! options
18606 language=sr
18607 !! wikitext
18608 {{Template:тест}}
18609 !! html
18610 <p>This is a test template
18611 </p>
18612 !! end
18613
18614
18615 !! test
18616 Basic test for template parameter in language variants
18617 !! options
18618 language=sr
18619 !! wikitext
18620 {{парамтест|param=foo}}
18621 !! html
18622 <p>This is a test template with parameter foo
18623 </p>
18624 !! end
18625
18626
18627 !! test
18628 Simple category in language variants
18629 !! options
18630 language=sr cat
18631 !! wikitext
18632 [[Category:МедиаWики Усер'с Гуиде]]
18633 !! html
18634 <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>
18635 !! end
18636
18637
18638 !! article
18639 Category:分类
18640 !! text
18641 blah
18642 !! endarticle
18643
18644 !! article
18645 Category:分類
18646 !! text
18647 blah
18648 !! endarticle
18649
18650 !! test
18651 Don't convert blue categorylinks to another variant (bug 33210)
18652 !! options
18653 language=zh cat
18654 !! wikitext
18655 [[A]][[Category:分类]]
18656 !! html
18657 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18658 !! end
18659
18660
18661 !! test
18662 Stripping -{}- tags (language variants)
18663 !! options
18664 language=sr
18665 !! wikitext
18666 Latin proverb: -{Ne nuntium necare}-
18667 !! html
18668 <p>Latin proverb: Ne nuntium necare
18669 </p>
18670 !! end
18671
18672
18673 !! test
18674 Prevent conversion with -{}- tags (language variants)
18675 !! options
18676 language=sr variant=sr-ec
18677 !! wikitext
18678 Latinski: -{Ne nuntium necare}-
18679 !! html
18680 <p>Латински: Ne nuntium necare
18681 </p>
18682 !! end
18683
18684
18685 !! test
18686 Prevent conversion of text with -{}- tags (language variants)
18687 !! options
18688 language=sr variant=sr-ec
18689 !! wikitext
18690 Latinski: -{Ne nuntium necare}-
18691 !! html
18692 <p>Латински: Ne nuntium necare
18693 </p>
18694 !! end
18695
18696
18697 !! test
18698 Prevent conversion of links with -{}- tags (language variants)
18699 !! options
18700 language=sr variant=sr-ec
18701 !! wikitext
18702 -{[[Main Page]]}-
18703 !! html
18704 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18705 </p>
18706 !! end
18707
18708
18709 !! test
18710 -{}- tags within headlines (within html for parserConvert())
18711 !! options
18712 language=sr variant=sr-ec
18713 !! wikitext
18714 == -{Naslov}- ==
18715 !! html
18716 <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>
18717
18718 !! end
18719
18720
18721 !! test
18722 Explicit definition of language variant alternatives
18723 !! options
18724 language=zh variant=zh-tw
18725 !! wikitext
18726 -{zh:China;zh-tw:Taiwan}-, not China
18727 !! html
18728 <p>Taiwan, not China
18729 </p>
18730 !! end
18731
18732
18733 !! test
18734 Conversion around HTML tags
18735 !! options
18736 language=sr variant=sr-ec
18737 !! wikitext
18738 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18739 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18740 !! html
18741 <p>
18742 <span title="ЛаCтин">ски</span>
18743 </p>
18744 !! end
18745
18746
18747 !! test
18748 Explicit session-wise language variant mapping (A flag and - flag)
18749 !! options
18750 language=zh variant=zh-tw
18751 !! wikitext
18752 Taiwan is not China.
18753 But -{A|zh:China;zh-tw:Taiwan}- is China,
18754 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18755 and -{China}- is China.
18756 !! html
18757 <p>Taiwan is not China.
18758 But Taiwan is Taiwan,
18759 (This should be stripped!)
18760 and China is China.
18761 </p>
18762 !! end
18763
18764 !! test
18765 Explicit session-wise language variant mapping (H flag for hide)
18766 !! options
18767 language=zh variant=zh-tw
18768 !! wikitext
18769 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18770 Taiwan is China.
18771 !! html
18772 <p>(This should be stripped!)
18773 Taiwan is Taiwan.
18774 </p>
18775 !! end
18776
18777 !! test
18778 Adding explicit conversion rule for title (T flag)
18779 !! options
18780 language=zh variant=zh-tw showtitle
18781 !! wikitext
18782 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18783 !! html
18784 Taiwan
18785 <p>Should be stripped!
18786 </p>
18787 !! end
18788
18789 !! test
18790 Testing that changing the language variant here in the tests actually works
18791 !! options
18792 language=zh variant=zh showtitle
18793 !! wikitext
18794 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18795 !! html
18796 China
18797 <p>Should be stripped!
18798 </p>
18799 !! end
18800
18801 !! test
18802 Recursive conversion of alt and title attrs shouldn't clear converter state
18803 !! options
18804 language=zh variant=zh-cn showtitle
18805 !! wikitext
18806 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18807 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18808 !! html
18809 China
18810 <p>
18811 Should be stripped<span title="Exclamation">!</span>
18812 </p>
18813 !! end
18814
18815 !! test
18816 Bug 24072: more test on conversion rule for title
18817 !! options
18818 language=zh variant=zh-tw showtitle
18819 !! wikitext
18820 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18821 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
18822 !! html
18823 Taiwan
18824 <p>This should be stripped!
18825 This won't take interferes with the title rule.
18826 </p>
18827 !! end
18828
18829 !! test
18830 Partly disable title conversion if variant == main language code
18831 !! options
18832 language=zh variant=zh title=[[ZH]] showtitle
18833 !! wikitext
18834 -{T|zh-cn:CN;zh-tw:TW}-
18835 !! html
18836 ZH
18837 <p>
18838 </p>
18839 !! end
18840
18841 !! test
18842 Partly disable title conversion if variant == main language code, more
18843 !! options
18844 language=zh variant=zh title=[[ZH]] showtitle
18845 !! wikitext
18846 -{T|TW}-
18847 !! html
18848 ZH
18849 <p>
18850 </p>
18851 !! end
18852
18853 !! test
18854 Raw output of variant escape tags (R flag)
18855 !! options
18856 language=zh variant=zh-tw
18857 !! wikitext
18858 Raw: -{R|zh:China;zh-tw:Taiwan}-
18859 !! html
18860 <p>Raw: zh:China;zh-tw:Taiwan
18861 </p>
18862 !! end
18863
18864 !! test
18865 Strings evaluating false shouldn't be ignored by Language converter (T51072)
18866 !! options
18867 language=zh variant=zh-cn
18868 !! input
18869 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
18870 !! result
18871 <p>0
18872 </p>
18873 !! end
18874
18875 !! test
18876 Conversion rules from [numeric-only string] to [something else] (T48634)
18877 !! options
18878 language=zh variant=zh-cn
18879 !! input
18880 -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
18881 !! result
18882 <p>D12345EE12345
18883 </p>
18884 !! end
18885
18886 !! test
18887 Bidirectional converter rule entries with an empty value should be ignored (T53551)
18888 !! options
18889 language=zh variant=zh-cn
18890 !! input
18891 -{H|zh-cn:foo;zh-tw:;}-foobar
18892 !! result
18893 <p>foobar
18894 </p>
18895 !! end
18896
18897 !! test
18898 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
18899 !! options
18900 language=zh variant=zh-cn
18901 !! input
18902 -{H|=>zh-cn:foo;}-foobar
18903 !! result
18904 <p>foobar
18905 </p>
18906 !! end
18907
18908 !! test
18909 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
18910 !! options
18911 language=zh variant=zh-cn
18912 !! input
18913 -{H|}-foobar
18914 !! result
18915 <p>foobar
18916 </p>
18917 !! end
18918
18919 !! test
18920 Nested using of manual convert syntax
18921 !! options
18922 language=zh variant=zh-hk
18923 !! wikitext
18924 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
18925 !! html
18926 <p>Nested: Hello Hong Kong!
18927 </p>
18928 !! end
18929
18930 !! test
18931 Proper conversion of text in external links
18932 !! options
18933 language=sr variant=sr-ec
18934 !! wikitext
18935 http://www.google.com
18936 gopher://www.google.com
18937 [http://www.google.com http://www.google.com]
18938 [gopher://www.google.com gopher://www.google.com]
18939 [https://www.google.com irc://www.google.com]
18940 [ftp://www.google.com www.google.com/ftp://dir]
18941 [//www.google.com www.google.com]
18942 !! html
18943 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18944 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18945 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
18946 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
18947 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
18948 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
18949 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
18950 </p>
18951 !! end
18952
18953 !! test
18954 Do not convert roman numbers to language variants
18955 !! options
18956 language=sr variant=sr-ec
18957 !! wikitext
18958 Fridrih IV je car.
18959 !! html
18960 <p>Фридрих IV је цар.
18961 </p>
18962 !! end
18963
18964 !! test
18965 Unclosed language converter markup "-{"
18966 !! options
18967 language=sr
18968 !! wikitext
18969 -{T|hello
18970 !! html
18971 <p>-{T|hello
18972 </p>
18973 !! end
18974
18975 !! test
18976 Don't convert raw rule "-{R|=&gt;}-" to "=>"
18977 !! options
18978 language=sr
18979 !! wikitext
18980 -{R|=&gt;}-
18981 !! html
18982 <p>=&gt;
18983 </p>
18984 !!end
18985
18986 !! test
18987 Don't break link parsing if language converter markup is in the caption.
18988 !! options
18989 language=sr variant=sr-ec
18990 !! wikitext
18991 [[Main Page|-{R|main page}-]]
18992 !! html
18993 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
18994 </p>
18995 !! end
18996
18997 # FIXME: This test is currently broken in the PHP parser (bug 52661)
18998 !! test
18999 Don't break image parsing if language converter markup is in the caption.
19000 !! options
19001 language=sr
19002 !! wikitext
19003 [[File:Foobar.jpg|-{R|caption}-]]
19004 !! html/parsoid
19005 <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>
19006 </p>
19007 !! end
19008
19009 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19010 !! test
19011 Don't break list handling if language converter markup is in the item.
19012 !! options
19013 language=zh variant=zh-cn
19014 !! wikitext
19015 ;-{zh-cn:AAA;zh-tw:BBB}-
19016 !! html/php
19017 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19018
19019 !! html/parsoid
19020 <dl><dt>AAA
19021 </dt></dl>
19022 !! end
19023
19024 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19025 !! test
19026 Don't break table handling if language converter markup is in the cell.
19027 !! options
19028 language=sr variant=sr-ec
19029 !! wikitext
19030 {|
19031 |-
19032 | -{R|B}-
19033 |}
19034 !! html/php
19035 <table>
19036
19037 <tr>
19038 <td>Б}-
19039 </td></tr></table>
19040
19041 !! html/parsoid
19042 <table>
19043
19044 <tr>
19045 <td> B
19046 </td></tr></table>
19047
19048 !! end
19049
19050 !! test
19051 Bug 529: Uncovered bullet
19052 !! wikitext
19053 * Foo {{bullet}}
19054 !! html
19055 <ul><li> Foo </li>
19056 <li> Bar</li></ul>
19057
19058 !! end
19059
19060 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19061 # Templates in Wikipedia rely on this behavior, as tidy has always been
19062 # enabled there. These tests are normally run *without* tidy, so specify the
19063 # full output here.
19064 # To test realistic parsing behavior, apply a tidy-like transformation to both
19065 # the expected output and your parser's output.
19066 !! test
19067 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19068 !! wikitext
19069 ******* Foo {{bullet}}
19070 !! html
19071 <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>
19072 <li> Bar</li></ul>
19073
19074 !! end
19075
19076 !! test
19077 Bug 529: Uncovered table already at line-start
19078 !! wikitext
19079 x
19080
19081 {{table}}
19082 y
19083 !! html
19084 <p>x
19085 </p>
19086 <table>
19087 <tr>
19088 <td> 1 </td>
19089 <td> 2
19090 </td></tr>
19091 <tr>
19092 <td> 3 </td>
19093 <td> 4
19094 </td></tr></table>
19095 <p>y
19096 </p>
19097 !! end
19098
19099 !! test
19100 Bug 529: Uncovered bullet in parser function result
19101 !! wikitext
19102 * Foo {{lc:{{bullet}} }}
19103 !! html
19104 <ul><li> Foo </li>
19105 <li> bar</li></ul>
19106
19107 !! end
19108
19109 !! test
19110 Bug 5678: Double-parsed template argument
19111 !! wikitext
19112 {{lc:{{{1}}}|hello}}
19113 !! html
19114 <p>{{{1}}}
19115 </p>
19116 !! end
19117
19118 !! test
19119 Bug 5678: Double-parsed template invocation
19120 !! wikitext
19121 {{lc:{{paramtest {{!}} param = hello }} }}
19122 !! html
19123 <p>{{paramtest | param = hello }}
19124 </p>
19125 !! end
19126
19127 !! test
19128 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19129 !! options
19130 language=cs
19131 title=[[Main Page]]
19132 !! wikitext
19133 {{PRVNÍVELKÉ:ěščř}}
19134 {{prvnívelké:ěščř}}
19135 {{PRVNÍMALÉ:ěščř}}
19136 {{prvnímalé:ěščř}}
19137 {{MALÁ:ěščř}}
19138 {{malá:ěščř}}
19139 {{VELKÁ:ěščř}}
19140 {{velká:ěščř}}
19141 !! html
19142 <p>Ěščř
19143 Ěščř
19144 ěščř
19145 ěščř
19146 ěščř
19147 ěščř
19148 ĚŠČŘ
19149 ĚŠČŘ
19150 </p>
19151 !! end
19152
19153 !! test
19154 Morwen/13: Unclosed link followed by heading
19155 !! wikitext
19156 [[link
19157 ==heading==
19158 !! html
19159 <p>[[link
19160 </p>
19161 <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>
19162
19163 !! end
19164
19165 !! test
19166 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19167 !! wikitext
19168 {{foo|
19169 =heading=
19170 !! html
19171 <p>{{foo|
19172 </p>
19173 <h1><span class="mw-headline" id="heading">heading</span></h1>
19174
19175 !! end
19176
19177 !! test
19178 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19179 !! wikitext
19180 {{foo|
19181 ==heading==
19182 !! html
19183 <p>{{foo|
19184 </p>
19185 <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>
19186
19187 !! end
19188
19189 !! test
19190 Tildes in comments
19191 !! options
19192 pst
19193 !! wikitext
19194 <!-- ~~~~ -->
19195 !! html
19196 <!-- ~~~~ -->
19197 !! end
19198
19199 !! test
19200 Paragraphs inside divs (no extra line breaks)
19201 !! wikitext
19202 <div>Line one
19203
19204 Line two</div>
19205 !! html
19206 <div>Line one
19207 Line two</div>
19208
19209 !! end
19210
19211 !! test
19212 Paragraphs inside divs (extra line break on open)
19213 !! wikitext
19214 <div>
19215 Line one
19216
19217 Line two</div>
19218 !! html
19219 <div>
19220 <p>Line one
19221 </p>
19222 Line two</div>
19223
19224 !! end
19225
19226 !! test
19227 Paragraphs inside divs (extra line break on close)
19228 !! wikitext
19229 <div>Line one
19230
19231 Line two
19232 </div>
19233 !! html
19234 <div>Line one
19235 <p>Line two
19236 </p>
19237 </div>
19238
19239 !! end
19240
19241 !! test
19242 Paragraphs inside divs (extra line break on open and close)
19243 !! wikitext
19244 <div>
19245 Line one
19246
19247 Line two
19248 </div>
19249 !! html
19250 <div>
19251 <p>Line one
19252 </p><p>Line two
19253 </p>
19254 </div>
19255
19256 !! end
19257
19258 !! test
19259 Nesting tags, paragraphs on lines which begin with <div>
19260 !! wikitext
19261 <div></div><strong>A
19262 B</strong>
19263 !! html/php+tidy
19264 <p><strong>A</strong></p>
19265 <p><strong>B</strong></p>
19266 !! html/parsoid
19267 <div></div>
19268 <p><strong>A
19269 B</strong>
19270 </p>
19271 !! end
19272
19273 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19274 !! test
19275 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19276 !! wikitext
19277 <blockquote>Line one
19278
19279 Line two</blockquote>
19280 !! html
19281 <blockquote>Line one
19282 Line two</blockquote>
19283
19284 !! html+tidy
19285 <blockquote>
19286 <p>Line one Line two</p>
19287 </blockquote>
19288 !! end
19289
19290 !! test
19291 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19292 !! wikitext
19293 <blockquote>
19294 Line one
19295
19296 Line two</blockquote>
19297 !! html
19298 <blockquote>
19299 <p>Line one
19300 </p>
19301 Line two</blockquote>
19302
19303 !! html+tidy
19304 <blockquote>
19305 <p>Line one</p>
19306 Line two</blockquote>
19307 !! end
19308
19309 !! test
19310 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19311 !! wikitext
19312 <blockquote>Line one
19313
19314 Line two
19315 </blockquote>
19316 !! html
19317 <blockquote>Line one
19318 <p>Line two
19319 </p>
19320 </blockquote>
19321
19322 !! html+tidy
19323 <blockquote>
19324 <p>Line one</p>
19325 <p>Line two</p>
19326 </blockquote>
19327 !! end
19328
19329 !! test
19330 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19331 !! wikitext
19332 <blockquote>
19333 Line one
19334
19335 Line two
19336 </blockquote>
19337 !! html
19338 <blockquote>
19339 <p>Line one
19340 </p><p>Line two
19341 </p>
19342 </blockquote>
19343
19344 !! html+tidy
19345 <blockquote>
19346 <p>Line one</p>
19347 <p>Line two</p>
19348 </blockquote>
19349 !! end
19350
19351 !! test
19352 Paragraphs inside blockquotes/divs (no extra line breaks)
19353 !! wikitext
19354 <blockquote><div>Line one
19355
19356 Line two</div></blockquote>
19357 !! html
19358 <blockquote><div>Line one
19359 Line two</div></blockquote>
19360
19361 !! end
19362
19363 !! test
19364 Paragraphs inside blockquotes/divs (extra line break on open)
19365 !! wikitext
19366 <blockquote><div>
19367 Line one
19368
19369 Line two</div></blockquote>
19370 !! html
19371 <blockquote><div>
19372 <p>Line one
19373 </p>
19374 Line two</div></blockquote>
19375
19376 !! end
19377
19378 !! test
19379 Paragraphs inside blockquotes/divs (extra line break on close)
19380 !! wikitext
19381 <blockquote><div>Line one
19382
19383 Line two
19384 </div></blockquote>
19385 !! html
19386 <blockquote><div>Line one
19387 <p>Line two
19388 </p>
19389 </div></blockquote>
19390
19391 !! end
19392
19393 !! test
19394 Paragraphs inside blockquotes/divs (extra line break on open and close)
19395 !! wikitext
19396 <blockquote><div>
19397 Line one
19398
19399 Line two
19400 </div></blockquote>
19401 !! html
19402 <blockquote><div>
19403 <p>Line one
19404 </p><p>Line two
19405 </p>
19406 </div></blockquote>
19407
19408 !! end
19409
19410 !! test
19411 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19412 !! options
19413 wgLinkHolderBatchSize=0
19414 !! wikitext
19415 [[meatball:1]]
19416 [[meatball:2]]
19417 [[meatball:3]]
19418 !! html
19419 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19420 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19421 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19422 </p>
19423 !! end
19424
19425 !! test
19426 Free external link invading image caption
19427 !! wikitext
19428 [[Image:Foobar.jpg|thumb|http://x|hello]]
19429 !! html
19430 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>hello</div></div></div>
19431
19432 !! end
19433
19434 !! test
19435 Bug 15196: localised external link numbers
19436 !! options
19437 language=fa
19438 !! wikitext
19439 [http://en.wikipedia.org/]
19440 !! html/php
19441 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19442 </p>
19443 !! html/parsoid
19444 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19445 !! end
19446
19447 !! test
19448 Multibyte character in padleft
19449 !! wikitext
19450 {{padleft:-Hello|7|Æ}}
19451 !! html
19452 <p>Æ-Hello
19453 </p>
19454 !! end
19455
19456 !! test
19457 Multibyte character in padright
19458 !! wikitext
19459 {{padright:Hello-|7|Æ}}
19460 !! html
19461 <p>Hello-Æ
19462 </p>
19463 !! end
19464
19465 !!test
19466 formatdate parser function
19467 !! wikitext
19468 {{#formatdate:2009-03-24}}
19469 !! html
19470 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19471 </p>
19472 !! end
19473
19474 !!test
19475 formatdate parser function, with default format
19476 !! wikitext
19477 {{#formatdate:2009-03-24|mdy}}
19478 !! html
19479 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19480 </p>
19481 !! end
19482
19483 !! test
19484 Spacing of numbers in formatted dates
19485 !! wikitext
19486 {{#formatdate:January 15}}
19487 !! html
19488 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19489 </p>
19490 !! end
19491
19492 !! test
19493 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
19494 !! options
19495 language=nl title=[[MediaWiki:Common.css]]
19496 !! wikitext
19497 {{#formatdate:2009-03-24|dmy}}
19498 !! html
19499 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19500 </p>
19501 !! end
19502
19503 #
19504 #
19505 #
19506
19507 #
19508 # Edit comments
19509 #
19510
19511 !! test
19512 Edit comment with link
19513 !! options
19514 comment
19515 !! wikitext
19516 I like the [[Main Page]] a lot
19517 !! html
19518 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19519 !!end
19520
19521 !! test
19522 Edit comment with link and link text
19523 !! options
19524 comment
19525 !! wikitext
19526 I like the [[Main Page|best pages]] a lot
19527 !! html
19528 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19529 !!end
19530
19531 !! test
19532 Edit comment with link and link text with suffix
19533 !! options
19534 comment
19535 !! wikitext
19536 I like the [[Main Page|best page]]s a lot
19537 !! html
19538 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19539 !!end
19540
19541 !! test
19542 Edit comment with section link (non-local, eg in history list)
19543 !! options
19544 comment title=[[Main Page]]
19545 !! wikitext
19546 /* External links */ removed bogus entries
19547 !! html
19548 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19549 !!end
19550
19551 !! test
19552 Edit comment with section link and text before it (non-local, eg in history list)
19553 !! options
19554 comment title=[[Main Page]]
19555 !! wikitext
19556 pre-comment text /* External links */ removed bogus entries
19557 !! html
19558 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>
19559 !!end
19560
19561 !! test
19562 Edit comment with section link (local, eg in diff view)
19563 !! options
19564 comment local title=[[Main Page]]
19565 !! wikitext
19566 /* External links */ removed bogus entries
19567 !! html
19568 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19569 !!end
19570
19571 !! test
19572 Edit comment with subpage link (bug 14080)
19573 !! options
19574 comment
19575 subpage
19576 title=[[Subpage test]]
19577 !! wikitext
19578 Poked at a [[/subpage]] here...
19579 !! html
19580 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19581 !!end
19582
19583 !! test
19584 Edit comment with subpage link and link text (bug 14080)
19585 !! options
19586 comment
19587 subpage
19588 title=[[Subpage test]]
19589 !! wikitext
19590 Poked at a [[/subpage|neat little page]] here...
19591 !! html
19592 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19593 !!end
19594
19595 !! test
19596 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19597 !! options
19598 comment
19599 title=[[Subpage test]]
19600 !! wikitext
19601 Poked at a [[/subpage]] here...
19602 !! html
19603 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...
19604 !!end
19605
19606 !! test
19607 Edit comment with bare anchor link (local, as on diff)
19608 !! options
19609 comment
19610 local
19611 title=[[Main Page]]
19612 !! wikitext
19613 [[#section]]
19614 !! html
19615 <a href="#section">#section</a>
19616 !! end
19617
19618 !! test
19619 Edit comment with bare anchor link (non-local, as on history)
19620 !! options
19621 comment
19622 title=[[Main Page]]
19623 !! wikitext
19624 [[#section]]
19625 !! html
19626 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19627 !! end
19628
19629 !! test
19630 Anchor starting with underscore
19631 !! wikitext
19632 [[#_ref|One]]
19633 !! html
19634 <p><a href="#_ref">One</a>
19635 </p>
19636 !! end
19637
19638 !! test
19639 Id starting with underscore
19640 !! wikitext
19641 <div id="_ref"></div>
19642 !! html
19643 <div id="_ref"></div>
19644
19645 !! end
19646
19647 !! test
19648 Space normalisation on autocomment (bug 22784)
19649 !! options
19650 comment
19651 title=[[Main Page]]
19652 !! wikitext
19653 /* __hello__world__ */
19654 !! html
19655 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19656 !! end
19657
19658 !! test
19659 percent-encoding and + signs in comments (Bug 26410)
19660 !! options
19661 comment
19662 !! wikitext
19663 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19664 !! html/php
19665 <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>
19666 !! end
19667
19668 # Parsoid doesn't support this yet: see bug 73581
19669 # but it *should* omit the 'src' attribute if the image is bad.
19670 # PHP side of tests was disabled in
19671 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19672 # because of issues in the PHP parserTests infrastructure
19673 # (but the output below is indeed what the PHP side emits)
19674 !! test
19675 Bad images - basic functionality
19676 !! wikitext
19677 [[File:Bad.jpg]]
19678 !! DISABLED/html/php
19679 !! html/parsoid
19680 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
19681 !! end
19682
19683 !! test
19684 Bad images - bug 16039: text after bad image disappears
19685 !! wikitext
19686 Foo bar
19687 [[File:Bad.jpg]]
19688 Bar foo
19689 !! DISABLED/html/php
19690 <p>Foo bar
19691 </p><p>Bar foo
19692 </p>
19693 !! html/parsoid
19694 <p>Foo bar
19695 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
19696 Bar foo</p>
19697 !! end
19698
19699 !! test
19700 Verify that displaytitle works (bug #22501) no displaytitle
19701 !! options
19702 showtitle
19703 !! config
19704 wgAllowDisplayTitle=true
19705 wgRestrictDisplayTitle=false
19706 !! wikitext
19707 this is not the the title
19708 !! html
19709 Parser test
19710 <p>this is not the the title
19711 </p>
19712 !! end
19713
19714 !! test
19715 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19716 !! options
19717 showtitle
19718 title=[[Screen]]
19719 !! config
19720 wgAllowDisplayTitle=true
19721 wgRestrictDisplayTitle=false
19722 !! wikitext
19723 this is not the the title
19724 {{DISPLAYTITLE:whatever}}
19725 !! html
19726 whatever
19727 <p>this is not the the title
19728 </p>
19729 !! end
19730
19731 !! test
19732 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19733 !! options
19734 showtitle
19735 title=[[Screen]]
19736 !! config
19737 wgAllowDisplayTitle=true
19738 wgRestrictDisplayTitle=true
19739 !! wikitext
19740 this is not the the title
19741 {{DISPLAYTITLE:whatever}}
19742 !! html
19743 Screen
19744 <p>this is not the the title
19745 </p>
19746 !! end
19747
19748 !! test
19749 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19750 !! options
19751 showtitle
19752 title=[[Screen]]
19753 !! config
19754 wgAllowDisplayTitle=true
19755 wgRestrictDisplayTitle=true
19756 !! wikitext
19757 this is not the the title
19758 {{DISPLAYTITLE:screen}}
19759 !! html
19760 screen
19761 <p>this is not the the title
19762 </p>
19763 !! end
19764
19765 !! test
19766 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19767 !! options
19768 showtitle
19769 title=[[Screen]]
19770 !! config
19771 wgAllowDisplayTitle=false
19772 !! wikitext
19773 this is not the the title
19774 {{DISPLAYTITLE:screen}}
19775 !! html
19776 Screen
19777 <p>this is not the the title
19778 <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>
19779 </p>
19780 !! end
19781
19782 !! test
19783 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19784 !! options
19785 showtitle
19786 title=[[Screen]]
19787 !! config
19788 wgAllowDisplayTitle=false
19789 !! wikitext
19790 this is not the the title
19791 !! html
19792 Screen
19793 <p>this is not the the title
19794 </p>
19795 !! end
19796
19797 !! test
19798 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19799 !! options
19800 showtitle
19801 title=[[Screen]]
19802 !! config
19803 wgAllowDisplayTitle=true
19804 wgRestrictDisplayTitle=true
19805 !! wikitext
19806 this is not the the title
19807 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19808 !! html
19809 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
19810 <p>this is not the the title
19811 </p>
19812 !! end
19813
19814 !! test
19815 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
19816 !! options
19817 showtitle
19818 title=[[Screen]]
19819 !! config
19820 wgAllowDisplayTitle=true
19821 wgRestrictDisplayTitle=true
19822 !! wikitext
19823 this is not the the title
19824 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
19825 !! html
19826 <span style="color: red;">s</span>creen
19827 <p>this is not the the title
19828 </p>
19829 !! end
19830
19831 !! test
19832 Page status indicators: Empty name is invalid
19833 !! options
19834 showindicators
19835 !! wikitext
19836 <indicator name=" "></indicator>
19837 <indicator></indicator>
19838 !! html
19839 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19840 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
19841 </p>
19842 !! end
19843
19844 !! test
19845 Page status indicators: Weird syntaxes that are okay
19846 !! options
19847 showindicators
19848 !! wikitext
19849 <indicator name="empty" />
19850 <indicator name="name"></indicator>
19851 !! html
19852 empty=
19853 name=
19854 <p><br />
19855 </p>
19856 !! end
19857
19858 !! test
19859 Page status indicators: Torture test
19860 !! options
19861 showindicators
19862 !! wikitext
19863 <indicator name="01">hello world</indicator>
19864 <indicator name="02">[[Main Page]]</indicator>
19865 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
19866 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
19867 <indicator name="05">* foo
19868 * bar</indicator>
19869 <indicator name="06"><nowiki>foo</nowiki></indicator>
19870 <indicator name="07"> Preformatted</indicator>
19871 <indicator name="08"><div>Broken tag</indicator>
19872 <indicator name="09">{| class=wikitable
19873 | cell
19874 |}</indicator>
19875 <indicator name="10">Two
19876
19877 paragraphs</indicator>
19878 !! html
19879 01=hello world
19880 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19881 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
19882 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
19883 05=<ul><li> foo</li>
19884 <li> bar</li></ul>
19885
19886 06=foo
19887 07=<pre>Preformatted
19888 </pre>
19889 08=<div>Broken tag</div>
19890
19891 09=<table class="wikitable">
19892 <tr>
19893 <td> cell
19894 </td></tr></table>
19895
19896 10=<p>Two
19897 </p><p>paragraphs
19898 </p>
19899 <p><br />
19900 </p><p><br />
19901 </p><p><br />
19902 </p><p><br />
19903 </p><p><br />
19904 </p>
19905 !! end
19906
19907 !! test
19908 preload: check <noinclude> and <includeonly>
19909 !! options
19910 preload
19911 !! wikitext
19912 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
19913 !! html
19914 Hello kind world.
19915 !! end
19916
19917 !! test
19918 preload: check <onlyinclude>
19919 !! options
19920 preload
19921 !! wikitext
19922 Goodbye <onlyinclude>Hello world</onlyinclude>
19923 !! html
19924 Hello world
19925 !! end
19926
19927 !! test
19928 preload: can pass tags through if we want to
19929 !! options
19930 preload
19931 !! wikitext
19932 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
19933 !! html
19934 <includeonly>Hello world</includeonly>
19935 !! end
19936
19937 !! test
19938 preload: check that it doesn't try to do tricks
19939 !! options
19940 preload
19941 !! wikitext
19942 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19943 !! html
19944 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
19945 !! end
19946
19947 !! test
19948 Play a bit with r67090 and bug 3158
19949 !! wikitext
19950 <div style="width:50% !important">&nbsp;</div>
19951 <div style="width:50%&nbsp;!important">&nbsp;</div>
19952 <div style="width:50%&#160;!important">&nbsp;</div>
19953 <div style="border : solid;">&nbsp;</div>
19954 !! html/php
19955 <div style="width:50% !important">&#160;</div>
19956 <div style="width:50% !important">&#160;</div>
19957 <div style="width:50% !important">&#160;</div>
19958 <div style="border&#160;: solid;">&#160;</div>
19959
19960 !! html/parsoid
19961 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19962 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19963 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19964 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
19965
19966 !! end
19967
19968 !! test
19969 HTML5 data attributes
19970 !! wikitext
19971 <span data-foo="bar">Baz</span>
19972 <p data-abc-def_hij="">Quuz</p>
19973 !! html
19974 <p><span data-foo="bar">Baz</span>
19975 </p>
19976 <p data-abc-def_hij="">Quuz</p>
19977
19978 !! end
19979
19980 !! test
19981 percent-encoding and + signs in internal links (Bug 26410)
19982 !! wikitext
19983 [[User:+%]] [[Page+title%]]
19984 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
19985 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
19986 [[%33%45]] [[%33%45+]]
19987 !! html/php
19988 <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>
19989 <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>
19990 <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>
19991 <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>
19992 </p>
19993 !! html/parsoid
19994 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
19995 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
19996 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
19997 <a rel="mw:WikiLink" href="./3E" title="3E" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}'>3E</a> <a rel="mw:WikiLink" href="./3E+" title="3E+" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}'>3E+</a></p>
19998 !! end
19999
20000 !! test
20001 Special characters in embedded file links (bug 27679)
20002 !! wikitext
20003 [[File:Contains & ampersand.jpg]]
20004 [[File:Does not exist.jpg|Title with & ampersand]]
20005 !! html/php
20006 <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>
20007 <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>
20008 </p>
20009 !! html/parsoid
20010 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
20011 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
20012 !! end
20013
20014 !! test
20015 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20016 !! wikitext
20017 Text&apos;s been normalized?
20018 !! html
20019 <p>Text&#39;s been normalized?
20020 </p>
20021 !! end
20022
20023 !! test
20024 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20025 !! wikitext
20026 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20027 !! html
20028 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20029 </p>
20030 !! end
20031
20032 !! test
20033 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20034 !! wikitext
20035 [http://www.example.org/ ideograms]
20036 !! html
20037 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20038 </p>
20039 !! end
20040
20041 !! test
20042 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20043 !! wikitext
20044 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20045 !! html
20046 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20047 </p>
20048 !! end
20049
20050 !! article
20051 Mediawiki:loop1
20052 !! text
20053 {{Identical|A}}
20054 !! endarticle
20055
20056 !! article
20057 Mediawiki:loop2
20058 !! text
20059 {{Identical|B}}
20060 !! endarticle
20061
20062 !! article
20063 Template:Identical
20064 !! text
20065 {{int:loop1}}
20066 {{int:loop2}}
20067 !! endarticle
20068
20069 !! test
20070 Bug 31098 Template which includes system messages which includes the template
20071 !! wikitext
20072 {{Identical}}
20073 !! html
20074 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20075 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20076 </p>
20077 !! end
20078
20079 !! test
20080 Bug31490 Turkish: ucfirst 'blah'
20081 !! options
20082 language=tr
20083 !! wikitext
20084 {{ucfirst:blah}}
20085 !! html
20086 <p>Blah
20087 </p>
20088 !! end
20089
20090 !! test
20091 Bug31490 Turkish: ucfirst 'ix'
20092 !! options
20093 language=tr
20094 !! wikitext
20095 {{ucfirst:ix}}
20096 !! html
20097 <p>İx
20098 </p>
20099 !! end
20100
20101 !! test
20102 Bug31490 Turkish: lcfirst 'BLAH'
20103 !! options
20104 language=tr
20105 !! wikitext
20106 {{lcfirst:BLAH}}
20107 !! html
20108 <p>bLAH
20109 </p>
20110 !! end
20111
20112 !! test
20113 Bug31490 Turkish: ucfırst (with a dotless i)
20114 !! options
20115 language=tr
20116 !! wikitext
20117 {{ucfırst:blah}}
20118 !! html
20119 <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>
20120 </p>
20121 !! end
20122
20123 !! test
20124 Bug31490 ucfırst (with a dotless i) with English language
20125 !! options
20126 language=en
20127 !! wikitext
20128 {{ucfırst:blah}}
20129 !! html
20130 <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>
20131 </p>
20132 !! end
20133
20134 !! test
20135 Bug 26375: TOC with italics
20136 !! options
20137 title=[[Main Page]]
20138 !! wikitext
20139 __TOC__
20140 == ''Lost'' episodes ==
20141 !! html
20142 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20143 <ul>
20144 <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>
20145 </ul>
20146 </div>
20147
20148 <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>
20149
20150 !! end
20151
20152 !! test
20153 Bug 26375: TOC with bold
20154 !! options
20155 title=[[Main Page]]
20156 !! wikitext
20157 __TOC__
20158 == '''should be bold''' then normal text ==
20159 !! html
20160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20161 <ul>
20162 <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>
20163 </ul>
20164 </div>
20165
20166 <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>
20167
20168 !! end
20169
20170 !! test
20171 Bug 33845: Headings become cursive in TOC when they contain an image
20172 !! options
20173 title=[[Main Page]]
20174 !! wikitext
20175 __TOC__
20176 == Image [[Image:foobar.jpg]] ==
20177 !! html
20178 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20179 <ul>
20180 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20181 </ul>
20182 </div>
20183
20184 <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>
20185
20186 !! end
20187
20188 !! test
20189 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20190 !! options
20191 title=[[Main Page]]
20192 !! wikitext
20193 __TOC__
20194 == <blockquote>Quote</blockquote> ==
20195 !! html
20196 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20197 <ul>
20198 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20199 </ul>
20200 </div>
20201
20202 <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>
20203
20204 !! html+tidy
20205 <p></p>
20206 <div id="toc" class="toc">
20207 <div id="toctitle">
20208 <h2>Contents</h2>
20209 </div>
20210 <ul>
20211 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20212 </ul>
20213 </div>
20214 <p></p>
20215 <h2><span class="mw-headline" id="Quote"></span></h2>
20216 <blockquote>
20217 <p><span class="mw-headline" id="Quote">Quote</span></p>
20218 </blockquote>
20219 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></p>
20220 !! end
20221
20222 !! test
20223 Unclosed tags in TOC
20224 !! options
20225 title=[[Main Page]]
20226 !! wikitext
20227 __TOC__
20228 == Proof: 2 < 3 ==
20229 <small>Hanc marginis exiguitas non caperet.</small>
20230 QED
20231 !! html
20232 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20233 <ul>
20234 <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>
20235 </ul>
20236 </div>
20237
20238 <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>
20239 <p><small>Hanc marginis exiguitas non caperet.</small>
20240 QED
20241 </p>
20242 !! end
20243
20244 !! test
20245 Multiple tags in TOC
20246 !! wikitext
20247 __TOC__
20248 == <i>Foo</i> <b>Bar</b> ==
20249
20250 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20251 !! html
20252 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20253 <ul>
20254 <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>
20255 <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>
20256 </ul>
20257 </div>
20258
20259 <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>
20260 <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>
20261
20262 !! html+tidy
20263 <p></p>
20264 <div id="toc" class="toc">
20265 <div id="toctitle">
20266 <h2>Contents</h2>
20267 </div>
20268 <ul>
20269 <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>
20270 <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>
20271 </ul>
20272 </div>
20273 <p></p>
20274 <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>
20275 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20276 <blockquote>
20277 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20278 </blockquote>
20279 <p><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></p>
20280 !! end
20281
20282 !! test
20283 Tags with parameters in TOC
20284 !! wikitext
20285 __TOC__
20286 == <sup class="in-h2">Hello</sup> ==
20287
20288 == <sup class="a > b">Evilbye</sup> ==
20289 !! html
20290 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20291 <ul>
20292 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20293 <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>
20294 </ul>
20295 </div>
20296
20297 <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>
20298 <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;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20299
20300 !! end
20301
20302 !! test
20303 span tags with directionality in TOC
20304 !! wikitext
20305 __TOC__
20306 == <span dir="ltr">C++</span> ==
20307
20308 == <span dir="rtl">זבנג!</span> ==
20309
20310 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20311
20312 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20313
20314 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20315 !! html
20316 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20317 <ul>
20318 <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>
20319 <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>
20320 <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>
20321 <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>
20322 <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>
20323 </ul>
20324 </div>
20325
20326 <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>
20327 <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>
20328 <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>
20329 <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>
20330 <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>
20331
20332 !! end
20333
20334 !! test
20335 Bug 72884: bdi element in ToC
20336 !! wikitext
20337 __TOC__
20338 == <bdi>test</bdi> ==
20339 !! html
20340 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20341 <ul>
20342 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20343 </ul>
20344 </div>
20345
20346 <h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20347
20348 !! end
20349
20350 # Note that the html output does not have the <p></p>, but the
20351 # html+tidy output *does*. This is because the empty <p></p> is
20352 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20353 !! test
20354 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20355 !! wikitext
20356 __TOC__
20357 == x ==
20358 !! html
20359 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20360 <ul>
20361 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20362 </ul>
20363 </div>
20364
20365 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20366
20367 !! html+tidy
20368 <p></p>
20369 <div id="toc" class="toc">
20370 <div id="toctitle">
20371 <h2>Contents</h2>
20372 </div>
20373 <ul>
20374 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20375 </ul>
20376 </div>
20377 <p></p>
20378 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20379 !! end
20380
20381 !! article
20382 MediaWiki:Bug32057
20383 !! text
20384 == {{int:headline_sample}} ==
20385 !! endarticle
20386
20387 !! test
20388 Bug 32057: Title needed when expanding <h> nodes.
20389 !! options
20390 title=[[Main Page]]
20391 !! wikitext
20392 {{int:Bug32057}}
20393 !! html
20394 <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>
20395
20396 !! end
20397
20398 !! test
20399 Strip marker in urlencode
20400 !! wikitext
20401 {{urlencode:x<nowiki/>y}}
20402 {{urlencode:x<nowiki/>y|wiki}}
20403 {{urlencode:x<nowiki/>y|path}}
20404 {{urlencode:x<pre id="one">two</pre>y}}
20405 !! html
20406 <p>xy
20407 xy
20408 xy
20409 xy
20410 </p>
20411 !! end
20412
20413 !! test
20414 Strip marker in lc
20415 !! wikitext
20416 {{lc:x<nowiki/>y}}
20417 !! html
20418 <p>xy
20419 </p>
20420 !! end
20421
20422 !! test
20423 Strip marker in uc
20424 !! wikitext
20425 {{uc:x<nowiki/>y}}
20426 !! html
20427 <p>XY
20428 </p>
20429 !! end
20430
20431 !! test
20432 Strip marker in formatNum
20433 !! wikitext
20434 {{formatnum:1<nowiki/>2}}
20435 {{formatnum:1<nowiki/>2|R}}
20436 !! html
20437 <p>12
20438 12
20439 </p>
20440 !! end
20441
20442 !! test
20443 Check noCommafy in formatNum
20444 !! options
20445 language=be-tarask
20446 !! wikitext
20447 {{formatnum:123456.78}}
20448 {{formatnum:123456.78|NOSEP}}
20449 !! html
20450 <p>123 456,78
20451 123456.78
20452 </p>
20453 !! end
20454
20455 !! test
20456 Wrong option for formatNum (bug 56199)
20457 !! wikitext
20458 {{formatnum:1,234.56|Random}}
20459 {{formatnum:1,234.56|EVERYTHING}}
20460 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20461 !! html
20462 <p>1,234.56
20463 1,234.56
20464 1,234.56
20465 </p>
20466 !! end
20467
20468 !! test
20469 Strip marker in grammar
20470 !! options
20471 language=fi
20472 !! wikitext
20473 {{grammar:elative|foo<nowiki/>bar}}
20474 !! html
20475 <p>foobarista
20476 </p>
20477 !! end
20478
20479 !! test
20480 Strip marker in padleft
20481 !! wikitext
20482 {{padleft:|2|x<nowiki/>y}}
20483 !! html
20484 <p>xy
20485 </p>
20486 !! end
20487
20488 !! test
20489 Strip marker in padright
20490 !! wikitext
20491 {{padright:|2|x<nowiki/>y}}
20492 !! html
20493 <p>xy
20494 </p>
20495 !! end
20496
20497 !! test
20498 Strip marker in anchorencode
20499 !! wikitext
20500 {{anchorencode:x<nowiki/>y}}
20501 !! html
20502 <p>xy
20503 </p>
20504 !! end
20505
20506 !! test
20507 nowiki inside link inside heading (bug 18295)
20508 !! wikitext
20509 ==[[foo|x<nowiki>y</nowiki>z]]==
20510 !! html
20511 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20512
20513 !! end
20514
20515 !! test
20516 new support for bdi element (bug 31817)
20517 !! wikitext
20518 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20519 !! html
20520 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20521
20522 !!end
20523
20524 !! test
20525 Ignore pipe between table row attributes
20526 !! wikitext
20527 {|
20528 | quux
20529 |- id=foo | style='color: red'
20530 | bar
20531 |}
20532 !! html
20533 <table>
20534 <tr>
20535 <td> quux
20536 </td></tr>
20537 <tr id="foo" style="color: red">
20538 <td> bar
20539 </td></tr></table>
20540
20541 !! end
20542
20543 !!test
20544 Gallery override link with WikiLink (bug 34852)
20545 !! wikitext
20546 <gallery>
20547 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20548 </gallery>
20549 !! html
20550 <ul class="gallery mw-gallery-traditional">
20551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20552 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20553 <div class="gallerytext">
20554 <p>caption
20555 </p>
20556 </div>
20557 </div></li>
20558 </ul>
20559
20560 !! end
20561
20562 !!test
20563 Gallery override link with absolute external link (bug 34852)
20564 !! wikitext
20565 <gallery>
20566 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20567 </gallery>
20568 !! html
20569 <ul class="gallery mw-gallery-traditional">
20570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20571 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20572 <div class="gallerytext">
20573 <p>caption
20574 </p>
20575 </div>
20576 </div></li>
20577 </ul>
20578
20579 !! end
20580
20581 !!test
20582 Gallery override link with malicious javascript (bug 34852)
20583 !! wikitext
20584 <gallery>
20585 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20586 </gallery>
20587 !! html
20588 <ul class="gallery mw-gallery-traditional">
20589 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20590 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20591 <div class="gallerytext">
20592 <p>caption
20593 </p>
20594 </div>
20595 </div></li>
20596 </ul>
20597
20598 !! end
20599
20600 !!test
20601 Gallery with invalid title as link (bug 43964)
20602 !! wikitext
20603 <gallery>
20604 File:foobar.jpg|link=<
20605 </gallery>
20606 !! html
20607 <ul class="gallery mw-gallery-traditional">
20608 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20609 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
20610 <div class="gallerytext">
20611 </div>
20612 </div></li>
20613 </ul>
20614
20615 !! end
20616
20617 !!test
20618 Language parser function
20619 !! wikitext
20620 {{#language:ar}}
20621 !! html
20622 <p>العربية
20623 </p>
20624 !! end
20625
20626 !!test
20627 Padleft and padright as substr
20628 !! wikitext
20629 {{padleft:|3|abcde}}
20630 {{padright:|3|abcde}}
20631 !! html
20632 <p>abc
20633 abc
20634 </p>
20635 !! end
20636
20637 !!test
20638 Special parser function
20639 !! wikitext
20640 {{#special:RandomPage}}
20641 {{#special:BaDtItLe}}
20642 {{#special:Foobar}}
20643 !! html
20644 <p>Special:Random
20645 Special:Badtitle
20646 Special:Foobar
20647 </p>
20648 !! end
20649
20650 !!test
20651 Bug 34939 - Case insensitive link parsing ([HttP://])
20652 !! wikitext
20653 [HttP://MediaWiki.Org/]
20654 !! html/php
20655 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20656 </p>
20657 !! html/parsoid
20658 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20659 !! end
20660
20661 !!test
20662 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20663 !! wikitext
20664 [HttP://MediaWiki.Org/ MediaWiki]
20665 !! html
20666 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20667 </p>
20668 !! end
20669
20670 !!test
20671 Bug 34939 - Case insensitive link parsing (HttP://)
20672 !! wikitext
20673 HttP://MediaWiki.Org/
20674 !! html/php
20675 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20676 </p>
20677 !! html/parsoid
20678 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20679 !! end
20680
20681 !!test
20682 Disable TOC
20683 !! options
20684 notoc
20685 !! wikitext
20686 Lead
20687 == Section 1 ==
20688 == Section 2 ==
20689 == Section 3 ==
20690 == Section 4 ==
20691 == Section 5 ==
20692 !! html
20693 <p>Lead
20694 </p>
20695
20696 <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>
20697 <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>
20698 <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>
20699 <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>
20700 <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>
20701
20702 !! end
20703
20704
20705 ###
20706 ### Parsoid-specific tests
20707 ### Parsoid-PHP parser incompatibilities
20708 ###
20709 !!test
20710 1. SOL-sensitive wikitext tokens as template-args
20711 !!options
20712 parsoid=wt2html,wt2wt
20713 !! wikitext
20714 {{echo|*a}}
20715 {{echo|#a}}
20716 {{echo|:a}}
20717 !! html
20718 <span about="#mwt1" typeof="mw:Transclusion">
20719 </span><ul about="#mwt1"><li>a</li>
20720 </ul>
20721 <span about="#mwt2" typeof="mw:Transclusion">
20722 </span><ol about="#mwt2"><li>a</li>
20723 </ol>
20724 <span about="#mwt3" typeof="mw:Transclusion">
20725 </span><dl about="#mwt3"><dd>a</dd>
20726 </dl>
20727 !!end
20728
20729 #### -----------------------------------------------------------------
20730 #### Parsoid-specific functionality tests
20731 #### -----------------------------------------------------------------
20732
20733 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20734 # We know wt2wt will fail, but we expect selser to pass.
20735 # Due to the nature of our testing, wt2wt and selser tests will enter the
20736 # blacklist and we'll catch selser regressions based on changes to the
20737 # blacklist entries for selser tests.
20738 !! test
20739 1. Bad treebuilder fixup of formatting elt is cleaned up
20740 !! options
20741 parsoid=wt2html,wt2wt
20742 !! wikitext
20743 {|
20744 |
20745 <small>
20746 [[Image:Foobar.jpg|right|Test]]
20747 </small>
20748 |}
20749 !! html/parsoid
20750 <table>
20751 <tbody><tr><td>
20752 <small>
20753 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure>
20754 </small>
20755 </td></tr>
20756 </tbody></table>
20757 !! end
20758
20759 !! test
20760 2. Bad treebuilder fixup of formatting elt is cleaned up
20761 !! options
20762 parsoid=wt2html,wt2wt
20763 !! wikitext
20764 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20765
20766 <small>[[Image:Foobar.jpg|right|300px]]</small>
20767 !! html/parsoid
20768
20769 <p><b>foo</b></p>
20770 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
20771 <p><b>bar</b></p>
20772 <small><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/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
20773 !! end
20774
20775 #### ----------------------------------------------------------------
20776 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20777 #### tags. Parsoid's output for these tags differs from that of the
20778 #### PHP parser.
20779 #### ----------------------------------------------------------------
20780
20781 !!test
20782 Ref: 1. ref-location should be replaced with an index span
20783 !!options
20784 parsoid
20785 !! wikitext
20786 A <ref>foo</ref>
20787 B <ref name="x">foo</ref>
20788 C <ref name="y" />
20789 <references />
20790 !! html
20791 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
20792 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
20793 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
20794 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20795 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20796 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
20797 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
20798 </ol>
20799 !!end
20800
20801 !!test
20802 Ref: 2. ref-tags with identical names should all get the same index
20803 !!options
20804 parsoid
20805 !! wikitext
20806 A <ref name="x">foo</ref>
20807 B <ref name="x" />
20808 <references />
20809 !! html
20810 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20811 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20812 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20813 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20814 </ol>
20815 !!end
20816
20817 !!test
20818 Ref: 3. spaces in ref-names should be ignored
20819 !!options
20820 parsoid
20821 !! wikitext
20822 A <ref name="x">foo</ref>
20823 B <ref name=" x " />
20824 C <ref name= x />
20825 <references />
20826 !! html
20827 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20828 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
20829 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20830 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
20831 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
20832 </ol>
20833 !!end
20834
20835 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
20836 !!test
20837 Ref: 4. 'constructor' should be accepted as a valid ref-name
20838 !!options
20839 parsoid
20840 !! wikitext
20841 A <ref name="constructor">foo</ref>
20842 <references />
20843 !! html
20844 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20845 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20846 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
20847 </ol>
20848 !!end
20849
20850 !!test
20851 Ref: 5. body should accept generic wikitext
20852 !!options
20853 parsoid
20854 !! wikitext
20855 A <ref>
20856 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
20857 </ref>
20858
20859 <references />
20860 !! html
20861 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20862
20863 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
20864 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
20865 </span></li>
20866 </ol>
20867 !!end
20868
20869 !!test
20870 Ref: 6. indent-pres should not be output in ref-body
20871 !!options
20872 parsoid
20873 !! wikitext
20874 A <ref>
20875 foo
20876 bar
20877 baz
20878 </ref>
20879
20880 <references />
20881 !! html
20882 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20883
20884 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20885 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
20886 bar
20887 baz
20888 </span></li>
20889 </ol>
20890 !!end
20891
20892 !!test
20893 Ref: 7. No p-wrapping in ref-body
20894 !!options
20895 parsoid
20896 !! wikitext
20897 A <ref>
20898 foo
20899
20900 bar
20901
20902
20903 baz
20904
20905
20906
20907 booz
20908 </ref>
20909
20910 <references />
20911 !! html
20912 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
20913
20914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20915 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
20916
20917 bar
20918
20919
20920 baz
20921
20922
20923
20924 booz
20925 </span></li>
20926 </ol>
20927 !!end
20928
20929 !!test
20930 Ref: 8. transclusion wikitext has lower precedence
20931 !!options
20932 parsoid
20933 !! wikitext
20934 A <ref> foo {{echo|</ref> B C}}
20935
20936 <references />
20937 !! html
20938 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
20939 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20940 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <span typeof="mw:Nowiki" data-parsoid='{"src":"{{","dsr":[12,14,0,0]}'>{{</span>echo|</span></li>
20941 </ol>
20942 !!end
20943
20944 !!test
20945 Ref: 9. unclosed comments should not leak out of ref-body
20946 !!options
20947 parsoid
20948 !! wikitext
20949 A <ref> foo <!--</ref> B C
20950 <references />
20951 !! html
20952 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
20953 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20954 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
20955 </ol>
20956 !!end
20957
20958 !!test
20959 Ref: 10. Unclosed HTML tags should not leak out of ref-body
20960 !!options
20961 parsoid
20962 !! wikitext
20963 A <ref> <b> foo </ref> B C
20964
20965 <references />
20966 !! html
20967 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
20968
20969
20970 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
20971 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
20972 </ol>
20973 !!end
20974
20975 !!test
20976 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
20977 !!options
20978 parsoid
20979 !! wikitext
20980 A <ref>foo</ref> B
20981 C <ref>bar</ref> D
20982 <references />
20983 !! html
20984 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
20985 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
20986 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
20987 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
20988 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
20989 </ol>
20990 !!end
20991
20992 !!test
20993 Ref: 12. ref-tags act as trailing newline migration barrier
20994 !! wikitext
20995 <!--the newline at the end of this line moves out of the p tag-->a
20996
20997 b<!--the newline at the end of this line stays inside the p tag--> <ref />
20998 <ref />
20999
21000 c
21001 <references />
21002 !! html/parsoid
21003 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21004
21005
21006 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21007 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21008
21009 <p>c</p>
21010 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21011 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
21012 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
21013 !!end
21014
21015 !!test
21016 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21017 !!options
21018 parsoid
21019 !! wikitext
21020 <ref>foo</ref> A
21021 <ref>bar
21022 </ref> B
21023 <references />
21024 !! html
21025 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
21026 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
21027 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21028 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21029 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
21030 </span></li>
21031 </ol>
21032 !!end
21033
21034 !!test
21035 Ref: 14. A nested ref-tag should be emitted as plain text
21036 !!options
21037 parsoid
21038 !! wikitext
21039 <ref>foo <ref>bar</ref> baz</ref>
21040
21041 <references />
21042 !! html
21043 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21044 </p>
21045 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21046 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
21047 </ol>
21048 !!end
21049
21050 !!test
21051 Ref: 15. ref-tags with identical names should get identical indexes
21052 !!options
21053 parsoid
21054 !! wikitext
21055 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21056 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21057
21058 <references />
21059 !! html
21060 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
21061 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21062
21063 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21064 </ol>
21065 !!end
21066
21067 ## We don't bother wt2wt-ing non-standard whitespace
21068 !!test
21069 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21070 !!options
21071 parsoid=wt2html
21072 !! wikitext
21073 A <ref >foo</ref >
21074
21075 <references />
21076 !! html
21077 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21079 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21080 !!end
21081
21082 !!test
21083 Ref: 17. Generate valid HTML5 id/about attributes
21084 !!options
21085 parsoid
21086 !!wikitext
21087 <ref name="a b">foo</ref>
21088
21089 <references />
21090 !!html
21091 <p><span class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
21092 </p>
21093
21094 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21095 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
21096 </ol>
21097 !!end
21098
21099 !!test
21100 Ref: 18. T58916: Extension attributes should be parsed as plain text
21101 !!options
21102 parsoid
21103 !!wikitext
21104 <ref name="{{echo|a}}">foo</ref>
21105
21106 <references />
21107 !!html
21108 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
21109 </p>
21110
21111 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21112 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
21113 </ol>
21114 !!end
21115
21116 !!test
21117 Ref: 19. ref-tags with identical name encodings should get identical indexes
21118 !!options
21119 parsoid
21120 !! wikitext
21121 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21122
21123 <references />
21124 !! html
21125 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
21126 </p>
21127 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21128 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
21129 </ol>
21130 !!end
21131
21132 !!test
21133 Ref: 20. ref-tags with identical names but different content should keep it
21134 !!options
21135 parsoid
21136 !! wikitext
21137 A <ref name="foo">Foo one</ref>
21138 B <ref name="foo">Foo two</ref>
21139 C <ref name="foo" />
21140
21141 <references />
21142 !! html
21143 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
21144 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
21145 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21146
21147 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
21148 </ol>
21149 !!end
21150
21151 !!test
21152 References: 1. references tag without any refs should be handled properly
21153 !! wikitext
21154 <references />
21155 !! html/parsoid
21156 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21157 !!end
21158
21159 !!test
21160 References: 2. references tag with group only outputs references from that group
21161 !! wikitext
21162 A <ref group="a">foo</ref>
21163 B <ref group="b">bar</ref>
21164 C <ref>baz</ref>
21165
21166 <references group="a" />
21167 <references />
21168 <references group="b" />
21169 !! html/parsoid
21170 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21171 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
21172 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
21173
21174 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21175 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21176 </ol>
21177 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21178 <li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
21179 </ol>
21180 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21181 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21182 </ol>
21183 !!end
21184
21185 !!test
21186 References: 3. ref list should be cleared after processing references
21187 !! wikitext
21188 A <ref>foo</ref>
21189
21190 <references />
21191
21192 B <ref>bar</ref>
21193
21194 <references />
21195 !! html/parsoid
21196 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21197
21198 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21199 </ol>
21200
21201 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21202
21203 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21204 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21205 </ol>
21206 !!end
21207
21208 !!test
21209 References: 4. only referenced group should be cleared after processing references
21210 !! wikitext
21211 A <ref group="a">afoo</ref>
21212 B <ref>bfoo</ref>
21213
21214 <references group="a" />
21215
21216 C <ref>cfoo</ref>
21217
21218 <references />
21219 !! html/parsoid
21220 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21221 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
21222
21223 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
21224 </ol>
21225
21226 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
21227
21228 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
21229 </ol>
21230 !!end
21231
21232 !!test
21233 References: 5. ref tags in references should be processed while ignoring all other content
21234 !! wikitext
21235 A <ref name="a" />
21236 B <ref name="b">bar</ref>
21237
21238 <references>
21239 <ref name="a">foo</ref>
21240 This should just get lost.
21241 </references>
21242 !! html/parsoid
21243 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
21244 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21245
21246
21247 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21248 </ol>
21249 !!end
21250
21251 !!test
21252 References: 6. <references /> from a transclusion
21253 !! wikitext
21254 <ref>Foo</ref> {{echo|<references />}}
21255 !! html/parsoid
21256 <p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-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"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
21257 </ol>
21258 !!end
21259
21260 !! test
21261 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21262 !! wikitext
21263 A <ref>foo bar for a</ref>
21264 B <ref group="X" name="b" />
21265
21266 <references />
21267
21268 <references group="X">
21269 <ref name="b">foo</ref>
21270 </references>
21271 !! html/parsoid
21272 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21273 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
21274 </p>
21275
21276 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21277 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
21278 </ol>
21279
21280 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21281 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
21282 </ol>
21283 !! end
21284
21285 !! test
21286 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21287 !! wikitext
21288 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21289 <references />
21290 !! html/parsoid
21291 <p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21292 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
21293 </ol>
21294 !!end
21295
21296 # This test only works in wt2html now as the <references /> are always generated
21297 # unless selser is active. Once T72722 is fixed, we should add a changes test
21298 # here to ensure that unrelated changes don't add the new <references /> in
21299 # wt2wt.
21300 !! test
21301 References: 9. Generate missing references list at the end
21302 !! wikitext
21303 A <ref>foo</ref>
21304 B <ref group="inexistent">bar</ref>
21305 !! html/parsoid
21306 <p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
21307 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21308 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21309 </ol>
21310 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21311 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21312 </ol>
21313 !! end
21314
21315 !! test
21316 References: 10. New <references/> shouldn't be added for unrelated edits.
21317 !! options
21318 parsoid={
21319 "modes": ["selser"],
21320 "changes": [["#x", "remove"]],
21321 "selser": "noauto"
21322 }
21323 !! wikitext
21324 Unrelated text<span id="x"> that's going to disappear</span>.
21325 A <ref>foo</ref>
21326 !! wikitext/edited
21327 Unrelated text.
21328 A <ref>foo</ref>
21329 !!end
21330
21331 !! test
21332 Entities in ref name
21333 !! wikitext
21334 <ref name="test &amp; me">hi</ref>
21335 <references />
21336 !! html/parsoid
21337 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21338 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21339 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
21340 </ol>
21341 !! end
21342
21343 # This test is wt2html only because we're permitting the serializer to produce
21344 # dirty diffs, normalizing the unclosed references to the self-closed version.
21345 !! test
21346 Generate references for unclosed references tag
21347 !! options
21348 parsoid=wt2html
21349 !! wikitext
21350 a<ref>foo</ref>
21351
21352 <references>
21353 !! html/parsoid
21354 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21355 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21356 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21357 !! end
21358
21359 !! test
21360 New reference serializes on its own line
21361 !! options
21362 parsoid=wt2wt,html2wt
21363 !! wikitext
21364 foo
21365 <references />
21366 !! html/parsoid
21367 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21368 !! end
21369
21370 #### ----------------------------------------------------------------
21371 #### Parsoid-only testing of Parsoid's impl of LST
21372 #### Not implemented yet, see
21373 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21374 #### ----------------------------------------------------------------
21375
21376 !!test
21377 LST Sections: 1. Simple section start and end
21378 !! wikitext
21379 <section begin="2011-05-16" />
21380 <section end="2014-04-10 (MW 1.23wmf22)" />
21381 !! html/parsoid
21382 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21383 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21384 !! end
21385
21386 #--------- Test stripping of empty nodes in template content ----------
21387 !!test
21388 Empty LI and TR nodes should be stripped from template content
21389 !!wikitext
21390 {{EmptyLITest}}
21391 {{EmptyTRTest}}
21392 !!html/parsoid
21393 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21394 <li>a</li>
21395 <li>b</li>
21396 </ul>
21397 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21398 <tbody>
21399 <tr>
21400 <td>foo</td>
21401 </tr>
21402 <tr>
21403 <td>bar</td>
21404 </tr>
21405 </tbody>
21406 </table>
21407 !!end
21408
21409 !!test
21410 Empty LI and TR nodes should not be stripped from top-level content
21411 !!wikitext
21412 * a
21413 *
21414 * b
21415 {|
21416 |-
21417 |-
21418 |foo
21419 |}
21420 !!html/parsoid
21421 <ul>
21422 <li> a</li>
21423 <li></li>
21424 <li> b</li>
21425 </ul>
21426 <table>
21427 <tbody>
21428 <tr></tr>
21429 <tr>
21430 <td>foo</td>
21431 </tr>
21432 </tbody>
21433 </table>
21434 !!end
21435
21436 !!test
21437 Empty TR nodes should not be stripped if they have any attributes set
21438 !!wikitext
21439 {{EmptyTRWithHTMLAttrTest}}
21440 !!html/parsoid
21441 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21442 <tr align="center"></tr>
21443 <tr><td>foo</td></tr>
21444 <tr align="center"></tr>
21445 <tr><td>bar</td></tr>
21446 </table>
21447 !!end
21448
21449 #### ----------------------------------------------------------------
21450 #### The following section of tests are primarily to test
21451 #### wikitext escaping capabilities of Parsoid. Given that
21452 #### escaping can be done any number of ways, the wikitext (input)
21453 #### is always adjusted to reflect how Parsoid adds nowiki
21454 #### escape tags.
21455 ####
21456 #### We are marking several tests as parsoid-only since the
21457 #### HTML in the result section is different from what the
21458 #### PHP parser generates for it.
21459 #### ----------------------------------------------------------------
21460
21461
21462 #### --------------- Headings ---------------
21463 #### 0. Unnested
21464 #### 1. Nested inside html <h1>=foo=</h1>
21465 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21466 #### 3. Nested inside html with wikitext split by html tags
21467 #### 4. No escape needed
21468 #### 5. Empty headings <h1></h1>
21469 #### 6. Heading chars in SOL context
21470 #### ----------------------------------------
21471 !! test
21472 Headings: 0. Unnested
21473 !! options
21474 parsoid
21475 !! wikitext
21476 <nowiki>=foo=</nowiki>
21477
21478 <nowiki> =foo= </nowiki>
21479 <!--cmt-->
21480 <nowiki>=foo=</nowiki>
21481
21482 =foo''a''<nowiki>=</nowiki>
21483 !! html
21484 <p><span typeof="mw:Nowiki">=foo=</span></p>
21485
21486 <p><span typeof="mw:Nowiki"> =foo= </span>
21487 <!--cmt-->
21488 <span typeof="mw:Nowiki">=foo=</span></p>
21489
21490 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21491 !!end
21492
21493 # New headings and existing headings are handled differently
21494 !! test
21495 Headings: 1. Nested inside html
21496 !! options
21497 parsoid=html2wt
21498 !! html
21499 <h1>=foo=</h1>
21500 <h2>=foo=</h2>
21501 <h3>=foo=</h3>
21502
21503 <h1 data-parsoid=''>=foo=</h1>
21504 <h2 data-parsoid=''>=foo=</h2>
21505 <h3 data-parsoid=''>=foo=</h3>
21506 <h4 data-parsoid=''>=foo=</h4>
21507 <h5 data-parsoid=''>=foo=</h5>
21508 <h6 data-parsoid=''>=foo=</h6>
21509 !! wikitext
21510 = =foo= =
21511
21512 == =foo= ==
21513
21514 === =foo= ===
21515
21516 =<nowiki>=foo=</nowiki>=
21517 ==<nowiki>=foo=</nowiki>==
21518 ===<nowiki>=foo=</nowiki>===
21519 ====<nowiki>=foo=</nowiki>====
21520 =====<nowiki>=foo=</nowiki>=====
21521 ======<nowiki>=foo=</nowiki>======
21522
21523 !!end
21524
21525 !! test
21526 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21527 !! options
21528 parsoid=html2wt
21529 !! html
21530 <h1>foo</h1>*bar
21531 <h1>foo</h1>=bar
21532 <h1>foo</h1>=bar=
21533 !! wikitext
21534 = foo =
21535 <nowiki>*</nowiki>bar
21536
21537 = foo =
21538 =bar
21539
21540 = foo =
21541 <nowiki>=bar=</nowiki>
21542 !!end
21543
21544 !! test
21545 Headings: 3. Nested inside html with wikitext split by html tags
21546 !! options
21547 parsoid=html2wt,wt2wt
21548 !! wikitext
21549 = ='''bold'''<nowiki>foo=</nowiki> =
21550 !! html/parsoid
21551 <h1>=<b>bold</b>foo=</h1>
21552 !!end
21553
21554 !! test
21555 Headings: 4a. No escaping needed (testing just h1 and h2)
21556 !! wikitext
21557 = =foo =
21558
21559 = foo= =
21560
21561 = =foo= =
21562
21563 = =foo= bar =
21564
21565 == =foo ==
21566
21567 == foo= ==
21568
21569 = = =
21570
21571 = ''=''foo= =
21572 !! html/parsoid
21573 <h1>=foo</h1>
21574 <h1>foo=</h1>
21575 <h1> =foo= </h1>
21576 <h1>=foo= bar</h1>
21577 <h2>=foo</h2>
21578 <h2>foo=</h2>
21579 <h1>=</h1>
21580 <h1><i>=</i>foo=</h1>
21581 !!end
21582
21583 !! test
21584 Headings: 4b. No escaping needed (inside p-tags)
21585 !! options
21586 parsoid=html2wt
21587 !! html
21588 <p>===
21589 =foo= x
21590 =foo= <s></s>
21591 </p>
21592 !! wikitext
21593 ===
21594 =foo= x
21595 =foo= <s></s>
21596 !!end
21597
21598 !! test
21599 Headings: 5. Empty headings
21600 !! wikitext
21601 =<nowiki/>=
21602
21603 ==<nowiki/>==
21604
21605 ===<nowiki/>===
21606
21607 ====<nowiki/>====
21608
21609 =====<nowiki/>=====
21610
21611 ======<nowiki/>======
21612 !! html/parsoid
21613 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21614
21615 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21616
21617 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21618
21619 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21620
21621 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21622
21623 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21624 !!end
21625
21626 !! test
21627 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21628 !! options
21629 parsoid
21630 !! wikitext
21631 <nowiki>=a=</nowiki>
21632
21633 <nowiki>=a=</nowiki>
21634
21635 <nowiki>=a=</nowiki>
21636
21637 <nowiki>=a=</nowiki>
21638 !! html
21639 <p>=a=</p>
21640 <p>=a= </p>
21641 <p>=a= </p>
21642 <p>=a= </p>
21643 !!end
21644
21645 !! test
21646 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21647 !! options
21648 parsoid
21649 !! wikitext
21650 <nowiki>=a=
21651 b</nowiki>
21652
21653 <nowiki>=a=
21654 b</nowiki>
21655
21656 <nowiki>=a=
21657 b</nowiki>
21658
21659 <nowiki>=a=
21660 b</nowiki>
21661 !! html
21662 <p>=a=
21663 b</p>
21664 <p>=a=
21665 b</p>
21666 <p>=a=
21667 b</p>
21668 <p>=a=
21669 b</p>
21670 </p>
21671 !!end
21672
21673 !! test
21674 Headings: 6c. Heading chars in SOL context (leading newline break)
21675 !! options
21676 parsoid
21677 !! wikitext
21678 a
21679 <nowiki>=b=</nowiki>
21680 !! html
21681 <p>a
21682 =b=</p>
21683 !!end
21684
21685 !! test
21686 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21687 !! options
21688 parsoid
21689 !! wikitext
21690 <!--c0--><nowiki>=a=</nowiki>
21691
21692 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21693 !! html
21694 <p><!--c0-->=a=</p>
21695 <p><!--c1-->=a= <!--c2--> <!--c3--></p>
21696 !!end
21697
21698 !! test
21699 Headings: 6d. Heading chars in SOL context (No escaping needed)
21700 !! options
21701 parsoid=html2wt
21702 !! html
21703 =a=<div>b</div>
21704 !! wikitext
21705 =a=<div>b</div>
21706 !!end
21707
21708 !! test
21709 Headings: 7. Insert a newline between new content and headings
21710 !! options
21711 parsoid=html2wt
21712 !! html
21713 <h2>NEW</h2>
21714 <p>new</p>
21715 <h2 data-parsoid='{"dsr":[0,5,2,2]}'>A</h2>
21716 <p data-parsoid='{"dsr":[6,7,0,0]}'>a</p>
21717 !! wikitext
21718 == NEW ==
21719 new
21720
21721 ==A==
21722 a
21723
21724 !! end
21725
21726 #### --------------- Lists ---------------
21727 #### 0. Outside nests (*foo, etc.)
21728 #### 1. Nested inside html <ul><li>*foo</li></ul>
21729 #### 2. Inside definition lists
21730 #### 3. Only bullets at start should be escaped
21731 #### 4. No escapes needed
21732 #### 5. No unnecessary escapes
21733 #### 6. Escape bullets in SOL position
21734 #### 7. Escape bullets in a multi-line context
21735 #### ----------------------------------------
21736
21737 !! test
21738 Lists: 0. Outside nests
21739 !! wikitext
21740 <nowiki>*</nowiki>foo
21741
21742 <nowiki>#</nowiki>foo
21743
21744 <nowiki>;Foo:</nowiki>bar
21745 !! html
21746 <p>*foo
21747 </p><p>#foo
21748 </p><p>;Foo:bar
21749 </p>
21750 !!end
21751
21752 !! test
21753 Lists: 1. Nested inside html
21754 !! wikitext
21755 *<nowiki>*foo</nowiki>
21756
21757 *<nowiki>#foo</nowiki>
21758
21759 *<nowiki>:foo</nowiki>
21760
21761 *<nowiki>;foo</nowiki>
21762
21763 #<nowiki>*foo</nowiki>
21764
21765 #<nowiki>#foo</nowiki>
21766
21767 #<nowiki>:foo</nowiki>
21768
21769 #<nowiki>;foo</nowiki>
21770 !! html
21771 <ul><li>*foo</li></ul>
21772 <ul><li>#foo</li></ul>
21773 <ul><li>:foo</li></ul>
21774 <ul><li>;foo</li></ul>
21775 <ol><li>*foo</li></ol>
21776 <ol><li>#foo</li></ol>
21777 <ol><li>:foo</li></ol>
21778 <ol><li>;foo</li></ol>
21779
21780 !!end
21781
21782 !! test
21783 Lists: 2. Inside definition lists
21784 !! wikitext
21785 ;<nowiki>;foo</nowiki>
21786
21787 ;<nowiki>:foo</nowiki>
21788
21789 ;<nowiki>:foo</nowiki>
21790 :bar
21791
21792 :<nowiki>:foo</nowiki>
21793 !! html
21794 <dl><dt>;foo</dt></dl>
21795 <dl><dt>:foo</dt></dl>
21796 <dl><dt>:foo</dt>
21797 <dd>bar</dd></dl>
21798 <dl><dd>:foo</dd></dl>
21799
21800 !!end
21801
21802 !! test
21803 Lists: 3. Only bullets at start of text should be escaped
21804 !! wikitext
21805 *<nowiki>*foo*bar</nowiki>
21806
21807 *<nowiki>*foo</nowiki>''it''*bar
21808 !! html
21809 <ul><li>*foo*bar</li></ul>
21810 <ul><li>*foo<i>it</i>*bar</li></ul>
21811
21812 !!end
21813
21814 !! test
21815 Lists: 4. No escapes needed
21816 !! options
21817 parsoid
21818 !! wikitext
21819 *foo*bar
21820
21821 *''foo''*bar
21822
21823 *[[Foo]]: bar
21824
21825 *[[Foo]]*bar
21826 !! html
21827 <ul>
21828 <li>foo*bar
21829 </li>
21830 </ul>
21831 <ul>
21832 <li><i>foo</i>*bar
21833 </li>
21834 </ul>
21835 <ul>
21836 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
21837 </li>
21838 </ul>
21839 <ul>
21840 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
21841 </li>
21842 </ul>
21843 !!end
21844
21845 !! test
21846 Lists: 5. No unnecessary escapes
21847 !! wikitext
21848 * bar <span><nowiki>[[foo]]</nowiki></span>
21849
21850 * =bar <span><nowiki>[[foo]]</nowiki></span>
21851
21852 * [[bar <span><nowiki>[[foo]]</nowiki></span>
21853
21854 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
21855
21856 * =bar <span>foo]]</span>=
21857
21858 * <s></s>: a
21859
21860 * ''* foo''
21861 !! html
21862 <ul><li> bar <span>[[foo]]</span></li></ul>
21863 <ul><li> =bar <span>[[foo]]</span></li></ul>
21864 <ul><li> [[bar <span>[[foo]]</span></li></ul>
21865 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
21866 <ul><li> =bar <span>foo]]</span>=</li></ul>
21867 <ul><li> <s></s>: a</li></ul>
21868 <ul><li> <i>* foo</i></li></ul>
21869
21870 !!end
21871
21872 !! test
21873 Lists: 6. Escape bullets in SOL position
21874 !! options
21875 parsoid=html2wt
21876 !! html
21877 <p><!--cmt-->*foo</p>
21878 !! wikitext
21879 <!--cmt--><nowiki>*</nowiki>foo
21880 !!end
21881
21882 !! test
21883 Lists: 7. Escape bullets in a multi-line context
21884 !! wikitext
21885 a
21886 <nowiki>*</nowiki>b
21887 !! html
21888 <p>a
21889 *b
21890 </p>
21891 !!end
21892
21893 !! test
21894 Lists: 8. Escape colons only if not present in tags
21895 !! options
21896 parsoid=html2wt
21897 !! html
21898 <dl><dt>a:b<i>c:d</i></dt></dl>
21899 !! wikitext
21900 ; <nowiki>a:b</nowiki>''c:d''
21901 !! end
21902
21903 #### --------------- HRs ---------------
21904 #### 1. Single line
21905 #### -----------------------------------
21906
21907 !! test
21908 HRs: 1. Single line
21909 !! wikitext
21910 ----<nowiki>----</nowiki>
21911 ----=foo=
21912 ----*foo
21913 !! html+tidy
21914 <hr />
21915 <p>----</p>
21916 <hr />
21917 <p>=foo=</p>
21918 <hr />
21919 <p>*foo</p>
21920 !! end
21921
21922 #### --------------- Tables ---------------
21923 #### 1a. Simple example
21924 #### 1b. No escaping needed (!foo)
21925 #### 1c. No escaping needed (|foo)
21926 #### 1d. No escaping needed (|}foo)
21927 ####
21928 #### 2a. Nested in td (<td>foo|bar</td>)
21929 #### 2b. Nested in td (<td>foo||bar</td>)
21930 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
21931 ####
21932 #### 3a. Nested in th (<th>foo!bar</th>)
21933 #### 3b. Nested in th (<th>foo!!bar</th>)
21934 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
21935 ####
21936 #### 4a. Escape -
21937 #### 4b. Escape +
21938 #### 4c. No escaping needed
21939 #### --------------------------------------
21940
21941 !! test
21942 Tables: 1a. Simple example
21943 !! wikitext
21944 <nowiki>{|
21945 |}</nowiki>
21946 !! html
21947 <p>{|
21948 |}
21949 </p>
21950 !! end
21951
21952 !! test
21953 Tables: 1b. No escaping needed
21954 !! wikitext
21955 !foo
21956 !! html
21957 <p>!foo
21958 </p>
21959 !! end
21960
21961 !! test
21962 Tables: 1c. No escaping needed
21963 !! wikitext
21964 |foo
21965 !! html
21966 <p>|foo
21967 </p>
21968 !! end
21969
21970 !! test
21971 Tables: 1d. No escaping needed
21972 !! wikitext
21973 |}foo
21974 !! html
21975 <p>|}foo
21976 </p>
21977 !! end
21978
21979 !! test
21980 Tables: 2a. Nested in td
21981 !! options
21982 parsoid=html2wt
21983 !! html/parsoid
21984 <table><tbody><tr>
21985 <td>foo|bar</td></tr>
21986 <tr><td>x<div>a|b</div></td>
21987 </tbody></table>
21988 !! wikitext
21989 {|
21990 |<nowiki>foo|bar</nowiki>
21991 |-
21992 |x<div><nowiki>a|b</nowiki></div>
21993 |}
21994 !! html/php+tidy
21995 <table>
21996 <tr>
21997 <td>foo|bar</td>
21998 </tr>
21999 <tr>
22000 <td>x
22001 <div>a|b</div>
22002 </td>
22003 </tr>
22004 </table>
22005 !! end
22006
22007 !! test
22008 Tables: 2b. Nested in td
22009 !! options
22010 parsoid=html2wt
22011 !! html/parsoid
22012 <table><tbody><tr>
22013 <td>foo||bar</td>
22014 <td>a<i>b||c</i></td>
22015 <td>a<i><div>b||c</div></i></td>
22016 </tr></tbody></table>
22017 !! wikitext
22018 {|
22019 |<nowiki>foo||bar</nowiki>
22020 |a''<nowiki>b||c</nowiki>''
22021 |a''<div><nowiki>b||c</nowiki></div>''
22022 |}
22023 !! html/php
22024 <table>
22025 <tr>
22026 <td>foo||bar
22027 </td>
22028 <td>a<i>b||c</i>
22029 </td>
22030 <td>a<i><div>b||c</div></i>
22031 </td></tr></table>
22032
22033 !! end
22034
22035 !! test
22036 Tables: 2c. Nested in td -- no escaping needed
22037 !! wikitext
22038 {|
22039
22040 |foo!!bar
22041 |}
22042 !! html/*
22043 <table>
22044
22045 <tr>
22046 <td>foo!!bar
22047 </td></tr></table>
22048
22049 !! end
22050
22051 !! test
22052 Tables: 3a. Nested in th
22053 !! wikitext
22054 {|
22055
22056 !foo!bar
22057 |}
22058 !! html/*
22059 <table>
22060
22061 <tr>
22062 <th>foo!bar
22063 </th></tr></table>
22064
22065 !! end
22066
22067 !! test
22068 Tables: 3b. Nested in th
22069 !! options
22070 parsoid=html2wt
22071 !! html/parsoid
22072 <table><tbody>
22073 <tr><th>foo!!bar</th>
22074 <th><i>foo|bar</i></th>
22075 <th><i>foo!!bar</i></th>
22076 <th><i><span>foo!!bar</span></i></th>
22077 </tr></tbody></table>
22078 !! wikitext
22079 {|
22080 !<nowiki>foo!!bar</nowiki>
22081 !''<nowiki>foo|bar</nowiki>''
22082 !''<nowiki>foo!!bar</nowiki>''
22083 !''<span><nowiki>foo!!bar</nowiki></span>''
22084 |}
22085 !! html/php
22086 <table>
22087 <tr>
22088 <th>foo!!bar
22089 </th>
22090 <th><i>foo|bar</i>
22091 </th>
22092 <th><i>foo!!bar</i>
22093 </th>
22094 <th><i><span>foo!!bar</span></i>
22095 </th></tr></table>
22096
22097 !! end
22098
22099 !! test
22100 Tables: 3c. Nested in th
22101 !! options
22102 parsoid=html2wt
22103 !! html/parsoid
22104 <table><tbody>
22105 <tr><th>foo||bar</th>
22106 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22107 </tr></tbody></table>
22108 !! wikitext
22109 {|
22110 !<nowiki>foo||bar</nowiki>
22111 !<nowiki>foo||bar</nowiki>
22112 |}
22113 !! html/php
22114 <table>
22115 <tr>
22116 <th>foo||bar
22117 </th>
22118 <th>foo||bar
22119 </th></tr></table>
22120
22121 !! end
22122
22123 !! test
22124 Tables: 4a. Escape -
22125 !! options
22126 parsoid=html2wt
22127 !! html/*
22128 <table>
22129
22130 <tr>
22131 <th>-bar
22132 </th></tr>
22133 <tr>
22134 <td>-bar
22135 </td></tr></table>
22136
22137 !! wikitext
22138 {|
22139
22140 !-bar
22141
22142 |-
22143 |<nowiki>-bar</nowiki>
22144 |}
22145 !! end
22146
22147 !! test
22148 Tables: 4b. Escape +
22149 !! options
22150 parsoid=html2wt
22151 !! html/*
22152 <table>
22153
22154 <tr>
22155 <th>+bar
22156 </th></tr>
22157 <tr>
22158 <td>+bar
22159 </td></tr></table>
22160
22161 !! wikitext
22162 {|
22163
22164 !+bar
22165
22166 |-
22167 |<nowiki>+bar</nowiki>
22168 |}
22169 !! end
22170
22171 !! test
22172 Tables: 4c. No escaping needed
22173 !! wikitext
22174 {|
22175 |foo-bar
22176 |foo+bar
22177 |-
22178 |''foo''-bar
22179 |''foo''+bar
22180 |-
22181 |foo
22182 bar|baz
22183 +bar
22184 -bar
22185 |-
22186 |x
22187 <div>a|b</div>
22188 |}
22189 !! html/php
22190 <table>
22191 <tr>
22192 <td>foo-bar
22193 </td>
22194 <td>foo+bar
22195 </td></tr>
22196 <tr>
22197 <td><i>foo</i>-bar
22198 </td>
22199 <td><i>foo</i>+bar
22200 </td></tr>
22201 <tr>
22202 <td>foo
22203 <p>bar|baz
22204 +bar
22205 -bar
22206 </p>
22207 </td></tr>
22208 <tr>
22209 <td>x
22210 <div>a|b</div>
22211 </td></tr></table>
22212
22213 !! html/parsoid
22214 <table><tbody>
22215 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22216 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22217 <tr><td>foo
22218 <p>bar|baz
22219 +bar
22220 -bar</p></td></tr>
22221 <tr><td>x
22222 <div>a|b</div></td>
22223 </tbody></table>
22224 !! end
22225
22226 !! test
22227 Tables: 4d. No escaping needed
22228 !! wikitext
22229 {|
22230 |[[Foo]]-bar
22231 ||+1
22232 ||-2
22233 |}
22234 !! html/php
22235 <table>
22236 <tr>
22237 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22238 </td>
22239 <td>+1
22240 </td>
22241 <td>-2
22242 </td></tr></table>
22243
22244 !! html/parsoid
22245 <table>
22246 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22247 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22248 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22249 </tbody></table>
22250 !! end
22251
22252 !! test
22253 Tables: Digest broken attributes on table and tr tag
22254 !! options
22255 parsoid=wt2html
22256 !! wikitext
22257 {| || |} ++
22258 |- || || ++ --
22259 |- > [
22260 |}
22261 !! html
22262 <table>
22263 <tbody>
22264 <tr></tr>
22265 <tr></tr>
22266 </tbody></table>
22267 !! end
22268
22269 !! test
22270 T97430: Don't emit empty nowiki pairs around marker meta tags
22271 !! options
22272 parsoid=html2wt
22273 !! html
22274 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22275 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22276 !! wikitext
22277 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22278 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22279 !! end
22280
22281 !! test
22282 Unclosed xmlish element in table line shouldn't eat end delimiters
22283 !! wikitext
22284 {|
22285 | <foo
22286 | bar>
22287 |}
22288 !! html/php
22289 <table>
22290 <tr>
22291 <td> &lt;foo
22292 </td>
22293 <td> bar&gt;
22294 </td></tr></table>
22295
22296 !! html/parsoid
22297 <table>
22298 <tbody><tr><td> &lt;foo</td>
22299 <td> bar></td></tr>
22300 </tbody></table>
22301 !! end
22302
22303 #### --------------- Links ----------------
22304 #### 1. Quote marks in link text
22305 #### 2. Wikilinks: Escapes needed
22306 #### 3. Wikilinks: No escapes needed
22307 #### 4. Extlinks: Escapes needed
22308 #### 5. Extlinks: No escapes needed
22309 #### --------------------------------------
22310 !! test
22311 Links 1. WikiLinks: No escapes needed
22312 !! wikitext
22313 [[Foo|Foo''boo'']]
22314 [[Foo|[Foobar]]]
22315 [[Foo|x [Foobar] x]]
22316 !! html/php
22317 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22318 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22319 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22320 </p>
22321 !! html/parsoid
22322 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22323 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22324 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22325 !! end
22326
22327 !! test
22328 Links 2. WikiLinks: Escapes needed
22329 !! options
22330 parsoid=html2wt
22331 !! html/parsoid
22332 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22333 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22334 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22335 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22336 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22337 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22338 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22339 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22340 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22341 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22342 !! wikitext
22343 [[Foo|<nowiki>Foobar]</nowiki>]]
22344 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22345 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22346 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22347 [[Foo|<nowiki>|Bar</nowiki>]]
22348 [[Foo|<nowiki>]]bar</nowiki>]]
22349 [[Foo|<nowiki>[[bar</nowiki>]]
22350 [[Foo|<nowiki>x [[ y</nowiki>]]
22351 [[Foo|<nowiki>x ]] y</nowiki>]]
22352 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22353 !! html/php
22354 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22355 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22356 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22357 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22358 <a href="/wiki/Foo" title="Foo">|Bar</a>
22359 <a href="/wiki/Foo" title="Foo">]]bar</a>
22360 <a href="/wiki/Foo" title="Foo">[[bar</a>
22361 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22362 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22363 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22364 </p>
22365 !! end
22366
22367 !! test
22368 Links 3. WikiLinks: No escapes needed
22369 !! wikitext
22370 [[Foo|[Foobar]]
22371 [[Foo|foo|bar]]
22372 !! html/php
22373 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22374 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22375 </p>
22376 !! html/parsoid
22377 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22378 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22379 !! end
22380
22381 !! test
22382 Links 4. ExtLinks: Escapes needed
22383 !! options
22384 parsoid=html2wt
22385 !! html/parsoid
22386 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22387 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22388 <p>[http://google.com]</p>
22389 <p>[http://google.com google]</p>
22390 !! wikitext
22391 [http://google.com <nowiki>[google]</nowiki>]
22392 [http://google.com <nowiki>google]</nowiki>]
22393
22394 <nowiki>[http://google.com]</nowiki>
22395
22396 <nowiki>[http://google.com google]</nowiki>
22397
22398 !! html/php
22399 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22400 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22401 </p><p>[http://google.com]
22402 </p><p>[http://google.com google]
22403 </p>
22404 !! end
22405
22406 !! test
22407 Links 5. ExtLinks: No escapes needed
22408 !! wikitext
22409 [http://google.com [google]
22410 !! html/php
22411 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22412 </p>
22413 !! html/parsoid
22414 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22415 !! end
22416
22417 !! test
22418 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22419 !! html/parsoid
22420 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22421 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22422 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22423 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22424 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22425 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22426 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22427 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22428 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22429 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22430 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22431 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22432 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22433 </p>
22434 !! wikitext
22435 x<nowiki/>http://example.com<nowiki/>y
22436 http://example.com<nowiki/>?x
22437 http://example.com<nowiki/>&x
22438 http://example.com<nowiki/>'x
22439 http://example.com<nowiki/>,x
22440 http://example.com<nowiki/>.x
22441 http://example.com<nowiki/>;x
22442 http://example.com<nowiki/>:x
22443 http://example.com<nowiki/>;x
22444 http://example.com<nowiki/>!x
22445 http://example.com<nowiki/>=x
22446 http://example.com<nowiki/>(x)
22447 http://example.com(x<nowiki/>)
22448 !! end
22449
22450 !! test
22451 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22452 !! html/parsoid
22453 <p>x
22454 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22455 y
22456 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22457 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22458 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22459 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22460 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22461 </p>
22462 !! wikitext
22463 x
22464 http://example.com
22465 y
22466 "http://example.com"
22467 (http://example.com)
22468 (http://example.com) foo
22469 http://example.com,
22470 http://example.com, foo
22471 !! html/php
22472 <p>x
22473 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22474 y
22475 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22476 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22477 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22478 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22479 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22480 </p>
22481 !! end
22482
22483 !! test
22484 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22485 !! html/parsoid
22486 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22487 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22488 !! wikitext
22489 http://example.com.,;:!?\
22490 -http://example.com:
22491 !! html/php
22492 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22493 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22494 </p>
22495 !! end
22496
22497 !! test
22498 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22499 !! html/parsoid
22500 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22501 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22502 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22503 !! wikitext
22504 RFC 123<nowiki/>4
22505 RFC 123<nowiki/>y
22506 X<nowiki/>RFC 123<nowiki/>y
22507 !! end
22508
22509 !! test
22510 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22511 !! html/parsoid
22512 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22513 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22514 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22515 </p>
22516 !! wikitext
22517 RFC 123?foo
22518 RFC 123&foo
22519 -RFC 123-
22520 !! html/php
22521 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22522 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22523 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22524 </p>
22525 !! end
22526
22527 !! test
22528 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22529 !! html/parsoid
22530 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22531 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22532 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22533 !! wikitext
22534 PMID 123<nowiki/>4
22535 PMID 123<nowiki/>y
22536 X<nowiki/>PMID 123<nowiki/>y
22537 !! end
22538
22539 !! test
22540 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22541 !! html/parsoid
22542 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22543 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22544 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22545 </p>
22546 !! wikitext
22547 PMID 123?foo
22548 PMID 123&foo
22549 -PMID 123-
22550 !! html/php
22551 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22552 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22553 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22554 </p>
22555 !! end
22556
22557 !! test
22558 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22559 !! html/parsoid
22560 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22561 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22562 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22563 </p>
22564 !! wikitext
22565 ISBN 1234567890<nowiki/>1
22566 ISBN 1234567890<nowiki/>x
22567 a<nowiki/>ISBN 1234567890<nowiki/>b
22568 !! end
22569
22570 !! test
22571 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22572 !! html/parsoid
22573 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22574 !! wikitext
22575 -ISBN 1234567890's
22576 !! html/php
22577 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22578 </p>
22579 !! end
22580
22581 !! test
22582 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22583 !! options
22584 parsoid=html2wt
22585 !! html/*
22586 <p>this is not a link: http://example.com
22587 </p>
22588 !! wikitext
22589 this is not a link: <nowiki>http://example.com</nowiki>
22590 !! end
22591
22592 !! test
22593 Links 15. Link trails can't become link prefixes.
22594 !! options
22595 language=is
22596 !! wikitext
22597 [[Söfnuður]]-[[00]]
22598 !! html/php
22599 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
22600 </p>
22601 !! html/parsoid
22602 <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
22603 !! end
22604
22605 #### --------------- Quotes ---------------
22606 #### 1. Quotes inside <b> and <i>
22607 #### 2. Link fragments separated by <i> and <b> tags
22608 #### 3. Link fragments inside <i> and <b>
22609 #### 4. No escaping needed
22610 #### --------------------------------------
22611 !! test
22612 1a. Quotes inside <b> and <i>
22613 !! options
22614 parsoid=html2wt,wt2wt
22615 !! wikitext
22616 ''<nowiki/>'foo'''
22617 ''<nowiki>''foo''</nowiki>''
22618 ''<nowiki>'''foo'''</nowiki>''
22619 ''foo''<nowiki/>'s
22620 '''<nowiki/>'foo''''
22621 '''<nowiki>''foo''</nowiki>'''
22622 '''<nowiki>'''foo'''</nowiki>'''
22623 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22624 '''foo'''<nowiki/>'s
22625 '''foo''
22626 ''foo''<nowiki/>'
22627 ''foo'''<nowiki/>'
22628 '''foo''<nowiki/>'
22629 ''''foo'''
22630 '''foo'''<nowiki/>'
22631 ''''foo'''<nowiki/>'
22632 ''fools'<span> errand</span>''
22633 ''<span>fool</span>'s errand''
22634 '<nowiki/>''foo'' bar '''baz''
22635 a|!*#-:;+-~[]{}b'''x''
22636 !! html/*
22637 <p><i>'foo'</i>
22638 <i>''foo''</i>
22639 <i>'''foo'''</i>
22640 <i>foo</i>'s
22641 <b>'foo'</b>
22642 <b>''foo''</b>
22643 <b>'''foo'''</b>
22644 <b>foo'<i>bar'</i>baz</b>
22645 <b>foo</b>'s
22646 '<i>foo</i>
22647 <i>foo</i>'
22648 <i>foo'</i>'
22649 '<i>foo</i>'
22650 '<b>foo</b>
22651 <b>foo</b>'
22652 '<b>foo</b>'
22653 <i>fools'<span> errand</span></i>
22654 <i><span>fool</span>'s errand</i>
22655 '<i>foo</i> bar '<i>baz</i>
22656 a|!*#-:;+-~[]{}b'<i>x</i>
22657 </p>
22658 !! end
22659
22660 !! test
22661 1b. Quotes inside <b> and <i> with other tags on same line
22662 !! options
22663 parsoid=html2wt,wt2wt
22664 !! wikitext
22665 '''a'' foo ''[[bar]]''
22666 ''a''' foo ''[[bar]]''
22667 ''a''' foo '''{{echo|[[bar]]}}'''
22668 [[foo]] x'''[[bar]]''
22669 '''foo'' <ref>test</ref>
22670 '''foo'' <div title="name">test</div>
22671 '''foo'' and <br> bar
22672 <references />
22673 !! html
22674 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22675 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22676 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
22677 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22678 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22679 '<i>foo</i> <div title="name">test</div>
22680 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22681 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22682 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
22683 </ol>
22684 !! end
22685
22686 !! test
22687 2. Link fragments separated by <i> and <b> tags
22688 !! wikitext
22689 [[''foo''<nowiki>hello]]</nowiki>
22690
22691 [['''foo'''<nowiki>hello]]</nowiki>
22692 !! html
22693 <p>[[<i>foo</i>hello]]
22694 </p><p>[[<b>foo</b>hello]]
22695 </p>
22696 !! end
22697
22698 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22699 # this is one of the shortcomings of this format
22700 !! test
22701 3. Link fragments inside <i> and <b>
22702 !! wikitext
22703 ''[[foo''<nowiki>]]</nowiki>
22704
22705 '''[[foo'''<nowiki>]]</nowiki>
22706 !! html
22707 <p><i>[[foo</i>]]
22708 </p><p><b>[[foo</b>]]
22709 </p>
22710 !! end
22711
22712 !! test
22713 4. No escaping needed
22714 !! wikitext
22715 '<span>''bar''</span>'
22716 '<span>'''bar'''</span>'
22717 'a:b'foo
22718 !! html
22719 <p>'<span><i>bar</i></span>'
22720 '<span><b>bar</b></span>'
22721 'a:b'foo
22722 </p>
22723 !! end
22724
22725 #### ----------- Paragraphs ---------------
22726 #### 1. No unnecessary escapes
22727 #### --------------------------------------
22728
22729 !! test
22730 1. No unnecessary escapes
22731 !! wikitext
22732 bar <span><nowiki>[[foo]]</nowiki></span>
22733
22734 =bar <span><nowiki>[[foo]]</nowiki></span>
22735
22736 [[bar <span><nowiki>[[foo]]</nowiki></span>
22737
22738 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22739
22740 =bar <span>foo]]</span><nowiki>=</nowiki>
22741 !! html
22742 <p>bar <span>[[foo]]</span>
22743 </p><p>=bar <span>[[foo]]</span>
22744 </p><p>[[bar <span>[[foo]]</span>
22745 </p><p>]]bar <span>[[foo]]</span>
22746 </p><p>=bar <span>foo]]</span>=
22747 </p>
22748 !!end
22749
22750 #### ----------------------- PRE --------------------------
22751 #### 1. Leading whitespace in SOL context should be escaped
22752 #### ------------------------------------------------------
22753 !! test
22754 1. Leading whitespace in SOL context should be escaped
22755 !! options
22756 parsoid
22757 !! wikitext
22758 <nowiki> </nowiki>a
22759
22760 <nowiki> </nowiki> a
22761
22762 <nowiki> </nowiki>a(tab)
22763
22764 <nowiki> </nowiki> a
22765 <!--cmt-->
22766 <nowiki> </nowiki> a
22767
22768 a
22769 <nowiki> </nowiki>b
22770
22771 a
22772 <nowiki> </nowiki>b
22773
22774 a
22775 <nowiki> </nowiki> b
22776 !! html
22777 <p> a</p>
22778 <p> a</p>
22779 <p> a(tab)</p>
22780 <p> a</p>
22781 <p><!--cmt--> a</p>
22782 <p>a
22783 b</p>
22784 <p>a
22785 b</p>
22786 <p>a
22787 b</p>
22788 !! end
22789
22790 !! test
22791 2. Leading whitespace in non-indent-pre contexts should not be escaped
22792 !! options
22793 parsoid
22794 !! wikitext
22795 foo <ref>''a''
22796 b</ref>
22797 <references />
22798 !! html
22799 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22800 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22801 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
22802 b</span></li>
22803 </ol>
22804 !! end
22805
22806 !! test
22807 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
22808 !! options
22809 parsoid
22810 !! wikitext
22811 <blockquote>
22812 a
22813 <span>b</span>
22814 c
22815 </blockquote>
22816 !! html
22817 <blockquote>
22818 <p>
22819 a
22820 <span>b</span>
22821 c</p>
22822 </blockquote>
22823 !! end
22824
22825 !! test
22826 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
22827 !! options
22828 parsoid
22829 !! wikitext
22830 [[File:Foobar.jpg|thumb|caption]]
22831 !! html/parsoid
22832 <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/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
22833 !! end
22834
22835 !! test
22836 5. Nowiki escaping should account for indent-pres
22837 !! options
22838 parsoid=html2wt
22839 !! html
22840 <pre>==foo==</pre>
22841 !! wikitext
22842 ==foo==
22843 !! end
22844
22845 !!test
22846 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
22847 !! options
22848 parsoid
22849 !! wikitext
22850 * foo
22851 * bar
22852 !! html
22853 <pre>
22854 * foo
22855 * bar
22856 </pre>
22857 !! end
22858
22859 #### --------------- Behavior Switches --------------------
22860
22861 !! test
22862 1. Valid behavior switches should be escaped
22863 !! options
22864 parsoid=html2wt
22865 !! html
22866 __TOC__
22867 <i>__TOC__</i>
22868 !! wikitext
22869 <nowiki>__TOC__</nowiki>
22870 ''<nowiki>__TOC__</nowiki>''
22871 !! end
22872
22873 !! test
22874 2. Invalid behavior switches should not be escaped
22875 !! options
22876 parsoid=html2wt
22877 !! html
22878 __TOO__
22879 __|__
22880 !! wikitext
22881 __TOO__
22882 __|__
22883 !! end
22884
22885 # We use indent-pre as an indirect way to test for sol-transparent behavior.
22886 !! test
22887 Behavior switches should be SOL-transparent
22888 !! wikitext
22889 __TOC__
22890
22891 <!-- this one's bogus -->
22892 __TOO__
22893
22894 __TOC__ foo
22895
22896 __TOC__ bar
22897 !! html/parsoid
22898 <meta property="mw:PageProp/toc" />
22899
22900 <!-- this one's bogus -->
22901 <pre>__TOO__</pre>
22902
22903 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
22904
22905 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
22906 !! end
22907
22908 #### --------------- HTML tags ---------------
22909 #### 1. a tags
22910 #### 2. other tags
22911 #### 3. multi-line html tag
22912 #### 4. extension tags
22913 #### -----------------------------------------
22914 !! test
22915 1. a tags
22916 !! options
22917 parsoid
22918 !! wikitext
22919 <a href="http://google.com">google</a>
22920 !! html
22921 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
22922 !! end
22923
22924 !! test
22925 2. other tags
22926 !! wikitext
22927 * <nowiki><div>foo</div></nowiki>
22928 * <nowiki><div style="color:red">foo</div></nowiki>
22929 * <nowiki><td></nowiki>
22930 !! html
22931 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
22932 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
22933 <li> &lt;td&gt;</li></ul>
22934
22935 !! end
22936
22937 !! test
22938 3. multi-line html tag
22939 !! wikitext
22940 <nowiki><div
22941 >foo</div
22942 ></nowiki>
22943 !! html
22944 <p>&lt;div
22945 &gt;foo&lt;/div
22946 &gt;
22947 </p>
22948 !! end
22949
22950 !! test
22951 4. extension tags
22952 !! wikitext
22953 <nowiki><ref>foo</ref></nowiki>
22954
22955 <nowiki><ref>bar</nowiki>
22956
22957 baz<nowiki></ref></nowiki>
22958 !! html
22959 <p>&lt;ref&gt;foo&lt;/ref&gt;
22960 </p><p>&lt;ref&gt;bar
22961 </p><p>baz&lt;/ref&gt;
22962 </p>
22963 !! end
22964
22965 #### --------------- Others ---------------
22966 !! test
22967 Escaping nowikis
22968 !! wikitext
22969 &lt;nowiki&gt;foo&lt;/nowiki&gt;
22970 !! html
22971 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
22972 </p>
22973 !! end
22974
22975 ## The quote-char in the input is necessary for triggering the bug
22976 !! test
22977 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
22978 !! options
22979 parsoid=wt2wt,html2wt
22980 !! wikitext
22981 foo's bar :
22982 !! html
22983 <p>foo's bar :</p>
22984 !! end
22985
22986 !! test
22987
22988 Tag-like HTML structures are passed through as text
22989 !! wikitext
22990 <x y>
22991
22992 <x.y>
22993
22994 <x-y>
22995
22996 1>2
22997
22998 x<y
22999
23000 a>b
23001
23002 1<d e>f
23003 !! html
23004 <p>&lt;x y&gt;
23005 </p><p>&lt;x.y&gt;
23006 </p><p>&lt;x-y&gt;
23007 </p><p>1&gt;2
23008 </p><p>x&lt;y
23009 </p><p>a&gt;b
23010 </p><p>1&lt;d e&gt;f
23011 </p>
23012 !! end
23013
23014 !! test
23015 HTML tag with necessary entities in attributes
23016 !! wikitext
23017 <span title="&amp;amp;">foo</span>
23018 !! html
23019 <p><span title="&amp;amp;">foo</span>
23020 </p>
23021 !! end
23022
23023 !! test
23024 HTML tag with 'unnecessary' entity encoding in attributes
23025 !! wikitext
23026 <span title="&amp;">foo</span>
23027 !! html
23028 <p><span title="&amp;">foo</span>
23029 </p>
23030 !! end
23031
23032 !! test
23033 HTML tag with broken attribute value quoting
23034 !! wikitext
23035 <span title="Hello world>Foo</span>
23036 !! html/php
23037 <p><span>Foo</span>
23038 </p>
23039 !! html/parsoid
23040 <p><span title="Hello world">Foo</span>
23041 </p>
23042 !! end
23043
23044 !! test
23045 Parsoid-only: HTML tag with broken attribute value quoting
23046 !! options
23047 parsoid
23048 !! wikitext
23049 <span title="Hello world>Foo</span>
23050 !! html
23051 <p><span title="Hello world">Foo</span>
23052 </p>
23053 !! end
23054
23055 !! test
23056 Table with broken attribute value quoting
23057 !! wikitext
23058 {|
23059 | title="Hello world|Foo
23060 |}
23061 !! html/php
23062 <table>
23063 <tr>
23064 <td>Foo
23065 </td></tr></table>
23066
23067 !! html/parsoid
23068 <table>
23069 <tr>
23070 <td title="Hello world">Foo
23071 </td></tr></table>
23072
23073 !! end
23074
23075 !! test
23076 Table with broken attribute value quoting on consecutive lines
23077 !! wikitext
23078 {|
23079 | title="Hello world|Foo
23080 | style="color:red|Bar
23081 |}
23082 !! html/php
23083 <table>
23084 <tr>
23085 <td>Foo
23086 </td>
23087 <td>Bar
23088 </td></tr></table>
23089
23090 !! html/parsoid
23091 <table><tbody>
23092 <tr>
23093 <td title="Hello world">Foo
23094 </td><td style="color: red">Bar
23095 </td></tr></tbody></table>
23096
23097 !! end
23098
23099 !! test
23100 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23101 !! options
23102 parsoid
23103 !! wikitext
23104 {{}}
23105 !! html
23106 {{}}
23107 !! end
23108
23109 !! test
23110 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23111 !! options
23112 parsoid
23113 !! wikitext
23114 }}{{
23115 !! html
23116 }}{{
23117 !! end
23118
23119 !!test
23120 Accept empty td cell attribute
23121 !! wikitext
23122 {|
23123 | align="center" | foo || |
23124 |}
23125 !! html
23126 <table>
23127 <tr>
23128 <td align="center"> foo </td>
23129 <td>
23130 </td></tr></table>
23131
23132 !!end
23133
23134 !!test
23135 Non-empty attributes in th-cells
23136 !! wikitext
23137 {|
23138 ! Foo !! style="color: red" | Bar
23139 |}
23140 !! html
23141 <table>
23142 <tr>
23143 <th> Foo </th>
23144 <th style="color: red"> Bar
23145 </th></tr></table>
23146
23147 !!end
23148
23149 !!test
23150 Accept empty attributes in th-cells
23151 !! wikitext
23152 {|
23153 !| foo !!| bar
23154 |}
23155 !! html
23156 <table>
23157 <tr>
23158 <th> foo </th>
23159 <th> bar
23160 </th></tr></table>
23161
23162 !!end
23163
23164 !!test
23165 Empty table rows go away
23166 !! wikitext
23167 {|
23168 | Hello
23169 | there
23170 |- class="foo"
23171 |-
23172 |}
23173 !! html
23174 <table>
23175 <tr>
23176 <td> Hello
23177 </td>
23178 <td> there
23179 </td></tr>
23180
23181 </table>
23182
23183 !! end
23184
23185 ###
23186 ### Parsoid-centric tests for testing RTing of inter-element separators
23187 ### Edge cases not tested by existing parser tests and specific to
23188 ### Parsoid-specific serialization strategies.
23189 ###
23190
23191 !!test
23192 RT-ed inter-element separators should be valid separators
23193 !! wikitext
23194 {|
23195 |- [[foo]]
23196 |}
23197 !! html
23198 <table>
23199
23200 </table>
23201
23202 !!end
23203
23204 # Parsoid-only since PHP parser relies on Tidy for correct output
23205 !!test
23206 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23207 !!options
23208 parsoid
23209 !! wikitext
23210 {|
23211 |<small>foo
23212 bar
23213 |}
23214
23215 {|
23216 |<small>foo<small>
23217 |}
23218 !! html
23219 <table>
23220 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23221 <p>bar</p></small></td></tr>
23222 </tbody></table>
23223
23224 <table>
23225 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
23226 </tbody></table>
23227 !!end
23228
23229 # Note that the "style" attribute is really a template parameter here.
23230 # The = would have to be {{=}} if you wanted the literal.
23231 !!test
23232 Empty TD followed by TD with tpl-generated attribute
23233 !! wikitext
23234 {|
23235 |-
23236 |
23237 |{{echo|style='color:red'}}|foo
23238 |}
23239 !! html
23240 <table>
23241
23242 <tr>
23243 <td>
23244 </td>
23245 <td>foo
23246 </td></tr></table>
23247
23248 !!end
23249
23250 !!test
23251 Indented table with an empty td
23252 !! wikitext
23253 {|
23254 |-
23255 |
23256 |foo
23257 |}
23258 !! html
23259 <table>
23260
23261 <tr>
23262 <td>
23263 </td>
23264 <td>foo
23265 </td></tr></table>
23266
23267 !!end
23268
23269 ## We have some newline diffs RT-ing this edge case
23270 ## and it is not important enough -- we seem to be emitting
23271 ## at most 2 newlines after a </tr> and this is unrelated to
23272 ## the issue from T85627 that this is testing.
23273 !!test
23274 Indented table with blank lines in between (T85627)
23275 !! options
23276 parsoid=wt2html
23277 !! wikitext
23278 {|
23279 |foo
23280
23281
23282 |}
23283 !! html
23284 <table>
23285
23286 <tr>
23287 <td>foo
23288 </td></tr></table>
23289
23290 !!end
23291
23292 !!test
23293 Indented block & table
23294 !! wikitext
23295 <div>foo</div>
23296 {|
23297 |foo
23298 |}
23299 !! html/php
23300 <div>foo</div>
23301 <table>
23302 <tr>
23303 <td>foo
23304 </td></tr></table>
23305
23306 !! html/parsoid
23307 <div data-parsoid='{"stx":"html"}'>foo</div>
23308 <table><tbody>
23309 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23310 </tbody></table>
23311 !!end
23312
23313 !! test
23314 Indent and comment before table row
23315 !! wikitext
23316 {|
23317 <!--hi-->|-
23318 | there
23319 |}
23320 !! html/php
23321 <table>
23322
23323 <tr>
23324 <td> there
23325 </td></tr></table>
23326
23327 !! html/parsoid
23328 <table>
23329 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23330 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23331 </tbody></table>
23332 !! end
23333
23334 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23335 !!test
23336 Empty TR followed by a template-generated TR
23337 !!options
23338 parsoid
23339 !! wikitext
23340 {|
23341 |-
23342 {{echo|<tr><td>foo</td></tr>}}
23343 |}
23344 !! html
23345 <table>
23346 <tbody>
23347 <tr></tr>
23348 <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}}]}'>
23349 <td>foo</td></tr>
23350 </tbody></table>
23351 !!end
23352
23353 ## PHP and parsoid output differ for this, and since this is primarily
23354 ## for testing Parsoid's serializer, marking this Parsoid only
23355 !!test
23356 Empty TR followed by mixed-ws-comment line should RT correctly
23357 !!options
23358 parsoid
23359 !! wikitext
23360 {|
23361 |-
23362 <!--c-->
23363 |-
23364 <!--c--> <!--d-->
23365 |}
23366 !! html
23367 <table>
23368 <tbody>
23369 <tr></tr>
23370 <!--c-->
23371 <tr>
23372 <!--c--> </tr><!--d-->
23373 </tbody></table>
23374
23375 !!end
23376
23377 !!test
23378 Multi-line image caption generated by templates with/without trailing newlines
23379 !! wikitext
23380 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23381 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23382 !! html/parsoid
23383 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
23384 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
23385 !!end
23386
23387 !! test
23388 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23389 !! options
23390 parsoid=html2wt
23391 !! html/parsoid
23392 <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>
23393
23394 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23395 !! wikitext
23396 <includeonly>foo</includeonly>
23397 new para
23398
23399 [[Category:Foo]]
23400
23401 = new heading =
23402 !! end
23403
23404 ## PHP emits broken html for this, and since this is primarily
23405 ## a Parsoid serializer test, marking this Parsoid only
23406 !!test
23407 Improperly nested inline or quotes tags with whitespace in between
23408 !! wikitext
23409 <span> <s>x</span> </s>
23410 ''' ''x''' ''
23411 !! html/parsoid
23412 <p><span> <s>x</s></span><s> </s>
23413 <b> <i>x</i></b><i> </i>
23414 </p>
23415 !!end
23416
23417 !!test
23418 Encapsulate protected attributes from wt
23419 !! wikitext
23420 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23421 !! html/parsoid
23422 <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>
23423 </body>
23424 !!end
23425
23426 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23427 ## Having nested or stray pre tags results in the attempt to add duplicates,
23428 ## causing an assertion fail. This test tries to prevent that situation.
23429 !!test
23430 Ensure ParagraphWrapper can deal with stray closing pre tags
23431 !!options
23432 parsoid=wt2html
23433 !! wikitext
23434 plain text</pre>
23435 !! html/parsoid
23436 plain text
23437 !!end
23438
23439 !!test
23440 1. Ensure fostered text content is wrapped in element nodes
23441 !!options
23442 parsoid=wt2html
23443 !! wikitext
23444 <table>hi</table><table>ho</table>
23445 !! html/parsoid
23446 <p>hi</p>
23447 <table></table>
23448 <p>ho</p>
23449 <table></table>
23450 !!end
23451
23452 !!test
23453 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23454 !!options
23455 parsoid=wt2html,wt2wt
23456 !! wikitext
23457 <table>
23458 <tr> || ||
23459 <td> a
23460 </table>
23461 !! html/parsoid
23462 <p> || ||
23463 </p><table>
23464 <tbody><tr><td> a</td></tr>
23465 </tbody></table>
23466 !!end
23467
23468 !!test
23469 Encapsulation properly handles null DSR information from foster box
23470 !!options
23471 parsoid=wt2html,wt2wt
23472 !! wikitext
23473 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23474 !! html/parsoid
23475 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
23476 !!end
23477
23478 !!test
23479 1. Encapsulate foster-parented transclusion content
23480 !!options
23481 parsoid=wt2wt,wt2html
23482 !! wikitext
23483 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23484 !! html/parsoid
23485 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
23486 <tbody>
23487 <tr>
23488 <td>bar</td>
23489 </tr>
23490 </tbody>
23491 </table>
23492 !!end
23493
23494 !!test
23495 2. Encapsulate foster-parented transclusion content
23496 !!options
23497 parsoid=wt2wt,wt2html
23498 !! wikitext
23499 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23500 !! html/parsoid
23501 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo&quot;}},&quot;i&quot;:0}},&quot;</div><tr><td>bar</td></tr></table>&quot;]}">foo</div>
23502 <table>
23503 <tbody>
23504 <tr>
23505 <td>bar</td>
23506 </tr>
23507 </tbody>
23508 </table>
23509 !!end
23510
23511 !!test
23512 3. Encapsulate foster-parented transclusion content
23513 !!options
23514 parsoid=wt2wt,wt2html
23515 !! wikitext
23516 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23517 !! html/parsoid
23518 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
23519 <p>foo</p>
23520 </div>
23521 <table>
23522 <tbody>
23523 <tr>
23524 <td>bar</td>
23525 </tr>
23526 </tbody>
23527 </table>
23528 !!end
23529
23530 !!test
23531 4. Encapsulate foster-parented transclusion content
23532 !!options
23533 parsoid=wt2wt,wt2html
23534 !! wikitext
23535 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23536 !! html/parsoid
23537 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
23538 <p>foo</p>
23539 </div>
23540 <table>
23541 <tbody>
23542 <tr>
23543 <td>bar</td>
23544 </tr>
23545 </tbody>
23546 </table>
23547 !!end
23548
23549 !!test
23550 5. Encapsulate foster-parented transclusion content
23551 !!options
23552 parsoid=wt2wt,wt2html
23553 !! wikitext
23554 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23555 !! html/parsoid
23556 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
23557 <table>
23558 <tbody>
23559 <tr>
23560 <td>
23561 <div>
23562 <p>foo</p>
23563 </div>
23564 </td>
23565 </tr>
23566 </tbody>
23567 </table>
23568 !!end
23569
23570 !!test
23571 6. Encapsulate foster-parented transclusion content
23572 !!options
23573 parsoid=wt2wt,wt2html
23574 !! wikitext
23575 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23576 !! html/parsoid
23577 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
23578 <table>
23579 <tbody>
23580 <tr>
23581 <td>
23582 <div>
23583 <p>foo</p>
23584 </div>
23585 </td>
23586 </tr>
23587 </tbody>
23588 </table>
23589 <p>ok</p>
23590 !!end
23591
23592 !!test
23593 7. Encapsulate foster-parented transclusion content
23594 !!options
23595 parsoid=wt2wt,wt2html
23596 !! wikitext
23597 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23598 !! html/parsoid
23599 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
23600 <table>
23601 <tbody>
23602 <tr>
23603 <td>bar</td>
23604 </tr>
23605 </tbody>
23606 </table>
23607 !!end
23608
23609 # Note that the wt is broken on purpose: the = should be {{=}} if you
23610 # don't want it to be a template parameter key.
23611 !!test
23612 8. Encapsulate foster-parented transclusion content
23613 !!options
23614 parsoid=wt2wt,wt2html
23615 !! wikitext
23616 {{echo|a
23617 }}{|{{echo|style='color:red'}}
23618 |-
23619 |b
23620 |}
23621 !! html/parsoid
23622 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23623 <span> </span>
23624 <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
23625 <table>
23626 <tbody>
23627 <tr>
23628 <td>b</td>
23629 </tr>
23630 </tbody>
23631 </table>
23632 !!end
23633
23634 !!test
23635 9. Encapsulate foster-parented transclusion content
23636 !!options
23637 parsoid=wt2wt,wt2html
23638 !! wikitext
23639 <table>{{echo|hi</table>hello}}
23640 !! html/parsoid
23641 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
23642 !!end
23643
23644 !!test
23645 Table in fosterable position
23646 !!options
23647 parsoid=wt2html,wt2wt
23648 !! wikitext
23649 {{OpenTable}}
23650 <div>
23651 {|
23652 |}
23653 </div>
23654 |}
23655 !! html/parsoid
23656 <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">
23657 </span>
23658 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23659
23660 <table>
23661 </table>
23662 !!end
23663
23664 # Parsoid only for bug 64747
23665 !! test
23666 Properly encapsulate empty-content transclusions in fosterable positions
23667 !! wikitext
23668 <table>
23669 {{#if:|
23670 <td>foo</td>
23671 }}
23672 </table>
23673 !! html/parsoid
23674 <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":["","","",""]}]]}'>
23675
23676 </table>
23677 !! end
23678
23679 !!test
23680 Support <object> element with .data attribute
23681 !!options
23682 parsoid=html2wt
23683 !! html/parsoid
23684 <object data="test.swf"></object>
23685 !! wikitext
23686 <object data="test.swf"></object>
23687 !!end
23688
23689 !! test
23690 Don't block XML namespace declaration
23691 !! wikitext
23692 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23693 !! html/php
23694 <p><span>MediaWiki</span>
23695 </p>
23696 !! html/parsoid
23697 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23698 !! end
23699
23700 # -----------------------------------------------------------------
23701 # The following section of tests are primarily to spec requirements
23702 # around serialization of new/edited content.
23703 #
23704 # All these tests are marked Parsoid html2wt and html2html only
23705 # ----------------------------------------------------------------
23706
23707 # 'mi' is a localinterwiki prefix as well as a language
23708 !! test
23709 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23710 !! options
23711 parsoid=html2wt
23712 !! html
23713 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23714 !! wikitext
23715 [[Foo]]
23716 !! end
23717
23718 # See T93839
23719 !! test
23720 New wikilinks should be serialized properly
23721 !! options
23722 parsoid=html2wt
23723 !! html
23724 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23725 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23726 !! wikitext
23727 [[Foo]]
23728 [[Foo]]
23729 !! end
23730
23731 !! test
23732 New wiki links (href variations)
23733 !! options
23734 parsoid=html2wt
23735 !! html
23736 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23737 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23738 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23739 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23740 !! wikitext
23741 [[Foo_bar]]
23742 [[Foo_bar]]
23743 [[Foo_bar]]
23744 [[Toxine bactérienne]]
23745 !! end
23746
23747 !! test
23748 New wiki links (content string variations)
23749 !! options
23750 parsoid=html2wt
23751 !! html
23752 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23753 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23754 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23755 !! wikitext
23756 [[Foo_bar]]
23757 [[Foo bar]]
23758 [[Foo_bar|./Foo_bar]]
23759 !! end
23760
23761 !! test
23762 New category links (href variations)
23763 !! options
23764 parsoid=html2wt
23765 !! html
23766 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
23767 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
23768 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
23769 !! wikitext
23770 [[Category:Toxine bactérienne]]
23771 [[Category:Toxine bactérienne]]
23772 [[Category:Toxine bactérienne]]
23773 !! end
23774
23775 !! test
23776 New sol transparent links don't need indent-pre nowiki protection
23777 !! options
23778 parsoid=html2wt
23779 language=de
23780 !! html
23781 <link rel="mw:PageProp/redirect" href="./Main_Page">
23782 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
23783 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
23784 !! wikitext
23785 #WEITERLEITUNG [[Main Page]]
23786 <!-- this is good --> [[Category:Good]]
23787 <!-- this is great --> [[Kategorie:Great]]
23788 !! end
23789
23790 !! test
23791 New interlanguage links (href variations)
23792 !! options
23793 parsoid=html2wt
23794 !! html
23795 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
23796 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
23797 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
23798 !! wikitext
23799 [[es:Toxine bactérienne]]
23800 [[es:Toxine_bactérienne]]
23801 [[es:Toxine_bactérienne]]
23802 !! end
23803
23804 !! test
23805 Image: Modifying size of an image (1)
23806 !! options
23807 parsoid={
23808 "modes": ["wt2wt"],
23809 "changes": [
23810 ["img[height]", "attr", "height", "22"],
23811 ["img[width]", "attr", "width", "200"]
23812 ]
23813 }
23814 !! wikitext
23815 [[Image:Foobar.jpg|230x230px]]
23816 !! wikitext/edited
23817 [[Image:Foobar.jpg|200x200px]]
23818 !!end
23819
23820 !! test
23821 Image: Modifying size of an image (2)
23822 !! options
23823 parsoid={
23824 "modes": ["wt2wt"],
23825 "changes": [
23826 ["img[height]", "attr", "height", "100"],
23827 ["img[width]", "attr", "width", "500"]
23828 ]
23829 }
23830 !! wikitext
23831 [[Image:Foobar.jpg|230x230px]]
23832 !! wikitext/edited
23833 [[Image:Foobar.jpg|500x500px]]
23834 !!end
23835
23836 # Change in size is ignored so long as class='mw-default-size'
23837 !! test
23838 Image: Modifying size of an image (3)
23839 !! options
23840 parsoid={
23841 "modes": ["wt2wt"],
23842 "changes": [
23843 ["figure[class]", "removeClass", "mw-default-size"],
23844 ["figure img", "attr", "height", "19"],
23845 ["figure img", "attr", "width", "170"]
23846 ]
23847 }
23848 !! wikitext
23849 [[Image:Foobar.jpg|thumb]]
23850 !! wikitext/edited
23851 [[Image:Foobar.jpg|thumb|170x170px]]
23852 !!end
23853
23854 !! test
23855 Image: Modifying alignment of an image (bug 48665)
23856 !! options
23857 parsoid={
23858 "modes": ["wt2wt"],
23859 "changes": [
23860 ["figure[class]", "removeClass", "mw-halign-right"],
23861 ["figure[class]", "addClass", "mw-halign-left"]
23862 ]
23863 }
23864 !! wikitext
23865 [[Image:Foobar.jpg|thumb|caption|right]]
23866 !! wikitext/edited
23867 [[Image:Foobar.jpg|thumb|caption|left]]
23868 !! end
23869
23870 !! test
23871 Image: Modifying mw-default-size of an frameless image (bug 62805)
23872 !! options
23873 parsoid={
23874 "modes": ["wt2wt"],
23875 "changes": [
23876 ["figure.mw-default-size", "removeClass", "mw-default-size"]
23877 ]
23878 }
23879 !! wikitext
23880 [[Image:Foobar.jpg|frameless|right]]
23881 !! wikitext/edited
23882 [[Image:Foobar.jpg|frameless|right|220x220px]]
23883 !! end
23884
23885 !! test
23886 Image: Modifying valign of an image (bug 49221)
23887 !! options
23888 parsoid={
23889 "modes": ["wt2wt"],
23890 "changes": [
23891 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
23892 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
23893 ]
23894 }
23895 !! wikitext
23896 [[File:Foobar.jpg|20px|middle]]
23897 !! wikitext/edited
23898 [[File:Foobar.jpg|20px|text-top]]
23899 !! end
23900
23901 !! test
23902 Image: Modifying alt attribute of an image (bug 56400)
23903 !! options
23904 parsoid={
23905 "modes": ["wt2wt"],
23906 "changes": [
23907 ["img[alt]", "attr", "alt", "some alternate edited text"]
23908 ]
23909 }
23910 !! wikitext
23911 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
23912 !! wikitext/edited
23913 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
23914 !!end
23915
23916 !! test
23917 Image: Modifying caption of an image
23918 !! options
23919 parsoid={
23920 "modes": ["wt2wt"],
23921 "changes": [
23922 ["figcaption", "text", "new caption"]
23923 ]
23924 }
23925 !! wikitext
23926 [[Image:Foobar.jpg|thumb|original caption]]
23927 !! wikitext/edited
23928 [[Image:Foobar.jpg|thumb|new caption]]
23929 !!end
23930
23931 !! test
23932 Image: empty alt attribute (bug 48924)
23933 !! options
23934 parsoid
23935 !! wikitext
23936 [[File:Foobar.jpg|thumb|alt=|bar]]
23937 !! html
23938 <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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" 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>
23939 !! end
23940
23941 #!! test
23942 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
23943 #!! options
23944 #parsoid=html2wt
23945 #language=ar
23946 #!! html
23947 #<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" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure>
23948 #!! wikitext
23949 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
23950 #!! end
23951
23952 !! test
23953 Image: Block level image should have \n before and after
23954 !! wikitext
23955 123
23956 [[File:Foobar.jpg|right|thumb|150x150px]]
23957 456
23958 !! html/parsoid
23959 <p>123</p>
23960 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
23961 <p>456</p>
23962 !!end
23963
23964 !! test
23965 Image: New block level image should have \n before and after (existing content)
23966 !! wikitext
23967 123
23968 [[File:Foobar.jpg|right|thumb|150x150px]]
23969 456
23970 !! html/parsoid
23971 <p>123</p>
23972 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
23973 <p>456</p>
23974 !!end
23975
23976 !! test
23977 Image: upright option (parsoid)
23978 !! wikitext
23979 [[File:Foobar.jpg|thumb|upright|caption]]
23980 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
23981 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
23982 !! html/parsoid
23983 <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/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
23984 <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/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
23985 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
23986 !!end
23987
23988 !! test
23989 Image: upright option is ignored on inline and frame images (parsoid)
23990 !! wikitext
23991 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
23992 !! html/parsoid
23993 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p>
23994 !!end
23995
23996 !! test
23997 Image: from basic HTML (1)
23998 !! options
23999 parsoid=html2wt
24000 !! html/parsoid
24001 <span typeof="mw:Image">
24002 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24003 </span>
24004 !! wikitext
24005 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24006 !! end
24007
24008 !! test
24009 Image: from basic HTML (2)
24010 !! options
24011 parsoid=html2wt
24012 !! html/parsoid
24013 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24014 !! wikitext
24015 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24016 !! end
24017
24018 !! test
24019 Image: from basic HTML (3)
24020 !! options
24021 parsoid=html2wt
24022 !! html/parsoid
24023 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24024 !! wikitext
24025 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24026 !! end
24027
24028 !! test
24029 Image: from basic HTML (4)
24030 !! options
24031 parsoid=html2wt
24032 !! html/parsoid
24033 <img src="./File:Foobar.jpg">
24034 !! wikitext
24035 [[File:Foobar.jpg|link=]]
24036 !! end
24037
24038 !! test
24039 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24040 !! options
24041 parsoid=html2wt
24042 !! html
24043 <ul>
24044 <li><p>foo</p></li>
24045 </ul>
24046 !! wikitext
24047 * foo
24048 !! end
24049
24050 !! test
24051 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24052 !! options
24053 parsoid=html2wt
24054 !! html
24055 <ul> <li>foo</li></ul>
24056 !! wikitext
24057 * foo
24058 !! end
24059
24060 !! test
24061 Don't strip leading whitespace when handling indent-pre suppressing tags
24062 !! options
24063 parsoid=html2wt
24064 !! html
24065 <table>
24066 <tr><td> indented row</td></tr>
24067 </table>
24068 <blockquote><p>
24069 <b>This is very bold of you!</b>
24070 </p>
24071 <table><tr><td>
24072 indented cell (no pre-wrapping!)
24073 </td></tr></table>
24074 </blockquote>
24075 <p>foo</p>
24076 <div>bar</div>
24077 !! wikitext
24078 {|
24079 | indented row
24080 |}
24081 <blockquote>
24082 '''This is very bold of you!'''
24083
24084 {|
24085 |
24086 indented cell (no pre-wrapping!)
24087 |}
24088 </blockquote>
24089 foo
24090 <div>bar</div>
24091 !! end
24092
24093 !! test
24094 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24095 !! options
24096 parsoid=html2wt
24097 !! wikitext
24098 foo
24099 <nowiki> </nowiki><span>bar</span>
24100
24101 <span>foo2
24102 <nowiki> </nowiki></span>bar2
24103
24104 <div>foo</div>
24105 <nowiki> </nowiki><span>bar</span>
24106
24107 <div>
24108 <nowiki> </nowiki><span>foo</span>
24109 </div>
24110 !! html
24111 <p>foo</p>
24112 <span>bar</span>
24113
24114 <span>foo2
24115 </span>bar2
24116
24117 <div>foo</div>
24118 <span>bar</span>
24119
24120 <div>
24121 <span>foo</span>
24122 </div>
24123 !! end
24124
24125 !! test
24126 Lists: Dont insert newlines in a serialized list item.
24127 !! options
24128 parsoid=html2wt
24129 !! html
24130 <ul><li>a<br>b</li><li>c</li></ul>
24131 !! wikitext
24132 * a<br>b
24133 * c
24134 !! end
24135
24136 !! test
24137 Headings: Force sol-transparent links and behavior switches to serialize before/after
24138 !! options
24139 parsoid=html2wt
24140 !! html
24141 <h2>hello there<link href="Category:A1" rel="mw:PageProp/Category" /></h2>
24142 <h2><link href="Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24143
24144 <h2><!--foo--> <link href="Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24145 <h2>it goes well <link href="Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24146
24147 <h2 data-parsoid='{}'>howdy<link href="Category:A5" rel="mw:PageProp/Category" /></h2>
24148
24149 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24150 !! wikitext
24151 == hello there ==
24152 [[Category:A1]]
24153 [[Category:A2]]
24154
24155 == hi pal ==
24156
24157 <!--foo--> [[Category:A3]]
24158
24159 == how goes it ==
24160
24161 == it goes well ==
24162 [[Category:A4]] <!--bar-->
24163
24164 ==howdy [[Category:A5]] ==
24165
24166 __TOC__
24167
24168 == ok ==
24169 !! end
24170
24171 !! test
24172 Headings: Don't hoist metas that come from templates
24173 !! options
24174 parsoid=html2wt
24175 !! html
24176 <h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
24177 !! wikitext
24178 == {{echo|foo [[Category:Foo]]}} ==
24179 !! end
24180
24181 !! test
24182 Headings: Category in ref isn't hoisted
24183 !! options
24184 parsoid=html2wt
24185 !! html
24186 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24187
24188 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
24189 !! wikitext
24190 == foo <ref>bar
24191 [[Category:Baz]] </ref> ==
24192
24193 <references />
24194 !! end
24195
24196 !! test
24197 Parsoid: Serialize positional parameters with = in them as named parameter
24198 !! options
24199 parsoid=html2wt
24200 !! html
24201 <p about="#mwt1" typeof="mw:Transclusion"
24202 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24203
24204 <p about="#mwt1" typeof="mw:Transclusion"
24205 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24206
24207 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24208 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24209 <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>
24210 !! wikitext
24211 {{echo|1 = f=oo}}
24212
24213 {{echo|1 = f=oo|2 = bar}}
24214
24215 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24216 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24217 {{echo|<nowiki>f=oo</nowiki>|bar}}
24218 !! end
24219
24220 !! test
24221 Parsoid: Serialize positional parameters with = in extlink as named parameter
24222 !! options
24223 parsoid=html2wt
24224 !! html
24225 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
24226 !! wikitext
24227 {{echo|1 = http://stuff?is=ok}}
24228 !! end
24229
24230 !! test
24231 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24232 !! options
24233 parsoid=html2wt
24234 !! html
24235 <div>a<p>b</p></div>
24236 <div>a
24237 <p>b</p></div>
24238 <div>
24239 a
24240 <p>b</p></div>
24241 !! wikitext
24242 <div>a
24243 b
24244 </div>
24245 <div>a
24246 b
24247 </div>
24248 <div>
24249 a
24250
24251 b
24252 </div>
24253 !! end
24254
24255 !! test
24256 Substrings resembling wikitext in hrefs should not get nowiki escapes
24257 !! options
24258 parsoid=html2wt
24259 !! html
24260 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24261 !! wikitext
24262 [[Foo''bar''baz]]
24263 !! end
24264
24265 !! test
24266 Enforce single-line context in the serializer
24267 !! options
24268 parsoid=html2wt
24269 !! html
24270 <h2>testing
24271 123</h2>
24272
24273 <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
24274 </span><span about="#mwt1">you</span> </h2>
24275
24276 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24277
24278 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
24279 there</span></li></ol>
24280
24281 <ul><li>asd
24282 sdf</li></ul>
24283
24284 <ul><li>foo
24285 bar
24286 baz</li>
24287 <li>foo <b>bar</b>
24288 baz</li></ul>
24289 !! wikitext
24290 == testing 123 ==
24291
24292 == hi {{bogus|there
24293 you}} ==
24294
24295 == foo <ref>hello
24296 there</ref> ==
24297
24298 <references />
24299
24300 * asd sdf
24301
24302 * foo bar baz
24303 * foo '''bar''' baz
24304 !! end
24305
24306 !! test
24307 Serialize new placeholder space without spans
24308 !! options
24309 parsoid=html2wt
24310 !! html
24311 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24312
24313 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24314
24315 <span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:Placeholder\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
24316 !! wikitext
24317 foo : bar
24318
24319 foo : bar
24320
24321 <ref>foo : bar</ref>ok
24322 !! end
24323
24324
24325 #-----------------------
24326 # Tag minimization tests
24327 #-----------------------
24328
24329 !! test
24330 1. I/B quote minimization: wikitext-only tags should be combined
24331 !! options
24332 parsoid=html2wt
24333 !! html
24334 <p><i>A</i><i>B</i></p>
24335 <p><b>A</b><b>B</b></p>
24336 <p><i>A</i><b><i>B</i></b></p>
24337 <p><b>A</b><i><b>B</b></i></p>
24338 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24339 <p><i><b>A</b></i><i><b>B</b></i></p>
24340 <p><i><b>A</b></i><b><i>B</i></b></p>
24341 <p><b><i>A</i></b><i><b>B</b></i></p>
24342 !! wikitext
24343 ''AB''
24344
24345 '''AB'''
24346
24347 ''A'''B'''''
24348
24349 '''A''B'''''
24350
24351 '''A''BC''D'''
24352
24353 '''''AB'''''
24354
24355 '''''AB'''''
24356
24357 '''''AB'''''
24358 !! end
24359
24360 !! test
24361 2. I/B quote minimization: wikitext and html tags should not be combined
24362 !! options
24363 parsoid=html2wt
24364 !! html
24365 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24366 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24367 !! wikitext
24368 ''A''<i>B</i>
24369
24370 ''A''<nowiki/>'''<i>B</i>'''
24371 !! end
24372
24373 !! test
24374 3. I/B quote minimization: templated content stops minimization
24375 !! options
24376 parsoid=html2wt
24377 !! html
24378 <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>
24379 <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>
24380 !! wikitext
24381 ''A''{{echo|''B''}}
24382
24383 ''A''{{echo|'''''B'''''}}
24384 !! end
24385
24386 !! test
24387 4. I/B quote minimization: new content should be mimimized with adjacent old content
24388 !! options
24389 parsoid=html2wt
24390 !! html
24391 <p><i>A</i><i>B</i></p>
24392 <p><b>A</b><b>B</b></p>
24393 <p><i>A</i><b><i>B</i></b></p>
24394 !! wikitext
24395 ''AB''
24396
24397 '''AB'''
24398
24399 ''A'''B'''''
24400 !! end
24401
24402 !! test
24403 5a. Merge adjacent quote nodes if they've been edited
24404 !! options
24405 parsoid={
24406 "modes": ["wt2wt", "selser"],
24407 "changes": [
24408 ["p", "contents", "remove", ":contains('b')"]
24409 ]
24410 }
24411 !! wikitext
24412 ''a''b''c''
24413 !! wikitext/edited
24414 ''ac''
24415 !! end
24416
24417 !! test
24418 5b. Merge adjacent quote nodes if they've been edited
24419 !! options
24420 parsoid={
24421 "modes": ["wt2wt", "selser"],
24422 "changes": [
24423 ["#x", "remove"]
24424 ]
24425 }
24426 !! wikitext
24427 ''a''<span id="x">b</span>''c''
24428 !! wikitext/edited
24429 ''ac''
24430 !! end
24431
24432 !! test
24433 1. Merge adjacent link nodes as long as at least one element is new
24434 !! options
24435 parsoid={
24436 "modes": ["html2wt"],
24437 "scrubWikitext": true
24438 }
24439 !! html
24440 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24441 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24442 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24443 !! wikitext
24444 [[Football]]
24445 [[Football]]
24446 [[Football|Foot]][[Football|ball]]
24447 !! end
24448
24449 !! test
24450 2. Merge adjacent link nodes and enable additional normalizations
24451 !! options
24452 parsoid={
24453 "modes": ["html2wt"],
24454 "scrubWikitext": true
24455 }
24456 !! html
24457 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24458 !! wikitext
24459 [[Football|''Football'']]
24460 !! end
24461
24462 !! test
24463 3. Don't merge adjacent link nodes if scrubWikitext is false
24464 !! options
24465 parsoid={
24466 "modes": ["html2wt"],
24467 "scrubWikitext": false
24468 }
24469 !! html
24470 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24471 !! wikitext
24472 [[Football|Foot]][[Football|ball]]
24473 !! end
24474
24475 #------------------------------
24476 # End of tag minimization tests
24477 #------------------------------
24478
24479 !!test
24480 Bug 54262: New entities
24481 !! options
24482 parsoid=html2wt
24483 !! wikitext
24484 &nbsp;
24485 !! html
24486 <span typeof="mw:Entity">&nbsp;</span>
24487 !! end
24488
24489 ## Note that there is no wikitext output for 'unknownproperty' ##
24490 ## Unknown magic words are silently dropped ##
24491
24492 !! test
24493 Magic words
24494 !! options
24495 parsoid=html2wt
24496 !! html/parsoid
24497 <meta property='mw:PageProp/toc' />
24498 <meta property='mw:PageProp/notoc' />
24499 <meta property='mw:PageProp/forcetoc' />
24500 <meta property='mw:PageProp/index' />
24501 <meta property='mw:PageProp/noindex' />
24502 <meta property='mw:PageProp/nogallery' />
24503 <meta property='mw:PageProp/noeditsection' />
24504 <meta property='mw:PageProp/notitleconvert' />
24505 <meta property='mw:PageProp/nocontentconvert' />
24506 <meta property='mw:PageProp/unknownproperty' />
24507 !! wikitext
24508 __TOC__
24509 __NOTOC__
24510 __FORCETOC__
24511 __INDEX__
24512 __NOINDEX__
24513 __NOGALLERY__
24514 __NOEDITSECTION__
24515 __NOTITLECONVERT__
24516 __NOCONTENTCONVERT__
24517 !! end
24518
24519 !! test
24520 Consecutive <pre>s should not get merged
24521 !! options
24522 parsoid=html2wt,html2html
24523 !! html
24524 <pre>a</pre><pre>b</pre>
24525
24526 <pre>c
24527 </pre><pre>
24528 d</pre>
24529
24530 <pre>e
24531
24532 </pre><pre>
24533
24534 f</pre>
24535 !! wikitext
24536 a
24537
24538 b
24539
24540 c
24541
24542 d
24543
24544 e
24545
24546
24547
24548 f
24549 !! end
24550
24551 !! test
24552 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24553 !! options
24554 parsoid=html2wt
24555 !! html
24556 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24557 !! wikitext
24558 [[Special:BookSources/1234567890|ISBN 1234567895]]
24559 !! end
24560
24561 !! test
24562 Edited RFC links not serializable as RFC links should serialize as extlinks
24563 !! options
24564 parsoid=html2wt
24565 !! html
24566 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24567 !! wikitext
24568 [//tools.ietf.org/html/rfc123 New RFC]
24569 !! end
24570
24571 !! test
24572 Edited PMID links not serializable as PMID links should serialize as extlinks
24573 !! options
24574 parsoid=html2wt
24575 !! html
24576 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24577 !! wikitext
24578 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24579 !! end
24580
24581 !! test
24582 WTS of autolinks with trailing/surrounding context
24583 !! options
24584 parsoid=html2wt
24585 !! html/parsoid
24586 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24587 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24588 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24589 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24590 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24591 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24592 !! wikitext
24593 http://cscott.net<nowiki/>'''foo'''
24594
24595 http://cscott.net<b>foo</b>
24596
24597 '''http://cscott.net<nowiki/>'''
24598
24599 '''http://cscott.net '''
24600
24601 '''http://cscott.net<nowiki/>x'''
24602
24603 http://cscott.net<nowiki/>x
24604 !! end
24605
24606 !! test
24607 WTS of autolinks with nowikis (round-trip)
24608 !! wikitext
24609 x<nowiki/>http://cscott.net<nowiki/>x
24610 !! html/parsoid
24611 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24612 !! end
24613
24614 # this is the "easy" test because it leaves in place all the
24615 # data-parsoid information indicating this is an autolink
24616 !! test
24617 WTS of autolinks with escapes (editing)
24618 !! options
24619 parsoid={
24620 "modes": ["wt2wt"],
24621 "changes": [
24622 [ "meta", "remove" ]
24623 ]
24624 }
24625 !! wikitext
24626 x<nowiki/>http://cscott.net<nowiki/>x
24627 !! wikitext/edited
24628 x<nowiki/>http://cscott.net<nowiki/>x
24629 !! end
24630
24631 !! test
24632 Edited Redirect link should emit a non-piped wikitext link
24633 !! options
24634 parsoid=html2wt
24635 !! html
24636 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24637 !! wikitext
24638 #REDIRECT [[Bar]]
24639 !! end
24640
24641 !! test
24642 T75121: Infer extension name from typeOf if data-mw is not present
24643 !! options
24644 parsoid=html2wt
24645 !! html
24646 <div typeOf="mw:Extension/foo"></div>
24647 !! wikitext
24648 <foo />
24649 !! end
24650
24651 # Note that the <p> wrapping isn't present in PHP parser output
24652 # The important thing for this test is that P-wrapping doesn't
24653 # interfere with the <nowiki> protection for leading - in <td>
24654 # (which isn't necessary for <th>).
24655 !! test
24656 T88318: p-wrapped dash in table.
24657 !! options
24658 parsoid=html2wt,wt2wt
24659 !! html/parsoid
24660 <table><tbody>
24661 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24662 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24663 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24664 </tbody></table>
24665 !! wikitext
24666 {|
24667 !-
24668 !-
24669 |-
24670 |<nowiki>-</nowiki>
24671 |<nowiki>- </nowiki>
24672 |-
24673 |<small>-</small>
24674 |<br>
24675 -
24676 |<br>
24677 -
24678 |}
24679 !! html/php+tidy
24680 <table>
24681 <tr>
24682 <th>-</th>
24683 <th>-</th>
24684 </tr>
24685 <tr>
24686 <td>-</td>
24687 <td>-</td>
24688 </tr>
24689 <tr>
24690 <td><small>-</small></td>
24691 <td><br />
24692 <p>-</p>
24693 </td>
24694 <td><br />
24695 <p>-</p>
24696 </td>
24697 </tr>
24698 </table>
24699 !! end
24700
24701 !! test
24702 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
24703 !! options
24704 parsoid=html2wt
24705 !! html
24706 <table id='mwAb'>
24707 <td id='mwAc'>foo</td>
24708 <td id='serialize-this'>bar</td>
24709 </table>
24710 !! wikitext
24711 {|
24712 |foo
24713 | id="serialize-this" |bar
24714 |}
24715 !! end
24716
24717 !! test
24718 Parsoid-like element ids should not be serialized to wikitext unless shadowed
24719 !! options
24720 parsoid=html2wt
24721 !! html
24722 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
24723 !! wikitext
24724 <div id="hello">ok</div>
24725 !! end
24726
24727 !! test
24728 WTS change modes
24729 !! options
24730 parsoid={
24731 "modes": ["wt2wt"],
24732 "changes": [
24733 [ "#xyz", "before", "<b>before</b> stuff " ],
24734 [ "#xyz", "after", " stuff <i>after</i>" ],
24735 [ "#xyz", "html", "x <b>y</b> z" ]
24736 ]
24737 }
24738 !! wikitext
24739 <span id="xyz">hello</span>
24740 !! wikitext/edited
24741 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
24742 !! end
24743
24744 !! test
24745 Never serialize a-tag as html, regardless of what data-parsoid has to say
24746 !! options
24747 parsoid=html2wt
24748 !! html
24749 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
24750 !! wikitext
24751 [[Foo]]
24752 !! end
24753
24754 ## SSS FIXME: This is broken output nevertheless.
24755 ## What might be a reasonable non-broken output for this?
24756 ## This is an edge case unlikely to be seen in production
24757 ## that I am not wasting more time on this right now.
24758 !! test
24759 Never serialize a-tag as html, no matter what attributes it has
24760 !! options
24761 parsoid=html2wt
24762 !! html
24763 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
24764 !! wikitext
24765 [http://boo.org http://boohoo.org]
24766 !! end
24767
24768 # --------------------------------------------
24769 # Tests spec'ing wikitext serialization norms |
24770 # --------------------------------------------
24771
24772 !! test
24773 Lists: Add space after bullets
24774 !! options
24775 parsoid=html2wt
24776 !! html
24777 <ul>
24778 <li>foo</li>
24779 <li> bar</li>
24780 <li><span> baz</span></li>
24781 </ul>
24782 !! wikitext
24783 * foo
24784 * bar
24785 * <span> baz</span>
24786 !! end
24787
24788 !! test
24789 Headings: Add space before/after == (T53744)
24790 !! options
24791 parsoid=html2wt
24792 !! html
24793 <h2>foo</h2>
24794 <h2> bar</h2>
24795 <h2>baz </h2>
24796 <h2><span> baz</span></h2>
24797
24798 <!-- Even after hoisted content -->
24799 <h2> <link href="Category:A2" rel="mw:PageProp/Category" />ok</h2>
24800 !! wikitext
24801 == foo ==
24802
24803 == bar ==
24804
24805 == baz ==
24806
24807 == <span> baz</span> ==
24808
24809 <!-- Even after hoisted content -->
24810 [[Category:A2]]
24811
24812 == ok ==
24813 !! end
24814
24815 !! test
24816 1. Headings: suppress newly created empty headings
24817 !! options
24818 parsoid={
24819 "modes": ["html2wt"],
24820 "scrubWikitext": true
24821 }
24822 !! html
24823 <h2></h2>
24824 !! wikitext
24825 !! end
24826
24827 !! test
24828 2. Headings: don't suppress empty headings if scrubWikitext is false
24829 !! options
24830 parsoid=html2wt
24831 !! html
24832 <h2></h2>
24833 !! wikitext
24834 ==<nowiki/>==
24835 !! end
24836
24837 !! test
24838 3. Headings: don't suppress empty headings for existing headings even if scrubWikitext is true
24839 !! options
24840 parsoid={
24841 "modes": ["html2wt"],
24842 "scrubWikitext": true
24843 }
24844 !! html
24845 <h2 data-parsoid='{}'></h2>
24846 !! wikitext
24847 ==<nowiki/>==
24848 !! end
24849
24850 !! test
24851 1. WT Quote Tags: suppress newly created empty style tags
24852 !! options
24853 parsoid={
24854 "modes": ["html2wt"],
24855 "scrubWikitext": true
24856 }
24857 !! html
24858 <i></i><b></b>
24859 !! wikitext
24860 !! end
24861
24862 !! test
24863 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
24864 !! options
24865 parsoid=html2wt
24866 !! html
24867 <i></i><b></b>
24868 !! wikitext
24869 ''<nowiki/>'''''<nowiki/>'''
24870 !! end
24871
24872 !! test
24873 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
24874 !! options
24875 parsoid={
24876 "modes": ["html2wt"],
24877 "scrubWikitext": true
24878 }
24879 !! html
24880 <p> hi</p>
24881 !! wikitext
24882 hi
24883 !! end
24884
24885 !! test
24886 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
24887 !! options
24888 parsoid=html2wt
24889 !! html
24890 <p> hi</p>
24891 !! wikitext
24892 <nowiki> </nowiki>hi
24893 !! end
24894
24895 # ---------------------------------------------------
24896 # End of tests spec'ing wikitext serialization norms |
24897 # ---------------------------------------------------
24898
24899 # -----------------------------------------------------------------
24900 # End of section for Parsoid-only html2wt tests for serialization
24901 # of new content
24902 # -----------------------------------------------------------------
24903
24904 # -----------------------------------------------------------------
24905 # The following section of tests are primarily to spec behavior of
24906 # the selective serializer. All these tests have manual selser
24907 # changes. The automated selser changes for all tests handle the
24908 # wide variation of changes, but these tests here capture specs
24909 # deterministically.
24910 # ----------------------------------------------------------------
24911
24912 ## T90517
24913 !! test
24914 Selser: New comments should not be lost
24915 !! options
24916 parsoid={
24917 "modes": ["selser"],
24918 "changes": [
24919 [ "#a", "after", "<!--c1-->" ],
24920 [ "#b", "before", "<!--c2-->" ]
24921 ]
24922 }
24923 !! wikitext
24924 <span id="a">a</span>
24925
24926 <span id="b">b</span>
24927 !! wikitext/edited
24928 <span id="a">a</span><!--c1-->
24929
24930 <!--c2--><span id="b">b</span>
24931 !! end
24932
24933 ## T89383
24934 !! test
24935 Selser: Check for validity of DSR before using it
24936 !! options
24937 parsoid={
24938 "modes": ["selser"],
24939 "changes": [
24940 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
24941 ]
24942 }
24943 !! wikitext
24944 <span id="a">a</span>
24945 !! wikitext/edited
24946 {{DISPLAYTITLE:foo}}
24947 <span id="a">a</span>
24948 !! end
24949
24950 !! test
24951 1. DOMDiff: Changes to <ref> content should be looked up using id
24952 !! options
24953 parsoid={
24954 "modes": ["selser"],
24955 "changes": [
24956 ["#X", "after", "bar"],
24957 ["#Y", "after", "baz"]
24958 ]
24959 }
24960 !! wikitext
24961 X <ref><span id="X">foo</span></ref>
24962 Y <ref name="a" />
24963 <references>
24964 <ref name="a"><span id="Y">foo</span></ref>
24965 </references>
24966 !! wikitext/edited
24967 X <ref><span id="X">foo</span>bar</ref>
24968 Y <ref name="a" />
24969 <references>
24970 <ref name="a"><span id="Y">foo</span>baz</ref>
24971 </references>
24972 !! end
24973
24974 !! test
24975 2. DOMDiff: Changes to <ref> content should be looked up using id
24976 !! options
24977 parsoid={
24978 "modes": ["selser"],
24979 "changes": [
24980 ["#Z", "after", "bar"]
24981 ]
24982 }
24983 !! wikitext
24984 A <ref>foo bar for a</ref>
24985 B <ref group="X" name="b" />
24986
24987 <references />
24988
24989 <references group="X">
24990 <ref name="b"><span id="Z">foo</span></ref>
24991 </references>
24992 !! wikitext/edited
24993 A <ref>foo bar for a</ref>
24994 B <ref group="X" name="b" />
24995
24996 <references />
24997
24998 <references group="X">
24999 <ref name="b"><span id="Z">foo</span>bar</ref>
25000 </references>
25001 !! end