Parser: Hard deprecate getConverterLanguage
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://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 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
40 # wgEnableMagicLinks
41 #
42 # For testing purposes, temporary articles can created:
43 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
44 # where '/' denotes a newline.
45
46 # This is the standard article assumed to exist.
47 !! article
48 Main Page
49 !! text
50 blah blah
51 !! endarticle
52
53 !!article
54 Foo
55 !!text
56 FOO
57 !!endarticle
58
59 !!article
60 Foo''s bar''s
61 !!text
62 Article titles can contain single quotes!
63 !!endarticle
64
65 !!article
66 Template:Foo
67 !!text
68 FOO
69 !!endarticle
70
71 !! article
72 Template:redirect to foo
73 !! text
74 #REDIRECT [[Template:Foo]]
75 !! endarticle
76
77 !! article
78 Template:Blank
79 !! text
80 !! endarticle
81
82 !! article
83 Template:pipe
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:=
90 !! text
91 <nowiki>=</nowiki>
92 !! endarticle
93
94 !!article
95 MediaWiki:bad image list
96 !!text
97 * [[File:Bad.jpg]] except [[Nasty page]]
98 !!endarticle
99
100 !! article
101 Template:inner list
102 !! text
103 * item 1
104 !! endarticle
105
106 !! article
107 Template:tbl-start
108 !! text
109 {|
110 !! endarticle
111
112 !! article
113 Template:tbl-end
114 !! text
115 |}
116 !! endarticle
117
118 !! article
119 Template:echo
120 !! text
121 {{{1}}}
122 !! endarticle
123
124 !! article
125 Template:echo3
126 !! text
127 {{{1}}}
128 {{{1}}}
129 {{{1}}}
130 !! endarticle
131
132 // For Serbian; localize Template namespace
133 !! article
134 Шаблон:Echo
135 !! text
136 {{{1}}}
137 !! endarticle
138
139 !! article
140 Template:echo_with_span
141 !! text
142 <span>{{{1}}}</span>
143 !! endarticle
144
145 !! article
146 Template:echo_with_div
147 !! text
148 <div>{{{1}}}</div>
149 !! endarticle
150
151 !! article
152 Template:echo with depth
153 !! text
154 {{echo|{{{1}}}}}
155 !! endarticle
156
157 !! article
158 Template:blank_param
159 !! text
160 {{{1}}}
161 {{{}}}
162 !! endarticle
163
164 !! article
165 Template:table_attribs
166 !! text
167 <noinclude>
168 |</noinclude>style="color:red;"|Foo
169 !! endarticle
170
171 !! article
172 Template:table_attribs_2
173 !! text
174 <noinclude>
175 |</noinclude>style="color:red;"|Foo
176 |Bar||Baz
177 !! endarticle
178
179 !! article
180 Template:table_attribs_3
181 !! text
182 <noinclude>
183 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
184 !! endarticle
185
186 !! article
187 Template:table_attribs_4
188 !! text
189 | style="background-color:#DC241f;" width="10px" |
190 !! endarticle
191
192 !! article
193 Template:table_attribs_5
194 !! text
195 <noinclude>
196 |</noinclude>style="color:red;"||Bar
197 !! endarticle
198
199 !! article
200 Template:table_attribs_6
201 !! text
202 style="background: <nowiki>
203
204
205 red;</nowiki>" |
206 !! endarticle
207
208 !! article
209 Template:table_attribs_7
210 !! text
211 <noinclude>
212 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
213 !! endarticle
214
215 !! article
216 Template:table_header_cells
217 !! text
218 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
219 !! endarticle
220
221 !! article
222 Template:table_cells
223 !! text
224 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
225 !! endarticle
226
227 !! article
228 Template:PartialTable
229 !! text
230 {|
231 |-
232 !! endarticle
233
234 !! article
235 Template:image_attribs
236 !! text
237 <noinclude>
238 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
239 !! endarticle
240
241 ## See T48811 for details
242 !! article
243 Template:mixed_attr_content_template
244 !! text
245 style="color:red;" title="T48811"
246 |-
247 |foo
248 !! endarticle
249
250 !! article
251 Template:definition_list
252 !! text
253 one
254 ::two
255 !! endarticle
256
257 !! article
258 A?b
259 !! text
260 Weirdo titles!
261 !! endarticle
262
263 !!article
264 Template:Bullet
265 !!text
266 *Bar
267 !!endarticle
268
269 !!article
270 Template:OpenTable
271 !!text
272 {|
273 !!endarticle
274
275 !!article
276 Template:EmptyLITest
277 !!text
278 *a
279 *
280 *
281 *b
282 !!endarticle
283
284 !!article
285 Template:EmptyTRTest
286 !!text
287 {|
288 |-
289 |-
290 |foo
291 |-
292 |-
293 |bar
294 |}
295 !!endarticle
296
297 !!article
298 Template:EmptyTRWithHTMLAttrTest
299 !!text
300 <table>
301 <tr align="center"></tr>
302 <tr><td>foo</td></tr>
303 <tr align="center"></tr>
304 <tr><td>bar</td></tr>
305 </table>
306 !!endarticle
307
308 !! article
309 Template:With: Colon
310 !! text
311 Template with colon
312 !! endarticle
313
314 ###
315 ### Basic tests
316 ###
317
318 !! test
319 Blank input
320 !! wikitext
321 !! html
322 !! end
323
324 !! test
325 Simple paragraph
326 !! wikitext
327 This is a simple paragraph.
328 !! html
329 <p>This is a simple paragraph.
330 </p>
331 !! end
332
333 !! test
334 Paragraphs with extra newline spacing
335 !! wikitext
336 a
337
338 b (+2 nls)
339
340
341 c (+3 nls)
342
343
344
345 d (+4 nls)
346
347
348
349
350 e (+5 nls)
351 !! html
352 <p>a
353 </p><p>b (+2 nls)
354 </p><p><br />
355 c (+3 nls)
356 </p><p><br />
357 </p><p>d (+4 nls)
358 </p><p><br />
359 </p><p><br />
360 e (+5 nls)
361 </p>
362 !! end
363
364 !! test
365 Paragraphs with newline spacing with comment lines in between
366 !! wikitext
367 ----
368 a
369 <!--foo-->
370 b
371 ----
372 a
373 <!--foo--><!--More than 1 comment, still stripped-->
374 b
375 ----
376 a
377 <!--foo--> <!----> <!-- bar -->
378 b
379 ----
380 a
381 <!--foo-->
382
383 b
384 ----
385 a
386
387 <!--foo-->
388 b
389 ----
390 a
391 <!--foo-->
392
393
394 b
395 ----
396 a
397
398
399 <!--foo-->
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 b
406 </p>
407 <hr />
408 <p>a
409 b
410 </p>
411 <hr />
412 <p>a
413 b
414 </p>
415 <hr />
416 <p>a
417 </p><p>b
418 </p>
419 <hr />
420 <p>a
421 </p><p>b
422 </p>
423 <hr />
424 <p>a
425 </p><p><br />
426 b
427 </p>
428 <hr />
429 <p>a
430 </p><p><br />
431 b
432 </p>
433 <hr />
434 !! end
435
436 !! test
437 Paragraphs with newline spacing with non-empty white-space lines in between
438 !! wikitext
439 ----
440 a
441
442 b
443 ----
444 a
445
446
447 b
448 ----
449 !! html
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460 !! end
461
462 !! test
463 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
464 !! wikitext
465 ----
466 a
467 <!--foo-->
468 b
469 ----
470 a
471 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
472 b
473 ----
474 a
475
476 <!--foo-->
477 <!--bar-->
478 b
479 ----
480 a
481
482 <!--foo-->
483 <!--bar-->
484
485 b
486 ----
487 !! html
488 <hr />
489 <p>a
490 b
491 </p>
492 <hr />
493 <p>a
494 b
495 </p>
496 <hr />
497 <p>a
498 </p><p>b
499 </p>
500 <hr />
501 <p>a
502 </p><p><br />
503 b
504 </p>
505 <hr />
506 !! end
507
508 !! test
509 Extra newlines: More paragraphs with indented comment
510 !! wikitext
511 a
512
513 <!--boo-->
514
515 b
516 !! html
517 <p>a
518 </p><p><br />
519 b
520 </p>
521 !!end
522
523 !! test
524 Extra newlines followed by heading
525 !! wikitext
526 a
527
528
529 =b=
530 [[a]]
531
532
533 =b=
534 !! html
535 <p>a
536 </p><p><br />
537 </p>
538 <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>
539 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
540 </p><p><br />
541 </p>
542 <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>
543 !! end
544
545 !! test
546 Extra newlines between heading and content are swallowed (Parsoid does not)
547 !! wikitext
548 =b=
549
550
551
552 [[a]]
553 !! html/php+tidy
554 <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>
555 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
556 </p>
557 !! html/parsoid
558 <h1 id="b">b</h1>
559 <p>
560 <br></p>
561
562 <p><a rel="mw:WikiLink" href="./A" title="A">a</a></p>
563 !! end
564
565 !! test
566 Extra new lines before and after lists are preserved
567 !! wikitext
568 a
569
570
571 *b
572
573
574 c
575 !! html/php+tidy
576 <p>a
577 </p><p><br />
578 </p>
579 <ul><li>b</li></ul>
580 <p><br />
581 c
582 </p>
583 !! html/parsoid
584 <p>a</p>
585 <p>
586 <br></p>
587 <ul><li>b</li></ul>
588 <p>
589 <br>
590 c</p>
591 !! end
592
593 # Parsoid regression test
594 !!test
595 Multiple newlines after tables are converted to p-br-p tags
596 !!options
597 parsoid=wt2html,wt2wt
598 !!wikitext
599 {|
600 |x
601 |}
602
603
604
605
606 =b=
607 !!html/php+tidy
608 <table>
609 <tbody><tr>
610 <td>x
611 </td></tr></tbody></table>
612 <p><br />
613 </p><p><br />
614 </p>
615 <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>
616 !!html/parsoid
617 <table>
618 <tbody>
619 <tr>
620 <td>x</td>
621 </tr>
622 </tbody>
623 </table>
624 <p><br/></p>
625 <p><br/></p>
626 <h1 id="b">b</h1>
627 !!end
628
629 !! test
630 Heading with line break in nowiki
631 !! options
632 parsoid=wt2html
633 !! config
634 wgFragmentMode=[ 'html5', 'legacy' ]
635 !! wikitext
636 ==A <nowiki>B
637 C</nowiki>==
638 !! html/php
639 <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
640 C">A B
641 C</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 B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
642 !! html/parsoid
643 <h2 id="A_B
644 C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
645 C</span></h2>
646 !! end
647
648 !! test
649 Parsing an URL
650 !! wikitext
651 http://fr.wikipedia.org/wiki/🍺
652 <!-- EasterEgg we love beer, better be able be able to link to it -->
653 !! html
654 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
655 </p>
656 !! end
657
658 !! test
659 Simple list
660 !! wikitext
661 *Item 1
662 *Item 2
663 !! html
664 <ul><li>Item 1</li>
665 <li>Item 2</li></ul>
666 !! end
667
668 !! test
669 Italics and bold
670 !! wikitext
671 *plain
672 *plain''italic''plain
673 *plain''italic''plain''italic''plain
674 *plain'''bold'''plain
675 *plain'''bold'''plain'''bold'''plain
676 *plain''italic''plain'''bold'''plain
677 *plain'''bold'''plain''italic''plain
678 *plain''italic'''bold-italic'''italic''plain
679 *plain'''bold''bold-italic''bold'''plain
680 *plain'''''bold-italic'''italic''plain
681 *plain'''''bold-italic''bold'''plain
682 *plain''italic'''bold-italic'''''plain
683 *plain'''bold''bold-italic'''''plain
684 *plain l'''italic''plain
685 *plain l''''bold''' plain
686 !! html
687 <ul><li>plain</li>
688 <li>plain<i>italic</i>plain</li>
689 <li>plain<i>italic</i>plain<i>italic</i>plain</li>
690 <li>plain<b>bold</b>plain</li>
691 <li>plain<b>bold</b>plain<b>bold</b>plain</li>
692 <li>plain<i>italic</i>plain<b>bold</b>plain</li>
693 <li>plain<b>bold</b>plain<i>italic</i>plain</li>
694 <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
695 <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
696 <li>plain<i><b>bold-italic</b>italic</i>plain</li>
697 <li>plain<b><i>bold-italic</i>bold</b>plain</li>
698 <li>plain<i>italic<b>bold-italic</b></i>plain</li>
699 <li>plain<b>bold<i>bold-italic</i></b>plain</li>
700 <li>plain l'<i>italic</i>plain</li>
701 <li>plain l'<b>bold</b> plain</li></ul>
702 !! end
703
704 # this example taken from the [[simple:Moon]] article (T49326)
705 !! test
706 Italics and possessives (1)
707 !! wikitext
708 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
709 !! html
710 <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
711 </p>
712 !! end
713
714 # this example taken from [[en:Flaming Pie]] (T51926)
715 !! test
716 Italics and possessives (2)
717 !! wikitext
718 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
719 !! html
720 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
721 </p>
722 !! end
723
724 # this example taken from [[en:Dictionary]] (T51926)
725 !! test
726 Italics and possessives (3)
727 !! wikitext
728 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''.
729 !! html
730 <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>.
731 </p>
732 !! end
733
734
735 ###
736 ### 2-quote opening sequence tests
737 ###
738 !! test
739 Italics and bold: 2-quote opening sequence: (2,2)
740 !! wikitext
741 ''foo''
742 !! html
743 <p><i>foo</i>
744 </p>
745 !!end
746
747 !! test
748 Italics and bold: 2-quote opening sequence: (2,3)
749 !! wikitext
750 ''foo'''
751 !! html/*
752 <p><i>foo'</i>
753 </p>
754 !!end
755
756 !! test
757 Italics and bold: 2-quote opening sequence: (2,4)
758 !! options
759 parsoid=wt2html
760 !! wikitext
761 ''foo''''
762 !! html/*
763 <p><i>foo''</i>
764 </p>
765 !!end
766
767 # same html as previous, but wikitext adjusted to match parsoid html2wt
768 !! test
769 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
770 !! wikitext
771 ''foo<nowiki>''</nowiki>''
772 !! html
773 <p><i>foo''</i>
774 </p>
775 !! end
776
777 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
778 !! test
779 Italics and bold: 2-quote opening sequence: (2,5)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''foo'''''
784 !! html/php
785 <p><i>foo</i>
786 </p>
787 !! html/parsoid
788 <p><i>foo</i><b></b>
789 </p>
790 !!end
791
792 # same html as previous, but wikitext adjusted to match parsoid html2wt
793 !! test
794 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
795 !! wikitext
796 ''foo'''''<nowiki/>'''
797 !! html/php
798 <p><i>foo</i>
799 </p>
800 !! html/parsoid
801 <p><i>foo</i><b></b>
802 </p>
803 !! end
804
805
806 ###
807 ### 3-quote opening sequence tests
808 ###
809
810 !! test
811 Italics and bold: 3-quote opening sequence: (3,2)
812 !! wikitext
813 '''foo''
814 !! html/*
815 <p>'<i>foo</i>
816 </p>
817 !!end
818
819 !! test
820 Italics and bold: 3-quote opening sequence: (3,3)
821 !! wikitext
822 '''foo'''
823 !! html
824 <p><b>foo</b>
825 </p>
826 !!end
827
828 !! test
829 Italics and bold: 3-quote opening sequence: (3,4)
830 !! wikitext
831 '''foo''''
832 !! html/*
833 <p><b>foo'</b>
834 </p>
835 !!end
836
837 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
838 !! test
839 Italics and bold: 3-quote opening sequence: (3,5)
840 !! options
841 parsoid=wt2html
842 !! wikitext
843 '''foo'''''
844 !! html/php
845 <p><b>foo</b>
846 </p>
847 !! html/parsoid
848 <p><b>foo</b><i></i>
849 </p>
850 !!end
851
852 # same html as previous, but wikitext adjusted to match parsoid html2wt
853 !! test
854 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
855 !! wikitext
856 '''foo'''''<nowiki/>''
857 !! html/php
858 <p><b>foo</b>
859 </p>
860 !! html/parsoid
861 <p><b>foo</b><i></i>
862 </p>
863 !! end
864
865
866 ###
867 ### 4-quote opening sequence tests
868 ###
869
870 !! test
871 Italics and bold: 4-quote opening sequence: (4,2)
872 !! options
873 parsoid=wt2html
874 !! wikitext
875 ''''foo''
876 !! html/*
877 <p>''<i>foo</i>
878 </p>
879 !!end
880
881 # same html as previous, but wikitext adjusted to match parsoid html2wt
882 !! test
883 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
884 !! wikitext
885 <nowiki>''</nowiki>''foo''
886 !! html
887 <p>''<i>foo</i>
888 </p>
889 !! end
890
891 !! test
892 Italics and bold: 4-quote opening sequence: (4,3)
893 !! wikitext
894 ''''foo'''
895 !! html/*
896 <p>'<b>foo</b>
897 </p>
898 !!end
899
900 !! test
901 Italics and bold: 4-quote opening sequence: (4,4)
902 !! options
903 parsoid=wt2html
904 !! wikitext
905 ''''foo''''
906 !! html/*
907 <p>'<b>foo'</b>
908 </p>
909 !!end
910
911 # same html as previous, but wikitext adjusted to match parsoid html2wt
912 !! test
913 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
914 !! wikitext
915 '<nowiki/>'''foo''''
916 !! html
917 <p>'<b>foo'</b>
918 </p>
919 !! end
920
921 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
922 !! test
923 Italics and bold: 4-quote opening sequence: (4,5)
924 !! options
925 parsoid=wt2html
926 !! wikitext
927 ''''foo'''''
928 !! html/php
929 <p>'<b>foo</b>
930 </p>
931 !! html/parsoid
932 <p>'<b>foo</b><i></i>
933 </p>
934 !!end
935
936 # same html as previous, but wikitext adjusted to match parsoid html2wt
937 !! test
938 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
939 !! wikitext
940 '<nowiki/>'''foo'''''<nowiki/>''
941 !! html/php
942 <p>'<b>foo</b>
943 </p>
944 !! html/parsoid
945 <p>'<b>foo</b><i></i>
946 </p>
947 !! end
948
949
950 ###
951 ### 5-quote opening sequence tests
952 ###
953
954 !! test
955 Italics and bold: 5-quote opening sequence: (5,2)
956 !! options
957 parsoid=wt2html
958 !! wikitext
959 '''''foo''
960 !! html/*
961 <p><b><i>foo</i></b>
962 </p>
963 !!end
964
965 # same html as previous, but wikitext adjusted to match parsoid html2wt
966 !! test
967 Italics and bold: 5-quote opening sequence: (5,2+3)
968 !! wikitext
969 '''''foo'''''
970 !! html/*
971 <p><i><b>foo</b></i>
972 </p>
973 !! end
974
975 !! test
976 Italics and bold: 5-quote opening sequence: (5,3)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''''foo'''
981 !! html/*
982 <p><i><b>foo</b></i>
983 </p>
984 !!end
985
986 # same html as previous, but wikitext adjusted to match parsoid html2wt
987 !! test
988 Italics and bold: 5-quote opening sequence: (5,3+2)
989 !! wikitext
990 '''''foo'''''
991 !! html
992 <p><i><b>foo</b></i>
993 </p>
994 !! end
995
996 !! test
997 Italics and bold: 5-quote opening sequence: (5,4)
998 !! options
999 parsoid=wt2html
1000 !! wikitext
1001 '''''foo''''
1002 !! html/*
1003 <p><i><b>foo'</b></i>
1004 </p>
1005 !!end
1006
1007 !! test
1008 Italics and bold: 5-quote opening sequence: (5,5)
1009 !! wikitext
1010 '''''foo'''''
1011 !! html
1012 <p><i><b>foo</b></i>
1013 </p>
1014 !!end
1015
1016 !! test
1017 Italics and bold: 5-quote opening sequence: (5,6)
1018 !! wikitext
1019 '''''foo''''''
1020 !! html/*
1021 <p><i><b>foo'</b></i>
1022 </p>
1023 !! end
1024
1025 ###
1026 ### multiple quote sequences in a line
1027 ###
1028
1029 !! test
1030 Italics and bold: multiple quote sequences: (2,4,2)
1031 !! options
1032 parsoid=wt2html
1033 !! wikitext
1034 ''foo''''bar''
1035 !! html/*
1036 <p><i>foo'<b>bar</b></i>
1037 </p>
1038 !! end
1039
1040 # same html as previous, but wikitext adjusted to match parsoid html2wt
1041 !! test
1042 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
1043 !! wikitext
1044 ''foo'<nowiki/>'''bar'''''
1045 !! html
1046 <p><i>foo'<b>bar</b></i>
1047 </p>
1048 !! end
1049
1050 !! test
1051 Italics and bold: multiple quote sequences: (2,4,3)
1052 !! options
1053 parsoid=wt2html
1054 !! wikitext
1055 ''foo''''bar'''
1056 !! html/*
1057 <p><i>foo'<b>bar</b></i>
1058 </p>
1059 !! end
1060
1061 # same html as previous, but wikitext adjusted to match parsoid html2wt
1062 !! test
1063 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
1064 !! wikitext
1065 ''foo'<nowiki/>'''bar'''''
1066 !! html
1067 <p><i>foo'<b>bar</b></i>
1068 </p>
1069 !! end
1070
1071 !! test
1072 Italics and bold: multiple quote sequences: (2,4,4)
1073 !! options
1074 parsoid=wt2html
1075 !! wikitext
1076 ''foo''''bar''''
1077 !! html/*
1078 <p><i>foo'<b>bar'</b></i>
1079 </p>
1080 !! end
1081
1082 # same html as previous, but wikitext adjusted to match parsoid html2wt
1083 !! test
1084 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
1085 !! wikitext
1086 ''foo'<nowiki/>'''bar'<nowiki/>'''''
1087 !! html
1088 <p><i>foo'<b>bar'</b></i>
1089 </p>
1090 !! end
1091
1092 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1093 !! test
1094 Italics and bold: multiple quote sequences: (3,4,2)
1095 !! options
1096 parsoid=wt2html
1097 !! wikitext
1098 '''foo''''bar''
1099 !! html/php
1100 <p><b>foo'</b>bar
1101 </p>
1102 !! html/parsoid
1103 <p><b>foo'</b>bar<i></i>
1104 </p>
1105 !! end
1106
1107 # same html as previous, but wikitext adjusted to match parsoid html2wt
1108 !! test
1109 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1110 !! wikitext
1111 '''foo''''bar''<nowiki/>''
1112 !! html/php
1113 <p><b>foo'</b>bar
1114 </p>
1115 !! html/parsoid
1116 <p><b>foo'</b>bar<i></i>
1117 </p>
1118 !! end
1119
1120 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1121 !! test
1122 Italics and bold: multiple quote sequences: (3,4,3)
1123 !! options
1124 parsoid=wt2html
1125 !! wikitext
1126 '''foo''''bar'''
1127 !! html/php
1128 <p><b>foo'</b>bar
1129 </p>
1130 !! html/parsoid
1131 <p><b>foo'</b>bar<b></b>
1132 </p>
1133 !! end
1134
1135 # same html as previous, but wikitext adjusted to match parsoid html2wt
1136 !! test
1137 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1138 !! wikitext
1139 '''foo''''bar'''<nowiki/>'''
1140 !! html/php
1141 <p><b>foo'</b>bar
1142 </p>
1143 !! html/parsoid
1144 <p><b>foo'</b>bar<b></b>
1145 </p>
1146 !! end
1147
1148 ###
1149 ### other quote tests
1150 ###
1151 !! test
1152 Italics and bold: other quote tests: (2,3,5)
1153 !! wikitext
1154 ''this is about '''foo's family'''''
1155 !! html
1156 <p><i>this is about <b>foo's family</b></i>
1157 </p>
1158 !!end
1159
1160
1161 !! test
1162 Italics and bold: other quote tests: (2,(3,3),2)
1163 !! wikitext
1164 ''this is about '''foo's''' family''
1165 !! html
1166 <p><i>this is about <b>foo's</b> family</i>
1167 </p>
1168 !!end
1169
1170
1171 !! test
1172 Italics and bold: other quote tests: (3,2,3,2)
1173 !! options
1174 parsoid=wt2html
1175 !! wikitext
1176 '''this is about ''foo'''s family''
1177 !! html/*
1178 <p><b>this is about <i>foo</i></b><i>s family</i>
1179 </p>
1180 !!end
1181
1182
1183 # same html as previous, but wikitext adjusted to match parsoid html2wt
1184 !! test
1185 Italics and bold: other quote tests: (3,2,3+2+2,2)
1186 !! wikitext
1187 '''this is about ''foo'''''<nowiki/>''s family''
1188 !! html
1189 <p><b>this is about <i>foo</i></b><i>s family</i>
1190 </p>
1191 !! end
1192
1193
1194 !! test
1195 Italics and bold: other quote tests: (3,2,3,3)
1196 !! wikitext
1197 '''this is about ''foo'''s family'''
1198 !! html/*
1199 <p>'<i>this is about </i>foo<b>s family</b>
1200 </p>
1201 !!end
1202
1203
1204 !! test
1205 Italics and bold: other quote tests: (3,(2,2),3)
1206 !! wikitext
1207 '''this is about ''foo's'' family'''
1208 !! html
1209 <p><b>this is about <i>foo's</i> family</b>
1210 </p>
1211 !!end
1212
1213
1214 !! test
1215 Italicized possessive
1216 !! wikitext
1217 The ''[[Main Page]]'''s talk page.
1218 !! html/php
1219 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1220 </p>
1221 !! html/parsoid
1222 <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1223 !! end
1224
1225 !! test
1226 Quote balancing context should be restricted to td/th cells on the same wikitext line
1227 !! options
1228 parsoid=wt2html,wt2wt
1229 !! wikitext
1230 {|
1231 !''a!!''b
1232 |''a||''b
1233 |}
1234 !! html+tidy
1235 <table>
1236 <tbody><tr>
1237 <th><i>a</i></th>
1238 <th><i>b</i>
1239 </th>
1240 <td><i>a</i></td>
1241 <td><i>b</i>
1242 </td></tr></tbody></table>
1243 !! end
1244
1245 !! test
1246 Bold conversion test
1247 !! wikitext
1248 a b'''c ''d e'''f'' g h'''i ''j
1249 !! options
1250 parsoid=wt2html
1251 !! html+tidy
1252 <p>a b'<i>c </i>d e<b>f<i> g h</i></b><i>i </i>j
1253 </p>
1254 !! end
1255
1256 ###
1257 ### Non-html5 tags
1258 ###
1259
1260 !! test
1261 Non-html5 tags should be accepted
1262 !! wikitext
1263 <center>''foo''</center>
1264 <big>''foo''</big>
1265 <font>''foo''</font>
1266 <strike>''foo''</strike>
1267 <tt>''foo''</tt>
1268 !! html
1269 <center><i>foo</i></center>
1270 <p><big><i>foo</i></big>
1271 <font><i>foo</i></font>
1272 <strike><i>foo</i></strike>
1273 <tt><i>foo</i></tt>
1274 </p>
1275 !! end
1276
1277 !! test
1278 <wbr> is valid wikitext (T54468)
1279 !! wikitext
1280 <wbr>
1281 !! html
1282 <p><wbr />
1283 </p>
1284 !! end
1285
1286 # <strike> is HTML4, <s> is HTML4/5.
1287 !! test
1288 <s> or <strike> for strikethrough
1289 !! wikitext
1290 <strike>strike</strike>
1291
1292 <s>s</s>
1293 !! html
1294 <p><strike>strike</strike>
1295 </p><p><s>s</s>
1296 </p>
1297 !! end
1298
1299 ## a not permitted
1300 ## i,b,br omitted
1301 !! test
1302 Text-level semantic html elements in wikitext
1303 !! wikitext
1304 <em>text</em>
1305 <strong>text</strong>
1306 <small>text</small>
1307 <s>text</s>
1308 <cite>text</cite>
1309 <q>text</q>
1310 <dfn>text</dfn>
1311 <abbr>text</abbr>
1312 <data>text</data>
1313 <time>text</time>
1314 <code>text</code>
1315 <var>text</var>
1316 <samp>text</samp>
1317 <kbd>text</kbd>
1318 <sub>text</sub>
1319 <u>text</u>
1320 <mark>text</mark>
1321 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1322 <bdi>text</bdi>
1323 <bdo>text</bdo>
1324 <span>text</span>
1325 <wbr />
1326 !! html
1327 <p><em>text</em>
1328 <strong>text</strong>
1329 <small>text</small>
1330 <s>text</s>
1331 <cite>text</cite>
1332 <q>text</q>
1333 <dfn>text</dfn>
1334 <abbr>text</abbr>
1335 <data>text</data>
1336 <time>text</time>
1337 <code>text</code>
1338 <var>text</var>
1339 <samp>text</samp>
1340 <kbd>text</kbd>
1341 <sub>text</sub>
1342 <u>text</u>
1343 <mark>text</mark>
1344 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1345 <bdi>text</bdi>
1346 <bdo>text</bdo>
1347 <span>text</span>
1348 <wbr />
1349 </p>
1350 !! end
1351
1352 # test cases taken from
1353 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1354 !! test
1355 Ruby markup (W3C-style)
1356 !! wikitext
1357 ;Mono-ruby for individual base characters
1358 :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1359 ;Group ruby
1360 :<ruby>今日<rt>きょう</rt></ruby>
1361 ;Jukugo ruby
1362 :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1363 ;Inline ruby
1364 :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1365 ;Double-sided ruby
1366 :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1367
1368 <ruby>
1369 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1370 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1371 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1372 </ruby>
1373 !! html
1374 <dl><dt>Mono-ruby for individual base characters</dt>
1375 <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1376 <dt>Group ruby</dt>
1377 <dd><ruby>今日<rt>きょう</rt></ruby></dd>
1378 <dt>Jukugo ruby</dt>
1379 <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1380 <dt>Inline ruby</dt>
1381 <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1382 <dt>Double-sided ruby</dt>
1383 <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>
1384 <p><ruby>
1385 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1386 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1387 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1388 </ruby>
1389 </p>
1390 !! end
1391
1392 # The next two test different paths in the sanitizer.
1393 !! test
1394 Non-word characters don't terminate tag names (T19663, T42670, T54022)
1395 !! wikitext
1396 <blockquote|>a</blockquote>
1397
1398 <b→> doesn't terminate </b→>
1399
1400 <bä> doesn't terminate </bä>
1401
1402 <boo> doesn't terminate </boo>
1403
1404 <s.foo> doesn't terminate </s.foo>
1405
1406 <sub-ID#1>
1407 !! html/php
1408 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1409 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1410 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1411 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1412 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1413 </p><p>&lt;sub-ID#1&gt;
1414 </p>
1415 !! end
1416
1417 !! test
1418 Non-word characters don't terminate tag names
1419 !! wikitext
1420 <blockquote|>a</blockquote>
1421
1422 <b→> doesn't terminate </b→>
1423
1424 <bä> doesn't terminate </bä>
1425
1426 <boo> doesn't terminate </boo>
1427
1428 <s.foo> doesn't terminate </s.foo>
1429
1430 <sub-ID#1>
1431 !! html+tidy
1432 <p>&lt;blockquote|&gt;a
1433 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1434 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1435 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1436 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1437 </p><p>&lt;sub-ID#1&gt;
1438 </p>
1439 !! end
1440
1441 ###
1442 ### See tests/parser/ParserTestParserHook.php for the <tåg> extension)
1443 ### This checks that HTML5 tags (with non-word characters in the tag
1444 ### name) make it safely through the parser -- the Sanitizer will
1445 ### munge them later, as it should.
1446 ###
1447 !! test
1448 Non-word characters are valid in extension tags (T19663)
1449 !! wikitext
1450 <tåg>tåg</tåg>
1451 !! html/php
1452 <pre>
1453 'tåg'
1454 array (
1455 )
1456 </pre>
1457 !! html/parsoid
1458 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1459 !! end
1460
1461 !! test
1462 Isolated close tags should be treated as literal text (T54760)
1463 !! options
1464 parsoid=wt2html
1465 !! wikitext
1466 </b>
1467
1468 <s.foo>s</s>
1469 !! html+tidy
1470 <p class="mw-empty-elt">
1471 </p><p>&lt;s.foo&gt;s
1472 </p>
1473 !! end
1474
1475 ###
1476 ### Special characters
1477 ###
1478
1479 !! test
1480 Bare pipe character (T54363)
1481 !! wikitext
1482 |
1483 !! html
1484 <p>|
1485 </p>
1486 !! end
1487
1488 !! test
1489 Bare pipe character from a template (T54363)
1490 !! wikitext
1491 {{pipe}}
1492 !! html
1493 <p>|
1494 </p>
1495 !! end
1496
1497 ###
1498 ### <nowiki> test cases
1499 ###
1500
1501 !! test
1502 <nowiki> unordered list
1503 !! wikitext
1504 <nowiki>* This is not an unordered list item.</nowiki>
1505 !! html/php
1506 <p>* This is not an unordered list item.
1507 </p>
1508 !! html/parsoid
1509 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1510 !! end
1511
1512 !! test
1513 <nowiki> spacing
1514 !! wikitext
1515 <nowiki>Lorem ipsum dolor
1516
1517 sed abit.
1518 sed nullum.
1519
1520 :and a colon
1521 </nowiki>
1522 !! html/php
1523 <p>Lorem ipsum dolor
1524
1525 sed abit.
1526 sed nullum.
1527
1528 :and a colon
1529
1530 </p>
1531 !! html/parsoid
1532 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1533
1534 sed abit.
1535 sed nullum.
1536
1537 :and a colon
1538 </span></p>
1539 !! end
1540
1541 !! test
1542 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1543 !! wikitext
1544 <nowiki><span class="error"></nowiki>
1545 !! html/php
1546 <p>&lt;span class="error"&gt;
1547 </p>
1548 !! html/parsoid
1549 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1550 !! end
1551
1552 !! test
1553 nowiki 3
1554 !! wikitext
1555 :There is not nowiki.
1556 :There is <nowiki>nowiki</nowiki>.
1557
1558 #There is not nowiki.
1559 #There is <nowiki>nowiki</nowiki>.
1560
1561 *There is not nowiki.
1562 *There is <nowiki>nowiki</nowiki>.
1563 !! html/php
1564 <dl><dd>There is not nowiki.</dd>
1565 <dd>There is nowiki.</dd></dl>
1566 <ol><li>There is not nowiki.</li>
1567 <li>There is nowiki.</li></ol>
1568 <ul><li>There is not nowiki.</li>
1569 <li>There is nowiki.</li></ul>
1570 !! html/parsoid
1571 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1572 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1573
1574 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1575 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1576
1577 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1578 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1579 !! end
1580
1581 !! test
1582 Entities inside <nowiki>
1583 !! wikitext
1584 <nowiki>&lt;</nowiki>
1585 !! html/php
1586 <p>&lt;
1587 </p>
1588 !! html/parsoid
1589 <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
1590 !! end
1591
1592 !! test
1593 Entities inside template parameters
1594 !! wikitext
1595 {{echo|&ndash;}}
1596 !! html/php+tidy
1597 <p>&#8211;
1598 </p>
1599 !! html/parsoid
1600 <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>
1601 !! end
1602
1603 !! test
1604 Properly escape nowiki when combined with other wiki markup
1605 !! options
1606 parsoid=html2wt
1607 !! html/parsoid
1608 <p>* &lt;/nowiki&gt; tag</p>
1609 !! wikitext
1610 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1611 !! end
1612
1613 !! test
1614 T93824: Put escaped HTML tags inside nowiki
1615 !! options
1616 parsoid=html2wt
1617 !! html/parsoid
1618 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1619 !! wikitext
1620 <nowiki><h2>foo</h2></nowiki>
1621 !! end
1622
1623 !! test
1624 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1625 !! options
1626 parsoid=html2wt
1627 !! html/parsoid
1628 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1629 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1630 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1631 !! wikitext
1632 This text: L'[[Foo]]
1633 This text: L<nowiki>''</nowiki>[[Foo]]
1634 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1635 !! end
1636
1637 # This test fails because wikitext whitespace is not normalized before comparing.
1638 !! test
1639 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1640 !! options
1641 parsoid=html2wt
1642 !! html/parsoid
1643 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1644 </p>
1645 !! wikitext
1646 This text : L<nowiki>''</nowiki>[[Foo]]
1647 !! end
1648
1649 # This test and the next one are html2wt only as they test that incorrect wikitext
1650 # passed in template arguments gets escaped or wrapped in nowikis where required.
1651 !! test
1652 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1653 !! options
1654 parsoid=html2wt
1655 !! html/parsoid
1656 <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>
1657 <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>
1658 !! wikitext
1659 {{echo|foo{{!}}bar}}
1660 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1661 !! end
1662
1663 !! test
1664 T53961: Output correct nowikis in template arguments
1665 !! options
1666 parsoid=html2wt
1667 !! html/parsoid
1668 <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>
1669 <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>
1670 <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>
1671 <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>
1672 <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>
1673 !! wikitext
1674 {{echo|a [ b}}
1675 {{echo|<nowiki>a }} b</nowiki>}}
1676 {{echo|<nowiki>a [[ b</nowiki>}}
1677 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1678 {{echo|a <nowiki>}</nowiki>}}
1679 !! end
1680
1681 !! test
1682 Cases where "!!" needs nowiki protection
1683 !! options
1684 parsoid=html2wt
1685 !! html/parsoid
1686 <table>
1687 <tr><th>this needs protection !! here</th></tr>
1688 </table>
1689
1690 <table>
1691 <tr><th>this does not need
1692 protection !! here</th></tr>
1693 </table>
1694 !! wikitext
1695 {|
1696 !<nowiki>this needs protection !! here</nowiki>
1697 |}
1698
1699 {|
1700 !this does not need
1701 protection !! here
1702 |}
1703 !! end
1704
1705 ###
1706 ### Comments
1707 ###
1708 !! test
1709 Comments and Indent-Pre
1710 !! wikitext
1711 <!-- comment 1 --> asdf
1712
1713 <!-- comment 1 --> asdf
1714 <!-- comment 2 -->
1715
1716 <!-- comment 1 --> asdf
1717 <!-- comment 2 -->xyz
1718
1719 <!-- comment 1 --> asdf
1720 <!-- comment 2 --> xyz
1721 !! html
1722 <pre>asdf
1723 </pre>
1724 <pre>asdf
1725 </pre>
1726 <pre>asdf
1727 </pre>
1728 <p>xyz
1729 </p>
1730 <pre>asdf
1731 xyz
1732 </pre>
1733 !! end
1734
1735 !! test
1736 Comment test 2a
1737 !! wikitext
1738 asdf
1739 <!-- comment 1 -->
1740 jkl
1741 !! html
1742 <p>asdf
1743 jkl
1744 </p>
1745 !! end
1746
1747 !! test
1748 Comment test 2b
1749 !! wikitext
1750 asdf
1751 <!-- comment 1 -->
1752
1753 jkl
1754 !! html
1755 <p>asdf
1756 </p><p>jkl
1757 </p>
1758 !! end
1759
1760 !! test
1761 Comment test 3
1762 !! wikitext
1763 asdf
1764 <!-- comment 1 -->
1765 <!-- comment 2 -->
1766 jkl
1767 !! html
1768 <p>asdf
1769 jkl
1770 </p>
1771 !! end
1772
1773 !! test
1774 Comment test 4
1775 !! wikitext
1776 asdf<!-- comment 1 -->jkl
1777 !! html
1778 <p>asdfjkl
1779 </p>
1780 !! end
1781
1782 !! test
1783 Comment spacing
1784 !! wikitext
1785 a
1786 <!-- foo --> b <!-- bar -->
1787 c
1788 !! html
1789 <p>a
1790 </p>
1791 <pre> b
1792 </pre>
1793 <p>c
1794 </p>
1795 !! end
1796
1797 !! test
1798 Comment whitespace
1799 !! wikitext
1800 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1801 !! html
1802 !! end
1803
1804 !! test
1805 Comment semantics and delimiters
1806 !! wikitext
1807 <!-- --><!----><!-----><!------>
1808 !! html/php
1809 !! html/parsoid
1810 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1811 !! end
1812
1813 !! test
1814 Comment semantics and delimiters, redux
1815 !! wikitext
1816 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1817 -- foo -- funky huh? ... -->
1818 !! html/php
1819 !! html/parsoid
1820 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1821 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1822 !! end
1823
1824 !! test
1825 Comment semantics and delimiters: directors cut
1826 !! wikitext
1827 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1828 everything starting with < followed by !-- until the first -- and > we see,
1829 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1830 -->-->
1831 !! html/php
1832 <p>--&gt;
1833 </p>
1834 !! html/parsoid
1835 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1836 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1837 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1838 --><p>--></p>
1839 !! end
1840
1841 !! test
1842 Comment semantics: nesting
1843 !! wikitext
1844 <!--<!-- no, we're not going to do anything fancy here -->-->
1845 !! html/php
1846 <p>--&gt;
1847 </p>
1848 !! html/parsoid
1849 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1850 !! end
1851
1852 # Parsoid closes the unclosed comment, even if it means a slight
1853 # round-trip diff.
1854 !! test
1855 Comment semantics: unclosed comment at end
1856 !! options
1857 parsoid=wt2html,html2html
1858 !! wikitext
1859 <!--This comment will run out to the end of the document
1860 !! html/php
1861 !! html/parsoid
1862 <!--This comment will run out to the end of the document-->
1863 !! end
1864
1865 !! test
1866 Comment semantics: normalize comments to play nice with XML and browsers
1867 !! wikitext
1868 <!-- Browsers --!> think this is closed -->
1869 <!--> This would normally be text -->
1870 <!---> As would this -->
1871 <!-- XML doesn't like trailing dashes -------->
1872 <!-- Nor doubled hyphens -- anywhere in the data -->
1873 But this is not a comment.
1874 !! html/php
1875 <p>But this is not a comment.
1876 </p>
1877 !! html/parsoid
1878 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1879 <!--&#x3E; This would normally be text -->
1880 <!--&#x2D;&#x3E; As would this -->
1881 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1882 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1883 <p>But this is not a comment.</p>
1884 !! end
1885
1886 !! test
1887 Comment semantics: round-trip even text which contains encoded -->
1888 !! wikitext
1889 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1890 !! html/parsoid
1891 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1892 !! end
1893
1894 !! test
1895 Comment in template title
1896 !! wikitext
1897 {{f<!---->oo}}
1898 !! html
1899 <p>FOO
1900 </p>
1901 !! end
1902
1903 !! test
1904 Comment on its own line post-expand
1905 !! wikitext
1906 a
1907 {{blank}}<!---->
1908 b
1909 !! html
1910 <p>a
1911 </p><p>b
1912 </p>
1913 !! end
1914
1915 !! test
1916 Comment on its own line post-expand with non-significant whitespace
1917 !! wikitext
1918 a
1919 {{blank}} <!---->
1920 b
1921 !! html
1922 <p>a
1923 </p><p>b
1924 </p>
1925 !! end
1926
1927 !! test
1928 post-expand include size being exceeded
1929 !! options
1930 maxincludesize=20
1931 !! wikitext
1932 {{echo3|1234567890}}
1933 !! html
1934 <p><a href="/wiki/Template:Echo3" title="Template:Echo3">Template:Echo3</a><!-- WARNING: template omitted, post-expand include size too large -->
1935 </p>
1936 !! end
1937
1938 !! test
1939 max template depth being reached
1940 !! options
1941 maxtemplatedepth=1
1942 !! wikitext
1943 {{echo with depth|too deep!}}
1944 !! html
1945 <p><span class="error">Template recursion depth limit exceeded (1)</span>
1946 </p>
1947 !! end
1948
1949 !! test
1950 multiple templates that are redirects
1951 !! wikitext
1952 {{redirect to foo}}
1953 {{redirect to foo}}
1954 !! html
1955 <p>FOO
1956 FOO
1957 </p>
1958 !! end
1959
1960 !! test
1961 Multiple comments should still parse as SOL-transparent
1962 !! options
1963 parsoid=wt2html,wt2wt
1964 !! wikitext
1965 <!--c1-->*a
1966 <!--c2--><!--c3--><!--c4-->*b
1967 !! html/php
1968 <ul><li>a</li>
1969 <li>b</li></ul>
1970 !! html/parsoid
1971 <!--c1--><ul>
1972 <li>a
1973 </li>
1974 <!--c2--><!--c3--><!--c4-->
1975 <li>b
1976 </li>
1977 </ul>
1978 !! end
1979
1980 ## Make sure ">" gets escaped in comments to avoid XSS
1981 !! test
1982 IE conditional comments
1983 !! wikitext
1984 <!--[if lt IE 9]>
1985 <script>alert('hi');</script>
1986 <![endif]-->
1987 !! html/parsoid
1988 <!--[if lt IE 9]&#x3E;
1989 <script&#x3E;alert('hi');</script&#x3E;
1990 <![endif]-->
1991 !! end
1992
1993 ###
1994 ### paragraph wrapping tests
1995 ###
1996
1997 !! test
1998 No block tags
1999 !! wikitext
2000 a
2001
2002 b
2003 !! html
2004 <p>a
2005 </p><p>b
2006 </p>
2007 !! end
2008
2009 !! test
2010 Block tag on one line (<div>)
2011 !! wikitext
2012 a <div>foo</div>
2013
2014 b
2015 !! html
2016 a <div>foo</div>
2017 <p>b
2018 </p>
2019 !! html+tidy
2020 <p>a </p><div>foo</div>
2021 <p>b
2022 </p>
2023 !! end
2024
2025 !! test
2026 No p-wrappable content
2027 !! options
2028 parsoid=wt2html,html2html
2029 !! wikitext
2030 <span><div>x</div></span>
2031 <span><s><div>x</div></s></span>
2032 <small><em></em></small><span><s><div>x</div></s></span>
2033 !! html+tidy
2034 <span><div>x</div></span>
2035 <span><s><div>x</div></s></span>
2036 <p><small><em></em></small></p><span><s><div>x</div></s></span>
2037 !! end
2038
2039 # T177612: Parsoid-only test
2040 !! test
2041 Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
2042 !! wikitext
2043 {{echo|<span><div>x</div></span>}}
2044 x
2045 !! html/parsoid
2046 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
2047 <p>x</p>
2048 !! end
2049
2050 !! test
2051 Block tag on one line (<blockquote>)
2052 !! wikitext
2053 a <blockquote>foo</blockquote>
2054
2055 b
2056 !! html
2057 a <blockquote>foo</blockquote>
2058 <p>b
2059 </p>
2060 !! html+tidy
2061 <p>a </p><blockquote><p>foo</p></blockquote>
2062 <p>b
2063 </p>
2064 !! end
2065
2066 !! test
2067 Block tag on both lines (<div>)
2068 !! wikitext
2069 a <div>foo</div>
2070
2071 b <div>foo</div>
2072 !! html
2073 a <div>foo</div>
2074 b <div>foo</div>
2075 !! html+tidy
2076 <p>a </p><div>foo</div><p>
2077 b </p><div>foo</div>
2078 !! end
2079
2080 !! test
2081 Block tag on both lines (<blockquote>)
2082 !! wikitext
2083 a <blockquote>foo</blockquote>
2084
2085 b <blockquote>foo</blockquote>
2086 !! html
2087 a <blockquote>foo</blockquote>
2088 b <blockquote>foo</blockquote>
2089 !! html+tidy
2090 <p>a </p><blockquote><p>foo</p></blockquote><p>
2091 b </p><blockquote><p>foo</p></blockquote>
2092 !! end
2093
2094 !! test
2095 Multiple lines without block tags
2096 !! wikitext
2097 <div>foo</div> a
2098 b
2099 c
2100 d<!--foo--> e
2101 x <div>foo</div> z
2102 !! html
2103 <div>foo</div> a
2104 <p>b
2105 c
2106 d e
2107 </p>
2108 x <div>foo</div> z
2109 !! html+tidy
2110 <div>foo</div><p> a
2111 </p><p>b
2112 c
2113 d e
2114 </p><p>
2115 x </p><div>foo</div><p> z</p>
2116 !! end
2117
2118 !! test
2119 Empty lines between lines with block tags
2120 !! wikitext
2121 <div></div>
2122
2123
2124 <div></div>a
2125
2126 b
2127 <div>a</div>b
2128
2129 <div>b</div>d
2130
2131
2132 <div>e</div>
2133 !! html
2134 <div></div>
2135 <p><br />
2136 </p>
2137 <div></div>a
2138 <p>b
2139 </p>
2140 <div>a</div>b
2141 <div>b</div>d
2142 <p><br />
2143 </p>
2144 <div>e</div>
2145 !! html+tidy
2146 <div></div>
2147 <p><br />
2148 </p>
2149 <div></div><p>a
2150 </p><p>b
2151 </p>
2152 <div>a</div><p>b
2153 </p><div>b</div><p>d
2154 </p><p><br />
2155 </p>
2156 <div>e</div>
2157 !! html/parsoid
2158 <div data-parsoid='{"stx":"html"}'></div>
2159
2160 <p><br /></p>
2161 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2162
2163 <p>b</p>
2164 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2165
2166 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2167
2168 <p><br /></p>
2169 <div data-parsoid='{"stx":"html"}'>e</div>
2170 !! end
2171
2172 !! test
2173 Unclosed HTML p-tags should be handled properly
2174 !! wikitext
2175 <div><p>foo</div>
2176 a
2177
2178 b
2179 !! html/php+tidy
2180 <div><p>foo</p></div>
2181 <p>a
2182 </p><p>b
2183 </p>
2184 !! html/parsoid
2185 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2186 <p>a</p>
2187 <p>b</p>
2188 !! end
2189
2190 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2191 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2192 ## them for now.
2193 !! test
2194 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2195 !! options
2196 parsoid=wt2html
2197 !! wikitext
2198 a [[Category:A1]] [[Category:A2]]
2199 [[Category:A3]]
2200 [[Category:A4]]
2201 !! html/parsoid
2202 <p>a</p>
2203 <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"/>
2204 !! end
2205
2206 !! test
2207 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2208 !! options
2209 parsoid=wt2html
2210 !! wikitext
2211 [[Category:A1]]a
2212 !! html/parsoid
2213 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2214 !! end
2215
2216 !! test
2217 No paragraph necessary for SOL transparent template
2218 !! wikitext
2219 <span><div>foo</div></span>
2220 [[Category:Foo]]
2221
2222 <span><div>foo</div></span>
2223 {{echo|[[Category:Foo]]}}
2224 !! html/php
2225 <span><div>foo</div></span>
2226 <span><div>foo</div></span>
2227 !! html/parsoid
2228 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2229 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
2230
2231 <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
2232 <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]]"}},"i":0}}]}'/>
2233 !! end
2234
2235 !! test
2236 Avoid expanding multiline sol transparent template ranges unnecessarily
2237 !! wikitext
2238 hi
2239
2240
2241 {{echo|<br/>
2242 }}
2243
2244 [[Category:Ho]]
2245 !! html/php
2246 <p>hi
2247 </p><p><br />
2248 <br />
2249 </p>
2250 !! html/parsoid
2251 <p>hi</p>
2252
2253 <p><br />
2254 <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
2255 </span></p>
2256
2257 <link rel="mw:PageProp/Category" href="./Category:Ho" />
2258 !! end
2259
2260 !! test
2261 Paragraph wrapping following unclosed table
2262 !! options
2263 parsoid=wt2html,html2html
2264 !! wikitext
2265 {|
2266 |-
2267
2268 {|
2269 | x
2270 |}
2271
2272 a
2273
2274 b
2275
2276 c
2277 !! html/php+tidy
2278 <table>
2279
2280
2281 </table><table>
2282 <tbody><tr>
2283 <td>x
2284 </td></tr></tbody></table>
2285 <p>a
2286 </p><p>b
2287 </p><p>c
2288 </p>
2289 !! html/parsoid
2290 <table data-parsoid='{"autoInsertedEnd":true}'>
2291 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr>
2292
2293 </tbody></table><table>
2294 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>x</td></tr>
2295 </tbody></table>
2296
2297 <p>a</p>
2298
2299 <p>b</p>
2300
2301 <p>c</p>
2302 !! end
2303
2304 !! test
2305 Paragraph wrapping suppressed in html p
2306 !! options
2307 parsoid=wt2html,html2html
2308 !! wikitext
2309 <p>
2310
2311
2312 hi
2313
2314
2315
2316 </p>
2317 !! html/php+tidy
2318 <p>
2319
2320
2321 hi
2322
2323
2324
2325 </p>
2326 !! html/parsoid
2327 <p data-parsoid='{"stx":"html"}'>
2328
2329
2330 hi
2331
2332
2333
2334 </p>
2335 !! end
2336
2337 !! test
2338 Dangling table row doesn't prevent p-wrapping
2339 !! options
2340 parsoid=wt2html,html2html
2341 !! wikitext
2342 {|
2343 | hi
2344 |-
2345 |} ho
2346 !! html/parsoid
2347 <table>
2348 <tbody><tr><td>hi</td></tr>
2349 <tr class="mw-empty-elt"></tr>
2350 </tbody></table><p> ho</p>
2351 !! end
2352
2353 !! test
2354 P-wrapping non-breaking spaces
2355 !! wikitext
2356  
2357 !! html/php+tidy
2358 <p>&#160;
2359 </p>
2360 !! html/parsoid
2361 <p> </p>
2362 !! end
2363
2364 ###
2365 ### Preformatted text
2366 ###
2367
2368 !! test
2369 Preformatted text
2370 !! wikitext
2371 This is some
2372 Preformatted text
2373 With ''italic''
2374 And '''bold'''
2375 And a [[Main Page|link]]
2376 !! html
2377 <pre>This is some
2378 Preformatted text
2379 With <i>italic</i>
2380 And <b>bold</b>
2381 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2382 </pre>
2383 !! end
2384
2385 !! test
2386 Tabs don't trigger preformatted text
2387 !! wikitext
2388 This is not
2389 preformatted text.
2390 This is preformatted text.
2391 So is this.
2392 !! html/php
2393 <p> This is not
2394 preformatted text.
2395 </p>
2396 <pre>This is preformatted text.
2397 So is this.
2398 </pre>
2399 !! html/parsoid
2400 <p> This is not
2401 preformatted text.</p>
2402 <pre>This is preformatted text.
2403 So is this.</pre>
2404 !! end
2405
2406 !! test
2407 Space before tab needs nowiki pre protection
2408 !! options
2409 parsoid=html2wt
2410 !! html/parsoid
2411 <p> a</p>
2412 !! wikitext
2413 <nowiki> </nowiki> a
2414 !! end
2415
2416 !! test
2417 Ident preformatting with inline content
2418 !! wikitext
2419 a
2420 ''b''
2421 !! html
2422 <pre>a
2423 <i>b</i>
2424 </pre>
2425 !! end
2426
2427 !! test
2428 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2429 !! wikitext
2430 <pre><nowiki>
2431 <b>
2432 <cite>
2433 <em>
2434 </nowiki></pre>
2435 !! html
2436 <pre>
2437 &lt;b&gt;
2438 &lt;cite&gt;
2439 &lt;em&gt;
2440 </pre>
2441 !! end
2442
2443 !! test
2444 Regression with preformatted in <center>
2445 !! wikitext
2446 <center>
2447 Blah
2448 </center>
2449 !! html
2450 <center>
2451 <pre>Blah
2452 </pre>
2453 </center>
2454 !! end
2455
2456 !! test
2457 T54763: Preformatted in <blockquote>
2458 !! wikitext
2459 <blockquote>
2460 Blah
2461 {|
2462 |
2463 indented cell (no pre-wrapping!)
2464 |}
2465 </blockquote>
2466 !! html
2467 <blockquote>
2468 <p> Blah
2469 </p>
2470 <table>
2471 <tr>
2472 <td>
2473 <p> indented cell (no pre-wrapping!)
2474 </p>
2475 </td></tr></table>
2476 </blockquote>
2477 !! end
2478
2479 !! test
2480 T53086: Double newlines in blockquotes should be turned into paragraphs
2481 !! wikitext
2482 <blockquote>
2483 Foo
2484
2485 Bar
2486 </blockquote>
2487 !! html
2488 <blockquote>
2489 <p>Foo
2490 </p><p>Bar
2491 </p>
2492 </blockquote>
2493 !! end
2494
2495 !! test
2496 T17491: <ins>/<del> in blockquote
2497 !! wikitext
2498 <blockquote>
2499 Foo <del>bar</del> <ins>baz</ins> quux
2500 </blockquote>
2501 !! html
2502 <blockquote>
2503 <p>Foo <del>bar</del> <ins>baz</ins> quux
2504 </p>
2505 </blockquote>
2506 !! html+tidy
2507 <blockquote>
2508 <p>Foo <del>bar</del> <ins>baz</ins> quux
2509 </p>
2510 </blockquote>
2511 !! end
2512
2513 !! test
2514 T17491: <ins>/<del> in blockquote (2)
2515 !! wikitext
2516 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2517 </blockquote>
2518 !! html
2519 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2520 </blockquote>
2521 !! html+tidy
2522 <blockquote><p>Foo <del>bar</del> <ins>baz</ins> quux
2523 </p></blockquote>
2524 !! end
2525
2526 !! test
2527 <pre> with attributes (T5202)
2528 !! wikitext
2529 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2530 !! html
2531 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2532 !! end
2533
2534 !! test
2535 <pre> with width attribute (T5202)
2536 !! wikitext
2537 <pre width="8">Narrow screen goodies</pre>
2538 !! html
2539 <pre width="8">Narrow screen goodies</pre>
2540 !! end
2541
2542 !! test
2543 <pre> with forbidden attribute (T5202)
2544 !! wikitext
2545 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2546 !! html
2547 <pre width="8">Narrow screen goodies</pre>
2548 !! end
2549
2550 !! test
2551 Entities inside <pre>
2552 !! wikitext
2553 <pre>&lt;</pre>
2554 !! html
2555 <pre>&lt;</pre>
2556 !! end
2557
2558 !! test
2559 <pre> with forbidden attribute values (T5202)
2560 !! wikitext
2561 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2562 !! html
2563 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2564 !! end
2565
2566 !! test
2567 <nowiki> inside <pre> (T15238)
2568 !! wikitext
2569 <pre>
2570 <nowiki>
2571 </pre>
2572 <pre>
2573 <nowiki></nowiki>
2574 </pre>
2575 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2576 !! html
2577 <pre>
2578 &lt;nowiki&gt;
2579 </pre>
2580 <pre>
2581
2582 </pre>
2583 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2584 !! end
2585
2586 !! test
2587 <nowiki> inside of #tag:pre
2588 !! wikitext
2589 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2590 !! html/php
2591 <pre>Foo &#8594;bar</pre>
2592 !! html/parsoid
2593 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2594 !! end
2595
2596 ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
2597 ## aren't enclosed in nowikis.
2598 !! test
2599 <nowiki> and <pre> preference (first one wins)
2600 !! options
2601 parsoid=wt2html
2602 !! wikitext
2603 <pre>
2604 <nowiki>
2605 </pre>
2606 </nowiki>
2607 </pre>
2608
2609 <nowiki>
2610 <pre>
2611 <nowiki>
2612 </pre>
2613 </nowiki>
2614 </pre>
2615
2616 !! html/php
2617 <pre>
2618 &lt;nowiki&gt;
2619 </pre>
2620 <p>&lt;/nowiki&gt;
2621 &lt;/pre&gt;
2622 </p><p>
2623 &lt;pre&gt;
2624 &lt;nowiki&gt;
2625 &lt;/pre&gt;
2626
2627 &lt;/pre&gt;
2628 </p>
2629 !! html/parsoid
2630 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
2631 </pre>
2632 <p>&lt;/nowiki></p>
2633
2634
2635 <p><span typeof="mw:Nowiki">
2636 &lt;pre>
2637 &lt;nowiki>
2638 &lt;/pre>
2639 </span></p>
2640 !! end
2641
2642 !! test
2643 </pre> inside nowiki
2644 !! wikitext
2645 <nowiki></pre></nowiki>
2646 !! html
2647 <p>&lt;/pre&gt;
2648 </p>
2649 !! end
2650
2651 !! test
2652 Empty pre; pre inside other HTML tags (T56946)
2653 !! wikitext
2654 a
2655
2656 <div><pre>
2657 foo
2658 </pre></div>
2659 <pre></pre>
2660 !! html/php+tidy
2661 <p>a
2662 </p>
2663 <div><pre>foo
2664 </pre></div>
2665 <pre></pre>
2666 !! html/parsoid
2667 <p>a</p>
2668
2669 <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
2670 </pre></div>
2671 <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
2672 !! end
2673
2674 !! test
2675 HTML pre followed by indent-pre
2676 !! wikitext
2677 <pre>foo</pre>
2678 bar
2679 !! html
2680 <pre>foo</pre>
2681 <pre>bar
2682 </pre>
2683 !! end
2684
2685 !! test
2686 Block tag pre
2687 !! wikitext
2688 <p><pre>foo</pre></p>
2689 !! html/php+tidy
2690 <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
2691 !! html/parsoid
2692 <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2693 !! end
2694
2695 !!test
2696 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2697 !! wikitext
2698 {{echo|}}
2699 !! html
2700 !! end
2701
2702 !!test
2703 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2704 !! wikitext
2705 {{echo|
2706 foo}}
2707 !! html
2708 <p>foo
2709 </p>
2710 !!end
2711
2712 !! test
2713 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2714 !! wikitext
2715 {{echo|a
2716 b}}
2717 !! html
2718 <pre>a
2719 </pre>
2720 <p>b
2721 </p>
2722 !!end
2723
2724 !! test
2725 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2726 !! wikitext
2727 {{echo|a
2728 b
2729 c
2730 d
2731 e
2732 }}
2733 !! html
2734 <pre>a
2735 </pre>
2736 <p>b
2737 c
2738 </p>
2739 <pre>d
2740 </pre>
2741 <p>e
2742 </p>
2743 !!end
2744
2745 !!test
2746 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2747 !! wikitext
2748 {{echo| foo}}
2749
2750 {{echo| foo}}{{echo| bar}}
2751
2752 {{echo| foo}}
2753 {{echo| bar}}
2754
2755 {{echo|<!--cmt--> foo}}
2756
2757 <!--cmt-->{{echo| foo}}
2758
2759 {{echo|{{echo| }}bar}}
2760 !! html
2761 <pre>foo
2762 </pre>
2763 <pre>foo bar
2764 </pre>
2765 <pre>foo
2766 bar
2767 </pre>
2768 <pre>foo
2769 </pre>
2770 <pre>foo
2771 </pre>
2772 <pre>bar
2773 </pre>
2774 !!end
2775
2776 !! test
2777 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2778 !! wikitext
2779 {{echo| }}a
2780
2781 {{echo|
2782 }}a
2783
2784 {{echo|
2785 b}}
2786
2787 {{echo|a
2788 }}b
2789
2790 {{echo|a
2791 }} b
2792 !! html
2793 <pre>a
2794 </pre>
2795 <p><br />
2796 </p>
2797 <pre>a
2798 </pre>
2799 <p><br />
2800 </p>
2801 <pre>b
2802 </pre>
2803 <p>a
2804 </p>
2805 <pre>b
2806 </pre>
2807 <p>a
2808 </p>
2809 <pre>b
2810 </pre>
2811 !!end
2812
2813 ## Hmm, should Parsoid rt this?
2814 !! test
2815 Pres with newline attributes
2816 !! options
2817 parsoid=wt2html,html2html
2818 !! wikitext
2819 <pre class="one
2820 two">hi</pre>
2821 !! html/php
2822 <pre class="one two">hi</pre>
2823 !! html/parsoid
2824 <pre class="one two" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
2825 !! end
2826
2827 !! test
2828 Things that look like <pre> tags aren't treated as such
2829 !! wikitext
2830 Barack Obama <President> of the United States
2831 <President></President>
2832 !! html
2833 <p>Barack Obama &lt;President&gt; of the United States
2834 &lt;President&gt;&lt;/President&gt;
2835 </p>
2836 !! end
2837
2838 ## Remex doesn't account for fostered content.
2839 ## The difference between Parsoid and the PHP parser can be attributed to core
2840 ## commit 674e8388cba and 710618f89af in Parsoid's repo. Parsoid doesn't
2841 ## tokenize unmatched extension tags that shadow html tags as strings to ease
2842 ## an escaping mechanism. See the comment in `maybeExtensionTag`.
2843 !! test
2844 Handle broken pre-like tags (T66025)
2845 !! options
2846 parsoid=wt2html
2847 !! wikitext
2848 {{echo|<pre <pre>x</pre>}}
2849
2850 <table><pre </table>
2851 !! html/php
2852 <pre>x</pre>
2853 <table>&lt;pre </table>
2854 !! html/php+tidy
2855 <pre>x</pre>
2856 &lt;pre <table></table>
2857 !! html/parsoid
2858 <pre typeof="mw:Extension/pre mw:Transclusion" about="#mwt2" data-parsoid='{"stx":"html","a":{"&lt;pre":null},"sa":{"&lt;pre":""},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2859
2860 <pre data-parsoid='{"stx":"html","src":"&lt;pre &lt;/table>","tagWidths":[13,0],"a":{"&lt;":null,"table":null},"sa":{"&lt;":"","table":""},"fostered":true,"autoInsertedEnd":true}'></pre><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'></table>
2861 !! end
2862
2863 ## Similar to the above, but shows the difference between extension and html tags
2864 !! test
2865 Less than in attribute position
2866 !! wikitext
2867 <pre <pre>123</pre>
2868
2869 <div <div>123</div>
2870 !! html/php+tidy
2871 <pre>123</pre><p>
2872 &lt;div </p><div>123</div>
2873 !! html/parsoid
2874 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"&lt;pre":""},"body":{"extsrc":"123"}}'>123</pre><p>
2875
2876 &lt;div </p><div>123</div>
2877 !! end
2878
2879 !! test
2880 Parsoid: handle pre with space after attribute
2881 !! options
2882 parsoid=wt2html
2883 !! wikitext
2884 <pre style="width:50%;" >{{echo|foo}}</pre>
2885 !! html/php
2886 <pre style="width:50%;">{{echo|foo}}</pre>
2887 !! html/parsoid
2888 <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
2889 !! end
2890
2891 !! test
2892 Self-closed pre
2893 !! wikitext
2894 <pre />
2895 !! html/php
2896 <pre></pre>
2897 !! html/parsoid
2898 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{}}'></pre>
2899 !! end
2900
2901 !! test
2902 Newline before table-close generates empty table row: T208619
2903 !! wikitext
2904 {|
2905
2906 |}
2907 !! html/php+tidy
2908 <table>
2909
2910 <tbody><tr><td></td></tr></tbody></table>
2911 !! html/parsoid
2912 <table data-parsoid='{}'>
2913
2914 </table>
2915 !! end
2916
2917 # PHP has one more row in the output than Parsoid does: T208619
2918 !! test
2919 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2920 !! options
2921 parsoid=wt2html
2922 !! wikitext
2923 {|
2924 <td>
2925 <td>
2926 </td>
2927
2928
2929
2930 |}
2931 !! html/php+tidy
2932 <table>
2933 <tbody><tr><td>
2934 </td><td>
2935 </td>
2936
2937
2938
2939 </tr><tr><td></td></tr></tbody></table>
2940 !! html/parsoid
2941 <table>
2942
2943 <tbody>
2944 <tr>
2945 <td></td>
2946
2947 <td>
2948 </td></tr>
2949
2950
2951
2952 </tbody></table>
2953 !! end
2954
2955
2956 #--------------------------------------------------------------------
2957 # Transclusion parameter whitespace stripping tests
2958 # Behavior is different for positional and named parameters
2959 #--------------------------------------------------------------------
2960 !! test
2961 Templates: Strip leading and trailing whitespace from named-param values
2962 !! wikitext
2963 {{echo|1= a }}
2964
2965 {{echo|1= {{echo|b}} }}
2966
2967 {{echo| 1 =
2968 c }}
2969
2970 {{echo| 1 =
2971 * d
2972 }}
2973 !! html
2974 <p>a
2975 </p><p>b
2976 </p><p>c
2977 </p>
2978 <ul><li>d</li></ul>
2979 !! end
2980
2981 !! test
2982 Templates: Don't strip whitespace from positional-param values
2983 !! wikitext
2984 {{echo|a }}
2985
2986 {{echo|{{echo|b}} }}
2987
2988 {{echo| c
2989 }}
2990
2991 {{echo| {{echo|d}}
2992 }}
2993
2994 {{echo|
2995 e}}
2996
2997 {{echo|
2998 *f}}
2999
3000 {{echo|
3001 }}g
3002 !! html
3003 <p>a
3004 </p><p>b
3005 </p>
3006 <pre>c
3007 </pre>
3008 <p><br />
3009 </p>
3010 <pre>d
3011 </pre>
3012 <p><br />
3013 </p>
3014 <pre>e
3015 </pre>
3016 <p><br />
3017 </p>
3018 <ul><li>f</li></ul>
3019 <p><br />
3020 </p>
3021 <pre>g
3022 </pre>
3023 !! end
3024
3025 !! test
3026 Templates: Don't recognize targets split by newlines
3027 !! options
3028 parsoid=wt2html
3029 !! wikitext
3030 {{ech
3031 o|foo}}
3032 !! html/php
3033 <p>{{ech
3034 o|foo}}
3035 </p>
3036 !! html/parsoid
3037 <p>{{ech
3038 o|foo}}</p>
3039 !! end
3040
3041 !! test
3042 Templates: Recognize targets when newlines and comments don't split the target
3043 !! options
3044 parsoid=wt2html
3045 !! wikitext
3046 {{
3047 <!--X--> ech<!--X-->o<!--X-->
3048 <!--X--> <!--X-->
3049
3050 |foo}}
3051 !! html/php
3052 <p>foo
3053 </p>
3054 !! html/parsoid
3055 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3056 !! end
3057
3058 !! test
3059 Templates: Handle empty comment-and-ws-only lines correctly
3060 !! wikitext
3061 {{echo|foo
3062 <!--should be ignored-->
3063 <!--should be ignored as well-->
3064 bar}}
3065 !! html/php
3066 <p>foo
3067 bar
3068 </p>
3069 !! html/parsoid
3070 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
3071 !! end
3072
3073 !! test
3074 Templates: Handle comments in the target
3075 !! wikitext
3076 {{echo
3077 <!-- should be ignored -->
3078 |foo}}
3079
3080 {{echo
3081 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
3082 |foo}}
3083
3084 {{echo<!-- should be ignored -->
3085 |foo}}
3086
3087 {{echo<!-- should be ignored -->|foo}}
3088
3089 {{<!-- should be ignored -->echo|foo}}
3090 !! html/php
3091 <p>foo
3092 </p><p>foo
3093 </p><p>foo
3094 </p><p>foo
3095 </p><p>foo
3096 </p>
3097 !! html/parsoid
3098 <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>
3099
3100 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3101
3102 <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>
3103
3104 <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>
3105
3106 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
3107 !! end
3108
3109 !! test
3110 Templates: Handle comments in parameter names (T69657)
3111 !! wikitext
3112 {{echo|1
3113 <!-- should be ignored -->
3114 =foo}}
3115
3116 {{echo|
3117 <!-- should be ignored -->
3118 1 = foo}}
3119
3120 {{echo|1<!-- should be ignored -->=foo}}
3121
3122 {{echo|<!-- should be ignored -->1=foo}}
3123 !! html/php
3124 <p>foo
3125 </p><p>foo
3126 </p><p>foo
3127 </p><p>foo
3128 </p>
3129 !! html/parsoid
3130 <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>
3131
3132 <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>
3133
3134 <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>
3135
3136 <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>
3137 !! end
3138
3139 !! test
3140 Templates: Other wikitext in parameter names (T69657)
3141 !! wikitext
3142 {{echo|''1''=foo}}
3143 !! html/php
3144 <p>{{{1}}}
3145 </p>
3146 !! html/parsoid
3147 <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>
3148 !! end
3149
3150 !! test
3151 Templates: With colons
3152 !! wikitext
3153 {{With: Colon}}
3154 !! html/php
3155 <p>Template with colon
3156 </p>
3157 !! html/parsoid
3158 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
3159 !! end
3160
3161 #--------------------------------------------------------------------
3162 # Transclusion parameter escaping tests
3163 #--------------------------------------------------------------------
3164
3165 !! test
3166 Templates: Parsoid parameter escaping test 1
3167 !! wikitext
3168 {{echo|[foo]|{{echo|[bar]}}}}
3169 !! html/php+tidy
3170 <p>[foo]
3171 </p>
3172 !! html/parsoid
3173 <p about="#mwt1" typeof="mw:Transclusion"
3174 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
3175 !! end
3176
3177 !! test
3178 Parsoid: Pipes in external links in template parameter
3179 !! wikitext
3180 {{echo|[{{echo|http://example.com}} link]}}
3181 !! html/php+tidy
3182 <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
3183 </p>
3184 !! html/parsoid
3185 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" class="external text" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
3186 !! end
3187
3188 !! test
3189 Parsoid: pipe in transclusion parameter
3190 !! wikitext
3191 {{echo|http://foo.com/a&#124;b}}
3192 !! html/php+tidy
3193 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
3194 </p>
3195 !! html/parsoid
3196 <p><a rel="mw:ExtLink" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" class="external free" 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%7Cb</a></p>
3197 !! end
3198
3199 !! test
3200 Parsoid: Pipe in external link target and content in template parameter
3201 !! options
3202 parsoid=html2wt,wt2wt
3203 !! wikitext
3204 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
3205 !! html/php+tidy
3206 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
3207 </p>
3208 !! html/parsoid
3209 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
3210 typeof="mw:Transclusion"
3211 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
3212 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
3213 !! end
3214
3215 !! test
3216 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
3217 !! wikitext
3218 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
3219 !! html/php+tidy
3220 <p><a rel="nofollow" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit">bar</a>
3221 </p>
3222 !! html/parsoid
3223 <p><a rel="mw:ExtLink" href="http://example.org/index.php?title=Parser_test&amp;action=edit" typeof="mw:Transclusion" class="external text" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>bar</a></p>
3224 !! end
3225
3226 !! test
3227 Templates: Don't escape already nowiki-escaped text in template parameters
3228 !! options
3229 parsoid=html2wt,wt2wt
3230 !! wikitext
3231 {{echo|foo<nowiki>|</nowiki>bar}}
3232 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
3233 {{echo|<nowiki></nowiki>}}
3234 !! html/php+tidy
3235 <p>foo|bar
3236 &lt;div&gt;
3237
3238 </p>
3239 !! html/parsoid
3240 <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>
3241 <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>
3242 <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>
3243 </p>
3244 !! end
3245
3246 ## T54824
3247 !! test
3248 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
3249 !! options
3250 parsoid=html2wt,wt2wt
3251 !! wikitext
3252 {{echo|{{echo|1=bar}}}}
3253 !! html/php+tidy
3254 <p>bar
3255 </p>
3256 !! html/parsoid
3257 <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>
3258 !! end
3259
3260 ## T58733
3261 !! test
3262 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
3263 !! wikitext
3264 {{echo|a : b}}
3265 !! html/php+tidy
3266 <p>a&#160;: b
3267 </p>
3268 !! html/parsoid
3269 <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>
3270 !! end
3271
3272 ## T73412
3273 !! test
3274 Templates: Preserve blank parameter names
3275 !! wikitext
3276 {{echo|=foo}}
3277 !! html/php+tidy
3278 <p>{{{1}}}
3279 </p>
3280 !! html/parsoid
3281 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
3282 !! end
3283
3284 !! test
3285 Templates: Preserve blank parameter names in other positions
3286 !! wikitext
3287 {{blank_param|bar|=foo}}
3288 !! html/php+tidy
3289 <p>bar
3290 foo
3291 </p>
3292 !! html/parsoid
3293 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
3294 foo</p>
3295 !! end
3296
3297 ###
3298 ### Parsoid-centric tests for testing RT edge cases for pre
3299 ###
3300
3301 !!test
3302 1a. Indent-Pre and Comments
3303 !! wikitext
3304 a
3305 <!--a-->
3306 c
3307 !! html
3308 <pre>a
3309 </pre>
3310 <p>c
3311 </p>
3312 !!end
3313
3314 !!test
3315 1b. Indent-Pre and Comments
3316 !! wikitext
3317 a
3318 <!--a-->
3319 c
3320 !! html
3321 <pre>a
3322 </pre>
3323 <p>c
3324 </p>
3325 !!end
3326
3327 !!test
3328 1c. Indent-Pre and Comments
3329 !! wikitext
3330 <!--a--> a
3331
3332 <!--a--> a
3333 !! html
3334 <pre> a
3335 </pre>
3336 <pre> a
3337 </pre>
3338 !!end
3339
3340 !!test
3341 1d. Indent-Pre and Comments
3342 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3343 !! wikitext
3344 <!--a--> a
3345
3346 <!--b-->b
3347 !! html
3348 <pre>a
3349 </pre>
3350 <pre>b
3351 </pre>
3352 !!end
3353
3354 !!test
3355 2a. Indent-Pre and tables
3356 !! wikitext
3357 {|
3358 |-
3359 !h1!!h2
3360 |foo||bar
3361 |}
3362 !! html
3363 <table>
3364
3365 <tr>
3366 <th>h1</th>
3367 <th>h2
3368 </th>
3369 <td>foo</td>
3370 <td>bar
3371 </td></tr></table>
3372 !!end
3373
3374 !!test
3375 2b. Indent-Pre and tables
3376 !! wikitext
3377 {|
3378 |-
3379 |foo
3380 |}
3381 !! html
3382 <table>
3383
3384 <tr>
3385 <td>foo
3386 </td></tr></table>
3387 !!end
3388
3389 !!test
3390 2c. Indent-Pre and tables (T44252)
3391 !! wikitext
3392 {|
3393 |+foo
3394 ! |bar
3395 |}
3396 !! html
3397 <table>
3398 <caption>foo
3399 </caption>
3400 <tr>
3401 <th>bar
3402 </th></tr></table>
3403 !!end
3404
3405 !!test
3406 2d. Indent-Pre and tables
3407 !! wikitext
3408 a
3409 {|
3410 |b
3411 |}
3412 !! html/php
3413 <pre>a
3414 </pre>
3415 <table>
3416 <tr>
3417 <td>b
3418 </td></tr></table>
3419 !! html/parsoid
3420 <pre>a</pre>
3421 <table>
3422 <tbody><tr><td> b</td></tr>
3423 </tbody></table>
3424 !!end
3425
3426 !!test
3427 2e. Indent-Pre and table-line syntax
3428 !! wikitext
3429 a
3430 | b
3431 | c
3432 !! html/php
3433 <pre>a
3434 | b
3435 | c
3436 </pre>
3437 !!end
3438
3439 !!test
3440 2f. Indent-pre started by table-line syntax
3441 !! wikitext
3442 a
3443 | b
3444 | c
3445 !! html/php
3446 <p>a
3447 </p>
3448 <pre>| b
3449 | c
3450 </pre>
3451 !! html/parsoid
3452 <p>a</p>
3453 <pre>
3454 | b
3455 | c</pre>
3456 !!end
3457
3458 !! test
3459 2g. Indented table markup mixed with indented pre content (proposed in T8200)
3460 !! wikitext
3461 <table>
3462 <tr>
3463 <td>
3464 Text that should be rendered preformatted
3465 </td>
3466 </tr>
3467 </table>
3468 !! html
3469 <table>
3470 <tr>
3471 <td>
3472 <pre>Text that should be rendered preformatted
3473 </pre>
3474 </td>
3475 </tr>
3476 </table>
3477 !! end
3478
3479 !! test
3480 2h. Indent pre in tables
3481 !! options
3482 parsoid=wt2html,html2html
3483 !! wikitext
3484 {|
3485 !
3486 foo
3487 !
3488 bar
3489 |-
3490 |
3491 baz
3492 {{!}}
3493 bam
3494 |}
3495 !! html/php
3496 <table>
3497 <tr>
3498 <th>
3499 <pre>foo
3500 </pre>
3501 </th>
3502 <th>
3503 <pre>bar
3504 </pre>
3505 </th></tr>
3506 <tr>
3507 <td>
3508 <pre>baz
3509 </pre>
3510 </td>
3511 <td>
3512 <pre>bam
3513 </pre>
3514 </td></tr></table>
3515 !! html/parsoid
3516 <table>
3517 <tbody><tr><th>
3518 <pre>foo</pre>
3519 </th><th>
3520 <pre>bar</pre>
3521 </th></tr><tr>
3522 <td>
3523 <pre>baz</pre>
3524 </td><td data-parsoid='{"startTagSrc":"{{!}}"}'>
3525 <pre>bam</pre>
3526 </td></tr></tbody></table>
3527 !! end
3528
3529 !! test
3530 3a. Indent-Pre and block tags (single-line html)
3531 !! wikitext
3532 a <p> foo </p>
3533 b <div> foo </div>
3534 c <blockquote> foo </blockquote>
3535 <span> foo </span>
3536 !! html
3537 a <p> foo </p>
3538 b <div> foo </div>
3539 c <blockquote> foo </blockquote>
3540 <pre><span> foo </span>
3541 </pre>
3542 !! html/php+tidy
3543 <p> a </p><p> foo </p><p>
3544 b </p><div> foo </div><p>
3545 c </p><blockquote><p> foo </p></blockquote>
3546 <pre><span> foo </span>
3547 </pre>
3548 !! html/parsoid
3549 <p> a </p><p data-parsoid='{"stx":"html"}'> foo </p><p>
3550 b </p><div data-parsoid='{"stx":"html"}'> foo </div><p>
3551 c </p><blockquote data-parsoid='{"stx":"html"}'><p> foo </p></blockquote>
3552 <pre><span data-parsoid='{"stx":"html"}'> foo </span></pre>
3553 !! end
3554
3555 !! test
3556 3b. Indent-Pre and block tags (multi-line html)
3557 !! wikitext
3558 a <span>foo</span>
3559 <!-- comment --> b <div> foo </div>
3560 !! html/php
3561 <pre>a <span>foo</span>
3562 </pre>
3563 b <div> foo </div>
3564 !! html/parsoid
3565 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3566 <!-- comment --> <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3567 !! html/php+tidy
3568 <pre>a <span>foo</span>
3569 </pre><p>
3570 b </p><div> foo </div>
3571 !! end
3572
3573 !! test
3574 3c. Indent-Pre and block tags (pre-content on separate line)
3575 !! wikitext
3576 <p>
3577 foo
3578 </p>
3579
3580 <div>
3581 foo
3582 </div>
3583
3584 <center>
3585 foo
3586 </center>
3587
3588 <blockquote>
3589 foo
3590 </blockquote>
3591
3592 <blockquote>
3593 <pre>
3594 foo
3595 </pre>
3596 </blockquote>
3597
3598 <table><tr><td>
3599 foo
3600 </td></tr></table>
3601
3602 <ul><li>
3603 foo
3604 </li></ul>
3605
3606 !! html/php
3607 <p>
3608 foo
3609 </p>
3610 <div>
3611 <pre>foo
3612 </pre>
3613 </div>
3614 <center>
3615 <pre>foo
3616 </pre>
3617 </center>
3618 <blockquote>
3619 <p> foo
3620 </p>
3621 </blockquote>
3622 <blockquote>
3623 <pre>
3624 foo
3625 </pre>
3626 </blockquote>
3627 <table><tr><td>
3628 <pre>foo
3629 </pre>
3630 </td></tr></table>
3631 <ul><li>
3632 foo
3633 </li></ul>
3634
3635 !! html/parsoid
3636 <p data-parsoid='{"stx":"html"}'>
3637 foo
3638 </p>
3639
3640 <div>
3641 <pre>foo</pre>
3642 </div>
3643
3644 <center>
3645 <pre>foo</pre>
3646 </center>
3647
3648 <blockquote>
3649 <p> foo</p>
3650 </blockquote>
3651
3652 <blockquote>
3653 <pre typeof="mw:Extension/pre" about="#mwt3" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3654 </pre>
3655 </blockquote>
3656
3657 <table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>
3658 <pre>foo</pre>
3659 </td></tr></tbody></table>
3660
3661 <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>
3662 foo
3663 </li></ul>
3664 !! end
3665
3666 !! test
3667 4. Indent-Pre and extension tags
3668 !! options
3669 parsoid=wt2html,html2html
3670 !! wikitext
3671 a <tag />
3672 !! html/php+tidy
3673 <p> a </p><pre>NULL
3674 array (
3675 )
3676 </pre>
3677 !! html/parsoid
3678 <p> a </p><pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{}}'></pre>
3679 !! end
3680
3681 !! test
3682 5. Indent-Pre and html pre
3683 !! wikitext
3684 <pre class="123">hi</pre>
3685 !! html/php
3686 <pre class="123">hi</pre>
3687 !! html/parsoid
3688 <pre class="123" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
3689 !! end
3690
3691 !!test
3692 Render paragraphs when indent-pre is suppressed in blocklevels
3693 !! wikitext
3694 <blockquote>
3695 foo
3696
3697 bar
3698 </blockquote>
3699 !! html
3700 <blockquote>
3701 <p> foo
3702 </p><p> bar
3703 </p>
3704 </blockquote>
3705 !!end
3706
3707 !!test
3708 4. Multiple spaces at start-of-line
3709 !! wikitext
3710 <p> foo </p>
3711 foo
3712 {|
3713 |foo
3714 |}
3715 !! html
3716 <p> foo </p>
3717 <pre> foo
3718 </pre>
3719 <table>
3720 <tr>
3721 <td>foo
3722 </td></tr></table>
3723 !!end
3724
3725 ## NOTE: the leading white-space chars on empty line are significant
3726 !! test
3727 5a. White-space in indent-pre
3728 !! wikitext
3729 a<br />
3730
3731 b
3732 !! html
3733 <pre>a<br />
3734
3735 b
3736 </pre>
3737 !! end
3738
3739 ## NOTE: the leading white-space chars on empty line are significant
3740 !! test
3741 5b. White-space in indent-pre
3742 !! wikitext
3743 a
3744
3745 b
3746
3747
3748 c
3749 !! html
3750 <pre>a
3751
3752 b
3753
3754
3755 c
3756 </pre>
3757 !! end
3758
3759 !! test
3760 5c. White-space in indent-pre
3761 !! wikitext
3762 ''a''
3763 ''b''
3764 ''c''
3765 !! html
3766 <pre><i>a</i>
3767 <i>b</i>
3768 <i>c</i>
3769 </pre>
3770 !! end
3771
3772 !! test
3773 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3774 !! wikitext
3775 a
3776
3777 <!-- continue -->
3778 b
3779
3780 c
3781
3782 d
3783 !! html
3784 <pre>a
3785
3786 b
3787 </pre>
3788 <pre>c
3789
3790 </pre>
3791 <p>d
3792 </p>
3793 !! end
3794
3795 !! test
3796 7a. Indent-pre and category links
3797 !! options
3798 parsoid=wt2html,wt2wt
3799 !! wikitext
3800 [[Category:foo]] <!-- No pre-wrapping -->
3801 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3802 !! html/php+tidy
3803 !! html/parsoid
3804 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3805 <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 -->
3806 !! end
3807
3808 ## We used to, but no longer wt2wt this test since the default serializer
3809 ## will normalize all categories to serialize on their own line.
3810 ## This wikitext usage is going to be fairly uncommon in production and
3811 ## selser will take care of preserving formatting in those scenarios.
3812 !! test
3813 7b. Indent-pre and category links
3814 !! options
3815 parsoid=wt2html
3816 !! wikitext
3817 [[Category:foo]] a
3818 [[Category:foo]] {{echo|b}}
3819 !! html/parsoid
3820 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3821 <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>
3822 !! end
3823
3824 !! test
3825 Indent-Pre: Newlines in comments shouldn't affect sol state
3826 !! wikitext
3827 a <!--
3828 foo
3829 --> b
3830 !! html/php+tidy
3831 <p>a b
3832 </p>
3833 !! html/parsoid
3834 <p>a <!--
3835 foo
3836 --> b</p>
3837 !! end
3838
3839 ###
3840 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3841 ###
3842
3843 !!test
3844 HTML-pre: 1. embedded newlines
3845 !! wikitext
3846 <pre>foo</pre>
3847
3848 <pre>
3849 foo
3850 </pre>
3851
3852 <pre>
3853
3854 foo
3855 </pre>
3856
3857 <pre>
3858
3859
3860 foo
3861 </pre>
3862 !! html/php+tidy
3863 <pre>foo</pre>
3864 <pre>foo
3865 </pre>
3866 <pre>
3867
3868 foo
3869 </pre>
3870 <pre>
3871
3872
3873 foo
3874 </pre>
3875 !! html/parsoid
3876 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
3877
3878 <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
3879 </pre>
3880
3881 <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
3882
3883 foo
3884 </pre>
3885
3886 <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
3887
3888
3889 foo
3890 </pre>
3891 !!end
3892
3893 !! test
3894 HTML-pre: big spaces
3895 !! wikitext
3896 <pre>
3897
3898
3899
3900
3901 haha
3902
3903
3904
3905
3906 haha
3907
3908
3909
3910
3911 </pre>
3912 !! html/php+tidy
3913 <pre>
3914
3915
3916
3917
3918 haha
3919
3920
3921
3922
3923 haha
3924
3925
3926
3927
3928 </pre>
3929 !! html/parsoid
3930 <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
3931
3932
3933
3934
3935 haha
3936
3937
3938
3939
3940 haha
3941
3942
3943
3944
3945 </pre>
3946 !! end
3947
3948 !!test
3949 HTML-pre: 2: indented text
3950 !! wikitext
3951 <pre>
3952 foo
3953 </pre>
3954 !! html
3955 <pre>
3956 foo
3957 </pre>
3958 !!end
3959
3960 !!test
3961 HTML-pre: 3: other wikitext
3962 !! wikitext
3963 <pre>
3964 * foo
3965 # bar
3966 = no-h =
3967 '' no-italic ''
3968 [[ NoLink ]]
3969 </pre>
3970 !! html/php
3971 <pre>
3972 * foo
3973 # bar
3974 = no-h =
3975 '' no-italic ''
3976 [[ NoLink ]]
3977 </pre>
3978 !! html/parsoid
3979 <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
3980 # bar
3981 = no-h =
3982 '' no-italic ''
3983 [[ NoLink ]]
3984 </pre>
3985 !!end
3986
3987 ###
3988 ### Definition lists
3989 ###
3990 !! test
3991 Simple definition
3992 !! wikitext
3993 ;name :Definition
3994 !! html
3995 <dl><dt>name</dt>
3996 <dd>Definition</dd></dl>
3997 !! end
3998
3999 !! test
4000 Definition list for indentation only
4001 !! wikitext
4002 :Indented text
4003 !! html
4004 <dl><dd>Indented text</dd></dl>
4005 !! end
4006
4007 !! test
4008 Definition list with no space
4009 !! wikitext
4010 ;name:Definition
4011 !! html
4012 <dl><dt>name</dt>
4013 <dd>Definition</dd></dl>
4014 !!end
4015
4016 !! test
4017 Definition list with URL link
4018 !! wikitext
4019 ;http://example.com/ :definition
4020 !! html
4021 <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a></dt>
4022 <dd>definition</dd></dl>
4023 !! end
4024
4025 !! test
4026 Definition list with bracketed URL link
4027 !! wikitext
4028 ;[http://www.example.com/ Example]:Something about it
4029 !! html
4030 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
4031 <dd>Something about it</dd></dl>
4032 !! end
4033
4034 !! test
4035 Definition list with wikilink containing colon
4036 !! wikitext
4037 ;[[Help:FAQ]]:The least-read page on Wikipedia
4038 !! html
4039 <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>
4040 <dd>The least-read page on Wikipedia</dd></dl>
4041 !! end
4042
4043 # At Brion's and JeLuF's insistence... :)
4044 !! test
4045 Definition list with news link containing colon
4046 !! wikitext
4047 ;news:alt.wikipedia.rox :This isn't even a real newsgroup!
4048 !! html/php
4049 <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
4050 <dd>This isn't even a real newsgroup!</dd></dl>
4051 !! html/parsoid
4052 <dl><dt><a rel="mw:ExtLink" href="news:alt.wikipedia.rox" class="external free" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
4053 !! end
4054
4055 !! test
4056 Malformed definition list with colon
4057 !! wikitext
4058 ;news:alt.wikipedia.rox -- don't crash or enter an infinite loop
4059 !! html
4060 <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>
4061 !! end
4062
4063 !! test
4064 Definition lists: colon in external link text
4065 !! wikitext
4066 ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
4067 !! html
4068 <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a></dt>
4069 <dd>OK, I made that up</dd></dl>
4070 !! end
4071
4072 !! test
4073 Definition lists: colon in HTML attribute
4074 !! wikitext
4075 ;<b style="display: inline">bold</b>
4076 !! html
4077 <dl><dt><b style="display: inline">bold</b></dt></dl>
4078 !! end
4079
4080 !! test
4081 Definition lists: self-closed tag
4082 !! wikitext
4083 ;one<br/>two :two-line fun
4084 !! html
4085 <dl><dt>one<br />two</dt>
4086 <dd>two-line fun</dd></dl>
4087 !! end
4088
4089 !! test
4090 Definition lists: ignore colons inside tags
4091 !! wikitext
4092 ;one <b>two : tag <i>fun:</i>:</b>:def
4093 !! html
4094 <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
4095 <dd>def</dd></dl>
4096 !! end
4097
4098 !! test
4099 Definition lists: excess closed tags
4100 !! wikitext
4101 ;one</b>two :bad tag fun
4102 !! html/php+tidy
4103 <dl><dt>onetwo</dt>
4104 <dd>bad tag fun</dd></dl>
4105 !! html/parsoid
4106 <dl>
4107 <dt>onetwo</dt>
4108 <dd>bad tag fun</dd>
4109 </dl>
4110 !! end
4111
4112 !! test
4113 T13748: Literal closing tags
4114 !! wikitext
4115 <dl>
4116 <dt>test 1</dt>
4117 <dd>test test test test test</dd>
4118 <dt>test 2</dt>
4119 <dd>test test test test test</dd>
4120 </dl>
4121 !! html
4122 <dl>
4123 <dt>test 1</dt>
4124 <dd>test test test test test</dd>
4125 <dt>test 2</dt>
4126 <dd>test test test test test</dd>
4127 </dl>
4128 !! end
4129
4130 !! test
4131 Definition and unordered list using wiki syntax nested in unordered list using html tags.
4132 !! wikitext
4133 <ul><li>
4134 ;term :description
4135 *unordered
4136 </li></ul>
4137 !! html
4138 <ul><li>
4139 <dl><dt>term</dt>
4140 <dd>description</dd></dl>
4141 <ul><li>unordered</li></ul>
4142 </li></ul>
4143 !! end
4144
4145 !! test
4146 Definition list with empty definition and following paragraph
4147 !! wikitext
4148 ;term:
4149
4150 Paragraph text
4151 !! html
4152 <dl><dt>term</dt>
4153 <dd></dd></dl>
4154 <p>Paragraph text
4155 </p>
4156 !! end
4157
4158 !! test
4159 Nested definition lists using html syntax
4160 !! wikitext
4161 <dl><dt>x</dt>
4162 <dd>a</dd>
4163 <dd>b</dd></dl>
4164 !! html
4165 <dl><dt>x</dt>
4166 <dd>a</dd>
4167 <dd>b</dd></dl>
4168 !! end
4169
4170 !! test
4171 Definition Lists: No nesting: Multiple dd's
4172 !! wikitext
4173 ;x
4174 :a
4175 :b
4176 !! html
4177 <dl><dt>x</dt>
4178 <dd>a</dd>
4179 <dd>b</dd></dl>
4180 !! end
4181
4182 !! test
4183 Definition Lists: Indentation: Regular
4184 !! wikitext
4185 :i1
4186 ::i2
4187 :::i3
4188 !! html
4189 <dl><dd>i1
4190 <dl><dd>i2
4191 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4192 !! end
4193
4194 !! test
4195 Definition Lists: Indentation: Missing 1st level
4196 !! wikitext
4197 ::i2
4198 :::i3
4199 !! html
4200 <dl><dd><dl><dd>i2
4201 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
4202 !! end
4203
4204 !! test
4205 Definition Lists: Indentation: Multi-level indent
4206 !! wikitext
4207 :::i3
4208 !! html
4209 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
4210 !! end
4211
4212 !! test
4213 Definition Lists: Hacky use to indent tables
4214 !! wikitext
4215 ::{|
4216 |foo
4217 |bar
4218 |}
4219 this text
4220 should be left alone
4221 !! html
4222 <dl><dd><dl><dd><table>
4223 <tr>
4224 <td>foo
4225 </td>
4226 <td>bar
4227 </td></tr></table></dd></dl></dd></dl>
4228 <p>this text
4229 should be left alone
4230 </p>
4231 !! end
4232
4233 !! test
4234 Definition Lists: Hacky use to indent tables (with content following table)
4235 !! wikitext
4236 :{|
4237 |foo
4238 |bar
4239 |} <!--c1--> this text should be part of the dl
4240 !! html/php+tidy
4241 <dl><dd><table>
4242 <tbody><tr>
4243 <td>foo
4244 </td>
4245 <td>bar
4246 </td></tr></tbody></table> this text should be part of the dl</dd></dl>
4247 !! html/parsoid
4248 <dl><dd><table>
4249 <tbody><tr>
4250 <td>foo
4251 </td>
4252 <td>bar
4253 </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
4254 !! end
4255
4256 !! test
4257 Definition Lists: Hacky use to indent tables, with comments (T65979)
4258 !! wikitext
4259 <!-- foo -->
4260 ::{|
4261 |foo
4262 |bar
4263 |}<!-- bar -->
4264 this text
4265 should be left alone
4266 !! html/parsoid
4267 <!-- foo -->
4268 <dl><dd><dl><dd><table><tr>
4269 <td>foo</td>
4270 <td>bar</td>
4271 </tr></table><!-- bar --></dd></dl></dd></dl>
4272 <p>this text
4273 should be left alone</p>
4274 !! end
4275
4276 !! test
4277 Definition Lists: Hacky use to indent tables, with comment before table
4278 !!options
4279 parsoid=wt2html
4280 !! wikitext
4281 ::<!-- foo -->{|
4282 |foo
4283 |}
4284 !! html/parsoid
4285 <dl><dd><dl><dd><!-- foo --><table><tr>
4286 <td>foo</td>
4287 </tr></table></dd></dl></dd></dl>
4288 !! end
4289
4290 # The trailing whitespace in this test is to catch a regression in
4291 # Parsoid after T54473.
4292 !! test
4293 Definition Lists: Hacky use to indent tables (WS-insensitive)
4294 !! wikitext
4295 :{|
4296 |a
4297 |}
4298 !! html/php
4299 <dl><dd><table>
4300 <tr>
4301 <td>a
4302 </td></tr></table></dd></dl>
4303 !! html/parsoid
4304 <dl><dd><table>
4305 <tbody><tr><td>a</td></tr>
4306 </tbody></table></dd></dl>
4307 !! end
4308
4309 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
4310 ## as an empty dt item. It also ignores all but the last ";" when followed
4311 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
4312 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
4313 ## ";"s.
4314 ##
4315 ## Ex: ";;t2 ::d2" is transformed into:
4316 ##
4317 ## <dl>
4318 ## <dt>t2 </dt>
4319 ## <dd>
4320 ## <dl>
4321 ## <dt></dt>
4322 ## <dd>d2</dd>
4323 ## </dl>
4324 ## </dd>
4325 ## </dl>
4326 ##
4327 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
4328 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
4329 ##
4330 ## <dl>
4331 ## <dt>
4332 ## <dl>
4333 ## <dt>t2 </dt>
4334 ## <dd>:d2</dd>
4335 ## </dl>
4336 ## </dt>
4337 ## </dl>
4338 ##
4339 ## All Parsoid only definition list tests have this difference.
4340 ##
4341 ## See also: https://phabricator.wikimedia.org/T8569
4342 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
4343
4344 !! test
4345 Table / list interaction: indented table with lists in table contents
4346 !! wikitext
4347 :{|
4348 |-
4349 |a
4350
4351 *b
4352 |-
4353 |c
4354
4355 *d
4356 |}
4357 !! html
4358 <dl><dd><table>
4359
4360 <tr>
4361 <td>a
4362 <ul><li>b</li></ul>
4363 </td></tr>
4364 <tr>
4365 <td>c
4366 <ul><li>d</li></ul>
4367 </td></tr></table></dd></dl>
4368 !! end
4369
4370 !!test
4371 Table / list interaction: lists nested in tables nested in indented lists
4372 !! wikitext
4373 :{|
4374 |
4375 :a
4376 :b
4377 |
4378 *c
4379 *d
4380 |}
4381
4382 *e
4383 *f
4384 !! html
4385 <dl><dd><table>
4386 <tr>
4387 <td>
4388 <dl><dd>a</dd>
4389 <dd>b</dd></dl>
4390 </td>
4391 <td>
4392 <ul><li>c</li>
4393 <li>d</li></ul>
4394 </td></tr></table></dd></dl>
4395 <ul><li>e</li>
4396 <li>f</li></ul>
4397 !!end
4398
4399 !! test
4400 Definition Lists: Nesting: Multi-level (Parsoid only)
4401 !! wikitext
4402 ;t1 :d1
4403 ;;t2 ::d2
4404 ;;;t3 :::d3
4405 !! html/parsoid
4406 <dl>
4407 <dt>t1 </dt>
4408 <dd>d1</dd>
4409 <dt>
4410 <dl>
4411 <dt>t2 </dt>
4412 <dd>:d2</dd>
4413 <dt>
4414 <dl>
4415 <dt>t3 </dt>
4416 <dd>::d3</dd>
4417 </dl>
4418 </dt>
4419 </dl>
4420 </dt>
4421 </dl>
4422 !! end
4423
4424
4425 !! test
4426 Definition Lists: Nesting: Test 2
4427 !! wikitext
4428 ;t1
4429 ::d2
4430 !! html+tidy
4431 <dl><dt>t1</dt>
4432 <dd>
4433 <dl><dd>d2</dd></dl></dd></dl>
4434 !! end
4435
4436
4437 !! test
4438 Definition Lists: Nesting: Test 3
4439 !! wikitext
4440 :;t1
4441 ::::d2
4442 !! html+tidy
4443 <dl><dd><dl><dt>t1</dt>
4444 <dd>
4445 <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
4446 !! end
4447
4448
4449 !! test
4450 Definition Lists: Nesting: Test 4
4451 !! wikitext
4452 ::;t3
4453 :::d3
4454 !! html
4455 <dl><dd><dl><dd><dl><dt>t3</dt>
4456 <dd>d3</dd></dl></dd></dl></dd></dl>
4457 !! end
4458
4459
4460 ## The Parsoid team believes the following three test exposes a
4461 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4462 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4463 ## It also exposes a "misfeature" in tidy, which doesn't like
4464 ## <dl> tags with a single <dt> child; it converts the <dt> into
4465 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4466 !! test
4467 Definition Lists: Mixed Lists: Test 1
4468 !! wikitext
4469 :;*foo
4470 ::*bar
4471 :;baz
4472 !! html/php
4473 <dl><dd><dl><dt><ul><li>foo</li>
4474 <li>bar</li></ul></dt></dl>
4475 <dl><dt>baz</dt></dl></dd></dl>
4476 !! html/php+tidy
4477 <dl><dd><dl><dt><ul><li>foo</li>
4478 <li>bar</li></ul></dt></dl>
4479 <dl><dt>baz</dt></dl></dd></dl>
4480 !! html/parsoid
4481 <dl>
4482 <dd><dl>
4483 <dt><ul>
4484 <li>foo
4485 </li>
4486 </ul></dt>
4487 <dd><ul>
4488 <li>bar
4489 </li>
4490 </ul></dd>
4491 <dt>baz</dt>
4492 </dl></dd>
4493 </dl>
4494 !! end
4495
4496 !! test
4497 Definition Lists: Mixed Lists: Test 2
4498 !! wikitext
4499 *:d1
4500 *:d2
4501 !! html
4502 <ul><li><dl><dd>d1</dd>
4503 <dd>d2</dd></dl></li></ul>
4504 !! end
4505
4506
4507 !! test
4508 Definition Lists: Mixed Lists: Test 3
4509 !! wikitext
4510 *:::d1
4511 *:::d2
4512 !! html
4513 <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
4514 <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
4515 !! end
4516
4517
4518 !! test
4519 Definition Lists: Mixed Lists: Test 4
4520 !! wikitext
4521 *;d1 :d2
4522 *;d3 :d4
4523 !! html
4524 <ul><li><dl><dt>d1</dt>
4525 <dd>d2</dd>
4526 <dt>d3</dt>
4527 <dd>d4</dd></dl></li></ul>
4528 !! end
4529
4530
4531 !! test
4532 Definition Lists: Mixed Lists: Test 5
4533 !! wikitext
4534 *:d1
4535 *::d2
4536 !! html
4537 <ul><li><dl><dd>d1
4538 <dl><dd>d2</dd></dl></dd></dl></li></ul>
4539 !! end
4540
4541
4542 !! test
4543 Definition Lists: Mixed Lists: Test 6
4544 !! wikitext
4545 #*:d1
4546 #*:::d3
4547 !! html
4548 <ol><li><ul><li><dl><dd>d1
4549 <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4550 !! end
4551
4552
4553 !! test
4554 Definition Lists: Mixed Lists: Test 7
4555 !! wikitext
4556 :*d1
4557 :*d2
4558 !! html
4559 <dl><dd><ul><li>d1</li>
4560 <li>d2</li></ul></dd></dl>
4561 !! end
4562
4563
4564 !! test
4565 Definition Lists: Mixed Lists: Test 8
4566 !! wikitext
4567 :*d1
4568 ::*d2
4569 !! html
4570 <dl><dd><ul><li>d1</li></ul>
4571 <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
4572 !! end
4573
4574
4575 !! test
4576 Definition Lists: Mixed Lists: Test 9
4577 !! wikitext
4578 *;foo :bar
4579 !! html
4580 <ul><li><dl><dt>foo</dt>
4581 <dd>bar</dd></dl></li></ul>
4582 !! end
4583
4584
4585 !! test
4586 Definition Lists: Mixed Lists: Test 10
4587 !! wikitext
4588 *#;foo :bar
4589 !! html
4590 <ul><li><ol><li><dl><dt>foo</dt>
4591 <dd>bar</dd></dl></li></ol></li></ul>
4592 !! end
4593
4594 # The Parsoid team disagrees with the PHP parser's seemingly-random
4595 # rules regarding dd/dt on the next few tests. Parsoid is more
4596 # consistent, and recognizes the shared nesting and keeps the
4597 # still-open tags around until the nesting is complete.
4598
4599 # This is a regression test for T175099
4600 !! test
4601 Definition Lists: Mixed Lists: Test 11
4602 !! wikitext
4603 ;a
4604 :*b
4605 !! html/php
4606 <dl><dt>a</dt>
4607 <dd>
4608 <ul><li>b</li></ul></dd></dl>
4609 !! html/parsoid
4610 <dl><dt>a
4611 <dd><ul><li>b</li></ul></dd></dl>
4612 !! end
4613
4614 # FIXME: Maybe get rid of this test?
4615 !! test
4616 Definition Lists: Mixed Lists: Test 12
4617 !! wikitext
4618 *#*#;*;;foo :bar
4619 *#*#;boo :baz
4620 !! html/php
4621 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4622 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4623 <dl><dt>boo</dt>
4624 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4625 !! html/php+tidy
4626 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo</dt>
4627 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4628 <dl><dt>boo</dt>
4629 <dd>baz</dd></dl></li></ol></li></ul>
4630 !! html/parsoid
4631 <ul>
4632 <li>
4633 <ol>
4634 <li>
4635 <ul>
4636 <li>
4637 <ol>
4638 <li>
4639 <dl>
4640 <dt>
4641 <ul>
4642 <li>
4643 <dl>
4644 <dt>
4645 <dl>
4646 <dt>foo</dt>
4647 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4648 </dl></dt>
4649 </dl></li>
4650 </ul></dt>
4651 <dt>boo</dt>
4652 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4653 </dl></li>
4654 </ol></li>
4655 </ul></li>
4656 </ol></li>
4657 </ul>
4658 !! end
4659
4660 !! test
4661 Definition Lists: Mixed Lists: Test 13
4662 !! wikitext
4663 *#*#;*;;foo : bar
4664 *#*#;boo : baz
4665 !! html+tidy
4666 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4667 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
4668 <dl><dt>boo&#160;</dt>
4669 <dd>baz</dd></dl></li></ol></li></ul>
4670 !! end
4671
4672 # FIXME: Maybe get rid of this test?
4673 # From old whitelist description:
4674 # * The test is wrong, there are two colons where there should be :;
4675 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4676 !! test
4677 Definition Lists: Weird Ones: Test 1
4678 !! wikitext
4679 *#;*::;;foo :bar (who uses this?)
4680 !! html/php+tidy
4681 <ul><li><ol><li><dl><dt>foo</dt>
4682 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4683 !! html/parsoid
4684 <ul>
4685 <li>
4686 <ol>
4687 <li>
4688 <dl>
4689 <dt>
4690 <ul>
4691 <li>
4692 <dl>
4693 <dd>
4694 <dl>
4695 <dd>
4696 <dl>
4697 <dt>
4698 <dl>
4699 <dt>foo</dt>
4700 <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
4701 </dl></dt>
4702 </dl></dd>
4703 </dl></dd>
4704 </dl></li>
4705 </ul></dt>
4706 </dl></li>
4707 </ol></li>
4708 </ul>
4709 !! end
4710
4711 !! test
4712 Definition Lists: colons occurring in tags
4713 !! wikitext
4714 ;a:b
4715 ;'''a:b'''
4716 ;<i>a:b</i>
4717 ;<span>a:b</span>
4718 ;<div>a:b</div>
4719 ;<div>a
4720 :b</div>
4721 ;{{echo|a:b}}
4722 ;{{echo|''a:b''}}
4723 ;;;''a:b''
4724 !! html+tidy
4725 <dl><dt>a</dt>
4726 <dd>b</dd>
4727 <dt><b>a:b</b></dt>
4728 <dt><i>a:b</i></dt>
4729 <dt><span>a:b</span></dt>
4730 <dt><div>a:b</div></dt>
4731 <dt><div>a</div></dt>
4732 <dd>b</dd>
4733 <dt>a</dt>
4734 <dd>b</dd>
4735 <dt><i>a:b</i></dt></dl>
4736 <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4737 !! html/parsoid
4738 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4739 <dt><b>a:b</b></dt>
4740 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4741 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4742 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4743 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4744 <dd>b</dd>
4745 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4746 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4747 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4748 !! end
4749
4750 # Parsoid's output differs here again because it shares
4751 # nesting between the two lists unlike the PHP parser.
4752 # Unsure which is more desirable.
4753 !! test
4754 Definition Lists: colons and tables 1
4755 !! wikitext
4756 :{|
4757 |x
4758 |}
4759 :{|
4760 |y
4761 |}
4762 !! html/php
4763 <dl><dd><table>
4764 <tr>
4765 <td>x
4766 </td></tr></table></dd></dl>
4767 <dl><dd><table>
4768 <tr>
4769 <td>y
4770 </td></tr></table></dd></dl>
4771 !! html/parsoid
4772 <dl><dd><table>
4773 <tr>
4774 <td>x
4775 </td></tr></table></dd>
4776 <dd><table>
4777 <tr>
4778 <td>y
4779 </td></tr></table></dd></dl>
4780 !! end
4781
4782 # FIXME: Does this need a html/php section?
4783 !! test
4784 Definition Lists: template interaction
4785 !! wikitext
4786 ::{{definition_list}}
4787
4788 :one
4789 ::{{definition_list}}
4790 :::two
4791 :::three
4792 ::four
4793 !! html/parsoid
4794 <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">
4795 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4796
4797 <dl><dd data-parsoid='{}'>one
4798 <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">
4799 </span><dd about="#mwt2">two
4800 <dl><dd>two</dd>
4801 <dd>three</dd></dl></dd>
4802 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4803 !! end
4804
4805
4806 ###
4807 ### External links
4808 ###
4809 !! test
4810 External links: non-bracketed
4811 !! wikitext
4812 Non-bracketed: http://example.com
4813 !! html
4814 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4815 </p>
4816 !! end
4817
4818 # parsoid doesn't explicitly mark autonumbered links, see T55505
4819 !! test
4820 External links: numbered
4821 !! wikitext
4822 Numbered: [http://example.com]
4823 Numbered: [http://example.net]
4824 Numbered: [http://example.com]
4825 !! html/php
4826 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4827 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4828 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4829 </p>
4830 !! html/parsoid
4831 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com" class="external autonumber"></a>
4832 Numbered: <a rel="mw:ExtLink" href="http://example.net" class="external autonumber"></a>
4833 Numbered: <a rel="mw:ExtLink" href="http://example.com" class="external autonumber"></a></p>
4834 !!end
4835
4836 !! test
4837 External links: specified text
4838 !! wikitext
4839 Specified text: [http://example.com link]
4840 !! html
4841 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4842 </p>
4843 !!end
4844
4845 !! test
4846 External links: trail
4847 !! wikitext
4848 Linktrails should not work for external links: [http://example.com link]s
4849 !! html
4850 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4851 </p>
4852 !! end
4853
4854 !! test
4855 External links: dollar sign in URL
4856 !! wikitext
4857 http://example.com/1$2345
4858 !! html
4859 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4860 </p>
4861 !! end
4862
4863 # parsoid doesn't explicitly mark autonumbered links, see T55505
4864 !! test
4865 External links: dollar sign in URL (autonumber)
4866 !! wikitext
4867 [http://example.com/1$2345]
4868 !! html/php
4869 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4870 </p>
4871 !! html/parsoid
4872 <p><a rel="mw:ExtLink" href="http://example.com/1$2345" class="external autonumber"></a></p>
4873 !!end
4874
4875 !! test
4876 External links: open square bracket forbidden in URL (T6377)
4877 !! options
4878 parsoid=wt2html,wt2wt,html2html
4879 !! wikitext
4880 http://example.com/1[2345
4881 !! html/php
4882 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4883 </p>
4884 !! html/parsoid
4885 <p><a rel="mw:ExtLink" href="http://example.com/1" class="external free">http://example.com/1</a>[2345</p>
4886 !! end
4887
4888 !! test
4889 External links: open square bracket forbidden in URL (named) (T6377)
4890 !! options
4891 parsoid=wt2html,html2html
4892 !! wikitext
4893 [http://example.com/1[2345]
4894 !! html/php
4895 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4896 </p>
4897 !! html/parsoid
4898 <p><a rel="mw:ExtLink" href="http://example.com/1" class="external text">[2345</a></p>
4899 !!end
4900
4901 # parsoid adds a space before the link name
4902 !! test
4903 External links: open square bracket forbidden in URL (named) (T6377)
4904 Parsoid variant.
4905 !! wikitext
4906 [http://example.com/1 [2345]
4907 !! html
4908 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4909 </p>
4910 !!end
4911
4912 !! test
4913 External links: nowiki in URL link text (T8230)
4914 !! wikitext
4915 [http://example.com/ <nowiki>''example site''</nowiki>]
4916 !! html
4917 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4918 </p>
4919 !! end
4920
4921 !! test
4922 External links: newline forbidden in text (T8230 regression check)
4923 !! wikitext
4924 [http://example.com/ first
4925 second]
4926 !! html
4927 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4928 second]
4929 </p>
4930 !!end
4931
4932 !! test
4933 External links: Pipe char between url and text
4934 !! wikitext
4935 [http://example.com | link]
4936 !! html
4937 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4938 </p>
4939 !!end
4940
4941 !! test
4942 External links: protocol-relative URL in brackets
4943 !! wikitext
4944 [//example.com/ Test]
4945 !! html
4946 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see T55505
4951 !! test
4952 External links: protocol-relative URL in brackets without text
4953 !! wikitext
4954 [//example.com]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="//example.com" class="external autonumber"></a></p>
4960 !! end
4961
4962 !! test
4963 External links: protocol-relative URL in free text is left alone
4964 !! wikitext
4965 //example.com/Foo
4966 !! html
4967 <p>//example.com/Foo
4968 </p>
4969 !!end
4970
4971 !! test
4972 External links: protocol-relative URL in the middle of a word is left alone (T32269)
4973 !! wikitext
4974 foo//example.com/Foo
4975 !! html
4976 <p>foo//example.com/Foo
4977 </p>
4978 !! end
4979
4980 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
4981 !! test
4982 External links: with no contents
4983 !! options
4984 parsoid=wt2html,wt2wt
4985 !! wikitext
4986 [http://en.wikipedia.org/wiki/Foo]
4987
4988 [[wikipedia:Foo|Bar]]
4989
4990 [[wikipedia:Foo|<span>Bar</span>]]
4991 !! html/php
4992 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4993 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4994 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" class="external autonumber"></a></p>
4998 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4999 <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
5000 !! end
5001
5002 !! test
5003 External links: Free with trailing punctuation
5004 !! wikitext
5005 http://example.com,
5006 http://example.com;
5007 http://example.com\
5008 http://example.com.
5009 http://example.com:
5010 http://example.com!
5011 http://example.com?
5012 http://example.com)
5013 http://example.com/url_with_(brackets)
5014 (http://example.com/url_without_brackets)
5015 http://example.com/url_with_entity&amp;
5016 http://example.com/url_with_entity&#x26;
5017 http://example.com/url_with_entity&#038;
5018 http://example.com/url_with_entity&nbsp;
5019 http://example.com/url_with_entity&#xA0;
5020 http://example.com/url_with_entity&#160;
5021 http://example.com/url_with_entity&lt;
5022 http://example.com/url_with_entity&#x3C;
5023 http://example.com/url_with_entity&#60;
5024 !! html/php
5025 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
5026 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
5027 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
5028 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
5029 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
5030 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
5031 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
5032 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5033 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5034 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5035 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5036 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5037 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5038 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5039 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
5040 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
5041 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
5042 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
5043 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>,
5047 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>;
5048 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>\
5049 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>.
5050 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>:
5051 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>!
5052 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>?
5053 <a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>)
5054 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)" class="external free">http://example.com/url_with_(brackets)</a>
5055 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets" class="external free">http://example.com/url_without_brackets</a>)
5056 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;" class="external free">http://example.com/url_with_entity&amp;</a>
5057 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;" class="external free">http://example.com/url_with_entity&amp;</a>
5058 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;" class="external free">http://example.com/url_with_entity&amp;</a>
5059 <a rel="mw:ExtLink" href="http://example.com/url_with_entity" class="external free">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
5060 <a rel="mw:ExtLink" href="http://example.com/url_with_entity" class="external free">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
5061 <a rel="mw:ExtLink" href="http://example.com/url_with_entity" class="external free">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
5062 <a rel="mw:ExtLink" href="http://example.com/url_with_entity" class="external free">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
5063 <a rel="mw:ExtLink" href="http://example.com/url_with_entity" class="external free">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
5064 <a rel="mw:ExtLink" href="http://example.com/url_with_entity" class="external free">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
5065 !! end
5066
5067 !! test
5068 External links: tricky Parsoid html2html case
5069 !! options
5070 parsoid=wt2html,wt2wt,html2html
5071 !! wikitext
5072 http://example.com/url_with_entity&amp;amp;
5073 !! html/php
5074 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
5075 </p>
5076 !! html/parsoid
5077 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp" class="external free">http://example.com/url_with_entity&amp;amp</a>;</p>
5078 !! end
5079
5080 !! test
5081 External links: Free with trailing quotes (T113666)
5082 !! wikitext
5083 '''News:''' Stuff here
5084
5085 news:'a'b''c''d e
5086 !! html/php
5087 <p><b>News:</b> Stuff here
5088 </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
5089 </p>
5090 !! html/parsoid
5091 <p><b>News:</b> Stuff here</p>
5092 <p><a rel="mw:ExtLink" href="news:'a'b" class="external free">news:'a'b</a><i>c</i>d e</p>
5093 !! end
5094
5095 !! test
5096 External links: with entity
5097 !! wikitext
5098 [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
5099 !! html/php
5100 <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
5101 </p>
5102 !! html/parsoid
5103 <p><a rel="mw:ExtLink" href="http://+www.librarieswithoutborders.org" class="external text" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
5104 !! end
5105
5106 !! test
5107 External links: Lone protocols are never linked (T105697)
5108 !! wikitext
5109 http://
5110 http://;
5111 (http://)
5112 bitcoin:
5113 bitcoin:;
5114 (bitcoin:)
5115 !! html
5116 <p>http://
5117 http://;
5118 (http://)
5119 bitcoin:
5120 bitcoin:;
5121 (bitcoin:)
5122 </p>
5123 !! end
5124
5125 !! test
5126 External links: No preceding word characters allowed (T67278)
5127 !! wikitext
5128 NOPEhttp://example.com
5129 N0http://example.com
5130 ok:http://example.com
5131 ok-http://example.com
5132 !! html
5133 <p>NOPEhttp://example.com
5134 N0http://example.com
5135 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5136 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5137 </p>
5138 !! end
5139
5140 !! test
5141 External links: nofollow domain exception
5142 !! wikitext
5143 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
5144 !! html
5145 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
5146 </p>
5147 !!end
5148
5149 !! test
5150 External image
5151 !! wikitext
5152 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5153 !! html
5154 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5155 </p>
5156 !! end
5157
5158 !! test
5159 External image from https
5160 !! wikitext
5161 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5162 !! html
5163 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
5164 </p>
5165 !! end
5166
5167 !! test
5168 External image (when not allowed)
5169 !! options
5170 wgAllowExternalImages=0
5171 !! wikitext
5172 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
5173 !! html
5174 <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>
5175 </p>
5176 !! end
5177
5178 !! test
5179 Link to non-http image, no img tag
5180 !! wikitext
5181 Link to non-http image, no img tag: ftp://example.com/test.jpg
5182 !! html
5183 <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>
5184 </p>
5185 !! end
5186
5187 !! test
5188 External links: terminating separator
5189 !! wikitext
5190 Terminating separator: http://example.com/thing,
5191 !! html
5192 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
5193 </p>
5194 !! end
5195
5196 !! test
5197 External links: intervening separator
5198 !! wikitext
5199 Intervening separator: http://example.com/1,2,3
5200 !! html
5201 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
5202 </p>
5203 !! end
5204
5205 !! test
5206 External links: old bug with URL in query
5207 !! wikitext
5208 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
5209 !! html
5210 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
5211 </p>
5212 !! end
5213
5214 !! test
5215 External links: old URL-in-URL bug, mixed protocols
5216 !! wikitext
5217 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
5218 !! html
5219 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
5220 </p>
5221 !!end
5222
5223 # Since Parsoid is starting to emit canonical wikitext for links,
5224 # [http://example.com http://example.com] will not RT back to that
5225 # form anymore.
5226 !! test
5227 External links: URL in text
5228 !! options
5229 parsoid=wt2html
5230 !! wikitext
5231 URL in text: [http://example.com http://example.com]
5232 !! html/php
5233 <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
5234 </p>
5235 !! html/parsoid
5236 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com" class="external text">http://example.com</a></p>
5237 !! end
5238
5239 !! test
5240 External links: Clickable images
5241 !! wikitext
5242 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
5243 !! html/php
5244 <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>
5245 </p>
5246 !! html/parsoid
5247 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com" class="external text"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
5248 !! end
5249
5250 !! test
5251 External links: raw ampersand
5252 !! wikitext
5253 Old &amp; use: http://x&y
5254 !! html
5255 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5256 </p>
5257 !! end
5258
5259 !! test
5260 External links: encoded ampersand
5261 !! wikitext
5262 Old &amp; use: http://x&amp;y
5263 !! html/php
5264 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
5265 </p>
5266 !! html/parsoid
5267 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y" class="external free">http://x&amp;y</a></p>
5268 !! end
5269
5270 !! test
5271 External links: encoded equals (T8102)
5272 !! wikitext
5273 http://example.com/?foo&#61;bar
5274 !! html/php
5275 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
5276 </p>
5277 !! html/parsoid
5278 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar" class="external free">http://example.com/?foo=bar</a></p>
5279 !! end
5280
5281 ##
5282 ## Note that parsoid doesn't explicit mark autonumbered links, nor
5283 ## does it number them. As discussed in T55505, we can identify
5284 ## autonumbered links via CSS.
5285 ##
5286
5287 !! test
5288 External links: [raw ampersand]
5289 !! wikitext
5290 Old &amp; use: [http://x&y]
5291 !! html/php
5292 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5293 </p>
5294 !! html/parsoid
5295 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y" class="external autonumber"></a></p>
5296 !! end
5297
5298 # note that parsoid html is identical to [raw ampersand] case; so html2wt
5299 # mode will return the [raw ampersand] wikitext
5300 !! test
5301 External links: [encoded ampersand]
5302 !! options
5303 parsoid=wt2html,wt2wt,html2html
5304 !! wikitext
5305 Old &amp; use: [http://x&amp;y]
5306 !! html/php
5307 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5308 </p>
5309 !! html/parsoid
5310 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y" class="external autonumber"></a></p>
5311 !! end
5312
5313 !! test
5314 External links: [raw equals]
5315 !! wikitext
5316 [http://example.com/?foo=bar]
5317 !! html/php
5318 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5319 </p>
5320 !! html/parsoid
5321 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar" class="external autonumber"></a></p>
5322 !! end
5323
5324 # note that parsoid html is identical to [raw equals] case; so html2wt
5325 # mode will return the [raw equals] wikitext
5326 !! test
5327 External links: [encoded equals] (T8102)
5328 !! options
5329 parsoid=wt2html,wt2wt,html2html
5330 !! wikitext
5331 [http://example.com/?foo&#61;bar]
5332 !! html/php
5333 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar" class="external autonumber"></a></p>
5337 !! end
5338
5339 # xxx parsoid strips the IDN character, so the round-trip tests will
5340 # obviously fail and are disabled. --cscott
5341 !! test
5342 External links: [IDN ignored character reference in hostname; strip it right off]
5343 !! options
5344 parsoid=wt2html,wt2wt,html2html
5345 !! wikitext
5346 [http://e&zwnj;xample.com/]
5347 !! html/php
5348 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5349 </p>
5350 !! html/parsoid
5351 <p><a rel="mw:ExtLink" href="http://example.com/" class="external autonumber"></a></p>
5352 !! end
5353
5354 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5355 # Where an external link could easily circumvent the sanitization of the text of
5356 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5357 # test demands a higher standard. That's a bit strange.
5358 #
5359 # Example:
5360 #
5361 # http://e‌xample.com -> [http://example.com|http://example.com]
5362 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5363 #
5364 # The first example is sanitized, but the second is not. Any security benefits
5365 # from this production are trivial to circumvent. Either remove this test and
5366 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5367 # the test accordingly.
5368 #
5369 # All our love,
5370 # The Parsoid team.
5371 # xxx parsoid strips the IDN character, so the round-trip tests will
5372 # obviously fail and are disabled. --cscott
5373 !! test
5374 External links: IDN ignored character reference in hostname; strip it right off
5375 !! options
5376 parsoid=wt2html,html2html
5377 !! wikitext
5378 http://e&zwnj;xample.com/
5379 !! html/php
5380 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5381 </p>
5382 !! html/parsoid
5383 <p><a rel="mw:ExtLink" href="http://example.com/" class="external free">http://example.com/</a></p>
5384 !! end
5385
5386 !! test
5387 External links: www.jpeg.org (T2554)
5388 !! wikitext
5389 http://www.jpeg.org
5390 !! html
5391 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5392 </p>
5393 !! end
5394
5395 # parsoid doesn't explicitly mark autonumbered links, see T55505
5396 !! test
5397 External links: URL within URL (T2002)
5398 !! wikitext
5399 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5400 !! html/php
5401 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber"></a></p>
5405 !! end
5406
5407 !! test
5408 T2361: URL inside bracketed URL
5409 !! wikitext
5410 [http://www.example.com/foo http://www.example.com/bar]
5411 !! html
5412 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5413 </p>
5414 !! end
5415
5416 !! test
5417 T2361: URL within URL, not bracketed
5418 !! wikitext
5419 http://www.example.com/foo?=http://www.example.com/bar
5420 !! html
5421 <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>
5422 </p>
5423 !! end
5424
5425 !! test
5426 T2289: ">"-token in URL-tail
5427 !! wikitext
5428 http://www.example.com/<hello>
5429 !! html
5430 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5431 </p>
5432 !!end
5433
5434 !! test
5435 T2289: literal ">"-token in URL-tail
5436 !! wikitext
5437 http://www.example.com/<b>html</b>
5438 !! html/php
5439 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5440 </p>
5441 !! html/parsoid
5442 <p><a rel="mw:ExtLink" href="http://www.example.com/" class="external free" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5443 !! end
5444
5445 !! test
5446 T2289: ">"-token in bracketed URL
5447 !! wikitext
5448 [http://www.example.com/<hello> stuff]
5449 !! html
5450 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5451 </p>
5452 !!end
5453
5454 !! test
5455 T2289: literal ">"-token in bracketed URL
5456 !! wikitext
5457 [http://www.example.com/<b>html</b> stuff]
5458 !! html
5459 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5460 </p>
5461 !!end
5462
5463 !! test
5464 T2289: literal double quote at end of URL
5465 !! wikitext
5466 http://www.example.com/"hello"
5467 !! html
5468 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5469 </p>
5470 !!end
5471
5472 !! test
5473 T2289: literal double quote in bracketed URL
5474 !! wikitext
5475 [http://www.example.com/"hello" stuff]
5476 !! html
5477 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5478 </p>
5479 !!end
5480
5481 !! test
5482 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
5483 !! wikitext
5484 [http://www.example.com test]
5485 !! html
5486 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5487 </p>
5488 !! end
5489
5490 !! test
5491 External links: link text with spaces
5492 !! wikitext
5493 [http://www.example.com a b c]
5494 [http://www.example.com ''a'' ''b'']
5495 !! html
5496 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5497 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5498 </p>
5499 !! end
5500
5501 # Note edge case difference between PHP and Parsoid here.
5502 !! test
5503 External links: wiki links within external link (T5695)
5504 !! options
5505 parsoid=wt2html,html2html
5506 !! wikitext
5507 [http://example.com [[wikilink]] embedded in ext link]
5508
5509 [http://example.com test [[wikilink]] embedded in ext link]
5510 !! html/php
5511 <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>
5512 </p><p><a rel="nofollow" class="external text" href="http://example.com">test </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>
5513 </p>
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://example.com" class="external autonumber"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5516 <p><a rel="mw:ExtLink" href="http://example.com" class="external text">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5517 !! end
5518
5519 !! test
5520 T2787: Links with one slash after the url protocol are invalid
5521 !! wikitext
5522 http:/example.com
5523
5524 [http:/example.com title]
5525 !! html
5526 <p>http:/example.com
5527 </p><p>[http:/example.com title]
5528 </p>
5529 !! end
5530
5531 !! test
5532 Bracketed external links with template-generated invalid target
5533 !! wikitext
5534 [{{echo|http:/example.com}} title]
5535 !! html
5536 <p>[http:/example.com title]
5537 </p>
5538 !! end
5539
5540 # wt2html only because Parsoid would want to add <nowiki>s coming from html
5541 !! test
5542 Broken wikilinks (but not external links) prevent templates from closing
5543 !! options
5544 parsoid=wt2html
5545 !! wikitext
5546 [http://example.com x
5547
5548 {{echo|[http://example.com x}}
5549
5550 [[Foo
5551
5552 {{echo|[[Foo}}
5553 !! html/php
5554 <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5555 </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
5556 </p><p>[[Foo
5557 </p><p>{{echo|[[Foo}}
5558 </p>
5559 !! html/parsoid
5560 <p>[<a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a> x</p>
5561 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a> x</p>
5562 <p>[[Foo</p>
5563 <p>{{echo|[[Foo}}</p>
5564 !! end
5565
5566 !! test
5567 Wikilinks with embedded newlines are not broken
5568 !! wikitext
5569 {{echo|[[ Foo
5570 B
5571 C]]}}
5572 !! html/php
5573 <p>[[ Foo
5574 B
5575 C]]
5576 </p>
5577 !! html/parsoid
5578 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
5579 !! end
5580
5581 !! test
5582 Broken templates
5583 !! options
5584 parsoid=wt2html
5585 !! wikitext
5586 {{echo|[[Foo|}}]]
5587
5588 [[Foo|{{echo|]]}}
5589 !! html/php
5590 <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
5591 </p><p>[[Foo|]]
5592 </p>
5593 !! html/parsoid
5594 <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
5595 <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
5596 !! end
5597
5598 !! article
5599 Template:pipe page
5600 !! text
5601 Main|Page
5602 !! endarticle
5603
5604 ## FIXME: Parsoid doesn't support this and may never. See T226523
5605 !! test
5606 Template returning pipe used in wikilink target
5607 !! wikitext
5608 [[{{pipe page}}]]
5609 !! html/php+tidy
5610 <p><a href="/index.php?title=Main&amp;action=edit&amp;redlink=1" class="new" title="Main (page does not exist)">Page</a>
5611 </p>
5612 !! html/parsoid
5613 <p>[[<span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"pipe page","href":"./Template:Pipe_page"},"params":{},"i":0}}]}'>Main|Page</span>]]</p>
5614 !! end
5615
5616 # Italic/link nesting is changed in this test, but the rendered result is the
5617 # same. Currently the result is actually an improvement over the MediaWiki
5618 # output.
5619 !! test
5620 T4702: Mismatched <i>, <b> and <a> tags are invalid
5621 !! wikitext
5622 ''[http://example.com text'']
5623 [http://example.com '''text]'''
5624 ''Something [http://example.com in italic'']
5625 ''Something [http://example.com mixed''''', even bold]'''
5626 '''''Now [http://example.com both''''']
5627 !! html/php
5628 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5629 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5630 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5631 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5632 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5633 </p>
5634 !! html/parsoid
5635 <p><i data-parsoid='{"autoInsertedEnd":true}'><a rel="mw:ExtLink" href="http://example.com" class="external text">text<i data-parsoid='{"autoInsertedEnd":true}'></i></a></i>
5636 <a rel="mw:ExtLink" href="http://example.com" class="external text"><b data-parsoid='{"autoInsertedEnd":true}'>text</b></a><b data-parsoid='{"autoInsertedEnd":true}'></b>
5637 <i data-parsoid='{"autoInsertedEnd":true}'>Something <a rel="mw:ExtLink" href="http://example.com" class="external text">in italic<i data-parsoid='{"autoInsertedEnd":true}'></i></a></i>
5638 <i>Something <a rel="mw:ExtLink" href="http://example.com" class="external text">mixed<b data-parsoid='{"autoInsertedEnd":true}'><i data-parsoid='{"autoInsertedEnd":true}'>, even bold</i></b></a>'</i>
5639 <b data-parsoid='{"autoInsertedEnd":true}'><i data-parsoid='{"autoInsertedEnd":true}'>Now <a rel="mw:ExtLink" href="http://example.com" class="external text">both<b data-parsoid='{"autoInsertedEnd":true}'><i data-parsoid='{"autoInsertedEnd":true}'></i></b></a></i></b></p>
5640 !! end
5641
5642
5643 !! test
5644 T6781: %26 in URL
5645 !! wikitext
5646 http://www.example.com/?title=AT%26T
5647 !! html/php
5648 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5649 </p>
5650 !! html/parsoid
5651 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T" class="external free">http://www.example.com/?title=AT%26T</a></p>
5652 !! end
5653
5654 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5655 # % is actually legal in HTML5. Any change in output would need testing though.
5656 !! test
5657 T6781, T7267: %25 in URL
5658 !! wikitext
5659 http://www.example.com/?title=100%25_Bran
5660 !! html/php
5661 <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>
5662 </p>
5663 !! html/parsoid
5664 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran" class="external free">http://www.example.com/?title=100%25_Bran</a></p>
5665 !! end
5666
5667 !! test
5668 T6781, T7267: %28, %29 in URL
5669 !! wikitext
5670 http://www.example.com/?title=Ben-Hur_%281959_film%29
5671 !! html/php
5672 <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>
5673 </p>
5674 !! html/parsoid
5675 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5676 !! end
5677
5678
5679 !! test
5680 T6781: %26 in autonumber URL
5681 !! wikitext
5682 [http://www.example.com/?title=AT%26T]
5683 !! html/php
5684 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5685 </p>
5686 !! html/parsoid
5687 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T" class="external autonumber"></a></p>
5688 !! end
5689
5690 !! test
5691 T6781, T7267: %26 in autonumber URL
5692 !! wikitext
5693 [http://www.example.com/?title=100%25_Bran]
5694 !! html/php
5695 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5696 </p>
5697 !! html/parsoid
5698 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran" class="external autonumber"></a></p>
5699 !! end
5700
5701 !! test
5702 T6781, T7267: %28, %29 in autonumber URL
5703 !! wikitext
5704 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5705 !! html/php
5706 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5707 </p>
5708 !! html/parsoid
5709 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber"></a></p>
5710 !! end
5711
5712
5713 !! test
5714 T6781: %26 in bracketed URL
5715 !! wikitext
5716 [http://www.example.com/?title=AT%26T link]
5717 !! html/php
5718 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5719 </p>
5720 !! html/parsoid
5721 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T" class="external text">link</a></p>
5722 !! end
5723
5724 !! test
5725 T6781, T7267: %25 in bracketed URL
5726 !! wikitext
5727 [http://www.example.com/?title=100%25_Bran link]
5728 !! html
5729 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5730 </p>
5731 !! end
5732
5733 !! test
5734 T6781, T7267: %28, %29 in bracketed URL
5735 !! wikitext
5736 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5737 !! html/php
5738 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5739 </p>
5740 !! html/parsoid
5741 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text">link</a></p>
5742 !! end
5743
5744 !! test
5745 External link containing a period in the anchor. (T65947)
5746 !! wikitext
5747 [//foo.org/bar#baz. bang]
5748
5749 [//foo.org/bar. bang]
5750 !! html/php
5751 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5752 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5753 </p>
5754 !! html/parsoid
5755 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz." class="external text">bang</a></p>
5756 <p><a rel="mw:ExtLink" href="//foo.org/bar." class="external text">bang</a></p>
5757 !! end
5758
5759 !! test
5760 External link containing a single quote. (T65947)
5761 !! wikitext
5762 [//foo.org/bar'baz]
5763
5764 [//foo.org/bar'baz bang]
5765 !! html/php
5766 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5767 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5768 </p>
5769 !! html/parsoid
5770 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz" class="external autonumber"></a></p>
5771 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz" class="external text">bang</a></p>
5772 !! end
5773
5774 !! test
5775 External link containing double-single-quotes in text '' (T6598 sanity check)
5776 !! wikitext
5777 Some [http://example.com/ pretty ''italics'' and stuff]!
5778 !! html
5779 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5780 </p>
5781 !! end
5782
5783 !! test
5784 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5785 !! wikitext
5786 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5787 !! html
5788 <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>
5789 </p>
5790 !! end
5791
5792 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5793 !! test
5794 External link containing double-single-quotes with no space separating the url from text in italics
5795 !! wikitext
5796 [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]].]
5797 !! html/php+tidy
5798 <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>.
5799 </p>
5800 !! html/parsoid
5801 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm" class="external text"><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>
5802 !! end
5803
5804 !! test
5805 External link with comments in link text
5806 !! wikitext
5807 [http://www.google.com Google <!-- comment -->]
5808 !! html/php
5809 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5810 </p>
5811 !! html/parsoid
5812 <p><a rel="mw:ExtLink" href="http://www.google.com" class="external text">Google <!-- comment --></a></p>
5813 !! end
5814
5815 !! test
5816 External link to bare IPv4 address
5817 !! wikitext
5818 [http://192.168.0.1 Link]
5819 !! html/php
5820 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5821 </p>
5822 !! html/parsoid
5823 <p><a rel="mw:ExtLink" href="http://192.168.0.1" class="external text">Link</a></p>
5824 !! end
5825
5826 !! test
5827 URL-encoding in URL functions (single parameter)
5828 !! wikitext
5829 {{localurl:Some page|amp=&}}
5830 !! html
5831 <p>/index.php?title=Some_page&amp;amp=&amp;
5832 </p>
5833 !! end
5834
5835 !! test
5836 URL-encoding in URL functions (multiple parameters)
5837 !! wikitext
5838 {{localurl:Some page|q=?&amp=&}}
5839 !! html
5840 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5841 </p>
5842 !! end
5843
5844 !! test
5845 Brackets in urls
5846 !! wikitext
5847 http://example.com/index.php?foozoid%5B%5D=bar
5848
5849 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5850 !! html/php
5851 <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>
5852 </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>
5853 </p>
5854 !! html/parsoid
5855 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" class="external free">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5856
5857 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar" class="external free" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5858 !! end
5859
5860 !! test
5861 IPv6 urls, autolink format (T23261)
5862 !! wikitext
5863 http://[2404:130:0:1000::187:2]/index.php
5864
5865 Examples from RFC 2373, section 2.2:
5866
5867 *http://[1080::8:800:200C:417A]/unicast
5868 *http://[FF01::101]/multicast
5869 *http://[::1]/loopback
5870 *http://[::]/unspecified
5871 *http://[::13.1.68.3]/ipv4compat
5872 *http://[::FFFF:129.144.52.38]/ipv4compat
5873
5874 Examples from RFC 2732, section 2:
5875
5876 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5877 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5878 *http://[3ffe:2a00:100:7031::1]
5879 *http://[1080::8:800:200C:417A]/foo
5880 *http://[::192.9.5.5]/ipng
5881 *http://[::FFFF:129.144.52.38]:80/index.html
5882 *http://[2010:836B:4179::836B:4179]
5883 !! html/php
5884 <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>
5885 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5886 </p>
5887 <ul><li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5888 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5889 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5890 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5891 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5892 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5893 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5894 </p>
5895 <ul><li><a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5896 <li><a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5897 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5898 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5899 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5900 <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5901 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5902 !! html/parsoid
5903 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php" class="external free">http://[2404:130:0:1000::187:2]/index.php</a></p>
5904
5905 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5906 <ul><li><a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast" class="external free">http://[1080::8:800:200C:417A]/unicast</a></li>
5907 <li><a rel="mw:ExtLink" href="http://[FF01::101]/multicast" class="external free">http://[FF01::101]/multicast</a></li>
5908 <li><a rel="mw:ExtLink" href="http://[::1]/loopback" class="external free">http://[::1]/loopback</a></li>
5909 <li><a rel="mw:ExtLink" href="http://[::]/unspecified" class="external free">http://[::]/unspecified</a></li>
5910 <li><a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat" class="external free">http://[::13.1.68.3]/ipv4compat</a></li>
5911 <li><a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat" class="external free">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5912
5913 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5914 <ul><li><a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html" class="external free">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5915 <li><a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html" class="external free">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5916 <li><a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]" class="external free">http://[3ffe:2a00:100:7031::1]</a></li>
5917 <li><a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo" class="external free">http://[1080::8:800:200C:417A]/foo</a></li>
5918 <li><a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng" class="external free">http://[::192.9.5.5]/ipng</a></li>
5919 <li><a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html" class="external free">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5920 <li><a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]" class="external free">http://[2010:836B:4179::836B:4179]</a></li></ul>
5921 !! end
5922
5923 !! test
5924 IPv6 urls, bracketed format (T23261)
5925 !! wikitext
5926 [http://[2404:130:0:1000::187:2]/index.php test]
5927
5928 Examples from RFC 2373, section 2.2:
5929
5930 *[http://[1080::8:800:200C:417A] unicast]
5931 *[http://[FF01::101] multicast]
5932 *[http://[::1]/ loopback]
5933 *[http://[::] unspecified]
5934 *[http://[::13.1.68.3] ipv4compat]
5935 *[http://[::FFFF:129.144.52.38] ipv4compat]
5936
5937 Examples from RFC 2732, section 2:
5938
5939 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5940 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5941 *[http://[3ffe:2a00:100:7031::1] 3]
5942 *[http://[1080::8:800:200C:417A]/foo 4]
5943 *[http://[::192.9.5.5]/ipng 5]
5944 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5945 *[http://[2010:836B:4179::836B:4179] 7]
5946 !! html/php
5947 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5948 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5949 </p>
5950 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5951 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5952 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5953 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5954 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5955 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5956 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5957 </p>
5958 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5959 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5960 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5961 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5962 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5963 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5964 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5965 !! html/parsoid
5966 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php" class="external text">test</a></p>
5967
5968 <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external mw-magiclink">RFC 2373</a>, section 2.2:</p>
5969 <ul><li><a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]" class="external text">unicast</a></li>
5970 <li><a rel="mw:ExtLink" href="http://[FF01::101]" class="external text">multicast</a></li>
5971 <li><a rel="mw:ExtLink" href="http://[::1]/" class="external text">loopback</a></li>
5972 <li><a rel="mw:ExtLink" href="http://[::]" class="external text">unspecified</a></li>
5973 <li><a rel="mw:ExtLink" href="http://[::13.1.68.3]" class="external text">ipv4compat</a></li>
5974 <li><a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]" class="external text">ipv4compat</a></li></ul>
5975
5976 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5977 <ul><li><a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html" class="external text">1</a></li>
5978 <li><a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html" class="external text">2</a></li>
5979 <li><a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]" class="external text">3</a></li>
5980 <li><a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo" class="external text">4</a></li>
5981 <li><a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng" class="external text">5</a></li>
5982 <li><a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html" class="external text">6</a></li>
5983 <li><a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]" class="external text">7</a></li></ul>
5984 !! end
5985
5986 !! test
5987 Non-extlinks in brackets
5988 !! wikitext
5989 [foo]
5990 [foo bar]
5991 [foo ''bar'']
5992 [fool's] errand
5993 [fool's errand]
5994 [{{echo|foo}}]
5995 [{{echo|foo}} bar]
5996 [{{echo|foo}} ''bar'']
5997 [{{echo|foo}}l's] errand
5998 [{{echo|foo}}l's errand]
5999 [url={{echo|foo}}]
6000 [url=http://example.com]
6001 [http:// bare protocols don't count]
6002 !! html/php
6003 <p>[foo]
6004 [foo bar]
6005 [foo <i>bar</i>]
6006 [fool's] errand
6007 [fool's errand]
6008 [foo]
6009 [foo bar]
6010 [foo <i>bar</i>]
6011 [fool's] errand
6012 [fool's errand]
6013 [url=foo]
6014 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
6015 [http:// bare protocols don't count]
6016 </p>
6017 !! html/parsoid
6018 <p>[foo]
6019 [foo bar]
6020 [foo <i>bar</i>]
6021 [fool's] errand
6022 [fool's errand]
6023 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6024 [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
6025 [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
6026 [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
6027 [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
6028 [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
6029 [url=<a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>]
6030 [http:// bare protocols don't count]</p>
6031 !! end
6032
6033 !! test
6034 Percent encoding in external links
6035 !! wikitext
6036 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6037 !! html/php
6038 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6039 </p>
6040 !! html/parsoid
6041 <p><a rel="mw:ExtLink" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia" class="external text">Search</a></p>
6042 !! end
6043
6044 !! test
6045 Use url link syntax for links where the content is equal the link target
6046 !! wikitext
6047 http://example.com
6048 !! html/php
6049 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6050 </p>
6051 !! html/parsoid
6052 <p><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a></p>
6053 !! end
6054
6055 !! test
6056 Parenthesis in external links, especially URL links
6057 !! wikitext
6058 http://example.com)
6059
6060 http://example.com/test)
6061
6062 http://example.com/(test)
6063
6064 http://example.com/((test)
6065
6066 (http://example.com/(test))
6067
6068 (http://example.com/(test)))))
6069
6070 http://example.com/a)b
6071
6072 [http://example.com) foo]
6073 !! html/php
6074 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6075 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6076 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6077 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6078 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6079 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6080 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6081 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6082 </p>
6083 !! html/parsoid
6084 <p><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a>)</p>
6085 <p><a rel="mw:ExtLink" href="http://example.com/test" class="external free">http://example.com/test</a>)</p>
6086 <p><a rel="mw:ExtLink" href="http://example.com/(test)" class="external free">http://example.com/(test)</a></p>
6087 <p><a rel="mw:ExtLink" href="http://example.com/((test)" class="external free">http://example.com/((test)</a></p>
6088 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))" class="external free">http://example.com/(test))</a></p>
6089 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))" class="external free">http://example.com/(test)))))</a></p>
6090 <p><a rel="mw:ExtLink" href="http://example.com/a)b" class="external free">http://example.com/a)b</a></p>
6091 <p><a rel="mw:ExtLink" href="http://example.com)" class="external text">foo</a></p>
6092 !! end
6093
6094 !! test
6095 Parenthesis in external links, w/ transclusion or comment
6096 !! wikitext
6097 (http://example.com/{{echo|hi}})
6098
6099 (http://example.com<!-- hi -->)
6100 !! html/php
6101 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6102 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6103 </p>
6104 !! html/parsoid
6105 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" class="external free" 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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
6106
6107 <p>(<a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
6108 !! end
6109
6110 !! test
6111 Serialize <a> tags with invalid link targets as plain text
6112 !! options
6113 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6114 !! html/parsoid
6115 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6116 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6117 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6118 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6119 !! wikitext
6120 text
6121 <nowiki>*</nowiki>text
6122 <nowiki>[[foo]]</nowiki>
6123 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6124 !! end
6125
6126 !! test
6127 mw:ExtLink -vs- mw:WikiLink (T94723)
6128 !! options
6129 parsoid=html2wt
6130 !! html/parsoid
6131 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6132 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6133 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6134 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6135 <p>
6136 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6137 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6138 </p>
6139 !! wikitext
6140 [[Foo|Bar]]
6141 [[Foo|Bar]]
6142 [[:en:Foo|Bar]]
6143 [[:en:Foo|Bar]]
6144
6145 [[:en:European_Robin|European Robin]]
6146 [[:en:European_Robin|European Robin]]
6147 !! end
6148
6149 !! test
6150 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6151 !! options
6152 parsoid=wt2wt
6153 !! wikitext
6154 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6155 !! html/parsoid
6156 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6157 !! end
6158
6159
6160 ###
6161 ### Quotes
6162 ###
6163
6164 !! test
6165 Quotes
6166 !! wikitext
6167 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6168
6169 Normal text. '''''Bold italic text.''''' Normal text.
6170 !! html
6171 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6172 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6173 </p>
6174 !! end
6175
6176 !! test
6177 Quotes wrapping HTML table
6178 !! wikitext
6179 '''<table><tr><td>hi</td></tr></table>'''
6180 !! html/php+tidy
6181 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6182 !! html/parsoid
6183 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6184 !! end
6185
6186 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6187 # parser strips. The wikitext contains just the first half of the bold
6188 # quote pair.
6189 !! test
6190 Unclosed and unmatched quotes
6191 !! wikitext
6192 '''''Bold italic text '''with bold deactivated''' in between.'''''
6193
6194 '''''Bold italic text ''with italic deactivated'' in between.'''''
6195
6196 '''Bold text..
6197
6198 ..spanning two paragraphs (should not work).'''
6199
6200 '''Bold tag left open
6201
6202 ''Italic tag left open
6203
6204 Normal text.
6205
6206 <!-- Unmatching number of opening, closing tags: -->
6207 '''This year''''s election ''should'' beat '''last year''''s.
6208
6209 ''Tom'''s car is bigger than ''Susan'''s.
6210
6211 Plain ''italic'''s plain
6212 !! html/php
6213 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6214 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6215 </p><p><b>Bold text..</b>
6216 </p><p>..spanning two paragraphs (should not work).
6217 </p><p><b>Bold tag left open</b>
6218 </p><p><i>Italic tag left open</i>
6219 </p><p>Normal text.
6220 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6221 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6222 </p><p>Plain <i>italic'</i>s plain
6223 </p>
6224 !! html/parsoid
6225 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6226 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6227 </p><p><b>Bold text..</b>
6228 </p><p>..spanning two paragraphs (should not work).<b></b>
6229 </p><p><b>Bold tag left open</b>
6230 </p><p><i>Italic tag left open</i>
6231 </p><p>Normal text.
6232 </p>
6233 <!-- Unmatching number of opening, closing tags: -->
6234 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6235 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6236 </p><p>Plain <i>italic'</i>s plain
6237 </p>
6238 !! end
6239
6240 ###
6241 ### Tables
6242 ###
6243 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6244 ###
6245
6246 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6247 # is the bare minimum required by the spec, see:
6248 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6249 # Parsoid team replies: empty table tags are legal in HTML5
6250 !! test
6251 A table with no data.
6252 !! options
6253 parsoid=wt2html
6254 !! wikitext
6255 {||}
6256 !! html/php
6257 !! html/parsoid
6258 <table></table>
6259 !! end
6260
6261 !! test
6262 A table with stray table end tags on start tag line (wt2html)
6263 !! options
6264 parsoid=wt2html
6265 !! wikitext
6266 {|style="color: red;"|}
6267
6268 {|style="color: red;" |}
6269 |foo
6270 |}
6271
6272 {|style="color: red;"|} id="foo"
6273 |foo
6274 |}
6275
6276 {|style="color: red;" |} id="foo"
6277 |foo
6278 |}
6279 !! html/php+tidy
6280 <table style="color: red;">
6281
6282 </table><table style="color: red;">
6283 <tbody><tr>
6284 <td>foo
6285 </td></tr></tbody></table>
6286 <table style="color: red;" id="foo">
6287 <tbody><tr>
6288 <td>foo
6289 </td></tr></tbody></table>
6290 <table style="color: red;" id="foo">
6291 <tbody><tr>
6292 <td>foo
6293 </td></tr></tbody></table>
6294 !! html/parsoid
6295 <table style="color: red;"></table>
6296
6297 <table style="color: red;">
6298 <tbody><tr>
6299 <td>foo</td>
6300 </tr></tbody>
6301 </table>
6302
6303 <table style="color: red;" id="foo">
6304 <tbody><tr>
6305 <td>foo</td>
6306 </tr></tbody>
6307 </table>
6308
6309 <table style="color: red;" id="foo">
6310 <tbody><tr>
6311 <td>foo</td>
6312 </tr></tbody>
6313 </table>
6314 !! end
6315
6316 !! test
6317 A table with no data (take 2)
6318 !! wikitext
6319 {|
6320 |}
6321 !! html/parsoid
6322 <table></table>
6323 !! end
6324
6325 # A table with nothing but a caption is invalid XHTML, we might want to render
6326 # this as <p>caption</p>
6327 # Parsoid team replies: table with only a caption is legal in HTML5
6328 !! test
6329 A table with nothing but a caption
6330 !! wikitext
6331 {|
6332 |+caption
6333 |}
6334 !! html/php
6335 <table>
6336 <caption>caption
6337 </caption><tr><td></td></tr></table>
6338 !! html/parsoid
6339 <table><caption>caption</caption></table>
6340 !! end
6341
6342 !! test
6343 A table with caption with default-spaced attributes and a table row
6344 !! wikitext
6345 {|
6346 |+ style="color: red;" |caption1
6347 |-
6348 |foo
6349 |}
6350 !! html
6351 <table>
6352 <caption style="color: red;">caption1
6353 </caption>
6354 <tr>
6355 <td>foo
6356 </td></tr></table>
6357 !! end
6358
6359 !! test
6360 A table with captions with non-default spaced attributes and a table row
6361 !! wikitext
6362 {|
6363 |+style="color: red;"|caption2
6364 |+ style="color: red;"|caption3
6365 |-
6366 |foo
6367 |}
6368 !! html
6369 <table>
6370 <caption style="color: red;">caption2
6371 </caption>
6372 <caption style="color: red;">caption3
6373 </caption>
6374 <tr>
6375 <td>foo
6376 </td></tr></table>
6377 !! end
6378
6379 !! test
6380 Table td-cell syntax variations
6381 !! wikitext
6382 {|
6383 |foo bar foo|baz
6384 |foo bar foo||baz
6385 |style='color:red;'|baz
6386 |style='color:red;'||baz
6387 |}
6388 !! html
6389 <table>
6390 <tr>
6391 <td>baz
6392 </td>
6393 <td>foo bar foo</td>
6394 <td>baz
6395 </td>
6396 <td style="color:red;">baz
6397 </td>
6398 <td>style='color:red;'</td>
6399 <td>baz
6400 </td></tr></table>
6401 !! end
6402
6403 !! test
6404 Simple table
6405 !! wikitext
6406 {|
6407 |1||2
6408 |-
6409 |3||4
6410 |}
6411 !! html
6412 <table>
6413 <tr>
6414 <td>1</td>
6415 <td>2
6416 </td></tr>
6417 <tr>
6418 <td>3</td>
6419 <td>4
6420 </td></tr></table>
6421 !! end
6422
6423 !! test
6424 Simple table but with multiple dashes for row wikitext
6425 !! wikitext
6426 {|
6427 |foo
6428 |-----
6429 |bar
6430 |}
6431 !! html
6432 <table>
6433 <tr>
6434 <td>foo
6435 </td></tr>
6436 <tr>
6437 <td>bar
6438 </td></tr></table>
6439 !! end
6440
6441 !! test
6442 Multiplication table
6443 !! wikitext
6444 {| border="1" cellpadding="2"
6445 |+Multiplication table
6446 |-
6447 !&times;!!1!!2!!3
6448 |-
6449 !1
6450 |1||2||3
6451 |-
6452 !2
6453 |2||4||6
6454 |-
6455 !3
6456 |3||6||9
6457 |-
6458 !4
6459 |4||8||12
6460 |-
6461 !5
6462 |5||10||15
6463 |}
6464 !! html
6465 <table border="1" cellpadding="2">
6466 <caption>Multiplication table
6467 </caption>
6468 <tr>
6469 <th>&#215;</th>
6470 <th>1</th>
6471 <th>2</th>
6472 <th>3
6473 </th></tr>
6474 <tr>
6475 <th>1
6476 </th>
6477 <td>1</td>
6478 <td>2</td>
6479 <td>3
6480 </td></tr>
6481 <tr>
6482 <th>2
6483 </th>
6484 <td>2</td>
6485 <td>4</td>
6486 <td>6
6487 </td></tr>
6488 <tr>
6489 <th>3
6490 </th>
6491 <td>3</td>
6492 <td>6</td>
6493 <td>9
6494 </td></tr>
6495 <tr>
6496 <th>4
6497 </th>
6498 <td>4</td>
6499 <td>8</td>
6500 <td>12
6501 </td></tr>
6502 <tr>
6503 <th>5
6504 </th>
6505 <td>5</td>
6506 <td>10</td>
6507 <td>15
6508 </td></tr></table>
6509 !! end
6510
6511 !! test
6512 Accept "||" in table headings
6513 !! wikitext
6514 {|
6515 !h1||h2
6516 |}
6517 !! html
6518 <table>
6519 <tr>
6520 <th>h1</th>
6521 <th>h2
6522 </th></tr></table>
6523 !! end
6524
6525 !! test
6526 Accept "!!" in table data
6527 !! wikitext
6528 {|
6529 |Foo!!||
6530 |}
6531 !! html
6532 <table>
6533 <tr>
6534 <td>Foo!!</td>
6535 <td>
6536 </td></tr></table>
6537 !! html/parsoid
6538 <table>
6539 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6540 </tbody></table>
6541 !! end
6542
6543 !! test
6544 Accept "||" in indented table headings
6545 !! wikitext
6546 :{|
6547 !h1||h2
6548 |}
6549 !! html
6550 <dl><dd><table>
6551 <tr>
6552 <th>h1</th>
6553 <th>h2
6554 </th></tr></table></dd></dl>
6555 !! end
6556
6557 !! test
6558 Accept "!!" in templates
6559 !! wikitext
6560 {|
6561 !a {{echo|b!!c}}
6562 |}
6563 !! html/php
6564 <table>
6565 <tr>
6566 <th>a b</th>
6567 <th>c
6568 </th></tr></table>
6569 !! html/parsoid
6570 <table>
6571 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' 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>
6572 !! end
6573
6574 !! test
6575 Accept "!!" in table headings after newline
6576 !! wikitext
6577 {|
6578 !a
6579 b!!c
6580 |}
6581 !! html/php
6582 <table>
6583 <tr>
6584 <th>a
6585 <p>b!!c
6586 </p>
6587 </th></tr></table>
6588 !! html/parsoid
6589 <table>
6590 <tbody><tr><th>a
6591 <p>b!!c</p></th></tr>
6592 </tbody></table>
6593 !! end
6594
6595 !! test
6596 Accept "!!" in table data of mixed wikitext / html syntax
6597 !! wikitext
6598 {|
6599 !a
6600 <tr><td>b!!c</td></tr>
6601 |}
6602 !! html/php+tidy
6603 <table>
6604 <tbody><tr>
6605 <th>a
6606 </th></tr><tr><td>b!!c</td></tr>
6607 </tbody></table>
6608 !! html/parsoid
6609 <table>
6610 <tbody><tr><th>a</th></tr>
6611 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6612 </tbody></table>
6613 !! end
6614
6615 !! test
6616 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6617 !! wikitext
6618 {|
6619 !|h1
6620 ||a
6621 |}
6622 !! html
6623 <table>
6624 <tr>
6625 <th>h1
6626 </th>
6627 <td>a
6628 </td></tr></table>
6629 !! end
6630
6631 !!test
6632 Accept "| !" at start of line in tables (ignore !-attribute)
6633 !! wikitext
6634 {|
6635 |-
6636 |!style="color:red"|bar
6637 |}
6638 !! html
6639 <table>
6640
6641 <tr>
6642 <td>bar
6643 </td></tr></table>
6644 !!end
6645
6646 !!test
6647 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 +/-
6648 !! wikitext
6649 {|
6650 |-
6651 |style='color:red;'|+1
6652 |style='color:blue;'|-1
6653 |-
6654 |1||2||3
6655 |1||+2||-3
6656 |-
6657 | +1
6658 | -1
6659 |}
6660 !! html
6661 <table>
6662
6663 <tr>
6664 <td style="color:red;">+1
6665 </td>
6666 <td style="color:blue;">-1
6667 </td></tr>
6668 <tr>
6669 <td>1</td>
6670 <td>2</td>
6671 <td>3
6672 </td>
6673 <td>1</td>
6674 <td>+2</td>
6675 <td>-3
6676 </td></tr>
6677 <tr>
6678 <td>+1
6679 </td>
6680 <td>-1
6681 </td></tr></table>
6682 !!end
6683
6684 # Differences between Parsoid and PHP re: trailing whitespace in a
6685 # table cell.
6686 !! test
6687 Table rowspan
6688 !! wikitext
6689 {| border=1
6690 |Cell 1, row 1
6691 |rowspan=2|Cell 2, row 1 (and 2)
6692 |Cell 3, row 1
6693 |-
6694 |Cell 1, row 2
6695 |Cell 3, row 2
6696 |}
6697 !! html/php
6698 <table border="1">
6699 <tr>
6700 <td>Cell 1, row 1
6701 </td>
6702 <td rowspan="2">Cell 2, row 1 (and 2)
6703 </td>
6704 <td>Cell 3, row 1
6705 </td></tr>
6706 <tr>
6707 <td>Cell 1, row 2
6708 </td>
6709 <td>Cell 3, row 2
6710 </td></tr></table>
6711 !! html/parsoid
6712 <table border="1">
6713 <tbody><tr data-parsoid='{"autoInsertedStart":true}'><td>Cell 1, row 1</td>
6714 <td rowspan="2">Cell 2, row 1 (and 2)</td>
6715 <td>Cell 3, row 1</td></tr>
6716 <tr data-parsoid='{"startTagSrc":"|-"}'>
6717 <td>Cell 1, row 2</td>
6718 <td>Cell 3, row 2</td></tr>
6719 </tbody></table>
6720 !! end
6721
6722 !! test
6723 Nested table
6724 !! wikitext
6725 {| border=1
6726 | &alpha;
6727 |
6728 {| bgcolor=#ABCDEF border=2
6729 |nested
6730 |-
6731 |table
6732 |}
6733 |the original table again
6734 |}
6735 !! html
6736 <table border="1">
6737 <tr>
6738 <td>&#945;
6739 </td>
6740 <td>
6741 <table bgcolor="#ABCDEF" border="2">
6742 <tr>
6743 <td>nested
6744 </td></tr>
6745 <tr>
6746 <td>table
6747 </td></tr></table>
6748 </td>
6749 <td>the original table again
6750 </td></tr></table>
6751 !! end
6752
6753 !! test
6754 Invalid attributes in table cell (T3830)
6755 !! wikitext
6756 {|
6757 |Cell:|broken
6758 |}
6759 !! html
6760 <table>
6761 <tr>
6762 <td>broken
6763 </td></tr></table>
6764 !! end
6765
6766 !! test
6767 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6768 !! wikitext
6769 {|
6770 |title="foo" |bar
6771 |title="foo<nowiki>|</nowiki>" |bar
6772 |title="foo<nowiki>|</nowiki>" bar
6773 |}
6774 !! html/php
6775 <table>
6776 <tr>
6777 <td title="foo">bar
6778 </td>
6779 <td title="foo&#124;">bar
6780 </td>
6781 <td>title="foo|" bar
6782 </td></tr></table>
6783 !! html/parsoid
6784 <table>
6785 <tbody><tr><td title="foo">bar</td>
6786 <td title="foo|" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"foo&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[32,50,8,9]}&apos;>|&lt;/span>"}]]}'>bar</td>
6787 <td>title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6788 </tbody></table>
6789 !! end
6790
6791 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6792 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6793 # *2wt modes will fail.
6794 !! test
6795 Table security: embedded pipes
6796 !! options
6797 parsoid=wt2html,html2html
6798 !! wikitext
6799 {|
6800 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6801 !! html/php
6802 <table>
6803 <tr>
6804 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6805 <td>]" onmouseover="alert(document.cookie)"&gt;test
6806 </td>
6807 </tr>
6808 </table>
6809 !! html/parsoid
6810 <table><tbody>
6811 <tr>
6812 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" href="ftp://%7Cx" class="external free" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6813 !! end
6814
6815 !! test
6816 Element attributes with double ! should not be broken up by <th>
6817 !! wikitext
6818 {|
6819 !hi <div class="!!">ha</div> ho
6820 |}
6821 !! html/php
6822 <table>
6823 <tr>
6824 <th>hi <div class="!!">ha</div> ho
6825 </th></tr></table>
6826 !! html/parsoid
6827 <table>
6828 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6829 </tbody></table>
6830 !! end
6831
6832 !! test
6833 ! and || in element attributes should not be parsed as <th>/<td>
6834 !! wikitext
6835 {|
6836 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6837 |}
6838 !! html/php
6839 <table>
6840 <tr>
6841 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6842 </td></tr></table>
6843 !! html/parsoid
6844 <table>
6845 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6846 </tbody></table>
6847 !! end
6848
6849 # FIXME: The output seems broken. Filed as T110268.
6850 !! test
6851 ! and || in td attributes should not be parsed as <th>/<td>
6852 !! options
6853 parsoid=wt2html
6854 !! wikitext
6855 {|
6856 |style="color: red !important;" data-contrived="put this here ||"|foo
6857 |}
6858 !! html/php
6859 <table>
6860 <tr>
6861 <td>style="color: red !important;" data-contrived="put this here</td>
6862 <td>foo
6863 </td></tr></table>
6864 !! html/parsoid
6865 <table>
6866 <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
6867 </tbody></table>
6868 !! end
6869
6870 !! test
6871 Break on | in element attribute in template
6872 !! options
6873 parsoid=wt2html,html2html
6874 !! wikitext
6875 {{echo|1=<div class="hi|ho">ha</div>}}
6876 !! html/php
6877 <p>ho"&gt;ha&lt;/div&gt;
6878 </p>
6879 !! html/parsoid
6880 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</p>
6881 !! end
6882
6883 !! test
6884 Break on | in element attribute name in template
6885 !! wikitext
6886 {{echo|<div cla|ss="hiho">ha</div>}}
6887 !! html/parsoid
6888 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6889 !! end
6890
6891 !! test
6892 Don't break on | in extension attribute in template
6893 !! wikitext
6894 {{echo|<ref name="hi|ho">ha</ref>}}
6895
6896 <references />
6897 !! html/parsoid
6898 <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
6899
6900 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Parser_test#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
6901 !! end
6902
6903 ## We don't support roundtripping of these attributes in Parsoid.
6904 ## Selective serialization takes care of preventing dirty diffs.
6905 ## But, on edits, we dirty-diff the invalid attribute text.
6906 !! test
6907 Invalid text in table attributes should be discarded
6908 !! options
6909 parsoid=wt2html
6910 !! wikitext
6911 {| <span>boo</span> style='border:1px solid black'
6912 | <span>boo</span> style='color:blue' |1
6913 |<span>boo</span> style='color:blue'|2
6914 |}
6915 !! html/php
6916 <table style="border:1px solid black">
6917 <tr>
6918 <td style="color:blue">1
6919 </td>
6920 <td style="color:blue">2
6921 </td></tr></table>
6922 !! html/parsoid
6923 <table style="border:1px solid black">
6924 <tr>
6925 <td style="color:blue">1</td>
6926 <td style="color:blue">2</td>
6927 </tr>
6928 </table>
6929 !! end
6930
6931 !! test
6932 Invalid text in table attributes should be preserved by selective serializer
6933 !! options
6934 parsoid={
6935 "modes": ["selser"],
6936 "changes": [
6937 ["td:first-child", "text", "abc"],
6938 ["td + td", "text", "xyz"]
6939 ]
6940 }
6941 !! wikitext
6942 {| <span>boo</span> style='border:1px solid black'
6943 | <span>boo</span> style='color:blue' | 1
6944 |<span>boo</span> style='color:blue'| 2
6945 |}
6946 !! wikitext/edited
6947 {| <span>boo</span> style='border:1px solid black'
6948 | <span>boo</span> style='color:blue' | abc
6949 |<span>boo</span> style='color:blue'| xyz
6950 |}
6951 !! end
6952
6953 !! test
6954 1. Template-generated table cell attributes and cell content
6955 !! wikitext
6956 {|
6957 |{{table_attribs}}
6958 | {{table_attribs}}
6959 || {{table_attribs_5}}
6960 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6961 |align=center {{table_attribs}}
6962 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6963 |}
6964 !! html
6965 <table>
6966 <tr>
6967 <td style="color:red;">Foo
6968 </td>
6969 <td style="color:red;">Foo
6970 </td>
6971 <td>style="color:red;"</td>
6972 <td>Bar
6973 </td>
6974 <td style="color:red;">Foo
6975 </td>
6976 <td align="center" style="color:red;">Foo
6977 </td>
6978 <td align="center" style="color:red;">Foo
6979 </td></tr></table>
6980 !! end
6981
6982 !! test
6983 2. Template-generated table cell attributes and cell content
6984 !! wikitext
6985 {|
6986 |{{table_attribs_2}}
6987 |}
6988 !! html/php
6989 <table>
6990 <tr>
6991 <td style="color:red;">Foo
6992 </td>
6993 <td>Bar</td>
6994 <td>Baz
6995 </td></tr></table>
6996 !! html/parsoid
6997 <table>
6998 <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>
6999 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
7000 </tbody></table>
7001 !! end
7002
7003 !! test
7004 3. Template-generated table cell attributes and cell content
7005 !! wikitext
7006 {|
7007 !align=center {{table_header_cells}}
7008 |-
7009 |align=center {{table_cells}}
7010 |}
7011 !! html/php
7012 <table>
7013 <tr>
7014 <th align="center" style="color:red;">Foo</th>
7015 <th style="color:red;"><i>Bar</i></th>
7016 <th style="color:brown;"><i>Foo</i> and Baz
7017 </th></tr>
7018 <tr>
7019 <td align="center" style="color:red;">Foo</td>
7020 <td style="color:red;"><i>Bar</i></td>
7021 <td style="color:brown;"><i>Foo</i> and Baz
7022 </td></tr></table>
7023 !! html/parsoid
7024 <table>
7025 <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>
7026 <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>
7027 </tbody></table>
7028 !! end
7029
7030 !! test
7031 4. Template-generated table cell attributes and cell content inside a templated table
7032 !! wikitext
7033 {{tbl-start}}
7034 !align=center {{table_header_cells}}
7035 |-
7036 |align=center {{table_cells}}
7037 {{tbl-end}}
7038 !! html/php
7039 <table>
7040 <tr>
7041 <th align="center" style="color:red;">Foo</th>
7042 <th style="color:red;"><i>Bar</i></th>
7043 <th style="color:brown;"><i>Foo</i> and Baz
7044 </th></tr>
7045 <tr>
7046 <td align="center" style="color:red;">Foo</td>
7047 <td style="color:red;"><i>Bar</i></td>
7048 <td style="color:brown;"><i>Foo</i> and Baz
7049 </td></tr></table>
7050 !! html/parsoid
7051 <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}}]}'>
7052 <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>
7053 <tr>
7054 <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>
7055 </tbody></table>
7056 !! end
7057
7058 ## Edge case fix to prevent future regressions
7059 !! test
7060 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7061 !! wikitext
7062 {|
7063 |{{table_attribs_7}}
7064 |}
7065 <references />
7066 !! html/parsoid
7067 <table>
7068 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
7069 </tbody></table>
7070 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#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" data-parsoid="{}">foo</span></li></ol>
7071 !! end
7072
7073 !! test
7074 Table with row followed by newlines and table heading
7075 !! options
7076 parsoid=wt2html,html2html
7077 !! wikitext
7078 {|
7079 |-
7080
7081 !foo
7082 |}
7083 !! html/*
7084 <table>
7085
7086
7087 <tr>
7088 <th>foo
7089 </th></tr></table>
7090 !! end
7091
7092 !! test
7093 Table with empty line following the start tag
7094 !! options
7095 parsoid=wt2html,html2html
7096 !! wikitext
7097 {|
7098
7099 |-
7100 |foo
7101 |}
7102 !! html/*
7103 <table>
7104
7105
7106 <tr>
7107 <td>foo
7108 </td></tr></table>
7109 !! end
7110
7111 !! test
7112 Table attributes with empty value
7113 !! options
7114 parsoid=wt2html,html2html
7115 !! wikitext
7116 {|
7117 | style=|hello
7118 |}
7119 !! html/php
7120 <table>
7121 <tr>
7122 <td style="">hello
7123 </td></tr></table>
7124 !! html/parsoid
7125 <table>
7126 <tbody><tr><td style="">hello</td></tr>
7127 </tbody></table>
7128 !! end
7129
7130 !! test
7131 Wikitext table with a lot of comments
7132 !! wikitext
7133 {|
7134 <!-- c0 -->
7135 |foo
7136 <!-- c1 -->
7137 |-<!-- c2 -->
7138 <!-- c3 -->
7139 |<!-- c4 -->
7140 <!-- c5 -->
7141 |}
7142 !! html
7143 <table>
7144 <tr>
7145 <td>foo
7146 </td></tr>
7147 <tr>
7148 <td>
7149 </td></tr></table>
7150 !! end
7151
7152 !! test
7153 Wikitext table comments represented in parsoid dom
7154 !! wikitext
7155 {|<!--c1--><!--c2-->
7156 |-<!--c3-->
7157 |x
7158 |}
7159 !! html/php+tidy
7160 <table>
7161
7162 <tbody><tr>
7163 <td>x
7164 </td></tr></tbody></table>
7165 !! html/parsoid
7166 <table><!--c1--><!--c2-->
7167 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7168 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7169 </tbody></table>
7170 !! end
7171
7172 !! test
7173 Wikitext table with double-line table cell
7174 !! wikitext
7175 {|
7176 |a
7177 b
7178 |}
7179 !! html
7180 <table>
7181 <tr>
7182 <td>a
7183 <p>b
7184 </p>
7185 </td></tr></table>
7186 !! end
7187
7188 !! test
7189 Table cell with a single comment
7190 !! wikitext
7191 {|
7192 |<!-- c1 -->
7193 |a
7194 |}
7195 !! html
7196 <table>
7197 <tr>
7198 <td>
7199 </td>
7200 <td>a
7201 </td></tr></table>
7202 !! end
7203
7204 !! test
7205 Table-cell after a comment-only-empty-line
7206 !! wikitext
7207 {|
7208 |a
7209 <!--c1-->
7210 <!--c2-->|b
7211 |}
7212 !! html
7213 <table>
7214 <tr>
7215 <td>a
7216 </td>
7217 <td>b
7218 </td></tr></table>
7219 !! html/parsoid
7220 <table>
7221 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7222 <!--c1-->
7223 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7224 </tbody></table>
7225 !! end
7226
7227 !! test
7228 Build table with {{!}}
7229 !! wikitext
7230 {{{!}} class="wikitable"
7231 !header
7232 !second header
7233 {{!}}- style="color:red;"
7234 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7235 {{!}}}
7236 !! html
7237 <table class="wikitable">
7238 <tr>
7239 <th>header
7240 </th>
7241 <th>second header
7242 </th></tr>
7243 <tr style="color:red;">
7244 <td>data</td>
7245 <td style="color:red;">second data
7246 </td></tr></table>
7247 !! end
7248
7249 !! test
7250 Build table with pipe as data
7251 !! wikitext
7252 {| class="wikitable"
7253 !header
7254 !second header
7255 |- style="color:red;"
7256 |data|| style="color:red;" |second data
7257 |-
7258 | style="color:red;" |data with | || style="color:red;" | second data with |
7259 |-
7260 ||data with | |||second data with |
7261 |}
7262 !! html
7263 <table class="wikitable">
7264 <tr>
7265 <th>header
7266 </th>
7267 <th>second header
7268 </th></tr>
7269 <tr style="color:red;">
7270 <td>data</td>
7271 <td style="color:red;">second data
7272 </td></tr>
7273 <tr>
7274 <td style="color:red;">data with |</td>
7275 <td style="color:red;">second data with |
7276 </td></tr>
7277 <tr>
7278 <td>data with |</td>
7279 <td>second data with |
7280 </td></tr></table>
7281 !! end
7282
7283 !! test
7284 Build table with wikilink
7285 !! wikitext
7286 {| class="wikitable"
7287 !header||second header
7288 |- style="color:red;"
7289 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7290 |-
7291 |data||second data [[Main Page|link|text with pipe]]
7292 |}
7293 !! html
7294 <table class="wikitable">
7295 <tr>
7296 <th>header</th>
7297 <th>second header
7298 </th></tr>
7299 <tr style="color:red;">
7300 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7301 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7302 </td></tr>
7303 <tr>
7304 <td>data</td>
7305 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7306 </td></tr></table>
7307 !! end
7308
7309 # The expected HTML structure in this test is debatable. The PHP parser does
7310 # not parse this kind of table at all. The main focus for Parsoid is on
7311 # round-tripping, so this output is ok for now. TODO: revisit!
7312 !! test
7313 Wikitext table with html-syntax row
7314 !! wikitext
7315 {|
7316 |-
7317 <td>foo</td>
7318 |}
7319 !! html/parsoid
7320 <table>
7321 <tbody>
7322 <tr>
7323 <td>foo</td></tr></tbody></table>
7324 !! end
7325
7326 ## Remex doesn't account for fostered content.
7327 !! test
7328 Fostered content in tables: Plain text
7329 !! options
7330 parsoid=wt2html
7331 !! wikitext
7332 {|
7333 |-
7334 a
7335 |}
7336 !! html/php
7337 <table>
7338
7339 a
7340 </table>
7341 !! html/php+tidy
7342
7343
7344 a
7345 <table></table>
7346 !! html/parsoid
7347 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7348 a</p>
7349 <table>
7350 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7351 !! end
7352
7353 !! test
7354 Fostered content in tables: Lists
7355 !! options
7356 parsoid=wt2html,html2html
7357 !! wikitext
7358 {|
7359 |-
7360 *a
7361 |}
7362 !! html/php
7363 <table>
7364
7365 <ul><li>a</li></ul>
7366 </table>
7367 !! html/php+tidy
7368 <ul><li>a</li></ul><table>
7369
7370
7371 </table>
7372 !! html/parsoid
7373 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7374 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7375
7376 </tr></tbody></table>
7377 !! end
7378
7379 !! test
7380 Template generated table cell with attributes
7381 !! wikitext
7382 {|
7383 |-
7384 {{table_attribs_4}} ||a||b
7385 |}
7386 !! html/php+tidy
7387 <table>
7388
7389 <tbody><tr>
7390 <td style="background-color:#DC241f;" width="10px"></td>
7391 <td>a</td>
7392 <td>b
7393 </td></tr></tbody></table>
7394 !! html/parsoid
7395 <table>
7396 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7397 <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}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
7398 !! end
7399
7400 !! test
7401 Parsoid: Round-trip tables directly followed by content (T53219)
7402 !! options
7403 parsoid=wt2html,wt2wt
7404 !! wikitext
7405 {|
7406 |foo
7407 |} bar
7408
7409 {|
7410 |baz
7411 |}<b>quux</b>
7412 !! html+tidy
7413 <table>
7414 <tbody><tr>
7415 <td>foo
7416 </td></tr></tbody></table><p> bar
7417 </p><table>
7418 <tbody><tr>
7419 <td>baz
7420 </td></tr></tbody></table><p><b>quux</b></p>
7421 !! end
7422
7423 !! test
7424 Parsoid: Default to a newline after tables in new content (T53219)
7425 !! options
7426 parsoid=html2wt
7427 !! html/parsoid
7428 <table><tbody>
7429 <tr><td>foo</td></tr></tbody></table> bar
7430 <table><tbody>
7431 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7432 !! wikitext
7433 {|
7434 |foo
7435 |}
7436 <nowiki> </nowiki>bar
7437 {|
7438 |baz
7439 |}
7440 '''quux'''
7441 !! end
7442
7443 !! test
7444 Parsoid: Row-syntax table headings followed by comment & table cells
7445 !! options
7446 parsoid=wt2html,wt2wt
7447 !! wikitext
7448 {|
7449 !foo||bar
7450 <!-- foo --> ||baz||quux
7451 |}
7452 !! html/php
7453 <table>
7454 <tr>
7455 <th>foo</th>
7456 <th>bar
7457 </th>
7458 <td>baz</td>
7459 <td>quux
7460 </td></tr></table>
7461 !! html/parsoid
7462 <table>
7463 <tbody><tr><th>foo</th><th>bar
7464 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7465 </tbody></table>
7466 !! end
7467
7468 !!test
7469 Parsoid: Recover better from broken table attributes
7470 !!options
7471 parsoid=wt2html
7472 !!wikitext
7473 {| class="foo
7474 | class="bar" |
7475 foo
7476 |}
7477 !!html/php+tidy
7478 <table class="foo">
7479 <tbody><tr>
7480 <td class="bar">
7481 <p>foo
7482 </p>
7483 </td></tr></tbody></table>
7484 !!html/parsoid
7485 <table class="foo">
7486 <tr>
7487 <td class="bar">
7488 <p>foo</p></td></tr>
7489 </tbody></table>
7490 !!end
7491
7492 # Note: PHP parser omits empty rows
7493 !! test
7494 Tables: Digest broken attributes on table and tr tag
7495 !! options
7496 parsoid=wt2html
7497 !! wikitext
7498 {| || |} ++
7499 |- || || ++ --
7500 |- > [
7501 |}
7502 !! html/php+tidy
7503 <table>
7504
7505
7506 </table>
7507 !! html/parsoid
7508 <table>
7509 <tbody>
7510 <tr class='mw-empty-elt'></tr>
7511 <tr class='mw-empty-elt'></tr>
7512 </tbody></table>
7513 !! end
7514
7515 !! test
7516 Table with missing opening <tr> tag
7517 !! options
7518 parsoid=wt2html,wt2wt
7519 !! wikitext
7520 <table>
7521 <td>foo</td>
7522 </tr>
7523 </table>
7524 !! html+tidy
7525 <table>
7526 <tbody><tr><td>foo</td>
7527 </tr>
7528 </tbody></table>
7529 !! end
7530
7531 # T137406: Whitespace in the HTML
7532 !! test
7533 1. Generate correct wikitext for tables with thead/tbody/tfoot
7534 !! options
7535 parsoid=html2wt
7536 !! html/parsoid
7537 <table>
7538 <caption>Test</caption>
7539 <thead>
7540 <tr>
7541 <th>Month</th>
7542 <th>Savings</th>
7543 </tr>
7544 </thead>
7545 <tbody>
7546 <tr>
7547 <td>January</td>
7548 <td>$100</td>
7549 </tr>
7550 <tr>
7551 <td>February</td>
7552 <td>$80</td>
7553 </tr>
7554 </tbody>
7555 <tfoot>
7556 <tr>
7557 <td>Sum</td>
7558 <td>$180</td>
7559 </tr>
7560 </tfoot>
7561 </table>
7562 !! wikitext
7563 {|
7564 |+Test
7565 !Month
7566 !Savings
7567 |-
7568 |January
7569 |$100
7570 |-
7571 |February
7572 |$80
7573 |-
7574 |Sum
7575 |$180
7576 |}
7577 !! html/php+tidy
7578 <table>
7579 <caption>Test
7580 </caption>
7581 <tbody><tr>
7582 <th>Month
7583 </th>
7584 <th>Savings
7585 </th></tr>
7586 <tr>
7587 <td>January
7588 </td>
7589 <td>$100
7590 </td></tr>
7591 <tr>
7592 <td>February
7593 </td>
7594 <td>$80
7595 </td></tr>
7596 <tr>
7597 <td>Sum
7598 </td>
7599 <td>$180
7600 </td></tr></tbody></table>
7601 !! end
7602
7603 # T137406: No whitespace in the HTML
7604 !! test
7605 2. Generate correct wikitext for tables with thead/tbody/tfoot
7606 !! options
7607 parsoid=html2wt
7608 !! html/parsoid
7609 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7610 !! wikitext
7611 {|
7612 !heading
7613 |-
7614 |foo
7615 |}
7616 !! end
7617
7618 !! test
7619 Wikitext tables can be nested inside HTML tables
7620 !! options
7621 parsoid=html2wt
7622 !! html/parsoid
7623 <table data-parsoid='{"stx":"html"}'>
7624 <tr><td>
7625 <table>
7626 <tr><td>foo</td></tr>
7627 </table>
7628 </td></tr>
7629 </table>
7630 !! wikitext
7631 <table>
7632 <tr><td>
7633 {|
7634 |foo
7635 |}
7636 </td></tr>
7637 </table>
7638 !! html/php+tidy
7639 <table>
7640 <tbody><tr><td>
7641 <table>
7642 <tbody><tr>
7643 <td>foo
7644 </td></tr></tbody></table>
7645 </td></tr>
7646 </tbody></table>
7647 !! end
7648
7649 ###
7650 ### Internal links
7651 ###
7652 !! test
7653 Plain link, capitalized
7654 !! wikitext
7655 [[Main Page]]
7656 !! html
7657 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7658 </p>
7659 !! end
7660
7661 !! test
7662 Plain link, uncapitalized
7663 !! wikitext
7664 [[main Page]]
7665 !! html
7666 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7667 </p>
7668 !! end
7669
7670 !! test
7671 Piped link
7672 !! wikitext
7673 [[Main Page|The Main Page]]
7674 !! html
7675 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7676 </p>
7677 !! end
7678
7679 !! test
7680 Piped link with comment in link text
7681 !! wikitext
7682 [[Main Page|The Main<!--front--> Page]]
7683 !! html
7684 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7685 </p>
7686 !! end
7687
7688 !! test
7689 Piped link with multiple pipe characters in link text
7690 !! wikitext
7691 [[Main Page||The|Main|Page|]]
7692 !! html/php
7693 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7694 </p>
7695 !! html/parsoid
7696 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7697 !! end
7698
7699 !! test
7700 Piped link with no link text
7701 !! wikitext
7702 [[Thomas Bek (bishop of St David's)|]]
7703 !! html/php
7704 <p>[[Thomas Bek (bishop of St David's)|]]
7705 </p>
7706 !! html/parsoid
7707 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7708 !! end
7709
7710 !! test
7711 Piped link with empty link text
7712 !! wikitext
7713 [[Main Page|<nowiki/>]] - empty nowiki
7714 [[Main Page| ]] - empty space
7715 [[Main Page|&nbsp;]] - empty non breaking space
7716 !! html/php
7717 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7718 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7719 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7720 </p>
7721 !! html/parsoid
7722 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7723 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7724 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7725 !! end
7726
7727 !! test
7728 Broken link
7729 !! wikitext
7730 [[Zigzagzogzagzig]]
7731 !! html
7732 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7733 </p>
7734 !! end
7735
7736 # The PHP parser strips the hash fragment for non-existent pages, but
7737 # Parsoid does not. (T227693)
7738 !! test
7739 Broken link with fragment
7740 !! wikitext
7741 [[Zigzagzogzagzig#zug]]
7742 !! html/php
7743 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7744 </p>
7745 !! html/parsoid
7746 <p><a rel="mw:WikiLink" href="./Zigzagzogzagzig#zug" title="Zigzagzogzagzig" data-parsoid="{&quot;tsr&quot;:[0,23],&quot;src&quot;:&quot;[[Zigzagzogzagzig#zug]]&quot;,&quot;bsp&quot;:[0,23],&quot;stx&quot;:&quot;simple&quot;}">Zigzagzogzagzig#zug</a></p>
7747 !! end
7748
7749 !! test
7750 Special page link with fragment
7751 !! wikitext
7752 [[Special:Version#anchor]]
7753 !! html
7754 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7755 </p>
7756 !! end
7757
7758 # Parsoid does not strip fragment from red links: T227693
7759 !! test
7760 Nonexistent special page link with fragment
7761 !! wikitext
7762 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7763 !! html/php
7764 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7765 </p>
7766 !! html/parsoid
7767 <p><a rel="mw:WikiLink" href="./Special:ThisNameWillHopefullyNeverBeUsed#anchor" title="Special:ThisNameWillHopefullyNeverBeUsed">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a></p>
7768 !! end
7769
7770 !! test
7771 Link with prefix
7772 !! wikitext
7773 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7774 !! html
7775 <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>
7776 </p>
7777 !! end
7778
7779 !! test
7780 Link with suffix
7781 !! wikitext
7782 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7783 !! html
7784 <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>!!!
7785 </p>
7786 !! end
7787
7788 !! article
7789 prefixed article
7790 !! text
7791 Some text
7792 !! endarticle
7793
7794 !! test
7795 T45661: Piped links with identical prefixes
7796 !! wikitext
7797 [[prefixed article|prefixed articles with spaces]]
7798
7799 [[prefixed article|prefixed articlesaoeu]]
7800
7801 [[Main Page|Main Page test]]
7802 !! html
7803 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7804 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7805 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7806 </p>
7807 !! end
7808
7809
7810 !! test
7811 Link with HTML entity in suffix / tail
7812 !! wikitext
7813 [[Main Page]]&quot;, [[Main Page]]&#97;
7814 !! html/php
7815 <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;
7816 </p>
7817 !! html/parsoid
7818 <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>
7819 !! end
7820
7821 !! test
7822 Link with 3 brackets
7823 !! wikitext
7824 [[[Main Page]]]
7825 Foo [[[Main Page]]]
7826 !! html
7827 <p>[[[Main Page]]]
7828 Foo [[[Main Page]]]
7829 </p>
7830 !! end
7831
7832 !! test
7833 Link with 4 brackets
7834 !! wikitext
7835 [[[[Main Page]]]]
7836 !! html
7837 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7838 </p>
7839 !! end
7840
7841 !! test
7842 Piped link with 3 brackets
7843 !! wikitext
7844 [[[main page|the main page]]]
7845 !! html
7846 <p>[[[main page|the main page]]]
7847 </p>
7848 !! end
7849
7850 !! test
7851 Piped link with extlink-like text
7852 !! wikitext
7853 [[Main Page|[bar]]]
7854 [[Main Page|This is a [bar]]]
7855 [[Main Page|[bar]]
7856 !! html/php
7857 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7858 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7859 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7860 </p>
7861 !! html/parsoid
7862 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7863 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7864 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7865 !! end
7866
7867 !! test
7868 Link with multiple pipes
7869 !! wikitext
7870 [[Main Page|The|Main|Page]]
7871 !! html
7872 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Anchor containing a #. (T65430)
7878 !! config
7879 wgFragmentMode=[ 'html5', 'legacy' ]
7880 !! wikitext
7881 [[Main Page#And#Link]]
7882 !! html/php
7883 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7884 </p>
7885 !! html/parsoid
7886 <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7887 !! end
7888
7889 !! test
7890 Link to namespaces
7891 !! wikitext
7892 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7893 !! html
7894 <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>
7895 </p>
7896 !! end
7897
7898 !! test
7899 Link with space in namespace
7900 !! wikitext
7901 [[User talk:Foo bar]]
7902 !! html
7903 <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>
7904 </p>
7905 !! end
7906
7907 !! article
7908 MemoryAlpha:AlphaTest
7909 !! text
7910 This is an article in the MemoryAlpha namespace
7911 (which shadows the memoryalpha interwiki link).
7912 !! endarticle
7913
7914 !! test
7915 Namespace takes precedence over interwiki link (T53680)
7916 !! wikitext
7917 [[MemoryAlpha:AlphaTest]]
7918 !! html
7919 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7920 </p>
7921 !! end
7922
7923 # The previous test doesn't work correctly in html2*, due to not recognizing the
7924 # link as an internal one. This one checks for the correct behavior.
7925 !! test
7926 Link to namespace preferred over interwiki with correct rel attribute
7927 !! options
7928 parsoid=html2wt,html2html
7929 !! html/parsoid
7930 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7931 !! wikitext
7932 [[MemoryAlpha:AlphaTest]]
7933 !! end
7934
7935 !! test
7936 Piped link to namespace
7937 !! wikitext
7938 [[Meta:Disclaimers|The disclaimers]]
7939 !! html
7940 <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>
7941 </p>
7942 !! end
7943
7944 !! test
7945 Link containing }
7946 !! wikitext
7947 [[Usually caused by a typo (oops}]]
7948 !! html
7949 <p>[[Usually caused by a typo (oops}]]
7950 </p>
7951 !! end
7952
7953 !! article
7954 7% Solution
7955 !! text
7956 Just a test of an article title containing a percent.
7957 !! endarticle
7958
7959 !! test
7960 Link containing % (not as a hex sequence)
7961 !! wikitext
7962 [[7% Solution]]
7963 [[7% Solution|7%25 Solution]]
7964 !! html/php
7965 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7966 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7967 </p>
7968 !! html/parsoid
7969 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7970 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7971 !! end
7972
7973 # note that the parsoid HTML is identical to the previous test output,
7974 # so the previous test ensures that the html2wt mode will generate the
7975 # "not as a hex sequence" wikitext.
7976 !! test
7977 Link containing % as a single hex sequence interpreted to char
7978 !! options
7979 parsoid=wt2wt,wt2html,html2html
7980 !! wikitext
7981 [[7%25 Solution]]
7982 [[7%25 Solution|7%25 Solution]]
7983 !! html/php
7984 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7985 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7986 </p>
7987 !! html/parsoid
7988 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7989 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7990 !!end
7991
7992 !! test
7993 Link containing % as a double hex sequence interpreted to hex sequence
7994 !! wikitext
7995 [[7%2525 Solution]]
7996 !! html
7997 <p>[[7%2525 Solution]]
7998 </p>
7999 !!end
8000
8001 ## Example for such a section: == < ==
8002 !! test
8003 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
8004 !! options
8005 title=[[Main Page]]
8006 !! config
8007 wgFragmentMode=[ 'html5', 'legacy' ]
8008 !! wikitext
8009 [[%23%3c]][[%23%3e]]
8010 !! html/php
8011 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
8012 </p>
8013 !! html/parsoid
8014 <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
8015 !! end
8016
8017 ## Example for such a section: == < ==
8018 !! test
8019 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
8020 !! config
8021 wgFragmentMode=[ 'legacy' ]
8022 !! wikitext
8023 [[%23%3c]][[%23%3e]]
8024 !! html/php
8025 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
8026 </p>
8027 !! end
8028
8029 !! test
8030 Link containing "<#" and ">#" as a hex sequences
8031 !! wikitext
8032 [[%3c%23]][[%3e%23]]
8033 !! html
8034 <p>[[%3c%23]][[%3e%23]]
8035 </p>
8036 !! end
8037
8038 !! test
8039 Link containing an equals sign
8040 !! wikitext
8041 [[Special:BookSources/isbn=4-00-026157-6]]
8042 !! html/php
8043 <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>
8044 </p>
8045 !! html/parsoid
8046 <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>
8047 !! end
8048
8049 !! article
8050 Foo & bar
8051 !! text
8052 Just a test of an article title containing an ampersand
8053 !! endarticle
8054
8055 !! test
8056 Link containing an ampersand
8057 !! wikitext
8058 [[Foo & bar]]
8059
8060 [[Foo &amp; bar]]
8061
8062 [[Foo &amp;amp; bar]]
8063 !! html/php+tidy
8064 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8065 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8066 </p><p>[[Foo &amp;amp; bar]]
8067 </p>
8068 !! html/parsoid
8069 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
8070 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar" data-parsoid='{"stx":"simple","a":{"href":"./Foo_&amp;_bar"},"sa":{"href":"Foo &amp;amp; bar"}}'>Foo &amp; bar</a></p>
8071 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
8072 !! end
8073
8074 !! article
8075 Foo~bar
8076 !! text
8077 Just a test of an article title containing a tilde.
8078 !! endarticle
8079
8080 # note that links containing signatures, like [[Foo~~~~]], are
8081 # massaged by the pre-save transform (PST) and so the tildes are never
8082 # seen by the parser.
8083 !! test
8084 Link containing a tilde
8085 !! wikitext
8086 [[Foo~bar]]
8087 !! html/php
8088 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8089 </p>
8090 !! html/parsoid
8091 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8092 !! end
8093
8094 !! test
8095 Link containing double-single-quotes '' (T6598)
8096 !! wikitext
8097 [[Lista d''e paise d''o munno]]
8098 !! html/php
8099 <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&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
8100 </p>
8101 !! html/parsoid
8102 <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>
8103 !! end
8104
8105 !! test
8106 Link containing double quotes and spaces
8107 !! wikitext
8108 [[Cool "Gator"]]
8109 !! html/php
8110 <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
8111 </p>
8112 !! html/parsoid
8113 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8114 !! end
8115
8116 !! test
8117 File containing double quotes and spaces
8118 !! wikitext
8119 [[File:Cool "Gator".png]]
8120 !! html/php+tidy
8121 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Cool_%22Gator%22.png" class="new" title="File:Cool &quot;Gator&quot;.png">File:Cool "Gator".png</a>
8122 </p>
8123 !! html/parsoid
8124 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Cool_%22Gator%22.png"><span resource='./File:Cool_"Gator".png' data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png"},"sa":{"resource":"File:Cool \"Gator\".png"}}'>File:Cool "Gator".png</span></a></figure-inline></p>
8125 !! end
8126
8127 !! test
8128 File containing single quotes
8129 !! wikitext
8130 [[File:Foo's ''italic'' bar.jpg]]
8131 [[File:Foo's ''italic'' bar.jpg|Foo's ''italic'' bar]]
8132 !! html/php+tidy
8133 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo%27s_%27%27italic%27%27_bar.jpg" class="new" title="File:Foo&#39;s &#39;&#39;italic&#39;&#39; bar.jpg">File:Foo's <i>italic</i> bar.jpg</a>
8134 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo%27s_%27%27italic%27%27_bar.jpg" class="new" title="File:Foo&#39;s &#39;&#39;italic&#39;&#39; bar.jpg">Foo's italic bar</a>
8135 </p>
8136 !! end
8137
8138 !! test
8139 Redirect containing double quotes and spaces
8140 !! wikitext
8141 #REDIRECT [[Cool "Gator"]]
8142 !! html/parsoid
8143 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8144 !! end
8145
8146 !! test
8147 Link containing double-single-quotes '' in text (T6598 sanity check)
8148 !! wikitext
8149 Some [[Link|pretty ''italics'' and stuff]]!
8150 !! html/php
8151 <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>!
8152 </p>
8153 !! html/parsoid
8154 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8155 !! end
8156
8157 !! test
8158 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8159 !! wikitext
8160 ''Some [[Link|pretty ''italics'' and stuff]]!''
8161 !! html
8162 <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>
8163 </p>
8164 !! end
8165
8166 ## FIXME: Title part of filename is interpreted in php
8167 !! test
8168 Link with double quotes in title part (literal) and alternate part (interpreted)
8169 !! wikitext
8170 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8171
8172 [[''Pentecoste'']]
8173
8174 [[''Pentecoste''|Pentecoste]]
8175
8176 [[''Pentecoste''|''Pentecoste'']]
8177 !! html/php
8178 <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>
8179 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
8180 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
8181 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
8182 </p>
8183 !! html/parsoid
8184 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg"><span resource="./File:Denys_Savchenko_''Pentecoste''.jpg" data-parsoid='{"a":{"resource":"./File:Denys_Savchenko_&apos;&apos;Pentecoste&apos;&apos;.jpg"},"sa":{"resource":"File:Denys_Savchenko_&apos;&apos;Pentecoste&apos;&apos;.jpg"}}'>File:Denys Savchenko ''Pentecoste''.jpg</span></a></figure-inline></p>
8185 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8186 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8187 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8188 !! end
8189
8190 !! test
8191 Broken image links with HTML captions (T41700)
8192 !! wikitext
8193 [[File:Nonexistent|<script></script>]]
8194 [[File:Nonexistent|100x100px|<script></script>]]
8195 [[File:Nonexistent|&lt;]]
8196 [[File:Nonexistent|a<i>b</i>c]]
8197 !! html/php
8198 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script>&lt;/script></a>
8199 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script>&lt;/script></a>
8200 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8201 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8202 </p>
8203 !! html/parsoid
8204 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"caption":"&amp;lt;script>&amp;lt;/script>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline>
8205 <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"caption":"&amp;lt;script>&amp;lt;/script>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-width="100" data-height="100" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline>
8206 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&apos;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&apos;>&amp;lt;&lt;/span>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline>
8207 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"caption":"a&lt;i data-parsoid=&apos;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&apos;>b&lt;/i>c","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent"><span resource="./File:Nonexistent" data-parsoid='{"a":{"resource":"./File:Nonexistent"},"sa":{"resource":"File:Nonexistent"}}'>File:Nonexistent</span></a></figure-inline></p>
8208 !! end
8209
8210 !! test
8211 Plain link to URL
8212 !! wikitext
8213 [[http://www.example.com]]
8214 !! html/php
8215 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8216 </p>
8217 !! html/parsoid
8218 <p>[<a rel="mw:ExtLink" href="http://www.example.com" class="external autonumber"></a>]</p>
8219 !! end
8220
8221 !! test
8222 Plain link to URL with link text
8223 !! wikitext
8224 [[http://www.example.com Link text]]
8225 !! html
8226 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8227 </p>
8228 !! end
8229
8230 !! test
8231 Plain link to URL containing special characters, with link text (see T213950).
8232 !! wikitext
8233 [[http://www.example.com/?q=%7Babc%7D Link text]]
8234 !! html
8235 <p>[<a rel="nofollow" class="external text" href="http://www.example.com/?q=%7Babc%7D">Link text</a>]
8236 </p>
8237 !! end
8238
8239 !! test
8240 Plain link to protocol-relative URL
8241 !! wikitext
8242 [[//www.example.com]]
8243 !! html/php
8244 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8245 </p>
8246 !! html/parsoid
8247 <p>[<a rel="mw:ExtLink" href="//www.example.com" class="external autonumber"></a>]</p>
8248 !! end
8249
8250 !! test
8251 Plain link to protocol-relative URL with link text
8252 !! wikitext
8253 [[//www.example.com Link text]]
8254 !! html
8255 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8256 </p>
8257 !! end
8258
8259 !! test
8260 Plain link to page with question mark in title
8261 !! wikitext
8262 [[A?b]]
8263
8264 [[A?b|Baz]]
8265 !! html
8266 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8267 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8268 </p>
8269 !! end
8270
8271 # I'm fairly sure the expected result here is wrong.
8272 # We want these to be URL links, not pseudo-pages with URLs for titles....
8273 # However the current output is also pretty screwy.
8274 #
8275 # ----
8276 # I'm changing it to match the current output--it arguably makes more
8277 # sense in the light of the test above. Old expected result was:
8278 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8279 #</p>
8280 # But I think this test is bordering on "garbage in, garbage out" anyway.
8281 # -- wtm
8282 !! test
8283 Piped link to URL
8284 !! wikitext
8285 Piped link to URL: [[http://www.example.com|an example URL]]
8286 !! html/php
8287 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8288 </p>
8289 !! html/parsoid
8290 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com%7Can" class="external text" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8291 !! end
8292
8293 !! test
8294 Plain link in template argument
8295 !! options
8296 parsoid=wt2html
8297 !! wikitext
8298 {{echo|[http://www.example.com |123]}}
8299
8300 {{echo|[[http://www.example.com |123]]}}
8301
8302 {{echo|[[http://www.example.com |123]}}
8303
8304 {{echo|[http://www.example.com |123]]}}
8305 !! html/php
8306 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8307 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8308 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8309 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8310 </p>
8311 !! html/parsoid
8312 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://www.example.com" class="external free">http://www.example.com</a> </p>
8313
8314 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://www.example.com" class="external text">|123</a>]</p>
8315
8316 <p>{{echo|[<a rel="mw:ExtLink" href="http://www.example.com" class="external text" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8317
8318 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" href="http://www.example.com" class="external free">http://www.example.com</a> </p>
8319 !! end
8320
8321 !! test
8322 T2002: [[page|http://url/]] should link to page, not http://url/
8323 !! wikitext
8324 [[Main Page|http://url/]]
8325 !! html/php
8326 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8327 </p>
8328 !! html/parsoid
8329 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8330 !! end
8331
8332 # Parsoid does not mark self-links, by design.
8333 !! test
8334 T2337: Escaped self-links should be bold
8335 !! options
8336 title=[[Bug462]]
8337 !! wikitext
8338 [[Bu&#103;462]] [[Bug462]]
8339 !! html/php+tidy
8340 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8341 </p>
8342 !! html/parsoid
8343 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8344 !! end
8345
8346 !! test
8347 Self-link to section should not be bold
8348 !! options
8349 title=[[Main Page]]
8350 !! wikitext
8351 [[Main Page#section]]
8352 !! html
8353 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8354 </p>
8355 !! end
8356
8357 !! article
8358 00
8359 !! text
8360 This is 00.
8361 !! endarticle
8362
8363 !!test
8364 Self-link to numeric title
8365 !!options
8366 title=[[0]]
8367 !! wikitext
8368 [[0]]
8369 !! html
8370 <p><a class="mw-selflink selflink">0</a>
8371 </p>
8372 !!end
8373
8374 !!test
8375 Link to numeric-equivalent title
8376 !!options
8377 title=[[0]]
8378 !! wikitext
8379 [[00]]
8380 !! html
8381 <p><a href="/wiki/00" title="00">00</a>
8382 </p>
8383 !!end
8384
8385 !! test
8386 <nowiki> inside a link
8387 !! wikitext
8388 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8389 !! html/php+tidy
8390 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8391 </p>
8392 !! html/parsoid
8393 <p>[[Main<span typeof="mw:Nowiki"> Page</span>]] <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">the main page <span typeof="mw:Nowiki">[it's not very good]</span></a></p>
8394 !! end
8395
8396 ## Parsoid doesn't get this right and even fails wt2html because, when doing the
8397 ## normalization for comparison, the html serialization / re-parse doesn't
8398 ## roundtrip. This is T49963
8399 !! test
8400 <pre> inside a link
8401 !! wikitext
8402 [[Main<pre> Page</pre>]] [[Main Page|the main page <pre>[it's not very good]</pre>]]
8403 !! html/php+tidy
8404 <p>[[Main</p><pre> Page</pre><p>]] <a href="/wiki/Main_Page" title="Main Page">the main page </a></p><a href="/wiki/Main_Page" title="Main Page"><pre>[it's not very good]</pre></a>
8405 !! html/parsoid
8406 <p>[[Main</p><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":" Page"}}'> Page</pre><p>]] <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">the main page <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"[it&apos;s not very good]"}}'>[it's not very good]</pre></a></p>
8407 !! end
8408
8409 !! test
8410 Non-breaking spaces in title
8411 !! wikitext
8412 [[&nbsp; Main &nbsp; Page &nbsp;]]
8413 !! html
8414 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8415 </p>
8416 !!end
8417
8418 # Add new article for the test below so that it doesn't red-link
8419 !! article
8420 Foo bar baz
8421 !! text
8422 boo
8423 !! endarticle
8424
8425 !! test
8426 Multiple spaces in titles should normalize to a single underscore
8427 !! options
8428 parsoid=wt2html,wt2wt
8429 !! wikitext
8430 [[Foo bar baz|x]]
8431 [[Foo bar baz|x]]
8432 [[Foo bar baz|x]]
8433 !! html/php
8434 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8435 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8436 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8440 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8441 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8442 </p>
8443 !! end
8444
8445 !! test
8446 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8447 !! options
8448 language=ca
8449 !! wikitext
8450 '''[[Main Page]]'''
8451 !! html
8452 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8453 </p>
8454 !! end
8455
8456 !! test
8457 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8458 !! options
8459 language=ca
8460 !! wikitext
8461 ''[[Main Page]]''
8462 !! html
8463 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8464 </p>
8465 !! end
8466
8467 !! test
8468 Internal link with en linktrail: no apostrophes (T29473)
8469 !! options
8470 language=en
8471 !! wikitext
8472 [[Something]]'nice
8473 !! html
8474 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8475 </p>
8476 !! end
8477
8478 !! test
8479 Internal link with ca linktrail with apostrophes (T29473)
8480 !! options
8481 language=ca
8482 !! wikitext
8483 [[Something]]'nice
8484 !! html
8485 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8486 </p>
8487 !! end
8488
8489 !! test
8490 Internal link with kaa linktrail with apostrophes (T29473)
8491 !! options
8492 language=kaa
8493 !! wikitext
8494 [[Something]]'nice
8495 !! html
8496 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
8497 </p>
8498 !! end
8499
8500 !! test
8501 Link with multiple ":" in a subpage-supporting namespace (T65636)
8502 !! wikitext
8503 [[User:Foo/Test/63636:Bar|Test]]
8504 !! html/php
8505 <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>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8509 !! end
8510
8511 ## Mainly a sanity check for Parsoid
8512 !! test
8513 Handle title parsing for subpages
8514 !! options
8515 title=[[/123123]]
8516 subpage
8517 !! wikitext
8518 123
8519 !! html/php
8520 <p>123
8521 </p>
8522 !! html/parsoid
8523 <p>123</p>
8524 !! end
8525
8526 !! article
8527 User:Test/123
8528 !! text
8529 test 123
8530 !! endarticle
8531
8532 !! test
8533 Link to a subpage from a namespace other than main
8534 !! options
8535 title=[[User:Test]]
8536 subpage
8537 !! wikitext
8538 [[/123]]
8539 !! html/php
8540 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8541 </p>
8542 !! html/parsoid
8543 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8544 !! end
8545
8546 !! test
8547 Ensure that transclusion titles are not url-decoded
8548 !! options
8549 subpage title=[[Test]]
8550 parsoid=wt2html
8551 !! wikitext
8552 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8553 !! html/php
8554 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8555 </p>
8556 !! html/parsoid
8557 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8558 !! end
8559
8560 !! test
8561 Purely hash wikilink
8562 !! options
8563 title=[[User:Test/123]]
8564 subpage
8565 !! wikitext
8566 [[#a|b]]
8567 !! html/php
8568 <p><a href="#a">b</a>
8569 </p>
8570 !! html/parsoid
8571 <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>
8572 !! end
8573
8574 !! test
8575 Serialization of purely hash wikilink
8576 !! options
8577 title=[[User:Test/123]]
8578 subpage
8579 parsoid=html2wt
8580 !! html/parsoid
8581 <p><a href="#a">[[</a></p>
8582 !! wikitext
8583 [[#a|<nowiki>[[</nowiki>]]
8584 !! html/php
8585 <p><a href="#a">[[</a>
8586 </p>
8587 !! end
8588
8589 !! test
8590 1. Interaction of linktrail and template encapsulation
8591 !! wikitext
8592 {{echo|[[Foo]]}}l
8593 !! html/php+tidy
8594 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8595 </p>
8596 !! html/parsoid
8597 <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>
8598 !! end
8599
8600 !! test
8601 2. Interaction of linktrail and template encapsulation
8602 !! wikitext
8603 {{echo|Some [[Fool]]}}s
8604 !! html/php+tidy
8605 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8606 </p>
8607 !! html/parsoid
8608 <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"}]]}'>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>
8609 !! end
8610
8611 !! test
8612 3. Interaction of linktrail and template encapsulation
8613 !! wikitext
8614 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8615 !! html/php+tidy
8616 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a> are <b>bold and foolish</b>
8617 </p>
8618 !! html/parsoid
8619 <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"}]]}'>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>
8620 !! end
8621
8622 !! article
8623 Söfnuður
8624 !! text
8625 Test.
8626 !! endarticle
8627
8628 !! test
8629 Internal link with is link prefix
8630 !! options
8631 language=is
8632 !! wikitext
8633 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8634 !! html
8635 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8636 </p>
8637 !! end
8638
8639 !! article
8640 Mótmælendatrú
8641 !! text
8642 Test.
8643 !! endarticle
8644
8645 !! test
8646 Internal link with is link trail and link prefix
8647 !! options
8648 language=is
8649 !! wikitext
8650 [[mótmælendatrú|xxx]]ar
8651 [[mótmælendatrú]]ar
8652 mótmælenda[[söfnuður]]
8653 mótmælenda[[söfnuður|söfnuðir]]
8654 mótmælenda[[söfnuður|söfnuðir]]xxx
8655 !! html
8656 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8657 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8658 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8659 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8660 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8661 </p>
8662 !! end
8663
8664 !! test
8665 Parsoid link trail escaping
8666 !! options
8667 parsoid=html2wt,html2html
8668 !! html/parsoid
8669 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8670 !! wikitext
8671 [[apple]]<nowiki/>s
8672 !! end
8673
8674 !! test
8675 Parsoid link prefix escaping
8676 !! options
8677 language=is
8678 parsoid=html2wt,html2html
8679 !! html/parsoid
8680 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8681 !! wikitext
8682 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8683 !! end
8684
8685 !! test
8686 Parsoid link bracket escaping
8687 !! options
8688 parsoid=html2wt,html2html
8689 !! html/parsoid
8690 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8691 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8692 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8693 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8694 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8695 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8696 !! wikitext
8697 [[Test]]
8698
8699 [<nowiki/>[[Test]]]
8700
8701 [[[[Test]]]]
8702
8703 [[[<nowiki/>[[Test]]]]]
8704
8705 [[[[[[Test]]]]]]
8706
8707 [[[[[<nowiki/>[[Test]]]]]]]
8708 !! end
8709
8710 !! test
8711 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8712 !! wikitext
8713 [[Foo| bar]]
8714
8715 [[Foo| ''bar'']]
8716
8717 [http://wp.org foo]
8718
8719 [http://wp.org ''foo'']
8720 !! html
8721 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8722 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8723 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8724 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8725 </p>
8726 !! end
8727
8728 !! test
8729 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8730 !! wikitext
8731 [[Foo|{{echo|a}} b {{echo|c}}]]
8732 !! html/parsoid
8733 <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>
8734 !! end
8735
8736 !! test
8737 Link with angle bracket after anchor
8738 !! config
8739 wgFragmentMode=[ 'html5', 'legacy' ]
8740 !! wikitext
8741 [[Foo#<bar>]]
8742 !! html/php
8743 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8744 </p>
8745 !! html/parsoid
8746 <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8747 !! end
8748
8749 !! test
8750 Link with angle bracket after anchor (legacy)
8751 !! config
8752 wgFragmentMode=[ 'legacy' ]
8753 !! wikitext
8754 [[Foo#<bar>]]
8755 !! html/php
8756 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8757 </p>
8758 !! end
8759
8760 ###
8761 ### Interwiki links (see maintenance/interwiki.sql)
8762 ###
8763
8764 !! test
8765 Inline interwiki link
8766 !! options
8767 parsoid=wt2html,wt2wt,html2html
8768 !! wikitext
8769 [[MeatBall:SoftSecurity]]
8770 !! html/php
8771 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8772 </p>
8773 !! html/parsoid
8774 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8775 !! end
8776
8777 !! test
8778 Inline interwiki link with empty title (T4372)
8779 !! options
8780 parsoid=wt2html,wt2wt,html2html
8781 !! wikitext
8782 [[MeatBall:]]
8783 !! html/php
8784 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8785 </p>
8786 !! html/parsoid
8787 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8788 !! end
8789
8790 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8791 !! test
8792 Interwiki link encoding conversion (T3636)
8793 !! options
8794 parsoid=wt2html,wt2wt
8795 !! wikitext
8796 *[[Wikipedia:ro:Olteni&#0355;a]]
8797 *[[Wikipedia:ro:Olteni&#355;a]]
8798 !! html/php
8799 <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>
8800 <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>
8801 !! html/php+tidy
8802 <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>
8803 <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>
8804 !! html/parsoid
8805 <ul>
8806 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8807 <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8808 </ul>
8809 !! end
8810
8811 !! test
8812 Interwiki link with fragment (T4130)
8813 !! wikitext
8814 [[MeatBall:SoftSecurity#foo]]
8815 !! html
8816 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8817 </p>
8818 !! end
8819
8820 ## The interwiki case here continued to be legacy escaped because of the
8821 ## default setting of $wgExternalInterwikiFragmentMode
8822 !! test
8823 Link scenarios with escaped fragments
8824 !! options
8825 title=[[Main Page]]
8826 !! config
8827 wgFragmentMode=[ 'html5', 'legacy' ]
8828 !! wikitext
8829 [[#Is this great?]]
8830 [[Foo#Is this great?]]
8831 [[meatball:Foo#Is this great?]]
8832 !! html/php
8833 <p><a href="#Is_this_great?">#Is this great?</a>
8834 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8835 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8836 </p>
8837 !! html/parsoid
8838 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8839 <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8840 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8841 !! end
8842
8843 !! test
8844 Link scenarios with escaped fragments (legacy)
8845 !! config
8846 wgFragmentMode=[ 'legacy' ]
8847 !! wikitext
8848 [[#Is this great?]]
8849 [[Foo#Is this great?]]
8850 [[meatball:Foo#Is this great?]]
8851 !! html/php
8852 <p><a href="#Is_this_great.3F">#Is this great?</a>
8853 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8854 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8855 </p>
8856 !! end
8857
8858 # Ideally the wikipedia: prefix here should be proto-relative too
8859 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8860 # define the 'en' prefix, and originally the test used 'wikipedia',
8861 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8862 # article.
8863 !! test
8864 Different interwiki prefixes mapping to the same URL
8865 !! wikitext
8866 [[:en:Foo]]
8867
8868 [[:en:Foo|Foo]]
8869
8870 [[wikipedia:Foo]]
8871
8872 [[:wikipedia:Foo|Foo]]
8873
8874 [[wikipedia:en:Foo]]
8875
8876 [[:wikipedia:en:Foo]]
8877
8878 [[ wikiPEdia :Foo]]
8879 !! html/parsoid
8880 <p><a rel="mw:WikiLink/Interwiki" 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>
8881
8882 <p><a rel="mw:WikiLink/Interwiki" 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>
8883
8884 <p><a rel="mw:WikiLink/Interwiki" 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>
8885
8886 <p><a rel="mw:WikiLink/Interwiki" 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>
8887
8888 <p><a rel="mw:WikiLink/Interwiki" 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>
8889
8890 <p><a rel="mw:WikiLink/Interwiki" 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>
8891
8892 <p><a rel="mw:WikiLink/Interwiki" 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>
8893 !! end
8894
8895 !! test
8896 Interwiki links that cannot be represented in wiki syntax
8897 !! wikitext
8898 [[meatball:ok]]
8899 [[meatball:ok#foo|ok with fragment]]
8900 [[meatball:ok_as_well?|ok ending with ? mark]]
8901 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8902 [http://de.wikipedia.org/wiki/#foo is just fragment]
8903
8904 !! html/php
8905 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8906 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8907 <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>
8908 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8909 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8910 </p>
8911 !! html/parsoid
8912 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8913 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8914 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" title="meatball:ok as well?">ok ending with ? mark</a>
8915 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history" class="external text">has query</a>
8916 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo" class="external text">is just fragment</a></p>
8917 !! end
8918
8919 !! test
8920 Interwiki links: trail
8921 !! wikitext
8922 [[wikipedia:Foo|Ba]]r
8923 !! html/php
8924 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8925 </p>
8926 !! html/parsoid
8927 <p><a rel="mw:WikiLink/Interwiki" 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>
8928 !! end
8929
8930 !! test
8931 Local interwiki link
8932 !! options
8933 parsoid=wt2html,wt2wt,html2html
8934 !! wikitext
8935 [[local:Template:Foo]]
8936 !! html/php
8937 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8938 </p>
8939 !! html/parsoid
8940 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8941 !! end
8942
8943 # Parsoid does not mark self-links, by design.
8944 !! test
8945 Local interwiki link: self-link to current page
8946 !! options
8947 title=[[Main Page]]
8948 parsoid=wt2html,wt2wt,html2html
8949 !! wikitext
8950 [[local:Main Page]]
8951 !! html/php
8952 <p><a class="mw-selflink selflink">local:Main Page</a>
8953 </p>
8954 !! html/parsoid
8955 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8956 !! end
8957
8958 !! test
8959 Local interwiki link: prefix only (T66167)
8960 !! options
8961 parsoid=wt2html,wt2wt,html2html
8962 !! wikitext
8963 [[local:]]
8964 !! html/php
8965 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8966 </p>
8967 !! html/parsoid
8968 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8969 !! end
8970
8971 !! test
8972 Local interwiki link: with additional interwiki prefix (T63357)
8973 !! options
8974 parsoid=wt2html,wt2wt,html2html
8975 !! wikitext
8976 [[local:meatball:Hello]]
8977 !! html/php
8978 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8979 </p>
8980 !! html/parsoid
8981 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8982 !! end
8983
8984 !! test
8985 Multiple local interwiki link prefixes
8986 !! wikitext
8987 [[local:local:local:local:mi:local:Foo]]
8988 !! options
8989 parsoid=wt2html,wt2wt,html2html
8990 !! html/php
8991 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8992 </p>
8993 !! html/parsoid
8994 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8995 !! end
8996
8997 !! test
8998 Interwiki link with percent encoded target
8999 !! wikitext
9000 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
9001 !! html/php
9002 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
9003 </p>
9004 !! html/parsoid
9005 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa" title="es:Nueva Guipúzcoa" data-parsoid='{"stx":"piped","a":{"href":"http://es.wikipedia.org/wiki/Nueva%20Guipúzcoa"},"sa":{"href":":es:Nueva Guip%C3%BAzcoa"},"isIW":true}'>Nueva Guipúzcoa</a></p>
9006 !! end
9007
9008 ###
9009 ### Interlanguage links
9010 ### Language links (so that searching for '### language' matches..)
9011 ###
9012
9013 !! test
9014 Interlanguage link
9015 !! wikitext
9016 Blah blah blah
9017 [[zh:Chinese]]
9018 !! html/php
9019 <p>Blah blah blah
9020 </p>
9021 !! html/parsoid
9022 <p>Blah blah blah</p>
9023 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9024 !! end
9025
9026 ## parsoid html2wt will lose the space variations
9027 !! test
9028 Interlanguage link with spacing
9029 !! options
9030 parsoid=wt2html,wt2wt,html2html
9031 !! wikitext
9032 Blah blah blah
9033 [[ zh : Chinese ]]
9034 !! html/php
9035 <p>Blah blah blah
9036 </p>
9037 !! html/parsoid
9038 <p>Blah blah blah</p>
9039 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9040 !! end
9041
9042 !! test
9043 Double interlanguage link
9044 !! wikitext
9045 Blah blah blah
9046 [[es:Spanish]]
9047 [[zh:Chinese]]
9048 !! html/php
9049 <p>Blah blah blah
9050 </p>
9051 !! html/parsoid
9052 <p>Blah blah blah</p>
9053 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9054 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9055 !! end
9056
9057 ## parsoid html2wt will lose the space variations
9058 !! test
9059 Interlanguage link variations
9060 !! options
9061 parsoid=wt2html,wt2wt,html2html
9062 !! wikitext
9063 Blah blah blah
9064 [[ es :Spanish]]
9065 [[ ZH :Chinese]]
9066 [[es:Foo_bar]]
9067 !! html/php
9068 <p>Blah blah blah
9069 </p>
9070 !! html/parsoid
9071 <p>Blah blah blah</p>
9072 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9073 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9074 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9075 !! end
9076
9077 !! test
9078 Escaping of interlanguage links (T129218, T156308)
9079 !! wikitext
9080 Blah blah blah
9081 [[:es:Spanish]]
9082 [[ : zh : Chinese ]]
9083 !! html/php
9084 <p>Blah blah blah
9085 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9086 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9087 </p>
9088 !! html/parsoid
9089 <p>Blah blah blah
9090 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9091 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9092 !! end
9093
9094 !! test
9095 Multiple colons escaping interlanguage links
9096 !! options
9097 parsoid=wt2html
9098 !! wikitext
9099 [[:es:Spanish]]
9100 [[::es:Spanish]]
9101 [[:::es:Spanish]]
9102 !! html/php
9103 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9104 [[::es:Spanish]]
9105 [[:::es:Spanish]]
9106 </p>
9107 !! html/parsoid
9108 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9109 [[::es:Spanish]]
9110 [[:::es:Spanish]]</p>
9111 !! end
9112
9113 ## parsoid html2wt will normalize the space to _
9114 !! test
9115 Space and question mark encoding in interlanguage links (T95473)
9116 !! options
9117 parsoid=wt2html,wt2wt,html2html
9118 !! wikitext
9119 Blah blah blah
9120 [[es:Foo bar?]]
9121 !! html/php
9122 <p>Blah blah blah
9123 </p>
9124 !! html/parsoid
9125 <p>Blah blah blah</p>
9126 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9127 !! end
9128
9129 !! test
9130 Interlanguage link, with prefix links
9131 !! options
9132 language=ln
9133 !! wikitext
9134 Blah blah blah
9135 [[zh:Chinese]]
9136 !! html/php
9137 <p>Blah blah blah
9138 </p>
9139 !! html/parsoid
9140 <p>Blah blah blah</p>
9141 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9142 !! end
9143
9144 !! test
9145 Double interlanguage link, with prefix links (T10897)
9146 !! options
9147 language=ln
9148 !! wikitext
9149 Blah blah blah
9150 [[es:Spanish]]
9151 [[zh:Chinese]]
9152 !! html/php
9153 <p>Blah blah blah
9154 </p>
9155 !! html/parsoid
9156 <p>Blah blah blah</p>
9157 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9158 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9159 !! end
9160
9161 !! test
9162 "Extra" interlanguage links (T34189 / gerrit 111390)
9163 !! wikitext
9164 Blah blah blah
9165 [[mul:Article]]
9166 !! html/php
9167 <p>Blah blah blah
9168 </p>
9169 !! html/parsoid
9170 <p>Blah blah blah</p>
9171 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9172 !! end
9173
9174 ## PHP parser tests script needs an update
9175 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9176 !! test
9177 Language links render as inline links if $wgInterwikiMagic=false
9178 !! options
9179 wgInterwikiMagic=false
9180 parsoid=wt2html,wt2wt,html2html
9181 !! wikitext
9182 Blah blah blah
9183 [[zh:Chinese]]
9184 !! html/parsoid
9185 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9186 !! end
9187
9188 ## PHP parser tests script needs an update
9189 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9190 !! test
9191 Language links render as inline links in the Talk namespace
9192 !! options
9193 title=Talk:Foo
9194 parsoid=wt2html,wt2wt,html2html
9195 !! wikitext
9196 Blah blah blah
9197 [[zh:Chinese]]
9198 !! html/parsoid
9199 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9200 !! end
9201
9202 !! test
9203 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9204 !! options
9205 language=ln
9206 !! wikitext
9207 [[WW&nbsp;II]]
9208 !! html
9209 <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>
9210 </p>
9211 !! end
9212
9213 !! test
9214 Parsoid T55221: Wikilinks should be properly entity-escaped
9215 !! options
9216 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9217 !! html/parsoid
9218 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9219 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9220 !! wikitext
9221 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9222
9223 He&amp;nbsp;llo He&amp;nbsp;llo
9224 !! html/php
9225 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9226 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9227 </p>
9228 !! end
9229
9230 # html2wt will fail because of title normalization without data-parsoid
9231 !! test
9232 Parsoid: handle constructor well
9233 !! options
9234 parsoid=wt2html,wt2wt
9235 !! wikitext
9236 [[constructor]]
9237
9238 [[constructor:foo]]
9239 !! html/php
9240 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9241 </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>
9242 </p>
9243 !! html/parsoid
9244 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9245
9246 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
9247 !! end
9248
9249 !! test
9250 Template parameter named "constructor"
9251 !! wikitext
9252 {{echo| constructor = |hi}}
9253 !! html/parsoid
9254 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"constructor","named":true,"spc":[" "," ",""," "]},{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"constructor":{"wt":""},"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
9255 !! end
9256
9257 !! article
9258 ko:
9259 !! text
9260 Test.
9261 !! endarticle
9262
9263 # Note that `ko` isn't a known interlanguage prefix
9264 !! test
9265 Parsoid: recognize interlanguage links without a target page
9266 !! options
9267 ill
9268 !! wikitext
9269 [[es:]]
9270
9271 [[ko:]]
9272 !! html/php
9273 es:
9274 !! html/parsoid
9275 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9276
9277 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9278 !! end
9279
9280 # Note that `ko` isn't a known interwiki prefix
9281 !! test
9282 Parsoid: recognize interwiki links without a target page
9283 !! options
9284 parsoid=wt2html,wt2wt,html2html
9285 !! wikitext
9286 [[:es:]]
9287
9288 [[:ko:]]
9289 !! html/php
9290 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9291 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9292 </p>
9293 !! html/parsoid
9294 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9295 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9296 !! end
9297
9298 !! test
9299 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9300 !! wikitext
9301 [[mi:Foo]]
9302 !! html/php
9303 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9304 </p>
9305 !! html/parsoid
9306 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9307 !! end
9308
9309 !! test
9310 Interlanguage link with preceding local interwiki link (T70085)
9311 !! options
9312 parsoid=wt2html,wt2wt,html2html
9313 !! wikitext
9314 Blah blah blah
9315 [[local:es:Spanish]]
9316 !! html/php
9317 <p>Blah blah blah
9318 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9319 </p>
9320 !! html/parsoid
9321 <p>Blah blah blah
9322 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9323 !! end
9324
9325 !! test
9326 Looks like an interlanguage link, but is actually a local interwiki
9327 !! options
9328 parsoid=wt2html,wt2wt,html2html
9329 !! wikitext
9330 Blah blah blah
9331 [[mi:Template:Foo]]
9332 !! html/php
9333 <p>Blah blah blah
9334 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9335 </p>
9336 !! html/parsoid
9337 <p>Blah blah blah
9338 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9339 !! end
9340
9341 ###
9342 ### Redirects, Parsoid-only
9343 ###
9344
9345 !! test
9346 1. Simple redirect to page
9347 !! wikitext
9348 #REDIRECT [[Main Page]]
9349 !! html/parsoid
9350 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9351 !! end
9352
9353 !! test
9354 2. Other redirect variants
9355 !! wikitext
9356 #REDIRECT [[Main_Page]]
9357 !! html/parsoid
9358 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9359 !! end
9360
9361 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9362 # This tests the Parsoid bail-out code.
9363 !! test
9364 3. Other redirect variants
9365 !! options
9366 parsoid=wt2html
9367 !! wikitext
9368 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9369 !! html/parsoid
9370 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9371 !! end
9372
9373 !! test
9374 4. Redirect to a templated destination
9375 !! wikitext
9376 #REDIRECT [[{{echo|Foo}}bar]]
9377 !! html/parsoid
9378 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
9379 !! end
9380
9381 !! test
9382 Empty redirect
9383 !! options
9384 parsoid=wt2html,wt2wt
9385 !! wikitext
9386 #REDIRECT [[]]
9387 !! html/parsoid
9388 <ol>
9389 <li>REDIRECT [[]]</li></ol>
9390 !! end
9391
9392 !! test
9393 Optional colon in #REDIRECT
9394 !! options
9395 # the colon is archaic syntax. we support it for wt2html, but we
9396 # don't care that it roundtrips back to the modern syntax.
9397 parsoid=wt2html,html2html
9398 !! wikitext
9399 #REDIRECT:[[Main Page]]
9400 !! html/parsoid
9401 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9402 !! end
9403
9404 !! test
9405 Whitespace in #REDIRECT with optional colon
9406 !! options
9407 # the colon and gratuitous whitespace is archaic syntax. we support
9408 # it for wt2html, but we don't care that it roundtrips back to the
9409 # modern syntax (without extra whitespace)
9410 parsoid=wt2html,html2html
9411 !! wikitext
9412
9413 #REDIRECT
9414 :
9415 [[Main Page]]
9416 !! html/parsoid
9417 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9418 !! end
9419
9420 !! test
9421 Piped link in #REDIRECT
9422 !! options
9423 # content after piped link is ignored. we support this syntax,
9424 # but don't care that the piped link is lost when we roundtrip this.
9425 parsoid=wt2html
9426 !! wikitext
9427 #REDIRECT [[Main Page|bar]]
9428 !! html/parsoid
9429 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9430 !! end
9431
9432 !! test
9433 Redirect to category (T104502)
9434 !! options
9435 parsoid=wt2html,wt2wt
9436 !! wikitext
9437 #REDIRECT [[Category:Foo]]
9438 !! html/parsoid
9439 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9440 !! end
9441
9442 !! test
9443 Redirect to category with URL encoding (T104502)
9444 !! options
9445 parsoid=wt2html
9446 !! wikitext
9447 #REDIRECT [[Category%3AFoo]]
9448 !! html/parsoid
9449 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9450 !! end
9451
9452 !! test
9453 Redirect to category page
9454 !! wikitext
9455 #REDIRECT [[:Category:Foo]]
9456 !! html/parsoid
9457 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9458 !! end
9459
9460 !! test
9461 Redirect to image page (1)
9462 !! wikitext
9463 #REDIRECT [[File:Wiki.png]]
9464 !! html/parsoid
9465 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9466 !! end
9467
9468 !! test
9469 Redirect to image page (2)
9470 !! wikitext
9471 #REDIRECT [[Image:Wiki.png]]
9472 !! html/parsoid
9473 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9474 !! end
9475
9476 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9477 # Next test confirms this.
9478 !! test
9479 Redirect to language (1) (T104918)
9480 !! options
9481 parsoid=wt2html,wt2wt,html2html
9482 !! wikitext
9483 #REDIRECT [[en:File:Wiki.png]]
9484 !! html/parsoid
9485 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9486 !! end
9487
9488 !! test
9489 Redirect to language (2) (T104918)
9490 !! wikitext
9491 #REDIRECT [[:en:File:Wiki.png]]
9492 !! html/parsoid
9493 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9494 !! end
9495
9496 !! test
9497 Redirect to interwiki (T104918)
9498 !! wikitext
9499 #REDIRECT [[meatball:File:Wiki.png]]
9500 !! html/parsoid
9501 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9502 !! end
9503
9504 !! test
9505 Non-English #REDIRECT
9506 !! options
9507 language=is
9508 !! wikitext
9509 #TILVÍSUN [[Main Page]]
9510 !! html/parsoid
9511 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9512 !! end
9513
9514 !! test
9515 Redirect syntax under text isn't considered a redirect
9516 !! wikitext
9517 some text
9518
9519 #redirect [[Main Page]]
9520 !! html/parsoid
9521 <p>some text</p>
9522 <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>
9523 !! end
9524
9525 !! test
9526 New redirect
9527 !! options
9528 parsoid=html2wt
9529 !! html/parsoid
9530 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9531 !! wikitext
9532 #REDIRECT [[Foo]]
9533 Foo
9534 !! end
9535
9536 !! test
9537 Redirect followed by block on the same line
9538 !! options
9539 parsoid=wt2html
9540 !! wikitext
9541 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9542 !! html/parsoid
9543 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9544 !! end
9545
9546 !! test
9547 Redirect followed by a newline
9548 !! wikitext
9549 #REDIRECT [[Main Page]]
9550 A newline
9551 !! html/parsoid
9552 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9553 <p>A newline</p>
9554 !! end
9555
9556 !! test
9557 Redirect followed by multiple newlines
9558 !! wikitext
9559 #REDIRECT [[Main Page]]
9560
9561
9562 A newline
9563 !! html/parsoid
9564 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9565
9566 <p><br/>
9567 A newline</p>
9568 !! end
9569
9570 !! test
9571 Drop duplicate redirects
9572 !! options
9573 parsoid=html2wt
9574 !! html/parsoid
9575 <link rel="mw:PageProp/redirect" href="./Foo"/>
9576 <link rel="mw:PageProp/redirect" href="./Bar"/>
9577 <link rel="mw:PageProp/redirect" href="./Baz"/>
9578 !! wikitext
9579 #REDIRECT [[Foo]]
9580 !! end
9581
9582 ##
9583 ## XHTML tidiness
9584 ###
9585
9586 !! test
9587 <br> to <br />
9588 !! wikitext
9589 1<br>2<br />3
9590 !! html
9591 <p>1<br />2<br />3
9592 </p>
9593 !! end
9594
9595 !! test
9596 Broken br tag sanitization
9597 !! wikitext
9598 </br>
9599 !! html/php
9600 <p>&lt;/br&gt;
9601 </p>
9602 !! end
9603
9604 # TODO: Fix html2html mode (T53055)!
9605 !! test
9606 Parsoid: Broken br tag recognition
9607 !! options
9608 parsoid=wt2html
9609 !! wikitext
9610 </br>
9611
9612 <br/ >
9613 !! html+tidy
9614 <p><br />
9615 </p><p><br />
9616 </p>
9617 !! end
9618
9619 !! test
9620 Incorrecly removing closing slashes from correctly formed XHTML
9621 !! wikitext
9622 <br style="clear:both;" />
9623 !! html
9624 <p><br style="clear:both;" />
9625 </p>
9626 !! end
9627
9628 !! test
9629 Failing to transform badly formed HTML into correct XHTML
9630 !! wikitext
9631 <br style="clear: left;">
9632 <br style="clear: right;">
9633 <br style="clear: both;">
9634 !! html
9635 <p><br style="clear: left;" />
9636 <br style="clear: right;" />
9637 <br style="clear: both;" />
9638 </p>
9639 !!end
9640
9641 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9642 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9643 !! test
9644 Handling html with a div self-closing tag
9645 !! wikitext
9646 <div title />
9647 <div title/>
9648 <div title/ >
9649 <div title=bar />
9650 <div title=bar/>
9651 <div title=bar/ >
9652 !! html/php+tidy
9653 <div title=""></div>
9654 <div title=""></div>
9655 <div title="">
9656 <div title="bar"></div>
9657 <div title="bar"></div>
9658 <div title="bar/"></div></div>
9659 !! html/parsoid
9660 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9661 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9662 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9663 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9664 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9665 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9666 !! end
9667
9668 !! test
9669 Elements with solidus in various attribute positions
9670 !! options
9671 parsoid=wt2html,html2html
9672 !! wikitext
9673 <div cla/ss="123">ha</div>
9674
9675 <div / class="123">ha</div>
9676
9677 <div class= / "123">ha</div>
9678 !! html/php+tidy
9679 <div>ha</div>
9680 <div class="123">ha</div>
9681 <div class="/">ha</div>
9682 !! html/parsoid
9683 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9684
9685 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9686
9687 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9688 !! end
9689
9690 !! test
9691 Handling html with a br self-closing tag
9692 !! wikitext
9693 <br title />
9694 <br title/>
9695 <br title/ >
9696 <br title=bar />
9697 <br title=bar/>
9698 <br title=bar/ >
9699 !! html/php+tidy
9700 <p><br title="" />
9701 <br title="" />
9702 <br title="" />
9703 <br title="bar" />
9704 <br title="bar" />
9705 <br title="bar/" />
9706 </p>
9707 !! html/parsoid
9708 <p><br title="" />
9709 <br title="" />
9710 <br title="" />
9711 <br title="bar" />
9712 <br title="bar" />
9713 <br title="bar/" />
9714 </p>
9715 !! end
9716
9717 !! test
9718 Quoted attributes without spaces
9719 !! options
9720 parsoid=wt2html
9721 !! wikitext
9722 <div class="foo"style="color:red">red</div>
9723 !! html/php+tidy
9724 <div class="foo" style="color:red">red</div>
9725 !! html/parsoid
9726 <div class="foo" style="color:red">red</div>
9727 !! end
9728
9729 !! test
9730 Horizontal ruler (should it add that extra space?)
9731 !! wikitext
9732 <hr>
9733 <hr >
9734 foo <hr
9735 > bar
9736 !! html+tidy
9737 <hr />
9738 <hr /><p>
9739 foo </p><hr /><p> bar</p>
9740 !! end
9741
9742 !! test
9743 Horizontal ruler -- 4+ dashes render hr
9744 !! wikitext
9745 ----
9746 !! html
9747 <hr />
9748 !! end
9749
9750 !! test
9751 Horizontal ruler -- eats additional dashes on the same line
9752 !! wikitext
9753 ---------
9754 !! html
9755 <hr />
9756 !! end
9757
9758 !! test
9759 Horizontal ruler -- does not collapse dashes on consecutive lines
9760 !! wikitext
9761 ----
9762 ----
9763 !! html
9764 <hr />
9765 <hr />
9766 !! end
9767
9768 !! test
9769 Horizontal ruler -- <4 dashes render as plain text
9770 !! wikitext
9771 ---
9772 !! html
9773 <p>---
9774 </p>
9775 !! end
9776
9777 !! test
9778 Horizontal ruler -- Supports content following dashes on same line
9779 !! wikitext
9780 ---- Foo
9781 !! html
9782 <hr /> Foo
9783 !! html+tidy
9784 <hr /><p> Foo</p>
9785 !! end
9786
9787 ###
9788 ### Block-level elements
9789 ###
9790 !! test
9791 Common list
9792 !! wikitext
9793 *Common list
9794 *item 2
9795 *item 3
9796 !! html
9797 <ul><li>Common list</li>
9798 <li>item 2</li>
9799 <li>item 3</li></ul>
9800 !! end
9801
9802 !! test
9803 Numbered list
9804 !! wikitext
9805 #Numbered list
9806 #item 2
9807 #item 3
9808 !! html
9809 <ol><li>Numbered list</li>
9810 <li>item 2</li>
9811 <li>item 3</li></ol>
9812 !! end
9813
9814 # the switch from level 3 to ordered should not introduce a newline between
9815 !! test
9816 Mixed list
9817 !! wikitext
9818 *Mixed list
9819 *#with numbers
9820 **and bullets
9821 *#and numbers
9822 *bullets again
9823 **bullet level 2
9824 ***bullet level 3
9825 ***#Number on level 4
9826 **bullet level 2
9827 **#Number on level 3
9828 **#Number on level 3
9829 *#number level 2
9830 *Level 1
9831 ***Level 3
9832 #**Level 3, but ordered
9833 !! html
9834 <ul><li>Mixed list
9835 <ol><li>with numbers</li></ol>
9836 <ul><li>and bullets</li></ul>
9837 <ol><li>and numbers</li></ol></li>
9838 <li>bullets again
9839 <ul><li>bullet level 2
9840 <ul><li>bullet level 3
9841 <ol><li>Number on level 4</li></ol></li></ul></li>
9842 <li>bullet level 2
9843 <ol><li>Number on level 3</li>
9844 <li>Number on level 3</li></ol></li></ul>
9845 <ol><li>number level 2</li></ol></li>
9846 <li>Level 1
9847 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9848 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9849 !! end
9850
9851 !! test
9852 1. Nested mixed wikitext and html list
9853 !! wikitext
9854 *hi
9855 *<ul><li>ho</li></ul>
9856 *hi
9857 **ho
9858 !! html/php
9859 <ul><li>hi</li>
9860 <li><ul><li>ho</li></ul></li>
9861 <li>hi
9862 <ul><li>ho</li></ul></li></ul>
9863 !! html/parsoid
9864 <ul><li>hi</li>
9865 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9866 <li>hi
9867 <ul><li>ho</li></ul></li></ul>
9868 !! end
9869
9870 !! test
9871 2. Nested mixed wikitext and html list (incompatible)
9872 !! wikitext
9873 ;hi
9874 :{{echo|<li>ho</li>}}
9875 !! html/php
9876 <dl><dt>hi</dt>
9877 <dd><li>ho</li></dd></dl>
9878 !! html/parsoid
9879 <dl><dt>hi</dt>
9880 <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9881 !! end
9882
9883 !! test
9884 Nested lists 1
9885 !! wikitext
9886 *foo
9887 **bar
9888 !! html
9889 <ul><li>foo
9890 <ul><li>bar</li></ul></li></ul>
9891 !! end
9892
9893 !! test
9894 Nested lists 2
9895 !! wikitext
9896 **foo
9897 *bar
9898 !! html
9899 <ul><li><ul><li>foo</li></ul></li>
9900 <li>bar</li></ul>
9901 !! end
9902
9903 !! test
9904 Nested lists 3 (first element empty)
9905 !! wikitext
9906 *
9907 **bar
9908 !! html
9909 <ul><li>
9910 <ul><li>bar</li></ul></li></ul>
9911 !! end
9912
9913 !! test
9914 Nested lists 4 (first element empty)
9915 !! wikitext
9916 **
9917 *bar
9918 !! html
9919 <ul><li><ul><li></li></ul></li>
9920 <li>bar</li></ul>
9921 !! end
9922
9923 !! test
9924 Nested lists 5 (both elements empty)
9925 !! wikitext
9926 **
9927 *
9928 !! html
9929 <ul><li><ul><li></li></ul></li>
9930 <li></li></ul>
9931 !! end
9932
9933 !! test
9934 Nested lists 6 (both elements empty)
9935 !! wikitext
9936 *
9937 **
9938 !! html
9939 <ul><li>
9940 <ul><li></li></ul></li></ul>
9941 !! end
9942
9943 !! test
9944 Nested lists 7 (skip initial nesting levels)
9945 !! wikitext
9946 ***foo
9947 !! html
9948 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9949 !! end
9950
9951 !! test
9952 Nested lists 8 (multiple nesting transitions)
9953 !! wikitext
9954 *foo
9955 ***bar
9956 **baz
9957 *boo
9958 !! html
9959 <ul><li>foo
9960 <ul><li><ul><li>bar</li></ul></li>
9961 <li>baz</li></ul></li>
9962 <li>boo</li></ul>
9963 !! end
9964
9965 # XXX this test should be moved to citeParserTests, since it depends
9966 # on the Cite extension, which is "built in" to Parsoid.
9967 !! test
9968 Nested lists 9 (extension interaction)
9969 !! wikitext
9970 *<references />
9971 !! html/php+tidy-DISABLED
9972 <ul><li class="mw-empty-elt"></li></ul>
9973 !! html/parsoid
9974 <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9975 !! end
9976
9977 !! test
9978 1. Lists with start-of-line-transparent tokens before bullets: Comments
9979 !! wikitext
9980 *foo
9981 *<!--cmt-->bar
9982 <!--cmt-->*baz
9983 !! html
9984 <ul><li>foo</li>
9985 <li>bar</li>
9986 <li>baz</li></ul>
9987 !! end
9988
9989 !! test
9990 Nested lists 10 (list and span siblings: wt2wt regression)
9991 !! wikitext
9992 *a <span>x</span>
9993 **b <span>y</span>
9994 !! html/parsoid
9995 <ul><li>a <span>x</span>
9996 <ul><li>b <span>y</span></li></ul></li></ul>
9997 !! end
9998
9999 !! test
10000 2. Lists with start-of-line-transparent tokens before bullets: Template close
10001 !! wikitext
10002 *foo {{echo|bar
10003 }}*baz
10004 !! html
10005 <ul><li>foo bar</li>
10006 <li>baz</li></ul>
10007 !! end
10008
10009 !! test
10010 List items are not parsed correctly following a <pre> block (T2785)
10011 !! wikitext
10012 *<pre>foo</pre>
10013 *<pre>bar</pre>
10014 *zar
10015 !! html/php
10016 <ul><li><pre>foo</pre></li>
10017 <li><pre>bar</pre></li>
10018 <li>zar</li></ul>
10019 !! html/parsoid
10020 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
10021 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
10022 <li>zar</li></ul>
10023 !! end
10024
10025 # FIXME: Might benefit from a html/parsoid since this has a template
10026 !! test
10027 List items from template
10028 !! wikitext
10029
10030 {{inner list}}
10031 *item 2
10032
10033 *item 0
10034 {{inner list}}
10035 *item 2
10036
10037 *item 0
10038 *notSOL{{inner list}}
10039 *item 2
10040 !! html
10041 <ul><li>item 1</li>
10042 <li>item 2</li></ul>
10043 <ul><li>item 0</li>
10044 <li>item 1</li>
10045 <li>item 2</li></ul>
10046 <ul><li>item 0</li>
10047 <li>notSOL</li>
10048 <li>item 1</li>
10049 <li>item 2</li></ul>
10050 !! end
10051
10052 !! test
10053 List interrupted by empty line or heading
10054 !! wikitext
10055 *foo
10056
10057 **bar
10058 ==A heading==
10059 *Another list item
10060 !! html
10061 <ul><li>foo</li></ul>
10062 <ul><li><ul><li>bar</li></ul></li></ul>
10063 <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>
10064 <ul><li>Another list item</li></ul>
10065 !!end
10066
10067 !! test
10068 Multiple list tags generated by templates
10069 !! wikitext
10070 {{echo|<li>}}a
10071 {{echo|<li>}}b
10072 {{echo|<li>}}c
10073 !! html
10074 <li>a
10075 <li>b
10076 <li>c</li>
10077 </li>
10078 </li>
10079
10080 !! html+tidy
10081 <li>a
10082 </li><li>b
10083 </li><li>c</li>
10084 !! html/parsoid
10085 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a"]}'>a</li>
10086 <li about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"b"]}'>b</li>
10087 <li about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"c"]}'>c</li>
10088 !! end
10089
10090 !! test
10091 Multiple newlines in between HTML list items don't induce paragraph wrapping
10092 !! wikitext
10093 <ul>
10094 <li>hi</li>
10095
10096
10097
10098
10099 <li>ho</li>
10100 </ul>
10101
10102 <dl>
10103 <dt>hi</dt>
10104 <dd>ho<div>123</div>
10105 </dd>
10106
10107
10108 </dl>
10109 !! html/php+tidy
10110 <ul>
10111 <li>hi</li>
10112
10113
10114
10115
10116 <li>ho</li>
10117 </ul>
10118 <dl>
10119 <dt>hi</dt>
10120 <dd>ho<div>123</div>
10121 </dd>
10122
10123
10124 </dl>
10125 !! end
10126
10127 !!test
10128 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10129 !! wikitext
10130 *a
10131 <!--This line will NOT split the list-->
10132 *b
10133 <!--This line will NOT split the list either-->
10134 *c
10135 <!--foo--> <!----> <!--This line NOT split the list either-->
10136 *d
10137 !! html
10138 <ul><li>a</li>
10139 <li>b</li>
10140 <li>c</li>
10141 <li>d</li></ul>
10142 !!end
10143
10144 !!test
10145 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10146 !! wikitext
10147 *a
10148 <!--This line will NOT split the list-->
10149 *b
10150 <!--This line will NOT split the list either-->
10151 *c
10152 <!--foo--> <!----> <!--This line NOT split the list
10153 either-->
10154 *d
10155 !! html
10156 <ul><li>a</li>
10157 <li>b</li>
10158 <li>c</li>
10159 <li>d</li></ul>
10160 !!end
10161
10162 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10163 # That pass could possibly be removed.
10164 !!test
10165 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10166 !!options
10167 parsoid=wt2html,wt2wt
10168 !! wikitext
10169 *foo
10170 *<li>li-hack
10171 *{{echo|<li>templated li-hack}}
10172 *<!--foo--><li> unsupported li-hack with preceding comments
10173
10174 <ul>
10175 <li><li>not a li-hack
10176 </li>
10177 </ul>
10178 !! html+tidy
10179 <ul><li>foo</li>
10180 <li class="mw-empty-elt"></li><li>li-hack</li>
10181 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10182 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10183 <ul>
10184 <li class="mw-empty-elt"></li><li>not a li-hack
10185 </li>
10186 </ul>
10187 !! html/parsoid
10188 <ul><li> foo</li>
10189 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10190 <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
10191 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10192
10193 <ul data-parsoid='{"stx":"html"}'>
10194 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10195 </li>
10196 </ul>
10197 !! end
10198
10199 !! test
10200 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10201 !! wikitext
10202 #foo
10203 ##bar
10204
10205 *foo
10206 **bar
10207
10208 :foo
10209 ::bar
10210 !! html/php+tidy
10211 <ol><li>foo
10212 <ol><li>bar</li></ol></li></ol>
10213 <ul><li>foo
10214 <ul><li>bar</li></ul></li></ul>
10215 <dl><dd>foo
10216 <dl><dd>bar</dd></dl></dd></dl>
10217 !! html/parsoid
10218 <ol>
10219 <li>foo<ol>
10220 <li>bar</li>
10221 </ol></li>
10222 </ol><ul>
10223 <li>foo<ul>
10224 <li>bar</li>
10225 </ul></li>
10226 </ul><dl>
10227 <dd>foo<dl>
10228 <dd>bar</dd>
10229 </dl></dd>
10230 </dl>
10231 !! end
10232
10233 !! test
10234 Parsoid: Test of whitespace serialization with Templated bullets
10235 !! options
10236 parsoid=wt2html
10237 !! wikitext
10238 * {{bullet}}
10239 !! html/parsoid
10240 <ul>
10241 <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
10242 </ul>
10243 !! end
10244
10245 # ------------------------------------------------------------------------
10246 # The next set of tests are about Parsoid's ability to handle badly nested
10247 # tags (parse, minimize scope of fixup, and roundtrip back)
10248 # ------------------------------------------------------------------------
10249
10250 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10251 # Parsoid's list handling is more aware of block structure.
10252 !! test
10253 Unbalanced closing block tags break a list
10254 !! wikitext
10255 <div>
10256 *a</div><div>
10257 *b</div>
10258 !! html+tidy
10259 <div>
10260 <ul><li>a</li></ul></div><div>
10261 <li>b</li></div>
10262 !! html/parsoid
10263 <div><ul>
10264 <li>a</li>
10265 </ul></div>
10266 <div><ul>
10267 <li>b</li>
10268 </ul></div>
10269 !! end
10270
10271 !! test
10272 Unbalanced closing non-block tags don't break a list
10273 !! options
10274 parsoid=wt2html,html2html
10275 !! wikitext
10276 <span>
10277 *a</span><span>
10278 *b</span>
10279 !! html/php+tidy
10280 <p><span>
10281 </span></p>
10282 <ul><li>a<span></span></li>
10283 <li>b</li></ul>
10284 !! html/parsoid
10285 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10286 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10287 <li>b</li></ul>
10288 !! end
10289
10290 # Parsoid does some post-dom-building cleanup
10291 # which is why its output differs from Remex.
10292 !! test
10293 Unclosed formatting tags that straddle lists are closed and reopened
10294 !! options
10295 parsoid=wt2html,wt2wt,html2html
10296 !! wikitext
10297 #<s> a
10298 #b </s>
10299 !! html/php+tidy
10300 <ol><li><s> a</s></li><s>
10301 </s><li><s>b </s></li></ol>
10302 !! html/parsoid
10303 <ol><li><s> a</s></li>
10304 <li><s>b </s></li></ol>
10305 !! end
10306
10307 # Output is ugly because of all the misnested tag fixups.
10308 !! test
10309 1. List embedded in a formatting tag
10310 !! wikitext
10311 <small>
10312 *foo
10313 </small>
10314 !! html/php+tidy
10315 <p><small>
10316 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10317 </p>
10318 !! html/parsoid
10319 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10320 <ul><li data-parsoid='{}'>foo</li></ul></small>
10321 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10322 !! end
10323
10324 # Output is ugly because of all the misnested tag fixups.
10325 !! test
10326 2. List embedded in a formatting tag in a misnested way
10327 !! wikitext
10328 <small>
10329 *a
10330 *b</small>
10331 !! html/php+tidy
10332 <p><small>
10333 </small></p><small></small><ul><small><li>a</li>
10334 </small><li><small>b</small></li></ul>
10335 !! html/parsoid
10336 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10337 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10338 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10339 !! end
10340
10341 # Output is ugly because of all the misnested tag fixups.
10342 !! test
10343 3. List embedded in a formatting tag in a misnested way
10344 !! wikitext
10345 <small>
10346
10347 ** 123</small>
10348 !! html/php+tidy
10349 <p><small>
10350 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10351 !! html/parsoid
10352 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10353
10354 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10355 !! end
10356
10357 ###
10358 ### Magic Words
10359 ###
10360
10361 # Note that the current date is hard-coded as
10362 # 1970-01-01T00:02:03Z (a Thursday)
10363 # when running parser tests. The timezone is also fixed to GMT, so
10364 # local date will be identical to current date.
10365
10366 !! test
10367 Magic Word: {{CURRENTDAY}}
10368 !! wikitext
10369 {{CURRENTDAY}}
10370 !! html
10371 <p>1
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{CURRENTDAY2}}
10377 !! wikitext
10378 {{CURRENTDAY2}}
10379 !! html
10380 <p>01
10381 </p>
10382 !! end
10383
10384 !! test
10385 Magic Word: {{CURRENTDAYNAME}}
10386 !! wikitext
10387 {{CURRENTDAYNAME}}
10388 !! html
10389 <p>Thursday
10390 </p>
10391 !! end
10392
10393 !! test
10394 Magic Word: {{CURRENTDOW}}
10395 !! wikitext
10396 {{CURRENTDOW}}
10397 !! html
10398 <p>4
10399 </p>
10400 !! end
10401
10402 !! test
10403 Magic Word: {{CURRENTMONTH}}
10404 !! wikitext
10405 {{CURRENTMONTH}}
10406 !! html
10407 <p>01
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{CURRENTMONTH1}}
10413 !! wikitext
10414 {{CURRENTMONTH1}}
10415 !! html
10416 <p>1
10417 </p>
10418 !! end
10419
10420 !! test
10421 Magic Word: {{CURRENTMONTHABBREV}}
10422 !! wikitext
10423 {{CURRENTMONTHABBREV}}
10424 !! html
10425 <p>Jan
10426 </p>
10427 !! end
10428
10429 !! test
10430 Magic Word: {{CURRENTMONTHNAME}}
10431 !! wikitext
10432 {{CURRENTMONTHNAME}}
10433 !! html
10434 <p>January
10435 </p>
10436 !! end
10437
10438 !! test
10439 Magic Word: {{CURRENTMONTHNAMEGEN}}
10440 !! wikitext
10441 {{CURRENTMONTHNAMEGEN}}
10442 !! html
10443 <p>January
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Word: {{CURRENTTIME}}
10449 !! wikitext
10450 {{CURRENTTIME}}
10451 !! html
10452 <p>00:02
10453 </p>
10454 !! end
10455
10456 !! test
10457 Magic Word: {{CURRENTHOUR}}
10458 !! wikitext
10459 {{CURRENTHOUR}}
10460 !! html
10461 <p>00
10462 </p>
10463 !! end
10464
10465 !! test
10466 Magic Word: {{CURRENTWEEK}} (T6594)
10467 !! wikitext
10468 {{CURRENTWEEK}}
10469 !! html
10470 <p>1
10471 </p>
10472 !! end
10473
10474 !! test
10475 Magic Word: {{CURRENTYEAR}}
10476 !! wikitext
10477 {{CURRENTYEAR}}
10478 !! html
10479 <p>1970
10480 </p>
10481 !! end
10482
10483 !! test
10484 Magic Word: {{CURRENTTIMESTAMP}}
10485 !! wikitext
10486 {{CURRENTTIMESTAMP}}
10487 !! html
10488 <p>19700101000203
10489 </p>
10490 !! end
10491
10492 !! test
10493 Magic Words LOCAL (UTC)
10494 !! wikitext
10495 *{{LOCALMONTH}}
10496 *{{LOCALMONTH1}}
10497 *{{LOCALMONTHNAME}}
10498 *{{LOCALMONTHNAMEGEN}}
10499 *{{LOCALMONTHABBREV}}
10500 *{{LOCALDAY}}
10501 *{{LOCALDAY2}}
10502 *{{LOCALDAYNAME}}
10503 *{{LOCALYEAR}}
10504 *{{LOCALTIME}}
10505 *{{LOCALHOUR}}
10506 *{{LOCALWEEK}}
10507 *{{LOCALDOW}}
10508 *{{LOCALTIMESTAMP}}
10509 !! html
10510 <ul><li>01</li>
10511 <li>1</li>
10512 <li>January</li>
10513 <li>January</li>
10514 <li>Jan</li>
10515 <li>1</li>
10516 <li>01</li>
10517 <li>Thursday</li>
10518 <li>1970</li>
10519 <li>00:02</li>
10520 <li>00</li>
10521 <li>1</li>
10522 <li>4</li>
10523 <li>19700101000203</li></ul>
10524 !! end
10525
10526 !! test
10527 Magic Word: {{FULLPAGENAME}}
10528 !! options
10529 title=[[User:Ævar Arnfjörð Bjarmason]]
10530 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10531 !! wikitext
10532 {{FULLPAGENAME}}
10533 !! html/*
10534 <p>User:Ævar Arnfjörð Bjarmason
10535 </p>
10536 !! end
10537
10538 !! test
10539 Magic Word: {{FULLPAGENAMEE}}
10540 !! options
10541 title=[[User:Ævar Arnfjörð Bjarmason]]
10542 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10543 !! wikitext
10544 {{FULLPAGENAMEE}}
10545 !! html/*
10546 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10547 </p>
10548 !! end
10549
10550 !! test
10551 Magic Word: {{TALKSPACE}}
10552 !! options
10553 title=[[User:Ævar Arnfjörð Bjarmason]]
10554 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10555 !! wikitext
10556 {{TALKSPACE}}
10557 !! html/*
10558 <p>User talk
10559 </p>
10560 !! end
10561
10562 !! test
10563 Magic Word: {{TALKSPACE}}, same namespace
10564 !! options
10565 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10566 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10567 !! wikitext
10568 {{TALKSPACE}}
10569 !! html/*
10570 <p>User talk
10571 </p>
10572 !! end
10573
10574 !! test
10575 Magic Word: {{TALKSPACE}}, main namespace
10576 !! options
10577 title=[[Parser Test]]
10578 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10579 !! wikitext
10580 {{TALKSPACE}}
10581 !! html/*
10582 <p>Talk
10583 </p>
10584 !! end
10585
10586 !! test
10587 Magic Word: {{TALKSPACEE}}
10588 !! options
10589 title=[[User:Ævar Arnfjörð Bjarmason]]
10590 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10591 !! wikitext
10592 {{TALKSPACEE}}
10593 !! html/*
10594 <p>User_talk
10595 </p>
10596 !! end
10597
10598 !! test
10599 Magic Word: {{SUBJECTSPACE}}
10600 !! options
10601 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10602 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10603 !! wikitext
10604 {{SUBJECTSPACE}}
10605 !! html/*
10606 <p>User
10607 </p>
10608 !! end
10609
10610 !! test
10611 Magic Word: {{SUBJECTSPACE}}, same namespace
10612 !! options
10613 title=[[User:Ævar Arnfjörð Bjarmason]]
10614 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10615 !! wikitext
10616 {{SUBJECTSPACE}}
10617 !! html/*
10618 <p>User
10619 </p>
10620 !! end
10621
10622 !! test
10623 Magic Word: {{SUBJECTSPACE}}, main namespace
10624 !! options
10625 title=[[Parser Test]]
10626 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10627 !! wikitext
10628 {{SUBJECTSPACE}}
10629 !! html/*
10630 !! end
10631
10632 !! test
10633 Magic Word: {{SUBJECTSPACEE}}
10634 !! options
10635 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10636 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10637 !! wikitext
10638 {{SUBJECTSPACEE}}
10639 !! html/*
10640 <p>User
10641 </p>
10642 !! end
10643
10644 !! test
10645 Magic Word: {{NAMESPACE}}
10646 !! options
10647 title=[[User:Ævar Arnfjörð Bjarmason]]
10648 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10649 !! wikitext
10650 {{NAMESPACE}}
10651 !! html/*
10652 <p>User
10653 </p>
10654 !! end
10655
10656 !! test
10657 Magic Word: {{NAMESPACEE}}
10658 !! options
10659 title=[[User:Ævar Arnfjörð Bjarmason]]
10660 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10661 !! wikitext
10662 {{NAMESPACEE}}
10663 !! html/*
10664 <p>User
10665 </p>
10666 !! end
10667
10668 !! test
10669 Magic Word: {{NAMESPACENUMBER}}
10670 !! options
10671 title=[[User:Ævar Arnfjörð Bjarmason]]
10672 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10673 !! wikitext
10674 {{NAMESPACENUMBER}}
10675 !! html/*
10676 <p>2
10677 </p>
10678 !! end
10679
10680 !! test
10681 Magic Word: {{SUBPAGENAME}}
10682 !! options
10683 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10684 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10685 !! wikitext
10686 {{SUBPAGENAME}}
10687 !! html/*
10688 <p>sub ö
10689 </p>
10690 !! end
10691
10692 !! test
10693 Magic Word: {{SUBPAGENAMEE}}
10694 !! options
10695 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10696 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10697 !! wikitext
10698 {{SUBPAGENAMEE}}
10699 !! html/*
10700 <p>sub_%C3%B6
10701 </p>
10702 !! end
10703
10704 !! test
10705 Magic Word: {{ROOTPAGENAME}}
10706 !! options
10707 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10708 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10709 !! wikitext
10710 {{ROOTPAGENAME}}
10711 !! html/*
10712 <p>Ævar Arnfjörð Bjarmason
10713 </p>
10714 !! end
10715
10716 !! test
10717 Magic Word: {{ROOTPAGENAMEE}}
10718 !! options
10719 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10720 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10721 !! wikitext
10722 {{ROOTPAGENAMEE}}
10723 !! html/*
10724 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10725 </p>
10726 !! end
10727
10728 !! test
10729 Magic Word: {{BASEPAGENAME}}
10730 !! options
10731 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10732 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10733 !! wikitext
10734 {{BASEPAGENAME}}
10735 !! html/*
10736 <p>Ævar Arnfjörð Bjarmason
10737 </p>
10738 !! end
10739
10740 !! test
10741 Magic Word: {{BASEPAGENAMEE}}
10742 !! options
10743 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10744 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10745 !! wikitext
10746 {{BASEPAGENAMEE}}
10747 !! html/*
10748 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10749 </p>
10750 !! end
10751
10752 !! test
10753 Magic Word: {{TALKPAGENAME}}
10754 !! options
10755 title=[[User:Ævar Arnfjörð Bjarmason]]
10756 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10757 !! wikitext
10758 {{TALKPAGENAME}}
10759 !! html/*
10760 <p>User talk:Ævar Arnfjörð Bjarmason
10761 </p>
10762 !! end
10763
10764 !! test
10765 Magic Word: {{TALKPAGENAMEE}}
10766 !! options
10767 title=[[User:Ævar Arnfjörð Bjarmason]]
10768 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10769 !! wikitext
10770 {{TALKPAGENAMEE}}
10771 !! html/*
10772 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10773 </p>
10774 !! end
10775
10776 !! test
10777 Magic Word: {{SUBJECTPAGENAME}}
10778 !! options
10779 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10780 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10781 !! wikitext
10782 {{SUBJECTPAGENAME}}
10783 !! html/*
10784 <p>User:Ævar Arnfjörð Bjarmason
10785 </p>
10786 !! end
10787
10788 !! test
10789 Magic Word: {{SUBJECTPAGENAMEE}}
10790 !! options
10791 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10792 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10793 !! wikitext
10794 {{SUBJECTPAGENAMEE}}
10795 !! html/*
10796 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10797 </p>
10798 !! end
10799
10800 !! test
10801 Magic Word: {{NUMBEROFFILES}}
10802 !! options
10803 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10804 !! wikitext
10805 {{NUMBEROFFILES}}
10806 !! html/*
10807 <p>7
10808 </p>
10809 !! end
10810
10811 !! test
10812 Magic Word: {{PAGENAME}}
10813 !! options
10814 title=[[User:Ævar Arnfjörð Bjarmason]]
10815 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10816 !! wikitext
10817 {{PAGENAME}}
10818 !! html/*
10819 <p>Ævar Arnfjörð Bjarmason
10820 </p>
10821 !! end
10822
10823 !! test
10824 Magic Word: {{PAGENAME}} with metacharacters
10825 !! options
10826 title=[['foo & bar = baz']]
10827 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10828 !! wikitext
10829 ''{{PAGENAME}}''
10830 !! html+tidy
10831 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10832 </p>
10833 !! end
10834
10835 !! test
10836 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10837 !! options
10838 title=[[*RFC 1234 http://example.com/]]
10839 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10840 !! wikitext
10841 {{PAGENAME}}
10842 !! html+tidy
10843 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10844 </p>
10845 !! end
10846
10847 !! test
10848 Magic Word: {{PAGENAMEE}}
10849 !! options
10850 title=[[User:Ævar Arnfjörð Bjarmason]]
10851 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10852 !! wikitext
10853 {{PAGENAMEE}}
10854 !! html/*
10855 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10856 </p>
10857 !! end
10858
10859 !! test
10860 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10861 !! options
10862 title=[[*RFC 1234 http://example.com/]]
10863 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10864 !! wikitext
10865 {{PAGENAMEE}}
10866 !! html+tidy
10867 <p>&#42;RFC_1234_http&#58;//example.com/
10868 </p>
10869 !! end
10870
10871 !! test
10872 Magic Word: {{REVISIONID}} on latest revision
10873 !! options
10874 lastsavedrevision
10875 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10876 showflags
10877 !! wikitext
10878 {{REVISIONID}}
10879 !! html/*
10880 <p>1337
10881 </p>
10882 flags=vary-revision-id
10883 !! end
10884
10885 !! test
10886 Magic Word: {{REVISIONID}} on non-latest revision
10887 !! options
10888 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10889 showflags
10890 !! wikitext
10891 {{REVISIONID}}
10892 !! html/*
10893 <p>1337
10894 </p>
10895 flags=vary-revision-id
10896 !! end
10897
10898 !! test
10899 Magic Word: {{REVISIONTIMESTAMP}} on latest revision
10900 !! options
10901 lastsavedrevision
10902 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10903 showflags
10904 !! wikitext
10905 {{REVISIONTIMESTAMP}}
10906 !! html/*
10907 <p>19700101000203
10908 </p>
10909 flags=
10910 !! end
10911
10912 !! test
10913 Magic Word: {{REVISIONTIMESTAMP}} on non-existing page
10914 !! options
10915 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10916 showflags
10917 !! wikitext
10918 {{REVISIONTIMESTAMP}}
10919 !! html/*
10920 <p>123
10921 </p>
10922 flags=vary-revision-timestamp
10923 !! end
10924
10925 !! test
10926 Magic Word: {{REVISIONUSER}} on latest revision
10927 !! options
10928 lastsavedrevision
10929 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10930 showflags
10931 !! wikitext
10932 {{REVISIONUSER}}
10933 !! html/*
10934 <p>127.0.0.1
10935 </p>
10936 flags=vary-user
10937 !! end
10938
10939 !! test
10940 Parser Function: {{REVISIONID:{{PAGENAME}}}} on latest revision
10941 !! options
10942 lastsavedrevision
10943 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10944 showflags
10945 !! wikitext
10946 {{REVISIONID:{{PAGENAME}}}}
10947 !! html/*
10948 <p>1337
10949 </p>
10950 flags=vary-revision-id
10951 !! end
10952
10953 !! test
10954 Parser Function: {{REVISIONID:{{PAGENAME}}}} on non-saved revision
10955 !! options
10956 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10957 showflags
10958 !! wikitext
10959 {{REVISIONID:{{PAGENAME}}}}
10960 !! html/*
10961
10962 flags=vary-revision-id
10963 !! end
10964
10965 !! test
10966 Parser Function: {{REVISIONTIMESTAMP:{{PAGENAME}}}} on latest revision
10967 !! options
10968 lastsavedrevision
10969 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10970 showflags
10971 !! wikitext
10972 {{REVISIONTIMESTAMP:{{PAGENAME}}}}
10973 !! html/*
10974 <p>19700101000203
10975 </p>
10976 flags=vary-revision-timestamp
10977 !! end
10978
10979 !! test
10980 Parser Function: {{REVISIONDAY:{{PAGENAME}}}} on latest revision
10981 !! options
10982 lastsavedrevision
10983 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10984 showflags
10985 !! wikitext
10986 {{REVISIONDAY:{{PAGENAME}}}}
10987 !! html/*
10988 <p>1
10989 </p>
10990 flags=vary-revision-timestamp
10991 !! end
10992
10993 !! test
10994 Parser Function: {{REVISIONMONTH:{{PAGENAME}}}} on latest revision
10995 !! options
10996 lastsavedrevision
10997 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10998 showflags
10999 !! wikitext
11000 {{REVISIONMONTH:{{PAGENAME}}}}
11001 !! html/*
11002 <p>01
11003 </p>
11004 flags=vary-revision-timestamp
11005 !! end
11006
11007 !! test
11008 Parser Function: {{REVISIONYEAR:{{PAGENAME}}}} on latest revision
11009 !! options
11010 lastsavedrevision
11011 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11012 showflags
11013 !! wikitext
11014 {{REVISIONYEAR:{{PAGENAME}}}}
11015 !! html/*
11016 <p>1970
11017 </p>
11018 flags=vary-revision-timestamp
11019 !! end
11020
11021 !! test
11022 Parser Function: {{PAGESIZE:{{PAGENAME}}}} on latest revision
11023 !! options
11024 lastsavedrevision
11025 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11026 showflags
11027 !! wikitext
11028 {{PAGESIZE:{{PAGENAME}}}}
11029 !! html/*
11030 <p>25
11031 </p>
11032 flags=vary-revision-sha1
11033 !! end
11034
11035 !! test
11036 Magic Word: {{SCRIPTPATH}}
11037 !! options
11038 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11039 !! wikitext
11040 {{SCRIPTPATH}}
11041 !! html/*
11042 !! end
11043
11044 !! test
11045 Magic Word: {{STYLEPATH}}
11046 !! options
11047 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11048 !! wikitext
11049 {{STYLEPATH}}
11050 !! html/*
11051 <p>/skins
11052 </p>
11053 !! end
11054
11055 !! test
11056 Magic Word: {{SERVER}}
11057 !! options
11058 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11059 !! wikitext
11060 {{SERVER}}
11061 !! html/*
11062 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11063 </p>
11064 !! end
11065
11066 !! test
11067 Magic Word: {{SERVERNAME}}
11068 !! options
11069 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11070 !! wikitext
11071 {{SERVERNAME}}
11072 !! html/*
11073 <p>example.org
11074 </p>
11075 !! end
11076
11077 !! test
11078 Magic Word: {{SITENAME}}
11079 !! options
11080 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11081 !! wikitext
11082 {{SITENAME}}
11083 !! html/*
11084 <p>MediaWiki
11085 </p>
11086 !! end
11087
11088 !! test
11089 Magic Word: {{PAGELANGUAGE}}
11090 !! options
11091 language=fr
11092 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11093 !! wikitext
11094 {{PAGELANGUAGE}}
11095 !! html/*
11096 <p>fr
11097 </p>
11098 !! end
11099
11100 !! test
11101 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
11102 !! options
11103 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11104 !! wikitext
11105 {{PAGELANGUAGE}}
11106 !! html/*
11107 <p>en
11108 </p>
11109 !! end
11110
11111 !! test
11112 Case-sensitive magic words, when cased differently, should just be template transclusions
11113 !! wikitext
11114 {{CurrentMonth}}
11115 {{currentday}}
11116 {{cURreNTweEK}}
11117 {{currentHour}}
11118 !! html
11119 <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>
11120 <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>
11121 <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>
11122 <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>
11123 </p>
11124 !! end
11125
11126 !! test
11127 Case-insensitive magic words should still work with weird casing.
11128 !! wikitext
11129 {{sErVeRNaMe}}
11130 {{LCFirst:AOEU}}
11131 {{ucFIRST:aoeu}}
11132 {{SERver}}
11133 !! html
11134 <p>example.org
11135 aOEU
11136 Aoeu
11137 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11138 </p>
11139 !! end
11140
11141 # From plwiki:PLOS_ONE
11142 !! test
11143 Parsoid: Page property magic word with magic word contents
11144 !! options
11145 showtitle
11146 !! config
11147 wgAllowDisplayTitle=true
11148 wgRestrictDisplayTitle=false
11149 !! wikitext
11150 {{DISPLAYTITLE:''{{PAGENAME}}''}}
11151 !! html/php+tidy
11152 <i>Parser test</i>
11153
11154 !! html/parsoid
11155 <meta property="mw:PageProp/displaytitle" content="Parser test" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Parser test&lt;/span>&lt;/i>"}]]}'/>
11156 !! end
11157
11158 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
11159 # But, this is a limitation of our representation and is documented in
11160 # TemplateHandler.js in processSpecialMagicWord
11161 !! test
11162 Parsoid: Template-generated DISPLAYTITLE
11163 !! wikitext
11164 {{{{echo|DISPLAYTITLE}}:Foo}}
11165 !! options
11166 showtitle
11167 !! config
11168 wgAllowDisplayTitle=true
11169 wgRestrictDisplayTitle=false
11170 !! html/php
11171 Foo
11172
11173 !! html/parsoid
11174 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
11175 !! end
11176
11177 !! test
11178 Namespace 1 {{ns:1}}
11179 !! wikitext
11180 {{ns:1}}
11181 !! html
11182 <p>Talk
11183 </p>
11184 !! end
11185
11186 !! test
11187 Namespace 1 {{ns:01}}
11188 !! wikitext
11189 {{ns:01}}
11190 !! html
11191 <p>Talk
11192 </p>
11193 !! end
11194
11195 !! test
11196 Namespace 0 {{ns:0}} (T6783)
11197 !! wikitext
11198 {{ns:0}}
11199 !! html
11200 !! end
11201
11202 !! test
11203 Namespace 0 {{ns:00}} (T6783)
11204 !! wikitext
11205 {{ns:00}}
11206 !! html
11207 !! end
11208
11209 !! test
11210 Namespace -1 {{ns:-1}}
11211 !! wikitext
11212 {{ns:-1}}
11213 !! html
11214 <p>Special
11215 </p>
11216 !! end
11217
11218 !! test
11219 Namespace User {{ns:User}}
11220 !! wikitext
11221 {{ns:User}}
11222 !! html
11223 <p>User
11224 </p>
11225 !! end
11226
11227 !! test
11228 Namespace User talk {{ns:User_talk}}
11229 !! wikitext
11230 {{ns:User_talk}}
11231 !! html
11232 <p>User talk
11233 </p>
11234 !! end
11235
11236 !! test
11237 Namespace User talk {{ns:uSeR tAlK}}
11238 !! wikitext
11239 {{ns:uSeR tAlK}}
11240 !! html
11241 <p>User talk
11242 </p>
11243 !! end
11244
11245 !! test
11246 Namespace File {{ns:File}}
11247 !! wikitext
11248 {{ns:File}}
11249 !! html
11250 <p>File
11251 </p>
11252 !! end
11253
11254 !! test
11255 Namespace File {{ns:Image}}
11256 !! wikitext
11257 {{ns:Image}}
11258 !! html
11259 <p>File
11260 </p>
11261 !! end
11262
11263 !! test
11264 Namespace (lang=de) Benutzer {{ns:User}}
11265 !! options
11266 language=de
11267 !! wikitext
11268 {{ns:User}}
11269 !! html
11270 <p>Benutzer
11271 </p>
11272 !! end
11273
11274 !! test
11275 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11276 !! options
11277 language=de
11278 !! wikitext
11279 {{ns:3}}
11280 !! html
11281 <p>Benutzer Diskussion
11282 </p>
11283 !! end
11284
11285 !! test
11286 Urlencode
11287 !! wikitext
11288 {{urlencode:hi world?!}}
11289 {{urlencode:hi world?!|WIKI}}
11290 {{urlencode:hi world?!|PATH}}
11291 {{urlencode:hi world?!|QUERY}}
11292 !! html/php
11293 <p>hi+world%3F%21
11294 hi_world%3F!
11295 hi%20world%3F%21
11296 hi+world%3F%21
11297 </p>
11298 !! end
11299
11300 !! test
11301 Magic Word: prioritize type info over data-parsoid
11302 !! options
11303 parsoid=html2wt
11304 !! html/parsoid
11305 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11306 !! wikitext
11307 __FORCETOC__
11308 !! end
11309
11310 !! test
11311 Magic Word: serialize on separate line (parsoid)
11312 !! options
11313 parsoid=wt2wt,html2wt
11314 !! wikitext
11315 foo
11316 __NOTOC__
11317 bar
11318 !! html/parsoid
11319 foo<meta property="mw:PageProp/notoc"/>bar
11320 !! end
11321
11322 !! test
11323 Magic Word: rt non-english wikis
11324 !! options
11325 parsoid=wt2wt
11326 language=de
11327 !! wikitext
11328 __NOEDITSECTION__
11329 !! html/parsoid
11330 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11331 !! end
11332
11333 !!test
11334 __proto__ is treated as normal wikitext (T105997)
11335 !!wikitext
11336 __proto__
11337 !!html
11338 <p>__proto__
11339 </p>
11340 !!end
11341
11342 ###
11343 ### Magic links
11344 ###
11345 !! test
11346 Magic links: internal link to RFC (T2479)
11347 !! wikitext
11348 [[RFC 123]]
11349 !! html/php
11350 <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>
11351 </p>
11352 !! html/parsoid
11353 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11354 !! end
11355
11356 !! test
11357 Magic links: RFC (T2479)
11358 !! wikitext
11359 RFC 822
11360 !! html/php
11361 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11362 </p>
11363 !! html/parsoid
11364 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11365 !! end
11366
11367 !! test
11368 Magic links: RFC (T67278)
11369 !! wikitext
11370 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11371 !! html/php
11372 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
11373 </p>
11374 !! html/parsoid
11375 <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
11376 !! end
11377
11378 !! test
11379 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11380 !! wikitext
11381 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11382 RFC
11383 822
11384 !! html/php
11385 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11386 RFC
11387 822
11388 </p>
11389 !! html/parsoid
11390 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
11391 RFC
11392 822</p>
11393 !! end
11394
11395 !! test
11396 Magic links: ISBN (T3937)
11397 !! wikitext
11398 ISBN 0-306-40615-2
11399 !! html/php
11400 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11401 </p>
11402 !! html/parsoid
11403 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11404 !! end
11405
11406 !! test
11407 Magic links: ISBN (T67278)
11408 !! wikitext
11409 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11410 !! html/php
11411 <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.
11412 </p>
11413 !! html/parsoid
11414 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
11415 !! end
11416
11417 !! test
11418 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11419 !! wikitext
11420 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11421 ISBN
11422 9780316098113
11423 ISBN 978
11424 0316098113
11425 !! html/php
11426 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11427 ISBN
11428 9780316098113
11429 ISBN 978
11430 0316098113
11431 </p>
11432 !! html/parsoid
11433 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
11434 ISBN
11435 9780316098113
11436 ISBN 978
11437 0316098113</p>
11438 !! end
11439
11440 !! test
11441 Magic links: PMID incorrectly converts space to underscore
11442 !! wikitext
11443 PMID 1234
11444 !! html/php
11445 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11446 </p>
11447 !! html/parsoid
11448 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11449 !! end
11450
11451 !! test
11452 Magic links: PMID (T67278)
11453 !! wikitext
11454 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11455 !! html/php
11456 <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.
11457 </p>
11458 !! html/parsoid
11459 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
11460 !! end
11461
11462 !! test
11463 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11464 !! wikitext
11465 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11466 PMID
11467 1234
11468 !! html/php
11469 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11470 PMID
11471 1234
11472 </p>
11473 !! html/parsoid
11474 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
11475 PMID
11476 1234</p>
11477 !! end
11478
11479 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11480 # since these are ExtLinkText, not MagicLinkText
11481 !! test
11482 Magic links: use appropriate serialization for "almost" magic links.
11483 !! wikitext
11484 X[[Special:BookSources/0978739256|foo]]
11485
11486 X[https://tools.ietf.org/html/rfc1234 foo]
11487 !! html/php
11488 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11489 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11490 </p>
11491 !! html/parsoid
11492 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11493 <p>X<a rel="mw:ExtLink" href="https://tools.ietf.org/html/rfc1234" class="external text">foo</a></p>
11494 !! end
11495
11496 !! test
11497 Magic links: All disabled (T47942)
11498 !! options
11499 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11500 !! wikitext
11501 ISBN 0-306-40615-2
11502 PMID 1234
11503 RFC 4321
11504 !! html/php
11505 <p>ISBN 0-306-40615-2
11506 PMID 1234
11507 RFC 4321
11508 </p>
11509 !! end
11510
11511 ###
11512 ### Templates
11513 ####
11514
11515 !! test
11516 Nonexistent template
11517 !! wikitext
11518 {{thistemplatedoesnotexist}}
11519 !! html
11520 <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>
11521 </p>
11522 !! end
11523
11524 !! test
11525 Template with invalid target containing tags
11526 !! wikitext
11527 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11528 !! html
11529 <p>{{a<b>b</b>|foo|a=b|a = b}}
11530 </p>
11531 !! end
11532
11533 !! test
11534 Template with invalid target containing unclosed tag
11535 !! wikitext
11536 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11537 !! html
11538 <p>{{a<b>|foo|a=b|a = b}}</b>
11539 </p>
11540 !! end
11541
11542 !! test
11543 Template with invalid target containing wikilink
11544 !! wikitext
11545 {{[[Main Page]]}}
11546 !! html/php
11547 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11548 </p>
11549 !! html/parsoid
11550 <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>
11551 !! end
11552
11553 # The html2html output of this test is currently failing
11554 # because the html2wt output is broken; see
11555 # https://phabricator.wikimedia.org/T220018#5123777 for a discussion.
11556 # Not (yet) including html2wt as a test mode because there are
11557 # a couple of different correct ways this could be <nowiki>'ed.
11558 !! test
11559 Template with just whitespace in it, T70421
11560 !! wikitext
11561 {{echo|{{ }}}}
11562 !! options
11563 parsoid=wt2html,html2html
11564 !! html/php+tidy
11565 <p>{{ }}
11566 </p>
11567 !! html/parsoid
11568 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
11569 !! end
11570
11571 # This is currently the wikitext output of html2wt on the above test
11572 # case; note that it is broken! Adding a <nowiki> around the closing
11573 # brace changes how the open braces associate, breaking the outer
11574 # {{echo}} template invocation. *However* this "broken" wikitext
11575 # exposed a useful tokenizer bug (T221384) in how the broken_template
11576 # rule was being backtracked into, so it's a useful test case even
11577 # if/when the above test case gets its html2wt output fixed.
11578 !! test
11579 Template with just whitespace (bad template brace matching)
11580 !! options
11581 parsoid=wt2html
11582 !! wikitext
11583 {{echo|{{ }<nowiki>}</nowiki>}}
11584 !! html/php+tidy
11585 <p>{{echo|{{ }}}}
11586 </p>
11587 !! html/parsoid
11588 <p>{{echo|{{ }<span typeof="mw:Nowiki">}</span>}}</p>
11589 !! end
11590
11591 !! article
11592 Template:test
11593 !! text
11594 This is a test template
11595 !! endarticle
11596
11597 !! test
11598 Simple template
11599 !! wikitext
11600 {{test}}
11601 !! html
11602 <p>This is a test template
11603 </p>
11604 !! end
11605
11606 !! test
11607 Template with explicit namespace
11608 !! wikitext
11609 {{Template:test}}
11610 !! html
11611 <p>This is a test template
11612 </p>
11613 !! end
11614
11615
11616 !! article
11617 Template:paramtest
11618 !! text
11619 This is a test template with parameter {{{param}}}
11620 !! endarticle
11621
11622 !! test
11623 Template parameter
11624 !! wikitext
11625 {{paramtest|param=foo}}
11626 !! html
11627 <p>This is a test template with parameter foo
11628 </p>
11629 !! end
11630
11631 !! article
11632 Template:paramtestnum
11633 !! text
11634 [[{{{1}}}|{{{2}}}]]
11635 !! endarticle
11636
11637 !! test
11638 Template unnamed parameter
11639 !! wikitext
11640 {{paramtestnum|Main Page|the main page}}
11641 !! html
11642 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11643 </p>
11644 !! end
11645
11646 !! article
11647 Template:templatesimple
11648 !! text
11649 (test)
11650 !! endarticle
11651
11652 !! article
11653 Template:templateredirect
11654 !! text
11655 #redirect [[Template:templatesimple]]
11656 !! endarticle
11657
11658 !! article
11659 Template:templateasargtestnum
11660 !! text
11661 {{{{{1}}}}}
11662 !! endarticle
11663
11664 !! article
11665 Template:templateasargtest
11666 !! text
11667 {{template{{{templ}}}}}
11668 !! endarticle
11669
11670 !! article
11671 Template:templateasargtest2
11672 !! text
11673 {{{{{templ}}}}}
11674 !! endarticle
11675
11676 !! test
11677 Template with template name as unnamed argument
11678 !! wikitext
11679 {{templateasargtestnum|templatesimple}}
11680 !! html
11681 <p>(test)
11682 </p>
11683 !! end
11684
11685 !! test
11686 Template with template name as argument
11687 !! wikitext
11688 {{templateasargtest|templ=simple}}
11689 !! html
11690 <p>(test)
11691 </p>
11692 !! end
11693
11694 !! test
11695 Template with template name as argument (2)
11696 !! wikitext
11697 {{templateasargtest2|templ=templatesimple}}
11698 !! html
11699 <p>(test)
11700 </p>
11701 !! end
11702
11703 !! article
11704 Template:templateasargtestdefault
11705 !! text
11706 {{{{{templ|templatesimple}}}}}
11707 !! endarticle
11708
11709 !! article
11710 Template:templa
11711 !! text
11712 '''templ'''
11713 !! endarticle
11714
11715 !! test
11716 Template with default value
11717 !! wikitext
11718 {{templateasargtestdefault}}
11719 !! html
11720 <p>(test)
11721 </p>
11722 !! end
11723
11724 !! test
11725 Template with default value (value set)
11726 !! wikitext
11727 {{templateasargtestdefault|templ=templa}}
11728 !! html
11729 <p><b>templ</b>
11730 </p>
11731 !! end
11732
11733 !! test
11734 Template redirect
11735 !! wikitext
11736 {{templateredirect}}
11737 !! html/php
11738 <p>(test)
11739 </p>
11740 !! html/parsoid
11741 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11742 !! end
11743
11744 !! test
11745 Template with argument in separate line
11746 !! wikitext
11747 {{ templateasargtest |
11748 templ = simple }}
11749 !! html
11750 <p>(test)
11751 </p>
11752 !! end
11753
11754 !! test
11755 Template with complex template as argument
11756 !! wikitext
11757 {{paramtest|
11758 param ={{ templateasargtest |
11759 templ = simple }}}}
11760 !! html
11761 <p>This is a test template with parameter (test)
11762 </p>
11763 !! end
11764
11765 !! test
11766 Templates with templated name
11767 !! wikitext
11768 {{{{echo|echo}}|foo}}
11769 {{{{echo|inner list}} }}
11770 !! html
11771 <p>foo
11772 </p>
11773 <ul><li>item 1</li></ul>
11774 !! html/parsoid
11775 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
11776 <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
11777 !! end
11778
11779 ## Regression test; the output here isn't really that interesting.
11780 !! test
11781 Templates with templated name and top level template args
11782 !! wikitext
11783 {{1{{2{{{3}}}|4=5}}}}
11784 !! html/parsoid
11785 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
11786 !! end
11787
11788 # Parsoid markup is deliberate "broken". This is an edge case.
11789 # See long comment in TemplateHandler.js:convertAttribsToString.
11790 !! test
11791 Templates with invalid templated targets
11792 !! wikitext
11793 {{echo
11794 {{echo|foo}}
11795 }}
11796 !! html/php
11797 <p>{{echo
11798 foo
11799 }}
11800 </p>
11801 !! html/parsoid
11802 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11803 foo }}</p>
11804 !! end
11805
11806 !! test
11807 Template with thumb image (with link in description)
11808 !! wikitext
11809 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11810 !! html/php
11811 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>
11812 !! html+tidy
11813 <p>This is a test template with parameter </p><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>
11814 !! html/parsoid
11815 <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":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Noimage.png"><span resource="./File:Noimage.png" data-width="220">File:Noimage.png</span></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>
11816 !! end
11817
11818 !! article
11819 Template:complextemplate
11820 !! text
11821 {{{1}}} {{paramtest|
11822 param ={{{param}}}}}
11823 !! endarticle
11824
11825 !! test
11826 Template with complex arguments
11827 !! wikitext
11828 {{complextemplate|
11829 param ={{ templateasargtest |
11830 templ = simple }}|[[Template:complextemplate|link]]}}
11831 !! html
11832 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11833 </p>
11834 !! end
11835
11836 !! test
11837 T2553: link with two variables in a piped link
11838 !! wikitext
11839 {|
11840 |[[{{{1}}}|{{{2}}}]]
11841 |}
11842 !! html/php
11843 <table>
11844 <tr>
11845 <td>[[{{{1}}}|{{{2}}}]]
11846 </td></tr></table>
11847 !! html/parsoid
11848 <table>
11849 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
11850 </tbody></table>
11851 !! end
11852
11853 # See: T2553
11854 !! test
11855 Abort table cell attribute parsing on wikilink
11856 !! wikitext
11857 {|
11858 |testing [[one|two]] |three||four
11859 |testing one two |three||four
11860 |testing="[[one|two]]" |three||four
11861 |}
11862 !! html/php
11863 <table>
11864 <tr>
11865 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
11866 <td>four
11867 </td>
11868 <td>three</td>
11869 <td>four
11870 </td>
11871 <td>testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
11872 <td>four
11873 </td></tr></table>
11874 !! html/parsoid
11875 <table>
11876 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11877 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
11878 <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td></tr>
11879 </tbody></table>
11880 !! end
11881
11882 !! test
11883 Don't abort table cell attribute parsing if wikilink is found in template arg
11884 !! wikitext
11885 {|
11886 |Test {{#tag:ref|One two "[[three]]" four}}
11887 |}
11888 !! html/parsoid
11889 <table>
11890 <tbody><tr><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
11891 </tbody></table>
11892 !! end
11893
11894 !! test
11895 Magic variable as template parameter
11896 !! wikitext
11897 {{paramtest|param={{SITENAME}}}}
11898 !! html
11899 <p>This is a test template with parameter MediaWiki
11900 </p>
11901 !! end
11902
11903 !! article
11904 Template:linktest
11905 !! text
11906 [[{{{param}}}|link]]
11907 !! endarticle
11908
11909 !! test
11910 Template parameter as link source
11911 !! wikitext
11912 {{linktest|param=Main Page}}
11913 !! html
11914 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11915 </p>
11916 !! end
11917
11918 !!article
11919 Template:paramtest2
11920 !! text
11921 including another template, {{paramtest|param={{{arg}}}}}
11922 !! endarticle
11923
11924 !! test
11925 Template passing argument to another template
11926 !! wikitext
11927 {{paramtest2|arg='hmm'}}
11928 !! html
11929 <p>including another template, This is a test template with parameter 'hmm'
11930 </p>
11931 !! end
11932
11933 !! article
11934 Template:Linktest2
11935 !! text
11936 Main Page
11937 !! endarticle
11938
11939 !! test
11940 Template as link source
11941 !! wikitext
11942 [[{{linktest2}}]]
11943
11944 [[{{linktest2}}|Main Page]]
11945
11946 [[{{linktest2}}]]Page
11947 !! html
11948 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11949 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11950 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11951 </p>
11952 !! end
11953
11954
11955 !! article
11956 Template:loop1
11957 !! text
11958 {{loop2}}
11959 !! endarticle
11960
11961 !! article
11962 Template:loop2
11963 !! text
11964 {{loop1}}
11965 !! endarticle
11966
11967 !! test
11968 Template infinite loop
11969 !! wikitext
11970 {{loop1}}
11971 !! html/php
11972 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11973 </p>
11974 !! html/parsoid
11975 <p><span class="error" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"loop1","href":"./Template:Loop1"},"params":{},"i":0}}]}'>Template loop detected: <a rel="mw:WikiLink" href="./Template:Loop1" title="Template:Loop1">Template:Loop1</a></span></p>
11976 !! end
11977
11978 !! test
11979 Template from main namespace
11980 !! wikitext
11981 {{:Main Page}}
11982 !! html
11983 <p>blah blah
11984 </p>
11985 !! end
11986
11987 !! test
11988 Template from non-includable namespace
11989 !! options
11990 wgNonincludableNamespaces=10
11991 !! wikitext
11992 {{echo|uh oh!}}
11993 !! html
11994 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11995 </p>
11996 !! end
11997
11998 !! article
11999 Template:table
12000 !! text
12001 {|
12002 | 1 || 2
12003 |-
12004 | 3 || 4
12005 |}
12006 !! endarticle
12007
12008 !! test
12009 T2529: Template with table, not included at beginning of line
12010 !! wikitext
12011 foo {{table}}
12012 !! html
12013 <p>foo
12014 </p>
12015 <table>
12016 <tr>
12017 <td>1</td>
12018 <td>2
12019 </td></tr>
12020 <tr>
12021 <td>3</td>
12022 <td>4
12023 </td></tr></table>
12024 !! end
12025
12026 !! test
12027 T2523: Template shouldn't eat newline (or add an extra one before table)
12028 !! wikitext
12029 foo
12030 {{table}}
12031 !! html
12032 <p>foo
12033 </p>
12034 <table>
12035 <tr>
12036 <td>1</td>
12037 <td>2
12038 </td></tr>
12039 <tr>
12040 <td>3</td>
12041 <td>4
12042 </td></tr></table>
12043 !! end
12044
12045 !! test
12046 T2041: Template parameters shown as broken links
12047 !! wikitext
12048 {{{parameter}}}
12049 !! html
12050 <p>{{{parameter}}}
12051 </p>
12052 !! end
12053
12054 !! test
12055 Template with targets containing wikilinks
12056 !! options
12057 parsoid=wt2html
12058 !! wikitext
12059 {{[[foo]]}}
12060
12061 {{[[{{echo|foo}}]]}}
12062
12063 {{{{echo|[[foo}}]]}}
12064 !! html/php
12065 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
12066 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
12067 </p><p>{{[[foo}}]]
12068 </p>
12069 !! html/parsoid
12070 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
12071 <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
12072 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
12073 !! end
12074
12075 !! article
12076 Template:''
12077 !! text
12078 bar
12079 !! endarticle
12080
12081 !! test
12082 Templates: Double quotes as template target
12083 !! wikitext
12084 foo {{''}} baz
12085 !! html/php
12086 <p>foo bar baz
12087 </p>
12088 !! html/parsoid
12089 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
12090 </p>
12091 !! end
12092
12093 ## This test is about making sure Parsoid's data-mw is well formed in the
12094 ## face of multiple templates with intersecting and overlapping ranges. The
12095 ## wikitext itself is wretched.
12096 !! test
12097 Templates with intersecting and overlapping ranges
12098 !! wikitext
12099 {|{{echo|
12100 <p>ha</p>}}
12101 {|{{echo|
12102 <p>ho</p>}}
12103 {{echo|{{!}}hi}}
12104 |}
12105 !! html/php+tidy
12106 <p>ha</p><table>
12107
12108 </table><p>ho</p><table>
12109
12110 <tbody><tr>
12111 <td>hi
12112 </td></tr></tbody></table>
12113 !! html/parsoid
12114 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"TABLE"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
12115
12116 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
12117
12118 <tbody><tr><td>hi</td></tr>
12119 </tbody></table>
12120 !! end
12121
12122 !! article
12123 Template:MSGNW test
12124 !! text
12125 ''None'' of '''this''' should be
12126 * interpreted
12127 but rather passed unmodified
12128 {{test}}
12129 <gallery>
12130 File:Foobar.jpg
12131 </gallery>
12132 <!-- comment -->
12133 !! endarticle
12134
12135 # hmm, fix this or just deprecate msgnw and document its behavior?
12136 !! test
12137 msgnw keyword
12138 !! wikitext
12139 {{msgnw:MSGNW test}}
12140 !! html/php
12141 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
12142 &#42; interpreted
12143 &#32;but rather passed unmodified
12144 &#123;&#123;test&#125;&#125;
12145 &#60;gallery&#62;
12146 File:Foobar.jpg
12147 &#60;/gallery&#62;
12148 &#60;!-- comment --&#62;
12149 </p>
12150 !! end
12151
12152 !! test
12153 int keyword
12154 !! wikitext
12155 {{int:youhavenewmessages|lots of money|not!}}
12156 !! html
12157 <p>You have lots of money (not!).
12158 </p>
12159 !! end
12160
12161 !! test
12162 int keyword - non-existing message
12163 !! wikitext
12164 {{int:var}}
12165 !! html
12166 <p>⧼var⧽
12167 </p>
12168 !! end
12169
12170 !! article
12171 Template:Includes
12172 !! text
12173 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12174 !! endarticle
12175
12176 !! test
12177 <includeonly> and <noinclude> being included
12178 !! wikitext
12179 {{Includes}}
12180 !! html
12181 <p>Foobar
12182 </p>
12183 !! end
12184
12185 !! article
12186 Template:Includes2
12187 !! text
12188 <onlyinclude>Foo</onlyinclude>bar
12189 !! endarticle
12190
12191 !! test
12192 <onlyinclude> being included
12193 !! wikitext
12194 {{Includes2}}
12195 !! html/php+tidy
12196 <p>Foo
12197 </p>
12198 !! html/parsoid
12199 <p><meta typeof="mw:Transclusion mw:Includes/OnlyInclude" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes2","href":"./Template:Includes2"},"params":{},"i":0}}]}'/><span about="#mwt1">Foo</span><meta typeof="mw:Includes/OnlyInclude/End" about="#mwt1"/></p>
12200 !! end
12201
12202
12203 !! article
12204 Template:Includes3
12205 !! text
12206 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
12207 !! endarticle
12208
12209 !! test
12210 <onlyinclude> and <includeonly> being included
12211 !! wikitext
12212 {{Includes3}}
12213 !! html/php+tidy
12214 <p>Foo
12215 </p>
12216 !! html/parsoid
12217 <p><meta typeof="mw:Transclusion mw:Includes/OnlyInclude" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"Includes3","href":"./Template:Includes3"},"params":{},"i":0}}]}'/><span about="#mwt1">Foo</span><meta typeof="mw:Includes/OnlyInclude/End" about="#mwt1"/></p>
12218 !! end
12219
12220 # FIXME: Parsoid's markup for this is quite ugly.
12221 !! test
12222 <includeonly> and <noinclude> on a page
12223 !! wikitext
12224 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12225 !! html/php+tidy
12226 <p>Foozar
12227 </p>
12228 !! html/parsoid
12229 <p>Foo<meta typeof="mw:Includes/NoInclude" data-parsoid="{}"/>zar</p><meta typeof="mw:Includes/NoInclude/End" data-parsoid="{}"/><meta typeof="mw:Includes/IncludeOnly" data-mw='{"src":"&lt;includeonly>bar&lt;/includeonly>"}' data-parsoid="{}"/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid="{}"/>
12230 !! end
12231
12232 !! test
12233 Un-closed <noinclude>
12234 !! wikitext
12235 <noinclude>
12236 !! html/php+tidy
12237 !! html/parsoid
12238 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12239 !! end
12240
12241 !! test
12242 Empty <noinclude>
12243 !! wikitext
12244 Hello<noinclude></noinclude>!
12245 !! html/php+tidy
12246 <p>Hello!
12247 </p>
12248 !! html/parsoid
12249 <p>Hello<meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>!</p>
12250 !! end
12251
12252 !! test
12253 <onlyinclude> on a page
12254 !! wikitext
12255 <onlyinclude>Foo</onlyinclude>bar
12256 !! html
12257 <p>Foobar
12258 </p>
12259 !! end
12260
12261 !! test
12262 Un-closed <onlyinclude>
12263 !! wikitext
12264 <onlyinclude>
12265 !! html
12266 !! end
12267
12268 !!test
12269 Self-closed noinclude, includeonly, onlyinclude tags
12270 !! wikitext
12271 <noinclude />
12272 <includeonly />
12273 <onlyinclude />
12274 !! html
12275 <p><br />
12276 </p>
12277 !!end
12278
12279 !!test
12280 Unbalanced includeonly and noinclude tags
12281 !! wikitext
12282 {|
12283 |a</noinclude>
12284 |b</noinclude></noinclude>
12285 |c</noinclude></includeonly>
12286 |d</includeonly></includeonly>
12287 |}
12288 !! html
12289 <table>
12290 <tr>
12291 <td>a
12292 </td>
12293 <td>b
12294 </td>
12295 <td>c&lt;/includeonly&gt;
12296 </td>
12297 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12298 </td></tr></table>
12299 !!end
12300
12301 !! article
12302 Template:Includeonly section
12303 !! text
12304 <includeonly>
12305 ==Includeonly section==
12306 </includeonly>
12307 ==Section T-1==
12308 !!endarticle
12309
12310 !! test
12311 T8563: Edit link generation for section shown by <includeonly>
12312 !! wikitext
12313 {{includeonly section}}
12314 !! html
12315 <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>
12316 <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>
12317 !! end
12318
12319 # Uses same input as the contents of [[Template:Includeonly section]]
12320 !! test
12321 T8563: Section extraction for section shown by <includeonly>
12322 !! options
12323 section=T-2
12324 !! wikitext
12325 <includeonly>
12326 ==Includeonly section==
12327 </includeonly>
12328 ==Section T-2==
12329 !! html
12330 ==Section T-2==
12331 !! end
12332
12333 !! test
12334 T8563: Edit link generation for section suppressed by <includeonly>
12335 !! wikitext
12336 <includeonly>
12337 ==Includeonly section==
12338 </includeonly>
12339 ==Section 1==
12340 !! html
12341 <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>
12342 !! end
12343
12344 !! test
12345 T8563: Section extraction for section suppressed by <includeonly>
12346 !! options
12347 section=1
12348 !! wikitext
12349 <includeonly>
12350 ==Includeonly section==
12351 </includeonly>
12352 ==Section 1==
12353 !! html
12354 ==Section 1==
12355 !! end
12356
12357 !! test
12358 Un-closed <includeonly>
12359 !! wikitext
12360 <includeonly>
12361 !! html/php
12362 !! html/parsoid
12363 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12364 !! end
12365
12366 ## We used to, but no longer wt2wt this test since the default serializer
12367 ## will normalize the include directives to serialize on their own line.
12368 ## Selser will take care of preserving formatting in scenarios where they
12369 ## intermingled with other wikitext.
12370 ## This test also triggered T223411 during Parsoid-PHP porting.
12371 !! test
12372 Includes and comments at SOL
12373 !! options
12374 parsoid=wt2html,html2html
12375 !! wikitext
12376 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12377
12378 <noinclude>
12379 some
12380 </noinclude>*stuff
12381 *here
12382
12383 <noinclude>
12384 some</noinclude>* stuff
12385 * here
12386
12387 <includeonly>can have stuff</includeonly>===here===
12388
12389 !! html/php
12390 <h2><span class="mw-headline" id="hu">hu</span></h2>
12391 <p>some
12392 </p>
12393 <ul><li>stuff</li>
12394 <li>here</li></ul>
12395 <p><br />
12396 some* stuff
12397 </p>
12398 <ul><li>here</li></ul>
12399 <h3><span class="mw-headline" id="here">here</span></h3>
12400 !! html/parsoid
12401 <!-- 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 id="hu">hu</h2>
12402
12403 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12404 <p>some</p>
12405 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12406 <li>here</li></ul>
12407
12408 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12409 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12410 <ul><li>here</li></ul>
12411
12412 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
12413 !! end
12414
12415 # TODO: test with DOM fragment reuse!
12416 !! test
12417 Parsoid: DOM fragment reuse
12418 !! options
12419 parsoid=wt2wt,wt2html
12420 !! wikitext
12421 a{{echo|b<table></table>c}}d
12422
12423 a{{echo|b
12424 <table></table>
12425 c}}d
12426
12427 {{echo|a
12428
12429 <table></table>
12430
12431 b}}
12432 !! html/php+tidy
12433 <p>ab</p><table></table><p>cd
12434 </p><p>ab
12435 </p>
12436 <table></table>
12437 <p>cd
12438 </p><p>a
12439 </p>
12440 <table></table>
12441 <p>b
12442 </p>
12443 !! html/parsoid
12444 <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"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
12445
12446 <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"}]]}'>ab</p><span about="#mwt2">
12447 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12448 </span><p about="#mwt2">cd</p>
12449
12450 <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"}]]}'>a</p><span about="#mwt3">
12451
12452 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12453
12454 </span><p about="#mwt3">b</p>
12455 !! end
12456
12457 !! test
12458 Parsoid: Merge double tds (T52603)
12459 !! wikitext
12460 {|
12461 |{{echo|{{!}} foo}}
12462 |}
12463 !! html/php+tidy
12464 <table>
12465 <tbody><tr>
12466 <td>foo
12467 </td></tr></tbody></table>
12468 !! html/parsoid
12469 <table><tbody>
12470 <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>
12471 </tbody></table>
12472 !! end
12473
12474 !! test
12475 Parsoid: Merge double tds in nested transclusion content (T52603)
12476 !! wikitext
12477 {{echo|<div>}}
12478 {|
12479 |{{echo|{{!}} foo}}
12480 |}
12481 {{echo|</div>}}
12482 !! html/php+tidy
12483 <div>
12484 <table>
12485 <tbody><tr>
12486 <td>foo
12487 </td></tr></tbody></table>
12488 </div>
12489 !! html/parsoid
12490 <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}}]}'>
12491 <table><tbody>
12492 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12493 </tbody></table>
12494 </div>
12495 !! end
12496
12497 ###
12498 ### <includeonly> and <noinclude> in attributes
12499 ###
12500 !!test
12501 0. includeonly around the entire attribute
12502 !! wikitext
12503 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12504 !! html
12505 <p><span id="v2">bar</span>
12506 </p>
12507 !!end
12508
12509 !!test
12510 1. includeonly in html attr key
12511 !! wikitext
12512 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12513 !! html
12514 <p><span id="foo">bar</span>
12515 </p>
12516 !!end
12517
12518 !!test
12519 2. includeonly in html attr value
12520 !! wikitext
12521 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12522 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12523 !! html
12524 <p><span id="v1">bar</span>
12525 <span id="v1">bar</span>
12526 </p>
12527 !!end
12528
12529 !!test
12530 3. includeonly in part of an attr value
12531 !! wikitext
12532 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12533 !! html
12534 <p><span style="color:red;">bar</span>
12535 </p>
12536 !!end
12537
12538 !!test
12539 4. includeonly in table attributes
12540 !! wikitext
12541 {|
12542 |- <noinclude>
12543 |-
12544 |a
12545 </noinclude>
12546 |- <includeonly>
12547 |-
12548 |b
12549 </includeonly>
12550 |}
12551 !! html
12552 <table>
12553
12554
12555 <tr>
12556 <td>a
12557 </td></tr>
12558 </table>
12559 !!end
12560
12561 ###
12562 ### Preprocessor precedence tests
12563 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12564 ###
12565 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12566 !! test
12567 Preprocessor precedence 1: link is rightmost opening
12568 !! options
12569 parsoid=wt2html
12570 !! wikitext
12571 {{[[Foo|bar}}]]
12572
12573 But close-brace is not a valid character in a link title:
12574 {{[[Foo}}|bar]]
12575
12576 However, we can still tell this was handled as a link in the preprocessor:
12577 {{echo|[[Foo}}|bar]]|bat}}
12578 !! html/php
12579 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12580 </p><p>But close-brace is not a valid character in a link title:
12581 {{[[Foo}}|bar]]
12582 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12583 [[Foo}}|bar]]
12584 </p>
12585 !! html/parsoid
12586 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12587 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12588 <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
12589 !! end
12590
12591 !! test
12592 Preprocessor precedence 2: template is rightmost opening
12593 !! options
12594 language=zh
12595 !! wikitext
12596 -{{echo|foo}-}}-
12597 !! html/php
12598 <p>-foo}--
12599 </p>
12600 !! html/parsoid
12601 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12602 !! end
12603
12604 !! test
12605 Preprocessor precedence 3: language converter is rightmost opening
12606 !! options
12607 language=zh
12608 parsoid=wt2html
12609 !! wikitext
12610 {{echo|hi}}
12611
12612 {{-{R|echo|hi}}}-
12613
12614 [[-{R|raw]]}-
12615 !! html/php
12616 <p>hi
12617 </p><p>{{echo|hi}}
12618 </p><p>[[raw]]
12619 </p>
12620 !! html/parsoid
12621 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12622 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12623 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12624 !! end
12625
12626 !! test
12627 Preprocessor precedence 4: left-most angle bracket
12628 !! options
12629 language=zh
12630 !! wikitext
12631 <!--{raw}-->
12632 !! html/php
12633 !! html/parsoid
12634 <!--{raw}-->
12635 !! end
12636
12637 !! article
12638 Template:Precedence5
12639 !! text
12640 {{{{{1}}}}}
12641 !! endarticle
12642
12643 !! test
12644 Preprocessor precedence 5: tplarg takes precedence over template
12645 !! wikitext
12646 {{Precedence5|Bullet}}
12647 !! html/php
12648 <ul><li>Bar</li></ul>
12649 !! html/parsoid
12650 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12651 !! end
12652
12653 !! test
12654 Preprocessor precedence 6: broken link is rightmost opening
12655 !! options
12656 parsoid=wt2html
12657 !! wikitext
12658 {{echo|[[Foo}}
12659
12660 {{echo|[[Foo|bar|bat=baz}}
12661 !! html/php
12662 <p>{{echo|[[Foo}}
12663 </p><p>{{echo|[[Foo|bar|bat=baz}}
12664 </p>
12665 !! html/parsoid
12666 <p>{{echo|[[Foo}}</p>
12667 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12668 !! end
12669
12670 # This next test exposes a difference between PHP and Parsoid:
12671 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12672 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12673 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12674 # outer `[[Foo` extends until the `y]]`
12675 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12676 # intermediate result (after template expansion), and link processing
12677 # happens on this intermediate result, which moves the wikilink
12678 # boundary leftward to `[[Foo|Bar]]`
12679 # 2b) Parsoid works in a single step, so it's going to keep the
12680 # wikilink as extending to the `y]]`
12681 # 3a) Then PHP does linktrail processing which slurps up the trailing
12682 # `xy` inside the link.
12683 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12684 # `z` inside the link.
12685 # This is "correct" behavior. Parsoid's basic worldview is that the
12686 # `]]` inside the template shouldn't be allowed to leak out to affect
12687 # the surrounding wikilink. PHP may match Parsoid (in the future)
12688 # if you use {{#balance}} (T114445).
12689
12690 !! test
12691 Preprocessor precedence 7: broken template is rightmost opening
12692 !! options
12693 parsoid=wt2html
12694 !! wikitext
12695 [[Foo|{{echo|Bar]]
12696
12697 [[Foo|{{echo|Bar]]-x}}-y]]-z
12698
12699 Careful: linktrails can move the end of the wikilink:
12700 [[Foo|{{echo|y']]a}}l]]l
12701 !! html/php
12702 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12703 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12704 </p><p>Careful: linktrails can move the end of the wikilink:
12705 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12706 </p>
12707 !! html/parsoid
12708 <p>[[Foo|{{echo|Bar]]</p>
12709 <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
12710 <p>Careful: linktrails can move the end of the wikilink:
12711 <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
12712 !! end
12713
12714 !! test
12715 Preprocessor precedence 8: broken language converter is rightmost opening
12716 !! options
12717 language=zh
12718 !! wikitext
12719 [[Foo-{R|raw]]
12720 !! html
12721 <p>[[Foo-{R|raw]]
12722 </p>
12723 !! end
12724
12725 !! article
12726 Template:Preprocessor_precedence_9
12727 !! text
12728 ;4: {{{{1}}}}
12729 ;5: {{{{{2}}}}}
12730 ;6: {{{{{{3}}}}}}
12731 ;7: {{{{{{{4}}}}}}}
12732 !! endarticle
12733
12734 !! test
12735 Preprocessor precedence 9: groups of braces
12736 !! wikitext
12737 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12738 !! html/php
12739 <dl><dt>4</dt>
12740 <dd>{Four}</dd>
12741 <dt>5</dt>
12742 <dd></dd></dl>
12743 <ul><li>Bar</li></ul>
12744 <dl><dt>6</dt>
12745 <dd>Four</dd>
12746 <dt>7</dt>
12747 <dd>{Bullet}</dd></dl>
12748 !! html/parsoid
12749 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
12750 <dt>4</dt>
12751 <dd>{Four}</dd>
12752 <dt>5</dt>
12753 <dd></dd>
12754 </dl><ul about="#mwt1">
12755 <li>Bar</li>
12756 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12757 <dt>6</dt>
12758 <dd>Four</dd>
12759 <dt>7</dt>
12760 <dd>{Bullet}</dd>
12761 </dl>
12762 !! end
12763
12764 !! article
12765 Template:Preprocessor_precedence_10
12766 !! text
12767 ;1: -{R|raw}-
12768 ;2: -{{Bullet}}-
12769 ;3: -{{{1}}}-
12770 ;4: -{{{{2}}}}-
12771 ;5: -{{{{{3}}}}}-
12772 ;6: -{{{{{{4}}}}}}-
12773 ;7: -{{{{{{{5}}}}}}}-
12774 !! endarticle
12775
12776 !! test
12777 Preprocessor precedence 10: groups of braces with leading dash
12778 !! options
12779 language=zh
12780 !! wikitext
12781 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12782 !! html/php
12783 <dl><dt>1</dt>
12784 <dd>raw</dd>
12785 <dt>2</dt>
12786 <dd>-</dd></dl>
12787 <ul><li>Bar-</li></ul>
12788 <dl><dt>3</dt>
12789 <dd>-Three-</dd>
12790 <dt>4</dt>
12791 <dd>raw2</dd>
12792 <dt>5</dt>
12793 <dd>-</dd></dl>
12794 <ul><li>Bar-</li></ul>
12795 <dl><dt>6</dt>
12796 <dd>-Three-</dd>
12797 <dt>7</dt>
12798 <dd>raw2</dd></dl>
12799 !! html/parsoid
12800 <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
12801 <dt>1</dt>
12802 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12803 <dt>2</dt>
12804 <dd>-</dd>
12805 </dl><ul about="#mwt1">
12806 <li>Bar-</li>
12807 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12808 <dt>3</dt>
12809 <dd>-Three-</dd>
12810 <dt>4</dt>
12811 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12812 <dt>5</dt>
12813 <dd>-</dd>
12814 </dl><ul about="#mwt1">
12815 <li>Bar-</li>
12816 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12817 <dt>6</dt>
12818 <dd>-Three-</dd>
12819 <dt>7</dt>
12820 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12821 </dl>
12822 !! end
12823
12824 !! test
12825 Preprocessor precedence 11: found during visual diff testing
12826 !! wikitext
12827 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12828
12829 {{echo|-{{echo|-{{echo|x}}}}}}
12830
12831 {{echo|-{{echo|x}}}}
12832 !! html/php
12833 <p><span>-<span>-x</span></span>
12834 </p><p>--x
12835 </p><p>-x
12836 </p>
12837 !! html/parsoid
12838 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
12839
12840 <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
12841
12842 <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
12843 !! end
12844
12845 !! test
12846 Preprocessor precedence 12: broken language converter closed by brace.
12847 !! options
12848 parsoid=wt2html
12849 !! wikitext
12850 This form breaks the template, which is unfortunate:
12851 *{{echo|foo-{bar}bat}}
12852
12853 But if the broken language converter markup is inside an extension
12854 tag, nothing bad happens:
12855 *<nowiki>foo-{bar}bat</nowiki>
12856 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12857 *<pre>foo-{bar}bat</pre>
12858 *{{echo|<pre>foo-{bar}bat</pre>}}
12859
12860 <tag>foo-{bar}bat</tag>
12861 {{echo|<tag>foo-{bar}bat</tag>}}
12862
12863 !! html/php+tidy
12864 <p>This form breaks the template, which is unfortunate:
12865 </p>
12866 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12867 <p>But if the broken language converter markup is inside an extension
12868 tag, nothing bad happens:
12869 </p>
12870 <ul><li>foo-&#123;bar}bat</li>
12871 <li>foo-&#123;bar}bat</li>
12872 <li><pre>foo-{bar}bat</pre></li>
12873 <li><pre>foo-{bar}bat</pre></li></ul>
12874 <pre>'foo-{bar}bat'
12875 array (
12876 )
12877 </pre>
12878 <pre>'foo-{bar}bat'
12879 array (
12880 )
12881 </pre>
12882 !! html/parsoid
12883 <p>This form breaks the template, which is unfortunate:</p>
12884 <ul>
12885 <li>{{echo|foo-{bar}bat}}</li>
12886 </ul>
12887 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12888 <ul>
12889 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12890 <li><span typeof="mw:Nowiki mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
12891 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12892 <li><pre typeof="mw:Extension/pre mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
12893 </ul>
12894 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
12895 !! end
12896
12897 !! test
12898 Preprocessor precedence 13: broken language converter in external link
12899 !! options
12900 parsoid=wt2html
12901 !! wikitext
12902 *[http://example.com/-{foo Example in URL]
12903 *[http://example.com Example in -{link} description]
12904 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12905 !! html/php+tidy
12906 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12907 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12908 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12909 !! html/parsoid
12910 <ul>
12911 <li><a rel="mw:ExtLink" href="http://example.com/-{foo" class="external text">Example in URL</a></li>
12912 <li><a rel="mw:ExtLink" href="http://example.com" class="external text">Example in -{link} description</a></li>
12913 <li>{{echo|<a rel="mw:ExtLink" href="http://example.com/-{foo" class="external text">Breaks template, however</a>}}</li>
12914 </ul>
12915 !! end
12916
12917 !! test
12918 Preprocessor precedence 14: broken language converter in comment
12919 !! wikitext
12920 *<!--{{foo}}-->...should be ok
12921 *<!---{{foo}}-->...extra dashes
12922 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12923 !! html/php+tidy
12924 <ul><li>...should be ok</li>
12925 <li>...extra dashes</li>
12926 <li>foobat...should be ok</li></ul>
12927 !! html/parsoid
12928 <ul>
12929 <li><!--{{foo}}-->...should be ok</li>
12930 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12931 <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
12932 </ul>
12933 !! end
12934
12935 !! test
12936 Preprocessor precedence 15: broken brace markup in headings
12937 !! config
12938 wgFragmentMode=[ 'html5', 'legacy' ]
12939 !! options
12940 parsoid=wt2html
12941 !! wikitext
12942 __NOTOC__ __NOEDITSECTION__
12943 ===1 foo[bar 1===
12944 1
12945 ===2 foo[[bar 2===
12946 2
12947 ===3 foo{bar 3===
12948 3
12949 ===4 foo{{bar 4===
12950 4
12951 ===5 foo{{{bar 5===
12952 5
12953 ===6 foo-{bar 6===
12954 6
12955 !! html/php+tidy
12956 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12957 <p>1
12958 </p>
12959 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12960 <p>2
12961 </p>
12962 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12963 <p>3
12964 </p>
12965 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12966 <p>4
12967 </p>
12968 <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
12969 <p>5
12970 </p>
12971 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12972 <p>6
12973 </p>
12974 !! html/parsoid
12975 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12976 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12977 <p>1</p>
12978 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12979 <p>2</p>
12980 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12981 <p>3</p>
12982 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12983 <p>4</p>
12984 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12985 <p>5</p>
12986 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12987 <p>6</p>
12988 !! end
12989
12990 !! test
12991 Preprocessor precedence 16: matching closing braces to opening braces
12992 !! options
12993 language=zh
12994 parsoid=wt2html
12995 !! wikitext
12996 -{{{echo|foo}}bar}-
12997 !! html/php
12998 <p>foobar
12999 </p>
13000 !! html/parsoid
13001 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
13002 !! end
13003
13004 !! test
13005 Preprocessor precedence 17: template w/o target shouldn't prevent closing
13006 !! options
13007 parsoid=wt2html
13008 !! wikitext
13009 {{echo|hi {{}}}}
13010 !! html/php
13011 <p>hi {{}}
13012 </p>
13013 !! html/parsoid
13014 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
13015 !! end
13016
13017 # Ensure we're using a language without variants for this test; even
13018 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
13019 !! test
13020 Preprocessor precedence 18: another rightmost wins scenario
13021 !! options
13022 parsoid=wt2html
13023 language=de
13024 !! wikitext
13025 {{ -{{{{1|tplarg}}} }} }-
13026 !! html/php
13027 <p>{{ -{tplarg }} }-
13028 </p>
13029 !! html/parsoid
13030 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
13031 !! end
13032
13033 !! test
13034 Preprocessor precedence 19: break syntax
13035 !! options
13036 parsoid=wt2html
13037 !! wikitext
13038 -{{
13039 !! html/php
13040 <p>-{{
13041 </p>
13042 !! html/parsoid
13043 <p>-{{</p>
13044 !! end
13045
13046 ###
13047 ### Token Stream Patcher tests
13048 ###
13049 ### These tests won't always pass wt2wt and other modes because
13050 ### on serialization, the table will be output on a new line.
13051 ### For now, we are blacklisting them, and using this to test selser.
13052 ###
13053
13054 !!test
13055 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
13056 !!options
13057 parsoid=wt2html,wt2wt
13058 !!wikitext
13059 {{echo|}}{| width = '100%'
13060 |foo
13061 |}
13062 !!html/parsoid
13063 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
13064 <tbody><tr><td>foo</td></tr>
13065 </tbody></table>
13066 !!end
13067
13068 ## We used to, but no longer wt2wt this test since the default serializer
13069 ## will normalize the include directives to serialize on their own line.
13070 ## Selser will take care of preserving formatting in scenarios where they
13071 ## intermingled with other wikitext.
13072 !!test
13073 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
13074 !!options
13075 parsoid=wt2html
13076 !!wikitext
13077 <includeonly>a</includeonly>{| {{{b}}}
13078 |c
13079 |}
13080 !!html/parsoid
13081 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
13082 <tbody><tr><td>c</td></tr>
13083 </tbody></table>
13084 !!end
13085
13086 !! test
13087 Table wikitext syntax outside wiki-tables
13088 !! wikitext
13089 a
13090 |+ not a caption
13091 ! not a table heading
13092 |- not a table row
13093 | not a table cell
13094 | class="foo bar" | baz
13095 b
13096 |}
13097 |-
13098 c
13099 !! html
13100 <p>a
13101 |+ not a caption
13102 ! not a table heading
13103 |- not a table row
13104 | not a table cell
13105 | class="foo bar" | baz
13106 b
13107 |}
13108 |-
13109 c
13110 </p>
13111 !! end
13112
13113 ###
13114 ### Testing parsing of templates where a template arg
13115 ### has the same name as the template itself.
13116 ###
13117
13118 !! article
13119 Template:quote
13120 !! text
13121 {{{quote|{{{1}}}}}}
13122 !! endarticle
13123
13124 !!test
13125 Templates: Template Name/Arg clash: 1. Use of positional param
13126 !! wikitext
13127 {{quote|foo}}
13128 !! html
13129 <p>foo
13130 </p>
13131 !!end
13132
13133 !!test
13134 Templates: Template Name/Arg clash: 2. Use of named param
13135 !! wikitext
13136 {{quote|quote=foo}}
13137 !! html
13138 <p>foo
13139 </p>
13140 !!end
13141
13142 !!test
13143 Templates: Template Name/Arg clash: 3. Use of named param with empty input
13144 !! wikitext
13145 {{quote|quote}}
13146 !! html
13147 <p>quote
13148 </p>
13149 !!end
13150
13151 ###
13152 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
13153 ###
13154
13155 !!test
13156 Templates: 1. Simple use
13157 !! wikitext
13158 {{echo|Foo}}
13159 !! html
13160 <p>Foo
13161 </p>
13162 !!end
13163
13164 !!test
13165 Templates: 2. Inside a block tag
13166 !! wikitext
13167 <div>{{echo|Foo}}</div>
13168 <blockquote>{{echo|Foo}}</blockquote>
13169 !! html
13170 <div>Foo</div>
13171 <blockquote>Foo</blockquote>
13172 !! html+tidy
13173 <div>Foo</div>
13174 <blockquote><p>Foo</p></blockquote>
13175 !!end
13176
13177 !!test
13178 Templates: P-wrapping: 1a. Templates on consecutive lines
13179 !! wikitext
13180 {{echo|Foo}}
13181 {{echo|bar}}
13182 !! html
13183 <p>Foo
13184 bar
13185 </p>
13186 !!end
13187
13188 !!test
13189 Templates: P-wrapping: 1b. Templates on consecutive lines
13190 !! wikitext
13191 Foo
13192
13193 {{echo|bar}}
13194 {{echo|baz}}
13195 !! html
13196 <p>Foo
13197 </p><p>bar
13198 baz
13199 </p>
13200 !!end
13201
13202 !!test
13203 Templates: P-wrapping: 1c. Templates on consecutive lines
13204 !! wikitext
13205 {{echo|Foo}}
13206 {{echo|bar}} <div>baz</div>
13207 !! html
13208 <p>Foo
13209 </p>
13210 bar <div>baz</div>
13211 !! html+tidy
13212 <p>Foo
13213 </p><p>
13214 bar </p><div>baz</div>
13215 !! end
13216
13217 !! test
13218 Templates: P-wrapping: 1d. Template preceded by comment-only line
13219 !! wikitext
13220 <!-- foo -->
13221 {{echo|Bar}}
13222 !! html/php+tidy
13223 <p>Bar
13224 </p>
13225 !! html/parsoid
13226 <!-- foo -->
13227
13228 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
13229 !!end
13230
13231 !! test
13232 Templates: Scopes should not be expanded unnecessarily
13233 !! options
13234 parsoid=wt2html,wt2wt
13235 !! wikitext
13236 {{echo|<div>a</div>}}b{{echo|
13237 <div>c</div>}}
13238 !! html/php+tidy
13239 <div>a</div><p>b
13240 </p><div>c</div>
13241 !! html/parsoid
13242 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>a&lt;/div>"}},"i":0}}]}'>a</div><p>b</p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;div>c&lt;/div>"}},"i":0}}]}'>
13243 </span><div about="#mwt2">c</div>
13244 !! end
13245
13246 !!test
13247 Templates: Inline Text: 1. Multiple template uses
13248 !! wikitext
13249 {{echo|Foo}}bar{{echo|baz}}
13250 !! html
13251 <p>Foobarbaz
13252 </p>
13253 !!end
13254
13255 !!test
13256 Templates: Inline Text: 2. Back-to-back template uses
13257 !! wikitext
13258 {{echo|Foo}}{{echo|bar}}
13259 !! html
13260 <p>Foobar
13261 </p>
13262 !!end
13263
13264 !!test
13265 Templates: Block Tags: 1. Multiple template uses
13266 !! wikitext
13267 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13268 !! html
13269 <div>Foo</div><div>bar</div><div>baz</div>
13270 !!end
13271
13272 !!test
13273 Templates: Block Tags: 2. Back-to-back template uses
13274 !! wikitext
13275 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13276 !! html
13277 <div>Foo</div><div>bar</div>
13278 !!end
13279
13280 ## Parsoid drops empty elements in templates.
13281 !! test
13282 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13283 !! wikitext
13284 {{echo|a
13285 b</p>}}
13286 !! html/php+tidy
13287 <p>a
13288 </p><p>
13289 b</p><p class="mw-empty-elt"></p>
13290 !! html/parsoid
13291 <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</p><span about="#mwt1">
13292 </span><p about="#mwt1">b</p>
13293 !! end
13294
13295 !!test
13296 Templates: Links: 1. Simple example
13297 !! wikitext
13298 {{echo|[[Foo|bar]]}}
13299 !! html
13300 <p><a href="/wiki/Foo" title="Foo">bar</a>
13301 </p>
13302 !!end
13303
13304 !!test
13305 Templates: Links: 2. Generation of link href
13306 !! wikitext
13307 [[{{echo|Foo}}|bar]]
13308 !! html
13309 <p><a href="/wiki/Foo" title="Foo">bar</a>
13310 </p>
13311 !!end
13312
13313 !!test
13314 Templates: Links: 3. Generation of part of a link href
13315 !! wikitext
13316 [[Fo{{echo|o}}|bar]]
13317
13318 [[Foo{{echo|bar}}]]
13319
13320 [[Foo{{echo|bar}}baz]]
13321
13322 [[Foo{{echo|bar}}|bar]]
13323
13324 [[:Foo{{echo|bar}}]]
13325
13326 [[:Foo{{echo|bar}}|bar]]
13327 !! html
13328 <p><a href="/wiki/Foo" title="Foo">bar</a>
13329 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13330 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13331 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13332 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13333 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13334 </p>
13335 !!end
13336
13337 !!test
13338 Templates: Links: 4. Multiple templates generating link href
13339 !! wikitext
13340 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13341 !! html
13342 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13343 </p>
13344 !!end
13345
13346 !!test
13347 Templates: Links: 5. Generation of link text
13348 !! wikitext
13349 [[Foo|{{echo|bar}}]]
13350 !! html
13351 <p><a href="/wiki/Foo" title="Foo">bar</a>
13352 </p>
13353 !!end
13354
13355 !!test
13356 Templates: Links: 5. Nested templates (only outermost template should be marked)
13357 !! wikitext
13358 {{echo|[[{{echo|Foo}}|bar]]}}
13359 !! html
13360 <p><a href="/wiki/Foo" title="Foo">bar</a>
13361 </p>
13362 !!end
13363
13364 !! test
13365 File with template filename
13366 !! wikitext
13367 [[File:{{echo|Foobar.jpg}}]]
13368 !! html/parsoid
13369 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"href"},{"html":"File:&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[7,26,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foobar.jpg\"}},\"i\":0}}]}&apos;>Foobar.jpg&lt;/span>"}]]}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:{{echo|Foobar.jpg}}"}}'/></a></figure-inline></p>
13370 !! end
13371
13372 !!test
13373 Templates: HTML Tag: 1. Generation of HTML attr. key
13374 !! wikitext
13375 <div {{echo|style}}="color:red;">foo</div>
13376 !! html
13377 <div style="color:red;">foo</div>
13378 !!end
13379
13380 !!test
13381 Templates: HTML Tag: 2. Generation of HTML attr. value
13382 !! wikitext
13383 <div style={{echo|'color:red;'}}>foo</div>
13384 !! html
13385 <div style="color:red;">foo</div>
13386 !!end
13387
13388 !!test
13389 Templates: HTML Tag: 3. Generation of HTML attr key and value
13390 !! wikitext
13391 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13392 !! html
13393 <div style="color:red;">foo</div>
13394 !!end
13395
13396 !!test
13397 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13398 !! wikitext
13399 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13400 !! html
13401 <div title="This is a long title with just one piece templated">foo</div>
13402 !!end
13403
13404 !!test
13405 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13406 !! wikitext
13407 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13408 !! html
13409 <div title="This is a long title with just one piece templated">foo</div>
13410 !!end
13411
13412 !!test
13413 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13414 !! wikitext
13415 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13416 !! html
13417 <div title="This is a long title with just one piece templated">foo</div>
13418 !!end
13419
13420 # SSS FIXME: While it is great we added support for all this,
13421 # do we want to make this part of the spec? Maybe we want to
13422 # deprecate this kind of usage in the future?
13423 !!test
13424 Templates: HTML Tag: 7. Generation of partial attribute key string
13425 !! wikitext
13426 <div st{{echo|yle}}="color:red;">foo</div>
13427 !! html
13428 <div style="color:red;">foo</div>
13429 !!end
13430
13431 !! test
13432 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13433 !! wikitext
13434 <div {{echo|1=id="v1"}}>bar</div>
13435 !! html
13436 <div id="v1">bar</div>
13437 !!end
13438
13439 !! test
13440 Templates: HTML Tag: 9. Multiple template-generated attributes
13441 !! wikitext
13442 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13443 !! html
13444 <div id="v1" title="foo">bar</div>
13445 !!end
13446
13447 !! test
13448 Templates: Support for templates generating attributes and content
13449 !! wikitext
13450 {| {{mixed_attr_content_template}}
13451 |-
13452 |bar
13453 |}
13454 !! html/php
13455 <table style="color:red;" title="T48811">
13456
13457 <tr>
13458 <td>foo
13459 </td></tr>
13460 <tr>
13461 <td>bar
13462 </td></tr></table>
13463 !! html/parsoid
13464 <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|}"]}'>
13465 <tbody><tr>
13466 <td>foo</td></tr>
13467 <tr>
13468 <td>bar</td></tr>
13469 </tbody></table>
13470 !!end
13471
13472 !! article
13473 Template:attribute_from_template
13474 !! text
13475 class="123"
13476 !! endarticle
13477
13478 !! test
13479 Table cell with attribute before expanded attribute
13480 !! wikitext
13481 {|
13482 | align="center" {{attribute_from_template}} |456
13483 |}
13484 !! html/parsoid
13485 <table>
13486 <tbody><tr><td align="center" class="123" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"class","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[]],\"dsr\":[20,47,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"attribute_from_template\",\"href\":\"./Template:Attribute_from_template\"},\"params\":{},\"i\":0}}]}&apos;>class=\"123\"&lt;/span>"},{"html":""}]]}'>456</td></tr>
13487 </tbody></table>
13488 !! end
13489
13490 !! test
13491 1. Entities and nowikis inside templated attributes should be handled correctly
13492 !! wikitext
13493 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13494 !! html/php
13495 <div style="background:#f9f9f9;">foo</div>
13496 !! html/parsoid
13497 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>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=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
13498 !! end
13499
13500 !! test
13501 2. Entities and nowikis inside templated attributes should be handled correctly
13502 !! wikitext
13503 {|
13504 |{{table_attribs_3}}
13505 |}
13506 !! html/php
13507 <table>
13508 <tr>
13509 <td style="background:#f9f9f9;">Foo
13510 </td></tr></table>
13511 !! html/parsoid
13512 <table>
13513 <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>
13514 </tbody></table>
13515 !! end
13516
13517 !! test
13518 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13519 !! wikitext
13520 {{tbl-start}}
13521 |{{table_attribs_3}}
13522 {{tbl-end}}
13523 !! html/php
13524 <table>
13525 <tr>
13526 <td style="background:#f9f9f9;">Foo
13527 </td></tr></table>
13528 !! html/parsoid
13529 <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}}]}'>
13530 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13531 </tbody></table>
13532 !! end
13533
13534 # T107622
13535 !! test
13536 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13537 !! wikitext
13538 {|
13539 |{{table_attribs_6}} hi
13540 |}
13541 !! html/php
13542 <table>
13543 <tr>
13544 <td style="background: red;">hi
13545 </td></tr></table>
13546 !! html/parsoid
13547 <table>
13548 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
13549 </tbody></table>
13550 !! end
13551
13552 !!test
13553 Templates: HTML Tables: 1. Generating start of a HTML table
13554 !! wikitext
13555 {{echo|<table><tr><td>foo</td>}}</tr></table>
13556 !! html
13557 <table><tr><td>foo</td></tr></table>
13558 !!end
13559
13560 !!test
13561 Templates: HTML Tables: 2a. Generating middle of a HTML table
13562 !! wikitext
13563 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13564 !! html
13565 <table><tr><td>foo</td></tr></table>
13566 !!end
13567
13568 !!test
13569 Templates: HTML Tables: 2b. Generating middle of a HTML table
13570 !! wikitext
13571 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13572 !! html
13573 <table><tr><td>foo</td></tr></table>
13574 !!end
13575
13576 !!test
13577 Templates: HTML Tables: 3. Generating end of a HTML table
13578 !! wikitext
13579 <table><tr>{{echo|<td>foo</td></tr></table>}}
13580 !! html
13581 <table><tr><td>foo</td></tr></table>
13582 !! end
13583
13584 !!test
13585 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13586 !! wikitext
13587 {{echo|<table>}}<tr><td>foo</td></tr></table>
13588 !! html
13589 <table><tr><td>foo</td></tr></table>
13590 !! end
13591
13592 !!test
13593 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13594 !! wikitext
13595 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13596 !! html
13597 <table><tr><td>foo</td></tr></table>
13598 !! end
13599
13600 !!test
13601 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13602 !! wikitext
13603 <table><tr>{{echo|<td>}}foo</td></tr></table>
13604 !! html
13605 <table><tr><td>foo</td></tr></table>
13606 !! end
13607
13608 !!test
13609 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13610 !! wikitext
13611 <table><tr><td>foo{{echo|</td>}}</tr></table>
13612 !! html
13613 <table><tr><td>foo</td></tr></table>
13614 !! end
13615
13616 !!test
13617 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13618 !! wikitext
13619 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13620 !! html
13621 <table><tr><td>foo</td></tr></table>
13622 !! end
13623
13624 !!test
13625 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13626 !! wikitext
13627 <table><tr><td>foo</td></tr>{{echo|</table>}}
13628 !! html
13629 <table><tr><td>foo</td></tr></table>
13630 !! end
13631
13632 !!test
13633 Templates: HTML Tables: 5. Proper fostering of categories from inside
13634 !!options
13635 parsoid=wt2html,wt2wt
13636 !! wikitext
13637 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13638 <!--Two categories (T52330)-->
13639 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13640 !! html/php+tidy
13641 <table><tbody><tr><td>foo</td></tr></tbody></table>
13642 <table><tbody><tr><td>foo</td></tr></tbody></table>
13643 !! html/parsoid
13644 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13645 <!--Two categories (T52330)-->
13646 <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>
13647 !!end
13648
13649 ## Remex doesn't account for fostered content.
13650 !! test
13651 Templates: Wiki Tables: 1a. Fostering of entire template content
13652 !! wikitext
13653 {|
13654 {{echo|a}}
13655 |}
13656 !! html/php
13657 <table>
13658 a
13659 <tr><td></td></tr></table>
13660 !! html/php+tidy
13661
13662 a
13663 <table><tbody><tr><td></td></tr></tbody></table>
13664 !! html/parsoid
13665 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
13666
13667 </table>
13668 !! end
13669
13670 !!test
13671 Templates: Wiki Tables: 1b. Fostering of entire template content
13672 !! wikitext
13673 {|
13674 {{echo|<div>}}
13675 foo
13676 {{echo|</div>}}
13677 |}
13678 !! html
13679 <table>
13680 <div>
13681 <p>foo
13682 </p>
13683 </div>
13684 <tr><td></td></tr></table>
13685 !! html/php+tidy
13686 <div>
13687 <p>foo
13688 </p>
13689 </div><table>
13690
13691 <tbody><tr><td></td></tr></tbody></table>
13692 !! html/parsoid
13693 <div about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":1}},"\n|}"]}'>
13694 <p>foo</p>
13695 </div><table about="#mwt3">
13696
13697 </table>
13698 !! end
13699
13700 ## Remex doesn't account for fostered content.
13701 !! test
13702 Templates: Wiki Tables: 2. Fostering of partial template content
13703 !! wikitext
13704 {|
13705 {{echo|a
13706 <div>b</div>}}
13707 |}
13708 !! html/php
13709 <table>
13710 a
13711 <div>b</div>
13712 <tr><td></td></tr></table>
13713 !! html/php+tidy
13714
13715 a
13716 <div>b</div><table>
13717 <tbody><tr><td></td></tr></tbody></table>
13718 !! html/parsoid
13719 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
13720
13721
13722 </table>
13723 !! end
13724
13725 !!test
13726 Templates: Wiki Tables: 3. td-content via multiple templates
13727 !! wikitext
13728 {|
13729 {{echo|{{pipe}}a}}{{echo|b}}
13730 |}
13731 !! html
13732 <table>
13733 <tr>
13734 <td>ab
13735 </td></tr></table>
13736 !! end
13737
13738 !!test
13739 Templates: Wiki Tables: 4. Templated tags, no content
13740 !! wikitext
13741 {{tbl-start}}
13742 {{tbl-end}}
13743 !! html
13744 <table>
13745 <tr><td></td></tr></table>
13746 !! end
13747
13748 !!test
13749 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13750 !! wikitext
13751 {{tbl-start}}
13752 |foo
13753 {{tbl-end}}
13754 !! html
13755 <table>
13756 <tr>
13757 <td>foo
13758 </td></tr></table>
13759 !! end
13760
13761 !!test
13762 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13763 !! wikitext
13764 {{tbl-start}}
13765 {{!}}foo
13766 {{tbl-end}}
13767 !! html
13768 <table>
13769 <tr>
13770 <td>foo
13771 </td></tr></table>
13772 !! end
13773
13774 ## This test case is very specific to Parsoid's internals
13775 ## and is hence only tested for Parsoid's code. Parsoid uses
13776 ## a <meta> marker tag for <ref> tags and they are expanded
13777 ## much later. We are verifying that this <meta> tag usage
13778 ## doesn't prevent foster parenting.
13779 !! test
13780 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13781 !! wikitext
13782 {{PartialTable}}<ref>foo</ref>
13783 |}
13784
13785 <references />
13786 !! html/parsoid
13787 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><sup about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p><table about="#mwt2">
13788 <tbody>
13789 </tbody></table>
13790
13791 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#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>
13792 !! end
13793
13794 !! test
13795 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13796 !! wikitext
13797 {{echo|
13798 {{{!}}
13799 {{!}}-}}
13800 <onlyinclude>
13801 |foo
13802 </onlyinclude>
13803 {{!}}}
13804 !! html/parsoid
13805 <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{{!}}}"]}'>
13806 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13807 <tbody><tr>
13808
13809 <td>foo
13810 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13811 </tbody></table>
13812 !! end
13813
13814 !!test
13815 Templates: Lists: Multi-line list-items via templates
13816 !! wikitext
13817 *{{echo|a {{nonexistent|
13818 unused}}}}
13819 *{{echo|b {{nonexistent|
13820 unused}}}}
13821 !! html
13822 <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>
13823 <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>
13824 !!end
13825
13826 !!test
13827 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13828 !! wikitext
13829 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13830 !! html
13831 <p><i>ab</i>c<i>d</i>e
13832 </p>
13833 !!end
13834
13835 !!test
13836 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13837 (PHP parser generates misnested html)
13838 !! wikitext
13839 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13840 !! html/parsoid
13841 <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>
13842 !!end
13843
13844 !!test
13845 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13846 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13847 !! options
13848 parsoid=wt2html,wt2wt
13849 !! wikitext
13850 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13851 !! html/php+tidy
13852 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13853 !! html/parsoid
13854 <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>
13855 <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>
13856 <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>
13857 !!end
13858
13859 !!test
13860 Templates: Ugly nesting: 4. Divs opened/closed across templates
13861 !! wikitext
13862 a<div>b{{echo|c</div>d}}e
13863 !! html
13864 a<div>bc</div>de
13865 !! html+tidy
13866 <p>a</p><div>bc</div><p>de</p>
13867 !! end
13868
13869 !! test
13870 Templates: Ugly templates: 3. newline-only template parameter
13871 !! wikitext
13872 foo {{echo|
13873 }}
13874 !! html
13875 <p>foo
13876 </p>
13877 !! end
13878
13879 # This looks like a bug: a single newline triggers p/br for some reason.
13880 !! test
13881 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13882 !! wikitext
13883 {{echo|
13884 }}
13885 !! html
13886 <p><br />
13887 </p>
13888 !! end
13889
13890 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13891 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13892 !! test
13893 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13894 !! wikitext
13895 {{echo|<table>}}
13896 {{echo|<div>foo}}
13897 {{echo|</table>}}
13898 !! html/parsoid
13899 <div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' 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}}]}'>foo</div><span about="#mwt1">
13900 </span><table about="#mwt1">
13901 </table>
13902 !! end
13903
13904 # T66017 -- ugly wikitext with fostered content generates two template ranges
13905 # that are "identical" and generate nesting cycles in the algorithm
13906 !! test
13907 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13908 !! wikitext
13909 {{echo|<table><tr><td><table>}}
13910 {{echo|<div>}}
13911 {{echo|</div>}}
13912 !! html/parsoid
13913 <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"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
13914 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13915 </table></td></tr></tbody></table>
13916 !! end
13917
13918 !! test
13919 Templates: Parameters substituted at the top-level
13920 !! wikitext
13921 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13922
13923 {{{foo|bar|baz}}}
13924 !! html/php
13925 <p><i>who</i> me? <b>never!</b>
13926 </p><p>bar
13927 </p>
13928 !! html/parsoid
13929 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
13930
13931 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13932 !! end
13933
13934 !! test
13935 Templates: Param with empty arg in the final position
13936 !! wikitext
13937 {{{hi|}}}
13938 !! html/parsoid
13939 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13940 !! end
13941
13942 !!test
13943 Parser Functions: 1. Simple example
13944 !! wikitext
13945 {{uc:foo}}
13946 !! html
13947 <p>FOO
13948 </p>
13949 !!end
13950
13951 !!test
13952 Parser Functions: 2. Nested use (only outermost should be marked up)
13953 !! wikitext
13954 {{uc:{{lc:FOO}}}}
13955 !! html
13956 <p>FOO
13957 </p>
13958 !!end
13959
13960 ## Note that the templates inside the references are not wrapped
13961 !! test
13962 Template nested in extension tag in template
13963 !! options
13964 title=[[Main Page]]
13965 language=zh
13966 !! wikitext
13967 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13968 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13969 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13970 <references />
13971 !! html/parsoid
13972 <p><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>[[ho|{{echo|hi}}]]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-1"}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup>
13973 <span about="#mwt8" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>[http://test.com?q={{echo|ho}}]&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt8" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-2"}}'><a href="./Main_Page#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></sup>
13974 <span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;ref>-{ho|{{echo|hi}}}-&lt;/ref>"}},"i":0}}]}'>hi</span><sup about="#mwt13" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{},"body":{"id":"mw-reference-text-cite_note-3"}}'><a href="./Main_Page#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></sup></p>
13975 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt17" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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"><a rel="mw:WikiLink" href="./Ho" title="Ho">hi</a></span></li><li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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"><a rel="mw:ExtLink" href="http://test.com?q=ho" class="external autonumber"></a></span></li><li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#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"><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["ho"],"t":"hi"}}'></span></span></li></ol>
13976 !! end
13977
13978 ###
13979 ### Pre-save transform tests
13980 ###
13981
13982 !! test
13983 pre-save transform: subst:
13984 !! options
13985 pst
13986 !! wikitext
13987 {{subst:test}}
13988 !! html/php
13989 This is a test template
13990 !! end
13991
13992 !! test
13993 pre-save transform: normal template
13994 !! options
13995 pst
13996 !! wikitext
13997 {{test}}
13998 !! html/php
13999 {{test}}
14000 !! end
14001
14002 !! test
14003 pre-save transform: nonexistent template
14004 !! options
14005 pst
14006 !! wikitext
14007 {{thistemplatedoesnotexist}}
14008 !! html/php
14009 {{thistemplatedoesnotexist}}
14010 !! end
14011
14012 !! test
14013 pre-save transform: subst magic variables
14014 !! options
14015 pst
14016 !! wikitext
14017 {{subst:SITENAME}}
14018 !! html/php
14019 MediaWiki
14020 !! end
14021
14022 # This is T2089, which I fixed. -- wtm
14023 !! test
14024 pre-save transform: subst: templates with parameters
14025 !! options
14026 pst
14027 !! wikitext
14028 {{subst:paramtest|param="something else"}}
14029 !! html/php
14030 This is a test template with parameter "something else"
14031 !! end
14032
14033 !! article
14034 Template:nowikitest
14035 !! text
14036 <nowiki>'''not wiki'''</nowiki>
14037 !! endarticle
14038
14039 !! test
14040 pre-save transform: nowiki in subst (T3188)
14041 !! options
14042 pst
14043 !! wikitext
14044 {{subst:nowikitest}}
14045 !! html/php
14046 <nowiki>'''not wiki'''</nowiki>
14047 !! end
14048
14049 !! article
14050 Template:commenttest
14051 !! text
14052 This template has <!-- a comment --> in it.
14053 !! endarticle
14054
14055 !! test
14056 pre-save transform: comment in subst (T3936)
14057 !! options
14058 pst
14059 !! wikitext
14060 {{subst:commenttest}}
14061 !! html/php
14062 This template has <!-- a comment --> in it.
14063 !! end
14064
14065 !! test
14066 pre-save transform: unclosed tag
14067 !! options
14068 pst
14069 !! wikitext
14070 <nowiki>'''not wiki'''
14071 !! html/php
14072 <nowiki>'''not wiki'''
14073 !! end
14074
14075 !! test
14076 pre-save transform: mixed tag case
14077 !! options
14078 pst
14079 !! wikitext
14080 <NOwiki>'''not wiki'''</noWIKI>
14081 !! html/php
14082 <NOwiki>'''not wiki'''</noWIKI>
14083 !! end
14084
14085 !! test
14086 pre-save transform: unclosed comment in <nowiki>
14087 !! options
14088 pst
14089 !! wikitext
14090 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
14091 !! html/php
14092 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
14093 !!end
14094
14095 # Leading @ in this template definition works around a limitation
14096 # in parsoid's parserTests which otherwise strips the <span> from the
14097 # result (confusing it for a template wrapper)
14098 !! article
14099 Template:dangerous
14100 !!text
14101 @<span onmouseover="alert('crap')">Oh no</span>
14102 !!endarticle
14103
14104 !!test
14105 (confirming safety of fix for subst T3936)
14106 !! wikitext
14107 {{Template:dangerous}}
14108 !! html
14109 <p>@<span>Oh no</span>
14110 </p>
14111 !! end
14112
14113 !! test
14114 pre-save transform: comment containing gallery (T7024)
14115 !! options
14116 pst
14117 !! wikitext
14118 <!-- <gallery>data</gallery> -->
14119 !! html/php
14120 <!-- <gallery>data</gallery> -->
14121 !!end
14122
14123 !! test
14124 pre-save transform: comment containing extension
14125 !! options
14126 pst
14127 !! wikitext
14128 <!-- <tag>data</tag> -->
14129 !! html/php
14130 <!-- <tag>data</tag> -->
14131 !!end
14132
14133 !! test
14134 pre-save transform: comment containing nowiki
14135 !! options
14136 pst
14137 !! wikitext
14138 <!-- <nowiki>data</nowiki> -->
14139 !! html/php
14140 <!-- <nowiki>data</nowiki> -->
14141 !!end
14142
14143 !! test
14144 pre-save transform: <noinclude> in subst (T5298)
14145 !! options
14146 pst
14147 !! wikitext
14148 {{subst:Includes}}
14149 !! html/php
14150 Foobar
14151 !! end
14152
14153 !! test
14154 pre-save transform: <onlyinclude> in subst (T5298)
14155 !! options
14156 pst
14157 !! wikitext
14158 {{subst:Includes2}}
14159 !! html/php
14160 Foo
14161 !! end
14162
14163 !! article
14164 Template:SubstTest
14165 !!text
14166 {{<includeonly>subst:</includeonly>Includes}}
14167 !! endarticle
14168
14169 !! article
14170 Template:SafeSubstTest
14171 !! text
14172 {{<includeonly>safesubst:</includeonly>Includes}}
14173 !! endarticle
14174
14175 !! test
14176 T24297: safesubst: works during PST
14177 !! options
14178 pst
14179 !! wikitext
14180 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
14181 !! html/php
14182 FoobarFoobar
14183 !! end
14184
14185 !! test
14186 T24297: safesubst: works during normal parse
14187 !! wikitext
14188 {{SafeSubstTest}}
14189 !! html
14190 <p>Foobar
14191 </p>
14192 !! end
14193
14194 !! test
14195 subst: does not work during normal parse
14196 !! wikitext
14197 {{SubstTest}}
14198 !! html
14199 <p>{{subst:Includes}}
14200 </p>
14201 !! end
14202
14203 !! test
14204 pre-save transform: context links ("pipe trick")
14205 !! options
14206 pst
14207 !! wikitext
14208 [[Article (context)|]]
14209 [[Bar:Article|]]
14210 [[:Bar:Article|]]
14211 [[Bar:Article (context)|]]
14212 [[:Bar:Article (context)|]]
14213 [[|Article]]
14214 [[|Article (context)]]
14215 [[Bar:X (Y) Z|]]
14216 [[:Bar:X (Y) Z|]]
14217 !! html/php
14218 [[Article (context)|Article]]
14219 [[Bar:Article|Article]]
14220 [[:Bar:Article|Article]]
14221 [[Bar:Article (context)|Article]]
14222 [[:Bar:Article (context)|Article]]
14223 [[Article]]
14224 [[Article (context)]]
14225 [[Bar:X (Y) Z|X (Y) Z]]
14226 [[:Bar:X (Y) Z|X (Y) Z]]
14227 !! end
14228
14229 !! test
14230 pre-save transform: context links ("pipe trick") with interwiki prefix
14231 !! options
14232 pst
14233 !! wikitext
14234 [[interwiki:Article|]]
14235 [[:interwiki:Article|]]
14236 [[interwiki:Bar:Article|]]
14237 [[:interwiki:Bar:Article|]]
14238 !! html/php
14239 [[interwiki:Article|Article]]
14240 [[:interwiki:Article|Article]]
14241 [[interwiki:Bar:Article|Bar:Article]]
14242 [[:interwiki:Bar:Article|Bar:Article]]
14243 !! end
14244
14245 !! test
14246 pre-save transform: context links ("pipe trick") with parens in title
14247 !! options
14248 pst title=[[Somearticle (context)]]
14249 !! wikitext
14250 [[|Article]]
14251 !! html/php
14252 [[Article (context)|Article]]
14253 !! end
14254
14255 !! test
14256 pre-save transform: context links ("pipe trick") with comma in title
14257 !! options
14258 pst title=[[Someplace, Somewhere]]
14259 !! wikitext
14260 [[|Otherplace]]
14261 [[Otherplace, Elsewhere|]]
14262 [[Otherplace, Elsewhere, Anywhere|]]
14263 !! html/php
14264 [[Otherplace, Somewhere|Otherplace]]
14265 [[Otherplace, Elsewhere|Otherplace]]
14266 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14267 !! end
14268
14269 !! test
14270 pre-save transform: context links ("pipe trick") with parens and comma
14271 !! options
14272 pst title=[[Someplace (IGNORED), Somewhere]]
14273 !! wikitext
14274 [[|Otherplace]]
14275 [[Otherplace (place), Elsewhere|]]
14276 !! html/php
14277 [[Otherplace, Somewhere|Otherplace]]
14278 [[Otherplace (place), Elsewhere|Otherplace]]
14279 !! end
14280
14281 !! test
14282 pre-save transform: context links ("pipe trick") with comma and parens
14283 !! options
14284 pst title=[[Who, me? (context)]]
14285 !! wikitext
14286 [[|Yes, you.]]
14287 [[Me, Myself, and I (1937 song)|]]
14288 !! html/php
14289 [[Yes, you. (context)|Yes, you.]]
14290 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14291 !! end
14292
14293 !! test
14294 pre-save transform: context links ("pipe trick") with namespace
14295 !! options
14296 pst title=[[Ns:Somearticle]]
14297 !! wikitext
14298 [[|Article]]
14299 !! html/php
14300 [[Ns:Article|Article]]
14301 !! end
14302
14303 !! test
14304 pre-save transform: context links ("pipe trick") with namespace and parens
14305 !! options
14306 pst title=[[Ns:Somearticle (context)]]
14307 !! wikitext
14308 [[|Article]]
14309 !! html/php
14310 [[Ns:Article (context)|Article]]
14311 !! end
14312
14313 !! test
14314 pre-save transform: context links ("pipe trick") with namespace and comma
14315 !! options
14316 pst title=[[Ns:Somearticle, Context, Whatever]]
14317 !! wikitext
14318 [[|Article]]
14319 !! html/php
14320 [[Ns:Article, Context, Whatever|Article]]
14321 !! end
14322
14323 !! test
14324 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14325 !! options
14326 pst title=[[Ns:Somearticle, Context (context)]]
14327 !! wikitext
14328 [[|Article]]
14329 !! html/php
14330 [[Ns:Article (context)|Article]]
14331 !! end
14332
14333 !! test
14334 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14335 !! options
14336 pst title=[[Ns:Somearticle (IGNORED), Context]]
14337 !! wikitext
14338 [[|Article]]
14339 !! html/php
14340 [[Ns:Article, Context|Article]]
14341 !! end
14342
14343 !! test
14344 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14345 !! options
14346 pst
14347 !! wikitext
14348 [[Article(context)|]]
14349 [[Bar:Article(context)|]]
14350 [[:Bar:Article(context)|]]
14351 [[|Article(context)]]
14352 [[Bar:X(Y)Z|]]
14353 [[:Bar:X(Y)Z|]]
14354 !! html/php
14355 [[Article(context)|Article]]
14356 [[Bar:Article(context)|Article]]
14357 [[:Bar:Article(context)|Article]]
14358 [[Article(context)]]
14359 [[Bar:X(Y)Z|X(Y)Z]]
14360 [[:Bar:X(Y)Z|X(Y)Z]]
14361 !! end
14362
14363 !! test
14364 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14365 !! options
14366 pst
14367 !! wikitext
14368 [[Article (context)|]]
14369 [[Bar:Article (context)|]]
14370 [[:Bar:Article (context)|]]
14371 [[|Article (context)]]
14372 [[Bar:X (Y) Z|]]
14373 [[:Bar:X (Y) Z|]]
14374 !! html/php
14375 [[Article (context)|Article]]
14376 [[Bar:Article (context)|Article]]
14377 [[:Bar:Article (context)|Article]]
14378 [[Article (context)]]
14379 [[Bar:X (Y) Z|X (Y) Z]]
14380 [[:Bar:X (Y) Z|X (Y) Z]]
14381 !! end
14382
14383 !! test
14384 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14385 !! options
14386 pst
14387 !! wikitext
14388 [[Article(context)|]]
14389 [[Bar:Article(context)|]]
14390 [[:Bar:Article(context)|]]
14391 [[|Article(context)]]
14392 [[Bar:X(Y)Z|]]
14393 [[:Bar:X(Y)Z|]]
14394 !! html/php
14395 [[Article(context)|Article]]
14396 [[Bar:Article(context)|Article]]
14397 [[:Bar:Article(context)|Article]]
14398 [[Article(context)]]
14399 [[Bar:X(Y)Z|X(Y)Z]]
14400 [[:Bar:X(Y)Z|X(Y)Z]]
14401 !! end
14402
14403 !! test
14404 pre-save transform: context links ("pipe trick") with commas (T23660)
14405 !! options
14406 pst
14407 !! wikitext
14408 [[Article (context), context|]]
14409 [[Article (context),context|]]
14410 [[Bar:Article (context), context|]]
14411 [[Bar:Article (context),context|]]
14412 [[:Bar:Article (context), context|]]
14413 [[:Bar:Article (context),context|]]
14414 !! html/php
14415 [[Article (context), context|Article]]
14416 [[Article (context),context|Article]]
14417 [[Bar:Article (context), context|Article]]
14418 [[Bar:Article (context),context|Article]]
14419 [[:Bar:Article (context), context|Article]]
14420 [[:Bar:Article (context),context|Article]]
14421 !! end
14422
14423 !! test
14424 Parsoid: backwards pipe trick
14425 !! wikitext
14426 [[|'''bar''']]
14427 !! html/php
14428 <p>[[|<b>bar</b>]]
14429 </p>
14430 !! html/parsoid
14431 <p>[[|<b>bar</b>]]</p>
14432 !! end
14433
14434 !! test
14435 pre-save transform: trim trailing empty lines
14436 !! options
14437 pst
14438 !! wikitext
14439 Empty lines are trimmed
14440
14441
14442
14443
14444 !! html/php
14445 Empty lines are trimmed
14446 !! end
14447
14448 !! test
14449 pre-save transform: Signature expansion
14450 !! options
14451 pst
14452 !! wikitext
14453 * ~~~
14454 * ~~~~
14455 * ~~~~~
14456 * <noinclude>~~~</noinclude>
14457 * <includeonly>~~~</includeonly>
14458 * <onlyinclude>~~~</onlyinclude>
14459 !! html/php
14460 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14461 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14462 * 00:02, 1 January 1970 (UTC)
14463 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14464 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14465 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14466 !! end
14467
14468
14469 !! test
14470 ParserOutput flags from signature expansion (T84843)
14471 !! options
14472 pst
14473 showflags
14474 !! wikitext
14475 ~~~~
14476 !! html/php
14477 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14478 flags=user-signature
14479 !! end
14480
14481
14482 !! test
14483 pre-save transform: Signature expansion in nowiki tags (T2093)
14484 !! options
14485 pst disabled
14486 !! wikitext
14487 Shall not expand:
14488
14489 <nowiki>~~~~</nowiki>
14490
14491 <includeonly><nowiki>~~~~</nowiki></includeonly>
14492
14493 <noinclude><nowiki>~~~~</nowiki></noinclude>
14494
14495 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14496
14497 {{subst:Foo}} shall be converted to FOO
14498
14499 As well as inside noinclude/onlyinclude
14500 <noinclude>{{subst:Foo}}</noinclude>
14501 <onlyinclude>{{subst:Foo}}</onlyinclude>
14502
14503 But not inside includeonly
14504 <includeonly>{{subst:Foo}}</includeonly>
14505 !! html/php
14506 Shall not expand:
14507
14508 <nowiki>~~~~</nowiki>
14509
14510 <includeonly><nowiki>~~~~</nowiki></includeonly>
14511
14512 <noinclude><nowiki>~~~~</nowiki></noinclude>
14513
14514 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14515
14516 FOO shall be converted to FOO
14517
14518 As well as inside noinclude/onlyinclude
14519 <noinclude>FOO</noinclude>
14520 <onlyinclude>FOO</onlyinclude>
14521
14522 But not inside includeonly
14523 <includeonly>{{subst:Foo}}</includeonly>
14524 !! end
14525
14526 !! test
14527 Parsoid: Recognize nowiki with trailing space in tags
14528 !! options
14529 parsoid=wt2html
14530 !! wikitext
14531 <nowiki ><div>[[foo]]</nowiki >
14532
14533 a<nowiki / >b
14534
14535 c<nowiki />d
14536
14537 e<nowiki/ >f
14538 !! html/php+tidy
14539 <p>&lt;div&gt;[[foo]]
14540 </p><p>a&lt;nowiki / &gt;b
14541 </p><p>cd
14542 </p><p>e&lt;nowiki/ &gt;f
14543 </p>
14544 !! html/parsoid
14545 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14546
14547 <p>a&lt;nowiki / >b</p>
14548
14549 <p>c<span typeof="mw:Nowiki"></span>d</p>
14550
14551 <p>e&lt;nowiki/ >f</p>
14552 !! end
14553
14554 !! test
14555 Parsoid: Recognize nowiki with odd capitalization
14556 !! options
14557 parsoid=wt2html
14558 !! wikitext
14559 <noWikI ><div>[[foo]]</Nowiki >
14560 !! html/php+tidy
14561 <p>&lt;div&gt;[[foo]]
14562 </p>
14563 !! html/parsoid
14564 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14565 !! end
14566
14567
14568 !! test
14569 Parsoid: Escape nowiki with trailing space in tags
14570 !! options
14571 parsoid=html2wt
14572 !! html/parsoid
14573 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14574 <p>a&lt;nowiki /&gt;b</p>
14575 <p>c&lt;nowiki/ &gt;d</p>
14576 !! wikitext
14577 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14578
14579 a&lt;nowiki /&gt;b
14580
14581 c&lt;nowiki/ &gt;d
14582 !! end
14583
14584 !! test
14585 Parsoid: Escape weird noWikI capitalizations
14586 !! options
14587 parsoid=html2wt
14588 !! html/parsoid
14589 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14590 !! wikitext
14591 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14592 !! end
14593
14594 ###
14595 ### Message transform tests
14596 ###
14597 !! test
14598 message transform: magic variables
14599 !! options
14600 msg
14601 !! wikitext
14602 {{SITENAME}}
14603 !! html
14604 MediaWiki
14605 !! end
14606
14607 !! test
14608 message transform: should not transform wiki markup
14609 !! options
14610 msg
14611 !! wikitext
14612 ''test''
14613 !! html
14614 ''test''
14615 !! end
14616
14617 !! test
14618 message transform: <noinclude> in transcluded template (T6926)
14619 !! options
14620 msg
14621 !! wikitext
14622 {{Includes}}
14623 !! html
14624 Foobar
14625 !! end
14626
14627 !! test
14628 message transform: <onlyinclude> in transcluded template (T6926)
14629 !! options
14630 msg
14631 !! wikitext
14632 {{Includes2}}
14633 !! html
14634 Foo
14635 !! end
14636
14637 !! test
14638 {{#special:}} page name, known
14639 !! options
14640 msg
14641 !! wikitext
14642 {{#special:Recentchanges}}
14643 !! html
14644 Special:RecentChanges
14645 !! end
14646
14647 !! test
14648 {{#special:}} page name with subpage, known
14649 !! options
14650 msg
14651 !! wikitext
14652 {{#special:Recentchanges/param}}
14653 !! html
14654 Special:RecentChanges/param
14655 !! end
14656
14657 !! test
14658 {{#special:}} page name, unknown
14659 !! options
14660 msg
14661 !! wikitext
14662 {{#special:foobar nonexistent}}
14663 !! html
14664 Special:Foobar nonexistent
14665 !! end
14666
14667 !! test
14668 {{#speciale:}} page name, known
14669 !! options
14670 msg
14671 !! wikitext
14672 {{#speciale:Recentchanges}}
14673 !! html
14674 Special:RecentChanges
14675 !! end
14676
14677 !! test
14678 {{#speciale:}} page name with subpage, known
14679 !! options
14680 msg
14681 !! wikitext
14682 {{#speciale:Recentchanges/param}}
14683 !! html
14684 Special:RecentChanges/param
14685 !! end
14686
14687 !! test
14688 {{#speciale:}} page name, unknown
14689 !! options
14690 msg
14691 !! wikitext
14692 {{#speciale:foobar nonexistent}}
14693 !! html
14694 Special:Foobar_nonexistent
14695 !! end
14696
14697 ###
14698 ### Images
14699 ###
14700 ### For Parsoid-specific tests, see
14701 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14702
14703 !! test
14704 Simple image
14705 !! options
14706 parsoid=wt2html,wt2wt,html2html
14707 !! wikitext
14708 [[Image:foobar.jpg]]
14709 !! html/php
14710 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
14711 </p>
14712 !! html/parsoid
14713 <p><figure-inline 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></figure-inline></p>
14714 !! end
14715
14716 !! test
14717 Serialize simple image with span wrapper
14718 !! options
14719 parsoid=html2wt
14720 !! html/parsoid
14721 <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>
14722 !! wikitext
14723 [[File:Foobar.jpg]]
14724 !! end
14725
14726 !! test
14727 Simple image (using File: namespace, now canonical)
14728 !! wikitext
14729 [[File:Foobar.jpg]]
14730 !! html/php
14731 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
14732 </p>
14733 !! html/parsoid
14734 <p><figure-inline 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></figure-inline></p>
14735 !! end
14736
14737 !! test
14738 Right-aligned image
14739 !! wikitext
14740 [[File:Foobar.jpg|right]]
14741 !! html/php
14742 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a></div>
14743 !! html/parsoid
14744 <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></figcaption></figure>
14745 !! end
14746
14747 !! test
14748 Image with caption
14749 !! wikitext
14750 [[File:Foobar.jpg|right|Caption text]]
14751 !! html/php
14752 <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" decoding="async" width="1941" height="220" /></a></div>
14753 !! html/parsoid
14754 <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>
14755 !! end
14756
14757 !! test
14758 Image with caption, T55312 #1
14759 !! wikitext
14760 [[File:Foobar.jpg|right|Caption page stuff]]
14761 !! html/php
14762 <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" decoding="async" width="1941" height="220" /></a></div>
14763 !! html/parsoid
14764 <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>
14765 !! end
14766
14767 !! test
14768 Image with caption, T55312 #2
14769 !! wikitext
14770 [[File:Foobar.jpg|right|Caption page=]]
14771 !! html/php
14772 <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" decoding="async" width="1941" height="220" /></a></div>
14773 !! html/parsoid
14774 <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>
14775 !! end
14776
14777 !! test
14778 Image with caption, T55312 #3
14779 !! wikitext
14780 [[File:Foobar.jpg|right|Caption page=stuff]]
14781 !! html/php
14782 <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" decoding="async" width="1941" height="220" /></a></div>
14783 !! html/parsoid
14784 <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>
14785 !! end
14786
14787 !! test
14788 Image caption with pipe entity
14789 !! wikitext
14790 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14791 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14792 !! html/php
14793 <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" decoding="async" 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>one &#x7c; two</div></div></div>
14794 <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" decoding="async" 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>one <i>two</i> &#x7c; three</div></div></div>
14795 !! html/parsoid
14796 <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>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
14797 <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>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
14798 !! end
14799
14800 !! test
14801 Allow empty links in image captions (T62753)
14802 !! options
14803 thumbsize=220
14804 !! wikitext
14805 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14806 [[]]
14807 [[Link2]]
14808 ]]
14809 !! html/php
14810 <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" decoding="async" 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>
14811 !! html/parsoid
14812 <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>
14813 [[]]
14814 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14815 </figcaption></figure>
14816 !! end
14817
14818 !! test
14819 Titles in unlinked images (T23454)
14820 !! wikitext
14821 [[File:Foobar.jpg|link=|stuff]]
14822 !! html/php
14823 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" title="stuff" width="1941" height="220" />
14824 </p>
14825 !! html/parsoid
14826 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"stuff"}'><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></figure-inline></p>
14827 !! end
14828
14829 !! test
14830 Link with empty target
14831 !! wikitext
14832 [[]]
14833 !! html
14834 <p>[[]]
14835 </p>
14836 !! end
14837
14838 !! test
14839 Image with link trail
14840 !! wikitext
14841 Linktrails should not work for images: [[File:Foobar.jpg]]s
14842 !! html/php
14843 <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" decoding="async" width="1941" height="220" /></a>s
14844 </p>
14845 !! html/parsoid
14846 <p>Linktrails should not work for images: <figure-inline 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></figure-inline>s</p>
14847 !! end
14848
14849 !! test
14850 Image with empty attribute
14851 !! options
14852 parsoid=wt2html,wt2wt,html2html
14853 !! wikitext
14854 [[File:Foobar.jpg|right||Caption text]]
14855 !! html/php
14856 <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" decoding="async" width="1941" height="220" /></a></div>
14857 !! html/parsoid
14858 <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>
14859 !! end
14860
14861 !! test
14862 1. Block image with individual attributes from templates
14863 !! wikitext
14864 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14865 !! html/php
14866 <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" decoding="async" 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>
14867 !! html/parsoid
14868 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14869 !! end
14870
14871 !! test
14872 2. Block Image with individual attributes from templates
14873 !! wikitext
14874 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14875 !! html/php
14876 <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" decoding="async" 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>
14877 !! html/parsoid
14878 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
14879 !! end
14880
14881 !! test
14882 3. Inline image with individual attributes from templates
14883 !! wikitext
14884 [[File:Foobar.jpg|{{echo|50px}}]]
14885 !! html/php
14886 <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" decoding="async" 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>
14887 </p>
14888 !! html/parsoid
14889 <p><figure-inline 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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
14890 !! end
14891
14892 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14893 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14894 !! test
14895 Image with multiple attributes from the same template
14896 !! wikitext
14897 [[File:Foobar.jpg|{{image_attribs}}]]
14898 !! html/php
14899 <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" decoding="async" width="1941" height="220" /></a></div>
14900 !! html/parsoid
14901 <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>
14902 !! end
14903
14904 !! test
14905 Image with link tails
14906 !! options
14907 thumbsize=220
14908 !! wikitext
14909 123[[File:Foobar.jpg]]456
14910 123[[File:Foobar.jpg|right]]456
14911 123[[File:Foobar.jpg|thumb]]456
14912 !! html/php
14913 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>456
14914 </p>
14915 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" decoding="async" width="1941" height="220" /></a></div>456
14916 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" decoding="async" 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
14917 !! html/php+tidy
14918 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>456
14919 </p><p>
14920 123</p><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a></div><p>456
14921 123</p><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" decoding="async" 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><p>456</p>
14922 !! html/parsoid
14923 <p>123<figure-inline 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></figure-inline>456</p>
14924 <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><figcaption></figcaption></figure><p>456
14925 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><figcaption></figcaption></figure><p>456</p>
14926 !! end
14927
14928 !! test
14929 Image with multiple captions -- only last one is accepted
14930 !! wikitext
14931 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14932 !! html/php
14933 <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" decoding="async" width="1941" height="220" /></a></div>
14934 !! html/parsoid
14935 <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>
14936 !! end
14937
14938 !! test
14939 Image with multiple widths -- use last
14940 !! wikitext
14941 [[File:Foobar.jpg|200px|300px|caption]]
14942 !! html/php
14943 <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" decoding="async" 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>
14944 </p>
14945 !! html/parsoid
14946 <p><figure-inline 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></figure-inline></p>
14947 !! end
14948
14949 !! test
14950 Image with multiple alignments -- use first (T50664)
14951 !! options
14952 thumbsize=220
14953 !! wikitext
14954 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14955
14956 [[File:Foobar.jpg|middle|text-top|caption]]
14957 !! html/php
14958 <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" decoding="async" 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>
14959 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" style="vertical-align: middle" /></a>
14960 </p>
14961 !! html/parsoid
14962 <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>
14963 <p><figure-inline 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></figure-inline></p>
14964 !! end
14965
14966 !! test
14967 Image with width attribute at different positions
14968 !! wikitext
14969 [[File:Foobar.jpg|200px|right|Caption]]
14970 [[File:Foobar.jpg|right|200px|Caption]]
14971 [[File:Foobar.jpg|right|Caption|200px]]
14972 !! html/php
14973 <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" decoding="async" 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>
14974 <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" decoding="async" 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>
14975 <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" decoding="async" 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>
14976 !! html/parsoid
14977 <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>
14978 <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>
14979 <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>
14980 !! end
14981
14982 # a sad bit of backward-compatibility
14983 !! test
14984 Image with size specified with pxpx (T15500, T53628)
14985 !! options
14986 parsoid=wt2html,wt2wt,html2html
14987 !! wikitext
14988 [[File:Foobar.jpg|20pxpx]]
14989 [[File:Foobar.jpg|200x20pxpx]]
14990 !! html/php
14991 <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" decoding="async" 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>
14992 <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" decoding="async" 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>
14993 </p>
14994 !! html/parsoid
14995 <p><figure-inline 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></figure-inline> <figure-inline 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></figure-inline></p>
14996 !! end
14997
14998 !! test
14999 Image with link parameter, wiki target
15000 !! wikitext
15001 [[File:Foobar.jpg|link=Main Page]]
15002 !! html/php
15003 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15004 </p>
15005 !! html/parsoid
15006 <p><figure-inline 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></figure-inline></p>
15007 !! end
15008
15009 # parsoid T51293 (part 1)
15010 !! test
15011 Image with link parameter, URL target
15012 !! wikitext
15013 [[File:Foobar.jpg|link=http://example.com/]]
15014 !! html/php
15015 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15016 </p>
15017 !! html/parsoid
15018 <p><figure-inline 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></figure-inline></p>
15019 !! end
15020
15021 # parsoid T51293 (part 2)
15022 !! test
15023 Image with link parameter, protocol-less URL target
15024 !! wikitext
15025 [[File:Foobar.jpg|link=//example.com/]]
15026 !! html/php
15027 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15028 </p>
15029 !! html/parsoid
15030 <p><figure-inline 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></figure-inline></p>
15031 !! end
15032
15033 !! test
15034 Escaping non-block captions (T107435)
15035 !! options
15036 parsoid={
15037 "modes": ["wt2wt"],
15038 "changes": [
15039 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
15040 ]
15041 }
15042 !! wikitext
15043 [[Image:Foobar.jpg|caption]]
15044 !! wikitext/edited
15045 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
15046 !! end
15047
15048 # wgExternalLinkTarget not supported by Parsoid
15049 !! test
15050 Image with link parameter, wgExternalLinkTarget
15051 !! wikitext
15052 [[Image:foobar.jpg|link=http://example.com/]]
15053 !! config
15054 wgExternalLinkTarget='foobar'
15055 !! html/php
15056 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15057 </p>
15058 !! end
15059
15060 !! test
15061 Image with link parameter, wgNoFollowLinks set to false
15062 !! wikitext
15063 [[Image:foobar.jpg|link=http://example.com/]]
15064 !! config
15065 wgNoFollowLinks=false
15066 !! html/php
15067 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15068 </p>
15069 !! end
15070
15071 !! test
15072 Image with link parameter, wgNoFollowDomainExceptions
15073 !! wikitext
15074 [[Image:foobar.jpg|link=http://example.com/]]
15075 !! config
15076 wgNoFollowDomainExceptions='example.com'
15077 !! html/php
15078 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15079 </p>
15080 !! end
15081
15082 # wgExternalLinkTarget not supported by Parsoid
15083 !! test
15084 Image with link parameter, wgExternalLinkTarget, unnamed parameter
15085 !! wikitext
15086 [[Image:foobar.jpg|link=http://example.com/|Title]]
15087 !! config
15088 wgExternalLinkTarget='foobar'
15089 !! html/php
15090 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15091 </p>
15092 !! end
15093
15094 !! test
15095 Image with empty link parameter
15096 !! wikitext
15097 [[File:Foobar.jpg|link=]]
15098 !! html/php
15099 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" />
15100 </p>
15101 !! html/parsoid
15102 <p><figure-inline 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></figure-inline></p>
15103 !! end
15104
15105 !! test
15106 Image with link parameter (wiki target) and unnamed parameter
15107 !! wikitext
15108 [[File:Foobar.jpg|link=Main_Page|Title]]
15109 !! html/php
15110 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15111 </p>
15112 !! html/parsoid
15113 <p><figure-inline 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></figure-inline></p>
15114 !! end
15115
15116 !! test
15117 Image with link parameter (URL target) and unnamed parameter
15118 !! wikitext
15119 [[File:Foobar.jpg|link=http://example.com/|Title]]
15120 !! html/php
15121 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15122 </p>
15123 !! html/parsoid
15124 <p><figure-inline 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></figure-inline></p>
15125 !! end
15126
15127 !! test
15128 Thumbnail image with link parameter
15129 !! options
15130 thumbsize=220
15131 parsoid=wt2html,wt2wt,html2html
15132 !! wikitext
15133 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
15134 !! html/php
15135 <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" decoding="async" 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>
15136 !! html/parsoid
15137 <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>
15138 !! end
15139
15140 !! test
15141 Manually-specified thumbnail image
15142 !! options
15143 thumbsize=220
15144 !! wikitext
15145 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15146 !! html/php
15147 <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" decoding="async" 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>
15148 !! html/parsoid
15149 <figure class="mw-default-size" typeof="mw:Image/Thumb" about="#mwt1" data-mw='{"attribs":[["manualthumb",{"txt":"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>
15150 !! end
15151
15152 !! test
15153 Manually-specified thumbnail image (backwards compat)
15154 !! options
15155 thumbsize=220
15156 parsoid=html2wt
15157 !! wikitext
15158 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15159 !! html/php
15160 <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" decoding="async" 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>
15161 !! html/parsoid
15162 <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>
15163 !! end
15164
15165 !! test
15166 Manually-specified thumbnail image with explicit link to wiki page
15167 !! options
15168 thumbsize=220
15169 parsoid=wt2html,wt2wt,html2html
15170 !! wikitext
15171 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
15172 !! html/php
15173 <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" decoding="async" 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>
15174 !! html/parsoid
15175 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"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>
15176 !! end
15177
15178 !! test
15179 Manually-specified thumbnail image with explicit link to url
15180 !! options
15181 thumbsize=220
15182 parsoid=wt2html,wt2wt,html2html
15183 !! wikitext
15184 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
15185 !! html/php
15186 <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" decoding="async" 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>
15187 !! html/parsoid
15188 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"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>
15189 !! end
15190
15191 !! test
15192 Manually-specified thumbnail image with explicit no link
15193 !! options
15194 thumbsize=220
15195 parsoid=wt2html,wt2wt,html2html
15196 !! wikitext
15197 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
15198 !! html/php
15199 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" decoding="async" 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>
15200 !! html/parsoid
15201 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"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>
15202 !! end
15203
15204 !! test
15205 Manually-specified thumbnail image with explicit link and alt text
15206 !! options
15207 thumbsize=220
15208 parsoid=wt2html,wt2wt,html2html
15209 !! wikitext
15210 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
15211 !! html/php
15212 <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" decoding="async" 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>
15213 !! html/parsoid
15214 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"attribs":[["manualthumb",{"txt":"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>
15215 !! end
15216
15217 !! test
15218 Image with frame and link
15219 !! options
15220 parsoid=wt2html,wt2wt,html2html
15221 !! wikitext
15222 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
15223 !! html/php
15224 <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" decoding="async" 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>
15225 !! html/parsoid
15226 <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>
15227 !! end
15228
15229 !! test
15230 Image with frame and link and explicit alt
15231 !! options
15232 parsoid=wt2html,wt2wt,html2html
15233 !! wikitext
15234 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15235 !! html/php
15236 <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" decoding="async" 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>
15237 !! html/parsoid
15238 <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>
15239 !! end
15240
15241 !! test
15242 Image with wiki markup in implicit alt
15243 !! wikitext
15244 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15245
15246 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15247 !! html/php
15248 <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" decoding="async" width="1941" height="220" /></a>
15249 </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" decoding="async" width="1941" height="220" /></a>
15250 </p>
15251 !! html/parsoid
15252 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
15253
15254 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &apos;&apos;&apos;bold&apos;&apos;&apos; in alt"}]}' data-mw='{"attribs":[["alt",{"html":"alt=testing &lt;b data-parsoid=&apos;{\"dsr\":[79,89,3,3]}&apos;>bold&lt;/b> in alt","txt":"testing bold in alt"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image: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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
15255 !! end
15256
15257 !! test
15258 Alt image option should handle most kinds of wikitext without barfing
15259 !! wikitext
15260 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15261 !! html/php
15262 <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" decoding="async" 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>
15263 !! html/parsoid
15264 <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|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&apos;>bold template&lt;/i>.","txt":"This is a link and a bold template."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:Foobar.jpg"}}'><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":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
15265 !! end
15266
15267 !! test
15268 Ampersand in alt attribute (T206940)
15269 !! wikitext
15270 [[File:Foobar.jpg|alt=&amp;amp;]]
15271
15272 <!-- consistency with gallery extension -->
15273 <gallery>
15274 File:Foobar.jpg|alt=&amp;amp;
15275 </gallery>
15276 !! html/php+tidy
15277 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&amp;amp;" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15278 </p>
15279 <ul class="gallery mw-gallery-traditional">
15280 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15281 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&amp;amp;" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15282 <div class="gallerytext">
15283 </div>
15284 </div></li>
15285 </ul>
15286 !! html/parsoid
15287 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Entity\" data-parsoid=&apos;{\"src\":\"&amp;amp;amp;\",\"srcContent\":\"&amp;amp;\",\"dsr\":[22,27,null,null]}&apos;>&amp;amp;&lt;/span>amp;","txt":"&amp;amp;"}]]}'><a href="./File:Foobar.jpg"><img alt="&amp;amp;" 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-inline></p>
15288
15289 <!-- consistency with gallery extension -->
15290 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15291 <li class="gallerybox" style="width: 155px;">
15292 <div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Entity\" data-parsoid=&apos;{\"src\":\"&amp;amp;amp;\",\"srcContent\":\"&amp;amp;\",\"dsr\":[109,114,null,null]}&apos;>&amp;amp;&lt;/span>amp;","txt":"&amp;amp;"}]]}'><a href="./File:Foobar.jpg"><img alt="&amp;amp;" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15293 <div class="gallerytext"></div>
15294 </li>
15295 </ul>
15296 !! end
15297
15298 ## FIXME: The inconsistency in the gallery extension on the php side is T49646
15299 !! test
15300 Link with encoded pipe in alt option
15301 !! options
15302 parsoid={
15303 "modes": ["wt2html", "html2html"]
15304 }
15305 !! wikitext
15306 [[File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption]]
15307
15308 <!-- consistency with gallery extension -->
15309 <gallery>
15310 File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption
15311 </gallery>
15312 !! html/php+tidy
15313 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="http://testing.123?4=5|6" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15314 </p>
15315 <ul class="gallery mw-gallery-traditional">
15316 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15317 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="http://testing.123?4=5&amp;vert;6%7Ccaption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15318 <div class="gallerytext">
15319 </div>
15320 </div></li>
15321 </ul>
15322 !! html/parsoid
15323 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=http://testing.123?4=5&amp;vert;6"},{"ck":"caption","ak":"caption"}]}' data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:ExtLink\" href=\"http://testing.123?4=5%7C6\" data-parsoid=&apos;{\"stx\":\"url\",\"a\":{\"href\":\"http://testing.123?4=5%7C6\"},\"sa\":{\"href\":\"http://testing.123?4=5&amp;amp;vert;6\"},\"dsr\":[22,51,0,0]}&apos;>http://testing.123?4=5%7C6&lt;/a>","txt":"http://testing.123?4=5|6"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="http://testing.123?4=5|6" 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-inline></p>
15324
15325 <!-- consistency with gallery extension -->
15326 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15327 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:ExtLink\" href=\"http://testing.123?4=5%7C6\" data-parsoid=&apos;{\"stx\":\"url\",\"a\":{\"href\":\"http://testing.123?4=5%7C6\"},\"sa\":{\"href\":\"http://testing.123?4=5&amp;amp;vert;6\"},\"dsr\":[137,166,0,0]}&apos;>http://testing.123?4=5%7C6&lt;/a>","txt":"http://testing.123?4=5|6"}]]}'><a href="./File:Foobar.jpg"><img alt="http://testing.123?4=5|6" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
15328 !! end
15329
15330 !! test
15331 Italics markup in alt attribute (T206940)
15332 !! options
15333 parsoid=wt2html,html2html
15334 !! wikitext
15335 [[File:Foobar.jpg|alt=''x''|caption]]
15336
15337 <!-- consistency with gallery extension -->
15338 <gallery>
15339 File:Foobar.jpg|alt=''x''|caption
15340 </gallery>
15341 !! html/php+tidy
15342 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="x" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15343 </p>
15344 <ul class="gallery mw-gallery-traditional">
15345 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15346 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="x" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15347 <div class="gallerytext">
15348 <p>caption
15349 </p>
15350 </div>
15351 </div></li>
15352 </ul>
15353 !! html/parsoid
15354 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&apos;&apos;x&apos;&apos;"},{"ck":"caption","ak":"caption"}]}' data-mw='{"attribs":[["alt",{"html":"alt=&lt;i data-parsoid=&apos;{\"dsr\":[22,27,2,2]}&apos;>x&lt;/i>","txt":"x"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="x" 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-inline></p>
15355
15356 <!-- consistency with gallery extension -->
15357 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15358 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;i data-parsoid=&apos;{\"dsr\":[113,118,2,2]}&apos;>x&lt;/i>","txt":"x"}]]}'><a href="./File:Foobar.jpg"><img alt="x" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
15359 </ul>
15360 !! end
15361
15362 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15363 ## are no longer in storage.
15364 !! test
15365 Nowiki markup in alt attribute (T206940)
15366 !! options
15367 parsoid=html2wt
15368 !! wikitext
15369 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15370
15371 <!-- consistency with gallery extension -->
15372 <gallery>
15373 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15374 </gallery>
15375 !! html/php+tidy
15376 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="&#39;&#39;x&#39;&#39;" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15377 </p>
15378 <ul class="gallery mw-gallery-traditional">
15379 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15380 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&#39;&#39;x&#39;&#39;" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15381 <div class="gallerytext">
15382 <p>caption
15383 </p>
15384 </div>
15385 </div></li>
15386 </ul>
15387 !! html/parsoid
15388 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt5" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>"},{"ck":"caption","ak":"caption"}]}' data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[22,41,8,9]}&apos;>&apos;&apos;&lt;/span>x&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[42,61,8,9]}&apos;>&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" 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-inline></p>
15389
15390 <!-- consistency with gallery extension -->
15391 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt13" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|alt=&lt;nowiki>&apos;&apos;&lt;/nowiki>x&lt;nowiki>&apos;&apos;&lt;/nowiki>|caption\n"}}'>
15392 <li class="gallerybox" style="width: 155px;">
15393 <div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[147,166,8,9]}&apos;>&apos;&apos;&lt;/span>x&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[167,186,8,9]}&apos;>&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]]}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15394 <div class="gallerytext">caption</div>
15395 </li>
15396 </ul>
15397 !! end
15398
15399 !! test
15400 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15401 !! wikitext
15402 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15403
15404 <!-- consistency with gallery extension -->
15405 <gallery>
15406 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15407 </gallery>
15408 !! html/php+tidy
15409 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="&#39;&#39;x&#39;&#39;" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15410 </p>
15411 <ul class="gallery mw-gallery-traditional">
15412 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15413 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="&#39;&#39;x&#39;&#39;" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15414 <div class="gallerytext">
15415 <p>caption
15416 </p>
15417 </div>
15418 </div></li>
15419 </ul>
15420 !! html/parsoid
15421 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[22,44,8,9]}&apos;>&apos;&apos;x&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]],"caption":"caption"}'><a href="./File:Foobar.jpg"><img alt="''x''" 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-inline></p>
15422
15423 <!-- consistency with gallery extension -->
15424 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt9" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15425 <li class="gallerybox" style="width: 155px;">
15426 <div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[130,152,8,9]}&apos;>&apos;&apos;x&apos;&apos;&lt;/span>","txt":"&apos;&apos;x&apos;&apos;"}]]}'><a href="./File:Foobar.jpg"><img alt="''x''" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15427 <div class="gallerytext">caption</div>
15428 </li>
15429 </ul>
15430 !! end
15431
15432 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15433 ## are no longer in storage.
15434 !! test
15435 Ampersand in link attribute (T206940)
15436 !! options
15437 parsoid=html2wt
15438 !! wikitext
15439 [[File:Foobar.jpg|link=Foo &amp; bar]]
15440
15441 <!-- consistency with gallery extension -->
15442 <gallery>
15443 File:Foobar.jpg|link=Foo &amp; bar
15444 </gallery>
15445 !! html/php+tidy
15446 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15447 </p>
15448 <ul class="gallery mw-gallery-traditional">
15449 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15450 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo_%26_bar"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15451 <div class="gallerytext">
15452 </div>
15453 </div></li>
15454 </ul>
15455 !! html/parsoid
15456 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=Foo &amp;amp; bar"}]}'><a href="./Foo_&amp;_bar" data-parsoid='{"a":{"href":"./Foo_&amp;_bar"},"sa":{"href":"link=Foo &amp;amp; bar"}}'><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-inline></p>
15457
15458 <!-- consistency with gallery extension -->
15459 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo &amp;amp; bar\n"}}'>
15460 <li class="gallerybox">
15461 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo_&amp;_bar"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15462 <div class="gallerytext"></div>
15463 </li>
15464 </ul>
15465 !! end
15466
15467 !! test
15468 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15469 !! wikitext
15470 [[File:Foobar.jpg|link=Foo_&_bar]]
15471
15472 <!-- consistency with gallery extension -->
15473 <gallery>
15474 File:Foobar.jpg|link=Foo_&_bar
15475 </gallery>
15476 !! html/php+tidy
15477 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15478 </p>
15479 <ul class="gallery mw-gallery-traditional">
15480 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15481 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo_%26_bar"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15482 <div class="gallerytext">
15483 </div>
15484 </div></li>
15485 </ul>
15486 !! html/parsoid
15487 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Foo_&amp;_bar"><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-inline></p>
15488
15489 <!-- consistency with gallery extension -->
15490 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15491 <li class="gallerybox">
15492 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo_&amp;_bar"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15493 <div class="gallerytext"></div>
15494 </li>
15495 </ul>
15496 !! end
15497
15498 !! test
15499 Italics markup in link attribute (T206940)
15500 !! options
15501 parsoid=wt2html,html2html
15502 !! wikitext
15503 [[Foo''s bar''s]]
15504
15505 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15506 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15507
15508 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15509
15510 <!-- consistency with gallery extension -->
15511 <gallery>
15512 File:Foobar.jpg|link=Foo''s bar''s|caption1
15513 File:Foobar.jpg|link=''Main Page''|caption2
15514 </gallery>
15515 !! html/php+tidy
15516 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15517 </p><p><a href="/wiki/Foos_bars" title="caption1"><img alt="caption1" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15518 </p><p><a href="/wiki/Main_Page" title="caption2"><img alt="caption2" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15519 </p>
15520 <ul class="gallery mw-gallery-traditional">
15521 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15522 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foos_bars"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15523 <div class="gallerytext">
15524 <p>caption1
15525 </p>
15526 </div>
15527 </div></li>
15528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15529 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15530 <div class="gallerytext">
15531 <p>caption2
15532 </p>
15533 </div>
15534 </div></li>
15535 </ul>
15536 !! html/parsoid
15537 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15538
15539 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15540 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=Foo&apos;&apos;s bar&apos;&apos;s"},{"ck":"caption","ak":"caption1"}]}' data-mw='{"caption":"caption1"}'><a href="./Foos_bars" data-parsoid='{"a":{"href":"./Foos_bars"},"sa":{"href":"link=Foo&apos;&apos;s bar&apos;&apos;s"}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15541
15542 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&apos;&apos;Main Page&apos;&apos;"},{"ck":"caption","ak":"caption2"}]}' data-mw='{"caption":"caption2"}'><a href="./Main_Page" data-parsoid='{"a":{"href":"./Main_Page"},"sa":{"href":"link=&apos;&apos;Main Page&apos;&apos;"}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15543
15544 <!-- consistency with gallery extension -->
15545 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15546 <li class="gallerybox">
15547 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foos_bars"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15548 <div class="gallerytext">caption1</div>
15549 </li>
15550 <li class="gallerybox">
15551 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15552 <div class="gallerytext">caption2</div>
15553 </li>
15554 </ul>
15555 !! end
15556
15557 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15558 ## are no longer in storage.
15559 !! test
15560 Nowiki markup in link attribute (T206940)
15561 !! options
15562 parsoid=html2wt
15563 !! wikitext
15564 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15565
15566 <!-- consistency with gallery extension -->
15567 <gallery>
15568 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15569 </gallery>
15570 !! html/php+tidy
15571 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15572 </p>
15573 <ul class="gallery mw-gallery-traditional">
15574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15575 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo%27%27s_bar%27%27s"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15576 <div class="gallerytext">
15577 <p>caption
15578 </p>
15579 </div>
15580 </div></li>
15581 </ul>
15582 !! html/parsoid
15583 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=Foo&lt;nowiki>&apos;&apos;&lt;/nowiki>s_bar&lt;nowiki>&apos;&apos;&lt;/nowiki>s"},{"ck":"caption","ak":"caption"}]}' data-mw='{"caption":"caption"}'><a href="./Foo''s_bar''s" data-parsoid='{"a":{"href":"./Foo&apos;&apos;s_bar&apos;&apos;s"},"sa":{"href":"link=Foo&lt;nowiki>&apos;&apos;&lt;/nowiki>s_bar&lt;nowiki>&apos;&apos;&lt;/nowiki>s"}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15584
15585 <!-- consistency with gallery extension -->
15586 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:Foobar.jpg|link=Foo&lt;nowiki>&apos;&apos;&lt;/nowiki>s_bar&lt;nowiki>&apos;&apos;&lt;/nowiki>s|caption\n"}}'>
15587 <li class="gallerybox">
15588 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo''s_bar''s"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15589 <div class="gallerytext">caption</div>
15590 </li>
15591 </ul>
15592 !! end
15593
15594 !! test
15595 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15596 !! wikitext
15597 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15598
15599 <!-- consistency with gallery extension -->
15600 <gallery>
15601 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15602 </gallery>
15603 !! html/php+tidy
15604 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15605 </p>
15606 <ul class="gallery mw-gallery-traditional">
15607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15608 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Foo%27%27s_bar%27%27s"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15609 <div class="gallerytext">
15610 <p>caption
15611 </p>
15612 </div>
15613 </div></li>
15614 </ul>
15615 !! html/parsoid
15616 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./Foo''s_bar''s"><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-inline></p>
15617
15618 <!-- consistency with gallery extension -->
15619 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15620 <li class="gallerybox">
15621 <div class="thumb"><figure-inline typeof="mw:Image"><a href="./Foo''s_bar''s"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15622 <div class="gallerytext">caption</div>
15623 </li>
15624 </ul>
15625 !! end
15626
15627 !! test
15628 HTML entity prefix in link markup (T209236)
15629 !! wikitext
15630 [[File:Foobar.jpg|link=https://example.com?foo&params=bar]]
15631
15632 <!-- consistency with gallery extension -->
15633 <gallery>
15634 File:Foobar.jpg|link=https://example.com?foo&params=bar
15635 </gallery>
15636 !! html/php+tidy
15637 <p><a href="https://example.com?foo&amp;params=bar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15638 </p>
15639 <ul class="gallery mw-gallery-traditional">
15640 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15641 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="https://example.com?foo&amp;params=bar"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
15642 <div class="gallerytext">
15643 </div>
15644 </div></li>
15645 </ul>
15646 !! html/parsoid
15647 <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="https://example.com?foo&amp;params=bar"><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-inline></p>
15648
15649 <!-- consistency with gallery extension -->
15650 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15651 <li class="gallerybox">
15652 <div class="thumb"><figure-inline typeof="mw:Image"><a href="https://example.com?foo&amp;params=bar"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div>
15653 <div class="gallerytext"></div>
15654 </li>
15655 </ul>
15656 !! end
15657
15658 !! test
15659 Image with table with attributes in caption
15660 !! options
15661 parsoid=wt2html,html2html
15662 !! wikitext
15663 [[File:Foobar.jpg|thumb|
15664 {| class="123" |
15665 |- class="456" |
15666 | ha
15667 |}
15668 ]]
15669 !! html/parsoid
15670 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{| class=\"123\" |\n|- class=\"456\" |\n| ha\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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>
15671 <table class="123">
15672 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15673 <td> ha</td></tr>
15674 </tbody></table>
15675 </figcaption></figure>
15676 !! end
15677
15678 !! test
15679 Image with table with rows from templates in caption
15680 !! wikitext
15681 [[File:Foobar.jpg|thumb|
15682 {|
15683 {{echo|{{!}} hi}}
15684 |}
15685 ]]
15686 !! html/parsoid
15687 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{|\n{{echo|{{!}} hi}}\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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>
15688 <table>
15689 <tbody about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} hi"}},"i":0}},"\n"]}'><tr><td> hi</td></tr>
15690 </tbody></table>
15691 </figcaption></figure>
15692 !! end
15693
15694 !! test
15695 Image with nested tables in caption
15696 !! wikitext
15697 [[File:Foobar.jpg|thumb|Foo<br />
15698 {|
15699 |
15700 {|
15701 |z
15702 |}
15703 |}
15704 ]]
15705 !! html/parsoid
15706 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo&lt;br/>\n{|\n|\n{|\n|z\n|}\n|}\n"}]}'><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 data-parsoid='{"dsr":[null,50,null,null]}'>Foo<br data-parsoid='{"stx":"html","selfClose":true}'/>
15707 <table>
15708 <tbody><tr><td>
15709 <table>
15710 <tbody><tr><td>z</td></tr>
15711 </tbody></table></td></tr>
15712 </tbody></table>
15713 </figcaption></figure>
15714 !! end
15715
15716 !! test
15717 Image with heading and horizontal rule in caption
15718 !! wikitext
15719 [[File:Foobar.jpg|thumb|
15720 ===Testing===
15721 123
15722 --------------
15723 ]]
15724 !! html/php
15725 <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" decoding="async" 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><h3><span class="mw-headline" id="Testing">Testing</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: Testing">edit</a><span class="mw-editsection-bracket">]</span></span></h3> 123 <hr /></div></div></div>
15726 !! html/parsoid
15727 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n=== Testing ===\n123\n--------------\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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>
15728 <h3 id="Testing">Testing</h3>
15729 123
15730 <hr data-parsoid='{"extra_dashes":10}'/>
15731 </figcaption></figure>
15732 !! end
15733
15734 ###################
15735 # Conflicting image format options.
15736 # First option specified should 'win'.
15737 # All three cases in each test should be identical.
15738
15739 !! test
15740 Image with 'frameless' first.
15741 !! options
15742 parsoid=wt2html,wt2wt,html2html
15743 !! wikitext
15744 [[File:Foobar.jpg|frameless|caption]]
15745
15746 [[File:Foobar.jpg|frameless|frame|caption]]
15747
15748 [[File:Foobar.jpg|frameless|thumb|caption]]
15749 !! html/php
15750 <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" decoding="async" 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>
15751 </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" decoding="async" 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>
15752 </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" decoding="async" 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>
15753 </p>
15754 !! html/parsoid
15755 <p><figure-inline 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></figure-inline></p>
15756 <p><figure-inline 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></figure-inline></p>
15757 <p><figure-inline 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></figure-inline></p>
15758 !! end
15759
15760 !! test
15761 Image with 'frame' first.
15762 !! options
15763 parsoid=wt2html,wt2wt,html2html
15764 !! wikitext
15765 [[File:Foobar.jpg|frame|caption]]
15766 [[File:Foobar.jpg|frame|frameless|caption]]
15767 [[File:Foobar.jpg|frame|thumb|caption]]
15768 !! html/php
15769 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15770 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15771 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
15772 !! html/parsoid
15773 <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>
15774 <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>
15775 <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>
15776 !! end
15777
15778 !! test
15779 Image with 'thumb' first.
15780 !! options
15781 parsoid=wt2html,wt2wt,html2html
15782 !! wikitext
15783 [[File:Foobar.jpg|thumb|caption]]
15784 [[File:Foobar.jpg|thumb|frameless|caption]]
15785 [[File:Foobar.jpg|thumb|frame|caption]]
15786 !! html/php
15787 <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" decoding="async" 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>
15788 <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" decoding="async" 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>
15789 <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" decoding="async" 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>
15790 !! html/parsoid
15791 <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>
15792 <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>
15793 <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>
15794 !! end
15795
15796 ###################
15797 # Image sizing.
15798 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15799 # and https://phabricator.wikimedia.org/T64258
15800 # Foobar has actual size of 1941x220
15801 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15802 # a scalable format.
15803 # 2. Framed images always ignore size options; always render at default size.
15804 # 3. "Unspecified format" and border are the only types which can be
15805 # enlarged.
15806
15807 !! test
15808 Image: unspecified format and border enlarge
15809 !! options
15810 parsoid=wt2html,wt2wt,html2html
15811 !! wikitext
15812 [[File:Foobar.jpg|2000px]]
15813
15814 [[File:Foobar.jpg|border|2000px]]
15815 !! html/php
15816 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="2000" height="227" /></a>
15817 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="2000" height="227" class="thumbborder" /></a>
15818 </p>
15819 !! html/parsoid
15820 <p><figure-inline 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="227" width="2000"/></a></figure-inline></p>
15821 <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
15822 !! end
15823
15824 !! test
15825 Image: "unspecified format" and border reduce
15826 !! options
15827 parsoid=wt2html,wt2wt,html2html
15828 !! wikitext
15829 [[File:Foobar.jpg|1000px]]
15830
15831 [[File:Foobar.jpg|border|1000px]]
15832 !! html/php
15833 <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" decoding="async" 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>
15834 </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" decoding="async" 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>
15835 </p>
15836 !! html/parsoid
15837 <p><figure-inline 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></figure-inline></p>
15838 <p><figure-inline 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></figure-inline></p>
15839 !! end
15840
15841 !! test
15842 Image: thumbs reduce
15843 !! options
15844 parsoid=wt2html,wt2wt,html2html
15845 !! wikitext
15846 [[File:Foobar.jpg|thumb|50px]]
15847 !! html/php
15848 <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" decoding="async" 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>
15849 !! html/parsoid
15850 <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><figcaption></figcaption></figure>
15851 !! end
15852
15853 !! test
15854 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15855 !! options
15856 parsoid=wt2html,wt2wt,html2html
15857 !! wikitext
15858 [[File:Foobar.jpg|thumb|2000px]]
15859
15860 [[File:Foobar.svg|thumb|2000px]]
15861 !! html/php
15862 <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" decoding="async" 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>
15863 <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" decoding="async" 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>
15864 !! html/parsoid
15865 <figure typeof="mw:Image/Thumb"><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></figcaption></figure>
15866 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a><figcaption></figcaption></figure>
15867 !! end
15868
15869 !! test
15870 Image: frameless can reduce in size
15871 !! options
15872 parsoid=wt2html,wt2wt,html2html
15873 !! wikitext
15874 [[File:Foobar.jpg|frameless|50px]]
15875 !! html/php
15876 <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" decoding="async" 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>
15877 </p>
15878 !! html/parsoid
15879 <p><figure-inline 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></figure-inline></p>
15880 !! end
15881
15882 !! test
15883 Image: bitmap frameless can't be enlarged past original size, but vector can
15884 !! options
15885 parsoid=wt2html,wt2wt,html2html
15886 !! wikitext
15887 [[File:Foobar.jpg|frameless|2000px]]
15888
15889 [[File:Foobar.svg|frameless|2000px]]
15890 !! html/php
15891 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
15892 </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" decoding="async" 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>
15893 </p>
15894 !! html/parsoid
15895 <p><figure-inline typeof="mw:Image/Frameless"><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-inline></p>
15896 <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure-inline></p>
15897 !! end
15898
15899 !! test
15900 Image: framed images are always unscaled.
15901 !! options
15902 parsoid=wt2html,wt2wt,html2html
15903 !! wikitext
15904 [[File:Foobar.jpg|frame]]
15905
15906 [[File:Foobar.jpg|frame|50px]]
15907
15908 [[File:Foobar.jpg|frame|50x50px]]
15909
15910 [[File:Foobar.jpg|frame|2000px]]
15911 !! html/php
15912 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15913 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15914 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15915 <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" decoding="async" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
15916 !! html/parsoid
15917 <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></figcaption></figure>
15918 <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></figcaption></figure>
15919 <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></figcaption></figure>
15920 <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></figcaption></figure>
15921 !! end
15922
15923 ###################
15924
15925 !! test
15926 Link to image page- image page normally doesn't exist, hence edit link
15927 Add test with existing image page
15928 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15929 !! wikitext
15930 [[:Image:test]]
15931 !! html
15932 <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>
15933 </p>
15934 !! end
15935
15936 !! test
15937 T20784 Link to non-existent image page with caption should use caption as link text
15938 !! wikitext
15939 [[:Image:test|caption]]
15940 !! html
15941 <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>
15942 </p>
15943 !! end
15944
15945 !! test
15946 Frameless image caption with a free URL
15947 !! wikitext
15948 [[File:Foobar.jpg|http://example.com]]
15949 !! html/php
15950 <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" decoding="async" width="1941" height="220" /></a>
15951 </p>
15952 !! html/parsoid
15953 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
15954 !! end
15955
15956 !! test
15957 Thumbnail image caption with a free URL
15958 !! options
15959 thumbsize=220
15960 !! wikitext
15961 [[File:Foobar.jpg|thumb|http://example.com]]
15962 !! html/php
15963 <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" decoding="async" 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>
15964 !! html/parsoid
15965 <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" class="external free">http://example.com</a></figcaption></figure>
15966 !! end
15967
15968 !! test
15969 Thumbnail image caption with a free URL and explicit alt
15970 !! options
15971 thumbsize=220
15972 parsoid=wt2html,wt2wt,html2html
15973 !! wikitext
15974 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15975 !! html/php
15976 <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" decoding="async" 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>
15977 !! html/parsoid
15978 <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" class="external free">http://example.com</a></figcaption></figure>
15979 !! end
15980
15981 !! test
15982 SVG thumbnails with no language set
15983 !! options
15984 !! wikitext
15985 [[File:Foobar.svg|thumb|caption]]
15986 !! html/php
15987 <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" decoding="async" 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>
15988 !! html/parsoid
15989 <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.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
15990 !! end
15991
15992 !! test
15993 SVG thumbnails with language de
15994 !! options
15995 parsoid=wt2html,wt2wt,html2html
15996 !! wikitext
15997 [[File:Foobar.svg|thumb|caption|lang=de]]
15998 !! html/php
15999 <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" decoding="async" 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>
16000 !! html/parsoid
16001 <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.png" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
16002 !! end
16003
16004 !! test
16005 SVG thumbnails with invalid language code
16006 !! options
16007 parsoid=wt2html,wt2wt,html2html
16008 !! wikitext
16009 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
16010 !! html/php
16011 <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" decoding="async" 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>
16012 !! html/parsoid
16013 <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.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid:language:code</figcaption></figure>
16014 !! end
16015
16016 !! test
16017 SVG thumbnails in page language
16018 !! options
16019 language=ru
16020 !! wikitext
16021 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
16022 !! html/php
16023 <p><a href="/wiki/%D0%A4%D0%B0%D0%B9%D0%BB:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/langru-240px-Foobar.svg.png" decoding="async" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langru-360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langru-480px-Foobar.svg.png 2x" /></a> <a href="/index.php?title=%D0%A4%D0%B0%D0%B9%D0%BB:Foobar.svg&amp;lang=en" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg.png" decoding="async" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/480px-Foobar.svg.png 2x" /></a>
16024 </p>
16025 !! end
16026
16027 !! test
16028 SVG thumbnails in page language not present in the file
16029 !! options
16030 language=de
16031 !! wikitext
16032 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
16033 !! html/php
16034 <p><a href="/wiki/Datei:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg.png" decoding="async" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/480px-Foobar.svg.png 2x" /></a> <a href="/index.php?title=Datei:Foobar.svg&amp;lang=ru" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/langru-240px-Foobar.svg.png" decoding="async" width="240" height="180" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langru-360px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langru-480px-Foobar.svg.png 2x" /></a>
16035 </p>
16036 !! end
16037
16038 !! test
16039 T3887: A ISBN with a thumbnail
16040 !! wikitext
16041 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
16042 !! html/php
16043 <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" decoding="async" 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>
16044 !! html/parsoid
16045 <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:WikiLink">ISBN 1235467890</a></figcaption></figure>
16046 !! end
16047
16048 !! test
16049 T3887: A RFC with a thumbnail
16050 !! wikitext
16051 [[File:Foobar.jpg|thumb|This is RFC 12354]]
16052 !! html/php
16053 <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" decoding="async" 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="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
16054 !! html/parsoid
16055 <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="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink" class="external mw-magiclink">RFC 12354</a></figcaption></figure>
16056 !! end
16057
16058 !! test
16059 T3887: A mailto link with a thumbnail
16060 !! wikitext
16061 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
16062 !! html/php
16063 <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" decoding="async" 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>
16064 !! html/parsoid
16065 <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" class="external free">mailto:nobody@example.com</a></figcaption></figure>
16066 !! end
16067
16068 # Pending resolution to T2368
16069 !! test
16070 T2648: Frameless image caption with a link
16071 !! wikitext
16072 [[File:Foobar.jpg|text with a [[link]] in it]]
16073 !! html/php
16074 <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" decoding="async" width="1941" height="220" /></a>
16075 </p>
16076 !! html/parsoid
16077 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16078 !! end
16079
16080 !! test
16081 T2648: Frameless image caption with a link (suffix)
16082 !! wikitext
16083 [[File:Foobar.jpg|text with a [[link]]foo in it]]
16084 !! html/php
16085 <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" decoding="async" width="1941" height="220" /></a>
16086 </p>
16087 !! html/parsoid
16088 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16089 !! end
16090
16091 !! test
16092 T2648: Frameless image caption with an interwiki link
16093 !! wikitext
16094 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
16095 !! html/php
16096 <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" decoding="async" width="1941" height="220" /></a>
16097 </p>
16098 !! html/parsoid
16099 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16100 !! end
16101
16102 !! test
16103 T2648: Frameless image caption with a piped interwiki link
16104 !! wikitext
16105 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
16106 !! html/php
16107 <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" decoding="async" width="1941" height="220" /></a>
16108 </p>
16109 !! html/parsoid
16110 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16111 !! end
16112
16113 !! test
16114 T107474: Frameless image caption with <nowiki>
16115 !! wikitext
16116 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
16117 !! html/parsoid
16118 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16119 !! end
16120
16121 !! test
16122 Escape HTML special chars in image alt text
16123 !! wikitext
16124 [[File:Foobar.jpg|& < > "]]
16125 !! html/php
16126 <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" decoding="async" width="1941" height="220" /></a>
16127 </p>
16128 !! html/parsoid
16129 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16130 !! end
16131
16132 !! test
16133 Escape HTML special chars in image alt text with LanguageConverter
16134 !! options
16135 language=zh
16136 !! wikitext
16137 [[File:Foobar.jpg|& < > "]]
16138 !! html/php
16139 <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" decoding="async" width="1941" height="220" /></a>
16140 </p>
16141 !! html/parsoid
16142 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16143 !! end
16144
16145 !! test
16146 Entities in file name and attributes
16147 !! wikitext
16148 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
16149 !! html/php
16150 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
16151 </p>
16152 !! html/parsoid
16153 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"attribs":[["link",{"txt":"7%25 solution"}]],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&apos;>7% solution&lt;/a>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/7%25_solution.gif"><span resource="./File:7%25_solution.gif" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif"},"sa":{"resource":"File:7%25 solution.gif"}}'>File:7% solution.gif</span></a></figure-inline></p>
16154 !! end
16155
16156 !! test
16157 T2499: Alt text should have &#1234;, not &amp;1234;
16158 !! wikitext
16159 [[File:Foobar.jpg|&#9792;]]
16160 !! html/php
16161 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
16162 </p>
16163 !! html/parsoid
16164 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16165 !! end
16166
16167 !! test
16168 Broken image caption with link
16169 !! options
16170 parsoid=wt2html,wt2wt,html2html
16171 !! wikitext
16172 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
16173 !! html/php
16174 <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.
16175 </p>
16176 !! html/parsoid
16177 <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>
16178 !! end
16179
16180 !! test
16181 Image caption containing another image
16182 !! wikitext
16183 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
16184 !! html/php
16185 <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" decoding="async" 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" decoding="async" width="135" height="135" /></a> inside it!</div></div></div>
16186 !! html/parsoid
16187 <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 <figure-inline 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></figure-inline> inside it!</figcaption></figure>
16188 !! end
16189
16190 !! test
16191 Image: caption containing a newline
16192 !! wikitext
16193 [[File:Foobar.jpg|This
16194 *is some text]]
16195 !! html/php
16196 <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" decoding="async" width="1941" height="220" /></a>
16197 </p>
16198 !! html/parsoid
16199 <p><figure-inline 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></figure-inline></p>
16200 !!end
16201
16202 !!test
16203 Image: caption containing leading space
16204 (The leading space should not trigger nowiki escaping in wt2wt mode)
16205 !! wikitext
16206 [[File:Foobar.jpg|thumb| bar]]
16207 !! html/php
16208 <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" decoding="async" 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>
16209 !! html/parsoid
16210 <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>
16211 !!end
16212
16213 # html/php output not have newlines after table, td, th, etc. because
16214 # Linker::makeThumbLink2() replaces the newlines with spaces since
16215 # the table is inside a caption.
16216 # FIXME: Verify if that circa 2004 fix is still required.
16217 !! test
16218 Image: caption containing a table
16219 !! options
16220 parsoid=wt2html,wt2wt,html2html
16221 !! wikitext
16222 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
16223 {|
16224 !Foo!!Bar
16225 |-
16226 |Foo1||Bar1
16227 |}
16228 and some more text.]]
16229 !! html/php
16230 <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" decoding="async" 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>
16231 !! html/parsoid
16232 <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
16233 <table>
16234 <tbody>
16235 <tr><th>Foo</th><th>Bar</th></tr>
16236 <tr>
16237 <td>Foo1</td>
16238 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
16239 !! end
16240
16241 !! test
16242 T5090: External links other than http: in image captions
16243 !! wikitext
16244 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
16245 !! html/php
16246 <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" decoding="async" 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>
16247 !! html/parsoid
16248 <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" class="external text">irc</a> and <a rel="mw:ExtLink" href="https://example.com" class="external text">Secure</a> ext links in it.</figcaption></figure>
16249 !! end
16250
16251 !! test
16252 Custom class
16253 !! options
16254 parsoid=wt2html,wt2wt,html2html
16255 !! wikitext
16256 [[Image:foobar.jpg|a|class=b]]
16257 !! html/php
16258 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" class="b" /></a>
16259 </p>
16260 !! html/parsoid
16261 <p><figure-inline 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></figure-inline></p>
16262 !! end
16263
16264 !! test
16265 Localized image handling (1).
16266 !! options
16267 parsoid=wt2html,wt2wt,html2html
16268 language=es
16269 !! wikitext
16270 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16271 !! html/php
16272 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a></div>
16273 !! html/parsoid
16274 <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>
16275 !! end
16276
16277 !! test
16278 Localized image handling (2).
16279 !! options
16280 thumbsize=220
16281 parsoid=wt2html,wt2wt,html2html
16282 language=es
16283 !! wikitext
16284 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16285 !! html/php
16286 <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" decoding="async" 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>
16287 !! html/parsoid
16288 <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>
16289 !! end
16290
16291 !! test
16292 Localized image handling (3).
16293 !! options
16294 language=fa
16295 parsoid=html2wt
16296 !! html/parsoid
16297 <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>
16298 !! wikitext
16299 [[File:Foobar.jpg|بندانگشتی]]
16300 !! end
16301
16302 !! test
16303 "border", "frameless" and "class" attributes on an image.
16304 !! options
16305 thumbsize=220
16306 parsoid=wt2html,wt2wt,html2html
16307 !! wikitext
16308 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16309 !! html/php
16310 <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" decoding="async" 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>
16311 </p>
16312 !! html/parsoid
16313 <p><figure-inline 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></figure-inline></p>
16314 !! end
16315
16316 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16317 !! test
16318 Invalid image attributes (T64500)
16319 !! options
16320 thumbsize=220
16321 parsoid=wt2html,wt2wt,html2html
16322 !! wikitext
16323 [[File:Foobar.jpg|thumb|float|left|caption]]
16324
16325 [[File:Foobar.jpg|thumb|righ|caption]]
16326
16327 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16328 !! html/php
16329 <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" decoding="async" 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>
16330 <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" decoding="async" 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>
16331 <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" decoding="async" 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>
16332 !! html/parsoid
16333 <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>
16334 <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>
16335 <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>
16336 !! end
16337
16338 !! article
16339 File:Barfoo.jpg
16340 !! text
16341 #REDIRECT [[File:Barfoo.jpg]]
16342 !! endarticle
16343
16344 # FIXME: Parsoid should run this test -- but we'd need to teach the
16345 # mockAPI about the redirected Barfoo.jpg image.
16346 !! test
16347 Redirected image
16348 !! wikitext
16349 [[Image:Barfoo.jpg]]
16350 !! html/php
16351 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16352 </p>
16353 !! end
16354
16355 ## FIXME: Parsoid needs to learn about this flag.
16356 !! test
16357 Missing image with uploads disabled
16358 !! options
16359 wgEnableUploads=0
16360 !! wikitext
16361 [[File:Foobaz.jpg]]
16362 !! html/php
16363 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16364 </p>
16365 !! html/parsoid
16366 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Foobaz.jpg"><span resource="./File:Foobaz.jpg">File:Foobaz.jpg</span></a></figure-inline></p>
16367 !! end
16368
16369 # Parsoid-specific testing for images
16370 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16371 # Currently imperfect due to a flaw in the Parsoid testrunner
16372 # Work in progress
16373 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16374 # image tests.
16375
16376 !! test
16377 Parsoid-specific image handling - simple image with size and middle alignment
16378 !! wikitext
16379 [[File:Foobar.jpg|middle|50px]]
16380 !! html/parsoid
16381 <p><figure-inline 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></figure-inline></p>
16382 !! end
16383
16384 !! test
16385 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16386 !! options
16387 parsoid=wt2wt,wt2html,html2html
16388 !! wikitext
16389 [[Image:Foobar.jpg|middle|50px]]
16390 !! html/parsoid
16391 <p><figure-inline 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></figure-inline></p>
16392 !! end
16393
16394 !! test
16395 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16396 !! wikitext
16397 [[File:Foobar.jpg|50px|middle]]
16398 !! html/parsoid
16399 <p><figure-inline 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></figure-inline></p>
16400 !! end
16401
16402 !! test
16403 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16404 !! options
16405 parsoid=wt2html,wt2wt,html2html
16406 !! wikitext
16407 [[Image:Foobar.jpg|50px|middle]]
16408 !! html/parsoid
16409 <p><figure-inline 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></figure-inline></p>
16410 !! end
16411
16412 !! test
16413 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16414 !! wikitext
16415 [[File:Foobar.jpg|500x10px|baseline|caption]]
16416 !! html/parsoid
16417 <p><figure-inline 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></figure-inline></p>
16418 !! end
16419
16420 !! test
16421 Parsoid-specific image handling - simple image with border and size spec
16422 !! wikitext
16423 [[File:Foobar.jpg|50px|border|caption]]
16424 !! html/parsoid
16425 <p><figure-inline 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></figure-inline></p>
16426 !! end
16427
16428 !! test
16429 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16430 !! options
16431 parsoid=wt2html,html2html
16432 !! wikitext
16433 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16434 !! html/parsoid
16435 <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 content</figcaption></figure>
16436 !! end
16437
16438 !! test
16439 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16440 !! options
16441 parsoid=wt2html,html2html
16442 !! wikitext
16443 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16444 !! html/parsoid
16445 <figure class="mw-default-size mw-halign-left" 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>
16446 !! end
16447
16448 !! test
16449 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16450 !! options
16451 parsoid=wt2html,html2html
16452 !! wikitext
16453 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16454 !! html/parsoid
16455 <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/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
16456 !! end
16457
16458 !! test
16459 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16460 !! options
16461 parsoid=wt2html,html2html
16462 !! wikitext
16463 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16464 !! html/parsoid
16465 <figure class="mw-halign-right" 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>
16466 !! end
16467
16468 !! test
16469 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16470 !! options
16471 parsoid=wt2html,wt2wt,html2html
16472 !! wikitext
16473 [[File:Foobar.jpg|frame|500x50px|caption]]
16474 !! html/parsoid
16475 <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>
16476 !! end
16477
16478 !! test
16479 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16480 !! options
16481 parsoid=wt2html,html2html
16482 !! wikitext
16483 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16484 !! html/parsoid
16485 <figure class="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>caption</figcaption></figure>
16486 !! end
16487
16488 !! test
16489 Parsoid-specific image handling - frameless image with specific size, border, and caption
16490 !! wikitext
16491 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16492 !! html/parsoid
16493 <p><figure-inline 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></figure-inline></p>
16494 !! end
16495
16496 !! test
16497 Parsoid-specific image handling - simple image with a formatted caption
16498 !! wikitext
16499 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16500 !! html/parsoid
16501 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&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>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16502 !! end
16503
16504 !! test
16505 Parsoid-specific image handling - caption with a template in it
16506 !! wikitext
16507 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16508 !! html/parsoid
16509 <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>
16510 !! end
16511
16512 !! test
16513 Parsoid-specific image handling - caption with unbalanced tags in it
16514 !! options
16515 parsoid=wt2html,wt2wt,html2html
16516 !! wikitext
16517 foo
16518 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16519 bar
16520 !! html/parsoid
16521 <p>foo</p>
16522 <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>
16523 <p>bar</p>
16524 !! end
16525
16526 !! test
16527 Parsoid-specific image handling - empty caption (1)
16528 !! options
16529 parsoid=wt2html,wt2wt
16530 !! wikitext
16531 [[File:Foobar.jpg|thumb|]]
16532 !! html/parsoid
16533 <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>
16534 !! end
16535
16536 # empty captions don't get serialized unless we're in the "round trip" case
16537 !! test
16538 Parsoid-specific image handling - empty caption (2)
16539 !! options
16540 parsoid=html2wt
16541 !! html/parsoid
16542 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16543 <a href="./File:Foobar.jpg">
16544 <img resource="./File:Foobar.jpg"
16545 src="//example.com/images/3/3a/Foobar.jpg"
16546 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16547 height="25" width="220"/>
16548 </a>
16549 <figcaption></figcaption>
16550 </figure>
16551 !! wikitext
16552 [[File:Foobar.jpg|thumb]]
16553 !! end
16554
16555 !! test
16556 Parsoid-specific image handling - whitespace caption
16557 !! wikitext
16558 [[File:Foobar.jpg|thumb| ]]
16559 !! html/parsoid
16560 <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>
16561 !! end
16562
16563 !! test
16564 Parsoid-specific image handling - lang option
16565 !! wikitext
16566 foo
16567 [[File:Foobar.svg|lang=de|caption]]
16568 bar
16569 !! html/parsoid
16570 <p>foo
16571 <figure-inline 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></figure-inline>
16572 bar</p>
16573 !! end
16574
16575 ## Edge case bugs in Parsoid from T93580
16576 !! test
16577 T93580: 1. Templated <ref> inside block images
16578 !! wikitext
16579 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16580
16581 <references />
16582 !! html/parsoid
16583 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><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/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 with templated ref: <sup about="#mwt5" 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&lt;/ref>"}},"i":0}}]}'><a href="./Parser_test#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
16584
16585 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#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" data-parsoid="{}">foo</span></li></ol>
16586 !! end
16587
16588 !! test
16589 T93580: 2. <ref> inside inline images
16590 !! wikitext
16591 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16592
16593 <references />
16594 !! html/parsoid
16595 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"attrs\":{},\"body\":{\"id\":\"mw-reference-text-cite_note-1\"}}&#39;>&lt;a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16596
16597 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#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>
16598 !! end
16599
16600 !! test
16601 T93580: 3. Templated <ref> inside inline images
16602 !! wikitext
16603 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16604
16605 <references />
16606 !! html/parsoid
16607 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Parser_test#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
16608
16609 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Parser_test#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>
16610 !! end
16611
16612 ###
16613 ### Subpages
16614 ###
16615 !! article
16616 Subpage test/subpage
16617 !! text
16618 foo
16619 !! endarticle
16620
16621 !! test
16622 Subpage link
16623 !! options
16624 subpage title=[[Subpage test]]
16625 !! wikitext
16626 [[/subpage]]
16627 !! html
16628 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16629 </p>
16630 !! end
16631
16632 !! test
16633 Subpage noslash link
16634 !! options
16635 subpage title=[[Subpage test]]
16636 !! wikitext
16637 [[/subpage/]]
16638 !! html
16639 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16640 </p>
16641 !! end
16642
16643 !! article
16644 Subpage test/1/2/subpage
16645 !! text
16646 blah
16647 !! endarticle
16648
16649 !! test
16650 Relative subpage noslash link
16651 !! options
16652 parsoid=wt2wt,wt2html,html2html
16653 subpage title=[[Subpage test/1/2/3/4]]
16654 !! wikitext
16655 [[../../subpage/]]
16656
16657 [[../../subpage]]
16658 !! html/php
16659 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16660 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16661 </p>
16662 !! html/parsoid
16663 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16664 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16665 !! end
16666
16667 !! test
16668 Parsoid: dot-slash prefixed wikilinks
16669 !! wikitext
16670 [[./foo]]
16671
16672 [[././bar]]
16673
16674 [[././baz/]]
16675 !! html/php
16676 <p>[[./foo]]
16677 </p><p>[[././bar]]
16678 </p><p>[[././baz/]]
16679 </p>
16680 !! html/parsoid
16681 <p>[[./foo]]
16682 </p><p>[[././bar]]
16683 </p><p>[[././baz/]]
16684 </p>
16685 !! end
16686
16687 !! test
16688 Render invalid page names as plain text (T53090)
16689 !! wikitext
16690 [[./../foo|bar]]
16691 [[foo�|bar]]
16692 [[foo/.|bar]]
16693 [[foo/..|bar]]
16694 [[foo~~~bar]]
16695 [[foo>bar]]
16696 [[foo[bar]]
16697 [[.]]
16698 [[..]]
16699 [[foo././bar]]
16700 [[foo[http://example.com]xyz]]
16701
16702 [[{{echo|./../foo}}|bar]]
16703 [[{{echo|foo/.}}|bar]]
16704 [[{{echo|foo/..}}|bar]]
16705 [[{{echo|foo~~~~bar}}]]
16706 [[{{echo|foo>bar}}]]
16707 [[{{echo|foo././bar}}]]
16708 [[{{echo|foo{bar}}]]
16709 [[{{echo|foo}bar}}]]
16710 [[{{echo|foo[bar}}]]
16711 [[{{echo|foo]bar}}]]
16712 [[{{echo|foo<bar}}]]
16713 !!html/php
16714 <p>[[./../foo|bar]]
16715 [[foo�|bar]]
16716 [[foo/.|bar]]
16717 [[foo/..|bar]]
16718 [[foo~~~bar]]
16719 [[foo&gt;bar]]
16720 [[foo[bar]]
16721 [[.]]
16722 [[..]]
16723 [[foo././bar]]
16724 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16725 </p><p>[[./../foo|bar]]
16726 [[foo/.|bar]]
16727 [[foo/..|bar]]
16728 [[foo~~~~bar]]
16729 [[foo&gt;bar]]
16730 [[foo././bar]]
16731 [[foo{bar]]
16732 [[foo}bar]]
16733 [[foo[bar]]
16734 [[foo]bar]]
16735 [[foo&lt;bar]]
16736 </p>
16737 !!html/parsoid
16738 <p>[[./../foo|bar]]
16739 [[foo�|bar]]
16740 [[foo/.|bar]]
16741 [[foo/..|bar]]
16742 [[foo~~~bar]]
16743 [[foo>bar]]
16744 [[foo[bar]]
16745 [[.]]
16746 [[..]]
16747 [[foo././bar]]
16748 [[foo<a rel="mw:ExtLink" href="http://example.com" class="external autonumber"></a>xyz]]</p>
16749
16750 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16751 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16752 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16753 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16754 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16755 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16756 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16757 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16758 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16759 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16760 [[<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>
16761 !!end
16762
16763 !! test
16764 Disabled subpages
16765 !! wikitext
16766 [[/subpage]]
16767 !! html
16768 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16769 </p>
16770 !! end
16771
16772 !! test
16773 T2561: {{/Subpage}}
16774 !! options
16775 subpage title=[[Page]]
16776 !! wikitext
16777 {{/Subpage}}
16778 !! html
16779 <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>
16780 </p>
16781 !! end
16782
16783 ###
16784 ### Categories
16785 ###
16786 !! article
16787 Category:MediaWiki User's Guide
16788 !! text
16789 blah
16790 !! endarticle
16791
16792 !! test
16793 Link to category
16794 !! wikitext
16795 [[:Category:MediaWiki User's Guide]]
16796 !! html
16797 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16798 </p>
16799 !! end
16800
16801 !! test
16802 Simple category
16803 !! options
16804 cat
16805 !! wikitext
16806 [[Category:MediaWiki User's Guide]]
16807 !! html/php
16808 cat=MediaWiki_User's_Guide sort=
16809 !! html/parsoid
16810 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
16811 !! end
16812
16813 !! test
16814 PAGESINCATEGORY invalid title fatal (r33546 fix)
16815 !! wikitext
16816 {{PAGESINCATEGORY:<bogus>}}
16817 !! html
16818 <p>0
16819 </p>
16820 !! end
16821
16822 !! test
16823 Category with different sort key
16824 !! options
16825 cat
16826 !! wikitext
16827 [[Category:MediaWiki User's Guide|Foo]]
16828 !! html/php
16829 cat=MediaWiki_User's_Guide sort=Foo
16830 !! html/parsoid
16831 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
16832 !! end
16833
16834 !! test
16835 Category with identical sort key
16836 !! options
16837 cat
16838 !! wikitext
16839 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16840 !! html/php
16841 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16842 !! html/parsoid
16843 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
16844 !! end
16845
16846 !! test
16847 Category with template-generated sort key
16848 !! options
16849 cat
16850 !! wikitext
16851 [[Category:MediaWiki User's Guide|MediaWiki {{echo|Foo}} Guide]]
16852 !! html/php
16853 cat=MediaWiki_User's_Guide sort=MediaWiki Foo Guide
16854 !! html/parsoid
16855 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20Foo%20Guide" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"mw:sortKey"},{"html":"MediaWiki &lt;span typeof=\"mw:Transclusion\" data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&apos;>Foo&lt;/span> Guide"}]]}'/>
16856 !! end
16857
16858 !! test
16859 Category with empty sort key
16860 !! options
16861 cat
16862 pst
16863 !! wikitext
16864 [[Category:MediaWiki User's Guide|]]
16865 !! html/php
16866 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16867 !! end
16868
16869 !! test
16870 Category with empty sort key and parentheses
16871 !! options
16872 cat
16873 pst
16874 !! wikitext
16875 [[Category:Foo (bar)|]]
16876 !! html/php
16877 [[Category:Foo (bar)|Foo]]
16878 !! end
16879
16880 !! test
16881 Category with link tail
16882 !! options
16883 cat
16884 pst
16885 !! wikitext
16886 123[[Category:Foo]]456
16887 !! html/php
16888 123[[Category:Foo]]456
16889 !! end
16890
16891 !! test
16892 Category with template
16893 !! options
16894 cat
16895 pst
16896 !! wikitext
16897 [[Category:{{echo|Foo}}]]
16898 !! html/php
16899 [[Category:{{echo|Foo}}]]
16900 !! end
16901
16902 !! test
16903 Category with template in sort key
16904 !! options
16905 cat
16906 pst
16907 !! wikitext
16908 [[Category:Foo|{{echo|Bar}}]]
16909 !! html/php
16910 [[Category:Foo|{{echo|Bar}}]]
16911 !! end
16912
16913 !! test
16914 Category with template in sort key and title
16915 !! options
16916 cat
16917 pst
16918 !! wikitext
16919 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16920 !! html/php
16921 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16922 !! end
16923
16924 ## We used to, but no longer wt2wt this test since the default serializer
16925 ## will normalize all categories to serialize on their own line.
16926 ## This wikitext usage is going to be fairly uncommon in production and
16927 ## selser will take care of preserving formatting in those scenarios.
16928 !! test
16929 Category / paragraph interactions
16930 !! options
16931 parsoid=wt2html
16932 !! wikitext
16933 Foo [[Category:Baz]] Bar
16934
16935 Foo [[Category:Baz]]
16936 Bar
16937
16938 Foo
16939 [[Category:Baz]]
16940 Bar
16941
16942 Foo
16943 [[Category:Baz]] Bar
16944
16945 Foo
16946 [[Category:Baz]]
16947 [[Category:Baz]]
16948 [[Category:Baz]]
16949 Bar
16950
16951 [[Category:Baz]]
16952 [[Category:Baz]]
16953 [[Category:Baz]]
16954
16955 [[Category:Baz]]
16956 {{echo|[[Category:Baz]]}}
16957 [[Category:Baz]]
16958 !! html/php
16959 <p>Foo Bar
16960 </p><p>Foo
16961 Bar
16962 </p><p>Foo
16963 Bar
16964 </p><p>Foo Bar
16965 </p><p>Foo
16966 Bar
16967 </p>
16968 !! html/parsoid
16969 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16970 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16971 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16972 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16973 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16974 <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/>
16975 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16976 !! end
16977
16978 ## We used to, but no longer wt2wt this test since the default serializer
16979 ## will normalize all categories to serialize on their own line.
16980 ## This wikitext usage is going to be fairly uncommon in production and
16981 ## selser will take care of preserving formatting in those scenarios.
16982 ##
16983 ## The whitespace on the empty line is part of the test. Please do not delete
16984 !! test
16985 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16986 !! options
16987 parsoid=wt2html
16988 !! wikitext
16989 This
16990
16991 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16992
16993 {{echo|[[Category:Foo]] and so should this!}}
16994 !! html/php
16995 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16996 </p>
16997 !! html/parsoid
16998 <p>This
16999
17000 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
17001
17002 <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>
17003 !! end
17004
17005 ## Parsoid will not try to wt2wt this while preserving newlines because
17006 ## it suppresses excess newlines within list items -- and we don't want to
17007 ## introduce a special case just for categories, which is, in reality somewhat
17008 ## odd behavior -- categories are unlikely to be used in list items like this
17009 ## in top-level pages and are only likely to show up in template-generated
17010 ## list items where this RT-ing is a non-issue.
17011 ##
17012 ## The whitespace on the empty line is part of the test. Please do not delete
17013 !! test
17014 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
17015 !! options
17016 parsoid=wt2html
17017 !! wikitext
17018 * This
17019
17020 [[Category:Foo]] and this should be part of the same list item
17021 * So should this
17022
17023 {{echo|[[Category:Foo]] and this should be part of the same list item}}
17024 !! html/php+tidy
17025 <ul><li>This and this should be part of the same list item</li>
17026 <li>So should this and this should be part of the same list item</li></ul>
17027 !! html/parsoid
17028 <ul>
17029 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
17030 <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>
17031 </ul>
17032 !! end
17033
17034 ## Newlines and categories that follow the last item of a list
17035 ## are treated differently because this (list followed by categories)
17036 ## is an extremely common pattern on wikis.
17037 !! test
17038 3. Categories and newlines: newline suppression for last list item should RT properly
17039 !! wikitext
17040 *a
17041 *b
17042
17043 [[Category:Foo]]
17044
17045 [[Category:Bar]]
17046 [[Category:Baz]]
17047
17048 :c
17049
17050 [[Category:C]]
17051
17052 ;d
17053
17054 [[Category:D]]
17055 !! html/parsoid
17056 <ul><li>a</li>
17057 <li>b</li></ul>
17058
17059 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17060
17061 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
17062 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
17063
17064 <dl><dd>c</dd></dl>
17065
17066 <link rel="mw:PageProp/Category" href="./Category:C"/>
17067
17068 <dl><dt>d</dt></dl>
17069
17070 <link rel="mw:PageProp/Category" href="./Category:D"/>
17071 !! end
17072
17073 !! test
17074 4. Categories and newlines: newline suppression for last list item should RT properly
17075 !! wikitext
17076 *a
17077 ****b
17078
17079 [[Category:Foo]]
17080 !! html/parsoid
17081 <ul><li>a
17082 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
17083
17084 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
17085 !! end
17086
17087 ## only wt2html for this to make sure the algo only applies to the rightmost path
17088 !! test
17089 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
17090 !! options
17091 parsoid=wt2html
17092 !! wikitext
17093 *a
17094 **b
17095 [[Category:Foo]]
17096 *c
17097 **d
17098 [[Category:Foo]]
17099 !! html/parsoid
17100 <ul><li>a
17101 <ul><li>b
17102 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
17103 <li>c
17104 <ul><li>d</li></ul></li></ul>
17105 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
17106 !! end
17107
17108 ## We used to, but no longer wt2wt this test since the default serializer
17109 ## will normalize all categories to serialize on their own line.
17110 ## This wikitext usage is going to be fairly uncommon in production and
17111 ## selser will take care of preserving formatting in those scenarios.
17112 !! test
17113 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
17114 !! options
17115 parsoid=wt2html
17116 !! wikitext
17117 *a [[Category:Foo]]
17118 !! html/parsoid
17119 <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>
17120 !! end
17121
17122 # This test also demonstrates because of newline+category tunneling
17123 # through the list hander, template wrapping doesn't expand to the
17124 # containing list when the list item swallows the category.
17125 !! test
17126 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
17127 !! wikitext
17128 *{{echo|a
17129 [[Category:Foo]]}}
17130 !! html/parsoid
17131 <ul><li><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
17132 </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>
17133 !! end
17134
17135 !! test
17136 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
17137 !! wikitext
17138 *a
17139
17140 {{echo|[[Category:Foo]]
17141 [[Category:Bar]]}}
17142 [[Category:Baz]]
17143 !! html/parsoid
17144 <ul><li>a</li></ul>
17145
17146 <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"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
17147 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
17148 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
17149 !! end
17150
17151 !! test
17152 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
17153 !! wikitext
17154 *a
17155
17156 [[Category:Bar]]<!--boo1--> <!--boo2-->
17157 [[Category:Baz]]<!--boo3--> <!--boo4-->
17158 !! html/parsoid
17159 <ul><li>a</li></ul>
17160
17161 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
17162 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
17163 !! end
17164
17165 !! test
17166 Categories and newlines: should behave properly with linkprefix (T87753)
17167 !! options
17168 language=ar
17169 !! wikitext
17170 foo bar
17171 foo bar
17172 [[تصنيف:Foo]]
17173 [[تصنيف:Bar]]
17174 !! html/php
17175 <p>foo bar
17176 foo bar
17177 </p>
17178 !! html/parsoid
17179 <p>foo bar
17180 foo bar</p>
17181 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
17182 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
17183 !! end
17184
17185 !! test
17186 No regressions on internal links following category (T174639)
17187 !! options
17188 parsoid=wt2html,html2html
17189 !! wikitext
17190 [[Category:Foo]]<div>a
17191
17192 [[Foo]]</div>
17193 !! html/php
17194 <div>a
17195 <a href="/wiki/Foo" title="Foo">Foo</a></div>
17196 !! html/parsoid
17197 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
17198
17199 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
17200 !! end
17201
17202 # Note that Parsoid differs slightly from PHP due to T175421
17203 !! test
17204 11. Special case where only newlines separate links (T175416)
17205 !! options
17206 parsoid=wt2html,html2html
17207 !! wikitext
17208 [[Category:Foo]]
17209
17210 [[Foo]][[es:Alimento]]
17211
17212 [[Foo]]
17213 !! html/php
17214 <p><br />
17215 <a href="/wiki/Foo" title="Foo">Foo</a>
17216 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
17217 </p>
17218 !! html/parsoid
17219 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17220
17221 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17222
17223 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
17224 !! end
17225
17226 !! test
17227 Category links with multiple namespaces
17228 !! wikitext
17229 [[Category:Project:Foo]]
17230 !! html/parsoid
17231 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
17232 !! end
17233
17234 !! test
17235 Parsoid: Serialize link to category page with colon escape
17236 !! wikitext
17237
17238 [[:Category:Foo]]
17239 [[:Category:Foo|Bar]]
17240 !! html/php+tidy
17241 <p><a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Category:Foo</a>
17242 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
17243 </p>
17244 !! html/parsoid
17245 <p>
17246 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
17247 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
17248 </p>
17249 !! end
17250
17251 # We used to, but no longer wt2wt this test since the default serializer
17252 # will normalize all categories to serialize on their own line.
17253 # This wikitext usage is going to be fairly uncommon in production and
17254 # selser will take care of preventing whitespace insertion if this
17255 # occurs in an article.
17256 #
17257 # html2html disabled for the same reason (whitespace insertion between
17258 # x and y).
17259 #
17260 # html2wt disabled because it localizes the "Category" namespace.
17261 !! test
17262 Link prefix/suffixes aren't applied to category links
17263 !! options
17264 parsoid=wt2html
17265 language=is
17266 !! wikitext
17267 x[[Category:Foo]]y
17268 !! html/php
17269 <p>xy
17270 </p>
17271 !! html/parsoid
17272 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17273 !! end
17274
17275 !! test
17276 Link prefix/suffixes aren't applied to language links
17277 !! options
17278 parsoid=wt2html
17279 language=is
17280 !! wikitext
17281 x[[es:Foo]]y
17282 !! html/php
17283 <p>xy
17284 </p>
17285 !! html/parsoid
17286 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17287 !! end
17288
17289 !! test
17290 Parsoid: Serialize link to file page with colon escape
17291 !! wikitext
17292
17293 [[:File:Foo.png]]
17294 [[:File:Foo.png|Bar]]
17295 !! html/php+tidy
17296 <p><a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">File:Foo.png</a>
17297 <a href="/index.php?title=File:Foo.png&amp;action=edit&amp;redlink=1" class="new" title="File:Foo.png (page does not exist)">Bar</a>
17298 </p>
17299 !! html/parsoid
17300 <p>
17301 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17302 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17303 </p>
17304 !! end
17305
17306 !! test
17307 Parsoid: Serialize a genuine category link without colon escape
17308 !! wikitext
17309 [[Category:Foo]]
17310 [[Category:Foo|Bar]]
17311 !! html/php+tidy
17312 !! html/parsoid
17313 <link rel="mw:PageProp/Category" href="./Category:Foo">
17314 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17315 !! end
17316
17317 !! test
17318 Normalize hrefs properly before testing for invalid link targets (T72894)
17319 !! options
17320 parsoid=html2wt
17321 !! html/parsoid
17322 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17323 !! wikitext
17324 [[Category:Toxine bactérienne]]
17325 !! end
17326
17327 !! test
17328 Parsoid: Defaultsort
17329 !! wikitext
17330 {{DEFAULTSORT:Foo}}
17331 !! html/parsoid
17332 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17333 !! end
17334
17335 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17336 # But, this is a limitation of our representation and is documented in
17337 # TemplateHandler.js in processSpecialMagicWord
17338 !! test
17339 Parsoid: Defaultsort (template-generated)
17340 !! wikitext
17341 {{{{echo|DEFAULTSORT}}:Foo}}
17342 !! html/parsoid
17343 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
17344 !! end
17345
17346 ###
17347 ### Inter-language links
17348 ###
17349 !! test
17350 Interlanguage links
17351 !! options
17352 ill
17353 !! wikitext
17354 [[es:Alimento]]
17355 [[fr:Nourriture]]
17356 [[zh:食品]]
17357 !! html/php
17358 es:Alimento fr:Nourriture zh:食品
17359 !! html/parsoid
17360 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17361 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17362 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17363 !! end
17364
17365 !! test
17366 Duplicate interlanguage links (T26502)
17367 !! options
17368 ill
17369 !! wikitext
17370 [[es:1]]
17371 [[es:2]]
17372 [[fr:1]]
17373 [[fr:2]]
17374 !! html/php
17375 es:1 fr:1
17376 !! html/parsoid
17377 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17378 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17379 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17380 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17381 !! end
17382
17383 ###
17384 ### Sections
17385 ###
17386 !! test
17387 Basic section headings
17388 !! wikitext
17389 ==Headline 1==
17390 Some text
17391
17392 ==Headline 2==
17393 More
17394 ===Smaller headline===
17395 Blah blah
17396 !! html
17397 <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>
17398 <p>Some text
17399 </p>
17400 <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>
17401 <p>More
17402 </p>
17403 <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>
17404 <p>Blah blah
17405 </p>
17406 !! end
17407
17408 !! test
17409 Section headings with TOC
17410 !! wikitext
17411 ==Headline 1==
17412 ===Subheadline 1===
17413 =====Skipping a level=====
17414 ======Skipping a level======
17415
17416 ==Headline 2==
17417 Some text
17418 ===Another headline===
17419 !! html
17420 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17421 <ul>
17422 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17423 <ul>
17424 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17425 <ul>
17426 <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>
17427 <ul>
17428 <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>
17429 </ul>
17430 </li>
17431 </ul>
17432 </li>
17433 </ul>
17434 </li>
17435 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17436 <ul>
17437 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17438 </ul>
17439 </li>
17440 </ul>
17441 </div>
17442
17443 <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>
17444 <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>
17445 <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>
17446 <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>
17447 <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>
17448 <p>Some text
17449 </p>
17450 <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>
17451 !! end
17452
17453 !! test
17454 TOC anchors don't collide
17455 !! wikitext
17456 __FORCETOC__
17457 ==Headline 2==
17458 ==Headline==
17459 ==Headline 2==
17460 ==Headline==
17461 !! html/php
17462 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17463 <ul>
17464 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17465 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17466 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17467 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17468 </ul>
17469 </div>
17470
17471 <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>
17472 <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>
17473 <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>
17474 <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>
17475 !! end
17476
17477 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17478 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17479 !! test
17480 Handling of sections up to level 6 and beyond
17481 !! options
17482 parsoid=wt2html
17483 !! wikitext
17484 =Level 1 Heading=
17485 ==Level 2 Heading==
17486 ===Level 3 Heading===
17487 ====Level 4 Heading====
17488 =====Level 5 Heading=====
17489 ======Level 6 Heading======
17490 =======Level 7 Heading=======
17491 ========Level 8 Heading========
17492 =========Level 9 Heading=========
17493 ==========Level 10 Heading==========
17494 !! html/php
17495 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17496 <ul>
17497 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17498 <ul>
17499 <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>
17500 <ul>
17501 <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>
17502 <ul>
17503 <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>
17504 <ul>
17505 <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>
17506 <ul>
17507 <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>
17508 <li class="toclevel-6 tocsection-7"><a href="#.3DLevel_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">=Level 7 Heading=</span></a></li>
17509 <li class="toclevel-6 tocsection-8"><a href="#.3D.3DLevel_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">==Level 8 Heading==</span></a></li>
17510 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3DLevel_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">===Level 9 Heading===</span></a></li>
17511 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3DLevel_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>
17512 </ul>
17513 </li>
17514 </ul>
17515 </li>
17516 </ul>
17517 </li>
17518 </ul>
17519 </li>
17520 </ul>
17521 </li>
17522 </ul>
17523 </div>
17524
17525 <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>
17526 <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>
17527 <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>
17528 <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>
17529 <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>
17530 <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>
17531 <h6><span class="mw-headline" id=".3DLevel_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>
17532 <h6><span class="mw-headline" id=".3D.3DLevel_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>
17533 <h6><span class="mw-headline" id=".3D.3D.3DLevel_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>
17534 <h6><span class="mw-headline" id=".3D.3D.3D.3DLevel_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>
17535 !! html/parsoid
17536 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17537 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17538 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17539 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17540 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17541 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17542 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17543 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17544 <h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3DLevel_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
17545 <h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
17546 !! end
17547
17548 !! test
17549 TOC regression (T11764)
17550 !! wikitext
17551 ==title 1==
17552 ===title 1.1===
17553 ====title 1.1.1====
17554 ===title 1.2===
17555 ==title 2==
17556 ===title 2.1===
17557 !! html
17558 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17559 <ul>
17560 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17561 <ul>
17562 <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>
17563 <ul>
17564 <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>
17565 </ul>
17566 </li>
17567 <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>
17568 </ul>
17569 </li>
17570 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17571 <ul>
17572 <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>
17573 </ul>
17574 </li>
17575 </ul>
17576 </div>
17577
17578 <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>
17579 <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>
17580 <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>
17581 <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>
17582 <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>
17583 <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>
17584 !! end
17585
17586 !! test
17587 TOC for heading containing <span id="..."></span> (T96153)
17588 !! wikitext
17589 __FORCETOC__
17590 ==<span id="old-anchor"></span>New title==
17591 !! html/php
17592 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17593 <ul>
17594 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17595 </ul>
17596 </div>
17597
17598 <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>
17599 !! end
17600
17601 !! test
17602 TOC with wgMaxTocLevel=3 (T8204)
17603 !! options
17604 wgMaxTocLevel=3
17605 !! wikitext
17606 ==title 1==
17607 ===title 1.1===
17608 ====title 1.1.1====
17609 ===title 1.2===
17610 ==title 2==
17611 ===title 2.1===
17612 !! html
17613 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17614 <ul>
17615 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17616 <ul>
17617 <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>
17618 <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>
17619 </ul>
17620 </li>
17621 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17622 <ul>
17623 <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>
17624 </ul>
17625 </li>
17626 </ul>
17627 </div>
17628
17629 <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>
17630 <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>
17631 <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>
17632 <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>
17633 <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>
17634 <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>
17635 !! end
17636
17637 !! test
17638 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17639 !! options
17640 wgMaxTocLevel=3
17641 !! wikitext
17642 ==Section 1==
17643 ===Section 1.1===
17644 ====Section 1.1.1====
17645 ====Section 1.1.1.1====
17646 ==Section 2==
17647 !! html
17648 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17649 <ul>
17650 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17651 <ul>
17652 <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>
17653 </ul>
17654 </li>
17655 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17656 </ul>
17657 </div>
17658
17659 <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>
17660 <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>
17661 <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>
17662 <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>
17663 <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>
17664 !! end
17665
17666
17667 !! test
17668 Resolving duplicate section names
17669 !! wikitext
17670 ==Foo bar==
17671 ==Foo bar==
17672 !! html
17673 <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>
17674 <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>
17675 !! end
17676
17677 !! test
17678 Resolving duplicate section names with differing case (T12721)
17679 !! wikitext
17680 ==Foo bar==
17681 ==Foo Bar==
17682 !! html
17683 <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>
17684 <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>
17685 !! end
17686
17687 !! article
17688 Template:sections
17689 !! text
17690 ===Section 1===
17691 ==Section 2==
17692 !! endarticle
17693
17694 !! test
17695 Template with sections, __NOTOC__
17696 !! wikitext
17697 __NOTOC__
17698 ==Section 0==
17699 {{sections}}
17700 ==Section 4==
17701 !! html
17702 <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>
17703 <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>
17704 <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>
17705 <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>
17706 !! end
17707
17708 !! test
17709 __NOEDITSECTION__ keyword
17710 !! wikitext
17711 __NOEDITSECTION__
17712 ==Section 1==
17713 ==Section 2==
17714 !! html
17715 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17716 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17717 !! end
17718
17719 !! test
17720 Link inside a section heading
17721 !! wikitext
17722 ==Section with a [[Main Page|link]] in it==
17723 !! html
17724 <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>
17725 !! end
17726
17727 !! test
17728 TOC regression (T14077)
17729 !! wikitext
17730 __TOC__
17731 ==title 1==
17732 ===title 1.1===
17733 ==title 2==
17734 !! html
17735 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17736 <ul>
17737 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17738 <ul>
17739 <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>
17740 </ul>
17741 </li>
17742 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17743 </ul>
17744 </div>
17745
17746 <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>
17747 <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>
17748 <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>
17749 !! end
17750
17751 !! test
17752 T3219 URL next to image (good)
17753 !! wikitext
17754 http://example.com [[File:Foobar.jpg]]
17755 !! html/php
17756 <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" decoding="async" width="1941" height="220" /></a>
17757 </p>
17758 !! html/parsoid
17759 <p><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a> <figure-inline 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></figure-inline></p>
17760 !!end
17761
17762 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17763 !! test
17764 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17765 !! options
17766 parsoid=wt2html,html2html
17767 !! wikitext
17768 ===
17769 The line above must have a trailing space!
17770 === <!--
17771 --> <!-- -->
17772 But just in case it doesn't...
17773 !! html/php
17774 <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>
17775 <p>The line above must have a trailing space!
17776 </p>
17777 <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>
17778 <p>But just in case it doesn't...
17779 </p>
17780 !! html/parsoid
17781 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17782 <p>The line above must have a trailing space!</p>
17783 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17784 --> <!-- -->
17785 <p>But just in case it doesn't...</p>
17786 !! end
17787
17788 !! test
17789 Header with special characters (T27462)
17790 !! wikitext
17791 The tooltips shall not show entities to the user (ie. be double escaped)
17792
17793 ==text > text==
17794 section 1
17795
17796 ==text < text==
17797 section 2
17798
17799 ==text & text==
17800 section 3
17801
17802 ==text ' text==
17803 section 4
17804
17805 ==text " text==
17806 section 5
17807 !! html/php
17808 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17809 </p>
17810 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17811 <ul>
17812 <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>
17813 <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>
17814 <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>
17815 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17816 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17817 </ul>
17818 </div>
17819
17820 <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>
17821 <p>section 1
17822 </p>
17823 <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>
17824 <p>section 2
17825 </p>
17826 <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>
17827 <p>section 3
17828 </p>
17829 <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 &#039; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
17830 <p>section 4
17831 </p>
17832 <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>
17833 <p>section 5
17834 </p>
17835 !! html/parsoid
17836 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17837
17838 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17839 <p>section 1</p>
17840
17841 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17842 <p>section 2</p>
17843
17844 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17845 <p>section 3</p>
17846
17847 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17848 <p>section 4</p>
17849
17850 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17851 <p>section 5</p>
17852 !! end
17853
17854 !! test
17855 Header with space, plus and underscore as entity
17856 !! wikitext
17857 Id should not contain + for spaces
17858
17859 ==Space between Text==
17860 section 1
17861
17862 ==Space-Entity&#32;between&#32;Text==
17863 section 2
17864
17865 ==Plus+between+Text==
17866 section 3
17867
17868 ==Plus-Entity&#43;between&#43;Text==
17869 section 4
17870
17871 ==Underscore_between_Text==
17872 section 5
17873
17874 ==Underscore-Entity&#95;between&#95;Text==
17875 section 6
17876
17877 [[#Space between Text]]
17878 [[#Space-Entity&#32;between&#32;Text]]
17879 [[#Plus+between+Text]]
17880 [[#Plus-Entity&#43;between&#43;Text]]
17881 [[#Underscore_between_Text]]
17882 [[#Underscore-Entity&#95;between&#95;Text]]
17883 !! html/php
17884 <p>Id should not contain + for spaces
17885 </p>
17886 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17887 <ul>
17888 <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>
17889 <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>
17890 <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>
17891 <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>
17892 <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>
17893 <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>
17894 </ul>
17895 </div>
17896
17897 <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>
17898 <p>section 1
17899 </p>
17900 <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>
17901 <p>section 2
17902 </p>
17903 <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>
17904 <p>section 3
17905 </p>
17906 <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>
17907 <p>section 4
17908 </p>
17909 <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>
17910 <p>section 5
17911 </p>
17912 <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>
17913 <p>section 6
17914 </p><p><a href="#Space_between_Text">#Space between Text</a>
17915 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17916 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17917 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17918 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17919 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17920 </p>
17921 !! html/parsoid
17922 <p>Id should not contain + for spaces</p>
17923
17924 <h2 id="Space_between_Text">Space between Text</h2>
17925 <p>section 1</p>
17926
17927 <h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>Text</h2>
17928 <p>section 2</p>
17929
17930 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17931 <p>section 3</p>
17932
17933 <h2 id="Plus-Entity+between+Text"><span id="Plus-Entity.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>Text</h2>
17934 <p>section 4</p>
17935
17936 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17937 <p>section 5</p>
17938
17939 <h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>Text</h2>
17940 <p>section 6</p>
17941
17942 <p><a rel="mw:WikiLink" href="./Parser_test#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
17943 <a rel="mw:WikiLink" href="./Parser_test#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
17944 <a rel="mw:WikiLink" href="./Parser_test#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
17945 <a rel="mw:WikiLink" href="./Parser_test#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
17946 <a rel="mw:WikiLink" href="./Parser_test#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
17947 <a rel="mw:WikiLink" href="./Parser_test#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
17948 !! end
17949
17950 # Parsoid html2wt disabled because it adds padding spaces around =
17951 !! test
17952 Headers with excess '=' characters
17953 (Are similar tests necessary beyond the 1st level?)
17954 !! options
17955 parsoid=wt2html,wt2wt,html2html
17956 !! wikitext
17957 =foo==
17958 ==foo=
17959 =''italic'' heading==
17960 ==''italic'' heading=
17961 !! html/php
17962 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17963 <ul>
17964 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17965 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17966 <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>
17967 <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>
17968 </ul>
17969 </div>
17970
17971 <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>
17972 <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>
17973 <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>
17974 <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>
17975 !! html/parsoid
17976 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17977 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17978 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17979 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17980 !! end
17981
17982 !! test
17983 HTML headers vs TOC (T25393)
17984 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17985 !! wikitext
17986 <h1>Header 1</h1>
17987 ==Header 1.1==
17988 ==Header 1.2==
17989
17990 <h1>Header 2
17991 </h1>
17992 ==Header 2.1==
17993 ==Header 2.2==
17994 __NOEDITSECTION__
17995 !! html/php
17996 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17997 <ul>
17998 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17999 <ul>
18000 <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>
18001 <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>
18002 </ul>
18003 </li>
18004 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
18005 <ul>
18006 <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>
18007 <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>
18008 </ul>
18009 </li>
18010 </ul>
18011 </div>
18012
18013 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
18014 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
18015 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
18016 <h1><span class="mw-headline" id="Header_2">Header 2
18017 </span></h1>
18018 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
18019 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
18020 !! html/parsoid
18021 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
18022 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
18023 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
18024
18025 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
18026 </h1>
18027 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
18028 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
18029 <meta property="mw:PageProp/noeditsection"/>
18030 !! end
18031
18032 !! test
18033 Single-line or multiline-comments can follow headings
18034 !! options
18035 parsoid=wt2html,wt2wt
18036 !! wikitext
18037 ==foo==<!---->
18038 ==bar==<!--c1-->
18039 ==baz==<!--
18040 c2
18041 c3-->
18042 !! html/php
18043 <h2><span class="mw-headline" id="foo">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></h2>
18044 <h2><span class="mw-headline" id="bar">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: bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18045 <h2><span class="mw-headline" id="baz">baz</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: baz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
18046 !! html/parsoid
18047 <h2 id="foo">foo</h2><!---->
18048 <h2 id="bar">bar</h2><!--c1-->
18049 <h2 id="baz">baz</h2><!--
18050 c2
18051 c3-->
18052 !! end
18053
18054 !! test
18055 T3219 URL next to image (broken)
18056 !! wikitext
18057 http://example.com[[File:Foobar.jpg]]
18058 !! html/php
18059 <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" decoding="async" width="1941" height="220" /></a>
18060 </p>
18061 !! html/parsoid
18062 <p><a rel="mw:ExtLink" href="http://example.com" class="external free">http://example.com</a><figure-inline 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></figure-inline></p>
18063 !!end
18064
18065 !! test
18066 T3186 news: in the middle of text
18067 !! wikitext
18068 http://en.wikinews.org/wiki/Wikinews:Workplace
18069 !! html
18070 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
18071 </p>
18072 !!end
18073
18074
18075 !! test
18076 Namespaced link must have a title
18077 !! wikitext
18078 [[Project:]]
18079 !! html
18080 <p>[[Project:]]
18081 </p>
18082 !!end
18083
18084 !! test
18085 Namespaced link must have a title (bad fragment version)
18086 !! wikitext
18087 [[Project:#fragment]]
18088 !! html
18089 <p>[[Project:#fragment]]
18090 </p>
18091 !!end
18092
18093
18094 ###
18095 ### HTML tags and HTML attributes
18096 ###
18097
18098 !! test
18099 div with no attributes
18100 !! wikitext
18101 <div>HTML rocks</div>
18102 !! html
18103 <div>HTML rocks</div>
18104 !! end
18105
18106 !! test
18107 div with double-quoted attribute
18108 !! wikitext
18109 <div id="rock">HTML rocks</div>
18110 !! html
18111 <div id="rock">HTML rocks</div>
18112 !! end
18113
18114 !! test
18115 div with single-quoted attribute
18116 !! wikitext
18117 <div id='rock'>HTML rocks</div>
18118 !! html
18119 <div id="rock">HTML rocks</div>
18120 !! end
18121
18122 !! test
18123 div with unquoted attribute
18124 !! wikitext
18125 <div id=rock>HTML rocks</div>
18126 !! html
18127 <div id="rock">HTML rocks</div>
18128 !! end
18129
18130 !! test
18131 div with illegal double attributes
18132 !! wikitext
18133 <div id="a" id="b">HTML rocks</div>
18134 !! html
18135 <div id="b">HTML rocks</div>
18136 !! end
18137
18138 !! test
18139 div with empty attribute value, space before equals
18140 !! options
18141 parsoid=wt2html,html2html
18142 !! wikitext
18143 <div class =>HTML rocks</div>
18144 !! html/php
18145 <div class="">HTML rocks</div>
18146 !! html/parsoid
18147 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18148 !! end
18149
18150 !! test
18151 div with multiple empty attribute values
18152 !! config
18153 wgFragmentMode=[ 'html5', 'legacy' ]
18154 !! options
18155 parsoid=wt2html,html2html
18156 !! wikitext
18157 <div id= title=>HTML rocks</div>
18158 !! html/php
18159 <div id="title=">HTML rocks</div>
18160 !! html/parsoid
18161 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18162 !! end
18163
18164 # FIXME Parsoid doesn't actually match PHP here.
18165 !! test
18166 Extension tag in attribute value
18167 !! options
18168 wgRawHtml=1
18169 !! wikitext
18170 <span title="<html><div>123</div></html>">ok</span>
18171 !! html/php+tidy
18172 <p><span title="&lt;div&gt;123&lt;/div&gt;">ok</span>
18173 </p>
18174 !! html/parsoid
18175 <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"&lt;html>&lt;div>123&lt;/div>&lt;/html>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;div typeof=\"mw:Extension/html\" about=\"#mwt3\" data-parsoid=&apos;{\"dsr\":[13,40,2,2]}&apos; data-mw=&apos;{\"name\":\"html\",\"attrs\":{},\"body\":{\"extsrc\":\"&amp;lt;div>123&amp;lt;/div>\"}}&apos;>123&lt;/div>"}]]}'>ok</span></p>
18176 !! end
18177
18178 !! test
18179 table with multiple empty attribute values
18180 !! options
18181 parsoid=wt2html,html2html
18182 !! wikitext
18183 {| title= id=
18184 |hi
18185 |}
18186 !! html/php
18187 <table title="id=">
18188 <tr>
18189 <td>hi
18190 </td></tr></table>
18191 !! html/parsoid
18192 <table title="id=">
18193 <tbody><tr><td>hi</td></tr>
18194 </tbody></table>
18195 !! end
18196
18197 !! test
18198 div with braces in attribute value
18199 !! wikitext
18200 <div title="{}">Foo</div>
18201 !! html/php
18202 <div title="&#123;&#125;">Foo</div>
18203 !! html/parsoid
18204 <div title="{}">Foo</div>
18205 !! end
18206
18207 !! test
18208 div with empty attribute value, no space before equals
18209 !! options
18210 parsoid=wt2html,html2html
18211 !! wikitext
18212 <div class=>HTML rocks</div>
18213 !! html/php
18214 <div class="">HTML rocks</div>
18215 !! html/parsoid
18216 <div class="">HTML rocks</div>
18217 !! end
18218
18219 !! test
18220 HTML multiple attributes correction
18221 !! wikitext
18222 <p class="error" class="awesome">Awesome!</p>
18223 !! html
18224 <p class="awesome">Awesome!</p>
18225 !! end
18226
18227 !! test
18228 Table multiple attributes correction
18229 !! wikitext
18230 {|
18231 !+ class="error" class="awesome"|status
18232 |}
18233 !! html
18234 <table>
18235 <tr>
18236 <th class="awesome">status
18237 </th></tr></table>
18238 !! end
18239
18240 !! test
18241 DIV IN UPPERCASE
18242 !! wikitext
18243 <DIV ID="x">HTML ROCKS</DIV>
18244 !! html
18245 <div id="x">HTML ROCKS</div>
18246 !! end
18247
18248 !! test
18249 Non-ASCII pseudo-tags are rendered as text
18250 !! wikitext
18251 <khyô>
18252 !! html
18253 <p>&lt;khyô&gt;
18254 </p>
18255 !! end
18256
18257 !! test
18258 Pseudo-tag with URL 'name' renders as url link
18259 !! wikitext
18260 <http://example.com/>
18261 !! html
18262 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
18263 </p>
18264 !! end
18265
18266 !! test
18267 text with amp in the middle of nowhere
18268 !! wikitext
18269 Remember AT&T?
18270 !! html
18271 <p>Remember AT&amp;T?
18272 </p>
18273 !! end
18274
18275 !! test
18276 text with character entity: eacute
18277 !! wikitext
18278 I always thought &eacute; was a cute letter.
18279 !! html+tidy
18280 <p>I always thought &#233; was a cute letter.
18281 </p>
18282 !! end
18283
18284 !! test
18285 text with entity-escaped character entity-like string: eacute
18286 !! wikitext
18287 I always thought &amp;eacute; was a cute letter.
18288 !! html
18289 <p>I always thought &amp;eacute; was a cute letter.
18290 </p>
18291 !! end
18292
18293 !! test
18294 text with undefined character entity: xacute
18295 !! wikitext
18296 I always thought &xacute; was a cute letter.
18297 !! html
18298 <p>I always thought &amp;xacute; was a cute letter.
18299 </p>
18300 !! end
18301
18302 !! test
18303 Text with HTML5 semicolon-less entity (should not decode)
18304 !! wikitext
18305 &ampamp;
18306 !! html/php+tidy
18307 <p>&amp;ampamp;
18308 </p>
18309 !! html/parsoid
18310 <p>&amp;ampamp;</p>
18311 !! end
18312
18313 !! test
18314 HTML5 tags
18315 !! wikitext
18316 <data value="5">five</data>
18317 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18318 <mark>This highlighted text</mark>
18319 !! html
18320 <p><data value="5">five</data>
18321 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18322 <mark>This highlighted text</mark>
18323 </p>
18324 !! end
18325
18326 !! test
18327 HTML tag with leading space is parsed as text
18328 !! wikitext
18329 < div>foo< /div>
18330 !! html
18331 <p>&lt; div&gt;foo&lt; /div&gt;
18332 </p>
18333 !! end
18334
18335 ## FIXME: The untrimmed attribute in Parsoid is T205737
18336 !! test
18337 Element with broken attribute syntax
18338 !! options
18339 parsoid=wt2html
18340 !! wikitext
18341 <div style=" style="123">hi</div>
18342 <div =>ho</div>
18343 !! html/php
18344 <div style="style=">hi</div>
18345 <div>ho</div>
18346 !! html/parsoid
18347 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18348 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18349 !! end
18350
18351 ###
18352 ### Nesting tests (see T43545, T52604, T53081)
18353 ###
18354
18355 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18356 # Note that html2wt is considerably more difficult if we use <b> in
18357 # the test case, instead of <small>
18358 !! test
18359 Ensure that HTML adoption agency algorithm is properly implemented.
18360 !! wikitext
18361 <small>X<small>Y</small>Z</small>
18362 !! html
18363 <p><small>X<small>Y</small>Z</small>
18364 </p>
18365 !! end
18366
18367 # This was T43545 in the PHP parser.
18368 !! test
18369 Nesting of <kbd>
18370 !! wikitext
18371 <kbd>X<kbd>Y</kbd>Z</kbd>
18372 !! html+tidy
18373 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18374 </p>
18375 !! end
18376
18377 # The following cases were T53081 in the PHP parser.
18378 # Note that there are some other nestable tags (b, i, etc) which are
18379 # not covered; see T53081 for discussion.
18380
18381 !! test
18382 Nesting of <em>
18383 !! wikitext
18384 <em>X<em>Y</em>Z</em>
18385 !! html+tidy
18386 <p><em>X<em>Y</em>Z</em>
18387 </p>
18388 !! end
18389
18390 !! test
18391 Nesting of <strong>
18392 !! wikitext
18393 <strong>X<strong>Y</strong>Z</strong>
18394 !! html+tidy
18395 <p><strong>X<strong>Y</strong>Z</strong>
18396 </p>
18397 !! end
18398
18399 !! test
18400 Nesting of <q>
18401 !! wikitext
18402 <q>X<q>Y</q>Z</q>
18403 !! html+tidy
18404 <p><q>X<q>Y</q>Z</q>
18405 </p>
18406 !! end
18407
18408 !! test
18409 Nesting of <ruby>
18410 !! wikitext
18411 <ruby>X<ruby>Y</ruby>Z</ruby>
18412 !! html
18413 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18414 </p>
18415 !! end
18416
18417 !! test
18418 Nesting of <bdo>
18419 !! wikitext
18420 <bdo>X<bdo>Y</bdo>Z</bdo>
18421 !! html
18422 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18423 </p>
18424 !! end
18425
18426
18427 ###
18428 ### Media links
18429 ###
18430
18431 !! test
18432 Media link
18433 !! wikitext
18434 [[Media:Foobar.jpg]]
18435 [[Media:Video.ogv]]
18436 [[:Media:Video.ogv]]
18437 !! html/php
18438 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18439 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18440 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18441 </p>
18442 !! html/parsoid
18443 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18444 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18445 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv" data-parsoid='{"a":{"resource":"./Media:Video.ogv"},"sa":{"resource":":Media:Video.ogv"}}'>Media:Video.ogv</a></p>
18446 !! end
18447
18448 !! test
18449 Media link with text
18450 !! wikitext
18451 [[Media:Foobar.jpg|A neat file to look at]]
18452 !! html/php
18453 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18454 </p>
18455 !! html/parsoid
18456 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18457 !! end
18458
18459 !! test
18460 Localized media link
18461 !! options
18462 language=is
18463 !! wikitext
18464 [[Miðill:Foobar.jpg]]
18465
18466 [[Miðill:Foobar.jpg|Icelandic]]
18467 !! html/php
18468 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18469 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18470 </p>
18471 !! html/parsoid
18472 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Miðill:Foobar.jpg</a></p>
18473 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18474 !! end
18475
18476 # FIXME: this is still bad HTML tag nesting
18477 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18478 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18479 !! test
18480 Media link with nasty text
18481 !! options
18482 parsoid=wt2html,html2html
18483 !! wikitext
18484 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18485 !! html/php
18486 <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>
18487 !! html/php+tidy
18488 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
18489 !! html/parsoid
18490 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Safe Link</a></p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg"><div style="display:none" data-parsoid='{"stx":"html"}'>" onmouseover="alert(document.cookie)" onfoo="</div></a>
18491 !! end
18492
18493 !! test
18494 Media link from missing resource (parsoid-only)
18495 !! options
18496 parsoid=html2wt
18497 !! html/parsoid
18498 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18499 !! wikitext
18500 [[Media:Foobar.jpg|Bat!]]
18501 !! end
18502
18503 !! test
18504 Media link from missing resource, localized (parsoid-only)
18505 !! options
18506 parsoid=html2wt
18507 language=is
18508 !! html/parsoid
18509 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18510 !! wikitext
18511 [[Miðill:Foobar.jpg|Bat!]]
18512 !! end
18513
18514 # This is a sanity test to ensure we don't crash or choke when given
18515 # old cached 1.7.0 HTML for media links; we don't require that the
18516 # result be "valid" because wt2wt was completely broken in 1.7.0
18517 !! test
18518 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18519 !! options
18520 parsoid=html2wt
18521 !! html/parsoid
18522 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18523 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18524 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18525 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18526 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18527 !! wikitext
18528 This is what Parsoid would emit (and we still handle this HTML fine):
18529
18530 [[Media:Foobar.jpg|A neat file to look at]]
18531
18532 But VisualEditor would mangle the rel attribute, and give us back this:
18533
18534 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18535
18536 But at least we don't crash when trying to handle the mangled HTML!
18537 !! end
18538
18539 !! test
18540 Media link to nonexistent file (T3702)
18541 !! wikitext
18542 [[Media:No such.jpg]]
18543 [[Media:No_such file.jpg]]
18544 !! html/php
18545 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18546 <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
18547 </p>
18548 !! html/parsoid
18549 <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" resource="./Media:No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"resource":"./Media:No_such.jpg"},"sa":{"resource":"Media:No such.jpg"}}'>Media:No such.jpg</a>
18550 <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" resource="./Media:No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"resource":"./Media:No_such_file.jpg"},"sa":{"resource":"Media:No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
18551 !! end
18552
18553 !! test
18554 Image link to nonexistent file (T3850 - good)
18555 !! wikitext
18556 [[File:No_such.jpg]]
18557 !! html/php
18558 <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>
18559 </p>
18560 !! html/parsoid
18561 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/No_such.jpg"><span resource="./File:No_such.jpg">File:No such.jpg</span></a></figure-inline></p>
18562 !! end
18563
18564 !! test
18565 :Image link to nonexistent file (T3850 - bad)
18566 !! wikitext
18567 [[:Image:No such.jpg]]
18568 !! html/php
18569 <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>
18570 </p>
18571 !! html/parsoid
18572 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18573 !! end
18574
18575 !! test
18576 Character reference normalization in link text (T3938)
18577 !! wikitext
18578 [[Main Page|this&that]]
18579 !! html
18580 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18581 </p>
18582 !!end
18583
18584 !! article
18585 אַ
18586 !! text
18587 Test for unicode normalization
18588
18589 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18590 !! endarticle
18591
18592 !! test
18593 (T21451) Links should refer to the normalized form.
18594 !! wikitext
18595 [[&#xFB2E;]]
18596 [[&#x5d0;&#x5b7;]]
18597 [[&#x5d0;ַ]]
18598 [[א&#x5b7;]]
18599 [[אַ]]
18600 !! html
18601 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18602 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18603 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18604 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18605 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18606 </p>
18607 !! end
18608
18609 !! test
18610 Empty attribute crash test (T4067)
18611 !! wikitext
18612 <font color="">foo</font>
18613 !! html
18614 <p><font color="">foo</font>
18615 </p>
18616 !! end
18617
18618 !! test
18619 Empty attribute crash test single-quotes (T4067)
18620 !! wikitext
18621 <font color=''>foo</font>
18622 !! html
18623 <p><font color="">foo</font>
18624 </p>
18625 !! end
18626
18627 !! test
18628 Attribute test: equals, then nothing
18629 !! options
18630 parsoid=wt2html,html2html
18631 !! wikitext
18632 <font color=>foo</font>
18633 !! html/php
18634 <p><font color="">foo</font>
18635 </p>
18636 !! html/parsoid
18637 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18638 !! end
18639
18640 !! test
18641 Attribute test: unquoted value
18642 !! options
18643 parsoid=wt2html,html2html
18644 !! wikitext
18645 <font color=x>foo</font>
18646 !! html/php
18647 <p><font color="x">foo</font>
18648 </p>
18649 !! html/parsoid
18650 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18651 !! end
18652
18653 !! test
18654 Attribute test: unquoted but illegal value (hash)
18655 !! wikitext
18656 <font color=#x>foo</font>
18657 !! html
18658 <p><font color="#x">foo</font>
18659 </p>
18660 !! end
18661
18662 # Parsoid does not serialize to empty attribute syntax,
18663 # so wt2wt and html2wt cases are skipped
18664 !! test
18665 Attribute test: no value (T54330)
18666 !! options
18667 parsoid=wt2html,html2html
18668 !! wikitext
18669 <font color>foo</font>
18670 !! html/php
18671 <p><font color="">foo</font>
18672 </p>
18673 !! html/parsoid
18674 <p><font color="">foo</font></p>
18675 !! end
18676
18677 !! test
18678 T4095: link with three closing brackets
18679 !! wikitext
18680 [[Main Page]]]
18681 !! html/php
18682 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18683 </p>
18684 !! html/parsoid
18685 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18686 !! end
18687
18688 !! test
18689 T4095: link with pipe and three closing brackets
18690 !! wikitext
18691 [[Main Page|link]]]
18692 !! html/php
18693 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18694 </p>
18695 !! html/parsoid
18696 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18697 !! end
18698
18699 !! test
18700 T4095: link with pipe and three closing brackets, version 2
18701 !! wikitext
18702 [[Main Page|[http://example.com/]]]
18703 !! html/php
18704 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18705 </p>
18706 !! html/parsoid
18707 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18708 !! end
18709
18710
18711 ###
18712 ### Safety
18713 ###
18714
18715 !! article
18716 Template:Dangerous attribute
18717 !! text
18718 " onmouseover="alert(document.cookie)
18719 !! endarticle
18720
18721 !! article
18722 Template:Dangerous style attribute
18723 !! text
18724 border-size: expression(alert(document.cookie))
18725 !! endarticle
18726
18727 !! article
18728 Template:Div style
18729 !! text
18730 <div style="float: right; {{{1}}}">Magic div</div>
18731 !! endarticle
18732
18733 !! test
18734 T4304: HTML attribute safety (safe template; regression T4309)
18735 !! wikitext
18736 <div title="{{test}}"></div>
18737 !! html/php
18738 <div title="This is a test template"></div>
18739 !! html/parsoid
18740 <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
18741 !! end
18742
18743 # Parsoid has enough context to handle this case
18744 !! test
18745 T4304: HTML attribute safety (dangerous template; 2309)
18746 !! wikitext
18747 <div title="{{dangerous attribute}}"></div>
18748 !! html/php
18749 <div title=""></div>
18750 !! html/parsoid
18751 <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=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
18752 !! end
18753
18754 !! test
18755 T4304: HTML attribute safety (dangerous style template; 2309)
18756 !! wikitext
18757 <div style="{{dangerous style attribute}}"></div>
18758 !! html/php
18759 <div style="/* insecure input */"></div>
18760 !! html/parsoid
18761 <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
18762 !! end
18763
18764 !! test
18765 T4304: HTML attribute safety (safe parameter; 2309)
18766 !! wikitext
18767 {{div style|width: 200px}}
18768 !! html/php
18769 <div style="float: right; width: 200px">Magic div</div>
18770 !! html/parsoid
18771 <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
18772 !! end
18773
18774 !! test
18775 T4304: HTML attribute safety (unsafe parameter; 2309)
18776 !! wikitext
18777 {{div style|width: expression(alert(document.cookie))}}
18778 !! html/php
18779 <div style="/* insecure input */">Magic div</div>
18780 !! html/parsoid
18781 <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
18782 !! end
18783
18784 ## Parsoid output here differs; needs investigation.
18785 !! test
18786 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18787 !! wikitext
18788 {{div style|"><script>alert(document.cookie)</script>}}
18789 !! html
18790 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18791 !! end
18792
18793 ## Parsoid output here differs; needs investigation.
18794 !! test
18795 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18796 !! wikitext
18797 {{div style|" ><script>alert(document.cookie)</script>}}
18798 !! html
18799 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18800 !! end
18801
18802 !! test
18803 T4304: HTML attribute safety (link)
18804 !! wikitext
18805 <div title="[[Main Page]]"></div>
18806 !! html/php
18807 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18808 !! html/parsoid
18809 <div title="[[Main Page]]"></div>
18810 !! end
18811
18812 !! test
18813 T4304: HTML attribute safety (italics)
18814 !! wikitext
18815 <div title="''foobar''"></div>
18816 !! html
18817 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18818 !! end
18819
18820 !! test
18821 T4304: HTML attribute safety (bold)
18822 !! wikitext
18823 <div title="'''foobar'''"></div>
18824 !! html
18825 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18826 !! end
18827
18828 !! test
18829 T4304: HTML attribute safety (ISBN)
18830 !! wikitext
18831 <div title="ISBN 1234567890"></div>
18832 !! html
18833 <div title="&#73;SBN 1234567890"></div>
18834 !! end
18835
18836 !! test
18837 T4304: HTML attribute safety (RFC)
18838 !! wikitext
18839 <div title="RFC 1234"></div>
18840 !! html
18841 <div title="&#82;FC 1234"></div>
18842 !! end
18843
18844 !! test
18845 T4304: HTML attribute safety (PMID)
18846 !! wikitext
18847 <div title="PMID 1234567890"></div>
18848 !! html
18849 <div title="&#80;MID 1234567890"></div>
18850 !! end
18851
18852 !! test
18853 T4304: HTML attribute safety (web link)
18854 !! wikitext
18855 <div title="http://example.com/"></div>
18856 !! html
18857 <div title="http&#58;//example.com/"></div>
18858 !! end
18859
18860 !! test
18861 T4304: HTML attribute safety (named web link)
18862 !! wikitext
18863 <div title="[http://example.com/ link]"></div>
18864 !! html/php
18865 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18866 !! html/parsoid
18867 <div title="[http://example.com/ link]"></div>
18868 !! end
18869
18870 !! test
18871 T5244: HTML attribute safety (extension; safe)
18872 !! wikitext
18873 <div style="<nowiki>background:blue</nowiki>"></div>
18874 !! html/php
18875 <div style="background:blue"></div>
18876 !! html/parsoid
18877 <div style="background:blue" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[12,44,8,9]}&apos;>background:blue&lt;/span>"}]]}'></div>
18878 !! end
18879
18880 !! test
18881 T5244: HTML attribute safety (extension; unsafe)
18882 !! wikitext
18883 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18884 !! html/php
18885 <div style="/* insecure input */"></div>
18886 !! html/parsoid
18887 <div style="/* insecure input */" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&apos;{\"dsr\":[12,75,8,9]}&apos;>border-left:expression(alert(document.cookie))&lt;/span>"}]]}'></div>
18888 !! end
18889
18890 # More MSIE fun discovered by Tom Gilder
18891
18892 !! test
18893 MSIE CSS safety test: spurious slash
18894 !! wikitext
18895 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18896 !! html/php
18897 <div style="/* insecure input */">evil</div>
18898 !! html/parsoid
18899 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18900 !! end
18901
18902 !! test
18903 MSIE CSS safety test: hex code
18904 !! wikitext
18905 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18906 !! html/php
18907 <div style="/* insecure input */">evil</div>
18908 !! html/parsoid
18909 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18910 !! end
18911
18912 !! test
18913 MSIE CSS safety test: comment in url
18914 !! wikitext
18915 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18916 !! html/php
18917 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18918 !! html/parsoid
18919 <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
18920 !! end
18921
18922 !! test
18923 MSIE CSS safety test: comment in expression
18924 !! wikitext
18925 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18926 !! html/php
18927 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18928 !! html/parsoid
18929 <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
18930 !! end
18931
18932 !! test
18933 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18934 !! wikitext
18935 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18936 !! html/php
18937 <p style="/* invalid control char */">A</p>
18938 !! html/parsoid
18939 <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
18940 !! end
18941
18942 !! test
18943 MSIE 6 CSS safety test: Fullwidth (T57332)
18944 !! wikitext
18945 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18946 <div style="top:EXPRESSION(alert())">B</div>
18947 !! html/php
18948 <p style="/* insecure input */">A</p>
18949 <div style="/* insecure input */">B</div>
18950 !! html/parsoid
18951 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
18952 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18953 !! end
18954
18955 !! test
18956 MSIE 6 CSS safety test: IPA extensions (T57332)
18957 !! wikitext
18958 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18959 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18960 !! html/php
18961 <div style="/* insecure input */">A</div>
18962 <p style="/* insecure input */">B</p>
18963 !! html/parsoid
18964 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18965 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
18966 !! end
18967
18968 !! test
18969 MSIE 6 CSS safety test: sup/sub script (T57332)
18970 !! wikitext
18971 <div style="background-image:url⁽javascript:alert())">A</div>
18972 <div style="background-image:url₍javascript:alert())">B</div>
18973 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18974 !! html/php
18975 <div style="/* insecure input */">A</div>
18976 <div style="/* insecure input */">B</div>
18977 <p style="/* insecure input */">C</p>
18978 !! html/parsoid
18979 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18980 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18981 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
18982 !! end
18983
18984 !! test
18985 Opera -o-link CSS
18986 !! options
18987 parsoid=wt2html,html2html
18988 !! wikitext
18989 <div
18990 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;"
18991 style="-o-link:attr(title);-o-link-source:current">X</div>
18992 !! html/php
18993 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18994 !! html/parsoid
18995 <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
18996 !! end
18997
18998 !! test
18999 MSIE 6 CSS safety test: Repetition markers (T57332)
19000 !! wikitext
19001 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
19002 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
19003 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
19004 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
19005 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
19006 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
19007 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
19008 !! html/php
19009 <p style="/* insecure input */">A</p>
19010 <p style="/* insecure input */">B</p>
19011 <p style="/* insecure input */">C</p>
19012 <p style="/* insecure input */">D</p>
19013 <p style="/* insecure input */">E</p>
19014 <p style="/* insecure input */">F</p>
19015 <p style="/* insecure input */">G</p>
19016 !! html/parsoid
19017 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
19018 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
19019 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
19020 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
19021 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
19022 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
19023 <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
19024 !! end
19025
19026 !! test
19027 Table attribute legitimate extension
19028 !! wikitext
19029 {|
19030 !+ style="<nowiki>color:blue</nowiki>"|status
19031 |}
19032 !! html
19033 <table>
19034 <tr>
19035 <th style="color:blue">status
19036 </th></tr></table>
19037 !! end
19038
19039 !! test
19040 Table attribute safety
19041 !! wikitext
19042 {|
19043 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
19044 |}
19045 !! html
19046 <table>
19047 <tr>
19048 <th style="/* insecure input */">status
19049 </th></tr></table>
19050 !! end
19051
19052 !! test
19053 CSS line continuation 1
19054 !! wikitext
19055 <div style="background-image: u\&#10;rl(test.jpg);"></div>
19056 !! html
19057 <div style="/* insecure input */"></div>
19058 !! end
19059
19060 !! test
19061 CSS line continuation 2
19062 !! wikitext
19063 <div style="background-image: u\&#13;rl(test.jpg); "></div>
19064 !! html
19065 <div style="/* invalid control char */"></div>
19066 !! end
19067
19068 !! article
19069 Template:Identity
19070 !! text
19071 {{{1}}}
19072 !! endarticle
19073
19074 !! test
19075 Expansion of multi-line templates in attribute values (T8255)
19076 !! wikitext
19077 <div style="background: {{identity|#00FF00}}">-</div>
19078 !! html
19079 <div style="background: #00FF00">-</div>
19080 !! end
19081
19082 !! test
19083 Expansion of multi-line templates in attribute values (T8255 sanity check)
19084 !! wikitext
19085 <div style="background:
19086 #00FF00">-</div>
19087 !! html/php
19088 <div style="background: #00FF00">-</div>
19089 !! html/parsoid
19090 <div style="background:
19091 #00FF00">-</div>
19092 !! end
19093
19094 !! test
19095 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
19096 !! wikitext
19097 <div style="background: &#10;#00FF00">-</div>
19098 !! html
19099 <div style="background: &#10;#00FF00">-</div>
19100 !! end
19101
19102 !! test
19103 Tags which are hidden from tidiers cannot pass through the Sanitizer
19104 !! wikitext
19105 <mw:toc><script>alert();</script></mw:toc>
19106 !! html+tidy
19107 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
19108 </p>
19109 !! end
19110
19111 ###
19112 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
19113 ###
19114
19115 !! test
19116 Parser hook: empty input
19117 !! wikitext
19118 <tag></tag>
19119 !! html/php
19120 <pre>
19121 ''
19122 array (
19123 )
19124 </pre>
19125 !! html/parsoid
19126 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19127 !! end
19128
19129 ## Don't expect parsoid to rt this form.
19130 !! test
19131 Parser hook: empty input using terminated empty elements
19132 !! options
19133 parsoid=wt2html,html2html
19134 !! wikitext
19135 <tag/>
19136 !! html/php
19137 <pre>
19138 NULL
19139 array (
19140 )
19141 </pre>
19142 !! html/parsoid
19143 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19144 !! end
19145
19146 !! test
19147 Parser hook: empty input using terminated empty elements (space before)
19148 !! wikitext
19149 <tag />
19150 !! html/php
19151 <pre>
19152 NULL
19153 array (
19154 )
19155 </pre>
19156 !! html/parsoid
19157 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19158 !! end
19159
19160 !! test
19161 Parser hook: basic input
19162 !! wikitext
19163 <tag>input</tag>
19164 !! html/php
19165 <pre>
19166 'input'
19167 array (
19168 )
19169 </pre>
19170 !! html/parsoid
19171 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19172 !! end
19173
19174 ## Don't expect parsoid to rt this form.
19175 !! test
19176 Parser hook: case insensitive
19177 !! options
19178 parsoid=wt2html,html2html
19179 !! wikitext
19180 <TAG>input</TAG>
19181 !! html/php
19182 <pre>
19183 'input'
19184 array (
19185 )
19186 </pre>
19187 !! html/parsoid
19188 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19189 !! end
19190
19191 ## Don't expect parsoid to rt this form.
19192 !! test
19193 Parser hook: case insensitive, redux
19194 !! options
19195 parsoid=wt2html,html2html
19196 !! wikitext
19197 <TaG>input</TAg>
19198 !! html/php
19199 <pre>
19200 'input'
19201 array (
19202 )
19203 </pre>
19204 !! html/parsoid
19205 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19206 !! end
19207
19208 !! test
19209 Parser hook: nested tags
19210 !! options
19211 parsoid=wt2html
19212 !! wikitext
19213 <tag><tag></tag></tag>
19214 !! html/php
19215 <pre>
19216 '<tag>'
19217 array (
19218 )
19219 </pre>&lt;/tag&gt;
19220 !! html/php+tidy
19221 <pre>'<tag>'
19222 array (
19223 )
19224 </tag></pre><p>&lt;/tag&gt;</p>
19225 !! html/parsoid
19226 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
19227 !! end
19228
19229 !! test
19230 Parser hook: basic arguments
19231 !! wikitext
19232 <tag width="200" height="100" depth="50" square=""></tag>
19233 !! html/php
19234 <pre>
19235 ''
19236 array (
19237 'width' => '200',
19238 'height' => '100',
19239 'depth' => '50',
19240 'square' => '',
19241 )
19242 </pre>
19243 !! html/parsoid
19244 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19245 !! end
19246
19247 ## Don't expect parsoid to rt this form.
19248 !! test
19249 Parser hook: basic arguments, variations
19250 !! options
19251 parsoid=wt2html,html2html
19252 !! wikitext
19253 <tag width=200 height = "100" depth = '50' square></tag>
19254 !! html/php
19255 <pre>
19256 ''
19257 array (
19258 'width' => '200',
19259 'height' => '100',
19260 'depth' => '50',
19261 'square' => '',
19262 )
19263 </pre>
19264 !! html/parsoid
19265 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19266 !! end
19267
19268 !! test
19269 Parser hook: argument containing a forward slash (T7344)
19270 !! wikitext
19271 <tag filename="/tmp/bla"></tag>
19272 !! html/php
19273 <pre>
19274 ''
19275 array (
19276 'filename' => '/tmp/bla',
19277 )
19278 </pre>
19279 !! html/parsoid
19280 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19281 !! end
19282
19283 ## Don't expect parsoid to rt this form.
19284 !! test
19285 Parser hook: empty input using terminated empty elements (T4374)
19286 !! options
19287 parsoid=wt2html,html2html
19288 !! wikitext
19289 <tag foo=bar/>text
19290 !! html/php
19291 <pre>
19292 NULL
19293 array (
19294 'foo' => 'bar',
19295 )
19296 </pre>text
19297 !! html/parsoid
19298 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19299 !! end
19300
19301 ## </tag> should be output literally since there is no matching tag that begins it
19302 ## Don't expect parsoid to rt this form.
19303 !! test
19304 Parser hook: basic arguments using terminated empty elements (T4374)
19305 !! options
19306 parsoid=wt2html
19307 !! wikitext
19308 <tag width=200 height = "100" depth = '50' square/>
19309 other stuff
19310 </tag>
19311 !! html/php
19312 <pre>
19313 NULL
19314 array (
19315 'width' => '200',
19316 'height' => '100',
19317 'depth' => '50',
19318 'square' => '',
19319 )
19320 </pre>
19321 <p>other stuff
19322 &lt;/tag&gt;
19323 </p>
19324 !! html/parsoid
19325 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19326 &lt;/tag></p>
19327 !! end
19328
19329 ## Don't expect parsoid to rt this form.
19330 !! test
19331 Parser hook: Don't allow unclosed extension tags
19332 !! options
19333 parsoid=wt2html
19334 !! wikitext
19335 test <tag>123
19336
19337 this is a '''test'''
19338 !! html/php
19339 <p>test &lt;tag&gt;123
19340 </p><p>this is a <b>test</b>
19341 </p>
19342 !! html/parsoid
19343 <p>test &lt;tag>123</p>
19344
19345 <p>this is a <b>test</b></p>
19346 !! end
19347
19348 !! test
19349 Parser hook: horizontal rule inside extension tag that outputs <pre>
19350 !! wikitext
19351 <tag>
19352 Hello
19353 <hr/>
19354 Goodbye
19355 </tag>
19356 !! html/php
19357 <pre>
19358 '
19359 Hello
19360 <hr/>
19361 Goodbye
19362 '
19363 array (
19364 )
19365 </pre>
19366 !! end
19367
19368 ###
19369 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
19370 ###
19371
19372 !! test
19373 Parser hook: static parser hook not inside a comment
19374 !! wikitext
19375 <statictag>hello, world</statictag>
19376
19377 <statictag action="flush" />
19378 !! html/php
19379 <p><br />
19380 hello, world
19381 </p>
19382 !! html/parsoid
19383 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
19384 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
19385 !! end
19386
19387 !! test
19388 Parser hook: static parser hook inside a comment
19389 !! wikitext
19390 <!-- <statictag>hello, world</statictag> -->
19391 <statictag action="flush" />
19392 !! html/php
19393 <p><br />
19394 </p>
19395 !! html/parsoid
19396 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19397 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
19398 !! end
19399
19400 # Nested template calls; this case was broken by Parser.php rev 1.506,
19401 # since reverted.
19402
19403 !! article
19404 Template:One-parameter
19405 !! text
19406 (My parameter is: {{{1}}})
19407 !! endarticle
19408
19409 !! article
19410 Template:Map-one-parameter
19411 !! text
19412 {{{{{1}}}|{{{2}}}}}
19413 !! endarticle
19414
19415 !! test
19416 Nested template calls
19417 !! wikitext
19418 {{Map-one-parameter|One-parameter|param}}
19419 !! html
19420 <p>(My parameter is: param)
19421 </p>
19422 !! end
19423
19424
19425 ###
19426 ### Sanitizer
19427 ###
19428
19429 !! test
19430 Sanitizer: Closing of open tags
19431 !! wikitext
19432 <s></s><table></table>
19433 !! html/php+tidy
19434 <p><s></s></p><table></table>
19435 !! html/parsoid
19436 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19437 !! end
19438
19439 !! test
19440 Sanitizer: Closing of open but not closed tags
19441 !! wikitext
19442 <s>foo
19443 !! html
19444 <p><s>foo</s>
19445 </p>
19446 !! end
19447
19448 !! test
19449 Sanitizer: Closing of closed but not open tags
19450 !! options
19451 parsoid=wt2html
19452 !! wikitext
19453 </s>
19454 !! html+tidy
19455 <p class="mw-empty-elt">
19456 </p>
19457 !! end
19458
19459 !! test
19460 Sanitizer: Closing of closed but not open table tags
19461 !! options
19462 parsoid=wt2html
19463 !! wikitext
19464 Table not started</td></tr></table>
19465 !! html+tidy
19466 <p>Table not started</p>
19467 !! end
19468
19469 !! test
19470 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19471 !! options
19472 title=[[Main Page]]
19473 !! config
19474 wgFragmentMode=[ 'html5', 'legacy' ]
19475 !! wikitext
19476 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19477 !! html/php
19478 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19479 </p>
19480 !! html/parsoid
19481 <p><span id="æ:_v" data-parsoid='{"stx":"html","a":{"id":"æ:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#æ:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#æ:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
19482 !! end
19483
19484 !! test
19485 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19486 !! config
19487 wgFragmentMode=[ 'legacy' ]
19488 !! wikitext
19489 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19490 !! html/php
19491 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19492 </p>
19493 !! end
19494
19495 # In HTML5, the restrictions are that id must contain at least one character,
19496 # and must not contain any space characters.
19497 !! test
19498 Sanitizer: Validating the contents of the id attribute (T6515)
19499 !! options
19500 disabled
19501 !! wikitext
19502 <br id="" /><br id="a space" />
19503 !! html
19504 Something ...
19505 !! end
19506
19507 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19508 !! test
19509 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19510 !! options
19511 disabled
19512 !! wikitext
19513 <br id="foo" /><br id="foo" />
19514 !! html
19515 Something need to be done. foo-2 ?
19516 !! end
19517
19518 !! test
19519 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19520 !! wikitext
19521 <div itemscope>
19522 <meta itemprop="hello" content="world">
19523 <meta http-equiv="refresh" content="5">
19524 <meta itemprop="hello" http-equiv="refresh" content="5">
19525 <link itemprop="hello" href="{{SERVER}}">
19526 <link rel="stylesheet" href="{{SERVER}}">
19527 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19528 </div>
19529 !! html
19530 <div itemscope="">
19531 <p> <meta itemprop="hello" content="world" />
19532 &lt;meta http-equiv="refresh" content="5"&gt;
19533 <meta itemprop="hello" content="5" />
19534 <link itemprop="hello" href="http&#58;//example.org" />
19535 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19536 <link itemprop="hello" href="http&#58;//example.org" />
19537 </p>
19538 </div>
19539 !! end
19540
19541 !! test
19542 Sanitizer: Strip comments from CSS attributes
19543 !! options
19544 parsoid=wt2html,wt2wt
19545 !! wikitext
19546 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19547 !! html/php
19548 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19549 </p>
19550 !! html/parsoid
19551 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19552 !! end
19553
19554 !! test
19555 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19556 !! wikitext
19557 [[meatball:Soft"Security]]
19558 !! html/php
19559 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19560 </p>
19561 !! html/parsoid
19562 <p><a rel="mw:WikiLink/Interwiki" href='http://www.usemod.com/cgi-bin/mb.pl?Soft"Security' title='meatball:Soft"Security'>meatball:Soft"Security</a></p>
19563 !! end
19564
19565 !! test
19566 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19567 !! wikitext
19568 [[meatball:Foo<Bar]]
19569 [[meatball:Foo>Bar]]
19570 [[meatball:Foo&lt;bar]]
19571 [[meatball:Foo&gt;bar]]
19572 !! html/php
19573 <p>[[meatball:Foo&lt;Bar]]
19574 [[meatball:Foo&gt;Bar]]
19575 [[meatball:Foo&lt;bar]]
19576 [[meatball:Foo&gt;bar]]
19577 </p>
19578 !! html/parsoid
19579 <p>[[meatball:Foo&lt;Bar]]
19580 [[meatball:Foo>Bar]]
19581 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19582 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19583 !! end
19584
19585 !! test
19586 Language converter: output gets cut off unexpectedly (T7757)
19587 !! options
19588 language=zh
19589 !! wikitext
19590 this bit is safe: }-
19591
19592 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19593
19594 then we get cut off here: }-
19595
19596 all additional text is vanished
19597 !! html/php
19598 <p>this bit is safe: }-
19599 </p><p>but if we add a conversion instance: xxx
19600 </p><p>then we get cut off here: }-
19601 </p><p>all additional text is vanished
19602 </p>
19603 !! html/parsoid
19604 <p>this bit is safe: }-</p>
19605 <p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p>
19606 <p>then we get cut off here: }-</p>
19607 <p>all additional text is vanished</p>
19608 !! end
19609
19610 !! test
19611 Language converter glossary rules inside attributes (T119158)
19612 !! options
19613 language=sr variant=sr-el
19614 !! wikitext
19615 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19616
19617 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19618 !! html/php
19619 <p>
19620 </p><p><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="&quot; onload=&quot;alert(1)&quot; data-foo=&quot;" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
19621 </p>
19622 !! html/parsoid
19623 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19624
19625 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"\"}}&apos; data-parsoid=&apos;{\"fl\":[],\"dsr\":[76,80,null,2]}&apos;>&lt;/span>foAjrjvi&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"\"}}&apos; data-parsoid=&apos;{\"fl\":[],\"dsr\":[88,92,null,2]}&apos;>&lt;/span>","txt":"foAjrjvi"}]]}'><a href="./Датотека:Foobar.jpg"><img alt="foAjrjvi" resource="./Датотека: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" data-parsoid='{"a":{"resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
19626 !! end
19627
19628 !! test
19629 Self closed html pairs (T7487)
19630 !! wikitext
19631 <center><font id="bug" />Centered text</center>
19632 <div><font id="bug2" />In div text</div>
19633 !! html+tidy
19634 <center><font id="bug"></font>Centered text</center>
19635 <div><font id="bug2"></font>In div text</div>
19636 !! end
19637
19638 !! test
19639 Punctuation: nbsp before exclamation
19640 !! wikitext
19641 C'est grave !
19642 !! html
19643 <p>C'est grave&#160;!
19644 </p>
19645 !! end
19646
19647 !! test
19648 Punctuation: CSS !important (T13874)
19649 !! wikitext
19650 <div style="width:50% !important">important</div>
19651 !! html
19652 <div style="width:50% !important">important</div>
19653 !! end
19654
19655 !! test
19656 Punctuation: CSS ! important (T13874; with space after)
19657 !! wikitext
19658 <div style="width:50% ! important">important</div>
19659 !! html
19660 <div style="width:50%&#32;! important">important</div>
19661 !! end
19662
19663 !! test
19664 HTML bullet list, closed tags (T7497)
19665 !! wikitext
19666 <ul>
19667 <li>One</li>
19668 <li>Two</li>
19669 </ul>
19670 !! html/php
19671 <ul>
19672 <li>One</li>
19673 <li>Two</li>
19674 </ul>
19675 !! html/parsoid
19676 <ul data-parsoid='{"stx":"html"}'>
19677 <li data-parsoid='{"stx":"html"}'>One</li>
19678 <li data-parsoid='{"stx":"html"}'>Two</li>
19679 </ul>
19680 !! end
19681
19682 !! test
19683 HTML bullet list, unclosed tags (T7497)
19684 !! wikitext
19685 <ul>
19686 <li>One
19687 <li>Two
19688 </ul>
19689 !! html/php+tidy
19690 <ul>
19691 <li>One
19692 </li><li>Two
19693 </li></ul>
19694 !! html/parsoid
19695 <ul data-parsoid='{"stx":"html"}'>
19696 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19697 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19698 </ul>
19699 !! end
19700
19701 !! test
19702 HTML ordered list, closed tags (T7497)
19703 !! wikitext
19704 <ol>
19705 <li>One</li>
19706 <li>Two</li>
19707 </ol>
19708 !! html/php
19709 <ol>
19710 <li>One</li>
19711 <li>Two</li>
19712 </ol>
19713 !! html/parsoid
19714 <ol data-parsoid='{"stx":"html"}'>
19715 <li data-parsoid='{"stx":"html"}'>One</li>
19716 <li data-parsoid='{"stx":"html"}'>Two</li>
19717 </ol>
19718 !! end
19719
19720 !! test
19721 HTML ordered list, unclosed tags (T7497)
19722 !! options
19723 !! wikitext
19724 <ol>
19725 <li>One
19726 <li>Two
19727 </ol>
19728 !! html/php+tidy
19729 <ol>
19730 <li>One
19731 </li><li>Two
19732 </li></ol>
19733 !! html/parsoid
19734 <ol data-parsoid='{"stx":"html"}'>
19735 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19736 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19737 </ol>
19738 !! end
19739
19740 !! test
19741 HTML nested bullet list, closed tags (T7497)
19742 !! wikitext
19743 <ul>
19744 <li>One</li>
19745 <li>Two:
19746 <ul>
19747 <li>Sub-one</li>
19748 <li>Sub-two</li>
19749 </ul>
19750 </li>
19751 </ul>
19752 !! html/php
19753 <ul>
19754 <li>One</li>
19755 <li>Two:
19756 <ul>
19757 <li>Sub-one</li>
19758 <li>Sub-two</li>
19759 </ul>
19760 </li>
19761 </ul>
19762 !! html/parsoid
19763 <ul data-parsoid='{"stx":"html"}'>
19764 <li data-parsoid='{"stx":"html"}'>One</li>
19765 <li data-parsoid='{"stx":"html"}'>Two:
19766 <ul data-parsoid='{"stx":"html"}'>
19767 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19768 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19769 </ul>
19770 </li>
19771 </ul>
19772 !! end
19773
19774 !! test
19775 HTML nested bullet list, open tags (T7497)
19776 !! wikitext
19777 <ul>
19778 <li>One
19779 <li>Two:
19780 <ul>
19781 <li>Sub-one
19782 <li>Sub-two
19783 </ul>
19784 </ul>
19785 !! html+tidy
19786 <ul>
19787 <li>One
19788 </li><li>Two:
19789 <ul>
19790 <li>Sub-one
19791 </li><li>Sub-two
19792 </li></ul>
19793 </li></ul>
19794 !! end
19795
19796 !! test
19797 HTML nested ordered list, closed tags (T7497)
19798 !! wikitext
19799 <ol>
19800 <li>One</li>
19801 <li>Two:
19802 <ol>
19803 <li>Sub-one</li>
19804 <li>Sub-two</li>
19805 </ol>
19806 </li>
19807 </ol>
19808 !! html
19809 <ol>
19810 <li>One</li>
19811 <li>Two:
19812 <ol>
19813 <li>Sub-one</li>
19814 <li>Sub-two</li>
19815 </ol>
19816 </li>
19817 </ol>
19818 !! end
19819
19820 !! test
19821 HTML nested ordered list, open tags (T7497)
19822 !! wikitext
19823 <ol>
19824 <li>One
19825 <li>Two:
19826 <ol>
19827 <li>Sub-one
19828 <li>Sub-two
19829 </ol>
19830 </ol>
19831 !! html/php
19832 <ol>
19833 <li>One
19834 <li>Two:
19835 <ol>
19836 <li>Sub-one
19837 <li>Sub-two
19838 </ol>
19839 </ol>
19840 !! html/parsoid
19841 <ol>
19842 <li>One
19843 </li>
19844 <li>Two:
19845 <ol>
19846 <li>Sub-one
19847 </li>
19848 <li>Sub-two
19849 </li>
19850 </ol>
19851 </li>
19852 </ol>
19853 !! end
19854
19855 !! test
19856 HTML ordered list item with parameters oddity
19857 !! wikitext
19858 <ol><li id="fragment">One</li>
19859 </ol>
19860 !! html
19861 <ol><li id="fragment">One</li>
19862 </ol>
19863 !! end
19864
19865 # parsoid doesn't explicitly mark autonumbered links, see T55505
19866 !!test
19867 T7918: autonumbering
19868 !! wikitext
19869 [http://first/] [http://second] [ftp://ftp]
19870
19871 ftp://inlineftp
19872
19873 [mailto:enclosed@mail.tld With target]
19874
19875 [mailto:enclosed@mail.tld]
19876
19877 mailto:inline@mail.tld
19878 !! html/php
19879 <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>
19880 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19881 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19882 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19883 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19884 </p>
19885 !! html/parsoid
19886 <p><a rel="mw:ExtLink" href="http://first/" class="external autonumber"></a> <a rel="mw:ExtLink" href="http://second" class="external autonumber"></a> <a rel="mw:ExtLink" href="ftp://ftp" class="external autonumber"></a></p>
19887 <p><a rel="mw:ExtLink" href="ftp://inlineftp" class="external free">ftp://inlineftp</a></p>
19888 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld" class="external text">With target</a></p>
19889 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld" class="external autonumber"></a></p>
19890 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld" class="external free">mailto:inline@mail.tld</a></p>
19891 !! end
19892
19893
19894 #
19895 # Security and HTML correctness
19896 # From Nick Jenkins' fuzz testing
19897 #
19898
19899 !! test
19900 Fuzz testing: Parser13
19901 !! wikitext
19902 {|
19903 | http://a|
19904 !! html
19905 <table>
19906 <tr>
19907 <td>
19908 </td>
19909 </tr>
19910 </table>
19911 !! end
19912
19913 # Note that Parsoid output differs from the PHP parser here: the PHP
19914 # parser breaks the URL for the magic word, while in Parsoid the URL
19915 # production takes precedence.
19916 !! test
19917 Fuzz testing: Parser14
19918 !! wikitext
19919 ==onmouseover===
19920 http://__TOC__
19921 !! html/php
19922 <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>
19923 http://<div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
19924 <ul>
19925 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19926 </ul>
19927 </div>
19928
19929 !! html/php+tidy
19930 <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><p>
19931 http://</p><div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
19932 <ul>
19933 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19934 </ul>
19935 </div>
19936 !! html/parsoid
19937 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19938 <p><a rel="mw:ExtLink" href="http://__TOC__" class="external free" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19939 !! end
19940
19941 !! test
19942 Fuzz testing: Parser14-table
19943 !! options
19944 parsoid=wt2html,html2html
19945 !! wikitext
19946 ==a==
19947 {| STYLE=__TOC__
19948 !! html/php
19949 <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>
19950 <table style="&#95;_TOC&#95;_">
19951 <tr><td></td></tr>
19952 </table>
19953 !! html/php+tidy
19954 <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>
19955 <table style="&#95;_TOC&#95;_">
19956 <tbody><tr><td></td></tr>
19957 </tbody></table>
19958 !! html/parsoid
19959 <h2 id="a">a</h2>
19960 <table style="__TOC__"></table>
19961 !! end
19962
19963 # Known to produce bogus xml (extra </td>)
19964 # Don't add the html/php section since it generates broken HTML
19965 !! test
19966 Fuzz testing: Parser16
19967 !! wikitext
19968 {|
19969 !https://||||||
19970 !! html+tidy
19971 <table>
19972 <tbody><tr>
19973 <th>https://</th>
19974 <th></th>
19975 <th></th>
19976 <th>
19977
19978 </th></tr>
19979 </tbody></table>
19980 !! end
19981
19982 !! test
19983 Fuzz testing: Parser21
19984 !! wikitext
19985 {|
19986 !irc://{{ftp://a" onmouseover="alert('hello world');"
19987 |
19988 !! html
19989 <table>
19990 <tr>
19991 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19992 </th>
19993 <td>
19994 </td>
19995 </tr>
19996 </table>
19997 !! end
19998
19999 !! test
20000 Fuzz testing: Parser22
20001 !! wikitext
20002 http://===r:::https://b
20003
20004 {|
20005 !! html/php
20006 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
20007 </p>
20008 <table>
20009 <tr><td></td></tr>
20010 </table>
20011 !! html/parsoid
20012 <p><a rel="mw:ExtLink" href="http://===r:::https://b" class="external free" data-parsoid='{"stx":"url"}'>http://===r:::https://b</a></p>
20013
20014 <table data-parsoid='{"autoInsertedEnd":true}'></table>
20015 !! end
20016
20017 # The above 'Parser24' fuzz test exposed a tokenizer bug (T221384);
20018 # this is a minimized version of the above test to catch regressions.
20019 !! test
20020 Fuzz testing: Parser24 (minimized)
20021 !! options
20022 parsoid=wt2html
20023 !! wikitext
20024 {{<u {{{{[[Sx-->}}
20025 !! html/php+tidy
20026 <p>{{<u>}}
20027 </u></p>
20028 !! html/parsoid
20029 <p>{{<u data-parsoid='{"stx":"html","a":{"{{{{[[Sx--":null},"sa":{"{{{{[[Sx--":""},"autoInsertedEnd":true}'>}}</u></p>
20030 !! end
20031
20032 ## Remex doesn't account for fostered content.
20033 ## Known to produce bad XML for now
20034 !! test
20035 Fuzz testing: Parser24
20036 !! options
20037 parsoid=wt2html
20038 !! wikitext
20039 {|
20040 {{{|
20041 <u CLASS=
20042 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
20043 <br style="onmouseover='alert(document.cookie);' " />
20044
20045 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
20046 |
20047 !! html/php
20048 <table>
20049 {{{|
20050 <u class="&#124;">}}}} &gt;
20051 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
20052
20053 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
20054 <tr>
20055 <td></u>
20056 </td>
20057 </tr>
20058 </table>
20059 !! html/php+tidy
20060
20061 {{{|
20062 <u class="&#124;">}}}} &gt;
20063 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
20064
20065 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
20066 </u><table><tbody><tr>
20067 <td>
20068 </td>
20069 </tr>
20070 </tbody></table>
20071 !! html/parsoid
20072 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
20073 {{{|
20074 <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
20075 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
20076
20077 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
20078 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
20079 !! end
20080
20081 # Note: the current result listed for this is not what the original one was,
20082 # but the original bug was JavaScript injection, which is fixed in any case.
20083 # It's not clear that the original result listed was any more correct than the
20084 # current one. Original result:
20085 # <p>{{{|
20086 # </p>
20087 # <li class="&#124;&#124;">
20088 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
20089 !!test
20090 Fuzz testing: Parser25 (T8055)
20091 !! wikitext
20092 {{{
20093 |
20094 <LI CLASS=||
20095 >
20096 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
20097 !! html/php
20098 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
20099 </p>
20100 !! html/parsoid
20101 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
20102 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
20103 !! end
20104
20105 !!test
20106 Fuzz testing: URL adjacent extension (with space, clean)
20107 !! wikitext
20108 http://example.com <nowiki>junk</nowiki>
20109 !! html/php
20110 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
20111 </p>
20112 !! html/parsoid
20113 <p><a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
20114 !! end
20115
20116 !!test
20117 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
20118 !! wikitext
20119 http://example.com<nowiki>junk</nowiki>
20120 !! html/php
20121 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
20122 </p>
20123 !! html/parsoid
20124 <p><a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
20125 !! end
20126
20127 !! test
20128 Fuzz testing: URL adjacent extension (no space, dirty; pre)
20129 !! wikitext
20130 http://example.com<pre>junk</pre>
20131 !! html/php
20132 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
20133 !! html/php+tidy
20134 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
20135 !! html/parsoid
20136 <p><a rel="mw:ExtLink" href="http://example.com" class="external free" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
20137 !! end
20138
20139 !! test
20140 Fuzz testing: image with bogus manual thumbnail
20141 !! wikitext
20142 [[Image:foobar.jpg|thumbnail= ]]
20143 !! html/php
20144 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
20145 !! html/parsoid
20146 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"attribs":[["manualthumb",{"txt":""}]],"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}]}'><a href="./Special:FilePath/Foobar.jpg"><span resource="./File:Foobar.jpg" data-parsoid='{"a":{"resource":"./File:Foobar.jpg"},"sa":{"resource":"Image:foobar.jpg"}}'>File:Foobar.jpg</span></a><figcaption></figcaption></figure>
20147 !! end
20148
20149 # Parsoid will emit the newline literally in wt2wt; see next test case.
20150 !! test
20151 Fuzz testing: encoded newline in generated HTML replacements (T8577)
20152 !! options
20153 parsoid=wt2html
20154 !! wikitext
20155 <pre dir="&#10;"></pre>
20156 !! html/php
20157 <pre dir="&#10;"></pre>
20158 !! html/parsoid
20159 <pre dir="
20160 " typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":""},"body":{"extsrc":""}}'></pre>
20161 !! end
20162
20163 !! test
20164 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
20165 !! options
20166 parsoid=html2wt
20167 !! html/parsoid
20168 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20169 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20170 !! wikitext
20171 <pre dir="
20172 "></pre>
20173 !! html/php
20174 <pre dir=""></pre>
20175 !! end
20176
20177 !! test
20178 Templates in extension attributes are not expanded
20179 !! wikitext
20180 <pre dir="{{echo|ltr}}"></pre>
20181 !! html/php
20182 <pre dir="{{echo|ltr}}"></pre>
20183 !! html/parsoid
20184 <pre dir="{{echo|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
20185 !! end
20186
20187 !! test
20188 Parsing optional HTML elements (T8171)
20189 !! options
20190 !! wikitext
20191 <table>
20192 <tr>
20193 <td> Some tabular data</td>
20194 <td> More tabular data ...
20195 <td> And yet som tabular data</td>
20196 </tr>
20197 </table>
20198 !! html
20199 <table>
20200 <tr>
20201 <td> Some tabular data</td>
20202 <td> More tabular data ...
20203 </td><td> And yet som tabular data</td>
20204 </tr>
20205 </table>
20206 !! end
20207
20208 !! test
20209 Correct handling of <td>, <tr> (T8171)
20210 !! options
20211 !! wikitext
20212 <table>
20213 <tr>
20214 <td> Some tabular data</td>
20215 <td> More tabular data ...</td>
20216 <td> And yet som tabular data</td>
20217 </tr>
20218 </table>
20219 !! html
20220 <table>
20221 <tr>
20222 <td> Some tabular data</td>
20223 <td> More tabular data ...</td>
20224 <td> And yet som tabular data</td>
20225 </tr>
20226 </table>
20227 !! end
20228
20229
20230 !! test
20231 Parsing crashing regression (fr:JavaScript)
20232 !! wikitext
20233 </body></x>
20234 !! html
20235 <p>&lt;/body&gt;&lt;/x&gt;
20236 </p>
20237 !! end
20238
20239 !! test
20240 Inline wiki vs wiki block nesting
20241 !! wikitext
20242 '''Bold paragraph
20243
20244 New wiki paragraph
20245 !! html
20246 <p><b>Bold paragraph</b>
20247 </p><p>New wiki paragraph
20248 </p>
20249 !! end
20250
20251 # FIXME: The current php output is documented
20252 # and desired output is the parsoid target.
20253 !! test
20254 Inline HTML vs wiki block nesting
20255 !! wikitext
20256 <b>Bold paragraph
20257
20258 New wiki paragraph
20259 !! html/php
20260 <p><b>Bold paragraph
20261 </p><p>New wiki paragraph</b>
20262 </p>
20263 !! html/php+tidy
20264 <p><b>Bold paragraph
20265 </b></p><p><b>New wiki paragraph
20266 </b></p>
20267 !! html/parsoid
20268 <p><b>Bold paragraph</b>
20269 </p><p>New wiki paragraph
20270 </p>
20271 !! end
20272
20273 # Original result was this:
20274 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20275 # </p>
20276 # While that might be marginally more intuitive, maybe, the six-apostrophe
20277 # construct is clearly pathological and the result stated here (which is what
20278 # the parser actually does) is about as reasonable as anything.
20279 !!test
20280 Mixing markup for italics and bold
20281 !! options
20282 !! wikitext
20283 '''bold''''''bold''bolditalics'''''
20284 !! html
20285 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20286 </p>
20287 !! end
20288
20289
20290 !! article
20291 Xyzzyx
20292 !! text
20293 Article for special page transclusion test
20294 !! endarticle
20295
20296 !! test
20297 Special page transclusion
20298 !! options
20299 !! wikitext
20300 {{Special:Prefixindex/Xyzzyx}}
20301 !! html
20302 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20303 </ul>
20304 !! end
20305
20306 !! test
20307 Special page transclusion twice (T7021)
20308 !! options
20309 !! wikitext
20310 {{Special:Prefixindex/Xyzzyx}}
20311 {{Special:Prefixindex/Xyzzyx}}
20312 !! html
20313 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20314 </ul>
20315 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20316 </ul>
20317 !! end
20318
20319 !! test
20320 Transclusion of default MediaWiki message
20321 !! wikitext
20322 {{MediaWiki:Mainpage}}
20323 !! html
20324 <p>Main Page
20325 </p>
20326 !! end
20327
20328 !! test
20329 Transclusion of nonexistent MediaWiki message
20330 !! wikitext
20331 {{MediaWiki:Mainpagexxx}}
20332 !! html
20333 <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>
20334 </p>
20335 !! end
20336
20337 !! test
20338 Transclusion of MediaWiki message with underscore
20339 !! wikitext
20340 {{MediaWiki:history_short}}
20341 !! html
20342 <p>History
20343 </p>
20344 !! end
20345
20346 !! test
20347 Transclusion of MediaWiki message with space
20348 !! wikitext
20349 {{MediaWiki:history short}}
20350 !! html
20351 <p>History
20352 </p>
20353 !! end
20354
20355 !! test
20356 Invalid header with following text
20357 !! wikitext
20358 = x = y
20359 !! html
20360 <p>= x = y
20361 </p>
20362 !! end
20363
20364
20365 !! test
20366 Section extraction test (section 0)
20367 !! options
20368 section=0
20369 !! wikitext
20370 start
20371 ==a==
20372 ===aa===
20373 ====aaa====
20374 ==b==
20375 ===ba===
20376 ===bb===
20377 ====bba====
20378 ===bc===
20379 ==c==
20380 ===ca===
20381 !! html/php
20382 start
20383 !! end
20384
20385 !! test
20386 Section extraction test (section 1)
20387 !! options
20388 section=1
20389 !! wikitext
20390 start
20391 ==a==
20392 ===aa===
20393 ====aaa====
20394 ==b==
20395 ===ba===
20396 ===bb===
20397 ====bba====
20398 ===bc===
20399 ==c==
20400 ===ca===
20401 !! html/php
20402 ==a==
20403 ===aa===
20404 ====aaa====
20405 !! end
20406
20407 !! test
20408 Section extraction test (section 2)
20409 !! options
20410 section=2
20411 !! wikitext
20412 start
20413 ==a==
20414 ===aa===
20415 ====aaa====
20416 ==b==
20417 ===ba===
20418 ===bb===
20419 ====bba====
20420 ===bc===
20421 ==c==
20422 ===ca===
20423 !! html/php
20424 ===aa===
20425 ====aaa====
20426 !! end
20427
20428 !! test
20429 Section extraction test (section 3)
20430 !! options
20431 section=3
20432 !! wikitext
20433 start
20434 ==a==
20435 ===aa===
20436 ====aaa====
20437 ==b==
20438 ===ba===
20439 ===bb===
20440 ====bba====
20441 ===bc===
20442 ==c==
20443 ===ca===
20444 !! html/php
20445 ====aaa====
20446 !! end
20447
20448 !! test
20449 Section extraction test (section 4)
20450 !! options
20451 section=4
20452 !! wikitext
20453 start
20454 ==a==
20455 ===aa===
20456 ====aaa====
20457 ==b==
20458 ===ba===
20459 ===bb===
20460 ====bba====
20461 ===bc===
20462 ==c==
20463 ===ca===
20464 !! html/php
20465 ==b==
20466 ===ba===
20467 ===bb===
20468 ====bba====
20469 ===bc===
20470 !! end
20471
20472 !! test
20473 Section extraction test (section 5)
20474 !! options
20475 section=5
20476 !! wikitext
20477 start
20478 ==a==
20479 ===aa===
20480 ====aaa====
20481 ==b==
20482 ===ba===
20483 ===bb===
20484 ====bba====
20485 ===bc===
20486 ==c==
20487 ===ca===
20488 !! html/php
20489 ===ba===
20490 !! end
20491
20492 !! test
20493 Section extraction test (section 6)
20494 !! options
20495 section=6
20496 !! wikitext
20497 start
20498 ==a==
20499 ===aa===
20500 ====aaa====
20501 ==b==
20502 ===ba===
20503 ===bb===
20504 ====bba====
20505 ===bc===
20506 ==c==
20507 ===ca===
20508 !! html/php
20509 ===bb===
20510 ====bba====
20511 !! end
20512
20513 !! test
20514 Section extraction test (section 7)
20515 !! options
20516 section=7
20517 !! wikitext
20518 start
20519 ==a==
20520 ===aa===
20521 ====aaa====
20522 ==b==
20523 ===ba===
20524 ===bb===
20525 ====bba====
20526 ===bc===
20527 ==c==
20528 ===ca===
20529 !! html/php
20530 ====bba====
20531 !! end
20532
20533 !! test
20534 Section extraction test (section 8)
20535 !! options
20536 section=8
20537 !! wikitext
20538 start
20539 ==a==
20540 ===aa===
20541 ====aaa====
20542 ==b==
20543 ===ba===
20544 ===bb===
20545 ====bba====
20546 ===bc===
20547 ==c==
20548 ===ca===
20549 !! html/php
20550 ===bc===
20551 !! end
20552
20553 !! test
20554 Section extraction test (section 9)
20555 !! options
20556 section=9
20557 !! wikitext
20558 start
20559 ==a==
20560 ===aa===
20561 ====aaa====
20562 ==b==
20563 ===ba===
20564 ===bb===
20565 ====bba====
20566 ===bc===
20567 ==c==
20568 ===ca===
20569 !! html/php
20570 ==c==
20571 ===ca===
20572 !! end
20573
20574 !! test
20575 Section extraction test (section 10)
20576 !! options
20577 section=10
20578 !! wikitext
20579 start
20580 ==a==
20581 ===aa===
20582 ====aaa====
20583 ==b==
20584 ===ba===
20585 ===bb===
20586 ====bba====
20587 ===bc===
20588 ==c==
20589 ===ca===
20590 !! html/php
20591 ===ca===
20592 !! end
20593
20594 !! test
20595 Section extraction test (nonexistent section 11)
20596 !! options
20597 section=11
20598 !! wikitext
20599 start
20600 ==a==
20601 ===aa===
20602 ====aaa====
20603 ==b==
20604 ===ba===
20605 ===bb===
20606 ====bba====
20607 ===bc===
20608 ==c==
20609 ===ca===
20610 !! html/php
20611 !! end
20612
20613 !! test
20614 Section extraction test with bogus heading (section 1)
20615 !! options
20616 section=1
20617 !! wikitext
20618 ==a==
20619 ==bogus== not a legal section
20620 ==b==
20621 !! html/php
20622 ==a==
20623 ==bogus== not a legal section
20624 !! end
20625
20626 !! test
20627 Section extraction test with bogus heading (section 2)
20628 !! options
20629 section=2
20630 !! wikitext
20631 ==a==
20632 ==bogus== not a legal section
20633 ==b==
20634 !! html/php
20635 ==b==
20636 !! end
20637
20638 !! test
20639 Section extraction test with comment after heading (section 1)
20640 !! options
20641 section=1
20642 !! wikitext
20643 ==a==
20644 ==b== <!-- -->
20645 ==c==
20646 !! html/php
20647 ==a==
20648 !! end
20649
20650 !! test
20651 Section extraction test with comment after heading (section 2)
20652 !! options
20653 section=2
20654 !! wikitext
20655 ==a==
20656 ==b== <!-- -->
20657 ==c==
20658 !! html/php
20659 ==b== <!-- -->
20660 !! end
20661
20662 !! test
20663 Section extraction test with bogus <nowiki> heading (section 1)
20664 !! options
20665 section=1
20666 !! wikitext
20667 ==a==
20668 ==bogus== <nowiki>not a legal section</nowiki>
20669 ==b==
20670 !! html/php
20671 ==a==
20672 ==bogus== <nowiki>not a legal section</nowiki>
20673 !! end
20674
20675 !! test
20676 Section extraction test with bogus <nowiki> heading (section 2)
20677 !! options
20678 section=2
20679 !! wikitext
20680 ==a==
20681 ==bogus== <nowiki>not a legal section</nowiki>
20682 ==b==
20683 !! html/php
20684 ==b==
20685 !! end
20686
20687 # Formerly testing for T4587, now resolved by the use of unmarked sections
20688 # instead of respecting commented sections
20689 !! test
20690 Section extraction prefixed by comment (section 1)
20691 !! options
20692 section=1
20693 !! wikitext
20694 <!-- -->==sec1==
20695 ==sec2==
20696 !! html/php
20697 ==sec2==
20698 !!end
20699
20700 !! test
20701 Section extraction prefixed by comment (section 2)
20702 !! options
20703 section=2
20704 !! wikitext
20705 <!-- -->==sec1==
20706 ==sec2==
20707 !! html/php
20708 !! end
20709
20710 # Formerly testing for T4607, now resolved by the use of unmarked sections
20711 # instead of respecting HTML-style headings
20712 !! test
20713 Section extraction, mixed wiki and html (section 1)
20714 !! options
20715 section=1
20716 !! wikitext
20717 <h2>unmarked</h2>
20718 unmarked
20719 ==1==
20720 one
20721 ==2==
20722 two
20723 !! html/php
20724 ==1==
20725 one
20726 !! end
20727
20728 !! test
20729 Section extraction, mixed wiki and html (section 2)
20730 !! options
20731 section=2
20732 !! wikitext
20733 <h2>unmarked</h2>
20734 unmarked
20735 ==1==
20736 one
20737 ==2==
20738 two
20739 !! html/php
20740 ==2==
20741 two
20742 !! end
20743
20744
20745 # Formerly testing for T5342
20746 !! test
20747 Section extraction, heading surrounded by <noinclude>
20748 !! options
20749 section=1
20750 !! wikitext
20751 <noinclude>==unmarked==</noinclude>
20752 ==marked==
20753 !! html/php
20754 ==marked==
20755 !!end
20756
20757 # Test behavior of T21910
20758 !! test
20759 Sectiion with all-equals
20760 !! options
20761 section=2
20762 !! wikitext
20763 ===
20764 The line above must have a trailing space
20765 === <!--
20766 --> <!-- -->
20767 But just in case it doesn't...
20768 !! html/php
20769 === <!--
20770 --> <!-- -->
20771 But just in case it doesn't...
20772 !! end
20773
20774 !! test
20775 Section replacement test (section 0)
20776 !! options
20777 replace=0,"xxx"
20778 !! wikitext
20779 start
20780 ==a==
20781 ===aa===
20782 ====aaa====
20783 ==b==
20784 ===ba===
20785 ===bb===
20786 ====bba====
20787 ===bc===
20788 ==c==
20789 ===ca===
20790 !! html/php
20791 xxx
20792
20793 ==a==
20794 ===aa===
20795 ====aaa====
20796 ==b==
20797 ===ba===
20798 ===bb===
20799 ====bba====
20800 ===bc===
20801 ==c==
20802 ===ca===
20803 !! end
20804
20805 !! test
20806 Section replacement test (section 1)
20807 !! options
20808 replace=1,"xxx"
20809 !! wikitext
20810 start
20811 ==a==
20812 ===aa===
20813 ====aaa====
20814 ==b==
20815 ===ba===
20816 ===bb===
20817 ====bba====
20818 ===bc===
20819 ==c==
20820 ===ca===
20821 !! html/php
20822 start
20823 xxx
20824
20825 ==b==
20826 ===ba===
20827 ===bb===
20828 ====bba====
20829 ===bc===
20830 ==c==
20831 ===ca===
20832 !! end
20833
20834 !! test
20835 Section replacement test (section 2)
20836 !! options
20837 replace=2,"xxx"
20838 !! wikitext
20839 start
20840 ==a==
20841 ===aa===
20842 ====aaa====
20843 ==b==
20844 ===ba===
20845 ===bb===
20846 ====bba====
20847 ===bc===
20848 ==c==
20849 ===ca===
20850 !! html/php
20851 start
20852 ==a==
20853 xxx
20854
20855 ==b==
20856 ===ba===
20857 ===bb===
20858 ====bba====
20859 ===bc===
20860 ==c==
20861 ===ca===
20862 !! end
20863
20864 !! test
20865 Section replacement test (section 3)
20866 !! options
20867 replace=3,"xxx"
20868 !! wikitext
20869 start
20870 ==a==
20871 ===aa===
20872 ====aaa====
20873 ==b==
20874 ===ba===
20875 ===bb===
20876 ====bba====
20877 ===bc===
20878 ==c==
20879 ===ca===
20880 !! html/php
20881 start
20882 ==a==
20883 ===aa===
20884 xxx
20885
20886 ==b==
20887 ===ba===
20888 ===bb===
20889 ====bba====
20890 ===bc===
20891 ==c==
20892 ===ca===
20893 !! end
20894
20895 !! test
20896 Section replacement test (section 4)
20897 !! options
20898 replace=4,"xxx"
20899 !! wikitext
20900 start
20901 ==a==
20902 ===aa===
20903 ====aaa====
20904 ==b==
20905 ===ba===
20906 ===bb===
20907 ====bba====
20908 ===bc===
20909 ==c==
20910 ===ca===
20911 !! html/php
20912 start
20913 ==a==
20914 ===aa===
20915 ====aaa====
20916 xxx
20917
20918 ==c==
20919 ===ca===
20920 !! end
20921
20922 !! test
20923 Section replacement test (section 5)
20924 !! options
20925 replace=5,"xxx"
20926 !! wikitext
20927 start
20928 ==a==
20929 ===aa===
20930 ====aaa====
20931 ==b==
20932 ===ba===
20933 ===bb===
20934 ====bba====
20935 ===bc===
20936 ==c==
20937 ===ca===
20938 !! html/php
20939 start
20940 ==a==
20941 ===aa===
20942 ====aaa====
20943 ==b==
20944 xxx
20945
20946 ===bb===
20947 ====bba====
20948 ===bc===
20949 ==c==
20950 ===ca===
20951 !! end
20952
20953 !! test
20954 Section replacement test (section 6)
20955 !! options
20956 replace=6,"xxx"
20957 !! wikitext
20958 start
20959 ==a==
20960 ===aa===
20961 ====aaa====
20962 ==b==
20963 ===ba===
20964 ===bb===
20965 ====bba====
20966 ===bc===
20967 ==c==
20968 ===ca===
20969 !! html/php
20970 start
20971 ==a==
20972 ===aa===
20973 ====aaa====
20974 ==b==
20975 ===ba===
20976 xxx
20977
20978 ===bc===
20979 ==c==
20980 ===ca===
20981 !! end
20982
20983 !! test
20984 Section replacement test (section 7)
20985 !! options
20986 replace=7,"xxx"
20987 !! wikitext
20988 start
20989 ==a==
20990 ===aa===
20991 ====aaa====
20992 ==b==
20993 ===ba===
20994 ===bb===
20995 ====bba====
20996 ===bc===
20997 ==c==
20998 ===ca===
20999 !! html/php
21000 start
21001 ==a==
21002 ===aa===
21003 ====aaa====
21004 ==b==
21005 ===ba===
21006 ===bb===
21007 xxx
21008
21009 ===bc===
21010 ==c==
21011 ===ca===
21012 !! end
21013
21014 !! test
21015 Section replacement test (section 8)
21016 !! options
21017 replace=8,"xxx"
21018 !! wikitext
21019 start
21020 ==a==
21021 ===aa===
21022 ====aaa====
21023 ==b==
21024 ===ba===
21025 ===bb===
21026 ====bba====
21027 ===bc===
21028 ==c==
21029 ===ca===
21030 !! html/php
21031 start
21032 ==a==
21033 ===aa===
21034 ====aaa====
21035 ==b==
21036 ===ba===
21037 ===bb===
21038 ====bba====
21039 xxx
21040
21041 ==c==
21042 ===ca===
21043 !!end
21044
21045 !! test
21046 Section replacement test (section 9)
21047 !! options
21048 replace=9,"xxx"
21049 !! wikitext
21050 start
21051 ==a==
21052 ===aa===
21053 ====aaa====
21054 ==b==
21055 ===ba===
21056 ===bb===
21057 ====bba====
21058 ===bc===
21059 ==c==
21060 ===ca===
21061 !! html/php
21062 start
21063 ==a==
21064 ===aa===
21065 ====aaa====
21066 ==b==
21067 ===ba===
21068 ===bb===
21069 ====bba====
21070 ===bc===
21071 xxx
21072 !! end
21073
21074 !! test
21075 Section replacement test (section 10)
21076 !! options
21077 replace=10,"xxx"
21078 !! wikitext
21079 start
21080 ==a==
21081 ===aa===
21082 ====aaa====
21083 ==b==
21084 ===ba===
21085 ===bb===
21086 ====bba====
21087 ===bc===
21088 ==c==
21089 ===ca===
21090 !! html/php
21091 start
21092 ==a==
21093 ===aa===
21094 ====aaa====
21095 ==b==
21096 ===ba===
21097 ===bb===
21098 ====bba====
21099 ===bc===
21100 ==c==
21101 xxx
21102 !! end
21103
21104 !! test
21105 Section replacement test with initial whitespace (T15728)
21106 !! options
21107 replace=2,"xxx"
21108 !! wikitext
21109 Preformatted initial line
21110 ==a==
21111 ===a===
21112 !! html/php
21113 Preformatted initial line
21114 ==a==
21115 xxx
21116 !! end
21117
21118
21119 !! test
21120 Section extraction, heading followed by pre with 20 spaces (T8398)
21121 !! options
21122 section=1
21123 !! wikitext
21124 ==a==
21125 a
21126 !! html/php
21127 ==a==
21128 a
21129 !! end
21130
21131 !! test
21132 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
21133 !! options
21134 section=1
21135 !! wikitext
21136 ==a==
21137 a
21138 !! html/php
21139 ==a==
21140 a
21141 !! end
21142
21143
21144 !! test
21145 Section extraction, <pre> around bogus header (T12309)
21146 !! options
21147 section=2
21148 !! wikitext
21149 == Section One ==
21150 <pre>
21151 =======
21152 </pre>
21153
21154 == Section Two ==
21155 stuff
21156 !! html/php
21157 == Section Two ==
21158 stuff
21159 !! end
21160
21161 !! test
21162 Section replacement, <pre> around bogus header (T12309)
21163 !! options
21164 replace=2,"xxx"
21165 !! wikitext
21166 == Section One ==
21167 <pre>
21168 =======
21169 </pre>
21170
21171 == Section Two ==
21172 stuff
21173 !! html/php
21174 == Section One ==
21175 <pre>
21176 =======
21177 </pre>
21178
21179 xxx
21180 !! end
21181
21182 !! test
21183 Handling of &#x0A; in URLs
21184 !! wikitext
21185 *irc://&#x0A;a
21186 !! html/php
21187 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21188 !! html/parsoid
21189 <ul><li><a rel="mw:ExtLink" href="irc://%0Aa" class="external free" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul>
21190 !! end
21191
21192 !! test
21193 Handling of %0A in URLs
21194 !! wikitext
21195 *irc://%0Aa
21196 !! html/php
21197 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21198 !! html/parsoid
21199 <ul><li><a rel="mw:ExtLink" href="irc://%0Aa" class="external free">irc://%0Aa</a></li></ul>
21200 !! end
21201
21202 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
21203 !! test
21204 5 quotes, code coverage +1 line
21205 !! options
21206 parsoid=wt2html
21207 !! wikitext
21208 '''''
21209 !! html/php
21210 !! html/parsoid
21211 <p><b><i></i></b></p>
21212 !! end
21213
21214 # same html as previous, but wikitext adjusted to match parsoid html2wt
21215 # note that wt2html and html2html will put the <i> before the <b>
21216 !! test
21217 5 quotes, code coverage +1 line w/ nowiki (1)
21218 !! options
21219 parsoid=wt2wt,html2wt
21220 !! wikitext
21221 '''''<nowiki/>'''''
21222 !! html/php
21223 <p><i></i>
21224 </p>
21225 !! html/parsoid
21226 <p><b><i></i></b></p>
21227 !! end
21228
21229 # same as previous, just swapping the <i> and <b>
21230 !! test
21231 5 quotes, code coverage +1 line w/ nowiki (2)
21232 !! wikitext
21233 '''''<nowiki/>'''''
21234 !! html/php
21235 <p><i></i>
21236 </p>
21237 !! html/parsoid
21238 <p><i><b></b></i></p>
21239 !! end
21240
21241 !! test
21242 Special:Search page linking.
21243 !! wikitext
21244 {{Special:search}}
21245 !! html
21246 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21247 </p>
21248 !! end
21249
21250 !! test
21251 {{!}} is a magic word
21252 !! wikitext
21253 {{!}} is a magic word there and {{!}} is still a magic word here
21254 | is not a magic word here but {{!}} is still a magic word here
21255 !! html/php
21256 <p>| is a magic word there and | is still a magic word here
21257 | is not a magic word here but | is still a magic word here
21258 </p>
21259 !! html/parsoid
21260 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
21261 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
21262 !! end
21263
21264 !! test
21265 Say the magic word
21266 !! options
21267 title=[[Parser test]]
21268 !! wikitext
21269 *{{PAGENAME}}
21270 *{{PAGENAMEE}}
21271 *{{FULLPAGENAME}}
21272 *{{FULLPAGENAMEE}}
21273 *{{BASEPAGENAME}}
21274 *{{BASEPAGENAMEE}}
21275 *{{SUBPAGENAME}}
21276 *{{SUBPAGENAMEE}}
21277 *{{ROOTPAGENAME}}
21278 *{{ROOTPAGENAMEE}}
21279 *{{TALKPAGENAME}}
21280 *{{TALKPAGENAMEE}}
21281 *{{SUBJECTPAGENAME}}
21282 *{{SUBJECTPAGENAMEE}}
21283 *{{NAMESPACEE}}
21284 *{{NAMESPACE}}
21285 *{{NAMESPACENUMBER}}
21286 *{{TALKSPACE}}
21287 *{{TALKSPACEE}}
21288 *{{SUBJECTSPACE}}
21289 *{{SUBJECTSPACEE}}
21290 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21291 !! html
21292 <ul><li>Parser test</li>
21293 <li>Parser_test</li>
21294 <li>Parser test</li>
21295 <li>Parser_test</li>
21296 <li>Parser test</li>
21297 <li>Parser_test</li>
21298 <li>Parser test</li>
21299 <li>Parser_test</li>
21300 <li>Parser test</li>
21301 <li>Parser_test</li>
21302 <li>Talk:Parser test</li>
21303 <li>Talk:Parser_test</li>
21304 <li>Parser test</li>
21305 <li>Parser_test</li>
21306 <li></li>
21307 <li></li>
21308 <li>0</li>
21309 <li>Talk</li>
21310 <li>Talk</li>
21311 <li></li>
21312 <li></li>
21313 <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>
21314 !! end
21315 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21316
21317 !! test
21318 Gallery with valid attributes
21319 !! wikitext
21320 <gallery type="123" summary="345">
21321 File:File:Foobar.jpg
21322 </gallery>
21323 !! html/php
21324 <ul class="gallery mw-gallery-traditional" type="123">
21325 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21326 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21327 <div class="gallerytext">
21328 </div>
21329 </div></li>
21330 </ul>
21331 !! html/parsoid
21332 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{}}'>
21333 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/File:Foobar.jpg"><span resource="./File:File:Foobar.jpg" data-width="120" data-height="120">File:File:Foobar.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21334 </ul>
21335 !! end
21336
21337 ## Parsoid thinks the "centre" here is a property, not a caption.
21338 !! test
21339 Gallery
21340 !! options
21341 parsoid={
21342 "modes": ["wt2html"]
21343 }
21344 !! wikitext
21345 <gallery>
21346 image1.png |
21347 image2.gif|||||
21348
21349 image3|
21350 image4 |300px| centre
21351 image5.svg| http://///////
21352 [[x|xx]]]]
21353 * image6
21354 </gallery>
21355 !! html/php
21356 <ul class="gallery mw-gallery-traditional">
21357 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21358 <div class="thumb" style="height: 150px;">Image1.png</div>
21359 <div class="gallerytext">
21360 </div>
21361 </div></li>
21362 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21363 <div class="thumb" style="height: 150px;">Image2.gif</div>
21364 <div class="gallerytext">
21365 </div>
21366 </div></li>
21367 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21368 <div class="thumb" style="height: 150px;">Image3</div>
21369 <div class="gallerytext">
21370 </div>
21371 </div></li>
21372 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21373 <div class="thumb" style="height: 150px;">Image4</div>
21374 <div class="gallerytext">
21375 <pre>centre
21376 </pre>
21377 </div>
21378 </div></li>
21379 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21380 <div class="thumb" style="height: 150px;">Image5.svg</div>
21381 <div class="gallerytext">
21382 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21383 </p>
21384 </div>
21385 </div></li>
21386 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21387 <div class="thumb" style="height: 150px;">* image6</div>
21388 <div class="gallerytext">
21389 </div>
21390 </div></li>
21391 </ul>
21392 !! html/parsoid
21393 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21394 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image1.png"><span resource="./File:Image1.png" data-width="120" data-height="120">File:Image1.png</span></a></figure-inline></div><div class="gallerytext"></div></li>
21395 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image2.gif"><span resource="./File:Image2.gif" data-width="120" data-height="120">File:Image2.gif</span></a></figure-inline></div><div class="gallerytext"></div></li>
21396 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image3"><span resource="./File:Image3" data-width="120" data-height="120">File:Image3</span></a></figure-inline></div><div class="gallerytext"></div></li>
21397 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image4"><span resource="./File:Image4" data-width="300">File:Image4</span></a></figure-inline></div><div class="gallerytext"></div></li>
21398 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Image5.svg"><span resource="./File:Image5.svg" data-width="120" data-height="120">File:Image5.svg</span></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" href="http://///////" class="external free">http://///////</a></div></li>
21399 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/*_image6"><span resource="./File:*_image6" data-width="120" data-height="120">File:* image6</span></a></figure-inline></div><div class="gallerytext"></div></li>
21400 </ul>
21401 !! end
21402
21403 !! test
21404 Gallery (with options, html)
21405 !! options
21406 parsoid={
21407 "modes": ["wt2html", "html2html"]
21408 }
21409 !! wikitext
21410 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21411 File:Nonexistent.jpg|caption
21412 File:Nonexistent.jpg
21413 image:foobar.jpg|some '''caption''' [[Main Page]]
21414 image:foobar.jpg
21415 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21416 </gallery>
21417 !! html/php
21418 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21419 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21420 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21421 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21422 <div class="gallerytext">
21423 <p>caption
21424 </p>
21425 </div>
21426 </div></li>
21427 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21428 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21429 <div class="gallerytext">
21430 </div>
21431 </div></li>
21432 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21433 <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" decoding="async" 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>
21434 <div class="gallerytext">
21435 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21436 </p>
21437 </div>
21438 </div></li>
21439 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21440 <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" decoding="async" 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>
21441 <div class="gallerytext">
21442 </div>
21443 </div></li>
21444 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21445 <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" decoding="async" 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>
21446 <div class="gallerytext">
21447 <p>blabla.
21448 </p>
21449 </div>
21450 </div></li>
21451 </ul>
21452 !! html/parsoid
21453 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2"},"body":{}}'>
21454 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21455 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext">caption</div></li>
21456 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21457 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
21458 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21459 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
21460 </ul>
21461 !! end
21462
21463 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
21464 ## are no longer in storage.
21465 !! test
21466 Gallery (with options, extsrc)
21467 !! options
21468 parsoid=html2wt
21469 !! wikitext
21470 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21471 File:Nonexistent.jpg|caption
21472 File:Nonexistent.jpg
21473 image:foobar.jpg|some '''caption''' [[Main Page]]
21474 image:foobar.jpg
21475 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21476 </gallery>
21477 !! html/php
21478 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21479 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21480 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21481 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21482 <div class="gallerytext">
21483 <p>caption
21484 </p>
21485 </div>
21486 </div></li>
21487 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21488 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21489 <div class="gallerytext">
21490 </div>
21491 </div></li>
21492 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21493 <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" decoding="async" 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>
21494 <div class="gallerytext">
21495 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21496 </p>
21497 </div>
21498 </div></li>
21499 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21500 <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" decoding="async" 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>
21501 <div class="gallerytext">
21502 </div>
21503 </div></li>
21504 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21505 <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" decoding="async" 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>
21506 <div class="gallerytext">
21507 <p>blabla.
21508 </p>
21509 </div>
21510 </div></li>
21511 </ul>
21512 !! html/parsoid
21513 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &apos;&apos;&apos;caption&apos;&apos;&apos; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
21514 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21515 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext">caption</div></li>
21516 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="70" data-height="40">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21517 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
21518 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21519 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
21520 </ul>
21521 !! end
21522
21523 !! test
21524 Gallery (without px units)
21525 !! wikitext
21526 <gallery widths="70" heights="40">
21527 File:Foobar.jpg
21528 </gallery>
21529 !! html/php
21530 <ul class="gallery mw-gallery-traditional">
21531 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21532 <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" decoding="async" 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>
21533 <div class="gallerytext">
21534 </div>
21535 </div></li>
21536 </ul>
21537 !! html/parsoid
21538 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{}}'>
21539 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
21540 </ul>
21541 !! end
21542
21543 !! test
21544 Gallery (with invalid units)
21545 !! wikitext
21546 <gallery widths="70em" heights="40em">
21547 File:Foobar.jpg
21548 </gallery>
21549 !! html/php
21550 <ul class="gallery mw-gallery-traditional">
21551 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21552 <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" decoding="async" 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>
21553 <div class="gallerytext">
21554 </div>
21555 </div></li>
21556 </ul>
21557 !! html/parsoid
21558 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{}}'>
21559 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21560 </ul>
21561 !! end
21562
21563 !! test
21564 Gallery with link that has fragment
21565 !! options
21566 parsoid={
21567 "modes": ["wt2html", "html2html"]
21568 }
21569 !! wikitext
21570 <gallery>
21571 image:foobar.jpg|link=Main_Page
21572 image:foobar.jpg|link=Main_Page#section
21573 image:foobar.jpg|link=Main Page#section|caption
21574 </gallery>
21575 !! html/php
21576 <ul class="gallery mw-gallery-traditional">
21577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21578 <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" decoding="async" 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>
21579 <div class="gallerytext">
21580 </div>
21581 </div></li>
21582 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21583 <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" decoding="async" 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>
21584 <div class="gallerytext">
21585 </div>
21586 </div></li>
21587 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21588 <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" decoding="async" 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>
21589 <div class="gallerytext">
21590 <p>caption
21591 </p>
21592 </div>
21593 </div></li>
21594 </ul>
21595 !! html/parsoid
21596 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21597 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21598 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21599 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21600 </ul>
21601 !! end
21602
21603 !! test
21604 Gallery with template inside caption
21605 !! wikitext
21606 <gallery caption="{{echo|hi}}">
21607 File:Foobar.jpg|{{echo|ho}}
21608 </gallery>
21609 !! html/php
21610 <ul class="gallery mw-gallery-traditional">
21611 <li class='gallerycaption'>hi</li>
21612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21613 <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" decoding="async" 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>
21614 <div class="gallerytext">
21615 <p>ho
21616 </p>
21617 </div>
21618 </div></li>
21619 </ul>
21620 !! html/parsoid
21621 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21622 <li class="gallerycaption"><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></li>
21623 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho"}},"i":0}}]}'>ho</span></div></li>
21624 </ul>
21625 !! end
21626
21627 !! test
21628 Gallery with wikitext inside gallery caption
21629 !! options
21630 parsoid={
21631 "modes": ["wt2html", "html2html"]
21632 }
21633 !! wikitext
21634 <gallery caption="# This should not be a list item
21635
21636 Text '''bold''' [[link]] {{ns:-1}}
21637
21638 [[File:Foobar.jpg|thumb|File in gallery caption]]">
21639 File:Foobar.jpg|Image caption
21640 </gallery>
21641 !! html/php
21642 <ul class="gallery mw-gallery-traditional">
21643 <li class='gallerycaption'># This should not be a list item Text <b>bold</b> <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">link</a> Special <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" decoding="async" 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>File in gallery caption</div></div></div></li>
21644 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21645 <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" decoding="async" 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>
21646 <div class="gallerytext">
21647 <p>Image caption
21648 </p>
21649 </div>
21650 </div></li>
21651 </ul>
21652 !! html/parsoid
21653 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21654 <li class="gallerycaption"># This should not be a list item Text <b>bold</b> <a rel="mw:WikiLink" href="./Link" title="Link">link</a> <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ns:-1","function":"ns"},"params":{},"i":0}}]}'>-1</span> <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>File in gallery caption</figcaption></figure></li>
21655 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">Image caption</div></li>
21656 </ul>
21657 !! end
21658
21659 !! test
21660 Gallery with wikitext inside caption
21661 !! wikitext
21662 <gallery>
21663 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21664 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21665 </gallery>
21666 !! html/php
21667 <ul class="gallery mw-gallery-traditional">
21668 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21669 <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" decoding="async" 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>
21670 <div class="gallerytext">
21671 <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" decoding="async" 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>
21672 </p>
21673 </div>
21674 </div></li>
21675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21676 <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" decoding="async" 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>
21677 <div class="gallerytext">
21678 <p>This is a test template
21679 </p>
21680 </div>
21681 </div></li>
21682 </ul>
21683 !! html/parsoid
21684 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21685 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"desc"}'><a href="./File:Foobar.jpg"><img alt="inneralt" 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></figure-inline></div></li>
21686 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"param"}},"i":0}}]}'>This is a test template</span></div></li>
21687 </ul>
21688 !! end
21689
21690 !! test
21691 Gallery (with showfilename option)
21692 !! wikitext
21693 <gallery showfilename="">
21694 File:Nonexistent.jpg|caption
21695 File:Nonexistent.jpg
21696 File:Foobar.jpg|some '''caption''' [[Main Page]]
21697 File:Foobar.jpg
21698 </gallery>
21699 !! html/php
21700 <ul class="gallery mw-gallery-traditional">
21701 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21702 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21703 <div class="gallerytext">
21704 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21705 caption
21706 </p>
21707 </div>
21708 </div></li>
21709 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21710 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21711 <div class="gallerytext">
21712 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21713 </p>
21714 </div>
21715 </div></li>
21716 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21717 <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" decoding="async" 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>
21718 <div class="gallerytext">
21719 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21720 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21721 </p>
21722 </div>
21723 </div></li>
21724 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21725 <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" decoding="async" 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>
21726 <div class="gallerytext">
21727 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21728 </p>
21729 </div>
21730 </div></li>
21731 </ul>
21732 !! html/parsoid
21733 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21734 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
21735 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
21736 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
21737 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
21738 </ul>
21739 !! end
21740
21741 ## Should Parsoid be preserving these variations? See T151367
21742 !! test
21743 Gallery (with namespace-less filenames)
21744 !! options
21745 parsoid={
21746 "modes": ["wt2html", "html2html"]
21747 }
21748 !! wikitext
21749 <gallery>
21750 File:Nonexistent.jpg
21751 Nonexistent.jpg
21752 image:foobar.jpg
21753 foobar.jpg
21754 </gallery>
21755 !! html/php
21756 <ul class="gallery mw-gallery-traditional">
21757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21758 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21759 <div class="gallerytext">
21760 </div>
21761 </div></li>
21762 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21763 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21764 <div class="gallerytext">
21765 </div>
21766 </div></li>
21767 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21768 <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" decoding="async" 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>
21769 <div class="gallerytext">
21770 </div>
21771 </div></li>
21772 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21773 <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" decoding="async" 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>
21774 <div class="gallerytext">
21775 </div>
21776 </div></li>
21777 </ul>
21778 !! html/parsoid
21779 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21780 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21781 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Nonexistent.jpg"><span resource="./File:Nonexistent.jpg" data-width="120" data-height="120">File:Nonexistent.jpg</span></a></figure-inline></div><div class="gallerytext"></div></li>
21782 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21783 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21784 </ul>
21785 !! end
21786
21787 !! test
21788 Gallery override link with wikilink (T36852)
21789 !! wikitext
21790 <gallery>
21791 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21792 </gallery>
21793 !! html/php
21794 <ul class="gallery mw-gallery-traditional">
21795 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21796 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Wikilink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
21797 <div class="gallerytext">
21798 </div>
21799 </div></li>
21800 </ul>
21801 !! html/parsoid
21802 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21803 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Wikilink"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21804 </ul>
21805 !! end
21806
21807 !! test
21808 Gallery override link with absolute external link (T36852)
21809 !! wikitext
21810 <gallery>
21811 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21812 </gallery>
21813 !! html/php
21814 <ul class="gallery mw-gallery-traditional">
21815 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21816 <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" decoding="async" 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>
21817 <div class="gallerytext">
21818 </div>
21819 </div></li>
21820 </ul>
21821 !! html/parsoid
21822 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21823 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21824 </ul>
21825 !! end
21826
21827 ## Putting the caption at the end here runs into T49646 on the php side
21828 ## so reducing the modes this runs in Parsoid
21829 !! test
21830 Gallery override link with absolute external link with LanguageConverter
21831 !! options
21832 language=zh
21833 parsoid=wt2html,html2html
21834 !! wikitext
21835 <gallery>
21836 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21837 </gallery>
21838 !! html/php
21839 <ul class="gallery mw-gallery-traditional">
21840 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21841 <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" decoding="async" 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>
21842 <div class="gallerytext">
21843 <p>caption
21844 </p>
21845 </div>
21846 </div></li>
21847 </ul>
21848 !! html/parsoid
21849 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21850 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
21851 </ul>
21852 !! end
21853
21854 !! test
21855 Gallery override link with malicious javascript (T36852)
21856 !! options
21857 parsoid={
21858 "modes": ["wt2html", "html2html"]
21859 }
21860 !! wikitext
21861 <gallery>
21862 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21863 </gallery>
21864 !! html/php
21865 <ul class="gallery mw-gallery-traditional">
21866 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21867 <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" decoding="async" 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>
21868 <div class="gallerytext">
21869 </div>
21870 </div></li>
21871 </ul>
21872 !! html/parsoid
21873 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21874 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21875 </ul>
21876 !! end
21877
21878 !! test
21879 Gallery with invalid title as link (T45964)
21880 !! options
21881 parsoid={
21882 "modes": ["wt2html", "html2html"]
21883 }
21884 !! wikitext
21885 <gallery>
21886 File:Foobar.jpg|link=<
21887 </gallery>
21888 !! html/php
21889 <ul class="gallery mw-gallery-traditional">
21890 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21891 <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" decoding="async" 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>
21892 <div class="gallerytext">
21893 </div>
21894 </div></li>
21895 </ul>
21896 !! html/parsoid
21897 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21898 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image" data-mw='{"attribs":[["link",{"txt":"&lt;"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21899 </ul>
21900 !! end
21901
21902 !! test
21903 Serialize gallery without attrs in data-mw
21904 !! options
21905 parsoid={
21906 "modes": ["html2wt"]
21907 }
21908 !! html/parsoid
21909 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21910 <li class="gallerycaption">123</li>
21911 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span>File:Test.png</span></div><div class="gallerytext"></div></li>
21912 </ul>
21913 !! wikitext
21914 <gallery caption="123">
21915 File:Test.png
21916 </gallery>
21917 !! end
21918
21919 !! test
21920 Gallery with class and style attributes
21921 !! wikitext
21922 <gallery class="center" style="text-align: center;">
21923 File:Foobar.jpg
21924 </gallery>
21925 !! html/php
21926 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21927 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21928 <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" decoding="async" 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>
21929 <div class="gallerytext">
21930 </div>
21931 </div></li>
21932 </ul>
21933 !! html/parsoid
21934 <ul class="gallery mw-gallery-traditional center" style="text-align: center;" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center","style":"text-align: center;"},"body":{}}'>
21935 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21936 </ul>
21937 !! end
21938
21939 !! test
21940 Gallery in nolines mode
21941 !! wikitext
21942 <gallery mode="nolines" showfilenames="yes" caption="No Lines!">
21943 File:Foobar.jpg|foo
21944 </gallery>
21945 !! html/php
21946 <ul class="gallery mw-gallery-nolines">
21947 <li class='gallerycaption'>No Lines!</li>
21948 <li class="gallerybox" style="width: 125px"><div style="width: 125px">
21949 <div class="thumb" style="width: 120px;"><div style="margin:0px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
21950 <div class="gallerytext">
21951 <p>foo
21952 </p>
21953 </div>
21954 </div></li>
21955 </ul>
21956 !! html/parsoid
21957 <ul class="gallery mw-gallery-nolines" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"mode":"nolines","showfilenames":"yes"},"body":{}}'>
21958 <li class="gallerycaption">No Lines!</li>
21959 <li class="gallerybox" style="width: 125px;"><div class="thumb" style="width: 120px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">foo</div></li>
21960 </ul>
21961 !! end
21962
21963 !! test
21964 Gallery in slideshow mode
21965 !! wikitext
21966 <gallery mode="slideshow" showthumbnails="">
21967 File:Foobar.jpg
21968 </gallery>
21969 !! html/php
21970 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21972 <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" decoding="async" 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>
21973 <div class="gallerytext">
21974 </div>
21975 </div></li>
21976 </ul>
21977 !! html/parsoid
21978 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21979 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
21980 </ul>
21981 !! end
21982
21983 !! test
21984 Gallery in packed mode
21985 !! wikitext
21986 <gallery mode="packed">
21987 File:Foobar.jpg
21988 </gallery>
21989 !! html/php
21990 <ul class="gallery mw-gallery-packed">
21991 <li class="gallerybox" style="width: 1061.3333333333px"><div style="width: 1061.3333333333px">
21992 <div class="thumb" style="width: 1059.3333333333px;"><div style="margin:0px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" decoding="async" width="1060" height="120" srcset="http://example.com/images/3/3a/Foobar.jpg 1.5x" /></a></div></div>
21993 <div class="gallerytext">
21994 </div>
21995 </div></li>
21996 </ul>
21997 !! html/parsoid
21998 <ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" about="#mwt3" data-parsoid='{"dsr":[0,50,23,10]}' data-mw='{"name":"gallery","attrs":{"mode":"packed"},"body":{}}'>
21999 <li class="gallerybox" style="width: 1061.3333333333333px;"><div class="thumb" style="width: 1059.3333333333333px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="120" width="1060"/></a></figure-inline></div><div class="gallerytext"></div></li>
22000 </ul>
22001 !! end
22002
22003 !! test
22004 Gallery in packed-overlay mode
22005 !! wikitext
22006 <gallery mode="packed-overlay" showfilenames="yes" caption="Packed Overlay!">
22007 File:Foobar.jpg|foo
22008 </gallery>
22009 !! html/php
22010 <ul class="gallery mw-gallery-packed-overlay">
22011 <li class='gallerycaption'>Packed Overlay!</li>
22012 <li class="gallerybox" style="width: 1061.3333333333px"><div style="width: 1061.3333333333px">
22013 <div class="thumb" style="width: 1059.3333333333px;"><div style="margin:0px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" decoding="async" width="1060" height="120" srcset="http://example.com/images/3/3a/Foobar.jpg 1.5x" /></a></div></div>
22014 <div class="gallerytextwrapper" style="width: 1040px"><div class="gallerytext">
22015 <p>foo
22016 </p>
22017 </div></div>
22018 </div></li>
22019 </ul>
22020 !! html/parsoid
22021 <ul class="gallery mw-gallery-packed-overlay" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"mode":"packed-overlay","showfilenames":"yes"},"body":{}}'>
22022 <li class="gallerycaption">Packed Overlay!</li>
22023 <li class="gallerybox" style="width: 1061.3333333333333px;"><div class="thumb" style="width: 1059.3333333333333px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="120" width="1060"/></a></figure-inline></div><div class="gallerytextwrapper" style="width: 1040px;"><div class="gallerytext">foo</div></div></li>
22024 </ul>
22025 !! end
22026
22027 !! test
22028 Gallery in packed-hover mode
22029 !! wikitext
22030 <gallery mode="packed-hover" showfilenames="yes" caption="Packed Hover!">
22031 File:Foobar.jpg|foo
22032 </gallery>
22033 !! html/php
22034 <ul class="gallery mw-gallery-packed-hover">
22035 <li class='gallerycaption'>Packed Hover!</li>
22036 <li class="gallerybox" style="width: 1061.3333333333px"><div style="width: 1061.3333333333px">
22037 <div class="thumb" style="width: 1059.3333333333px;"><div style="margin:0px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" decoding="async" width="1060" height="120" srcset="http://example.com/images/3/3a/Foobar.jpg 1.5x" /></a></div></div>
22038 <div class="gallerytextwrapper" style="width: 1040px"><div class="gallerytext">
22039 <p>foo
22040 </p>
22041 </div></div>
22042 </div></li>
22043 </ul>
22044 !! html/parsoid
22045 <ul class="gallery mw-gallery-packed-hover" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"mode":"packed-hover","showfilenames":"yes"},"body":{}}'>
22046 <li class="gallerycaption">Packed Hover!</li>
22047 <li class="gallerybox" style="width: 1061.3333333333333px;"><div class="thumb" style="width: 1059.3333333333333px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1589px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="120" width="1060"/></a></figure-inline></div><div class="gallerytextwrapper" style="width: 1040px;"><div class="gallerytext">foo</div></div></li>
22048 </ul>
22049 !! end
22050
22051 !! test
22052 Serialize gallery image captions on a line
22053 !! options
22054 parsoid={
22055 "modes": ["html2wt"]
22056 }
22057 !! html/parsoid
22058 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
22059 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><p>hi</p><p>ho</p></div></li>
22060 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">hi<br />ho</div></li>
22061 </ul>
22062 !! wikitext
22063 <gallery>
22064 File:Foobar.jpg| hi ho
22065 File:Foobar.jpg|hi<br />ho
22066 </gallery>
22067 !! end
22068
22069 !! test
22070 HTML Hex character encoding (spells the word "JavaScript")
22071 !! options
22072 parsoid=wt2html,wt2wt,html2html
22073 !! wikitext
22074 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
22075 !! html/php
22076 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
22077 </p>
22078 !! html/parsoid
22079 <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>
22080 !! end
22081
22082 !! test
22083 HTML Hex character encoding bogus encoding (T28437 regression check)
22084 !! wikitext
22085 &#xsee;&#XSEE;
22086 !! html
22087 <p>&amp;#xsee;&amp;#XSEE;
22088 </p>
22089 !! end
22090
22091 !! test
22092 HTML Hex character encoding mixed case
22093 !! options
22094 parsoid=wt2html,wt2wt,html2html
22095 !! wikitext
22096 &#xEE;&#Xee;
22097 !! html/php
22098 <p>&#xee;&#xee;
22099 </p>
22100 !! html/parsoid
22101 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
22102 !! end
22103
22104 # See: https://www.w3.org/TR/html5/syntax.html#character-references
22105 # Note that U+000C (form feed) is not a valid XML character, so
22106 # it is banned even though allowed in HTML5.
22107 # Note there are also weird legacy numeric entities which are mapped
22108 # elsewhere; see T113194
22109 !! test
22110 Illegal character references (T106578, T113194)
22111 !! options
22112 parsoid={ "modes": ["wt2html","html2html"], "normalizePhp": true }
22113 !! wikitext
22114 ; Null: &#00;
22115 ; FF: &#xC;
22116 ; CR: &#xD;
22117 ; Control (low): &#8;
22118 ; Control (high): &#x7F; &#x9F;
22119 ; Unsupported legacy: &#128; &#130; &#131; &#150; &#159;
22120 ; Surrogate: &#xD83D;&#xDCA9;
22121 ; This is an okay astral character: &#x1F4A9;
22122 !! html+tidy
22123 <dl><dt>Null</dt>
22124 <dd>&amp;#00;</dd>
22125 <dt>FF</dt>
22126 <dd>&amp;#xC;</dd>
22127 <dt>CR</dt>
22128 <dd>&amp;#xD;</dd>
22129 <dt>Control (low)</dt>
22130 <dd>&amp;#8;</dd>
22131 <dt>Control (high)</dt>
22132 <dd>&amp;#x7F; &amp;#x9F;</dd>
22133 <dt>Unsupported legacy</dt>
22134 <dd>&amp;#128; &amp;#130; &amp;#131; &amp;#150; &amp;#159;</dd>
22135 <dt>Surrogate</dt>
22136 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
22137 <dt>This is an okay astral character</dt>
22138 <dd>&#x1f4a9;</dd></dl>
22139 !! end
22140
22141 !! test
22142 __FORCETOC__ override
22143 !! wikitext
22144 __NEWSECTIONLINK__
22145 __FORCETOC__
22146 !! html/php
22147 <p><br />
22148 </p>
22149 !! end
22150
22151 !! test
22152 ISBN code coverage
22153 !! wikitext
22154 ISBN 978-0-1234-56&#x20;789
22155 !! html/php
22156 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
22157 </p>
22158 !! html/parsoid
22159 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
22160 !! end
22161
22162 !! test
22163 ISBN followed by 5 spaces
22164 !! wikitext
22165 ISBN
22166 !! html
22167 <p>ISBN
22168 </p>
22169 !! end
22170
22171 !! test
22172 Double ISBN
22173 !! wikitext
22174 ISBN ISBN 1234567890
22175 !! html/php
22176 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22177 </p>
22178 !! html/parsoid
22179 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22180 !! end
22181
22182 # Uppercase X and lowercase x as well
22183 !! test
22184 ISBN with an X
22185 !! wikitext
22186 ISBN 3-462-04561-X
22187 ISBN 3-462-04561-x
22188 ISBN 080442957X
22189 ISBN 080442957x
22190 ISBN 978080442957X
22191 ISBN 978080442957x
22192 !! html/php
22193 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
22194 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
22195 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
22196 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
22197 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
22198 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
22199 </p>
22200 !! html/parsoid
22201 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
22202 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
22203 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
22204 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
22205 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
22206 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
22207 !! end
22208
22209 !! test
22210 ISBN with empty prefix (parsoid test)
22211 !! wikitext
22212 ISBN 1234567890
22213 !! html/php
22214 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22215 </p>
22216 !! html/parsoid
22217 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
22218 !! end
22219
22220 !! test
22221 T24905: <abbr> followed by ISBN followed by </a>
22222 !! wikitext
22223 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
22224 !! html/php
22225 <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>
22226 </p>
22227 !! html/parsoid
22228 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com" class="external text">example.com</a></p>
22229 !! end
22230
22231 !! test
22232 Double RFC
22233 !! wikitext
22234 RFC RFC 1234
22235 !! html/php
22236 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
22237 </p>
22238 !! html/parsoid
22239 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
22240 !! end
22241
22242 !! test
22243 Double RFC with a wiki link
22244 !! wikitext
22245 RFC [[RFC 1234]]
22246 !! html/php
22247 <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>
22248 </p>
22249 !! html/parsoid
22250 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
22251 !! end
22252
22253 !! test
22254 RFC code coverage
22255 !! wikitext
22256 RFC 983&#x20;987
22257 !! html/php
22258 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
22259 </p>
22260 !! html/parsoid
22261 <p><a href="https://tools.ietf.org/html/rfc983" rel="mw:ExtLink" class="external mw-magiclink" data-parsoid='{"stx":"magiclink"}'>RFC 983</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>987</p>
22262 !! end
22263
22264 !! test
22265 Centre-aligned image
22266 !! wikitext
22267 [[Image:foobar.jpg|centre]]
22268 !! html/php
22269 <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" decoding="async" width="1941" height="220" /></a></div></div>
22270 !! html/parsoid
22271 <figure class="mw-default-size mw-halign-center" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"center","ak":"centre"}]}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a><figcaption></figcaption></figure>
22272 !! end
22273
22274 !! test
22275 None-aligned image
22276 !! wikitext
22277 [[Image:foobar.jpg|none]]
22278 !! html/php
22279 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a></div>
22280 !! html/parsoid
22281 <figure class="mw-default-size mw-halign-none" 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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a><figcaption></figcaption></figure>
22282 !! end
22283
22284 !! test
22285 Width + Height sized image (using px) (height is ignored)
22286 !! wikitext
22287 [[Image:foobar.jpg|640x480px]]
22288 !! html/php
22289 <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" decoding="async" 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>
22290 </p>
22291 !! html/parsoid
22292 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640x480px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
22293 !! end
22294
22295 !! test
22296 Width-sized image (using px, no following whitespace)
22297 !! wikitext
22298 [[Image:foobar.jpg|640px]]
22299 !! html/php
22300 <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" decoding="async" 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>
22301 </p>
22302 !! html/parsoid
22303 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
22304 !! end
22305
22306 !! test
22307 Width-sized image (using px, with following whitespace - test regression from r39467)
22308 !! wikitext
22309 [[Image:foobar.jpg|640px ]]
22310 !! html/php
22311 <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" decoding="async" 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>
22312 </p>
22313 !! html/parsoid
22314 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px "}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
22315 !!end
22316
22317 !! test
22318 Width-sized image (using px, with preceding whitespace - test regression from r39467)
22319 !! wikitext
22320 [[Image:foobar.jpg| 640px]]
22321 !! html/php
22322 <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" decoding="async" 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>
22323 </p>
22324 !! html/parsoid
22325 <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":" 640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
22326 !! end
22327
22328 ## FIXME: Parsoid mocking should include the page in the url to catch regressions
22329 !! test
22330 Image with page parameter
22331 !! options
22332 djvu
22333 !! wikitext
22334 [[File:LoremIpsum.djvu|page=2]]
22335 !! html/php
22336 <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" decoding="async" 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>
22337 </p>
22338 !! html/parsoid
22339 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"attribs":[["page",{"txt":"2"}]]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><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></figure-inline></p>
22340 !! end
22341
22342 !! test
22343 Another italics / bold test
22344 !! wikitext
22345 ''' ''x'
22346 !! html
22347 <pre>'<i> </i>x'
22348 </pre>
22349 !!end
22350
22351 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22352 !! test
22353 dt/dd/dl test
22354 !! wikitext
22355 :;;;::
22356 !! html/php
22357 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22358 !! html/parsoid
22359 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22360 !! end
22361
22362 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22363 !! test
22364 Images with the "|" character in the comment
22365 !! wikitext
22366 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22367 !! html/php
22368 <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" decoding="async" 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>
22369 !! html/parsoid
22370 <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=%7Cleft%7C&amp;param2=%7Cx" class="external text" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
22371 !! end
22372
22373 !! test
22374 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22375 !! wikitext
22376 <html><script>alert(1);</script></html>
22377 !! html
22378 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22379 </p>
22380 !! end
22381
22382 !! test
22383 HTML with raw HTML ($wgRawHtml==true)
22384 !! options
22385 wgRawHtml=1
22386 !! wikitext
22387 <html><script>alert(1);</script></html>
22388 !! html/php
22389 <p><script>alert(1);</script>
22390 </p>
22391 !! html/parsoid
22392 <p><script typeof="mw:Extension/html" about="#mwt3" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></p>
22393 !! end
22394
22395 !! test
22396 Parents of subpages, one level up
22397 !! options
22398 subpage title=[[Subpage test/L1/L2/L3]]
22399 !! wikitext
22400 [[../|L2]]
22401 !! html
22402 <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>
22403 </p>
22404 !! end
22405
22406
22407 !! test
22408 Parents of subpages, one level up, not named
22409 !! options
22410 subpage title=[[Subpage test/L1/L2/L3]]
22411 !! wikitext
22412 [[../]]
22413 !! html
22414 <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>
22415 </p>
22416 !! end
22417
22418
22419
22420 !! test
22421 Parents of subpages, two levels up
22422 !! options
22423 subpage title=[[Subpage test/L1/L2/L3]]
22424 !! wikitext
22425 [[../../|L1]]2
22426
22427 [[../../|L1]]l
22428 !! html
22429 <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
22430 </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>
22431 </p>
22432 !! end
22433
22434 !! test
22435 Parents of subpages, two levels up, without trailing slash or name.
22436 !! options
22437 subpage title=[[Subpage test/L1/L2/L3]]
22438 !! wikitext
22439 [[../..]]
22440 !! html
22441 <p>[[../..]]
22442 </p>
22443 !! end
22444
22445 !! test
22446 Parents of subpages, two levels up, with lots of extra trailing slashes.
22447 !! options
22448 subpage title=[[Subpage test/L1/L2/L3]]
22449 !! wikitext
22450 [[../../////]]
22451 !! html
22452 <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>
22453 </p>
22454 !! end
22455
22456 !! article
22457 Subpage test/L1/L2/L3Sibling
22458 !! text
22459 Sibling article
22460 !! endarticle
22461
22462 !! test
22463 Transclusion of a sibling page (one level up)
22464 !! options
22465 subpage title=[[Subpage test/L1/L2/L3]]
22466 !! wikitext
22467 {{../L3Sibling}}
22468 !! html
22469 <p>Sibling article
22470 </p>
22471 !! end
22472
22473 !! test
22474 Transclusion of a child page
22475 !! options
22476 subpage title=[[Subpage test/L1/L2]]
22477 !! wikitext
22478 {{/L3Sibling}}
22479 !! html
22480 <p>Sibling article
22481 </p>
22482 !! end
22483
22484 # This is wt2html only in Parsoid because we add <nowiki>
22485 # because of {{..}} and we don't expect to fix that to
22486 # eliminate the nowikis selective for {{..}} markup.
22487 !! test
22488 Non-transclusion because of too many up levels
22489 !! options
22490 subpage title=[[Subpage test/L1/L2/L3]]
22491 parsoid=wt2html
22492 !! wikitext
22493 {{../../../../More than parent}}
22494 !! html/php
22495 <p>{{../../../../More than parent}}
22496 </p>
22497 !! html/parsoid
22498 <p>{{../../../../More than parent}}</p>
22499 !! end
22500
22501 !! test
22502 Definition list code coverage
22503 !! wikitext
22504 ;title :def
22505 ;title :def
22506 ;title:def
22507 !! html/php
22508 <dl><dt>title</dt>
22509 <dd>def</dd>
22510 <dt>title</dt>
22511 <dd>def</dd>
22512 <dt>title</dt>
22513 <dd>def</dd></dl>
22514 !! html/parsoid
22515 <dl><dt>title </dt><dd>def</dd>
22516 <dt>title </dt><dd>def</dd>
22517 <dt>title</dt><dd>def</dd></dl>
22518 !! end
22519
22520 !! test
22521 Don't fall for the self-closing div
22522 !! wikitext
22523 <div>hello world</div/>
22524 !! html
22525 <div>hello world</div>
22526 !! end
22527
22528 !! test
22529 MSGNW magic word
22530 !! wikitext
22531 {{MSGNW:msg}}
22532 !! html/php
22533 <p>&#91;&#91;:Template:Msg&#93;&#93;
22534 </p>
22535 !! end
22536
22537 !! test
22538 RAW magic word
22539 !! wikitext
22540 {{RAW:QUERTY}}
22541 !! html
22542 <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>
22543 </p>
22544 !! end
22545
22546 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22547 !! test
22548 Always escape literal '>' in output, not just after '<'
22549 !! wikitext
22550 ><>
22551 !! html
22552 <p>&gt;&lt;&gt;
22553 </p>
22554 !! end
22555
22556 !! test
22557 Template caching
22558 !! wikitext
22559 {{Test}}
22560 {{Test}}
22561 !! html
22562 <p>This is a test template
22563 This is a test template
22564 </p>
22565 !! end
22566
22567
22568 !! article
22569 MediaWiki:Fake
22570 !! text
22571 ==header==
22572 !! endarticle
22573
22574 !! test
22575 Inclusion of !userCanEdit() content
22576 !! wikitext
22577 {{MediaWiki:Fake}}
22578 !! html
22579 <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>
22580 !! end
22581
22582
22583 !! test
22584 Out-of-order TOC heading levels
22585 !! wikitext
22586 ==2==
22587 ======6======
22588 ===3===
22589 =1=
22590 =====5=====
22591 ==2==
22592 !! html
22593 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
22594 <ul>
22595 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22596 <ul>
22597 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22598 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22599 </ul>
22600 </li>
22601 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22602 <ul>
22603 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22604 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22605 </ul>
22606 </li>
22607 </ul>
22608 </div>
22609
22610 <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>
22611 <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>
22612 <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>
22613 <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>
22614 <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>
22615 <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>
22616 !! end
22617
22618
22619 !! test
22620 ISBN with a dummy number
22621 !! wikitext
22622 ISBN ---
22623 !! html
22624 <p>ISBN ---
22625 </p>
22626 !! end
22627
22628
22629 !! test
22630 ISBN with space-delimited number
22631 !! wikitext
22632 ISBN 92 9017 032 8
22633 !! html/php
22634 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22635 </p>
22636 !! html/parsoid
22637 <p data-parsoid='{"dsr":[0,18,0,0]}'><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink","dsr":[0,18,2,2]}'>ISBN 92 9017 032 8</a></p>
22638 !! end
22639
22640
22641 !! test
22642 ISBN with multiple spaces, no number
22643 !! wikitext
22644 ISBN foo
22645 !! html
22646 <p>ISBN foo
22647 </p>
22648 !! end
22649
22650
22651 !! test
22652 ISBN length
22653 !! wikitext
22654 ISBN 123456789
22655
22656 ISBN 1234567890
22657
22658 ISBN 12345678901
22659 !! html/php
22660 <p>ISBN 123456789
22661 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22662 </p><p>ISBN 12345678901
22663 </p>
22664 !! html/parsoid
22665 <p>ISBN 123456789</p>
22666
22667 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22668
22669 <p>ISBN 12345678901</p>
22670 !! end
22671
22672
22673 !! test
22674 ISBN with trailing year (T9110)
22675 !! wikitext
22676 ISBN 1-234-56789-0 - 2006
22677
22678 ISBN 1 234 56789 0 - 2006
22679 !! html/php
22680 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22681 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22682 </p>
22683 !! html/parsoid
22684 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22685
22686 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22687 !! end
22688
22689
22690 !! test
22691 anchorencode
22692 !! config
22693 wgFragmentMode=[ 'html5', 'legacy' ]
22694 !! wikitext
22695 {{anchorencode:foo bar©#%n}}
22696 !! html/php
22697 <p>foo_bar©#%n
22698 </p>
22699 !! html/parsoid
22700 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:foo bar©#%n","function":"anchorencode"},"params":{},"i":0}}]}'>foo_bar©#%n</p>
22701 !! end
22702
22703 !! test
22704 anchorencode (legacy)
22705 !! config
22706 wgFragmentMode=[ 'legacy' ]
22707 !! wikitext
22708 {{anchorencode:foo bar©#%n}}
22709 !! html/php
22710 <p>foo_bar.C2.A9.23.25n
22711 </p>
22712 !! end
22713
22714 !! test
22715 anchorencode trims spaces
22716 !! config
22717 wgFragmentMode=[ 'html5', 'legacy' ]
22718 !! wikitext
22719 {{anchorencode: __pretty__please__}}
22720 !! html/php
22721 <p>pretty_please
22722 </p>
22723 !! html/parsoid
22724 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22725 !! end
22726
22727 !! test
22728 anchorencode deals with links
22729 !! config
22730 wgFragmentMode=[ 'html5', 'legacy' ]
22731 !! wikitext
22732 {{anchorencode: [[hello|world]] [[hi]]}}
22733 !! html/php
22734 <p>world_hi
22735 </p>
22736 !! html/parsoid
22737 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22738 !! end
22739
22740 !! test
22741 anchorencode deals with templates
22742 !! config
22743 wgFragmentMode=[ 'html5', 'legacy' ]
22744 !! wikitext
22745 {{anchorencode: {{Foo}} x}}
22746 !! html/php
22747 <p>FOO_x
22748 </p>
22749 !! html/parsoid
22750 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22751 !! end
22752
22753 !! test
22754 anchorencode encodes like the TOC generator: (T20431)
22755 !! config
22756 wgFragmentMode=[ 'html5', 'legacy' ]
22757 !! wikitext
22758 ===_ +:.3A%3A _ &&amp;]] x===
22759 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22760 __NOEDITSECTION__
22761 !! html/php
22762 <h3><span id=".2B:.3A.253A_.26.26.5D.5D_x"></span><span class="mw-headline" id="+:.3A%3A_&amp;&amp;]]_x">_ +:.3A%3A _ &amp;&amp;]] x</span></h3>
22763 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22764 </p>
22765 !! html/parsoid
22766 <h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &amp;<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;","dsr":[18,23,null,null]}'>&amp;</span>]] x</h3>
22767 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &amp;&amp;amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%3A_&amp;&amp;<span typeof="mw:Entity">]</span><span typeof="mw:Entity">]</span>_x</p>
22768 <meta property="mw:PageProp/noeditsection"/>
22769 !! end
22770
22771 !! test
22772 anchorencode encodes like the TOC generator: (T20431) (legacy)
22773 !! config
22774 wgFragmentMode=[ 'legacy' ]
22775 !! wikitext
22776 ===_ +:.3A%3A&&amp;]]===
22777 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22778 __NOEDITSECTION__
22779 !! html/php
22780 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22781 <p>.2B:.3A.253A.26.26.5D.5D
22782 </p>
22783 !! end
22784
22785 !! test
22786 T8200: blockquotes and paragraph formatting
22787 !! wikitext
22788 <blockquote>
22789 foo
22790 </blockquote>
22791
22792 bar
22793
22794 baz
22795 !! html
22796 <blockquote>
22797 <p>foo
22798 </p>
22799 </blockquote>
22800 <p>bar
22801 </p>
22802 <pre>baz
22803 </pre>
22804 !! end
22805
22806 !! test
22807 T10293: Use of center tag ruins paragraph formatting
22808 !! wikitext
22809 <center>
22810 foo
22811 </center>
22812
22813 bar
22814
22815 baz
22816 !! html
22817 <center>
22818 <p>foo
22819 </p>
22820 </center>
22821 <p>bar
22822 </p>
22823 <pre>baz
22824 </pre>
22825 !! end
22826
22827 !!test
22828 Parsing of overlapping (improperly nested) inline html tags
22829 !! wikitext
22830 <span><s>x</span></s>
22831 !! html/php
22832 <p><span><s>x&lt;/span&gt;</s></span>
22833 </p>
22834 !! html/parsoid
22835 <p><span><s>x</s></span>
22836 </p>
22837 !!end
22838
22839 ###
22840 ### Language variants related tests
22841 ###
22842
22843 # Parsoid does not mark self-links.
22844 # Parsoid does not convert links; PHP will do any necessary redirects.
22845
22846 !! test
22847 Self-link in language variants
22848 !! options
22849 title=[[Dunav]] language=sr
22850 !! wikitext
22851 Both [[Dunav]] and [[Дунав]] are names for this river.
22852 !! html/php
22853 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22854 </p>
22855 !! html/parsoid
22856 <p>Both <a rel="mw:WikiLink" href="./Dunav" title="Dunav">Dunav</a> and <a rel="mw:WikiLink" href="./Дунав" title="Дунав">Дунав</a> are names for this river.</p>
22857 !! end
22858
22859 !! article
22860 Дуна
22861 !! text
22862 content
22863 !! endarticle
22864
22865 !! test
22866 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22867 !! options
22868 title=[[Duna]] language=sr
22869 !! wikitext
22870 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22871 !! html/php
22872 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links.
22873 </p>
22874 !! html/parsoid
22875 <p><a rel="mw:WikiLink" href="./Дуна" title="Дуна">Дуна</a> is not a self-link while <a rel="mw:WikiLink" href="./Duna" title="Duna">Duna</a> and <a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> are still self-links.</p>
22876 !! end
22877
22878 !! test
22879 Link to a section of a variant of this title shouldn't be parsed as self-link
22880 !! options
22881 title=[[Duna]] language=sr
22882 !! wikitext
22883 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22884 !! html/php
22885 <p><a class="mw-selflink selflink">Dуна</a> 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.
22886 </p>
22887 !! html/parsoid
22888 <p><a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> is a self-link while <a rel="mw:WikiLink" href="./Dunа#Foo" title="Dunа">Dunа#Foo</a> and <a rel="mw:WikiLink" href="./Dуна#Foo" title="Dуна">Dуна#Foo</a> are not self-links.</p>
22889 !! end
22890
22891 !! test
22892 Link to pages in language variants
22893 !! options
22894 language=sr
22895 !! wikitext
22896 Main Page can be written as [[Маин Паге]]
22897 !! html/php
22898 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22899 </p>
22900 !! html/parsoid
22901 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22902 !! end
22903
22904
22905 !! test
22906 Multiple links to pages in language variants
22907 !! options
22908 language=sr
22909 !! wikitext
22910 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22911 !! html/php
22912 <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>.
22913 </p>
22914 !! html/parsoid
22915 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a> can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a> same as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a>.</p>
22916 !! end
22917
22918
22919 !! test
22920 Simple template in language variants
22921 !! options
22922 language=sr
22923 !! wikitext
22924 {{тест}}
22925 !! html/php
22926 <p>This is a test template
22927 </p>
22928 !! end
22929
22930
22931 !! test
22932 Template with explicit namespace in language variants
22933 !! options
22934 language=sr
22935 !! wikitext
22936 {{Template:тест}}
22937 !! html/php
22938 <p>This is a test template
22939 </p>
22940 !! end
22941
22942
22943 !! test
22944 Basic test for template parameter in language variants
22945 !! options
22946 language=sr
22947 !! wikitext
22948 {{парамтест|param=foo}}
22949 !! html/php
22950 <p>This is a test template with parameter foo
22951 </p>
22952 !! end
22953
22954 !! test
22955 Simple category in language variants
22956 !! options
22957 language=sr cat
22958 !! wikitext
22959 [[Category:МедиаWики Усер'с Гуиде]]
22960 !! html/php
22961 cat=МедиаWики_Усер'с_Гуиде sort=
22962 !! html/parsoid
22963 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22964 !! end
22965
22966 !! article
22967 Category:分类
22968 !! text
22969 blah
22970 !! endarticle
22971
22972 !! article
22973 Category:分類
22974 !! text
22975 blah
22976 !! endarticle
22977
22978 ## We used to, but no longer wt2wt this test since the default serializer
22979 ## will normalize all categories to serialize on their own line.
22980 ## This wikitext usage is going to be fairly uncommon in production and
22981 ## selser will take care of preserving formatting in those scenarios.
22982 !! test
22983 Don't convert blue categorylinks to another variant (T35210)
22984 !! options
22985 cat
22986 language=zh
22987 parsoid=wt2html
22988 !! wikitext
22989 [[A]][[Category:分类]]
22990 !! html/php
22991 cat=分类 sort=
22992 !! html/parsoid
22993 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22994 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22995 !! end
22996
22997 !! test
22998 Stripping -{}- tags (language variants)
22999 !! options
23000 language=sr
23001 !! wikitext
23002 Latin proverb: -{Ne nuntium necare}-
23003 !! html/php
23004 <p>Latin proverb: Ne nuntium necare
23005 </p>
23006 !! html/parsoid
23007 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
23008 !! end
23009
23010
23011 !! test
23012 Prevent conversion with -{}- tags (language variants)
23013 !! options
23014 language=sr variant=sr-ec
23015 !! wikitext
23016 Latinski: -{Ne nuntium necare}-
23017 !! html/php
23018 <p>Латински: Ne nuntium necare
23019 </p>
23020 !! html/parsoid
23021 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
23022 !! end
23023
23024
23025 !! test
23026 Prevent conversion of text with -{}- tags (language variants)
23027 !! options
23028 language=sr variant=sr-ec
23029 !! wikitext
23030 Latinski: -{Ne nuntium necare}-
23031 !! html/php
23032 <p>Латински: Ne nuntium necare
23033 </p>
23034 !! html/parsoid
23035 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
23036 !! end
23037
23038
23039 !! test
23040 Prevent conversion of links with -{}- tags (language variants)
23041 !! options
23042 language=sr variant=sr-ec
23043 !! wikitext
23044 -{[[Main Page]]}-
23045 !! html/php
23046 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
23047 </p>
23048 !! html/parsoid
23049 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}&#39;>Main Page&lt;/a>"}}'></span></p>
23050 !! end
23051
23052
23053 !! test
23054 -{}- tags within headlines (within html for parserConvert())
23055 !! config
23056 wgFragmentMode=[ 'html5', 'legacy' ]
23057 !! options
23058 language=sr variant=sr-ec
23059 !! wikitext
23060 ==-{Naslov}-==
23061
23062 Note that even an unprotected headline ID is not affected by language
23063 conversion:
23064
23065 ==Latinski==
23066 !! html/php
23067 <h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">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>
23068 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
23069 цонверсион:
23070 </p>
23071 <h2><span class="mw-headline" id="Latinski">Латински</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="Уредите одељак „Латински”">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
23072 !! html/parsoid
23073 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
23074
23075 <p>Note that even an unprotected headline ID is not affected by language
23076 conversion:</p>
23077
23078 <h2 id="Latinski">Latinski</h2>
23079 !! end
23080
23081 !! test
23082 Explicit definition of language variant alternatives
23083 !! options
23084 language=zh variant=zh-tw
23085 !! wikitext
23086 -{zh:China;zh-tw:Taiwan}-, not China
23087 !! html/php
23088 <p>Taiwan, not China
23089 </p>
23090 !! html/parsoid
23091 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, not China</p>
23092 !! end
23093
23094 !! test
23095 Explicit definition of language variant alternatives (BCP 47 codes)
23096 !! options
23097 language=zh variant=zh-tw
23098 !! wikitext
23099 -{zh:China;zh-Hant-TW:Taiwan}-, not China
23100 !! html/php
23101 <p>Taiwan, not China
23102 </p>
23103 !! html/parsoid
23104 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-Hant-TW","t":"Taiwan"}]}'></span>, not China</p>
23105 !! end
23106
23107 !! test
23108 Filter syntax for language variants
23109 !! options
23110 language=zh variant=zh-tw
23111 !! wikitext
23112 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
23113 !! html/php
23114 <p>fooblog, WEBJOURNAL, WEBLOGquux
23115 </p>
23116 !! html/parsoid
23117 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
23118 !! end
23119
23120 # Note that Parsoid post-processing for language variants needs to
23121 # update the `title` attribute here, based on the mw:ExpandedAttrs property
23122 !! test
23123 Conversion around HTML tags
23124 !! options
23125 language=sr variant=sr-ec
23126 !! wikitext
23127 -{H|span=>sr-ec:script;title=>sr-ec:src}-
23128 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
23129 !! html/php
23130 <p>
23131 <span title="ЛаCтин">ски</span>
23132 </p>
23133 !! html/parsoid
23134 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"span","l":"sr-ec","t":"script"},{"f":"title","l":"sr-ec","t":"src"}]}'/>
23135 <span title="Latin" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"La&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}&#39;>&lt;/span>tin"}]]}'>ski</span></p>
23136 !! end
23137
23138 !! test
23139 Explicit session-wise two-way language variant mapping (A flag and - flag)
23140 !! options
23141 language=zh variant=zh-tw
23142 !! wikitext
23143 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
23144
23145 Taiwan is not China.
23146
23147 But -{A|zh:China; zh-tw:Taiwan}- is China,
23148
23149 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
23150
23151 and -{China}- is China.
23152 !! html/php
23153 <p>This is Taiwan, but we'll forget that now.
23154 </p><p>Taiwan is not China.
23155 </p><p>But Taiwan is Taiwan,
23156 </p><p>(This should be stripped!)
23157 </p><p>and China is China.
23158 </p>
23159 !! html/parsoid
23160 <p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p>
23161 <p>Taiwan is not China.</p>
23162 <p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span> is China,</p>
23163 <p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"remove":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
23164 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
23165 !! end
23166
23167 !! test
23168 Explicit session-wise one-way language variant mapping (A flag and - flag)
23169 !! options
23170 language=zh variant=zh-tw
23171 !! wikitext
23172 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
23173
23174 COUNTRY is China or Taiwan.
23175
23176 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
23177
23178 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23179
23180 and -{COUNTRY}- is COUNTRY.
23181 !! html/php
23182 <p>This is Taiwan, but we'll forget that now.
23183 </p><p>COUNTRY is China or Taiwan.
23184 </p><p>But Taiwan is Taiwan,
23185 </p><p>(This should be stripped!)
23186 </p><p>and COUNTRY is COUNTRY.
23187 </p>
23188 !! html/parsoid
23189 <p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p>
23190 <p>COUNTRY is China or Taiwan.</p>
23191 <p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span> is COUNTRY,</p>
23192 <p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}],"remove":true}'/> should be stripped!)</p>
23193 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
23194 !! end
23195
23196 !! test
23197 Explicit session-wise two-way language variant mapping (H flag for hide)
23198 !! options
23199 language=zh variant=zh-tw
23200 !! wikitext
23201 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
23202
23203 Taiwan is China.
23204 !! html/php
23205 <p>(This should be stripped!)
23206 </p><p>Taiwan is Taiwan.
23207 </p>
23208 !! html/parsoid
23209 <p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
23210 <p>Taiwan is China.</p>
23211 !! end
23212
23213 !! test
23214 Explicit session-wise one-way language variant mapping (H flag for hide)
23215 !! options
23216 language=zh variant=zh-tw
23217 !! wikitext
23218 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23219
23220 COUNTRY is Taiwan or China.
23221 !! html/php
23222 <p>(This should be stripped!)
23223 </p><p>Taiwan is Taiwan or China.
23224 </p>
23225 !! html/parsoid
23226 <p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
23227 <p>COUNTRY is Taiwan or China.</p>
23228 !! end
23229
23230 ## Note that parsoid test runner does not support 'showtitle' option.
23231 !! test
23232 Adding explicit conversion rule for title (T flag)
23233 !! options
23234 language=zh variant=zh-tw showtitle
23235 !! wikitext
23236 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
23237
23238 Taiwan is China.
23239 !! html/php
23240 Taiwan
23241 <p>Should be stripped!
23242 </p><p>Taiwan is China.
23243 </p>
23244 !! html/parsoid
23245 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23246 <p>Taiwan is China.</p>
23247 !! end
23248
23249 !! test
23250 Code coverage: T combined with H flag
23251 !! options
23252 language=zh variant=zh-tw showtitle
23253 !! wikitext
23254 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
23255
23256 Taiwan is China.
23257 !! html/php
23258 Taiwan
23259 <p>Should be stripped!
23260 </p><p>Taiwan is Taiwan.
23261 </p>
23262 !! html/parsoid
23263 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23264 <p>Taiwan is China.</p>
23265 !! end
23266
23267 !! test
23268 Code coverage: T with no variants
23269 !! options
23270 language=zh variant=zh-tw showtitle
23271 !! wikitext
23272 -{H|zh:China; zh-tw:Taiwan}-
23273 Taiwan is China.-{T|Taiwan is China}-
23274 !! html/php
23275 Taiwan is China
23276 <p>
23277 Taiwan is Taiwan.
23278 </p>
23279 !! html/parsoid
23280 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23281 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
23282 !! end
23283
23284 !! test
23285 Code coverage: rules with no variants
23286 !! options
23287 language=zh variant=zh-tw
23288 !! wikitext
23289 -{H|zh:China; zh-tw:Taiwan}-
23290 Taiwan is China.
23291 -{H|China}-
23292 Taiwan is China.
23293 !! html/php
23294 <p>
23295 Taiwan is Taiwan.
23296
23297 Taiwan is China.
23298 </p>
23299 !! html/parsoid
23300 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23301 Taiwan is China.
23302 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23303 Taiwan is China.</p>
23304 !! end
23305
23306
23307 !! test
23308 Code coverage: D flag for conversion rule
23309 !! options
23310 language=zh variant=zh-tw
23311 !! wikitext
23312 -{D|zh-cn:XA; zh-tw:YA}-
23313 -{A;D|zh-cn:XB; zh-tw:YB}-
23314 -{D;H|zh-cn:XC; zh-tw:YC}-
23315
23316 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23317
23318 -{D|0=>zh-tw:1}-
23319 -{A;D|2=>zh-tw:3}-
23320 -{D;H|4=>zh-tw:5}-
23321
23322 XA XB XC YA YB YC FOO BAR BAT 012345
23323 !! html/php
23324 <p>大陆:XA;台灣:YA;
23325
23326 大陆:XC;台灣:YC;
23327 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23328 </p><p>0⇒台灣:1;
23329
23330 4⇒台灣:5;
23331 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23332 </p>
23333 !! html/parsoid
23334 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23335 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23336 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23337 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"FOO","l":"zh-tw","t":"BAR"},{"f":"FOO","l":"zh-cn","t":"BAT"}]}'></span></p>
23338 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23339 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23340 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23341 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23342 !! end
23343
23344 !! test
23345 Code coverage: N flag for conversion rule
23346 !! options
23347 language=zh variant=zh-cn
23348 !! wikitext
23349 -{N|zh-cn}-
23350
23351 -{N|zh-tw}-
23352
23353 -{N|sr-ec}-
23354 !! html/php
23355 <p>大陆
23356 </p><p>台灣
23357 </p><p>српски (ћирилица)‎
23358 </p>
23359 !! html/parsoid
23360 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23361 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23362 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23363 !! end
23364
23365 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23366 !! test
23367 Code coverage: N flag for conversion rule (wt2html only)
23368 !! options
23369 language=zh variant=zh-cn
23370 parsoid=wt2html,html2html
23371 !! wikitext
23372 -{D;N|en}-
23373 !! html/php
23374 <p>English
23375 </p>
23376 !! html/parsoid
23377 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23378 !! end
23379
23380 !! test
23381 Testing that changing the language variant here in the tests actually works
23382 !! options
23383 language=zh variant=zh showtitle
23384 !! wikitext
23385 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23386 !! html/php
23387 China
23388 <p>Should be stripped!
23389 </p>
23390 !! html/parsoid
23391 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23392 !! end
23393
23394 !! test
23395 Recursive conversion of alt and title attrs shouldn't clear converter state
23396 !! options
23397 language=zh variant=zh-cn
23398 showtitle
23399 !! wikitext
23400 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23401 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23402 !! html/php
23403 China
23404 <p>
23405 Should be stripped<span title="Exclamation">!</span>
23406 </p>
23407 !! html/parsoid
23408 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23409 Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/><span title="exclamation">!</span></p>
23410 !! end
23411
23412 !! test
23413 T26072: more test on conversion rule for title
23414 !! options
23415 language=zh variant=zh-tw showtitle
23416 !! wikitext
23417 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23418
23419 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23420 !! html/php
23421 Taiwan
23422 <p>This should be stripped!
23423 </p><p>This won't take interferes with the title rule.
23424 </p>
23425 !! html/parsoid
23426 <p>This should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23427 <p>This won't take interferes with the title rule<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"Beijing"},{"l":"zh-tw","t":"Taipei"}]}'/>.</p>
23428 !! end
23429
23430 !! test
23431 Partly disable title conversion if variant == main language code
23432 !! options
23433 language=zh variant=zh title=[[ZH]] showtitle
23434 !! wikitext
23435 -{T|zh-cn:CN;zh-tw:TW}-
23436 !! html/php
23437 ZH
23438 <p>
23439 </p>
23440 !! html/parsoid
23441 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"CN"},{"l":"zh-tw","t":"TW"}]}'/></p>
23442 !! end
23443
23444 !! test
23445 Partly disable title conversion if variant == main language code, more
23446 !! options
23447 language=zh variant=zh title=[[ZH]] showtitle
23448 !! wikitext
23449 -{T|TW}-
23450 !! html/php
23451 ZH
23452 <p>
23453 </p>
23454 !! html/parsoid
23455 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23456 !! end
23457
23458 !! test
23459 Raw output of variant escape tags (R flag)
23460 !! options
23461 language=zh variant=zh-tw
23462 !! wikitext
23463 Raw: -{R|zh:China;zh-tw:Taiwan}-
23464 !! html/php
23465 <p>Raw: zh:China;zh-tw:Taiwan
23466 </p>
23467 !! html/parsoid
23468 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23469 !! end
23470
23471 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23472 !! test
23473 Raw output of variant escape tags (R flag) (wt2html only)
23474 !! options
23475 language=zh variant=zh-tw
23476 parsoid=wt2html,html2html
23477 !! wikitext
23478 -{Variant}- -{D|syntax}- -{D;R|options}-
23479 !! html/php
23480 <p>Variant syntax options
23481 </p>
23482 !! html/parsoid
23483 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Variant"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"syntax"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"options"}}'></span></p>
23484 !! end
23485
23486 !! test
23487 Nested markup inside raw output of variant escape tags (R flag)
23488 !! options
23489 language=zh variant=zh-tw
23490 !! wikitext
23491 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23492 !! html/php
23493 <p>Nested raw: nested Taiwan nested
23494 </p>
23495 !! html/parsoid
23496 <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}&#39;>&lt;/span> nested"}}'></span></p>
23497 !! end
23498
23499 !! test
23500 Nested markup and spaces inside raw output of variant escape tags (R flag)
23501 !! options
23502 language=zh variant=zh-tw
23503 !! wikitext
23504 X-{ outer -{ inner }- outer }-X
23505 !! html/php
23506 <p>X outer inner outer X
23507 </p>
23508 !! html/parsoid
23509 <p>X<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":" outer &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\" inner \"}}&#39; data-parsoid=&#39;{\"fl\":[],\"dsr\":[10,21,null,2]}&#39;>&lt;/span> outer "}}'></span>X</p>
23510 !! end
23511
23512 !! test
23513 Templates inside raw output of variant escape tags (R flag)
23514 !! options
23515 language=zh variant=zh-tw
23516 !! wikitext
23517 Nested raw: -{R|nested {{echo|hi}} templates}-
23518 !! html/php
23519 <p>Nested raw: nested hi templates
23520 </p>
23521 !! html/parsoid
23522 <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested &lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[23,34,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span> templates"}}'></span></p>
23523 !! end
23524
23525 !! test
23526 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23527 !! options
23528 language=zh variant=zh-cn
23529 !! wikitext
23530 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23531 !! html/php
23532 <p>0
23533 </p>
23534 !! html/parsoid
23535 <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[12]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"0"},{"l":"zh-sg","t":"1"},{"l":"zh-tw","t":"2"},{"l":"zh-hk","t":"3"}]}'></span></p>
23536 !! end
23537
23538 !! test
23539 Conversion rules from [numeric-only string] to [something else] (T48634)
23540 !! options
23541 language=zh variant=zh-cn
23542 !! wikitext
23543 -{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
23544 !! html/php
23545 <p>D12345EE12345
23546 </p>
23547 !! html/parsoid
23548 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"B"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"C"},{"f":"0","l":"zh-cn","t":"D"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-hans","t":"A"}]}'/>012345<span typeof="mw:LanguageVariant" data-parsoid='{"fl":["A"],"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"0"},{"l":"zh-cn","t":"E"}]}'></span>012345</p>
23549 !! end
23550
23551 !! test
23552 Two-way converter rule entries with an empty value should be ignored (T53551)
23553 !! options
23554 language=zh variant=zh-cn
23555 !! wikitext
23556 -{H|zh-cn:foo;zh-tw:;}-foobar
23557 !! html/php
23558 <p>foobar
23559 </p>
23560 !! html/parsoid
23561 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"foo"},{"l":"zh-tw","t":""}]}'/>foobar</p>
23562 !! end
23563
23564 !! test
23565 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23566 !! options
23567 language=zh variant=zh-cn
23568 !! wikitext
23569 -{H|=>zh-cn:foo;}-foobar
23570 !! html/php
23571 <p>foobar
23572 </p>
23573 !! html/parsoid
23574 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23575 !! end
23576
23577 !! test
23578 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23579 !! options
23580 language=zh variant=zh-cn
23581 !! wikitext
23582 -{H|}-foobar
23583 !! html/php
23584 <p>foobar
23585 </p>
23586 !! html/parsoid
23587 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23588 !! end
23589
23590 !! test
23591 Nested using of manual convert syntax
23592 !! options
23593 language=zh variant=zh-hk
23594 !! wikitext
23595 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23596 !! html/php
23597 <p>Nested: Hello Hong Kong!
23598 </p>
23599 !! html/parsoid
23600 <p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,2,2]}&apos;>&lt;/span>"},{"l":"zh-hant","t":"Hello &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,2,2]}&amp;apos;>&amp;lt;/span> K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,2,2]}&amp;apos;>&amp;lt;/span>ong\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,2,2]}&apos;>&lt;/span>"}]}'></span>!</p>
23601 !! end
23602
23603 !! test
23604 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23605 !! options
23606 language=zh variant=zh-cn
23607 !! wikitext
23608 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23609 !! html/php
23610 <p><span title="X">A</span>
23611 </p>
23612 !! html/parsoid
23613 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,2,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
23614 !! end
23615
23616 !! test
23617 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23618 !! options
23619 language=zh variant=zh-cn
23620 !! wikitext
23621 -{<span title="-{X}-">A</span>}-
23622 !! html/php+disabled
23623 <p><span title="X">A</span>
23624 </p>
23625 !! html/parsoid
23626 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,2,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
23627 !! end
23628
23629 # Parsoid and PHP disagree on how to parse this example: Parsoid
23630 # insists that the content of a language converter element be a valid
23631 # DOM fragment or attribute string
23632 !! test
23633 Language converter markup with block content
23634 !! options
23635 language=zh variant=zh-cn
23636 !! wikitext
23637 <span>a-{b<div>c}-d
23638
23639 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23640
23641 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23642 !! html/php+tidy
23643 <span>ab<div>cd
23644 <span>ab<div>cd
23645 <span>ad</span></div></span></div></span>
23646 !! html/parsoid
23647 <span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b&lt;div data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}&apos;>c&lt;/div>"}}'></div>d
23648
23649 <span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&apos;>c&lt;/div>"}}'></div>d
23650
23651 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"x&lt;span data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&apos;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div data-parsoid=&apos;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&apos;>c&lt;/div>"}]}'/>d</span></p></span></span>
23652 !! end
23653
23654 !! test
23655 LanguageConverter selser (1)
23656 !! options
23657 language=zh variant=zh-cn
23658 parsoid={
23659 "modes": ["wt2wt", "selser"],
23660 "changes": [
23661 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23662 ]
23663 }
23664 !! wikitext
23665 -{raw}-
23666 !! wikitext/edited
23667 -{edited}-
23668 !! end
23669
23670 !! test
23671 LanguageConverter selser (2)
23672 !! options
23673 language=zh variant=zh-cn
23674 parsoid={
23675 "modes": ["wt2wt", "selser"],
23676 "changes": [
23677 ["span[class='x']", "contents", "text", "-{foo}-"],
23678 ["a", "contents", "text", "-{"],
23679 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23680 ]
23681 }
23682 !! wikitext
23683 <span class="x">TEXT1</span>
23684 [http://example.com TEXT2]
23685 [[Foo|TEXT3]]
23686 {{echo|TEXT4}}
23687 !! wikitext/edited
23688 <span class="x"><nowiki>-{foo}-</nowiki></span>
23689 [http://example.com -{]
23690 [[Foo|<nowiki>-{</nowiki>]]
23691 {{1x|<nowiki>-{</nowiki>}}
23692 !! end
23693
23694 # Tests LanguageVariantText in ConstrainedText
23695 !! test
23696 LanguageConverter selser (3)
23697 !! options
23698 language=zh variant=zh-cn
23699 parsoid={
23700 "modes": ["wt2wt", "selser"],
23701 "changes": [
23702 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23703 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23704 ]
23705 }
23706 !! wikitext
23707 {|
23708 |-
23709 |<span>Foo</span>
23710 |}
23711 !! wikitext/edited
23712 {|
23713 |-
23714 |<nowiki/>-{edited}-
23715 |}
23716 !! end
23717
23718 # Tests LanguageVariantText._fromSelSer
23719 !! test
23720 LanguageConverter selser (4)
23721 !! options
23722 language=zh variant=zh-cn
23723 parsoid={
23724 "modes": ["wt2wt", "selser"],
23725 "changes": [
23726 ["td > span.x", "remove"]
23727 ]
23728 }
23729 !! wikitext
23730 {|
23731 |-
23732 |<span class="x">Foo</span>-{Bar}-
23733 ||<span class="x">Foo</span>-{Bar}-
23734 |}
23735 !! wikitext/edited
23736 {|
23737 |-
23738 |<nowiki/>-{Bar}-
23739 ||-{Bar}-
23740 |}
23741 !! end
23742
23743 # Since Parsoid is starting to emit canonical wikitext for links,
23744 # [http://example.com http://example.com] will not RT back to that
23745 # form anymore.
23746 # Parsoid does not language-convert links (it is done in a
23747 # post-processing step)
23748 !! test
23749 Proper conversion of text in external links
23750 !! options
23751 language=sr variant=sr-ec
23752 parsoid=wt2html
23753 !! wikitext
23754 http://www.google.com
23755 gopher://www.google.com
23756 [http://www.google.com http://www.google.com]
23757 [gopher://www.google.com gopher://www.google.com]
23758 [https://www.google.com irc://www.google.com]
23759 [ftp://www.google.com www.google.com/ftp://dir]
23760 [//www.google.com www.google.com]
23761 !! html/php
23762 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23763 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23764 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23765 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23766 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23767 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23768 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23769 </p>
23770 !! html/parsoid
23771 <p><a rel="mw:ExtLink" href="http://www.google.com" class="external free">http://www.google.com</a>
23772 <a rel="mw:ExtLink" href="gopher://www.google.com" class="external free">gopher://www.google.com</a>
23773 <a rel="mw:ExtLink" href="http://www.google.com" class="external text">http://www.google.com</a>
23774 <a rel="mw:ExtLink" href="gopher://www.google.com" class="external text">gopher://www.google.com</a>
23775 <a rel="mw:ExtLink" href="https://www.google.com" class="external text">irc://www.google.com</a>
23776 <a rel="mw:ExtLink" href="ftp://www.google.com" class="external text">www.google.com/ftp://dir</a>
23777 <a rel="mw:ExtLink" href="//www.google.com" class="external text">www.google.com</a></p>
23778 !! end
23779
23780 !! test
23781 Do not convert roman numbers to language variants
23782 !! options
23783 language=sr variant=sr-ec
23784 !! wikitext
23785 Fridrih IV je car.
23786 !! html/php
23787 <p>Фридрих IV је цар.
23788 </p>
23789 !! html/parsoid
23790 <p>Fridrih IV je car.</p>
23791 !! end
23792
23793 !! test
23794 Unclosed language converter markup "-{"
23795 !! options
23796 language=sr
23797 !! wikitext
23798 -{T|hello
23799 !! html
23800 <p>-{T|hello
23801 </p>
23802 !! end
23803
23804 !! test
23805 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23806 !! options
23807 language=sr
23808 !! wikitext
23809 -{R|=&gt;}-
23810 !! html/php
23811 <p>=&gt;
23812 </p>
23813 !! html/parsoid
23814 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"=&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;gt;\",\"srcContent\":\">\",\"dsr\":[5,9,null,null]}&#39;>>&lt;/span>"}}'></span></p>
23815 !!end
23816
23817 !! test
23818 Don't break link parsing if language converter markup is in the caption.
23819 !! options
23820 language=sr variant=sr-ec
23821 !! wikitext
23822 [[Main Page|-{R|main page}-]]
23823 !! html/php
23824 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23825 </p>
23826 !! html/parsoid
23827 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"main page"}}' data-parsoid='{"fl":["R"]}'></span></a></p>
23828 !! end
23829
23830 !! test
23831 T146304: Don't break template parsing if language converter markup is in the parameter.
23832 !! options
23833 language=sr variant=sr-ec
23834 !! wikitext
23835 {{echo|-{R|foo}-}}
23836 !! html/php
23837 <p>foo
23838 </p>
23839 !! html/parsoid
23840 <p><span typeof="mw:Transclusion mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo"}}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Шаблон:Echo"},"params":{"1":{"wt":"-{R|foo}-"}},"i":0}}]}'></span></p>
23841 !! end
23842
23843 !! test
23844 T146305: Don't break image parsing if language converter markup is in the caption.
23845 !! options
23846 language=sr
23847 !! wikitext
23848 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23849 !! html/php
23850 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" 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/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећајте"></a></div>caption:</div></div></div>
23851 !! html/parsoid
23852 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a href="./Датотека:Foobar.jpg"><img resource="./Датотека: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><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"caption:"}}' data-parsoid='{"fl":["R"]}'></span></figcaption></figure>
23853 !! end
23854
23855 !! test
23856 T146305: Don't break image parsing if nested language converter markup is in the caption.
23857 !! options
23858 language=zh variant=zh-cn
23859 !! wikitext
23860 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23861 !! html/php
23862 <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" decoding="async" 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="放大"></a></div>blog (hk: WEBJOURNAL, tw: WEBLOG)</div></div></div>
23863 !! html/parsoid
23864 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"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><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBJOURNAL\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[43,65,null,2]}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBLOG\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[71,89,null,2]}&#39;>&lt;/span>)"}]}'></span></figcaption></figure>
23865 !! end
23866
23867 # XXX html2wt disabled because rich markup in alt is not preserved.
23868 !! test
23869 Don't break gallery if language converter markup is inside.
23870 !! options
23871 language=zh
23872 parsoid=wt2html,html2html
23873 !! wikitext
23874 <gallery>
23875 File:Foobar.jpg|alt=-{R|bat}-|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]
23876 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=-{R|param}-}}
23877 </gallery>
23878 !! html/php
23879 <ul class="gallery mw-gallery-traditional">
23880 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23881 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="bat" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" decoding="async" 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>
23882 <div class="gallerytext">
23883 <p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" decoding="async" 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>
23884 </p>
23885 </div>
23886 </div></li>
23887 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23888 <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" decoding="async" 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>
23889 <div class="gallerytext">
23890 <p>This is a test template
23891 </p>
23892 </div>
23893 </div></li>
23894 </ul>
23895 !! html/parsoid
23896 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
23897 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image mw:ExpandedAttrs" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"bat\"}}&apos; data-parsoid=&apos;{\"fl\":[\"R\"],\"dsr\":[84,93,null,2]}&apos;>&lt;/span>","txt":""}]]}'><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["alt",{"html":"alt=&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"foo\"}}&apos; data-parsoid=&apos;{\"fl\":[\"R\"],\"dsr\":[58,67,null,2]}&apos;>&lt;/span>","txt":""}]],"caption":"&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"disabled\":{\"t\":\"bar\"}}&apos; data-parsoid=&apos;{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}&apos;>&lt;/span>"}'><a href="./File:Foobar.jpg"><img alt="" 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></figure-inline></div></li>
23898 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"-{R|param}-"}},"i":0}}]}'>This is a test template</span></div></li>
23899 </ul>
23900 !! end
23901
23902 !! test
23903 T153135: Don't break list handling if language converter markup is in the item.
23904 !! options
23905 language=zh variant=zh-cn
23906 !! wikitext
23907 ;-{zh-cn:AAA;zh-tw:BBB}-
23908 ;-{R|foo:bar}-
23909 !! html/php
23910 <dl><dt>AAA</dt>
23911 <dt>foo:bar</dt></dl>
23912 !! html/parsoid
23913 <dl><dt data-parsoid='{"dsr":[0,24,1,0]}'><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}]}'></span></dt>
23914 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23915 </dl>
23916 !! end
23917
23918 // Note that parsoid does not protect colons unless language converter
23919 // markup is properly nested, because it is a backtracking parser.
23920 !! test
23921 T153135: Unclosed markup in definition list (code coverage)
23922 !! options
23923 language=zh variant=zh-cn
23924 !! wikitext
23925 ;<b>foo:bar
23926 ;-{zh-cn:AAA
23927 !! html/php+tidy
23928 <dl><dt><b>foo:bar</b></dt><b>
23929 <dt>-{zh-cn:AAA</dt></b></dl>
23930 !! html/parsoid
23931 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23932 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23933 !! end
23934
23935 !! test
23936 T153135: Nested language converter markup in definition list (code coverage)
23937 !! options
23938 language=zh variant=zh-cn
23939 !! wikitext
23940 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23941 !! html/php
23942 <dl><dt>AAA foo:bar bat:baz</dt>
23943 <dd>def</dd></dl>
23944 !! html/parsoid
23945 <dl><dt data-parsoid='{"dsr":[0,49,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bat:baz\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}&#39;>&lt;/span>"}]}'></span></dt>
23946 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23947 </dl>
23948 !! end
23949
23950 # html2wt mode disabled due to <nowiki> insertion.
23951 !! test
23952 T153140: Don't break table handling if language converter markup is in the cell.
23953 !! options
23954 language=sr variant=sr-ec
23955 parsoid=wt2html,wt2wt,html2html
23956 !! wikitext
23957 {|
23958 |-
23959 | -{R|B}-
23960 |}
23961 !! html/php
23962 <table>
23963
23964 <tr>
23965 <td>B
23966 </td></tr></table>
23967 !! html/parsoid
23968 <table>
23969 <tbody>
23970 <tr>
23971 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23972 </tr>
23973 </tbody>
23974 </table>
23975 !! end
23976
23977 !! test
23978 Language converter tricky html2wt cases (1)
23979 !! options
23980 language=sr
23981 parsoid=html2wt,wt2wt
23982 !! html/parsoid
23983 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23984 !! wikitext
23985 -{<nowiki>}-</nowiki>}-
23986 !! html/php
23987 <p>&#125;-
23988 </p>
23989 !! end
23990
23991 !! test
23992 Language converter tricky html2wt cases (2)
23993 !! options
23994 language=sr
23995 parsoid=html2wt,wt2wt
23996 !! html/parsoid
23997 <p>-{foo}-</p>
23998 !! wikitext
23999 <nowiki>-{foo}-</nowiki>
24000 !! html/php
24001 <p>-&#123;foo&#125;-
24002 </p>
24003 !! end
24004
24005 !! test
24006 Language converter tricky html2wt cases (3)
24007 !! options
24008 language=sr
24009 parsoid=html2wt,wt2wt
24010 !! html/parsoid
24011 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
24012 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
24013 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
24014 !! wikitext
24015 -{R||}-
24016
24017 -{R|R|raw}-
24018
24019 -{<nowiki>-{foo}-</nowiki>}-
24020 !! html/php
24021 <p>|
24022 </p><p>R|raw
24023 </p><p>-&#123;foo&#125;-
24024 </p>
24025 !! end
24026
24027 !! test
24028 Language converter tricky html2wt cases (4)
24029 !! options
24030 language=sr
24031 parsoid=html2wt,wt2wt
24032 !! html/parsoid
24033 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hey\"}},\"i\":0}}]}&#39;>hey&lt;/span>"}}'></span></p>
24034 !! wikitext
24035 -{R|{{echo|hey}}}-
24036 !! html/php
24037 <p>hey
24038 </p>
24039 !! end
24040
24041 # Note that the <nowiki> escaping added by parsoid for source text,
24042 # destination text, and language names only works on the PHP side
24043 # for *destination text*. (HTML entity escaping wouldn't work
24044 # any better.) This is probably a bug, at least for source texts.
24045 # (For language names PHP uses a precise regexp based on the languages
24046 # it currently knows have variants, which is fragile since this set
24047 # can grow/shrink over time.)
24048 !! test
24049 Language converter tricky html2wt cases (5)
24050 !! options
24051 language=zh variant=zh-cn
24052 !! html/parsoid
24053 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"a:b=>c","l":"zh-cn","t":"x;foo=>zh-cn:boo"},{"f":"bar","l":"zh-cn","t":"bat;xyz=>zh-cn:abc"}]}'/>foobar</p>
24054 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
24055 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"xyz"},{"l":"zh-cn","t":"0;zh-tw:bar"}]}'></span></p>
24056 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
24057 <p>a:b=>c xyz</p>
24058 !! wikitext
24059 -{H|<nowiki>a:b=>c</nowiki>=>zh-cn:<nowiki>x;foo=>zh-cn:boo</nowiki>;bar=>zh-cn:<nowiki>bat;xyz=>zh-cn:abc</nowiki>}-foobar
24060
24061 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
24062
24063 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
24064
24065 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
24066
24067 a:b=>c xyz
24068 !! html/php+disabled
24069 <p>foobat;xyz=&gt;zh-cn:abc
24070 </p><p>A
24071 </p><p>0;zh-tw:bar
24072 </p><p>abc
24073 </p><p>a:b=&gt;c 0;zh-tw:bar
24074 </p>
24075 !! end
24076
24077 !! test
24078 T179579: Nowiki and lc interaction
24079 !! options
24080 parsoid=wt2html
24081 language=sr
24082 !! wikitext
24083 -{</nowiki>123}-
24084
24085 -{123<nowiki>|</nowiki>456}-
24086 !! html/parsoid
24087 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
24088
24089 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"123&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[23,41,8,9]}&#39;>|&lt;/span>456"}}' data-parsoid='{"fl":[],"src":"-{123&lt;nowiki>|&lt;/nowiki>456}-"}'></span></p>
24090 !! end
24091
24092 !! test
24093 T2529: Uncovered bullet
24094 !! wikitext
24095 *Foo {{bullet}}
24096 !! html
24097 <ul><li>Foo</li>
24098 <li>Bar</li></ul>
24099 !! end
24100
24101 !! test
24102 T2529: Uncovered bullet in a deeply nested list
24103 !! wikitext
24104 *******Foo {{bullet}}
24105 !! html
24106 <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>
24107 <li>Bar</li></ul>
24108 !! end
24109
24110 !! test
24111 T2529: Uncovered table already at line-start
24112 !! wikitext
24113 x
24114
24115 {{table}}
24116 y
24117 !! html
24118 <p>x
24119 </p>
24120 <table>
24121 <tr>
24122 <td>1</td>
24123 <td>2
24124 </td></tr>
24125 <tr>
24126 <td>3</td>
24127 <td>4
24128 </td></tr></table>
24129 <p>y
24130 </p>
24131 !! end
24132
24133 !! test
24134 T2529: Uncovered bullet in parser function result
24135 !! wikitext
24136 *Foo {{lc:{{bullet}} }}
24137 !! html
24138 <ul><li>Foo</li>
24139 <li>bar</li></ul>
24140 !! end
24141
24142 !! test
24143 T7678: Double-parsed template argument
24144 !! wikitext
24145 {{lc:{{{1}}}|hello}}
24146 !! html
24147 <p>{{{1}}}
24148 </p>
24149 !! end
24150
24151 !! test
24152 T7678: Double-parsed template invocation
24153 !! wikitext
24154 {{lc:{{paramtest {{!}} param = hello }} }}
24155 !! html
24156 <p>{{paramtest | param = hello }}
24157 </p>
24158 !! end
24159
24160 !! test
24161 Case insensitivity of parser functions for non-ASCII characters (T10143)
24162 !! options
24163 language=cs
24164 title=[[Main Page]]
24165 !! wikitext
24166 {{PRVNÍVELKÉ:ěščř}}
24167 {{prvnívelké:ěščř}}
24168 {{PRVNÍMALÉ:ěščř}}
24169 {{prvnímalé:ěščř}}
24170 {{MALÁ:ěščř}}
24171 {{malá:ěščř}}
24172 {{VELKÁ:ěščř}}
24173 {{velká:ěščř}}
24174 !! html
24175 <p>Ěščř
24176 Ěščř
24177 ěščř
24178 ěščř
24179 ěščř
24180 ěščř
24181 ĚŠČŘ
24182 ĚŠČŘ
24183 </p>
24184 !! end
24185
24186 !! test
24187 Morwen/13: Unclosed link followed by heading
24188 !! wikitext
24189 [[link
24190 ==heading==
24191 !! html
24192 <p>[[link
24193 </p>
24194 <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>
24195 !! end
24196
24197 !! test
24198 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
24199 !! wikitext
24200 {{foo|
24201 =heading=
24202 !! html
24203 <p>{{foo|
24204 </p>
24205 <h1><span class="mw-headline" id="heading">heading</span></h1>
24206 !! end
24207
24208 !! test
24209 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
24210 !! wikitext
24211 {{foo|
24212 ==heading==
24213 !! html
24214 <p>{{foo|
24215 </p>
24216 <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>
24217 !! end
24218
24219 !! test
24220 Tildes in comments
24221 !! options
24222 pst
24223 !! wikitext
24224 <!-- ~~~~ -->
24225 !! html/php
24226 <!-- ~~~~ -->
24227 !! end
24228
24229 !! test
24230 Paragraphs inside divs (no extra line breaks)
24231 !! wikitext
24232 <div>Line one
24233
24234 Line two</div>
24235 !! html
24236 <div>Line one
24237 Line two</div>
24238 !! end
24239
24240 !! test
24241 Paragraphs inside divs (extra line break on open)
24242 !! wikitext
24243 <div>
24244 Line one
24245
24246 Line two</div>
24247 !! html
24248 <div>
24249 <p>Line one
24250 </p>
24251 Line two</div>
24252 !! end
24253
24254 !! test
24255 Paragraphs inside divs (extra line break on close)
24256 !! wikitext
24257 <div>Line one
24258
24259 Line two
24260 </div>
24261 !! html
24262 <div>Line one
24263 <p>Line two
24264 </p>
24265 </div>
24266 !! end
24267
24268 !! test
24269 Paragraphs inside divs (extra line break on open and close)
24270 !! wikitext
24271 <div>
24272 Line one
24273
24274 Line two
24275 </div>
24276 !! html
24277 <div>
24278 <p>Line one
24279 </p><p>Line two
24280 </p>
24281 </div>
24282 !! end
24283
24284 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24285 !! test
24286 Nesting tags, paragraphs on lines which begin with <div>
24287 !! wikitext
24288 <div></div><strong>A
24289 B</strong>
24290 !! html/php+tidy
24291 <div></div><p><strong>A
24292 </strong></p><strong></strong><p><strong>B</strong>
24293 </p>
24294 !! html/parsoid
24295 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24296 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24297 !! end
24298
24299 # T8200: <blockquote> should behave like <div> with respect to line breaks
24300 !! test
24301 T8200: paragraphs inside blockquotes (no extra line breaks)
24302 !! wikitext
24303 <blockquote>Line one
24304
24305 Line two</blockquote>
24306 !! html
24307 <blockquote>Line one
24308 Line two</blockquote>
24309 !! html+tidy
24310 <blockquote><p>Line one
24311 Line two</p></blockquote>
24312 !! end
24313
24314 !! test
24315 T8200: paragraphs inside blockquotes (extra line break on open)
24316 !! wikitext
24317 <blockquote>
24318 Line one
24319
24320 Line two</blockquote>
24321 !! html
24322 <blockquote>
24323 <p>Line one
24324 </p>
24325 Line two</blockquote>
24326 !! html+tidy
24327 <blockquote>
24328 <p>Line one
24329 </p><p>
24330 Line two</p></blockquote>
24331 !! end
24332
24333 !! test
24334 T8200: paragraphs inside blockquotes (extra line break on close)
24335 !! wikitext
24336 <blockquote>Line one
24337
24338 Line two
24339 </blockquote>
24340 !! html
24341 <blockquote>Line one
24342 <p>Line two
24343 </p>
24344 </blockquote>
24345 !! html+tidy
24346 <blockquote><p>Line one
24347 </p><p>Line two
24348 </p>
24349 </blockquote>
24350 !! end
24351
24352 !! test
24353 T8200: paragraphs inside blockquotes (extra line break on open and close)
24354 !! wikitext
24355 <blockquote>
24356 Line one
24357
24358 Line two
24359 </blockquote>
24360 !! html
24361 <blockquote>
24362 <p>Line one
24363 </p><p>Line two
24364 </p>
24365 </blockquote>
24366 !! end
24367
24368 ## This is a corner case interaction between the paragraph wrapping in the
24369 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24370 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24371 ## of which "div" is one, but do p-wrapping inside them. These are referred
24372 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24373 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24374 !! test
24375 Paragraphs inside blockquotes/divs (no extra line breaks)
24376 !! wikitext
24377 <blockquote><div>Line one
24378
24379 Line two</div></blockquote>
24380 !! html
24381 <blockquote><div>Line one
24382 Line two</div></blockquote>
24383 !! end
24384
24385 !! test
24386 Paragraphs inside blockquotes/divs (extra line break on open)
24387 !! wikitext
24388 <blockquote><div>
24389 Line one
24390
24391 Line two</div></blockquote>
24392 !! html
24393 <blockquote><div>
24394 <p>Line one
24395 </p>
24396 Line two</div></blockquote>
24397 !! end
24398
24399 !! test
24400 Paragraphs inside blockquotes/divs (extra line break on close)
24401 !! wikitext
24402 <blockquote><div>Line one
24403
24404 Line two
24405 </div></blockquote>
24406 !! html
24407 <blockquote><div>Line one
24408 <p>Line two
24409 </p>
24410 </div></blockquote>
24411 !! end
24412
24413 !! test
24414 Paragraphs inside blockquotes/divs (extra line break on open and close)
24415 !! wikitext
24416 <blockquote><div>
24417 Line one
24418
24419 Line two
24420 </div></blockquote>
24421 !! html
24422 <blockquote><div>
24423 <p>Line one
24424 </p><p>Line two
24425 </p>
24426 </div></blockquote>
24427 !! end
24428
24429 !! test
24430 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24431 !! options
24432 wgLinkHolderBatchSize=0
24433 !! wikitext
24434 [[meatball:1]]
24435 [[meatball:2]]
24436 [[meatball:3]]
24437 !! html
24438 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24439 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24440 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24441 </p>
24442 !! end
24443
24444 !! test
24445 Free external link invading image caption
24446 !! wikitext
24447 [[Image:Foobar.jpg|thumb|http://x|hello]]
24448 !! html/php
24449 <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" decoding="async" 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>
24450 !! html/parsoid
24451 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"bogus","ak":"http://x"},{"ck":"caption","ak":"hello"}]}'><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":"Image:Foobar.jpg"}}'/></a><figcaption>hello</figcaption></figure>
24452 !! end
24453
24454 !! test
24455 T17196: localised external link numbers
24456 !! options
24457 language=fa
24458 !! wikitext
24459 [http://en.wikipedia.org/]
24460 !! html/php
24461 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24462 </p>
24463 !! html/parsoid
24464 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/" class="external autonumber"></a></p>
24465 !! end
24466
24467 !! test
24468 Multibyte character in padleft
24469 !! wikitext
24470 {{padleft:-Hello|7|Æ}}
24471 !! html/php
24472 <p>Æ-Hello
24473 </p>
24474 !! html/parsoid
24475 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24476 !! end
24477
24478 !! test
24479 Multibyte character in padright
24480 !! wikitext
24481 {{padright:Hello-|7|Æ}}
24482 !! html/php
24483 <p>Hello-Æ
24484 </p>
24485 !! html/parsoid
24486 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24487 !! end
24488
24489 !!test
24490 formatdate parser function
24491 !! wikitext
24492 {{#formatdate:2009-03-24}}
24493 !! html
24494 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24495 </p>
24496 !! end
24497
24498 !!test
24499 formatdate parser function, with default format
24500 !! wikitext
24501 {{#formatdate:2009-03-24|mdy}}
24502 !! html
24503 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24504 </p>
24505 !! end
24506
24507 !! test
24508 Spacing of numbers in formatted dates
24509 !! wikitext
24510 {{#formatdate:January 15}}
24511 !! html
24512 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24513 </p>
24514 !! end
24515
24516 !! test
24517 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
24518 !! options
24519 language=nl title=[[MediaWiki:Common.css]]
24520 !! wikitext
24521 {{#formatdate:2009-03-24|dmy}}
24522 !! html
24523 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24524 </p>
24525 !! end
24526
24527 !! test
24528 formatdate with invalid month
24529 !! wikitext
24530 {{#formatdate:2019-22-22|dmy}}
24531 !! html
24532 <p>2019-22-22
24533 </p>
24534 !! end
24535
24536 !! test
24537 formatdate: dots in month name do not match any char (T220563)
24538 !! options
24539 language=de
24540 !! wikitext
24541 {{#formatdate:jun. 3|dmy}}
24542 {{#formatdate:junx 3|dmy}}
24543 !! html
24544 <p><span class="mw-formatted-date" title="06-03">3 Juni</span>
24545 junx 3
24546 </p>
24547 !! end
24548
24549 !! test
24550 formatdate uses correct capitalisation in French
24551 !! options
24552 language=fr
24553 !! wikitext
24554 {{#formatdate:Juin 3|dmy}}
24555 !! html
24556 <p><span class="mw-formatted-date" title="06-03">3 juin</span>
24557 </p>
24558 !! end
24559
24560 !! test
24561 formatdate uses correct capitalisation in English
24562 !! wikitext
24563 {{#formatdate:june 3|dmy}}
24564 !! html
24565 <p><span class="mw-formatted-date" title="06-03">3 June</span>
24566 </p>
24567 !! end
24568
24569
24570 #
24571 #
24572 #
24573
24574 #
24575 # Edit comments
24576 #
24577
24578 !! test
24579 Edit comment with link
24580 !! options
24581 comment
24582 !! wikitext
24583 I like the [[Main Page]] a lot
24584 !! html/php
24585 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24586 !!end
24587
24588 !! test
24589 Edit comment with link and link text
24590 !! options
24591 comment
24592 !! wikitext
24593 I like the [[Main Page|best pages]] a lot
24594 !! html/php
24595 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24596 !!end
24597
24598 !! test
24599 Edit comment with link and link text with suffix
24600 !! options
24601 comment
24602 !! wikitext
24603 I like the [[Main Page|best page]]s a lot
24604 !! html/php
24605 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24606 !!end
24607
24608 !! test
24609 Edit comment with section link (non-local, eg in history list)
24610 !! options
24611 comment title=[[Main Page]]
24612 !! wikitext
24613 /* External links */ removed bogus entries
24614 !! html/php
24615 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→‎External links</a>: </span> removed bogus entries</span>
24616 !!end
24617
24618 !! test
24619 Edit comment with section link and text before it (non-local, eg in history list)
24620 !! options
24621 comment title=[[Main Page]]
24622 !! wikitext
24623 pre-comment text /* External links */ removed bogus entries
24624 !! html/php
24625 pre-comment text <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→‎External links</a>: </span> removed bogus entries</span>
24626 !!end
24627
24628 !! test
24629 Edit comment with section link (local, eg in diff view)
24630 !! options
24631 comment local title=[[Main Page]]
24632 !! wikitext
24633 /* External links */ removed bogus entries
24634 !! html/php
24635 <span dir="auto"><span class="autocomment"><a href="#External_links">→‎External links</a>: </span> removed bogus entries</span>
24636 !!end
24637
24638 !! test
24639 Edit comment with section link that has a link in it
24640 !! options
24641 comment local title=[[Main Page]]
24642 !! wikitext
24643 /* [[A link]] */
24644 !! html/php
24645 <span dir="auto"><span class="autocomment"><a href="#A_link">→‎&#91;[A link]]</a></span></span>
24646 !! end
24647
24648 !! test
24649 Edit comment with section link that has a template in it
24650 !! options
24651 comment local title=[[Main Page]]
24652 !! wikitext
24653 /* {{foobar|param}} */
24654 !! html/php
24655 <span dir="auto"><span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→‎{{foobar|param}}</a></span></span>
24656 !! end
24657
24658 !! test
24659 Edit comment with subpage link (T16080)
24660 !! options
24661 comment
24662 subpage
24663 title=[[Subpage test]]
24664 !! wikitext
24665 Poked at a [[/subpage]] here...
24666 !! html/php
24667 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24668 !!end
24669
24670 !! test
24671 Edit comment with subpage link and link text (T16080)
24672 !! options
24673 comment
24674 subpage
24675 title=[[Subpage test]]
24676 !! wikitext
24677 Poked at a [[/subpage|neat little page]] here...
24678 !! html/php
24679 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24680 !!end
24681
24682 !! test
24683 Edit comment with bogus subpage link in non-subpage NS (T16080)
24684 !! options
24685 comment
24686 title=[[Subpage test]]
24687 !! wikitext
24688 Poked at a [[/subpage]] here...
24689 !! html/php
24690 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...
24691 !!end
24692
24693 !! test
24694 Edit comment with bare anchor link (local, as on diff)
24695 !! options
24696 comment
24697 local
24698 title=[[Main Page]]
24699 !! wikitext
24700 [[#section]]
24701 !! html/php
24702 <a href="#section">#section</a>
24703 !! end
24704
24705 !! test
24706 Edit comment with bare anchor link (non-local, as on history)
24707 !! options
24708 comment
24709 title=[[Main Page]]
24710 !! wikitext
24711 [[#section]]
24712 !! html/php
24713 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24714 !! end
24715
24716 !! test
24717 Anchor starting with underscore
24718 !! options
24719 title=[[Foo]]
24720 !! wikitext
24721 [[#_ref|One]]
24722 !! html/php
24723 <p><a href="#_ref">One</a>
24724 </p>
24725 !! html/parsoid
24726 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24727 !! end
24728
24729 !! test
24730 Id starting with underscore
24731 !! wikitext
24732 <div id="_ref"></div>
24733 !! html/*
24734 <div id="_ref"></div>
24735 !! end
24736
24737 !! test
24738 Edit comment with link with more than one pipe (T99346)
24739 !! options
24740 comment
24741 !! wikitext
24742 [[Main Page|Many|pipes]]
24743 !! html/php
24744 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24745 !! end
24746
24747 !! test
24748 Complex edit comment with link with more than one pipe (T99346)
24749 !! options
24750 comment
24751 !! wikitext
24752 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24753 !! html/php
24754 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
24755 !! end
24756
24757 !! test
24758 Space normalisation on autocomment (T24784)
24759 !! options
24760 comment
24761 title=[[Main Page]]
24762 !! wikitext
24763 /* __hello__world__ */
24764 !! html/php
24765 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→‎__hello__world__</a></span></span>
24766 !! end
24767
24768 !! test
24769 percent-encoding and + signs in comments (T28410)
24770 !! options
24771 comment
24772 !! wikitext
24773 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24774 !! html/php
24775 <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>
24776 !! end
24777
24778 # Parsoid doesn't support this yet: see T75581
24779 # but it *should* omit the 'src' attribute if the image is bad.
24780 # PHP side of tests was disabled in
24781 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24782 # because of issues in the PHP parserTests infrastructure
24783 # (but the output below is indeed what the PHP side emits)
24784 !! test
24785 Bad images - basic functionality
24786 !! wikitext
24787 [[File:Bad.jpg]]
24788 !! html/php+disabled
24789 !! html/parsoid
24790 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Bad.jpg"><span resource="./File:Bad.jpg">File:Bad.jpg</span></a></figure-inline></p>
24791 !! end
24792
24793 !! test
24794 Bad images - T18039: text after bad image disappears
24795 !! wikitext
24796 Foo bar
24797 [[File:Bad.jpg]]
24798 Bar foo
24799 !! html/php+disabled
24800 <p>Foo bar
24801 </p><p>Bar foo
24802 </p>
24803 !! html/parsoid
24804 <p>Foo bar
24805 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Bad.jpg"><span resource="./File:Bad.jpg">File:Bad.jpg</span></a></figure-inline>
24806 Bar foo</p>
24807 !! end
24808
24809 !! test
24810 Verify that displaytitle works (T24501) no displaytitle
24811 !! options
24812 showtitle
24813 !! config
24814 wgAllowDisplayTitle=true
24815 wgRestrictDisplayTitle=false
24816 !! wikitext
24817 this is not the the title
24818 !! html/php
24819 Parser test
24820 <p>this is not the the title
24821 </p>
24822 !! end
24823
24824 !! test
24825 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24826 !! options
24827 showtitle
24828 title=[[Screen]]
24829 !! config
24830 wgAllowDisplayTitle=true
24831 wgRestrictDisplayTitle=false
24832 !! wikitext
24833 this is not the the title
24834 {{DISPLAYTITLE:whatever}}
24835 !! html/php
24836 whatever
24837 <p>this is not the the title
24838 </p>
24839 !! end
24840
24841 !! test
24842 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24843 !! options
24844 showtitle
24845 title=[[Screen]]
24846 !! config
24847 wgAllowDisplayTitle=true
24848 wgRestrictDisplayTitle=true
24849 !! wikitext
24850 this is not the the title
24851 {{DISPLAYTITLE:whatever}}
24852 !! html/php
24853 Screen
24854 <p>this is not the the title
24855 </p>
24856 !! end
24857
24858 !! test
24859 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24860 !! options
24861 showtitle
24862 title=[[Screen]]
24863 !! config
24864 wgAllowDisplayTitle=true
24865 wgRestrictDisplayTitle=true
24866 !! wikitext
24867 this is not the the title
24868 {{DISPLAYTITLE:screen}}
24869 !! html/php
24870 screen
24871 <p>this is not the the title
24872 </p>
24873 !! end
24874
24875 !! test
24876 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24877 !! options
24878 showtitle
24879 title=[[Screen]]
24880 !! config
24881 wgAllowDisplayTitle=false
24882 !! wikitext
24883 this is not the the title
24884 {{DISPLAYTITLE:screen}}
24885 !! html/php
24886 Screen
24887 <p>this is not the the title
24888 <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>
24889 </p>
24890 !! end
24891
24892 !! test
24893 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24894 !! options
24895 showtitle
24896 title=[[Screen]]
24897 !! config
24898 wgAllowDisplayTitle=false
24899 !! wikitext
24900 this is not the the title
24901 !! html/php
24902 Screen
24903 <p>this is not the the title
24904 </p>
24905 !! end
24906
24907 !! test
24908 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24909 !! options
24910 showtitle
24911 title=[[Screen]]
24912 !! config
24913 wgAllowDisplayTitle=true
24914 wgRestrictDisplayTitle=true
24915 !! wikitext
24916 this is not the the title
24917 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24918 !! html/php
24919 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24920 <p>this is not the the title
24921 </p>
24922 !! end
24923
24924 !! test
24925 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24926 !! options
24927 showtitle
24928 title=[[Screen]]
24929 !! config
24930 wgAllowDisplayTitle=true
24931 wgRestrictDisplayTitle=true
24932 !! wikitext
24933 this is not the the title
24934 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24935 !! html/php
24936 <span style="color: red;">s</span>creen
24937 <p>this is not the the title
24938 </p>
24939 !! end
24940
24941 !! test
24942 Page status indicators: Empty name is invalid
24943 !! options
24944 showindicators
24945 !! wikitext
24946 <indicator name=" "></indicator>
24947 <indicator></indicator>
24948 !! html/php
24949 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24950 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24951 </p>
24952 !! end
24953
24954 !! test
24955 Page status indicators: Weird syntaxes that are okay
24956 !! options
24957 showindicators
24958 !! wikitext
24959 <indicator name="empty" />
24960 <indicator name="name"></indicator>
24961 !! html/php
24962 empty=
24963 name=
24964 <p><br />
24965 </p>
24966 !! end
24967
24968 !! test
24969 Page status indicators: Torture test
24970 !! options
24971 showindicators
24972 !! wikitext
24973 <indicator name="01">hello world</indicator>
24974 <indicator name="02">[[Main Page]]</indicator>
24975 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24976 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24977 <indicator name="05">*foo
24978 *bar</indicator>
24979 <indicator name="06"><nowiki>foo</nowiki></indicator>
24980 <indicator name="07"> Preformatted</indicator>
24981 <indicator name="08"><div>Broken tag</indicator>
24982 <indicator name="09">{| class=wikitable
24983 |cell
24984 |}</indicator>
24985 <indicator name="10">Two
24986
24987 paragraphs</indicator>
24988 !! html/php
24989 01=hello world
24990 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24991 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" decoding="async" 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" />
24992 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" decoding="async" 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>
24993 05=<ul><li>foo</li>
24994 <li>bar</li></ul>
24995 06=foo
24996 07=<pre>Preformatted
24997 </pre>
24998 08=<div>Broken tag</div>
24999
25000 09=<table class="wikitable">
25001 <tr>
25002 <td>cell
25003 </td></tr></table>
25004 10=<p>Two
25005 </p><p>paragraphs
25006 </p>
25007 <p><br />
25008 </p><p><br />
25009 </p><p><br />
25010 </p><p><br />
25011 </p><p><br />
25012 </p>
25013 !! end
25014
25015 !! test
25016 preload: check <noinclude> and <includeonly>
25017 !! options
25018 preload
25019 !! wikitext
25020 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
25021 !! html/php
25022 Hello kind world.
25023 !! end
25024
25025 !! test
25026 preload: check <onlyinclude>
25027 !! options
25028 preload
25029 !! wikitext
25030 Goodbye <onlyinclude>Hello world</onlyinclude>
25031 !! html/php
25032 Hello world
25033 !! end
25034
25035 !! test
25036 preload: can pass tags through if we want to
25037 !! options
25038 preload
25039 !! wikitext
25040 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
25041 !! html/php
25042 <includeonly>Hello world</includeonly>
25043 !! end
25044
25045 !! test
25046 preload: check that it doesn't try to do tricks
25047 !! options
25048 preload
25049 !! wikitext
25050 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
25051 !! html/php
25052 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
25053 !! end
25054
25055 !! test
25056 Play a bit with r67090 and T5158
25057 !! wikitext
25058 <div style="width:50% !important">&nbsp;</div>
25059 <div style="width:50%&nbsp;!important">&nbsp;</div>
25060 <div style="width:50%&#160;!important">&nbsp;</div>
25061 <div style="border : solid;">&nbsp;</div>
25062 !! html/php
25063 <div style="width:50% !important">&#160;</div>
25064 <div style="width:50% !important">&#160;</div>
25065 <div style="width:50% !important">&#160;</div>
25066 <div style="border&#32;: solid;">&#160;</div>
25067 !! html/parsoid
25068 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
25069 <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>
25070 <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>
25071 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
25072 !! end
25073
25074 !! test
25075 French spaces in wikitext
25076 !! wikitext
25077 foo ! bar ? bat 50 % is less than 75 %.
25078
25079 Hello : this ; is « something ‹ else › again »
25080 !! html
25081 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
25082 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
25083 </p>
25084 !! end
25085
25086 # It would be reasonable for Parsoid and PHP to differ here.
25087 # The PHP behavior is arguably a bug.
25088 !! test
25089 Corner case: french spaces in definition list
25090 !! wikitext
25091 ;foo : bar
25092 !! html+tidy
25093 <dl><dt>foo&#160;</dt>
25094 <dd>bar</dd></dl>
25095 !! end
25096
25097 !! test
25098 T5158: Test for French spaces in attributes
25099 !! wikitext
25100 <br style=" clear : both ; " />
25101 !! html/php
25102 <p><br style="clear&#32;: both&#32;;" />
25103 </p>
25104 !! end
25105
25106 !! test
25107 HTML5 data attributes
25108 !! wikitext
25109 <span data-foo="bar">Baz</span>
25110 <p data-abc-def_hij="">Quuz</p>
25111 !! html/php
25112 <p><span data-foo="bar">Baz</span>
25113 </p>
25114 <p data-abc-def_hij="">Quuz</p>
25115 !! html/parsoid
25116 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
25117 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
25118 !! end
25119
25120 !! test
25121 Strip reserved data attributes
25122 !! wikitext
25123 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-object-id="123" data-ooui="xyzzy" data-bad:ns="ns">d</div>
25124 !! html/php
25125 <div data-ok="fred" data-object-id="123">d</div>
25126 !! html/parsoid
25127 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-x-data-object-id="123" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
25128 !! end
25129
25130 !! test
25131 percent-encoding and + signs in internal links (T28410)
25132 !! wikitext
25133 [[User:+%]] [[Page+title%]]
25134 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
25135 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
25136 [[%33%45]] [[%33%45+]]
25137 !! html/php
25138 <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>
25139 <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>
25140 <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>
25141 <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>
25142 </p>
25143 !! html/parsoid
25144 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
25145 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
25146 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&apos;>bar&lt;/a>","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/%25+abc9"><span resource="./File:%25+abc9" data-parsoid='{"a":{"resource":"./File:%25+abc9"},"sa":{"resource":"File:%+abc%39"}}'>File:%+abc9</span></a></figure-inline>
25147 <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>
25148 !! end
25149
25150 !! test
25151 Special characters in embedded file links (T29679)
25152 !! wikitext
25153 [[File:Contains & ampersand.jpg]]
25154 [[File:Does not exist.jpg|Title with & ampersand]]
25155 !! html/php
25156 <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>
25157 <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>
25158 </p>
25159 !! html/parsoid
25160 <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Contains_&amp;_ampersand.jpg"><span resource="./File:Contains_&amp;_ampersand.jpg" data-parsoid='{"a":{"resource":"./File:Contains_&amp;_ampersand.jpg"},"sa":{"resource":"File:Contains &amp; ampersand.jpg"}}'>File:Contains &amp; ampersand.jpg</span></a></figure-inline>
25161 <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"caption":"Title with &amp;amp; ampersand","errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./Special:FilePath/Does_not_exist.jpg"><span resource="./File:Does_not_exist.jpg" data-parsoid='{"a":{"resource":"./File:Does_not_exist.jpg"},"sa":{"resource":"File:Does not exist.jpg"}}'>File:Does not exist.jpg</span></a></figure-inline></p>
25162 !! end
25163
25164 !! test
25165 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
25166 !! wikitext
25167 Text&apos;s been normalized?
25168 !! html
25169 <p>Text&#39;s been normalized?
25170 </p>
25171 !! end
25172
25173 !! test
25174 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
25175 !! wikitext
25176 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
25177 !! html
25178 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
25179 </p>
25180 !! end
25181
25182 !! test
25183 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
25184 !! wikitext
25185 [http://www.example.org/ ideograms]
25186 !! html
25187 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
25188 </p>
25189 !! end
25190
25191 !! test
25192 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
25193 !! wikitext
25194 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
25195 !! html
25196 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
25197 </p>
25198 !! end
25199
25200 !! article
25201 Mediawiki:loop1
25202 !! text
25203 {{Identical|A}}
25204 !! endarticle
25205
25206 !! article
25207 Mediawiki:loop2
25208 !! text
25209 {{Identical|B}}
25210 !! endarticle
25211
25212 !! article
25213 Template:Identical
25214 !! text
25215 {{int:loop1}}
25216 {{int:loop2}}
25217 !! endarticle
25218
25219 !! test
25220 T33098 Template which includes system messages which includes the template
25221 !! wikitext
25222 {{Identical}}
25223 !! html
25224 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25225 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25226 </p>
25227 !! end
25228
25229 !! test
25230 T33490 Turkish: ucfirst 'blah'
25231 !! options
25232 language=tr
25233 !! wikitext
25234 {{ucfirst:blah}}
25235 !! html
25236 <p>Blah
25237 </p>
25238 !! end
25239
25240 !! test
25241 T33490 Turkish: ucfirst 'ix'
25242 !! options
25243 language=tr
25244 !! wikitext
25245 {{ucfirst:ix}}
25246 !! html
25247 <p>İx
25248 </p>
25249 !! end
25250
25251 !! test
25252 T33490 Turkish: lcfirst 'BLAH'
25253 !! options
25254 language=tr
25255 !! wikitext
25256 {{lcfirst:BLAH}}
25257 !! html
25258 <p>bLAH
25259 </p>
25260 !! end
25261
25262 !! test
25263 T33490 Turkish: ucfırst (with a dotless i)
25264 !! options
25265 language=tr
25266 !! wikitext
25267 {{ucfırst:blah}}
25268 !! html
25269 <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>
25270 </p>
25271 !! end
25272
25273 !! test
25274 T33490 ucfırst (with a dotless i) with English language
25275 !! options
25276 language=en
25277 !! wikitext
25278 {{ucfırst:blah}}
25279 !! html
25280 <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>
25281 </p>
25282 !! end
25283
25284 # Note that Parsoid doesn't emit an explicit TOC.
25285 # Note also that the html2wt direction tends to emit an extra newline
25286 # between the __TOC__ magicword and the first heading unless *both*
25287 # the <meta> and the <h2> have a data-parsoid attribute set (even if
25288 # it's "{}").
25289
25290 !! test
25291 T28375: TOC with italics
25292 !! options
25293 title=[[Main Page]]
25294 !! wikitext
25295 __TOC__
25296 ==''Lost'' episodes==
25297 !! html/php
25298 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25299 <ul>
25300 <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>
25301 </ul>
25302 </div>
25303
25304 <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>
25305 !! html/parsoid
25306 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25307 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
25308 !! end
25309
25310 !! test
25311 T28375: TOC with bold
25312 !! options
25313 title=[[Main Page]]
25314 !! wikitext
25315 __TOC__
25316 =='''should be bold''' then normal text==
25317 !! html/php
25318 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25319 <ul>
25320 <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>
25321 </ul>
25322 </div>
25323
25324 <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>
25325 !! html/parsoid
25326 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25327 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25328 !! end
25329
25330 !! test
25331 T35845: Headings become cursive in TOC when they contain an image
25332 !! options
25333 title=[[Main Page]]
25334 !! wikitext
25335 __TOC__
25336 ==Image [[Image:foobar.jpg]]==
25337 !! html/php
25338 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25339 <ul>
25340 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25341 </ul>
25342 </div>
25343
25344 <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" decoding="async" 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>
25345 !! html/parsoid
25346 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25347 <h2 id="Image" data-parsoid='{}'>Image <figure-inline 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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></h2>
25348 !! end
25349
25350 !! test
25351 T35845 (2): Headings become bold in TOC when they contain a blockquote
25352 !! options
25353 title=[[Main Page]]
25354 !! wikitext
25355 __TOC__
25356 ==<blockquote>Quote</blockquote>==
25357 !! html/php
25358 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25359 <ul>
25360 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25361 </ul>
25362 </div>
25363
25364 <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>
25365 !! html/php+tidy
25366 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25367 <ul>
25368 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25369 </ul>
25370 </div>
25371
25372 <h2><span class="mw-headline" id="Quote"><blockquote><p>Quote</p></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>
25373 !! html/parsoid
25374 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25375 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25376 !! end
25377
25378 !! test
25379 Unclosed tags in TOC
25380 !! config
25381 wgFragmentMode=[ 'html5', 'legacy' ]
25382 !! options
25383 title=[[Main Page]]
25384 !! wikitext
25385 __TOC__
25386 ==Proof: 2 < 3==
25387 <small>Hanc marginis exiguitas non caperet.</small>
25388 QED
25389 !! html/php
25390 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25391 <ul>
25392 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_&lt;_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
25393 </ul>
25394 </div>
25395
25396 <h2><span id="Proof:_2_.3C_3"></span><span class="mw-headline" id="Proof:_2_&lt;_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>
25397 <p><small>Hanc marginis exiguitas non caperet.</small>
25398 QED
25399 </p>
25400 !! html/parsoid
25401 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25402 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25403 <p><small>Hanc marginis exiguitas non caperet.</small>
25404 QED</p>
25405 !! end
25406
25407 !! test
25408 Multiple tags in TOC
25409 !! wikitext
25410 __TOC__
25411 ==<i>Foo</i> <b>Bar</b>==
25412
25413 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25414 !! html/php
25415 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25416 <ul>
25417 <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>
25418 <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>
25419 </ul>
25420 </div>
25421
25422 <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>
25423 <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>
25424 !! html/php+tidy
25425 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25426 <ul>
25427 <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>
25428 <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>
25429 </ul>
25430 </div>
25431
25432 <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>
25433 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote><p>Bar</p></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>
25434 !! html/parsoid
25435 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25436 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25437
25438 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25439 !! end
25440
25441 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25442 # html5 tag parsing.
25443 !! test
25444 Tags with parameters in TOC
25445 !! options
25446 parsoid=wt2html
25447 !! wikitext
25448 __TOC__
25449 ==<sup class="in-h2">Hello</sup>==
25450
25451 ==<sup class="a > b">Evilbye</sup>==
25452 !! html/php
25453 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25454 <ul>
25455 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25456 <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>
25457 </ul>
25458 </div>
25459
25460 <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>
25461 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> 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>
25462 !! html/parsoid
25463 <meta property="mw:PageProp/toc" />
25464 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25465
25466 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25467 !! end
25468
25469 !! test
25470 span tags with directionality in TOC
25471 !! wikitext
25472 __TOC__
25473 ==<span dir="ltr">C++</span>==
25474
25475 ==<span dir="rtl">זבנג!</span>==
25476
25477 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25478
25479 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25480
25481 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25482 !! html/php
25483 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25484 <ul>
25485 <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>
25486 <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>
25487 <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>
25488 <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>
25489 <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>
25490 </ul>
25491 </div>
25492
25493 <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>
25494 <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>
25495 <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>
25496 <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>
25497 <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>
25498 !! html/parsoid
25499 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25500 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25501 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25502 <h2 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></h2>
25503 <h2 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></h2>
25504 <h2 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></h2>
25505 !! end
25506
25507 !! test
25508 T74884: bdi element in ToC
25509 !! wikitext
25510 __TOC__
25511 ==<bdi>test</bdi>==
25512 !! html/php
25513 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25514 <ul>
25515 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25516 </ul>
25517 </div>
25518
25519 <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>
25520 !! html/parsoid
25521 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25522 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25523 !! end
25524
25525 !! test
25526 T35715: s/strike element in ToC
25527 !! wikitext
25528 __TOC__
25529 ==<s>test</s> test <strike>test</strike>==
25530 !! html/php
25531 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25532 <ul>
25533 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
25534 </ul>
25535 </div>
25536
25537 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></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 test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25538 !! html/parsoid
25539 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25540 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25541 !! end
25542
25543 !! test
25544 T198618: style element in ToC
25545 !! options
25546 styletag=1
25547 !! wikitext
25548 __TOC__
25549 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25550 !! html/php
25551 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25552 <ul>
25553 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25554 </ul>
25555 </div>
25556
25557 <h2><span class="mw-headline" id="Style"><style>.foo {}</style>Style<style>.bar {}</style></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: Style">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25558 !! html/parsoid
25559 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25560 <h2 id="Style" data-parsoid="{}"><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo {}"}}'>.foo {}</style>Style<style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".bar {}"}}'>.bar {}</style></h2>
25561 !! end
25562
25563 !! test
25564 T198618: script element in ToC
25565 !! options
25566 wgRawHtml=1
25567 !! wikitext
25568 __TOC__
25569 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25570 !! html/php
25571 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25572 <ul>
25573 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25574 </ul>
25575 </div>
25576
25577 <h2><span class="mw-headline" id="Script"><script>alert(1);</script>Script<script>alert(1);</script></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: Script">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25578 !! html/parsoid
25579 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25580 <h2 id="Script" data-parsoid='{}'><script typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script>Script<script typeof="mw:Extension/html" about="#mwt6" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;script>alert(1);&lt;/script>"}}'>alert(1);</script></h2>
25581 !! end
25582
25583 !! test
25584 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25585 !! wikitext
25586 __TOC__
25587 ==x==
25588 !! html/php
25589 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
25590 <ul>
25591 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25592 </ul>
25593 </div>
25594
25595 <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>
25596 !! html/parsoid
25597 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25598 <h2 id="x" data-parsoid='{}'>x</h2>
25599 !! end
25600
25601 !! article
25602 MediaWiki:T34057
25603 !! text
25604 == {{int:ok}} ==
25605 !! endarticle
25606
25607 !! test
25608 T34057: Title needed when expanding <h> nodes.
25609 !! options
25610 title=[[Main Page]]
25611 !! wikitext
25612 {{int:T34057}}
25613 !! html
25614 <h2><span class="mw-headline" id="OK">OK</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: OK">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25615 !! end
25616
25617 !! test
25618 Strip marker in urlencode
25619 !! wikitext
25620 {{urlencode:x<nowiki/>y}}
25621 {{urlencode:x<nowiki/>y|wiki}}
25622 {{urlencode:x<nowiki/>y|path}}
25623 {{urlencode:x<pre id="one">two</pre>y}}
25624 !! html/php
25625 <p>xy
25626 xy
25627 xy
25628 xy
25629 </p>
25630 !! end
25631
25632 !! test
25633 Strip marker in lc
25634 !! wikitext
25635 {{lc:x<nowiki/>y}}
25636 !! html
25637 <p>xy
25638 </p>
25639 !! end
25640
25641 !! test
25642 Strip marker in uc
25643 !! wikitext
25644 {{uc:x<nowiki/>y}}
25645 !! html
25646 <p>XY
25647 </p>
25648 !! end
25649
25650 !! test
25651 Strip marker in formatNum
25652 !! wikitext
25653 {{formatnum:1<nowiki/>2}}
25654 {{formatnum:1<nowiki/>2|R}}
25655 !! html
25656 <p>12
25657 12
25658 </p>
25659 !! end
25660
25661 !! test
25662 Check noCommafy in formatNum
25663 !! options
25664 language=be-tarask
25665 !! wikitext
25666 {{formatnum:123456.78}}
25667 {{formatnum:123456.78|NOSEP}}
25668 !! html
25669 <p>123 456,78
25670 123456.78
25671 </p>
25672 !! end
25673
25674 !! test
25675 Wrong option for formatNum (T58199)
25676 !! wikitext
25677 {{formatnum:1,234.56|Random}}
25678 {{formatnum:1,234.56|EVERYTHING}}
25679 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25680 !! html
25681 <p>1,234.56
25682 1,234.56
25683 1,234.56
25684 </p>
25685 !! end
25686
25687 !! test
25688 Strip marker in grammar
25689 !! options
25690 language=fi
25691 !! wikitext
25692 {{grammar:elative|foo<nowiki/>bar}}
25693 !! html
25694 <p>foobarista
25695 </p>
25696 !! end
25697
25698 !! test
25699 Strip marker in padleft
25700 !! wikitext
25701 {{padleft:|2|x<nowiki/>y}}
25702 !! html
25703 <p>xy
25704 </p>
25705 !! end
25706
25707 !! test
25708 Strip marker in padright
25709 !! wikitext
25710 {{padright:|2|x<nowiki/>y}}
25711 !! html
25712 <p>xy
25713 </p>
25714 !! end
25715
25716 !! test
25717 Strip marker in anchorencode
25718 !! wikitext
25719 {{anchorencode:x<nowiki/>y}}
25720 !! html/php
25721 <p>xy
25722 </p>
25723 !! html/parsoid
25724 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:x&lt;nowiki/>y","function":"anchorencode"},"params":{},"i":0}}]}'>xy</p>
25725 !! end
25726
25727 !! test
25728 nowiki inside link inside heading (T20295)
25729 !! wikitext
25730 ==[[foo|x<nowiki>y</nowiki>z]]==
25731 !! html
25732 <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>
25733 !! end
25734
25735 !! test
25736 new support for bdi element (T33817)
25737 !! wikitext
25738 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25739 !! html
25740 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25741 !! end
25742
25743 !! test
25744 Ignore pipe between table row attributes
25745 !! wikitext
25746 {|
25747 |quux
25748 |- id=foo | style='color: red'
25749 |bar
25750 |}
25751 !! html
25752 <table>
25753 <tr>
25754 <td>quux
25755 </td></tr>
25756 <tr id="foo" style="color: red">
25757 <td>bar
25758 </td></tr></table>
25759 !! end
25760
25761 !!test
25762 Language parser function
25763 !! wikitext
25764 {{#language:ar}}
25765 !! html
25766 <p>العربية
25767 </p>
25768 !! end
25769
25770 !!test
25771 Padleft and padright (default 0-padding)
25772 !! wikitext
25773 {{padleft:xyz|5}}
25774 {{padright:xyz|5}}
25775 !! html/php
25776 <p>00xyz
25777 xyz00
25778 </p>
25779 !! html/parsoid
25780 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25781 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25782 !! end
25783
25784 !!test
25785 Padleft and padright (partial fill)
25786 !! wikitext
25787 {{padleft:xyz|6|ab}}
25788 {{padright:xyz|6|ab}}
25789 !! html/php
25790 <p>abaxyz
25791 xyzaba
25792 </p>
25793 !! html/parsoid
25794 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>abaxyz</span>
25795 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>xyzaba</span></p>
25796 !! end
25797
25798 !!test
25799 Padleft and padright as substr
25800 !! wikitext
25801 {{padleft:|3|abcde}}
25802 {{padright:|3|abcde}}
25803 !! html/php
25804 <p>abc
25805 abc
25806 </p>
25807 !! html/parsoid
25808 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:","function":"padleft"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span>
25809 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:","function":"padright"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span></p>
25810 !! end
25811
25812 !! test
25813 Padleft and padright with non-numerical length (T180403)
25814 !! wikitext
25815 {{padleft:abcdef|junk}}
25816 {{padright:abcdef|junk}}
25817 !! html/php
25818 <p>abcdef
25819 abcdef
25820 </p>
25821 !! end
25822
25823 !!test
25824 Special parser function
25825 !! wikitext
25826 {{#special:RandomPage}}
25827 {{#special:BaDtItLe}}
25828 {{#special:Foobar}}
25829 !! html
25830 <p>Special:Random
25831 Special:Badtitle
25832 Special:Foobar
25833 </p>
25834 !! end
25835
25836 !!test
25837 T36939 - Case insensitive link parsing ([HttP://])
25838 !! wikitext
25839 [HttP://MediaWiki.Org/]
25840 !! html/php
25841 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25842 </p>
25843 !! html/parsoid
25844 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/" class="external autonumber"></a></p>
25845 !! end
25846
25847 !!test
25848 T36939 - Case insensitive link parsing ([HttP:// title])
25849 !! wikitext
25850 [HttP://MediaWiki.Org/ MediaWiki]
25851 !! html
25852 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25853 </p>
25854 !! end
25855
25856 !!test
25857 T36939 - Case insensitive link parsing (HttP://)
25858 !! wikitext
25859 HttP://MediaWiki.Org/
25860 !! html/php
25861 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25862 </p>
25863 !! html/parsoid
25864 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/" class="external free">HttP://MediaWiki.Org/</a></p>
25865 !! end
25866
25867 !!test
25868 Disable TOC
25869 !! options
25870 notoc
25871 !! wikitext
25872 Lead
25873 ==Section 1==
25874 ==Section 2==
25875 ==Section 3==
25876 ==Section 4==
25877 ==Section 5==
25878 !! html
25879 <p>Lead
25880 </p>
25881
25882 <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>
25883 <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>
25884 <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>
25885 <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>
25886 <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>
25887 !! end
25888
25889
25890 ###
25891 ### Parsoid-specific tests
25892 ### Parsoid-PHP parser incompatibilities
25893 ###
25894 !!test
25895 1. SOL-sensitive wikitext tokens as template-args
25896 !! options
25897 parsoid=wt2html,wt2wt
25898 !! wikitext
25899 {{echo|*a}}
25900 {{echo|#a}}
25901 {{echo|:a}}
25902 !! html/php+tidy
25903 <ul><li>a</li></ul>
25904 <ol><li>a</li></ol>
25905 <dl><dd>a</dd></dl>
25906 !! html/parsoid
25907 <span about="#mwt1" typeof="mw:Transclusion">
25908 </span><ul about="#mwt1"><li>a</li>
25909 </ul>
25910 <span about="#mwt2" typeof="mw:Transclusion">
25911 </span><ol about="#mwt2"><li>a</li>
25912 </ol>
25913 <span about="#mwt3" typeof="mw:Transclusion">
25914 </span><dl about="#mwt3"><dd>a</dd>
25915 </dl>
25916 !!end
25917
25918 #### -----------------------------------------------------------------
25919 #### Parsoid-specific functionality tests
25920 #### -----------------------------------------------------------------
25921
25922 # T65642/T68749: Formatting elt fixup around images.
25923 # We know wt2wt will fail, but we expect selser to pass.
25924 # Due to the nature of our testing, wt2wt and selser tests will enter the
25925 # blacklist and we'll catch selser regressions based on changes to the
25926 # blacklist entries for selser tests.
25927 !! test
25928 1. Treebuilder fixup of formatting elt
25929 !! options
25930 parsoid=wt2html,wt2wt
25931 !! wikitext
25932 {|
25933 |
25934 <small>
25935 [[Image:Foobar.jpg|right|Test]]
25936 </small>
25937 |}
25938 !! html/php+tidy
25939 <table>
25940 <tbody><tr>
25941 <td>
25942 <p><small>
25943 </small></p><small>
25944 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Test"><img alt="Test" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a></div>
25945 </small><p><small></small>
25946 </p>
25947 </td></tr></tbody></table>
25948 !! html/parsoid
25949 <table>
25950 <tbody><tr><td>
25951 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25952 <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></small>
25953 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25954 </tbody></table>
25955 !! end
25956
25957 !! test
25958 2. Treebuilder fixup of formatting elt
25959 !! options
25960 parsoid=wt2html,wt2wt
25961 !! wikitext
25962 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25963
25964 <small>[[Image:Foobar.jpg|right|300px]]</small>
25965 !! html/php+tidy
25966 <p><b>foo</b></p><b><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" decoding="async" 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></b><p><b>bar</b>
25967 </p><small><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" decoding="async" 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></div></small>
25968 !! html/parsoid
25969 <p><b>foo</b></p><b><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></b><p><b>bar</b></p>
25970
25971 <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><figcaption></figcaption></figure></small>
25972 !! end
25973
25974 !! test
25975 3. Treebuilder fixup of formatting elt
25976 !! options
25977 parsoid=wt2html,wt2wt
25978 !! wikitext
25979 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25980 !! html/php+tidy
25981 <p><small><b>foo</b></small></p><small><b><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" decoding="async" 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></b></small><p><small><b>bar</b></small></p>
25982 !! html/parsoid
25983 <p><small><b>foo</b></small></p><small><b><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></b></small><p><small><b>bar</b></small></p>
25984 !! end
25985
25986 !! test
25987 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25988 !! options
25989 parsoid=wt2html,wt2wt
25990 !! wikitext
25991 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25992 !! html/php+tidy
25993 <b><small><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" decoding="async" 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></div></small></b>
25994 !! html/parsoid
25995 <b><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><figcaption></figcaption></figure></small></b>
25996 !! end
25997
25998 ## Just a regression test
25999 !! test
26000 Wikilink with only closing tag in target
26001 !! options
26002 parsoid=wt2html
26003 !! wikitext
26004 [[Test|</span>]]
26005 !! html/parsoid
26006 <p><a rel="mw:WikiLink" href="./Test" title="Test"></a></p>
26007 !! end
26008
26009 #### ----------------------------------------------------------------
26010 #### Parsoid-only testing of Parsoid's impl of LST
26011 #### Not implemented yet, see
26012 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
26013 #### ----------------------------------------------------------------
26014
26015 ## We still need to support serializing the older format while content is stored.
26016 !! test
26017 LST Sections: Backwards compatibility
26018 !! options
26019 parsoid={
26020 "suppressErrors": true,
26021 "modes": ["html2wt"]
26022 }
26023 !! wikitext
26024 <section begin="2011-05-16" />
26025 <section end="2014-04-10 (MW 1.23wmf22)" />
26026 !! html/parsoid
26027 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
26028 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
26029 !! end
26030
26031 !! test
26032 LST Sections: Newfangled approach
26033 !! wikitext
26034 <section begin="2011-05-16" />
26035 <section end="2014-04-10 (MW 1.23wmf22)" />
26036 !! html/parsoid
26037 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
26038 </span>
26039 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
26040 </span></p>
26041 !! end
26042
26043 #--------- Test stripping of empty nodes in template content ----------
26044
26045 !! test
26046 Empty LI and TR nodes should be stripped from template content
26047 !! wikitext
26048 {{EmptyLITest}}
26049 {{EmptyTRTest}}
26050 !! html/parsoid
26051 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
26052 <li>a</li>
26053 <li>b</li>
26054 </ul>
26055 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
26056 <tbody>
26057 <tr>
26058 <td>foo</td>
26059 </tr>
26060 <tr>
26061 <td>bar</td>
26062 </tr>
26063 </tbody>
26064 </table>
26065 !! end
26066
26067 !! test
26068 Empty LI and TR nodes should not be stripped from top-level content
26069 !! wikitext
26070 *a
26071 *
26072 *b
26073
26074 {|
26075 |-
26076 |-
26077 |foo
26078 |}
26079 !! html/parsoid
26080 <ul>
26081 <li>a</li>
26082 <li class='mw-empty-elt'></li>
26083 <li>b</li>
26084 </ul>
26085 <table>
26086 <tbody>
26087 <tr class='mw-empty-elt'></tr>
26088 <tr>
26089 <td>foo</td>
26090 </tr>
26091 </tbody>
26092 </table>
26093 !! end
26094
26095 !! test
26096 Empty TR nodes should not be stripped if they have any attributes set
26097 !! wikitext
26098 {{EmptyTRWithHTMLAttrTest}}
26099 !! html/parsoid
26100 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
26101 <tr align='center'></tr>
26102 <tr><td>foo</td></tr>
26103 <tr align='center'></tr>
26104 <tr><td>bar</td></tr>
26105 </table>
26106 !! end
26107
26108 #### ----------------------------------------------------------------
26109 #### The following section of tests are primarily to test
26110 #### wikitext escaping capabilities of Parsoid. Given that
26111 #### escaping can be done any number of ways, the wikitext (input)
26112 #### is always adjusted to reflect how Parsoid adds nowiki
26113 #### escape tags.
26114 ####
26115 #### We are marking several tests as parsoid-only since the
26116 #### HTML in the result section is different from what the
26117 #### PHP parser generates for it.
26118 #### ----------------------------------------------------------------
26119
26120
26121 #### --------------- Headings ---------------
26122 #### 0. Unnested
26123 #### 1. Nested inside html <h1>=foo=</h1>
26124 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
26125 #### 3. Nested inside html with wikitext split by html tags
26126 #### 4. No escape needed
26127 #### 5. Empty headings <h1></h1>
26128 #### 6. Heading chars in SOL context
26129 #### ----------------------------------------
26130 !! test
26131 Headings: 0. Unnested
26132 !! options
26133 parsoid=html2wt
26134 !! html/parsoid
26135 <p>=foo=</p>
26136
26137 <p> =foo=
26138 <!--cmt-->
26139 =foo=</p>
26140
26141 <p>=foo<i>a</i>=</p>
26142 !! wikitext
26143 <nowiki>=foo=</nowiki>
26144
26145 <nowiki> </nowiki>=foo=
26146 <!--cmt-->
26147 <nowiki>=foo=</nowiki>
26148
26149 =foo''a''<nowiki>=</nowiki>
26150 !!end
26151
26152 # New headings and existing headings are handled differently
26153 !! test
26154 Headings: 1. Nested inside html
26155 !! options
26156 parsoid=html2wt
26157 !! html/parsoid
26158 <h1>=foo=</h1>
26159 <h2>=foo=</h2>
26160 <h3>=foo=</h3>
26161
26162 <h1 data-parsoid='{}'>=foo=</h1>
26163 <h2 data-parsoid='{}'>=foo=</h2>
26164 <h3 data-parsoid='{}'>=foo=</h3>
26165 <h4 data-parsoid='{}'>=foo=</h4>
26166 <h5 data-parsoid='{}'>=foo=</h5>
26167 <h6 data-parsoid='{}'>=foo=</h6>
26168 !! wikitext
26169 = =foo= =
26170
26171 == =foo= ==
26172
26173 === =foo= ===
26174
26175 =<nowiki>=foo=</nowiki>=
26176 ==<nowiki>=foo=</nowiki>==
26177 ===<nowiki>=foo=</nowiki>===
26178 ====<nowiki>=foo=</nowiki>====
26179 =====<nowiki>=foo=</nowiki>=====
26180 ======<nowiki>=foo=</nowiki>======
26181 !! end
26182
26183 !! test
26184 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
26185 !! options
26186 parsoid=html2wt
26187 !! html/parsoid
26188 <h1>foo</h1>*bar
26189 <h1>foo</h1>=bar
26190 <h1>foo</h1>=bar=
26191 !! wikitext
26192 = foo =
26193 <nowiki>*</nowiki>bar
26194
26195 = foo =
26196 =bar
26197
26198 = foo =
26199 <nowiki>=bar=</nowiki>
26200 !!end
26201
26202 !! test
26203 Headings: 3. Nested inside html with wikitext split by html tags
26204 !! options
26205 parsoid=html2wt
26206 !! html/parsoid
26207 <h1>=<b>bold</b>foo=</h1>
26208 !! wikitext
26209 = ='''bold'''foo= =
26210 !!end
26211
26212 !! test
26213 Headings: 4a. No escaping needed (testing just h1 and h2)
26214 !! options
26215 parsoid=html2wt
26216 !! html/parsoid
26217 <h1>=foo</h1>
26218 <h1>foo=</h1>
26219 <h1> =foo= </h1>
26220 <h1>=foo= bar</h1>
26221 <h2>=foo</h2>
26222 <h2>foo=</h2>
26223 <h1>=</h1>
26224 <h1><i>=</i>foo=</h1>
26225 !! wikitext
26226 = =foo =
26227
26228 = foo= =
26229
26230 = =foo= =
26231
26232 = =foo= bar =
26233
26234 == =foo ==
26235
26236 == foo= ==
26237
26238 = = =
26239
26240 = ''=''foo= =
26241 !!end
26242
26243 !! test
26244 Headings: 4b. No escaping needed (inside p-tags)
26245 !! options
26246 parsoid=html2wt
26247 !! html/parsoid
26248 <p>=foo= x
26249 =foo= <s></s>
26250 </p>
26251 !! wikitext
26252 =foo= x
26253 =foo= <s></s>
26254 !! html/php
26255 <p>=foo= x
26256 =foo= <s></s>
26257 </p>
26258 !!end
26259
26260 !! test
26261 Headings: 4c. Short headings (1)
26262 !! options
26263 parsoid=html2wt
26264 !! html/parsoid
26265 <p>===
26266 </p>
26267 !! wikitext
26268 <nowiki>===</nowiki>
26269 !! html/php
26270 <p>===
26271 </p>
26272 !! end
26273
26274 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
26275 !! test
26276 Headings: 4d. Short headings (2)
26277 !! options
26278 parsoid=wt2html,html2html
26279 !! wikitext
26280 =
26281 ==
26282 ===
26283 ====
26284 =====
26285 !! html/php
26286 <p>=
26287 ==
26288 </p>
26289 <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>
26290 <h1><span class="mw-headline" id=".3D.3D">==</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>
26291 <h2><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=3" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
26292 !! html/parsoid
26293 <p>=
26294 ==</p>
26295 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
26296 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
26297 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
26298 !! end
26299
26300 !! test
26301 Headings: 5. Empty headings
26302 !! options
26303 parsoid=html2wt
26304 !! html/parsoid
26305 <h1 data-parsoid='{}'></h1>
26306
26307 <h2 data-parsoid='{}'></h2>
26308
26309 <h3 data-parsoid='{}'></h3>
26310
26311 <h4 data-parsoid='{}'></h4>
26312
26313 <h5 data-parsoid='{}'></h5>
26314
26315 <h6 data-parsoid='{}'></h6>
26316 !! wikitext
26317 =<nowiki/>=
26318
26319 ==<nowiki/>==
26320
26321 ===<nowiki/>===
26322
26323 ====<nowiki/>====
26324
26325 =====<nowiki/>=====
26326
26327 ======<nowiki/>======
26328 !!end
26329
26330 !! test
26331 Headings: 6a. Heading chars in SOL context (with trailing spaces)
26332 !! options
26333 parsoid=html2wt
26334 !! html/parsoid
26335 <p>=a=</p>
26336
26337 <p>=a=</p>
26338
26339 <p>=a=</p>
26340 !! wikitext
26341 <nowiki>=a=</nowiki>
26342
26343 <nowiki>=a=</nowiki>
26344
26345 <nowiki>=a=</nowiki>
26346 !!end
26347
26348 !! test
26349 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26350 !! options
26351 parsoid=html2wt
26352 !! html/parsoid
26353 <p>=a=
26354 b</p>
26355
26356 <p>=a=
26357 b</p>
26358
26359 <p>=a=
26360 b</p>
26361 !! wikitext
26362 <nowiki>=a=</nowiki>
26363 b
26364
26365 <nowiki>=a=</nowiki>
26366 b
26367
26368 <nowiki>=a=</nowiki>
26369 b
26370 !!end
26371
26372 !! test
26373 Headings: 6c. Heading chars in SOL context (leading newline break)
26374 !! options
26375 parsoid=html2wt
26376 !! html/parsoid
26377 <p>a
26378 =b=</p>
26379 !! wikitext
26380 a
26381 <nowiki>=b=</nowiki>
26382 !!end
26383
26384 !! test
26385 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26386 !! options
26387 parsoid=html2wt
26388 !! html/parsoid
26389 <!--c0--><p>=a=</p>
26390
26391 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26392 !! wikitext
26393 <!--c0--><nowiki>=a=</nowiki>
26394
26395 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26396 !!end
26397
26398 !! test
26399 Headings: 6d. Heading chars in SOL context (No escaping needed)
26400 !! options
26401 parsoid=html2wt
26402 !! html/parsoid
26403 =a=<div>b</div>
26404 !! wikitext
26405 =a=<div>b</div>
26406 !!end
26407
26408 !! test
26409 Headings: 7. Insert a newline between new content and headings
26410 !! options
26411 parsoid=html2wt
26412 !! html/parsoid
26413 <h2>NEW</h2>
26414 <p>new</p>
26415 <h2 data-parsoid='{}'>A</h2>
26416 <p data-parsoid='{}'>a</p>
26417 !! wikitext
26418 == NEW ==
26419 new
26420
26421 ==A==
26422 a
26423 !! end
26424
26425 !! test
26426 Headings: Used as horizontal rule
26427 !! config
26428 wgFragmentMode=[ 'html5', 'legacy' ]
26429 !! options
26430 parsoid=wt2html
26431 !! wikitext
26432 ===============
26433 !! html/php
26434 <h6><span id=".3D.3D.3D"></span><span class="mw-headline" id="===">===</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></h6>
26435 !! html/parsoid
26436 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26437 !! end
26438
26439 #### --------------- Lists ---------------
26440 #### 0. Outside nests (*foo, etc.)
26441 #### 1. Nested inside html <ul><li>*foo</li></ul>
26442 #### 2. Inside definition lists
26443 #### 3. Only bullets at start should be escaped
26444 #### 4. No escapes needed
26445 #### 5. No unnecessary escapes
26446 #### 6. Escape bullets in SOL position
26447 #### 7. Escape bullets in a multi-line context
26448 #### ----------------------------------------
26449
26450 !! test
26451 Lists: 0. Outside nests
26452 !! options
26453 parsoid=html2wt
26454 !! html/parsoid
26455 <p>*foo</p>
26456
26457 <p>#foo</p>
26458
26459 <p>;Foo:bar</p>
26460 !! wikitext
26461 <nowiki>*</nowiki>foo
26462
26463 <nowiki>#</nowiki>foo
26464
26465 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26466 !!end
26467
26468 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26469 ## to test wikitext escaping, and insignificant whitespace diffs
26470 ## cause PHP parser tests to barf
26471 !! test
26472 Lists: 1. Nested inside html (No unnecessary escapes)
26473 !! options
26474 parsoid=html2wt
26475 !! html/parsoid
26476 <ul>
26477 <li>*foo</li>
26478 <li>#foo</li>
26479 <li>:foo</li>
26480 <li>;foo</li>
26481 <li data-parsoid='{}'>*foo</li>
26482 <li data-parsoid='{}'>#foo</li>
26483 <li data-parsoid='{}'>:foo</li>
26484 <li data-parsoid='{}'>;foo</li>
26485 </ul>
26486
26487 <ol>
26488 <li>*foo</li>
26489 <li>#foo</li>
26490 <li>:foo</li>
26491 <li>;foo</li>
26492 <li data-parsoid='{}'>*foo</li>
26493 <li data-parsoid='{}'>#foo</li>
26494 <li data-parsoid='{}'>:foo</li>
26495 <li data-parsoid='{}'>;foo</li>
26496 </ol>
26497 !! wikitext
26498 * *foo
26499 * #foo
26500 * :foo
26501 * ;foo
26502 *<nowiki>*foo</nowiki>
26503 *<nowiki>#foo</nowiki>
26504 *<nowiki>:foo</nowiki>
26505 *<nowiki>;foo</nowiki>
26506
26507 # *foo
26508 # #foo
26509 # :foo
26510 # ;foo
26511 #<nowiki>*foo</nowiki>
26512 #<nowiki>#foo</nowiki>
26513 #<nowiki>:foo</nowiki>
26514 #<nowiki>;foo</nowiki>
26515 !!end
26516
26517 !! test
26518 Lists: 2. Inside definition lists
26519 !! options
26520 parsoid=html2wt
26521 !! html/parsoid
26522 <dl><dt>;foo</dt></dl>
26523 <dl><dt>:foo</dt></dl>
26524 <dl><dt>:foo</dt>
26525 <dd>bar</dd></dl>
26526 <dl><dd>:foo</dd></dl>
26527 !! wikitext
26528 ; ;foo
26529
26530 ; <nowiki>:foo</nowiki>
26531
26532 ; <nowiki>:foo</nowiki>
26533 : bar
26534
26535 : :foo
26536 !!end
26537
26538 !! test
26539 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26540 !! options
26541 parsoid=html2wt
26542 !! html/parsoid
26543 <ul>
26544 <li>*foo*bar</li>
26545 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26546 </ul>
26547 !! wikitext
26548 * *foo*bar
26549 *<nowiki>*foo</nowiki>''it''*bar
26550 !!end
26551
26552 !! test
26553 Lists: 4. No escapes needed
26554 !! options
26555 parsoid=html2wt
26556 !! html/parsoid
26557 <ul>
26558 <li>foo*bar
26559 </li>
26560 </ul>
26561 <ul>
26562 <li><i>foo</i>*bar
26563 </li>
26564 </ul>
26565 <ul>
26566 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26567 </li>
26568 </ul>
26569 <ul>
26570 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26571 </li>
26572 </ul>
26573 !! wikitext
26574 *foo*bar
26575
26576 *''foo''*bar
26577
26578 *[[Foo]]: bar
26579
26580 *[[Foo]]*bar
26581 !!end
26582
26583 !! test
26584 Lists: 5. No unnecessary escapes
26585 !! options
26586 parsoid=html2wt
26587 !! html/parsoid
26588 <ul><li> bar <span>[[foo]]</span></li></ul>
26589 <ul><li> =bar <span>[[foo]]</span></li></ul>
26590 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26591 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26592 <ul><li> =bar <span>foo]]</span>=</li></ul>
26593 <ul><li> <s></s>: a</li></ul>
26594 <ul><li> <i>* foo</i></li></ul>
26595
26596 !! wikitext
26597 * bar <span><nowiki>[[foo]]</nowiki></span>
26598
26599 * =bar <span><nowiki>[[foo]]</nowiki></span>
26600
26601 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26602
26603 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26604
26605 * =bar <span>foo]]</span>=
26606
26607 * <s></s>: a
26608
26609 * ''* foo''
26610 !!end
26611
26612 !! test
26613 Lists: 6. Escape bullets in SOL position
26614 !! options
26615 parsoid=html2wt
26616 !! html/parsoid
26617 <p><!--cmt-->*foo</p>
26618 !! wikitext
26619 <!--cmt--><nowiki>*</nowiki>foo
26620 !!end
26621
26622 !! test
26623 Lists: 7. Escape bullets in a multi-line context
26624 !! options
26625 parsoid=html2wt
26626 !! html/parsoid
26627 <p>a
26628 *b
26629 </p>
26630 !! wikitext
26631 a
26632 <nowiki>*</nowiki>b
26633 !!end
26634
26635 !! test
26636 Lists: 8. Escape colons only if not present in tags
26637 !! options
26638 parsoid=html2wt
26639 !! html/parsoid
26640 <dl><dt>a:b<i>c:d</i></dt></dl>
26641 !! wikitext
26642 ; <nowiki>a:b</nowiki>''c:d''
26643 !! end
26644
26645 #### --------------- HRs ---------------
26646 #### 1. Single line
26647 #### -----------------------------------
26648
26649 !! test
26650 HRs: 1. Single line
26651 !! options
26652 parsoid=html2wt
26653 !! html/parsoid
26654 <hr />----
26655 <hr />=foo=
26656 <hr />*foo
26657 !! wikitext
26658 ----<nowiki>----</nowiki>
26659 ----=foo=
26660 ----*foo
26661 !! end
26662
26663 #### --------------- Tables ---------------
26664 #### 1a. Simple example
26665 #### 1b. No escaping needed (!foo)
26666 #### 1c. No escaping needed (|foo)
26667 #### 1d. No escaping needed (|}foo)
26668 ####
26669 #### 2a. Nested in td (<td>foo|bar</td>)
26670 #### 2b. Nested in td (<td>foo||bar</td>)
26671 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26672 ####
26673 #### 3a. Nested in th (<th>foo!bar</th>)
26674 #### 3b. Nested in th (<th>foo!!bar</th>)
26675 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26676 ####
26677 #### 4a. Escape -
26678 #### 4b. Escape +
26679 #### 4c. No escaping needed
26680 #### --------------------------------------
26681
26682 !! test
26683 Tables: 1a. Simple example
26684 !! options
26685 parsoid=html2wt
26686 !! html/parsoid
26687 <p>{|
26688 |}
26689 </p>
26690 !! wikitext
26691 <nowiki>{|</nowiki>
26692 |}
26693 !! end
26694
26695 !! test
26696 Tables: 1b. No escaping needed
26697 !! options
26698 parsoid=html2wt
26699 !! html/parsoid
26700 <p>!foo
26701 </p>
26702 !! wikitext
26703 !foo
26704 !! end
26705
26706 !! test
26707 Tables: 1c. No escaping needed
26708 !! options
26709 parsoid=html2wt
26710 !! html/parsoid
26711 <p>|foo
26712 </p>
26713 !! wikitext
26714 |foo
26715 !! end
26716
26717 !! test
26718 Tables: 1d. No escaping needed
26719 !! options
26720 parsoid=html2wt
26721 !! html/parsoid
26722 <p>|}foo
26723 </p>
26724 !! wikitext
26725 |}foo
26726 !! end
26727
26728 !! test
26729 Tables: 2a. Nested in td
26730 !! options
26731 parsoid=html2wt
26732 !! html/parsoid
26733 <table><tbody><tr>
26734 <td>foo|bar</td></tr>
26735 <tr><td>x<div>a|b</div></td>
26736 </tbody></table>
26737 !! wikitext
26738 {|
26739 |<nowiki>foo|bar</nowiki>
26740 |-
26741 |x<div><nowiki>a|b</nowiki></div>
26742 |}
26743 !! html/php+tidy
26744 <table>
26745 <tbody><tr>
26746 <td>foo|bar
26747 </td></tr>
26748 <tr>
26749 <td>x<div>a|b</div>
26750 </td></tr></tbody></table>
26751 !! end
26752
26753 !! test
26754 Tables: 2b. Nested in td
26755 !! options
26756 parsoid=html2wt
26757 !! html/parsoid
26758 <table><tbody><tr>
26759 <td>foo||bar</td>
26760 <td>a<i>b||c</i></td>
26761 <td>a<i><div>b||c</div></i></td>
26762 </tr></tbody></table>
26763 !! wikitext
26764 {|
26765 |<nowiki>foo||bar</nowiki>
26766 |a''<nowiki>b||c</nowiki>''
26767 |a''<div><nowiki>b||c</nowiki></div>''
26768 |}
26769 !! html/php
26770 <table>
26771 <tr>
26772 <td>foo||bar
26773 </td>
26774 <td>a<i>b||c</i>
26775 </td>
26776 <td>a<i><div>b||c</div></i>
26777 </td></tr></table>
26778 !! end
26779
26780 !! test
26781 Tables: 2c. Nested in td -- no escaping needed
26782 !! options
26783 parsoid=html2wt
26784 !! html/*
26785 <table>
26786 <tr>
26787 <td>foo!!bar
26788 </td></tr></table>
26789 !! wikitext
26790 {|
26791 |foo!!bar
26792 |}
26793 !! end
26794
26795 !! test
26796 Tables: 3a. Nested in th
26797 !! options
26798 parsoid=html2wt
26799 !! html/*
26800 <table>
26801 <tr>
26802 <th>foo!bar
26803 </th></tr></table>
26804 !! wikitext
26805 {|
26806 !foo!bar
26807 |}
26808 !! end
26809
26810 !! test
26811 Tables: 3b. Nested in th
26812 !! options
26813 parsoid=html2wt
26814 !! html/parsoid
26815 <table><tbody>
26816 <tr><th>foo!!bar</th>
26817 <th><i>foo|bar</i></th>
26818 <th><i>foo!!bar</i></th>
26819 <th><i><span>foo!!bar</span></i></th>
26820 </tr></tbody></table>
26821 !! wikitext
26822 {|
26823 !<nowiki>foo!!bar</nowiki>
26824 !''<nowiki>foo|bar</nowiki>''
26825 !''<nowiki>foo!!bar</nowiki>''
26826 !''<span><nowiki>foo!!bar</nowiki></span>''
26827 |}
26828 !! html/php
26829 <table>
26830 <tr>
26831 <th>foo!!bar
26832 </th>
26833 <th><i>foo|bar</i>
26834 </th>
26835 <th><i>foo!!bar</i>
26836 </th>
26837 <th><i><span>foo!!bar</span></i>
26838 </th></tr></table>
26839 !! end
26840
26841 !! test
26842 Tables: 3c. Nested in th
26843 !! options
26844 parsoid=html2wt
26845 !! html/parsoid
26846 <table><tbody>
26847 <tr><th>foo||bar</th>
26848 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26849 </tr></tbody></table>
26850 !! wikitext
26851 {|
26852 !<nowiki>foo||bar</nowiki>
26853 !<nowiki>foo||bar</nowiki>
26854 |}
26855 !! html/php
26856 <table>
26857 <tr>
26858 <th>foo||bar
26859 </th>
26860 <th>foo||bar
26861 </th></tr></table>
26862 !! end
26863
26864 !! test
26865 Tables: 4a. Escape -
26866 !! options
26867 parsoid=html2wt
26868 !! html/*
26869 <table>
26870 <tr>
26871 <th>-bar
26872 </th></tr>
26873 <tr>
26874 <td>-bar
26875 </td></tr></table>
26876 !! wikitext
26877 {|
26878 !-bar
26879 |-
26880 |<nowiki>-bar</nowiki>
26881 |}
26882 !! end
26883
26884 !! test
26885 Tables: 4b. Escape +
26886 !! options
26887 parsoid=html2wt
26888 !! html/*
26889 <table>
26890 <tr>
26891 <th>+bar
26892 </th></tr>
26893 <tr>
26894 <td>+bar
26895 </td></tr></table>
26896 !! wikitext
26897 {|
26898 !+bar
26899 |-
26900 |<nowiki>+bar</nowiki>
26901 |}
26902 !! end
26903
26904 !! test
26905 Tables: 4c. No escaping needed
26906 !! options
26907 parsoid=html2wt
26908 !! html/parsoid
26909 <table><tbody>
26910 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26911 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26912 <tr><td>foo
26913 <p>bar|baz
26914 +bar
26915 -bar</p></td></tr>
26916 <tr><td>x
26917 <div>a|b</div></td>
26918 </tbody></table>
26919 !! wikitext
26920 {|
26921 |foo-bar
26922 |foo+bar
26923 |-
26924 |''foo''-bar
26925 |''foo''+bar
26926 |-
26927 |foo
26928 bar|baz
26929 +bar
26930 -bar
26931 |-
26932 |x
26933 <div>a|b</div>
26934 |}
26935 !! html/php
26936 <table>
26937 <tr>
26938 <td>foo-bar
26939 </td>
26940 <td>foo+bar
26941 </td></tr>
26942 <tr>
26943 <td><i>foo</i>-bar
26944 </td>
26945 <td><i>foo</i>+bar
26946 </td></tr>
26947 <tr>
26948 <td>foo
26949 <p>bar|baz
26950 +bar
26951 -bar
26952 </p>
26953 </td></tr>
26954 <tr>
26955 <td>x
26956 <div>a|b</div>
26957 </td></tr></table>
26958 !! end
26959
26960 !! test
26961 Tables: 4d. No escaping needed
26962 !! options
26963 parsoid=html2wt
26964 !! html/parsoid
26965 <table>
26966 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26967 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26968 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26969 </tbody></table>
26970 !! wikitext
26971 {|
26972 |[[Foo]]-bar
26973 ||+1
26974 ||-2
26975 |}
26976 !! html/php
26977 <table>
26978 <tr>
26979 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26980 </td>
26981 <td>+1
26982 </td>
26983 <td>-2
26984 </td></tr></table>
26985 !! end
26986
26987 !! test
26988 Tables: 4e. Escape }
26989 !! options
26990 parsoid=html2wt
26991 !! html/parsoid
26992 <table>
26993 <tr><td>}</td></tr>
26994 <tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table>
26995 </table>
26996 !! wikitext
26997 {|
26998 |<nowiki>}</nowiki>
26999 |-
27000 |x||}
27001 |}
27002 !! html/php
27003 <table>
27004 <tr>
27005 <td>}
27006 </td></tr>
27007 <tr>
27008 <td>x</td>
27009 <td>}
27010 </td></tr></table>
27011 !! end
27012
27013 !! test
27014 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
27015 !! options
27016 parsoid=html2wt
27017 !! html/parsoid
27018 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
27019
27020 <table><tr><td></td><td align="center"></td><td></td></tr></table>
27021
27022 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
27023
27024 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
27025 !! wikitext
27026 {|
27027 | || align="center" | ||
27028 |}
27029
27030 {|
27031 |
27032 | align="center" |
27033 |
27034 |}
27035
27036 {|
27037 | {{!}}{{!}} align="center" | ||
27038 |}
27039
27040 {|
27041 ! !! align="center" | !!
27042 |}
27043 !! html/php+tidy
27044 <table>
27045 <tbody><tr>
27046 <td></td>
27047 <td align="center"></td>
27048 <td>
27049 </td></tr></tbody></table>
27050 <table>
27051 <tbody><tr>
27052 <td>
27053 </td>
27054 <td align="center">
27055 </td>
27056 <td>
27057 </td></tr></tbody></table>
27058 <table>
27059 <tbody><tr>
27060 <td></td>
27061 <td align="center"></td>
27062 <td>
27063 </td></tr></tbody></table>
27064 <table>
27065 <tbody><tr>
27066 <th></th>
27067 <th align="center"></th>
27068 <th>
27069 </th></tr></tbody></table>
27070 !! end
27071
27072 !! test
27073 T97430: Don't emit empty nowiki pairs around marker meta tags
27074 !! options
27075 parsoid=html2wt
27076 !! html/parsoid
27077 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
27078 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
27079 !! wikitext
27080 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
27081 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
27082 !! end
27083
27084 !! test
27085 Unclosed xmlish element in table line shouldn't eat end delimiters
27086 !! options
27087 parsoid=html2wt
27088 !! html/parsoid
27089 <table>
27090 <tbody><tr><td> &lt;foo</td>
27091 <td> bar></td></tr>
27092 </tbody></table>
27093 !! wikitext
27094 {|
27095 | <foo
27096 | bar>
27097 |}
27098 !! html/php
27099 <table>
27100 <tr>
27101 <td>&lt;foo
27102 </td>
27103 <td>bar&gt;
27104 </td></tr></table>
27105 !! end
27106
27107 #### --------------- Links ----------------
27108 #### 1. Quote marks in link text
27109 #### 2. Wikilinks: Escapes needed
27110 #### 3. Wikilinks: No escapes needed
27111 #### 4. Extlinks: Escapes needed
27112 #### 5. Extlinks: No escapes needed
27113 #### --------------------------------------
27114 !! test
27115 Links 1. WikiLinks: No escapes needed
27116 !! options
27117 parsoid=html2wt
27118 !! html/parsoid
27119 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
27120 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
27121 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
27122 !! wikitext
27123 [[Foo|Foo''boo'']]
27124 [[Foo|[Foobar]]]
27125 [[Foo|x [Foobar] x]]
27126 !! html/php
27127 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
27128 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
27129 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
27130 </p>
27131 !! end
27132
27133 !! test
27134 Links 2. WikiLinks: Escapes needed
27135 !! options
27136 parsoid=html2wt
27137 !! html/parsoid
27138 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
27139 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
27140 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
27141 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
27142 <a href="Foo" rel="mw:WikiLink">|Bar</a>
27143 <a href="Foo" rel="mw:WikiLink">]]bar</a>
27144 <a href="Foo" rel="mw:WikiLink">[[bar</a>
27145 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
27146 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
27147 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
27148 !! wikitext
27149 [[Foo|<nowiki>Foobar]</nowiki>]]
27150 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
27151 [[Foo|<nowiki>[[Bar]]</nowiki>]]
27152 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
27153 [[Foo||Bar]]
27154 [[Foo|<nowiki>]]bar</nowiki>]]
27155 [[Foo|<nowiki>[[bar</nowiki>]]
27156 [[Foo|<nowiki>x [[ y</nowiki>]]
27157 [[Foo|<nowiki>x ]] y</nowiki>]]
27158 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
27159 !! html/php
27160 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
27161 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
27162 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
27163 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
27164 <a href="/wiki/Foo" title="Foo">|Bar</a>
27165 <a href="/wiki/Foo" title="Foo">]]bar</a>
27166 <a href="/wiki/Foo" title="Foo">[[bar</a>
27167 <a href="/wiki/Foo" title="Foo">x [[ y</a>
27168 <a href="/wiki/Foo" title="Foo">x ]] y</a>
27169 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
27170 </p>
27171 !! end
27172
27173 !! test
27174 Links 3. WikiLinks: No escapes needed
27175 !! options
27176 parsoid=html2wt
27177 !! html/parsoid
27178 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
27179 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
27180 !! wikitext
27181 [[Foo|[Foobar]]
27182 [[Foo|foo|bar]]
27183 !! html/php
27184 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
27185 <a href="/wiki/Foo" title="Foo">foo|bar</a>
27186 </p>
27187 !! end
27188
27189 !! test
27190 Links 4. ExtLinks: Escapes needed
27191 !! options
27192 parsoid=html2wt
27193 !! html/parsoid
27194 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
27195 <a rel="mw:ExtLink" href="http://google.com">google]</a>
27196 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
27197 <p>[http://google.com]</p>
27198 <p>[http://google.com google]</p>
27199 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
27200 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
27201 !! wikitext
27202 [http://google.com <nowiki>[google]</nowiki>]
27203 [http://google.com <nowiki>google]</nowiki>]
27204 [http://google.com <nowiki>goog] le</nowiki>]
27205
27206 <nowiki>[http://google.com]</nowiki>
27207
27208 <nowiki>[http://google.com google]</nowiki>
27209
27210 [http://google.com<nowiki>]</nowiki>
27211
27212 [{{echo|http://google.com}}<nowiki>]</nowiki>
27213 !! html/php
27214 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
27215 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
27216 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
27217 </p><p>[http://google.com]
27218 </p><p>[http://google.com google]
27219 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
27220 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
27221 </p>
27222 !! end
27223
27224 !! test
27225 Links 5. ExtLinks: No escapes needed
27226 !! options
27227 parsoid=html2wt
27228 !! html/parsoid
27229 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
27230 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
27231 !! wikitext
27232 [http://google.com [google]
27233
27234 [[http://google.com]]
27235 !! html/php
27236 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
27237 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
27238 </p>
27239 !! end
27240
27241 !! test
27242 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
27243 !! options
27244 parsoid=html2wt
27245 !! html/parsoid
27246 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
27247 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
27248 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
27249 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
27250 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
27251 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
27252 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27253 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
27254 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27255 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
27256 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
27257 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
27258 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
27259 </p>
27260 !! wikitext
27261 x<nowiki/>http://example.com<nowiki/>y
27262 http://example.com<nowiki/>?x
27263 http://example.com<nowiki/>&x
27264 http://example.com<nowiki/>'x
27265 http://example.com<nowiki/>,x
27266 http://example.com<nowiki/>.x
27267 http://example.com<nowiki/>;x
27268 http://example.com<nowiki/>:x
27269 http://example.com<nowiki/>;x
27270 http://example.com<nowiki/>!x
27271 http://example.com<nowiki/>=x
27272 http://example.com<nowiki/>(x)
27273 http://example.com(x<nowiki/>)
27274 !! end
27275
27276 !! test
27277 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27278 !! options
27279 parsoid=html2wt
27280 !! html/parsoid
27281 <p>x
27282 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
27283 y
27284 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
27285 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
27286 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
27287 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
27288 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
27289 </p>
27290 !! wikitext
27291 x
27292 http://example.com
27293 y
27294 "http://example.com"
27295 (http://example.com)
27296 (http://example.com) foo
27297 http://example.com,
27298 http://example.com, foo
27299 !! html/php
27300 <p>x
27301 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
27302 y
27303 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
27304 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
27305 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
27306 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
27307 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
27308 </p>
27309 !! end
27310
27311 !! test
27312 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27313 !! options
27314 parsoid=html2wt
27315 !! html/parsoid
27316 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
27317 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
27318 !! wikitext
27319 http://example.com.,;:!?\
27320 -http://example.com:
27321 !! html/php
27322 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
27323 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
27324 </p>
27325 !! end
27326
27327 !! test
27328 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
27329 !! options
27330 parsoid=html2wt
27331 !! html/parsoid
27332 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
27333 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
27334 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
27335 !! wikitext
27336 RFC 123<nowiki/>4
27337 RFC 123<nowiki/>y
27338 X<nowiki/>RFC 123<nowiki/>y
27339 !! end
27340
27341 !! test
27342 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
27343 !! options
27344 parsoid=html2wt
27345 !! html/parsoid
27346 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
27347 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
27348 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
27349 </p>
27350 !! wikitext
27351 RFC 123?foo
27352 RFC 123&foo
27353 -RFC 123-
27354 !! html/php
27355 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
27356 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
27357 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
27358 </p>
27359 !! end
27360
27361 !! test
27362 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27363 !! options
27364 parsoid=html2wt
27365 !! html/parsoid
27366 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27367 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27368 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27369 !! wikitext
27370 PMID 123<nowiki/>4
27371 PMID 123<nowiki/>y
27372 X<nowiki/>PMID 123<nowiki/>y
27373 !! end
27374
27375 !! test
27376 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27377 !! options
27378 parsoid=html2wt
27379 !! html/parsoid
27380 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27381 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27382 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27383 </p>
27384 !! wikitext
27385 PMID 123?foo
27386 PMID 123&foo
27387 -PMID 123-
27388 !! html/php
27389 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27390 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27391 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27392 </p>
27393 !! end
27394
27395 !! test
27396 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27397 !! options
27398 parsoid=html2wt
27399 !! html/parsoid
27400 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27401 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27402 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27403 </p>
27404 !! wikitext
27405 ISBN 1234567890<nowiki/>1
27406 ISBN 1234567890<nowiki/>x
27407 a<nowiki/>ISBN 1234567890<nowiki/>b
27408 !! end
27409
27410 !! test
27411 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27412 !! options
27413 parsoid=html2wt
27414 !! html/parsoid
27415 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27416 !! wikitext
27417 -ISBN 1234567890's
27418 !! html/php
27419 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27420 </p>
27421 !! end
27422
27423 !! test
27424 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27425 !! options
27426 parsoid=html2wt
27427 !! html/*
27428 <p>this is not a link: http://example.com
27429 </p>
27430 !! wikitext
27431 this is not a link: <nowiki>http://example.com</nowiki>
27432 !! end
27433
27434 !! test
27435 Links 15. Link trails can't become link prefixes.
27436 !! options
27437 language=is
27438 parsoid=html2wt
27439 !! html/parsoid
27440 <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>
27441 !! wikitext
27442 [[Söfnuður]]-[[00]]
27443 !! html/php
27444 <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>
27445 </p>
27446 !! end
27447
27448 #### --------------- Quotes ---------------
27449 #### 1. Quotes inside <b> and <i>
27450 #### 2. Link fragments separated by <i> and <b> tags
27451 #### 3. Link fragments inside <i> and <b>
27452 #### 4. No escaping needed
27453 #### --------------------------------------
27454 !! test
27455 1a. Quotes inside <b> and <i>
27456 !! options
27457 parsoid=html2wt
27458 !! html/*
27459 <p><i>'foo'</i>
27460 <i>''foo''</i>
27461 <i>'''foo'''</i>
27462 <i>foo</i>'s
27463 <b>'foo'</b>
27464 <b>''foo''</b>
27465 <b>'''foo'''</b>
27466 <b>foo'<i>bar'</i>baz</b>
27467 <b>foo</b>'s
27468 '<i>foo</i>
27469 <i>foo</i>'
27470 <i>foo'</i>'
27471 '<i>foo</i>'
27472 '<b>foo</b>
27473 <b>foo</b>'
27474 '<b>foo</b>'
27475 <i>fools'<span> errand</span></i>
27476 <i><span>fool</span>'s errand</i>
27477 '<i>foo</i> bar '<i>baz</i>
27478 a|!*#-:;+-~[]{}b'<i>x</i>
27479 </p>
27480 !! wikitext
27481 ''<nowiki/>'foo'''
27482 ''<nowiki>''foo''</nowiki>''
27483 ''<nowiki>'''foo'''</nowiki>''
27484 ''foo''<nowiki/>'s
27485 '''<nowiki/>'foo''''
27486 '''<nowiki>''foo''</nowiki>'''
27487 '''<nowiki>'''foo'''</nowiki>'''
27488 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27489 '''foo'''<nowiki/>'s
27490 '''foo''
27491 ''foo''<nowiki/>'
27492 ''foo'''<nowiki/>'
27493 '''foo''<nowiki/>'
27494 ''''foo'''
27495 '''foo'''<nowiki/>'
27496 ''''foo'''<nowiki/>'
27497 ''fools'<span> errand</span>''
27498 ''<span>fool</span>'s errand''
27499 '<nowiki/>''foo'' bar '''baz''
27500 a|!*#-:;+-~[]{}b'''x''
27501 !! end
27502
27503 !! test
27504 1b. Quotes inside <b> and <i> with other tags on same line
27505 !! options
27506 parsoid=html2wt
27507 !! html/parsoid
27508 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27509 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27510 <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>
27511 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27512 '<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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
27513 '<i>foo</i> <div title="name">test</div>
27514 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27515 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27516 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
27517 </ol>
27518 !! wikitext
27519 '''a'' foo ''[[bar]]''
27520 ''a''' foo ''[[bar]]''
27521 ''a''' foo '''{{echo|[[bar]]}}'''
27522 [[foo]] x'''[[bar]]''
27523 '''foo'' <ref>test</ref>
27524 '''foo'' <div title="name">test</div>
27525 '''foo'' and <br> bar
27526 <references />
27527 !! end
27528
27529 !! test
27530 2. Link fragments separated by <i> and <b> tags
27531 !! options
27532 parsoid=html2wt
27533 !! html/parsoid
27534 <p>[[<i>foo</i>hello]]</p>
27535 <p>[[<b>foo</b>hello]]</p>
27536 !! wikitext
27537 [[''foo''<nowiki>hello]]</nowiki>
27538
27539 [['''foo'''<nowiki>hello]]</nowiki>
27540 !! end
27541
27542 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27543 # this is one of the shortcomings of this format
27544 !! test
27545 3. Link fragments inside <i> and <b>
27546 !! options
27547 parsoid=html2wt
27548 !! html/parsoid
27549 <p><i>[[foo</i>]]</p>
27550 <p><b>[[foo</b>]]</p>
27551 !! wikitext
27552 ''[[foo''<nowiki>]]</nowiki>
27553
27554 '''[[foo'''<nowiki>]]</nowiki>
27555 !! end
27556
27557 !! test
27558 4. No escaping needed
27559 !! options
27560 parsoid=html2wt
27561 !! html/parsoid
27562 <p>'<span><i>bar</i></span>'
27563 '<span><b>bar</b></span>'
27564 'a:b'foo
27565 </p>
27566 !! wikitext
27567 '<span>''bar''</span>'
27568 '<span>'''bar'''</span>'
27569 'a:b'foo
27570 !! end
27571
27572 #### ----------- Paragraphs ---------------
27573 #### 1. No unnecessary escapes
27574 #### --------------------------------------
27575
27576 !! test
27577 1. No unnecessary escapes
27578 !! options
27579 parsoid=html2wt
27580 !! html/parsoid
27581 <p>bar <span>[[foo]]</span>
27582 </p><p>=bar <span>[[foo]]</span>
27583 </p><p>[[bar <span>[[foo]]</span>
27584 </p><p>]]bar <span>[[foo]]</span>
27585 </p><p>=bar <span>foo]]</span>=
27586 </p>
27587 !! wikitext
27588 bar <span><nowiki>[[foo]]</nowiki></span>
27589
27590 =bar <span><nowiki>[[foo]]</nowiki></span>
27591
27592 [[bar <span><nowiki>[[foo]]</nowiki></span>
27593
27594 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27595
27596 =bar <span>foo]]</span><nowiki>=</nowiki>
27597 !!end
27598
27599 #### ----------------------- PRE --------------------------
27600 !! test
27601 1. Leading whitespace in SOL context should be escaped
27602 !! options
27603 parsoid=html2wt
27604 !! html/parsoid
27605 <p> a</p>
27606
27607 <p> a</p>
27608
27609 <p> a(tab)</p>
27610
27611 <p> a
27612 <!--cmt-->
27613 a</p>
27614
27615 <p>a
27616 b</p>
27617
27618 <p>a
27619 b</p>
27620
27621 <p>a
27622 b</p>
27623 !! wikitext
27624 <nowiki> </nowiki>a
27625
27626 <nowiki> </nowiki> a
27627
27628 a(tab)
27629
27630 <nowiki> </nowiki> a
27631 <!--cmt-->
27632 <nowiki> </nowiki>a
27633
27634 a
27635 <nowiki> </nowiki>b
27636
27637 a
27638 b
27639
27640 a
27641 b
27642 !! html/php
27643 <p> a
27644 </p><p> a
27645 </p><p> a(tab)
27646 </p><p> a
27647 a
27648 </p><p>a
27649 b
27650 </p><p>a
27651 b
27652 </p><p>a
27653 b
27654 </p>
27655 !! end
27656
27657 !! test
27658 2. Leading whitespace in non-indent-pre contexts should not be escaped
27659 !! options
27660 parsoid=html2wt
27661 !! html/parsoid
27662 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
27663 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27664 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>a</i>
27665 b</span></li>
27666 </ol>
27667 !! wikitext
27668 foo <ref>''a''
27669 b</ref>
27670 <references />
27671 !! end
27672
27673 !! test
27674 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27675 !! options
27676 parsoid=html2wt
27677 !! html/parsoid
27678 <blockquote>
27679 <p>
27680 a
27681 <span>b</span>
27682 c</p>
27683 </blockquote>
27684 !! wikitext
27685 <blockquote>
27686 a
27687 <span>b</span>
27688 c
27689 </blockquote>
27690 !! end
27691
27692 !! test
27693 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27694 !! options
27695 parsoid=html2wt
27696 !! html/parsoid
27697 <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>
27698 !! wikitext
27699 [[File:Foobar.jpg|thumb|caption]]
27700 !! end
27701
27702 !! test
27703 5. Nowiki escaping should account for indent-pres
27704 !! options
27705 parsoid=html2wt
27706 !! html/parsoid
27707 <pre>==foo==</pre>
27708 !! wikitext
27709 ==foo==
27710 !! end
27711
27712 !! test
27713 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27714 !! options
27715 parsoid=html2wt
27716 !! html/parsoid
27717 <pre>
27718 * foo
27719 * bar
27720 </pre>
27721 !! wikitext
27722 * foo
27723 * bar
27724 !! end
27725
27726 !! test
27727 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27728 !! options
27729 parsoid = {
27730 "modes": ["html2wt"],
27731 "scrubWikitext": true
27732 }
27733 !! html/parsoid
27734 <p> foo</p>
27735 <p> %foo</p>
27736 <p> *foo</p>
27737 <p> #foo</p>
27738 <p> =foo=</p>
27739 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27740 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27741 <p> <!--boo-->*foo</p>
27742 <p><!--boo--> *foo</p>
27743 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27744 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27745 !! wikitext
27746 foo
27747
27748 %foo
27749
27750 <nowiki/>*foo
27751
27752 <nowiki/>#foo
27753
27754 <nowiki/>=foo=
27755
27756 [[Category:Foo]]
27757 <nowiki/>*foo
27758
27759 [[Category:Foo]]
27760 <nowiki>*</nowiki>foo
27761
27762 <nowiki/><!--boo-->*foo
27763
27764 <!--boo--><nowiki/>*foo
27765
27766 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27767
27768 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27769 !! end
27770
27771 #### --------------- Behavior Switches --------------------
27772
27773 !! test
27774 1. Valid behavior switches should be escaped
27775 !! options
27776 parsoid=html2wt
27777 !! html/parsoid
27778 __TOC__
27779 <i>__TOC__</i>
27780 !! wikitext
27781 <nowiki>__TOC__</nowiki>
27782 ''<nowiki>__TOC__</nowiki>''
27783 !! end
27784
27785 !! test
27786 2. Invalid behavior switches should not be escaped
27787 !! options
27788 parsoid=html2wt
27789 !! html/parsoid
27790 __TOO__
27791 __|__
27792 !! wikitext
27793 __TOO__
27794 __|__
27795 !! end
27796
27797 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27798 !! test
27799 Behavior switches should be SOL-transparent
27800 !! options
27801 parsoid=html2wt
27802 !! html/parsoid
27803 <meta property="mw:PageProp/toc" />
27804
27805 <!-- this one's bogus -->
27806 <pre>__TOO__</pre>
27807
27808 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27809
27810 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27811 !! wikitext
27812 __TOC__
27813
27814 <!-- this one's bogus -->
27815 __TOO__
27816
27817 __TOC__ foo
27818
27819 __TOC__
27820 bar
27821 !! end
27822
27823 #### --------------- HTML tags ---------------
27824 #### 1. a tags
27825 #### 2. other tags
27826 #### 3. multi-line html tag
27827 #### 4. extension tags
27828 #### -----------------------------------------
27829 !! test
27830 1. a tags
27831 !! options
27832 parsoid=html2wt
27833 !! html/parsoid
27834 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27835 !! wikitext
27836 <a href="http://google.com">google</a>
27837 !! end
27838
27839 !! test
27840 2. other tags
27841 !! options
27842 parsoid=html2wt
27843 !! html/parsoid
27844 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27845 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27846 <li> &lt;td&gt;</li></ul>
27847
27848 !! wikitext
27849 * <nowiki><div>foo</div></nowiki>
27850 * <nowiki><div style="color:red">foo</div></nowiki>
27851 * <nowiki><td></nowiki>
27852 !! end
27853
27854 !! test
27855 3. multi-line html tag
27856 !! options
27857 parsoid=html2wt
27858 !! html/parsoid
27859 <p>&lt;div
27860 &gt;foo&lt;/div
27861 &gt;
27862 </p>
27863 !! wikitext
27864 <nowiki><div
27865 >foo</div
27866 ></nowiki>
27867 !! end
27868
27869 !! test
27870 4. extension tags
27871 !! options
27872 parsoid=html2wt
27873 !! html/parsoid
27874 <p>&lt;ref&gt;foo&lt;/ref&gt;
27875 </p><p>&lt;ref&gt;bar
27876 </p><p>baz&lt;/ref&gt;
27877 </p>
27878 !! wikitext
27879 <nowiki><ref>foo</ref></nowiki>
27880
27881 <nowiki><ref>bar</nowiki>
27882
27883 baz<nowiki></ref></nowiki>
27884 !! end
27885
27886 !! test
27887 Parsoid: newline inducing block nodes don't suppress <nowiki>
27888 !! options
27889 parsoid=html2wt
27890 !! html/parsoid
27891 a<h1>foo</h1>
27892 !! wikitext
27893 <nowiki> </nowiki>a
27894
27895 = foo =
27896 !! end
27897
27898 #### --------------- Others ---------------
27899 !! test
27900 Escaping nowikis
27901 !! options
27902 parsoid=html2wt
27903 !! html/parsoid
27904 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27905 </p>
27906 !! wikitext
27907 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27908 !! end
27909
27910 ## The quote-char in the input is necessary for triggering the bug
27911 !! test
27912 (T54035) Nowiki-escaping should not get tripped by " :" in text
27913 !! options
27914 parsoid=html2wt
27915 !! html/parsoid
27916 <p>foo's bar :</p>
27917 !! wikitext
27918 foo's bar :
27919 !! end
27920
27921 #----------- End of wikitext escaping tests --------------
27922
27923 !! test
27924
27925 Tag-like HTML structures are passed through as text
27926 !! wikitext
27927 <x y>
27928
27929 <x.y>
27930
27931 <x-y>
27932
27933 1>2
27934
27935 x<y
27936
27937 a>b
27938
27939 1<d e>f
27940 !! html
27941 <p>&lt;x y&gt;
27942 </p><p>&lt;x.y&gt;
27943 </p><p>&lt;x-y&gt;
27944 </p><p>1&gt;2
27945 </p><p>x&lt;y
27946 </p><p>a&gt;b
27947 </p><p>1&lt;d e&gt;f
27948 </p>
27949 !! end
27950
27951 !! test
27952 HTML tag with necessary entities in attributes
27953 !! wikitext
27954 <span title="&amp;amp;">foo</span>
27955 !! html
27956 <p><span title="&amp;amp;">foo</span>
27957 </p>
27958 !! end
27959
27960 !! test
27961 HTML tag with 'unnecessary' entity encoding in attributes
27962 !! wikitext
27963 <span title="&amp;">foo</span>
27964 !! html
27965 <p><span title="&amp;">foo</span>
27966 </p>
27967 !! end
27968
27969 !! test
27970 HTML tag with broken attribute value quoting
27971 !! options
27972 parsoid=wt2html,html2html
27973 !! wikitext
27974 <span title="Hello world>Foo</span>
27975 !! html/php
27976 <p><span title="Hello world">Foo</span>
27977 </p>
27978 !! html/parsoid
27979 <p><span title="Hello world">Foo</span></p>
27980 !! end
27981
27982 !! test
27983 Self-closed tag with broken attribute value quoting
27984 !! options
27985 parsoid=wt2html,html2html
27986 !! wikitext
27987 <div title="Hello world />Foo
27988 !! html/php+tidy
27989 <div title="Hello world"></div><p>Foo</p>
27990 !! html/parsoid
27991 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27992 !! end
27993
27994 !! test
27995 Table with broken attribute value quoting
27996 !! options
27997 parsoid=wt2html,html2html
27998 !! wikitext
27999 {|
28000 | title="Hello world|Foo
28001 |}
28002 !! html/php
28003 <table>
28004 <tr>
28005 <td title="Hello world">Foo
28006 </td></tr></table>
28007 !! html/parsoid
28008 <table>
28009 <tr>
28010 <td title="Hello world">Foo
28011 </td></tr></table>
28012 !! end
28013
28014 !! test
28015 Table with broken attribute value quoting on consecutive lines
28016 !! options
28017 parsoid=wt2html,html2html
28018 !! wikitext
28019 {|
28020 | title="Hello world|Foo
28021 | style="color:red|Bar
28022 |}
28023 !! html/php
28024 <table>
28025 <tr>
28026 <td title="Hello world">Foo
28027 </td>
28028 <td style="color:red">Bar
28029 </td></tr></table>
28030 !! html/parsoid
28031 <table><tbody>
28032 <tr>
28033 <td title="Hello world">Foo
28034 </td><td style="color: red">Bar
28035 </td></tr></tbody></table>
28036 !! end
28037
28038 !!test
28039 Accept empty td cell attribute
28040 !! wikitext
28041 {|
28042 | align="center" |foo|| |
28043 |}
28044 !! html
28045 <table>
28046 <tr>
28047 <td align="center">foo</td>
28048 <td>
28049 </td></tr></table>
28050 !! end
28051
28052 !!test
28053 Non-empty attributes in th-cells
28054 !! wikitext
28055 {|
28056 !Foo!! style="color: red" |Bar
28057 |}
28058 !! html
28059 <table>
28060 <tr>
28061 <th>Foo</th>
28062 <th style="color: red">Bar
28063 </th></tr></table>
28064 !! end
28065
28066 !!test
28067 Accept empty attributes in th-cells
28068 !! wikitext
28069 {|
28070 !|foo!!|bar
28071 |}
28072 !! html
28073 <table>
28074 <tr>
28075 <th>foo</th>
28076 <th>bar
28077 </th></tr></table>
28078 !! end
28079
28080 !!test
28081 Empty table rows go away
28082 !! wikitext
28083 {|
28084 |Hello
28085 |there
28086 |- class="foo"
28087 |-
28088 |}
28089 !! html
28090 <table>
28091 <tr>
28092 <td>Hello
28093 </td>
28094 <td>there
28095 </td></tr>
28096
28097 </table>
28098 !! end
28099
28100 ###
28101 ### Parsoid-centric tests for testing RTing of inter-element separators
28102 ### Edge cases not tested by existing parser tests and specific to
28103 ### Parsoid-specific serialization strategies.
28104 ###
28105
28106 !!test
28107 RT-ed inter-element separators should be valid separators
28108 !! wikitext
28109 {|
28110 |- [[foo]]
28111 |}
28112 !! html/php
28113 <table>
28114
28115 </table>
28116 !! html/parsoid
28117 <table>
28118 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
28119 </tbody></table>
28120 !!end
28121
28122 # Parsoid-only test of a DOM pass
28123 !!test
28124 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
28125 !! wikitext
28126 {|
28127 |<small>foo
28128 bar
28129 |}
28130
28131 {|
28132 |<small>foo<small>
28133 |}
28134 !! html/parsoid
28135 <table>
28136 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
28137 <p>bar</p></small></td></tr>
28138 </tbody></table>
28139
28140 <table>
28141 <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>
28142 </tbody></table>
28143 !!end
28144
28145 # Note that the "style" attribute is really a template parameter here.
28146 # The = would have to be {{=}} if you wanted the literal.
28147 !!test
28148 Empty TD followed by TD with tpl-generated attribute
28149 !! wikitext
28150 {|
28151 |-
28152 |
28153 |{{echo|style='color:red'}}|foo
28154 |}
28155 !! html
28156 <table>
28157
28158 <tr>
28159 <td>
28160 </td>
28161 <td>foo
28162 </td></tr></table>
28163 !! end
28164
28165 !!test
28166 Indented table with an empty td
28167 !! wikitext
28168 {|
28169 |-
28170 |
28171 |foo
28172 |}
28173 !! html
28174 <table>
28175
28176 <tr>
28177 <td>
28178 </td>
28179 <td>foo
28180 </td></tr></table>
28181 !! end
28182
28183 !! test
28184 Indented table with blank lines in between (T85627)
28185 !! wikitext
28186 {|
28187 |foo
28188
28189
28190 |}
28191 !! html/php
28192 <table>
28193 <tr>
28194 <td>foo
28195 <p><br />
28196 </p>
28197 </td></tr></table>
28198 !! html/parsoid
28199 <table>
28200 <tbody><tr><td>foo
28201 <p>
28202 <br /></p></td></tr>
28203 </tbody></table>
28204 !! end
28205
28206 !!test
28207 Indented block & table
28208 !! wikitext
28209 <div>foo</div>
28210 {|
28211 |foo
28212 |}
28213 !! html/php
28214 <div>foo</div>
28215 <table>
28216 <tr>
28217 <td>foo
28218 </td></tr></table>
28219 !! html/parsoid
28220 <div data-parsoid='{"stx":"html"}'>foo</div>
28221 <table><tbody>
28222 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
28223 </tbody></table>
28224 !!end
28225
28226 !! test
28227 Indent and comment before table row
28228 !! wikitext
28229 {|
28230 <!--hi-->|-
28231 |there
28232 |}
28233 !! html/php
28234 <table>
28235
28236 <tr>
28237 <td>there
28238 </td></tr></table>
28239 !! html/parsoid
28240 <table>
28241 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
28242 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
28243 </tbody></table>
28244 !! end
28245
28246 # PHP parser omits empty TR
28247 !!test
28248 Empty TR followed by a template-generated TR
28249 !! wikitext
28250 {|
28251 |-
28252 {{echo|<tr><td>foo</td></tr>}}
28253 |}
28254 !! html/php+tidy
28255 <table>
28256
28257 <tbody><tr><td>foo</td></tr>
28258 </tbody></table>
28259 !! html/parsoid
28260 <table>
28261 <tbody>
28262 <tr class='mw-empty-elt'></tr>
28263 <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}}]}'>
28264 <td>foo</td></tr>
28265 </tbody></table>
28266 !!end
28267
28268 ## PHP and parsoid output differ for this; as usual PHP omits empty
28269 ## elements, and since it strips the comments the TR is empty.
28270 !!test
28271 Empty TR followed by mixed-ws-comment line should RT correctly
28272 !! wikitext
28273 {|
28274 |-
28275 <!--c-->
28276 |-
28277 <!--c--> <!--d-->
28278 |}
28279 !! html/php+tidy
28280 <table>
28281
28282
28283 </table>
28284 !! html/parsoid
28285 <table>
28286 <tbody>
28287 <tr class='mw-empty-elt'></tr>
28288 <!--c-->
28289 <tr>
28290 <!--c--> </tr><!--d-->
28291 </tbody></table>
28292 !! end
28293
28294 !!test
28295 Multi-line image caption generated by templates with/without trailing newlines
28296 !! wikitext
28297 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
28298 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
28299 !! html/parsoid
28300 <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>
28301 <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>
28302 !!end
28303
28304 !! test
28305 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
28306 !! options
28307 parsoid=html2wt
28308 !! html/parsoid
28309 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}' data-mw='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
28310
28311 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
28312 !! wikitext
28313 <includeonly>foo</includeonly>
28314 new para
28315
28316 [[Category:Foo]]
28317
28318 = new heading =
28319 !! end
28320
28321 ## PHP emits broken html for this, and since this is primarily
28322 ## a Parsoid serializer test, marking this Parsoid only
28323 !!test
28324 Improperly nested inline or quotes tags with whitespace in between
28325 !! wikitext
28326 <span> <s>x</span> </s>
28327 ''' ''x''' ''
28328 !! html/parsoid
28329 <p><span> <s>x</s></span><s> </s>
28330 <b> <i>x</i></b><i> </i>
28331 </p>
28332 !!end
28333
28334 !!test
28335 Encapsulate protected attributes from wt
28336 !! wikitext
28337 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
28338
28339 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
28340 |ok
28341 |}
28342 !! html/parsoid
28343 <div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
28344
28345 <table data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">
28346 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
28347 </tbody></table>
28348 !!end
28349
28350 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28351 ## Having nested or stray pre tags results in the attempt to add duplicates,
28352 ## causing an assertion fail. This test tries to prevent that situation.
28353 !! test
28354 Ensure ParagraphWrapper can deal with stray closing pre tags
28355 !! options
28356 parsoid=wt2html
28357 !! wikitext
28358 plain text</pre>
28359 !! html/parsoid
28360 <p>plain text</p>
28361 !! end
28362
28363 ## Remex doesn't account for fostered content.
28364 !! test
28365 1. Ensure fostered text content is wrapped in element nodes
28366 !! options
28367 parsoid=wt2html
28368 !! wikitext
28369 <table>hi</table><table>ho</table>
28370 !! html/php+tidy
28371 hi<table></table>ho<table></table>
28372 !! html/parsoid
28373 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>hi</p><table data-parsoid='{"stx":"html"}'></table><p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>ho</p><table data-parsoid='{"stx":"html"}'></table>
28374 !! end
28375
28376 ## Remex doesn't account for fostered content.
28377 !! test
28378 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28379 !! options
28380 parsoid=wt2html,wt2wt
28381 !! wikitext
28382 <table>
28383 <tr> || ||
28384 <td> a
28385 </table>
28386 !! html/php+tidy
28387 || ||
28388 <table>
28389 <tbody><tr><td> a
28390 </td></tr></tbody></table>
28391 !! html/parsoid
28392 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28393 <table data-parsoid='{"stx":"html"}'>
28394 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28395 </td></tr></tbody></table>
28396 !! end
28397
28398 ## Remex doesn't account for fostered content.
28399 !! test
28400 Encapsulation properly handles null DSR information from foster box
28401 !! options
28402 parsoid=wt2html,wt2wt
28403 !! wikitext
28404 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28405 !! html/parsoid
28406 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>foo&lt;tr>&lt;td>bar&lt;/td>&lt;/tr>&lt;/table>"}},"i":0}}]}'>foo</p><table about="#mwt1" data-parsoid='{"stx":"html"}'><tbody><tr><td>bar</td></tr></tbody></table>
28407 !! end
28408
28409 ## Remex doesn't account for fostered content.
28410 !! test
28411 1. Encapsulate foster-parented transclusion content
28412 !! options
28413 parsoid=wt2wt,wt2html
28414 !! wikitext
28415 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28416 !! html/php+tidy
28417 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28418 !! html/parsoid
28419 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;tr>&lt;td>bar&lt;/td>&lt;/tr>"}},"i":0}},"&lt;/table>"]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td>bar</td></tr></tbody></table>
28420 !! end
28421
28422 !! test
28423 2. Encapsulate foster-parented transclusion content
28424 !! options
28425 parsoid=wt2wt,wt2html
28426 !! wikitext
28427 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28428 !! html/parsoid
28429 <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>
28430 <table>
28431 <tbody>
28432 <tr>
28433 <td>bar</td>
28434 </tr>
28435 </tbody>
28436 </table>
28437 !! end
28438
28439 !! test
28440 3. Encapsulate foster-parented transclusion content
28441 !! options
28442 parsoid=wt2wt,wt2html
28443 !! wikitext
28444 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28445 !! html/parsoid
28446 <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;]}">
28447 <p>foo</p>
28448 </div>
28449 <table>
28450 <tbody>
28451 <tr>
28452 <td>bar</td>
28453 </tr>
28454 </tbody>
28455 </table>
28456 !! end
28457
28458 !! test
28459 4. Encapsulate foster-parented transclusion content
28460 !! options
28461 parsoid=wt2wt,wt2html
28462 !! wikitext
28463 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28464 !! html/parsoid
28465 <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;]}">
28466 <p>foo</p>
28467 </div>
28468 <table>
28469 <tbody>
28470 <tr>
28471 <td>bar</td>
28472 </tr>
28473 </tbody>
28474 </table>
28475 !! end
28476
28477 ## Remex doesn't account for fostered content.
28478 !! test
28479 5. Encapsulate foster-parented transclusion content
28480 !!options
28481 parsoid=wt2wt,wt2html
28482 !! wikitext
28483 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28484 !! html/php+tidy
28485 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28486 !! html/parsoid
28487 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo"}},"i":0}},"&lt;/tr>&lt;/table>"]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28488 !! end
28489
28490 ## Remex doesn't account for fostered content.
28491 !! test
28492 6. Encapsulate foster-parented transclusion content
28493 !! options
28494 parsoid=wt2wt,wt2html
28495 !! wikitext
28496 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28497 !! html/php+tidy
28498 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28499 !! html/parsoid
28500 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;tr>&lt;td>&lt;div>&lt;p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;/p>&lt;/div>&lt;/td>foo&lt;/tr>&lt;/table>"}},"i":0}}]}'>foo</p><table about="#mwt2" data-parsoid='{"stx":"html"}'><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p data-parsoid='{"stx":"html"}'>ok</p>
28501 !! end
28502
28503 !! test
28504 7. Encapsulate foster-parented transclusion content
28505 !!options
28506 parsoid=wt2wt,wt2html
28507 !! wikitext
28508 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28509 !! html/parsoid
28510 <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>
28511 <table>
28512 <tbody>
28513 <tr>
28514 <td>bar</td>
28515 </tr>
28516 </tbody>
28517 </table>
28518 !! end
28519
28520 ## Remex doesn't account for fostered content.
28521 # Note that the wt is broken on purpose: the = should be {{=}} if you
28522 # don't want it to be a template parameter key.
28523 !! test
28524 8. Encapsulate foster-parented transclusion content
28525 !! options
28526 parsoid=wt2wt,wt2html
28527 !! wikitext
28528 {{echo|a
28529 }}{|{{echo|style='color:red'}}
28530 |-
28531 |b
28532 |}
28533 !! html/php+tidy
28534 <p>a
28535 </p>
28536 <table>
28537
28538 <tbody><tr>
28539 <td>b
28540 </td></tr></tbody></table>
28541 !! html/parsoid
28542 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p><span about="#mwt1">
28543 </span><p about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE","pi":[[{"k":"style","named":true}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&apos;color:red&apos;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p><table about="#mwt3">
28544 <tbody><tr>
28545 <td>b
28546 </td></tr></tbody></table>
28547 !! end
28548
28549 ## Remex doesn't account for fostered content.
28550 !! test
28551 9. Encapsulate foster-parented transclusion content
28552 !!options
28553 parsoid=wt2wt,wt2html
28554 !! wikitext
28555 <table>{{echo|hi</table>hello}}
28556 !! html/php+tidy
28557 hi<table></table><p>hello</p>
28558 !! html/parsoid
28559 <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}'>hi</p><table about="#mwt2"></table><p about="#mwt2">hello</p>
28560 !! end
28561
28562 !! test
28563 Table in fosterable position
28564 !!options
28565 parsoid=wt2html
28566 !! wikitext
28567 {{OpenTable}}
28568 <div>
28569 {|
28570 |}
28571 </div>
28572 |}
28573 !! html/parsoid
28574 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
28575 </span>
28576 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28577
28578 <table>
28579 </table>
28580 !! end
28581
28582 # Parsoid only for T66747
28583 # (Also core doesn't define {{#if}} in default install)
28584 !! test
28585 Properly encapsulate empty-content transclusions in fosterable positions
28586 !! wikitext
28587 <table>
28588 {{#if:|
28589 <td>foo</td>
28590 }}
28591 </table>
28592 !! html/parsoid
28593 <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"}]]}'>
28594
28595 </table>
28596 !! end
28597
28598 ## No longer captures its original intention
28599 !! test
28600 Always encapsulate foster box when template range is expanded to table
28601 !! options
28602 disabled
28603 parsoid=wt2wt
28604 !! wikitext
28605 {|
28606 hello
28607 {{OpenTable}}
28608 |}
28609 !! html/parsoid
28610 !! end
28611
28612 !! test
28613 T115289: Unclosed table
28614 !! wikitext
28615 {{echo|<table>}}<!--c-->[[Category:Two]]
28616 !! html/parsoid
28617 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
28618 !! end
28619
28620 !! test
28621 T115289: Don't migrate newlines out of tables with fostered content
28622 !! wikitext
28623 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28624 !! html/parsoid
28625 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
28626 !! end
28627
28628 !! test
28629 T73074: More fostering fun
28630 !! wikitext
28631 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28632 !! html/parsoid
28633 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
28634 !! end
28635
28636 !!test
28637 Support <object> element with .data attribute
28638 !!options
28639 parsoid=html2wt
28640 !! html/parsoid
28641 <object data="test.swf"></object>
28642 !! wikitext
28643 <object data="test.swf"></object>
28644 !!end
28645
28646 !! test
28647 T72867: Don't block XML namespace declaration
28648 !! wikitext
28649 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28650 !! html/php
28651 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28652 </p>
28653 !! html/parsoid
28654 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28655 !! end
28656
28657 # -----------------------------------------------------------------
28658 # The following section of tests are primarily to spec requirements
28659 # around Parsoid's serialization (old, new, edited content)
28660 #
28661 # All these tests are marked Parsoid html2wt and html2html only
28662 # ----------------------------------------------------------------
28663
28664 !! test
28665 Ignore rel attribute in a-tags during serialization to url-links
28666 !! options
28667 parsoid=html2wt
28668 !! html/parsoid
28669 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28670 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28671 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28672 !! wikitext
28673 http://en.wikipedia.org/wiki/Foobar
28674 http://en.wikipedia.org/wiki/Foobar
28675 http://en.wikipedia.org/wiki/Foobar
28676 !! end
28677
28678 # 'mi' is a localinterwiki prefix as well as a language
28679 !! test
28680 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28681 !! options
28682 parsoid=html2wt
28683 !! html/parsoid
28684 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28685 !! wikitext
28686 [[Foo]]
28687 !! end
28688
28689 !! test
28690 Parsoid should accept interwiki shortcuts
28691 !! options
28692 parsoid=html2wt
28693 !! html/parsoid
28694 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28695 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28696 <a href='./fr:Foo'>Foo</a></p>
28697 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28698 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28699 <a href='fr%3AFoo'>Foo</a></p>
28700 <p><a href='FR%3AFoo'>Foo</a>
28701 <a href='./FR:Foo'>Foo</a></p>
28702 !! wikitext
28703 [[:fr:Foo|Foo]]
28704 [[:fr:Foo|Foo]]
28705 [[:fr:Foo|Foo]]
28706
28707 [[:fr:Foo|Foo]]
28708 [[:fr:Foo|Foo]]
28709 [[:fr:Foo|Foo]]
28710
28711 [[:fr:Foo|Foo]]
28712 [[:fr:Foo|Foo]]
28713 !! end
28714
28715 !! test
28716 Parsoid should not accept invalid interwiki shortcuts
28717 !! options
28718 parsoid=html2wt
28719 !! html/parsoid
28720 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28721 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28722 <a href='news:Foo'>Foo</a></p>
28723 !! wikitext
28724 [news:Foo Foo]
28725 [news:Foo Foo]
28726 [news:Foo Foo]
28727 !! end
28728
28729 # See T93839
28730 !! test
28731 New wikilinks should be serialized properly
28732 !! options
28733 parsoid=html2wt
28734 !! html/parsoid
28735 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28736 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28737 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28738 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28739 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28740 !! wikitext
28741 [[Foo]]
28742 [[Foo]]
28743 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28744 http://en.wikipedia.org/wiki/Foo
28745 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28746 !! end
28747
28748 !! test
28749 New wiki links (href variations)
28750 !! options
28751 parsoid=html2wt
28752 !! html/parsoid
28753 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28754 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28755 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28756 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28757 !! wikitext
28758 [[Foo_bar]]
28759 [[Foo_bar]]
28760 [[Foo_bar]]
28761 [[Toxine bactérienne]]
28762 !! end
28763
28764 !! test
28765 New wiki links (content string variations)
28766 !! options
28767 parsoid=html2wt
28768 !! html/parsoid
28769 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28770 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28771 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28772 !! wikitext
28773 [[Foo_bar]]
28774 [[Foo bar]]
28775 [[Foo_bar|./Foo_bar]]
28776 !! end
28777
28778 !! test
28779 New category links (href variations)
28780 !! options
28781 parsoid=html2wt
28782 !! html/parsoid
28783 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28784 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28785 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28786 !! wikitext
28787 [[Category:Toxine bactérienne]]
28788 [[Category:Toxine bactérienne]]
28789 [[Category:Toxine bactérienne]]
28790 !! end
28791
28792 !! test
28793 New sol transparent links don't need indent-pre nowiki protection
28794 !! options
28795 parsoid=html2wt
28796 language=de
28797 !! html/parsoid
28798 <link rel="mw:PageProp/redirect" href="./Main_Page">
28799 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28800 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28801 !! wikitext
28802 #WEITERLEITUNG [[Main Page]]
28803 <!-- this is good --> [[Category:Good]]
28804 <!-- this is great --> [[Kategorie:Great]]
28805 !! end
28806
28807 !! test
28808 New interlanguage links (href variations)
28809 !! options
28810 parsoid=html2wt
28811 !! html/parsoid
28812 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28813 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28814 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28815 !! wikitext
28816 [[es:Toxine bactérienne]]
28817 [[es:Toxine_bactérienne]]
28818 [[es:Toxine_bactérienne]]
28819 !! end
28820
28821 # Regression test for T219023
28822 !! test
28823 Emit simple non-piped link where possible
28824 !! options
28825 parsoid=html2wt
28826 !! html/parsoid
28827 <a rel='mw:WikiLink' href='./VisualEditor'>VisualEditor</a>
28828 <a rel='mw:WikiLink' href='./VisualEditor'>visualEditor</a>
28829 <a rel='mw:WikiLink' href='./VisualEditor link'>VisualEditor link</a>
28830 <a rel='mw:WikiLink' href='./VisualEditor link'>visualEditor link</a>
28831 !! wikitext
28832 [[VisualEditor]]
28833 [[visualEditor]]
28834 [[VisualEditor link]]
28835 [[visualEditor link]]
28836 !! end
28837
28838 !! test
28839 Image: Modifying size of an image (1)
28840 !! options
28841 parsoid={
28842 "modes": ["wt2wt"],
28843 "changes": [
28844 ["img[height]", "attr", "height", "22"],
28845 ["img[width]", "attr", "width", "200"]
28846 ]
28847 }
28848 !! wikitext
28849 [[Image:Foobar.jpg|230x230px]]
28850 !! wikitext/edited
28851 [[Image:Foobar.jpg|200x200px]]
28852 !!end
28853
28854 !! test
28855 Image: Modifying size of an image (2)
28856 !! options
28857 parsoid={
28858 "modes": ["wt2wt"],
28859 "changes": [
28860 ["img[height]", "attr", "height", "100"],
28861 ["img[width]", "attr", "width", "500"]
28862 ]
28863 }
28864 !! wikitext
28865 [[Image:Foobar.jpg|230x230px]]
28866 !! wikitext/edited
28867 [[Image:Foobar.jpg|500x500px]]
28868 !!end
28869
28870 # Change in size is ignored so long as class='mw-default-size'
28871 !! test
28872 Image: Modifying size of an image (3)
28873 !! options
28874 parsoid={
28875 "modes": ["wt2wt"],
28876 "changes": [
28877 ["figure[class]", "removeClass", "mw-default-size"],
28878 ["figure img", "attr", "height", "19"],
28879 ["figure img", "attr", "width", "170"]
28880 ]
28881 }
28882 !! wikitext
28883 [[Image:Foobar.jpg|thumb]]
28884 !! wikitext/edited
28885 [[Image:Foobar.jpg|thumb|170x170px]]
28886 !!end
28887
28888 !! test
28889 Image: Modifying alignment of an image (T50665)
28890 !! options
28891 parsoid={
28892 "modes": ["wt2wt"],
28893 "changes": [
28894 ["figure[class]", "removeClass", "mw-halign-right"],
28895 ["figure[class]", "addClass", "mw-halign-left"]
28896 ]
28897 }
28898 !! wikitext
28899 [[Image:Foobar.jpg|thumb|caption|right]]
28900 !! wikitext/edited
28901 [[Image:Foobar.jpg|thumb|caption|left]]
28902 !! end
28903
28904 !! test
28905 Image: Modifying mw-default-size of an frameless image (T64805)
28906 !! options
28907 parsoid={
28908 "modes": ["wt2wt"],
28909 "changes": [
28910 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28911 ]
28912 }
28913 !! wikitext
28914 [[Image:Foobar.jpg|frameless|right]]
28915 !! wikitext/edited
28916 [[Image:Foobar.jpg|frameless|right|220x220px]]
28917 !! end
28918
28919 !! test
28920 Image: Modifying valign of an image (T51221)
28921 !! options
28922 parsoid={
28923 "modes": ["wt2wt"],
28924 "changes": [
28925 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28926 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28927 ]
28928 }
28929 !! wikitext
28930 [[File:Foobar.jpg|20px|middle]]
28931 !! wikitext/edited
28932 [[File:Foobar.jpg|20px|text-top]]
28933 !! end
28934
28935 !! test
28936 Image: Modifying alt attribute of an image (T58400)
28937 !! options
28938 disabled
28939 parsoid={
28940 "modes": ["wt2wt"],
28941 "changes": [
28942 ["img[alt]", "attr", "alt", "some alternate edited text"]
28943 ]
28944 }
28945 !! wikitext
28946 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28947 !! wikitext/edited
28948 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28949 !!end
28950
28951 !! test
28952 Image: Modifying caption of an image
28953 !! options
28954 parsoid={
28955 "modes": ["wt2wt"],
28956 "changes": [
28957 ["figcaption", "text", "new caption"]
28958 ]
28959 }
28960 !! wikitext
28961 [[Image:Foobar.jpg|thumb|original caption]]
28962 !! wikitext/edited
28963 [[Image:Foobar.jpg|thumb|new caption]]
28964 !!end
28965
28966 !! test
28967 Image: empty alt attribute (T50924)
28968 !! wikitext
28969 [[File:Foobar.jpg|thumb|alt=|bar]]
28970 !! html/php+tidy
28971 <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" decoding="async" 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>
28972 !! html/parsoid
28973 <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>
28974 !! end
28975
28976 !! test
28977 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28978 !! options
28979 parsoid=html2wt
28980 language=ar
28981 disabled
28982 !! html/parsoid
28983 <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>
28984 !! wikitext
28985 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28986 !! end
28987
28988 !! test
28989 Image: Block level image should have \n before and after
28990 !! wikitext
28991 123
28992 [[File:Foobar.jpg|right|thumb|150x150px]]
28993 456
28994 !! html/parsoid
28995 <p>123</p>
28996 <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><figcaption></figcaption></figure>
28997 <p>456</p>
28998 !! end
28999
29000 !! test
29001 Image: New block level image should have \n before and after (existing content)
29002 !! wikitext
29003 123
29004 [[File:Foobar.jpg|right|thumb|150x150px]]
29005 456
29006 !! html/parsoid
29007 <p>123</p>
29008 <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><figcaption></figcaption></figure>
29009 <p>456</p>
29010 !! end
29011
29012 !! test
29013 Image: upright option (parsoid)
29014 !! wikitext
29015 [[File:Foobar.jpg|thumb|upright|caption]]
29016 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
29017 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
29018 !! html/parsoid
29019 <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>
29020 <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>
29021 <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>
29022 !! end
29023
29024 !! test
29025 Image: upright option is ignored on inline and frame images (parsoid)
29026 !! wikitext
29027 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
29028 !! html/parsoid
29029 <p><figure-inline 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></figure-inline></p>
29030 !! end
29031
29032 !! test
29033 Image: in template parameter with empty parameter
29034 !! wikitext
29035 {{echo|[[File:Foobar.jpg|link=]]}}
29036 !! html/parsoid
29037 <p><figure-inline class="mw-default-size" typeof="mw:Transclusion mw:Image" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[File:Foobar.jpg|link=]]"}},"i":0}}]}'><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></figure-inline></p>
29038 !! end
29039
29040 !! test
29041 Image: from basic HTML (1)
29042 !! options
29043 parsoid=html2wt
29044 !! html/parsoid
29045 <span typeof="mw:Image">
29046 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
29047 </span>
29048 !! wikitext
29049 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
29050 !! end
29051
29052 !! test
29053 Image: from basic HTML (2)
29054 !! options
29055 parsoid=html2wt
29056 !! html/parsoid
29057 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
29058 !! wikitext
29059 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
29060 !! end
29061
29062 !! test
29063 Image: from basic HTML (3)
29064 !! options
29065 parsoid=html2wt
29066 !! html/parsoid
29067 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
29068 !! wikitext
29069 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
29070 !! end
29071
29072 !! test
29073 Image: from basic HTML (4)
29074 !! options
29075 parsoid=html2wt
29076 !! html/parsoid
29077 <img src="./File:Foobar.jpg">
29078 !! wikitext
29079 [[File:Foobar.jpg|link=]]
29080 !! end
29081
29082 !! test
29083 Image: Invalid title as link
29084 !! wikitext
29085 [[File:Foobar.jpg|link=<]]
29086 !! html/php
29087 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
29088 </p>
29089 !! html/parsoid
29090 <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"attribs":[["link",{"txt":"&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></figure-inline></p>
29091 !! end
29092
29093 !! test
29094 Various link types in alt and link options
29095 !! wikitext
29096 [[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
29097
29098 [[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
29099
29100 [[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
29101 !! html/php+tidy
29102 <p><a href="/wiki/Main_Page" title="caption"><img alt="Main Page" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
29103 </p><p><a href="/wiki/Media:Thumb.png" title="caption"><img alt="Media:Thumb.png" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
29104 </p><p><a href="http://en.wikipedia.org/wiki/Foo" title="caption"><img alt="wikipedia:Foo" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
29105 </p>
29106 !! html/parsoid
29107 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt1" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[41,216,2,2]}&apos;>Main Page&lt;/a>","txt":"Main Page"}]],"caption":"caption"}'><a href="./Main_Page" data-parsoid='{"a":{"href":"./Main_Page"},"sa":{"href":"link=[[Main Page]]"}}'><img alt="Main Page" 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-inline></p>
29108
29109 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:MediaLink\" href=\"//example.com/images/e/ea/Thumb.png\" resource=\"./Media:Thumb.png\" title=\"Thumb.png\" data-parsoid=&apos;{\"a\":{\"resource\":\"./Media:Thumb.png\"},\"sa\":{\"resource\":\"Media:Thumb.png\"},\"dsr\":[113,216,null,null]}&apos;>Media:Thumb.png&lt;/a>","txt":"Media:Thumb.png"}]],"caption":"caption"}'><a href="./Media:Thumb.png" data-parsoid='{"a":{"href":"./Media:Thumb.png"},"sa":{"href":"link=[[Media:Thumb.png]]"}}'><img alt="Media:Thumb.png" 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-inline></p>
29110
29111 <p><figure-inline class="mw-default-size" typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["alt",{"html":"alt=&lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://en.wikipedia.org/wiki/Foo\" title=\"wikipedia:Foo\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"http://en.wikipedia.org/wiki/Foo\"},\"sa\":{\"href\":\"wikipedia:Foo\"},\"isIW\":true,\"dsr\":[189,216,2,2]}&apos;>wikipedia:Foo&lt;/a>","txt":"wikipedia:Foo"}]],"caption":"caption"}'><a href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"link=[[wikipedia:Foo]]"}}'><img alt="wikipedia:Foo" 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-inline></p>
29112 !! end
29113
29114 !! test
29115 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
29116 !! options
29117 parsoid=html2wt
29118 !! html/parsoid
29119 <ul>
29120 <li><p>foo</p></li>
29121 </ul>
29122 !! wikitext
29123 * foo
29124 !! end
29125
29126 !! test
29127 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
29128 !! options
29129 parsoid=html2wt
29130 !! html/parsoid
29131 <ul> <li>foo</li></ul>
29132 !! wikitext
29133 * foo
29134 !! end
29135
29136 !! test
29137 Don't strip leading whitespace when handling indent-pre suppressing tags
29138 !! options
29139 parsoid=html2wt
29140 !! html/parsoid
29141 <table>
29142 <tr><td> indented row</td></tr>
29143 </table>
29144 <blockquote><p>
29145 <b>This is very bold of you!</b>
29146 </p>
29147 <table><tr><td>
29148 indented cell (no pre-wrapping!)
29149 </td></tr></table>
29150 </blockquote>
29151 <p>foo</p>
29152 <div>bar</div>
29153 !! wikitext
29154 {|
29155 | indented row
29156 |}
29157 <blockquote>
29158 '''This is very bold of you!'''
29159
29160 {|
29161 |
29162 indented cell (no pre-wrapping!)
29163 |}
29164 </blockquote>
29165 foo
29166 <div>bar</div>
29167 !! end
29168
29169 !! test
29170 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
29171 !! options
29172 parsoid=html2wt
29173 !! html/parsoid
29174 <p>foo</p>
29175 <span>bar</span>
29176
29177 <span>foo2
29178 </span>bar2
29179
29180 <div>foo</div>
29181 <span>bar</span>
29182
29183 <div>
29184 <span>foo</span>
29185 </div>
29186 !! wikitext
29187 foo
29188
29189 <span>bar</span>
29190
29191 <span>foo2
29192 <nowiki> </nowiki></span>bar2
29193
29194 <div>foo</div>
29195 <nowiki> </nowiki><span>bar</span>
29196
29197 <div>
29198 <nowiki> </nowiki><span>foo</span>
29199 </div>
29200 !! end
29201
29202 !! test
29203 Lists: Dont insert newlines in a serialized list item.
29204 !! options
29205 parsoid=html2wt
29206 !! html/parsoid
29207 <ul><li>a<br>b</li><li>c</li></ul>
29208 !! wikitext
29209 * a<br />b
29210 * c
29211 !! end
29212
29213 !! test
29214 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
29215 !! options
29216 parsoid={
29217 "modes": ["html2wt"],
29218 "scrubWikitext": false
29219 }
29220 !! html/parsoid
29221 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29222 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29223
29224 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29225 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29226
29227 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
29228
29229 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29230 !! wikitext
29231 == hello there [[Category:A1]] ==
29232
29233 == [[Category:A2]] hi pal ==
29234
29235 == <!--foo--> [[Category:A3]] how goes it ==
29236
29237 == it goes well [[Category:A4]] <!--bar--> ==
29238
29239 ==howdy [[Category:A5]]==
29240
29241 == __TOC__ ok ==
29242 !! end
29243
29244 !! test
29245 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
29246 !! options
29247 parsoid={
29248 "modes": ["html2wt"],
29249 "scrubWikitext": true
29250 }
29251 !! html/parsoid
29252 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29253 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29254
29255 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29256 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29257
29258 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29259 !! wikitext
29260 == hello there ==
29261 [[Category:A1]]
29262 [[Category:A2]]
29263
29264 == hi pal ==
29265
29266 <!--foo-->[[Category:A3]]
29267
29268 == how goes it ==
29269
29270 == it goes well ==
29271 [[Category:A4]] <!--bar-->
29272
29273 __TOC__
29274
29275 == ok ==
29276 !! end
29277
29278 !! test
29279 Headings: Don't hoist metas that come from templates
29280 !! options
29281 parsoid={
29282 "modes": ["html2wt"],
29283 "scrubWikitext": true
29284 }
29285 !! html/parsoid
29286 <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>
29287 !! wikitext
29288 == {{echo|foo [[Category:Foo]]}} ==
29289 !! end
29290
29291 !! test
29292 Headings: Category in ref isn't hoisted
29293 !! options
29294 parsoid={
29295 "modes": ["html2wt"],
29296 "scrubWikitext": true
29297 }
29298 !! html/parsoid
29299 <h2> 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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
29300
29301 <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="./Main_Page#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>
29302 !! wikitext
29303 == foo <ref>bar
29304 [[Category:Baz]] </ref> ==
29305
29306 <references />
29307 !! end
29308
29309 !! test
29310 Parsoid: Serialize positional parameters with = in them as named parameter
29311 !! options
29312 parsoid=html2wt
29313 !! html/parsoid
29314 <p about="#mwt1" typeof="mw:Transclusion"
29315 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
29316
29317 <p about="#mwt1" typeof="mw:Transclusion"
29318 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
29319
29320 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29321 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29322 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' 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>
29323 !! wikitext
29324 {{echo|1=f=oo}}
29325
29326 {{echo|1=f=oo|2=bar}}
29327
29328 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29329 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29330 {{echo|<nowiki>f=oo</nowiki>|bar}}
29331 !! end
29332
29333 !! test
29334 Parsoid: Serialize positional parameters with = in extlink as named parameter
29335 !! options
29336 parsoid=html2wt
29337 !! html/parsoid
29338 <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>
29339 !! wikitext
29340 {{echo|1=http://stuff?is=ok}}
29341 !! end
29342
29343 !! test
29344 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
29345 !! options
29346 parsoid=html2wt
29347 !! html/parsoid
29348 <div>a<p>b</p></div>
29349 <div>a
29350 <p>b</p></div>
29351 <div>
29352 a
29353 <p>b</p></div>
29354 !! wikitext
29355 <div>a
29356 b
29357 </div>
29358 <div>a
29359 b
29360 </div>
29361 <div>
29362 a
29363
29364 b
29365 </div>
29366 !! end
29367
29368 !! test
29369 Substrings resembling wikitext in hrefs should not get nowiki escapes
29370 !! options
29371 parsoid=html2wt
29372 !! html/parsoid
29373 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
29374 !! wikitext
29375 [[Foo''bar''baz]]
29376 !! end
29377
29378 !! test
29379 Enforce single-line context in the serializer
29380 !! options
29381 parsoid=html2wt
29382 !! html/parsoid
29383 <h2>testing
29384 123</h2>
29385
29386 <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">
29387 </span><span about="#mwt1">you</span> </h2>
29388
29389 <h2> 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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
29390
29391 <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="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
29392 there</span></li></ol>
29393
29394 <ul><li>asd
29395 sdf</li></ul>
29396
29397 <ul><li>foo
29398 bar
29399 baz</li>
29400 <li>foo <b>bar</b>
29401 baz</li></ul>
29402
29403 <dl><dt>hi
29404 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29405 ho</dd></dl>
29406
29407 <dl><dd> <table>
29408 <tbody><tr><td> ha
29409 ha
29410 ha</td></tr>
29411 </tbody></table></dd></dl>
29412 !! wikitext
29413 == testing 123 ==
29414
29415 == hi {{bogus|there
29416 you}} ==
29417
29418 == foo <ref>hello
29419 there</ref> ==
29420
29421 <references />
29422
29423 * asd sdf
29424
29425 * foo bar baz
29426 * foo '''bar''' baz
29427
29428 ; hi ho : hi ho
29429
29430 : {|
29431 | ha
29432 ha
29433 ha
29434 |}
29435 !! end
29436
29437 !! test
29438 Serialize new placeholder space without spans
29439 !! options
29440 parsoid=html2wt
29441 !! html/parsoid
29442 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29443
29444 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29445
29446 <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>
29447 !! wikitext
29448 foo : bar
29449
29450 foo : bar
29451
29452 <ref>foo : bar</ref>ok
29453 !! end
29454
29455
29456 #-----------------------
29457 # Tag minimization tests
29458 #-----------------------
29459
29460 !! test
29461 1. I/B quote minimization: wikitext-only tags should be combined
29462 !! options
29463 parsoid=html2wt
29464 !! html/parsoid
29465 <p><i>A</i><i>B</i></p>
29466 <p><b>A</b><b>B</b></p>
29467 <p><i>A</i><b><i>B</i></b></p>
29468 <p><b>A</b><i><b>B</b></i></p>
29469 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29470 <p><i><b>A</b></i><i><b>B</b></i></p>
29471 <p><i><b>A</b></i><b><i>B</i></b></p>
29472 <p><b><i>A</i></b><i><b>B</b></i></p>
29473 !! wikitext
29474 ''AB''
29475
29476 '''AB'''
29477
29478 ''A'''B'''''
29479
29480 '''A''B'''''
29481
29482 '''A''BC''D'''
29483
29484 '''''AB'''''
29485
29486 '''''AB'''''
29487
29488 '''''AB'''''
29489 !! end
29490
29491 !! test
29492 2. I/B quote minimization: wikitext and html tags should not be combined
29493 !! options
29494 parsoid=html2wt
29495 !! html/parsoid
29496 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29497 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29498 !! wikitext
29499 ''A''<i>B</i>
29500
29501 ''A''<nowiki/>'''<i>B</i>'''
29502 !! end
29503
29504 !! test
29505 3. I/B quote minimization: templated content stops minimization
29506 !! options
29507 parsoid=html2wt
29508 !! html/parsoid
29509 <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>
29510 <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>
29511 !! wikitext
29512 ''A''{{echo|''B''}}
29513
29514 ''A''{{echo|'''''B'''''}}
29515 !! end
29516
29517 !! test
29518 4. I/B quote minimization: new content should be mimimized with adjacent old content
29519 !! options
29520 parsoid=html2wt
29521 !! html/parsoid
29522 <p><i>A</i><i>B</i></p>
29523 <p><b>A</b><b>B</b></p>
29524 <p><i>A</i><b><i>B</i></b></p>
29525 !! wikitext
29526 ''AB''
29527
29528 '''AB'''
29529
29530 ''A'''B'''''
29531 !! end
29532
29533 !! test
29534 5a. Merge adjacent quote nodes if they've been edited
29535 !! options
29536 parsoid={
29537 "modes": ["wt2wt", "selser"],
29538 "changes": [
29539 ["p", "contents", "remove", ":contains('b')"]
29540 ]
29541 }
29542 !! wikitext
29543 ''a''b''c''
29544 !! wikitext/edited
29545 ''ac''
29546 !! end
29547
29548 !! test
29549 5b. Merge adjacent quote nodes if they've been edited
29550 !! options
29551 parsoid={
29552 "modes": ["wt2wt", "selser"],
29553 "changes": [
29554 ["#x", "remove"]
29555 ]
29556 }
29557 !! wikitext
29558 ''a''<span id="x">b</span>''c''
29559 !! wikitext/edited
29560 ''ac''
29561 !! end
29562
29563 !! test
29564 1. Merge adjacent link nodes as long as at least one element is new
29565 !! options
29566 parsoid={
29567 "modes": ["html2wt"],
29568 "scrubWikitext": true
29569 }
29570 !! html/parsoid
29571 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29572 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29573 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29574 !! wikitext
29575 [[Football]]
29576 [[Football]]
29577 [[Football|Foot]][[Football|ball]]
29578 !! end
29579
29580 !! test
29581 2. Merge adjacent link nodes and enable additional normalizations
29582 !! options
29583 parsoid={
29584 "modes": ["html2wt"],
29585 "scrubWikitext": true
29586 }
29587 !! html/parsoid
29588 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29589 !! wikitext
29590 ''[[Football]]''
29591 !! end
29592
29593 !! test
29594 3. Don't merge adjacent link nodes if scrubWikitext is false
29595 !! options
29596 parsoid={
29597 "modes": ["html2wt"],
29598 "scrubWikitext": false
29599 }
29600 !! html/parsoid
29601 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29602 !! wikitext
29603 [[Football|Foot]][[Football|ball]]
29604 !! end
29605
29606 !! test
29607 1. Move format tags outside of WikiLink
29608 !! options
29609 parsoid={
29610 "modes": ["html2wt"],
29611 "scrubWikitext": true
29612 }
29613 !! html/parsoid
29614 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29615 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29616 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29617 !! wikitext
29618 ''[[Football]]''
29619 '''''[[Football]]'''''
29620 <u>'''''[[Football]]'''''</u>
29621 !! end
29622
29623 !! test
29624 2. Move format tags outside of WikiLink with mergable A tags
29625 !! options
29626 parsoid={
29627 "modes": ["html2wt"],
29628 "scrubWikitext": true
29629 }
29630 !! html/parsoid
29631 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29632 !! wikitext
29633 '''''[[Football]]'''''
29634 !! end
29635
29636 !! test
29637 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29638 !! options
29639 parsoid={
29640 "modes": ["html2wt"],
29641 "scrubWikitext": true
29642 }
29643 !! html/parsoid
29644 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29645 !! wikitext
29646 <font color="red"><u>'''[[Foo]]'''</u></font>
29647 !! end
29648
29649 !! test
29650 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29651 !! options
29652 parsoid={
29653 "modes": ["html2wt"],
29654 "scrubWikitext": true
29655 }
29656 !! html/parsoid
29657 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29658 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29659 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29660 !! wikitext
29661 [[Foo|<font color="red">Foo</font>]]
29662 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29663 [[Foo|<span class="Bar">Foo</span>]]
29664 !! end
29665
29666 !! test
29667 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29668 !! options
29669 parsoid={
29670 "modes": ["selser"],
29671 "scrubWikitext": true,
29672 "changes": [
29673 ["a", "html", "<i>Foo</i>"]
29674 ]
29675 }
29676 !! wikitext
29677 [[Foo]]
29678 !! wikitext/edited
29679 ''[[Foo]]''
29680 !! end
29681
29682 !! test
29683 6. Regression test: Manual edit test to ensure diff markers are not lost
29684 !! options
29685 parsoid={
29686 "modes": ["selser"],
29687 "scrubWikitext": true,
29688 "changes": [
29689 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29690 ]
29691 }
29692 !! wikitext
29693 ''Foo''
29694 !! wikitext/edited
29695 ''[[Foo]]''
29696 !! end
29697
29698 !! test
29699 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29700 !! options
29701 parsoid={
29702 "modes": ["selser"],
29703 "scrubWikitext": true,
29704 "changes": [
29705 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29706 ]
29707 }
29708 !! wikitext
29709 <div>placeholder</div>
29710 !! wikitext/edited
29711 <div>placeholder</div>
29712 [[Foo]] , placeholder
29713 !! end
29714
29715 #------------------------------
29716 # End of tag minimization tests
29717 #------------------------------
29718
29719 !!test
29720 T56262: New entities
29721 !! options
29722 parsoid=html2wt
29723 !! html/parsoid
29724 <span typeof="mw:Entity">&nbsp;</span>
29725 !! wikitext
29726 &nbsp;
29727 !! end
29728
29729 ## Note that there is no wikitext output for 'unknownproperty' ##
29730 ## Unknown magic words are silently dropped ##
29731
29732 !! test
29733 Magic words
29734 !! options
29735 parsoid=html2wt
29736 !! html/parsoid
29737 <meta property='mw:PageProp/toc' />
29738 <meta property='mw:PageProp/notoc' />
29739 <meta property='mw:PageProp/forcetoc' />
29740 <meta property='mw:PageProp/index' />
29741 <meta property='mw:PageProp/noindex' />
29742 <meta property='mw:PageProp/nogallery' />
29743 <meta property='mw:PageProp/noeditsection' />
29744 <meta property='mw:PageProp/notitleconvert' />
29745 <meta property='mw:PageProp/nocontentconvert' />
29746 <meta property='mw:PageProp/unknownproperty' />
29747 !! wikitext
29748 __TOC__
29749 __NOTOC__
29750 __FORCETOC__
29751 __INDEX__
29752 __NOINDEX__
29753 __NOGALLERY__
29754 __NOEDITSECTION__
29755 __NOTITLECONVERT__
29756 __NOCONTENTCONVERT__
29757 !! end
29758
29759 !! test
29760 Consecutive <pre>s should not get merged
29761 !! options
29762 parsoid=html2wt,html2html
29763 !! html/parsoid
29764 <pre>a</pre><pre>b</pre>
29765
29766 <pre>c
29767 </pre><pre>
29768 d</pre>
29769
29770 <pre>e
29771
29772 </pre><pre>
29773
29774 f</pre>
29775 !! wikitext
29776 a
29777
29778 b
29779
29780 c
29781
29782 d
29783
29784 e
29785
29786
29787
29788 f
29789 !! end
29790
29791 !! test
29792 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29793 !! options
29794 parsoid=html2wt
29795 !! html/parsoid
29796 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29797 !! wikitext
29798 [[Special:BookSources/1234567890|ISBN 1234567895]]
29799 !! end
29800
29801 !! test
29802 Edited RFC links not serializable as RFC links should serialize as extlinks
29803 !! options
29804 parsoid=html2wt
29805 !! html/parsoid
29806 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29807 !! wikitext
29808 [https://tools.ietf.org/html/rfc123 New RFC]
29809 !! end
29810
29811 !! test
29812 Edited PMID links not serializable as PMID links should serialize as extlinks
29813 !! options
29814 parsoid=html2wt
29815 !! html/parsoid
29816 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29817 !! wikitext
29818 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29819 !! end
29820
29821 !! test
29822 WTS of autolinks with trailing/surrounding context
29823 !! options
29824 parsoid=html2wt
29825 !! html/parsoid
29826 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29827 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29828 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29829 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29830 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29831 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29832 !! wikitext
29833 http://cscott.net'''foo'''
29834
29835 http://cscott.net<b>foo</b>
29836
29837 '''http://cscott.net'''
29838
29839 '''http://cscott.net '''
29840
29841 '''http://cscott.net<nowiki/>x'''
29842
29843 http://cscott.net<nowiki/>x
29844 !! end
29845
29846 !! test
29847 WTS of autolinks with nowikis (round-trip)
29848 !! wikitext
29849 x<nowiki/>http://cscott.net<nowiki/>x
29850 !! html/parsoid
29851 <p>x<a rel="mw:ExtLink" href="http://cscott.net" class="external free">http://cscott.net</a>x</p>
29852 !! end
29853
29854 # this is the "easy" test because it leaves in place all the
29855 # data-parsoid information indicating this is an autolink
29856 !! test
29857 WTS of autolinks with escapes (editing)
29858 !! options
29859 parsoid={
29860 "modes": ["wt2wt"],
29861 "changes": [
29862 [ "span", "remove" ]
29863 ]
29864 }
29865 !! wikitext
29866 x<nowiki/>http://cscott.net<nowiki/>x
29867 !! wikitext/edited
29868 x<nowiki/>http://cscott.net<nowiki/>x
29869 !! end
29870
29871 !! test
29872 WTS of edited autolink-like text (T103364)
29873 !! options
29874 parsoid={
29875 "modes": ["wt2wt"],
29876 "changes": [
29877 [ "span[typeof]", "removeAttr", "typeof" ]
29878 ]
29879 }
29880 !! wikitext
29881 Not a link: <nowiki>http://example.com</nowiki>.
29882 !! wikitext/edited
29883 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29884 !! end
29885
29886 !! test
29887 WTS of newly-authored autolink-like text (T103364)
29888 !! options
29889 parsoid=html2wt
29890 !! html/parsoid
29891 <p>http://example.com is not a link.</p>
29892 !! wikitext
29893 <nowiki>http://example.com</nowiki> is not a link.
29894 !! end
29895
29896 !! test
29897 WTS of autolink-like text after an autolink (T108563)
29898 !! options
29899 parsoid=html2wt
29900 !! html/parsoid
29901 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29902 !! wikitext
29903 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29904 !! end
29905
29906 !! test
29907 WTS of an autolink surrounded by square brackets (T220018)
29908 !! options
29909 parsoid=html2wt
29910 !! html/parsoid
29911 <p>[<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]</p>
29912 !! wikitext
29913 <nowiki>[</nowiki>http://example.com]
29914 !! end
29915
29916 !! test
29917 WTS of edited autolink surrounded by square brackets (T220018)
29918 !! options
29919 parsoid={
29920 "modes": ["wt2wt"],
29921 "changes": [
29922 [ "a", "before", "[" ],
29923 [ "a", "after", "]" ]
29924 ]
29925 }
29926 !! wikitext
29927 http://example.com
29928 !! wikitext/edited
29929 <nowiki>[</nowiki>http://example.com]
29930 !! end
29931
29932 !! test
29933 WTS of an external link surrounded by square brackets (T220018)
29934 !! options
29935 parsoid=html2wt
29936 !! html/parsoid
29937 <p>[<a rel="mw:ExtLink" href="http://example.com">foo</a>]</p>
29938 !! wikitext
29939 <nowiki>[</nowiki>[http://example.com foo]]
29940 !! end
29941
29942 !! test
29943 WTS of edited external link surrounded by square brackets (T220018)
29944 !! options
29945 parsoid={
29946 "modes": ["wt2wt"],
29947 "changes": [
29948 [ "a", "before", "[" ],
29949 [ "a", "after", "]" ]
29950 ]
29951 }
29952 !! wikitext
29953 [http://example.com foo]
29954 !! wikitext/edited
29955 <nowiki>[</nowiki>[http://example.com foo]]
29956 !! end
29957
29958 !! test
29959 Magic links inside links (not autolinked)
29960 !! wikitext
29961 [[Foo|http://example.com]]
29962 [[Foo|RFC 1234]]
29963 [[Foo|PMID 1234]]
29964 [[Foo|ISBN 123456789x]]
29965
29966 [http://foo.com http://example.com]
29967 [http://foo.com RFC 1234]
29968 [http://foo.com PMID 1234]
29969 [http://foo.com ISBN 123456789x]
29970 !! html+tidy
29971 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29972 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29973 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29974 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29975 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29976 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29977 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29978 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29979 </p>
29980 !! html/parsoid
29981 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29982 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29983 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29984 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29985
29986 <p><a rel="mw:ExtLink" href="http://foo.com" class="external text">http://example.com</a>
29987 <a rel="mw:ExtLink" href="http://foo.com" class="external text">RFC 1234</a>
29988 <a rel="mw:ExtLink" href="http://foo.com" class="external text">PMID 1234</a>
29989 <a rel="mw:ExtLink" href="http://foo.com" class="external text">ISBN 123456789x</a></p>
29990 !! end
29991
29992 !! test
29993 Magic links inside image captions (autolinked)
29994 !! wikitext
29995 [[File:Foobar.jpg|thumb|http://example.com]]
29996 [[File:Foobar.jpg|thumb|RFC 1234]]
29997 [[File:Foobar.jpg|thumb|PMID 1234]]
29998 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29999 !! html+tidy
30000 <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" decoding="async" 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 rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
30001 <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" decoding="async" 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 class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a></div></div></div>
30002 <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" decoding="async" 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 class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div></div></div>
30003 <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" decoding="async" 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/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div></div></div>
30004 !! html/parsoid
30005 <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" class="external free">http://example.com</a></figcaption></figure>
30006 <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="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></figcaption></figure>
30007 <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="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></figcaption></figure>
30008 <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/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
30009 !! end
30010
30011 !! test
30012 WTS of magic word text (T109371)
30013 !! options
30014 parsoid=html2wt
30015 !! html/parsoid
30016 <p>RFC 1234</p>
30017 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
30018 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
30019 !! wikitext
30020 <nowiki>RFC 1234</nowiki>
30021
30022 [http://foo.com RFC 1234]
30023
30024 [[Foo|RFC 1234]]
30025 !! end
30026
30027 !! test
30028 Edited Redirect link should emit a non-piped wikitext link
30029 !! options
30030 parsoid=html2wt
30031 !! html/parsoid
30032 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
30033 !! wikitext
30034 #REDIRECT [[Bar]]
30035 !! end
30036
30037 !! test
30038 T75121: Infer extension name from typeOf if data-mw is not present
30039 !! options
30040 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30041 !! html/parsoid
30042 <div typeOf="mw:Extension/foo"></div>
30043 !! wikitext
30044 <foo />
30045 !! end
30046
30047 # Note that the <p> wrapping isn't present in PHP parser output
30048 # The important thing for this test is that P-wrapping doesn't
30049 # interfere with the <nowiki> protection for leading - in <td>
30050 # (which isn't necessary for <th>).
30051 !! test
30052 T88318: p-wrapped dash in table.
30053 !! options
30054 parsoid=html2wt,wt2wt
30055 !! html/parsoid
30056 <table><tbody>
30057 <tr><th><p>-</p></th><th><p>- </p></th></tr>
30058 <tr><td><p>-</p></td><td><p>- </p></td></tr>
30059 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
30060 </tbody></table>
30061 !! wikitext
30062 {|
30063 !-
30064 !-
30065 |-
30066 |<nowiki>-</nowiki>
30067 |<nowiki>- </nowiki>
30068 |-
30069 |<small>-</small>
30070 |<br />
30071 -
30072 |<br />-
30073 |}
30074 !! html/php+tidy
30075 <table>
30076 <tbody><tr>
30077 <th>-
30078 </th>
30079 <th>-
30080 </th></tr>
30081 <tr>
30082 <td>-
30083 </td>
30084 <td>-
30085 </td></tr>
30086 <tr>
30087 <td><small>-</small>
30088 </td>
30089 <td><br />
30090 <p>-
30091 </p>
30092 </td>
30093 <td><br />-
30094 </td></tr></tbody></table>
30095 !! end
30096
30097 !! test
30098 T149209: WTS: Handle newlines in table cells properly
30099 !! options
30100 parsoid=html2wt
30101 !! html/parsoid
30102 <table>
30103 <tbody>
30104 <tr><td>a
30105 b
30106 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
30107 <tr><td><p>x</p>
30108 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
30109 </tbody></table>
30110 <table>
30111 <tbody>
30112 <tr><th>a
30113 b
30114 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
30115 <tr><th><p>x</h>
30116 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
30117 </tbody></table>
30118 !! wikitext
30119 {|
30120 |a
30121 b
30122 |c
30123 |-
30124 |x
30125 {{!}}y
30126 |}
30127 {|
30128 !a
30129 b
30130 !c
30131 |-
30132 !x
30133 !y
30134 |}
30135 !! end
30136
30137 !! test
30138 T149209: Selser: Handle newlines in table cells properly
30139 !! options
30140 parsoid={
30141 "modes": ["selser"],
30142 "changes": [
30143 [ "#h1", "html", "a\nb\n" ],
30144 [ "#h2", "html", "a\nb\n" ],
30145 [ "#c1", "html", "a\nb\n" ],
30146 [ "#c2", "html", "<p>a</p>" ],
30147 [ "#c3", "html", "<p>a</p>" ],
30148 [ "#c4", "html", "edit-me<p>a</p>" ]
30149 ]
30150 }
30151 !! wikitext
30152 {|
30153 ! id="h1" |edit-me!!1
30154 |-
30155 ! id="h2" |edit-me||2
30156 |-
30157 | id="c1" |edit-me||3
30158 |-
30159 | id="c2" |edit-me||4
30160 |-
30161 | id="c3" |edit-me||p||q||r
30162 |-
30163 | id="c4" |edit-me||p||q||r
30164 |}
30165 !! wikitext/edited
30166 {|
30167 ! id="h1" |a
30168 b
30169 !1
30170 |-
30171 ! id="h2" |a
30172 b
30173 !2
30174 |-
30175 | id="c1" |a
30176 b
30177 |3
30178 |-
30179 | id="c2" |a
30180 |4
30181 |-
30182 | id="c3" |a
30183 |p||q||r
30184 |-
30185 | id="c4" |edit-me
30186 a
30187 |p||q||r
30188 |}
30189 !! end
30190
30191 !! test
30192 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
30193 !! options
30194 parsoid=html2wt
30195 !! html/parsoid
30196 <table id='mwAb'>
30197 <td id='mwAc'>foo</td>
30198 <td id='serialize-this'>bar</td>
30199 </table>
30200 !! wikitext
30201 {|
30202 |foo
30203 | id="serialize-this" |bar
30204 |}
30205 !! end
30206
30207 !! test
30208 Parsoid-like element ids should not be serialized to wikitext unless shadowed
30209 !! options
30210 parsoid=html2wt
30211 !! html/parsoid
30212 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
30213 !! wikitext
30214 <div id="hello">ok</div>
30215 !! end
30216
30217 !! test
30218 Testing serialization after deletion in references
30219 !! options
30220 parsoid={
30221 "modes": ["wt2wt"],
30222 "changes": [
30223 ["#x", "remove"]
30224 ]
30225 }
30226 !! wikitext
30227 hi <ref><div id="x">ho</div></ref>
30228
30229 <references />
30230 !! wikitext/edited
30231 hi <ref></ref>
30232
30233 <references />
30234 !! end
30235
30236 !!test
30237 Testing serialization after deletion of table cells
30238 !!options
30239 parsoid={
30240 "modes": ["wt2wt", "selser"],
30241 "changes": [
30242 ["#x", "remove"]
30243 ]
30244 }
30245 !!wikitext
30246 {|
30247 !h1 !!h2 !!h3
30248 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
30249 |}
30250 !! wikitext/edited
30251 {|
30252 !h1!!h2!!h3
30253 |c2|||c3
30254 |}
30255 !!end
30256
30257 !! test
30258 Testing selser after addition of new row before first row (T125419)
30259 !! options
30260 parsoid={
30261 "modes": ["wt2wt", "selser"],
30262 "changes": [
30263 [ "tr", "before", "<tr><td>X</td></tr>" ]
30264 ]
30265 }
30266 !! wikitext
30267 {|
30268 |a
30269 |}
30270 !! wikitext/edited
30271 {|
30272 |X
30273 |-
30274 |a
30275 |}
30276 !! end
30277
30278 !! test
30279 Serialize new table rows in a HTML table using HTML tags
30280 !! options
30281 parsoid={
30282 "modes": ["wt2wt", "selser"],
30283 "changes": [
30284 [ "tr", "before", "<tr><td>X</td></tr>" ]
30285 ]
30286 }
30287 !! wikitext
30288 <table><tr><td>a</td></tr></table>
30289 !! wikitext/edited
30290 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
30291 !! end
30292
30293 !! test
30294 Serialize new table cells in a HTML row using HTML tags
30295 !! options
30296 parsoid={
30297 "modes": ["wt2wt", "selser"],
30298 "changes": [
30299 [ "td", "before", "<td>X</td>" ]
30300 ]
30301 }
30302 !! wikitext
30303 <table><tr><td>a</td></tr></table>
30304 !! wikitext/edited
30305 <table><tr><td>X</td><td>a</td></tr></table>
30306 !! end
30307
30308 !! test
30309 Serialize wikitext list items as HTML list items when embedded in a HTML list
30310 !! options
30311 parsoid=html2wt
30312 !! html/parsoid
30313 <ul data-parsoid='{"stx": "html"}'>
30314 <li data-parsoid='{}'>a</li>
30315 <li>b</li>
30316 </ul>
30317 !! wikitext
30318 <ul>
30319 <li>a</li>
30320 <li>b</li>
30321 </ul>
30322 !! html/php+tidy
30323 <ul>
30324 <li>a</li>
30325 <li>b</li>
30326 </ul>
30327 !! end
30328
30329 # Nested list should be inside <li>, that is
30330 # <ul><li>foo<ul>..</ul></li></ul> instead of
30331 # <ul><li>foo</li><ul>..</ul></ul>
30332 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
30333 !! test
30334 Wikitext lists can be nested inside HTML lists
30335 !! options
30336 parsoid=html2wt
30337 !! html/parsoid
30338 <ul data-parsoid='{"stx": "html"}'>
30339 <li data-parsoid='{"stx": "html"}'>a
30340 <ul><li>b</li></ul>
30341 </li>
30342 </ul>
30343
30344 <ul data-parsoid='{"stx": "html"}'>
30345 <li>x
30346 <ul><li>y</li></ul>
30347 </li>
30348 </ul>
30349 !! wikitext
30350 <ul>
30351 <li>a
30352 * b
30353 </li>
30354 </ul>
30355
30356 <ul>
30357 <li>x
30358 * y
30359 </li>
30360 </ul>
30361 !! html/php+tidy
30362 <ul>
30363 <li>a
30364 <ul><li>b</li></ul>
30365 </li>
30366 </ul>
30367 <ul>
30368 <li>x
30369 <ul><li>y</li></ul>
30370 </li>
30371 </ul>
30372 !! end
30373
30374 !! test
30375 WTS change modes
30376 !! options
30377 parsoid={
30378 "modes": ["wt2wt"],
30379 "changes": [
30380 [ "#xyz", "before", "<b>before</b> stuff " ],
30381 [ "#xyz", "after", " stuff <i>after</i>" ],
30382 [ "#xyz", "html", "x <b>y</b> z" ]
30383 ]
30384 }
30385 !! wikitext
30386 <span id="xyz">hello</span>
30387 !! wikitext/edited
30388 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
30389 !! end
30390
30391 !! test
30392 Never serialize a-tag as html, regardless of what data-parsoid has to say
30393 !! options
30394 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30395 !! html/parsoid
30396 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
30397 !! wikitext
30398 [[Foo]]
30399 !! end
30400
30401 ## SSS FIXME: This is broken output nevertheless.
30402 ## What might be a reasonable non-broken output for this?
30403 ## This is an edge case unlikely to be seen in production
30404 ## that I am not wasting more time on this right now.
30405 !! test
30406 Never serialize a-tag as html, no matter what attributes it has
30407 !! options
30408 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30409 !! html/parsoid
30410 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
30411 !! wikitext
30412 [http://boo.org http://boohoo.org]
30413 !! end
30414
30415 # Misnested is an indication that selser can reuse the source but these have
30416 # shown to sneak through on occasion. See T101768.
30417 # The original wikitext here is: [http://test.com [[one]] two three]
30418 !! test
30419 Strip span tags added to mark misnested links
30420 !! options
30421 parsoid=html2wt
30422 !! html/parsoid
30423 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
30424 !! wikitext
30425 [http://test.com][[one]] two three
30426 !! end
30427
30428 !! test
30429 Catch regression when unpacking misnested links
30430 !! options
30431 parsoid=wt2html
30432 !! wikitext
30433 {{echo|hi}}[http://example.com [[ho]]]
30434 !! html/parsoid
30435 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span><a rel="mw:ExtLink" href="http://example.com" class="external autonumber"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
30436 !! end
30437
30438 !! test
30439 Catch regression when unpacking with trailing content
30440 !! wikitext
30441 {{echo|Foo <references/> bar}}
30442 !! html/parsoid
30443 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Foo &lt;references/> bar"}},"i":0}}]}'>Foo </p><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol><p about="#mwt2"> bar</p>
30444 !! end
30445
30446 !! test
30447 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
30448 !! options
30449 parsoid=html2wt
30450 !! html/parsoid
30451 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
30452 <tbody><tr><td>d
30453 </td></tr>
30454 </tbody></table>
30455 !! wikitext
30456 {{echo|a}}
30457 {|{{echo|c
30458 {{!}}d
30459 }}
30460 |}
30461 !! end
30462
30463 ## This test verifies the presence and computation of this attribute indirectly
30464 ## by making an edit and ensuring that the serialization is correct (which it would be
30465 ## only if firstWikitextNode is properly set).
30466 !! test
30467 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30468 !! options
30469 parsoid= {
30470 "modes": ["wt2wt"],
30471 "changes": [
30472 [ "div#x", "remove" ],
30473 [ "div", "before", "<div>new</div>" ]
30474 ]
30475 }
30476 !! wikitext
30477 <div id="x">foo</div>
30478 {|
30479 {{echo|<div>boo</div>
30480 {{!}}b}}
30481 |c
30482 |}
30483 !! wikitext/edited
30484
30485 <div>new</div>
30486 {|
30487 {{echo|<div>boo</div>
30488 {{!}}b}}
30489 |c
30490 |}
30491 !! end
30492
30493 ## Don't necessarily expect this to roundtrip, but run serialization to catch crashers
30494 !! test
30495 File in link scenarios
30496 !! options
30497 parsoid={
30498 "modes": ["wt2html","html2wt"],
30499 "suppressErrors": true
30500 }
30501 !! wikitext
30502 [http://www.google.com [[File:Foobar.jpg|123]]]
30503
30504 [http://www.google.com [[File:Foobar.jpg|thumb|123]]]
30505 !! html/php+tidy
30506 <p><a rel="nofollow" class="external text" href="http://www.google.com"></a><a href="/wiki/File:Foobar.jpg" class="image" title="123"><img alt="123" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" /></a>
30507 </p>
30508 <a rel="nofollow" class="external text" href="http://www.google.com"></a><div class="thumb tright"><a rel="nofollow" class="external text" href="http://www.google.com"></a><div class="thumbinner" style="width:182px;"><a rel="nofollow" class="external text" href="http://www.google.com"></a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" decoding="async" 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>123</div></div></div>
30509 !! html/parsoid
30510 <p><a rel="mw:ExtLink" href="http://www.google.com" class="external text" data-parsoid='{"targetOff":23,"contentOffsets":[23,46]}'><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"123"}]}' data-mw='{"caption":"123"}'></figure-inline></a><a href="./File:Foobar.jpg" data-parsoid='{"misnested":true}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"},"misnested":true}'/></a></p>
30511
30512 <a rel="mw:ExtLink" href="http://www.google.com" class="external autonumber" data-parsoid='{"targetOff":72,"contentOffsets":[72,101]}'></a><figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"123"}]}'><a rel="mw:ExtLink" href="http://www.google.com" class="external autonumber" data-parsoid='{"targetOff":72,"contentOffsets":[72,101]}'></a><a href="./File:Foobar.jpg" data-parsoid='{"misnested":true}'><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"},"misnested":true}'/></a><figcaption data-parsoid='{"misnested":true}'>123</figcaption></figure>
30513 !! end
30514
30515 # --------------------------------------------
30516 # Tests spec'ing wikitext serialization norms |
30517 # --------------------------------------------
30518
30519 !! test
30520 Serialize multi-line indent-pre starting with wikitext syntax
30521 !! options
30522 parsoid=html2wt
30523 !! html/parsoid
30524 <pre>* 1
30525 ** 2
30526 * 3</pre>
30527 !! wikitext
30528 * 1
30529 ** 2
30530 * 3
30531 !! end
30532
30533 !! test
30534 1. Categories should always be serialized on their own line
30535 !! options
30536 parsoid=html2wt
30537 !! html/parsoid
30538 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30539 !! wikitext
30540 foo
30541 [[Category:Foo]]
30542 bar
30543 !! end
30544
30545 !! test
30546 2. Categories that are part of templates should not introduce a line break
30547 !! wikitext
30548 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30549 !! html/parsoid
30550 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
30551 !! end
30552
30553 # Careful while editing these next 2 tests. There are \u200f characters
30554 # before and after the <link> tags in the HTML and following some
30555 # of the categories in wikitext
30556 # Do not remove these characters in edits.
30557 #
30558 # As part of the serialization, these bidi characters will get stripped.
30559 !! test
30560 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30561 !! options
30562 parsoid={
30563 "modes": ["html2wt"],
30564 "scrubWikitext": true
30565 }
30566 !! html/parsoid
30567 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30568 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30569 !! wikitext
30570 [[קטגוריה:טקסים]]
30571 [[קטגוריה: שיטות משפט]]
30572 !! end
30573
30574 !! test
30575 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30576 !! options
30577 parsoid={
30578 "modes": ["html2wt"],
30579 "scrubWikitext": true
30580 }
30581 !! html/parsoid
30582 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30583 !! wikitext
30584 [[קטגוריה:טקסים]]
30585 ‏y
30586 !! end
30587
30588 !! test
30589 Lists: Add space after bullets
30590 !! options
30591 parsoid=html2wt
30592 !! html/parsoid
30593 <ul>
30594 <li>foo</li>
30595 <li> bar</li>
30596 <li><span> baz</span></li>
30597 </ul>
30598 !! wikitext
30599 * foo
30600 * bar
30601 * <span> baz</span>
30602 !! end
30603
30604 !! test
30605 1. Headings: Add space before/after == (T53744)
30606 !! options
30607 parsoid=html2wt
30608 !! html/parsoid
30609 <h2>foo</h2>
30610 <h2> bar</h2>
30611 <h2>baz </h2>
30612 <h2><span> baz</span></h2>
30613 !! wikitext
30614 == foo ==
30615
30616 == bar ==
30617
30618 == baz ==
30619
30620 == <span> baz</span> ==
30621 !! end
30622
30623 !! test
30624 2. Headings: Add space before/after == even after hoisted content
30625 !! options
30626 parsoid={
30627 "modes": ["html2wt"],
30628 "scrubWikitext": true
30629 }
30630 !! html/parsoid
30631 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30632 !! wikitext
30633 [[Category:A2]]
30634
30635 == ok ==
30636 !! end
30637
30638 !! test
30639 1. Headings: suppress newly created empty headings
30640 !! options
30641 parsoid={
30642 "modes": ["html2wt"],
30643 "scrubWikitext": true
30644 }
30645 !! html/parsoid
30646 <h2></h2>
30647 !! wikitext
30648 !! end
30649
30650 !! test
30651 2. Headings: don't suppress empty headings if scrubWikitext is false
30652 !! options
30653 parsoid=html2wt
30654 !! html/parsoid
30655 <h2></h2>
30656 !! wikitext
30657 ==<nowiki/>==
30658 !! end
30659
30660 !! test
30661 3. Headings: suppress empty headings on edits
30662 !! options
30663 parsoid={
30664 "modes": ["selser"],
30665 "scrubWikitext": true,
30666 "changes": [
30667 [ "#x", "remove"]
30668 ]
30669 }
30670 !! wikitext
30671 ==<span id="x">foo</span>==
30672 !! wikitext/edited
30673 !! end
30674
30675 !! test
30676 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30677 !! options
30678 parsoid={
30679 "modes": ["html2wt"],
30680 "scrubWikitext": true
30681 }
30682 !! html/parsoid
30683 <h2>foo<br/>bar</h2>
30684 <h2>foo <span><br/>bar</span> baz</h2>
30685 !! wikitext
30686 == foo bar ==
30687
30688 == foo <span> bar</span> baz ==
30689 !! end
30690
30691 !! test
30692 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30693 !! options
30694 parsoid={
30695 "modes": ["html2wt"],
30696 "scrubWikitext": false
30697 }
30698 !! html/parsoid
30699 <h2>foo<br/>bar</h2>
30700 !! wikitext
30701 == foo<br />bar ==
30702 !! end
30703
30704 !! test
30705 1. WT Quote Tags: suppress newly created empty style tags
30706 !! options
30707 parsoid={
30708 "modes": ["html2wt"],
30709 "scrubWikitext": true
30710 }
30711 !! html/parsoid
30712 <i></i><b></b>
30713 !! wikitext
30714 !! end
30715
30716 !! test
30717 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30718 !! options
30719 parsoid=html2wt
30720 !! html/parsoid
30721 <i></i><b></b>
30722 !! wikitext
30723 ''<nowiki/>'''''<nowiki/>'''
30724 !! end
30725
30726 !! test
30727 3. WT Quote Tags: suppress empty style tags on edits
30728 !! options
30729 parsoid={
30730 "modes": ["selser"],
30731 "scrubWikitext": true,
30732 "changes": [
30733 [ "#x", "remove"]
30734 ]
30735 }
30736 !! wikitext
30737 '''<span id="x">foo</span>'''
30738 !! wikitext/edited
30739 !! end
30740
30741 !! test
30742 1. Anchors: suppress newly created empty anchors
30743 !! options
30744 parsoid={
30745 "modes": ["html2wt"],
30746 "scrubWikitext": true
30747 }
30748 !! html/parsoid
30749 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30750 !! wikitext
30751 !! end
30752
30753 !! test
30754 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30755 !! options
30756 parsoid={
30757 "modes": ["html2wt"],
30758 "scrubWikitext": false
30759 }
30760 !! html/parsoid
30761 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30762 !! wikitext
30763 [[Test|<nowiki/>]]
30764 !! end
30765
30766 !! test
30767 3. Anchors: suppress empty anchors on edits
30768 !! options
30769 parsoid={
30770 "modes": ["selser"],
30771 "scrubWikitext": true,
30772 "changes": [
30773 [ "#x", "remove"]
30774 ]
30775 }
30776 !! wikitext
30777 [[Test|<span id="x">foo</span>]]
30778 !! wikitext/edited
30779 !! end
30780
30781 !! test
30782 3a. Anchors: do not suppress numbered extlinks
30783 !! options
30784 parsoid={
30785 "modes": ["wt2wt"],
30786 "scrubWikitext": true
30787 }
30788 !! wikitext
30789 [http://foo.com]
30790 !! html/parsoid
30791 <a rel="mw:ExtLink" href="http://foo.com"></a>
30792 !! end
30793
30794 !! test
30795 3b. Anchors: do not suppress numbered extlinks
30796 !! options
30797 parsoid={
30798 "modes": ["wt2wt"],
30799 "scrubWikitext": true,
30800 "changes": [
30801 [ "#x", "remove"]
30802 ]
30803 }
30804 !! wikitext
30805 [http://foo.com <span id="x">foo</span>]
30806 !! wikitext/edited
30807 [http://foo.com]
30808 !! end
30809
30810 !!test
30811 Normalizations should be restricted to edited content
30812 !!options
30813 parsoid={
30814 "modes": ["selser"],
30815 "scrubWikitext": true,
30816 "changes": [
30817 [ "h1", "before", "<i></i>"]
30818 ]
30819 }
30820 !!wikitext
30821 a
30822 = =
30823 b
30824 !!wikitext/edited
30825 a
30826 = =
30827 b
30828 !!end
30829
30830 !! test
30831 1. Multiple normalizations (html2wt)
30832 !! options
30833 parsoid={
30834 "modes": ["html2wt"],
30835 "scrubWikitext": true
30836 }
30837 !! html/parsoid
30838 <h2><i></i></h2>
30839 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30840 </a><b><i></i></b>x</p>
30841 !! wikitext
30842
30843 [[foo]]
30844 x
30845 !! end
30846
30847 !! test
30848 2. Multiple normalizations (selser)
30849 !! options
30850 parsoid={
30851 "modes": ["selser"],
30852 "scrubWikitext": true,
30853 "changes": [
30854 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30855 ]
30856 }
30857 !! wikitext
30858 <div id="x">foo</div>
30859 !! wikitext/edited
30860 <div id="x">foo</div>
30861 bar
30862 !! end
30863
30864 !! test
30865 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30866 !! options
30867 parsoid={
30868 "modes": ["html2wt"],
30869 "scrubWikitext": true
30870 }
30871 !! html/parsoid
30872 <p> hi</p>
30873 <p> hello</p>
30874 !! wikitext
30875 hi
30876
30877 hello
30878 !! end
30879
30880 !! test
30881 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30882 !! options
30883 parsoid=html2wt
30884 !! html/parsoid
30885 <p> hi</p>
30886 <p> hello</p>
30887 !! wikitext
30888 <nowiki> </nowiki>hi
30889
30890 <nowiki> </nowiki> hello
30891 !! end
30892
30893 !! test
30894 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30895 !! options
30896 parsoid={
30897 "modes": ["html2wt"],
30898 "scrubWikitext": true
30899 }
30900 !! html/parsoid
30901 <p>Foo
30902 bar
30903 baz</p>
30904
30905 <table><tr><td>Foo
30906 bar
30907 baz bang</td></tr></table>
30908
30909 <p><!--boo--> foo
30910 bar</p>
30911
30912 <p> foo
30913 bar<span>boo</span></p>
30914 !! wikitext
30915 Foo
30916 bar
30917 baz
30918
30919 {|
30920 |Foo
30921 bar
30922 baz bang
30923 |}
30924
30925 <!--boo-->foo
30926 bar
30927
30928 foo
30929 bar<span>boo</span>
30930 !! end
30931
30932 !! test
30933 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30934 !! options
30935 parsoid={
30936 "modes": ["selser"],
30937 "scrubWikitext": true,
30938 "changes": [
30939 [ "p", "html", " a\n b" ]
30940 ]
30941 }
30942 !! wikitext
30943 xyz
30944 !! wikitext/edited
30945 a
30946 b
30947 !! end
30948
30949 !! test
30950 1. New links that end in spaces
30951 !! options
30952 parsoid={
30953 "modes": ["html2wt"],
30954 "scrubWikitext": false
30955 }
30956 !! html/parsoid
30957 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30958 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30959 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30960 !! wikitext
30961 [[Berlin ]]<nowiki/>is the capital of Germany.
30962
30963 [[Foo ]]'''bar'''
30964
30965 [[Boston ]] is a city.
30966 !! end
30967
30968 !! test
30969 2. New links that end in spaces
30970 !! options
30971 parsoid={
30972 "modes": ["html2wt"],
30973 "scrubWikitext": true
30974 }
30975 !! html/parsoid
30976 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30977 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30978 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30979 !! wikitext
30980 [[Berlin]] is the capital of Germany.
30981
30982 [[Foo]] '''bar'''
30983
30984 [[Boston]] is a city.
30985 !! end
30986
30987 !! test
30988 1. Table cells with escapable prefixes
30989 !! options
30990 parsoid={
30991 "modes": ["html2wt"],
30992 "scrubWikitext": false
30993 }
30994 !! html/parsoid
30995 <table>
30996 <tr><td>a</td></tr>
30997 <tr><td>-</td></tr>
30998 <tr><td>+</td></tr>
30999 <tr><td>}</td></tr>
31000 </table>
31001 !! wikitext
31002 {|
31003 |a
31004 |-
31005 |<nowiki>-</nowiki>
31006 |-
31007 |<nowiki>+</nowiki>
31008 |-
31009 |<nowiki>}</nowiki>
31010 |}
31011 !! end
31012
31013 !! test
31014 2. Table cells with escapable prefixes
31015 !! options
31016 parsoid={
31017 "modes": ["html2wt"],
31018 "scrubWikitext": true
31019 }
31020 !! html/parsoid
31021 <table>
31022 <tr><td>a</td></tr>
31023 <tr><td>-</td></tr>
31024 <tr><td>+</td></tr>
31025 <tr><td>}</td></tr>
31026 </table>
31027 !! wikitext
31028 {|
31029 |a
31030 |-
31031 | -
31032 |-
31033 | +
31034 |-
31035 | }
31036 |}
31037 !! end
31038
31039 !! test
31040 3a. Table cells with escapable prefixes after edits
31041 !! options
31042 parsoid={
31043 "modes": ["selser"],
31044 "scrubWikitext": true,
31045 "changes": [
31046 [ "table tbody tr:first-child td:first-child", "remove"]
31047 ]
31048 }
31049 !! wikitext
31050 {|
31051 |a||-
31052 |}
31053 !! wikitext/edited
31054 {|
31055 | -
31056 |}
31057 !! end
31058
31059 !! test
31060 3b. Table cells with escapable prefixes after edits
31061 !! options
31062 parsoid={
31063 "modes": ["selser"],
31064 "scrubWikitext": true,
31065 "changes": [
31066 [ "table tbody tr:first-child td:first-child", "html", "-" ],
31067 [ "#x", "remove" ]
31068 ]
31069 }
31070 !! wikitext
31071 {|
31072 |pqr
31073 |<span id="x">foo</span>+
31074 |}
31075 !! wikitext/edited
31076 {|
31077 | -
31078 | +
31079 |}
31080 !! end
31081
31082 # FIXME: This test will fail because
31083 # normalization doesn't realize that the id attribute
31084 # will eliminate the escapable scenario
31085 !! test
31086 4a. Table cells without escapable prefixes after edits
31087 !! options
31088 parsoid={
31089 "modes": ["selser"],
31090 "scrubWikitext": true,
31091 "changes": [
31092 [ "#x", "html", "-" ]
31093 ]
31094 }
31095 !! wikitext
31096 {|
31097 | id="x" |abcd
31098 |}
31099 !! wikitext/edited
31100 {|
31101 | id="x" |-
31102 |}
31103 !! end
31104
31105 ## This tests normalizer's ability to discriminate between
31106 ## cells having identical content.
31107 !! test
31108 4b. Table cells without escapable prefixes after edits
31109 !! options
31110 parsoid={
31111 "modes": ["selser"],
31112 "scrubWikitext": true,
31113 "changes": [
31114 [ "td", "html", "-" ]
31115 ]
31116 }
31117 !! wikitext
31118 {|
31119 |a||b
31120 |}
31121 !! wikitext/edited
31122 {|
31123 | -||-
31124 |}
31125 !! end
31126
31127 ## This tests normalizer's ability to not be tripped by
31128 ## comments (and whitespace)
31129 !! test
31130 4c. Table cells without escapable prefixes after edits
31131 !! options
31132 parsoid={
31133 "modes": ["selser"],
31134 "scrubWikitext": true,
31135 "changes": [
31136 [ "table tbody tr td:first-child", "remove" ]
31137 ]
31138 }
31139 !! wikitext
31140 {|
31141 |-
31142 <!--foo--> |a||-
31143 |}
31144 !! wikitext/edited
31145 {|
31146 |-
31147 <!--foo--> | -
31148 |}
31149 !! end
31150
31151 ## This tests normalizer's ability to handle HTML cells
31152 !! test
31153 4d. Table cells without escapable prefixes after edits
31154 !! options
31155 parsoid={
31156 "modes": ["selser"],
31157 "scrubWikitext": true,
31158 "changes": [
31159 [ "td", "html", "-" ]
31160 ]
31161 }
31162 !! wikitext
31163 <table>
31164 <tr><td>a</td></tr>
31165 </table>
31166 !! wikitext/edited
31167 <table>
31168 <tr><td>-</td></tr>
31169 </table>
31170 !! end
31171
31172 ## T111151 Remove font elements without attributes
31173 !! test
31174 5a. font tags without attributes should be dropped in scrubWikitext mode
31175 !! options
31176 parsoid={
31177 "modes": ["html2wt"],
31178 "scrubWikitext": true
31179 }
31180 !! html/parsoid
31181 <font>foo</font>
31182 <font><font>bar</font></font>
31183 <font class="x">boo</font>
31184 !! wikitext
31185 foo
31186 bar
31187 <font class="x">boo</font>
31188 !! end
31189
31190 !! test
31191 5b. font tags should not be dropped without scrubWikitext being enabled
31192 !! options
31193 parsoid={
31194 "modes": ["html2wt"],
31195 "scrubWikitext": false
31196 }
31197 !! html/parsoid
31198 <font>foo</font>
31199 !! wikitext
31200 <font>foo</font>
31201 !! end
31202
31203 !! test
31204 Ignore empty <p></p> when scrubWikitext is false
31205 !! options
31206 parsoid={
31207 "modes": ["html2wt"],
31208 "scrubWikitext": false
31209 }
31210 !! html/parsoid
31211 <div>1</div>
31212 <p>a</p><p></p><p>b</p>
31213 <div>2</div>
31214 <p>a</p>
31215 <p></p>
31216 <p>b</p>
31217 <div>3</div>
31218 <p>a</p>
31219 <p></p>
31220 <p></p>
31221 <p></p>
31222 <p></p>
31223 <p>b</p>
31224 !! wikitext
31225 <div>1</div>
31226 a
31227
31228 b
31229 <div>2</div>
31230 a
31231
31232 b
31233 <div>3</div>
31234 a
31235
31236 b
31237 !! html/php+tidy
31238 <div>1</div>
31239 <p>a
31240 </p><p>b
31241 </p>
31242 <div>2</div>
31243 <p>a
31244 </p><p>b
31245 </p>
31246 <div>3</div>
31247 <p>a
31248 </p><p>b
31249 </p>
31250 !! end
31251
31252 !! test
31253 Normalize empty paragraphs to HTML form that html2wt expects
31254 !! options
31255 parsoid={
31256 "modes": ["html2wt"],
31257 "scrubWikitext": true
31258 }
31259 !! html/parsoid
31260 <div>1</div>
31261 <p>a</p><p></p><p>b</p>
31262 <div>2</div>
31263 <p>a</p>
31264 <p></p>
31265 <p>b</p>
31266 <div>3</div>
31267 <p>a</p>
31268 <p></p>
31269 <p></p>
31270 <p></p>
31271 <p></p>
31272 <p>b</p>
31273 <div>4</div>
31274 <p>a</p>
31275 <p></p>
31276 <div>foo</div>
31277 !! wikitext
31278 <div>1</div>
31279 a
31280
31281
31282 b
31283 <div>2</div>
31284 a
31285
31286
31287 b
31288 <div>3</div>
31289 a
31290
31291
31292
31293
31294
31295 b
31296 <div>4</div>
31297 a
31298
31299 <br />
31300 <div>foo</div>
31301 !! html/php+tidy
31302 <div>1</div>
31303 <p>a
31304 </p><p><br />
31305 b
31306 </p>
31307 <div>2</div>
31308 <p>a
31309 </p><p><br />
31310 b
31311 </p>
31312 <div>3</div>
31313 <p>a
31314 </p><p><br />
31315 </p><p><br />
31316 </p><p>b
31317 </p>
31318 <div>4</div>
31319 <p>a
31320 </p><p><br />
31321 </p>
31322 <div>foo</div>
31323 !! end
31324
31325 !! test
31326 Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away
31327 !! options
31328 parsoid={
31329 "modes": ["html2wt"],
31330 "scrubWikitext": true
31331 }
31332 !! html/parsoid
31333 <table>
31334 <tbody>
31335 <tr>
31336 <td><div>foo
31337 </div>
31338 <p class="mw-empty-elt"></p>
31339 </td>
31340 </tr>
31341 </tbody>
31342 <caption></caption>
31343 </table>
31344 !! wikitext
31345 {|
31346 |<div>foo
31347 </div>
31348 |+
31349 |}
31350 !! end
31351
31352 !! test
31353 Templated content should be skipped over by normalization
31354 !! options
31355 parsoid={
31356 "modes": ["html2wt"],
31357 "scrubWikitext": true
31358 }
31359 !! html/parsoid
31360 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SomeTemplate1","href":"./Template:SomeTemplate1"},"params":{"1":{"wt":"boo"}},"i":0}}]}'>foobar</p><p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"SomeTemplate2","href":"./Template:SomeTemplate2"},"params":{"1":{"wt":"booboo"}},"i":0}}]}'>foobar</p><span about="#mwt2">
31361 </span><p about="#mwt2"></p><span about="#mwt2">
31362 </span>
31363 !! wikitext
31364 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
31365 !! end
31366
31367 !! test
31368 Escape nowiki DOM elements
31369 !! options
31370 parsoid=html2wt
31371 !! html/parsoid
31372 <nowiki><i>foo</i></nowiki>
31373 !! wikitext
31374 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
31375 !! end
31376
31377 # This is meant to be an interim fix while we go about figuring out
31378 # how to not introduce these trailing <nowiki/>s in the first place.
31379 !! test
31380 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
31381 !! options
31382 parsoid=html2wt
31383 !! html/parsoid
31384 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
31385 y</p>
31386 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
31387 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
31388 !! wikitext
31389 x
31390 y
31391
31392 {{echo|
31393 1 = <nowiki/>}}
31394
31395 {{echo|
31396 1 = <nowiki/>
31397 }}
31398 !! end
31399
31400 !! test
31401 New list is serialized on newlines
31402 !! options
31403 parsoid=html2wt
31404 !! html/parsoid
31405 <p>The quick brown fox jumps over the lazy dog.</p><ul>
31406 <li>Yesterday</li>
31407 <li>Today</li>
31408 <li>Tomorrow</li>
31409 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
31410 !! wikitext
31411 The quick brown fox jumps over the lazy dog.
31412
31413 * Yesterday
31414 * Today
31415 * Tomorrow
31416
31417 The quick onyx goblin jumps over the lazy dwarf.
31418 !! end
31419
31420 !! test
31421 New lists in formatting elements serialized w/o newlines
31422 !! options
31423 parsoid=html2wt
31424 !! html/parsoid
31425 <small>
31426
31427 <ul>
31428 <li>123</li>
31429 </ul>
31430
31431 </small>
31432
31433 <small><ul><li>hi</li></ul></small>
31434 !! wikitext
31435 <small>
31436 * 123
31437 </small>
31438
31439 <small>
31440 * hi
31441 </small>
31442 !! end
31443
31444 !! test
31445 New list in table doesn't need newlines
31446 !! options
31447 parsoid=html2wt
31448 !! html/parsoid
31449 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
31450 !! wikitext
31451 {|
31452 |
31453 * test
31454 * 123
31455 |}
31456 !! end
31457
31458 # ---------------------------------------------------
31459 # End of tests spec'ing wikitext serialization norms |
31460 # ---------------------------------------------------
31461
31462 # T104032
31463 !! test
31464 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
31465 !! options
31466 parsoid=html2wt
31467 !! html/parsoid
31468 a<p>b</p>
31469 <b>c</b><p>d</p>
31470 <table><tr>
31471 <td>a<p>b</p></td>
31472 <td><b>c</b><p>d</p></td>
31473 </tr></table>
31474 !! wikitext
31475 a
31476
31477 b
31478
31479 '''c'''
31480
31481 d
31482 {|
31483 |a
31484 b
31485 |'''c'''
31486 d
31487 |}
31488 !! end
31489
31490 !! test
31491 Anchor without href scenarios
31492 !! options
31493 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
31494 !! html/parsoid
31495 <a class="bc"></a>
31496 <a class="no">dice</a>
31497 <a name="foo"></a>
31498 !! wikitext
31499
31500 dice
31501 <span name="foo"></span>
31502 !! end
31503
31504 !! test
31505 New transclusion added after a list should be serialized after the list
31506 !! options
31507 parsoid=html2wt
31508 !! html/parsoid
31509 <ul><li>a</li></ul><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
31510 !! wikitext
31511 * a
31512 {{echo|foo}}
31513 !! end
31514
31515 !! test
31516 Only html p-tag is strong indent pre suppressing
31517 !! options
31518 parsoid=html2wt
31519 !! html/parsoid
31520 <p>test2<span>
31521 test3
31522 </span></p>
31523 !! wikitext
31524 test2<span>
31525 <nowiki> </nowiki>test3
31526 </span>
31527 !! end
31528
31529 # -----------------------------------------------------------------
31530 # End of section for Parsoid-only html2wt tests for serialization
31531 # of new content
31532 # -----------------------------------------------------------------
31533
31534 # -----------------------------------------------------------------
31535 # The following section of tests are primarily to spec behavior of
31536 # the selective serializer. All these tests have manual selser
31537 # changes. The automated selser changes for all tests handle the
31538 # wide variation of changes, but these tests here capture specs
31539 # deterministically.
31540 # ----------------------------------------------------------------
31541
31542 ## T90517
31543 !! test
31544 Selser: New comments should not be lost
31545 !! options
31546 parsoid={
31547 "modes": ["selser"],
31548 "changes": [
31549 [ "#a", "after", "<!--c1-->" ],
31550 [ "#b", "before", "<!--c2-->" ]
31551 ]
31552 }
31553 !! wikitext
31554 <span id="a">a</span>
31555
31556 <span id="b">b</span>
31557 !! wikitext/edited
31558 <span id="a">a</span><!--c1-->
31559
31560 <!--c2--><span id="b">b</span>
31561 !! end
31562
31563 ## T89383
31564 !! test
31565 Selser: Check for validity of DSR before using it
31566 !! options
31567 parsoid={
31568 "modes": ["selser"],
31569 "changes": [
31570 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31571 ]
31572 }
31573 !! wikitext
31574 <span id="a">a</span>
31575 !! wikitext/edited
31576 {{DISPLAYTITLE:foo}}
31577 <span id="a">a</span>
31578 !! end
31579
31580 !! test
31581 1. DOMDiff: Changes to <ref> content should be looked up using id
31582 !! options
31583 parsoid={
31584 "modes": ["selser"],
31585 "changes": [
31586 ["#X", "after", "bar"],
31587 ["#Y", "after", "baz"]
31588 ]
31589 }
31590 !! wikitext
31591 X <ref><span id="X">foo</span></ref>
31592 Y <ref name="a" />
31593 <references>
31594 <ref name="a"><span id="Y">foo</span></ref>
31595 </references>
31596 !! wikitext/edited
31597 X <ref><span id="X">foo</span>bar</ref>
31598 Y <ref name="a" />
31599 <references>
31600 <ref name="a"><span id="Y">foo</span>baz</ref>
31601 </references>
31602 !! end
31603
31604 !! test
31605 2. DOMDiff: Changes to <ref> content should be looked up using id
31606 !! options
31607 parsoid={
31608 "modes": ["selser"],
31609 "changes": [
31610 ["#Z", "after", "bar"]
31611 ]
31612 }
31613 !! wikitext
31614 A <ref>foo bar for a</ref>
31615 B <ref group="X" name="b" />
31616
31617 <references />
31618
31619 <references group="X">
31620 <ref name="b"><span id="Z">foo</span></ref>
31621 </references>
31622 !! wikitext/edited
31623 A <ref>foo bar for a</ref>
31624 B <ref group="X" name="b" />
31625
31626 <references />
31627
31628 <references group="X">
31629 <ref name="b"><span id="Z">foo</span>bar</ref>
31630 </references>
31631 !! end
31632
31633 !! test
31634 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31635 !! options
31636 parsoid={
31637 "modes": ["selser"],
31638 "changes": [
31639 [ "div:first-child", "text", "bar" ]
31640 ]
31641 }
31642 !! wikitext
31643 <div style="{{1x|color:red;}}%">foo</div>
31644 !! wikitext/edited
31645 <div style="{{1x|color:red;}}%">bar</div>
31646 !! end
31647
31648 !! test
31649 Empty LI (T49673)
31650 !! wikitext
31651 *a
31652 *
31653 *
31654 *b
31655 !! html+tidy
31656 <ul><li>a</li>
31657 <li class="mw-empty-elt"></li>
31658 <li class="mw-empty-elt"></li>
31659 <li>b</li></ul>
31660 !! end
31661
31662 !! test
31663 Thumbnail output
31664 !! wikitext
31665 [[File:Thumb.png|thumb]]
31666 !! html/php+tidy
31667 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" decoding="async" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div></div></div></div>
31668 !! html/parsoid
31669 <figure class="mw-default-size" typeof="mw:Image/Thumb"><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><figcaption></figcaption></figure>
31670 !! end
31671
31672 !! test
31673 unclosed internal link XSS (T137264)
31674 !! wikitext
31675 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31676 !! html/php
31677 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31678 </p>
31679 !! html/parsoid
31680 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31681 !! end
31682
31683 !! test
31684 Validating that <style> isn't eaten by tidy (T167349)
31685 !! options
31686 styletag=1
31687 !! wikitext
31688 <div class="foo">
31689 <style>.foo::before { content: "<foo>"; }</style>
31690 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31691 </div>
31692 !! html/php+tidy
31693 <div class="foo">
31694 <style>.foo::before { content: "<foo>"; }</style>
31695 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31696 </div>
31697 !! html/parsoid
31698 <div class="foo">
31699 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31700 <style data-x-data-mw-foobar="baz" typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{"data-x-data-mw-foobar":"baz"},"body":{"extsrc":".foo::after { content: \"&lt;bar>\"; }"}}'>.foo::after { content: "<bar>"; }</style>
31701 </div>
31702 !! end
31703
31704 ## Right now, Parsoid doesn't de-duplicate style tags.
31705 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31706 ## In a followup patch, when we de-duplicate style tags and
31707 ## introduce link tags, we'll add a hook for link tags in
31708 ## the parser test runner script.
31709 !! test
31710 Validating that <style> isn't wrapped in a paragraph (T186965)
31711 !! options
31712 styletag=1
31713 !! wikitext
31714 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31715
31716 <style>.foo::before { content: "<foo>"; }</style>
31717
31718 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31719
31720 But if it's on a line with other content, let it be wrapped.
31721
31722 <style>.foo::before { content: "<foo>"; }</style> bar
31723
31724 foo <style>.foo::before { content: "<foo>"; }</style>
31725
31726 foo <style>.foo::before { content: "<foo>"; }</style> bar
31727
31728 And the same if we have non-paragraph-breaking whitespace
31729
31730 foo
31731 <style>.foo::before { content: "<foo>"; }</style>
31732 bar
31733 !! html/php
31734 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31735 </p>
31736 <style>.foo::before { content: "<foo>"; }</style>
31737 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31738 <p>But if it's on a line with other content, let it be wrapped.
31739 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31740 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31741 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31742 </p><p>And the same if we have non-paragraph-breaking whitespace
31743 </p><p>foo
31744 <style>.foo::before { content: "<foo>"; }</style>
31745 bar
31746 </p>
31747 !! html/parsoid
31748 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31749
31750 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31751
31752 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> &lt;link rel="foo" href="bar"/><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
31753
31754 <p>But if it's on a line with other content, let it be wrapped.</p>
31755
31756 <p><style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
31757
31758 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style></p>
31759
31760 <p>foo <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style> bar</p>
31761
31762 <p>And the same if we have non-paragraph-breaking whitespace</p>
31763
31764 <p>foo
31765 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31766 bar</p>
31767 !! end
31768
31769 !! test
31770 Validating that <link> isn't wrapped in a paragraph (T186965)
31771 !! options
31772 styletag=1
31773 !! wikitext
31774 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31775
31776 <link rel="foo" href="bar"/>
31777
31778 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31779
31780 But if it's on a line with other content, let it be wrapped.
31781
31782 <link rel="foo" href="bar"/> bar
31783
31784 foo <link rel="foo" href="bar"/>
31785
31786 foo <link rel="foo" href="bar"/> bar
31787
31788 And the same if we have non-paragraph-breaking whitespace
31789
31790 foo
31791 <link rel="foo" href="bar"/>
31792 bar
31793 !! html/php
31794 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31795 </p>
31796 <link rel="foo" href="bar"/>
31797 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31798 <p>But if it's on a line with other content, let it be wrapped.
31799 </p><p><link rel="foo" href="bar"/> bar
31800 </p><p>foo <link rel="foo" href="bar"/>
31801 </p><p>foo <link rel="foo" href="bar"/> bar
31802 </p><p>And the same if we have non-paragraph-breaking whitespace
31803 </p><p>foo
31804 <link rel="foo" href="bar"/>
31805 bar
31806 </p>
31807 !! end
31808
31809 !! test
31810 Extension returning multiple nodes starting with a style tag roundtrips
31811 !! options
31812 wgRawHtml=1
31813 !! wikitext
31814 <table>
31815 {{echo|<html><style>.hi { color: red; }</style>
31816 </html>}}
31817 <tr><td class="hi">ho</td></tr>
31818 </table>
31819 !! html/parsoid
31820 <p about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"firstWikitextNode":"TABLE_html","pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;html>&lt;style>.hi { color: red; }&lt;/style>\n&lt;/html>"}},"i":0}},"\n&lt;tr>&lt;td class=\"hi\">ho&lt;/td>&lt;/tr>\n&lt;/table>"]}'><style typeof="mw:Extension/html" about="#mwt4" data-mw='{"name":"html","attrs":{},"body":{"extsrc":"&lt;style>.hi { color: red; }&lt;/style>\n"}}'>.hi { color: red; }</style><span about="#mwt4">
31821 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31822
31823 <tbody><tr><td class="hi">ho</td></tr>
31824 </tbody></table>
31825 !! end
31826
31827 !! test
31828 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31829 !! config
31830 wgFragmentMode=[ 'html5', 'legacy' ]
31831 !! wikitext
31832 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31833 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31834 !! html/php
31835 <h2><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE"></span><span class="mw-headline" id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</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&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31836 <p><a href="#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31837 </p>
31838 !! html/parsoid
31839 <h2 id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId" data-parsoid="{}"></span>A&amp;B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;amp;E</h2>
31840 <p><a rel="mw:WikiLink" href="./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"},"sa":{"href":"#A&amp;B&amp;amp;C&amp;amp;amp;D&amp;amp;amp;amp;E"}}'>#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a></p>
31841 !! end
31842
31843 !! test
31844 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31845 !! config
31846 wgFragmentMode=[ 'legacy' ]
31847 !! wikitext
31848 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31849 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31850 !! html/php
31851 <h2><span class="mw-headline" id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</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&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31852 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31853 </p>
31854 !! end
31855
31856 !! test
31857 Decoding of HTML entities in embedded HTML tags
31858 !! wikitext
31859 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31860 !! html/php
31861 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31862 !! html/parsoid
31863 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5" data-parsoid='{"stx":"html","a":{"class":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"sa":{"class":"1&amp;2&amp;amp;3&amp;amp;amp;4&amp;amp;amp;amp;5"}}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>x</td></tr></tbody></table>
31864 !! end
31865
31866 !! test
31867 Decoding of HTML entities in indicator names for IDs (T104196)
31868 !! options
31869 parsoid=wt2html,html2html
31870 showindicators
31871 !! wikitext
31872 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31873 !! html/php
31874 1&2&3&amp;4&amp;amp;5=Indicator
31875
31876 !! html/parsoid
31877 <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
31878 !! end
31879
31880 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31881 !! test
31882 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31883 !! options
31884 showindicators
31885 !! wikitext
31886 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31887 !! html/php
31888 1&2&3&amp;4&amp;amp;5=Indicator
31889
31890 !! html/parsoid
31891 <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
31892 !! end
31893
31894 # This fragment mode is what Parsoid supports.
31895 !! test
31896 HTML5 ids: fallback to legacy
31897 !! config
31898 wgFragmentMode=[ 'html5', 'legacy' ]
31899 !! wikitext
31900 ==Foo bar==
31901
31902 ==foo Bar==
31903
31904 ==Тест==
31905
31906 ==Тест==
31907
31908 ==тест==
31909
31910 ==Hey < # " > % : '==
31911 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31912
31913 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31914
31915 <!-- These two links should produce identical HTML -->
31916 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31917
31918 !! html/php
31919 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
31920 <ul>
31921 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31922 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31923 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31924 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31925 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31926 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
31927 </ul>
31928 </div>
31929
31930 <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>
31931 <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>
31932 <h2><span id=".D0.A2.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31933 <h2><span id=".D0.A2.D0.B5.D1.81.D1.82_2"></span><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31934 <h2><span id=".D1.82.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31935 <h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31936 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
31937 </p><p>💩 <span id="💩"></span>
31938 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31939 </p>
31940 !! html/parsoid
31941 <h2 id="Foo_bar">Foo bar</h2>
31942
31943 <h2 id="foo_Bar_2">foo Bar</h2>
31944
31945 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31946
31947 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31948
31949 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31950
31951 <h2 id="Hey_&lt;_#_&quot;_>_%_:_'"><span id="Hey_.3C_.23_.22_.3E_.25_:_.27" typeof="mw:FallbackId"></span>Hey &lt; # " > %<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: '</h2>
31952 <p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Parser_test#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Parser_test#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Parser_test#тест">#тест</a> <a rel="mw:WikiLink" href="./Parser_test#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Hey_&lt;_#_\"_>_%_:_&#39;"},"sa":{"href":"#Hey &lt; # \" > % : &#39;"}}'>#Hey &lt; # " > % : '</a></p>
31953
31954 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[178,197,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
31955
31956 <!-- These two links should produce identical HTML -->
31957 <p><a rel="mw:WikiLink" href="./Parser_test#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Parser_test#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
31958 !! end
31959
31960 # Parsoid doesn't support this mode
31961 !! test
31962 HTML5 ids: legacy with a fallback to modern
31963 !! config
31964 wgFragmentMode=[ 'legacy', 'html5' ]
31965 !! wikitext
31966 ==Foo bar==
31967
31968 ==foo Bar==
31969
31970 ==Тест==
31971
31972 ==Тест==
31973
31974 ==тест==
31975
31976 ==Hey < # " > % : '==
31977 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31978
31979 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31980
31981 <!-- These two links should produce identical HTML -->
31982 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31983
31984 !! html/php
31985 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
31986 <ul>
31987 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31988 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31989 <li class="toclevel-1 tocsection-3"><a href="#.D0.A2.D0.B5.D1.81.D1.82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31990 <li class="toclevel-1 tocsection-4"><a href="#.D0.A2.D0.B5.D1.81.D1.82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31991 <li class="toclevel-1 tocsection-5"><a href="#.D1.82.D0.B5.D1.81.D1.82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31992 <li class="toclevel-1 tocsection-6"><a href="#Hey_.3C_.23_.22_.3E_.25_:_.27"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
31993 </ul>
31994 </div>
31995
31996 <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>
31997 <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>
31998 <h2><span id="Тест"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
31999 <h2><span id="Тест_2"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32000 <h2><span id="тест"></span><span class="mw-headline" id=".D1.82.D0.B5.D1.81.D1.82">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32001 <h2><span id="Hey_&lt;_#_&quot;_&gt;_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32002 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#.D0.A2.D0.B5.D1.81.D1.82">#Тест</a> <a href="#.D1.82.D0.B5.D1.81.D1.82">#тест</a> <a href="#Hey_.3C_.23_.22_.3E_.25_:_.27">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
32003 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
32004 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
32005 </p>
32006 !! end
32007
32008 # Parsoid doesn't support this mode.
32009 !! test
32010 HTML5 ids: no legacy
32011 !! config
32012 wgFragmentMode=[ 'html5' ]
32013 !! wikitext
32014 ==Foo bar==
32015
32016 ==foo Bar==
32017
32018 ==Тест==
32019
32020 ==Тест==
32021
32022 ==тест==
32023
32024 ==Hey < # " > % : '==
32025 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
32026
32027 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
32028
32029 <!-- These two links should produce identical HTML -->
32030 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
32031
32032 !! html/php
32033 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
32034 <ul>
32035 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
32036 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
32037 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
32038 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
32039 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
32040 <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
32041 </ul>
32042 </div>
32043
32044 <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>
32045 <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>
32046 <h2><span class="mw-headline" id="Тест">Тест</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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32047 <h2><span class="mw-headline" id="Тест_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: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32048 <h2><span class="mw-headline" id="тест">тест</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: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32049 <h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</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: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32050 <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
32051 </p><p>💩 <span id="💩"></span>
32052 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
32053 </p>
32054 !! end
32055
32056 !! test
32057 T90902: Normalize weird characters in section IDs
32058 !! config
32059 wgFragmentMode=[ 'html5', 'legacy' ]
32060 !! wikitext
32061 ==Foo&nbsp;bar==
32062 [[#Foo&nbsp;bar]]
32063
32064 !! html/php
32065 <h2><span class="mw-headline" id="Foo_bar">Foo&#160;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>
32066 <p><a href="#Foo_bar">#Foo&#160;bar</a>
32067 </p>
32068 !! html/parsoid
32069 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
32070 <p><a rel="mw:WikiLink" href="./Parser_test#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
32071 !! end
32072
32073 !! test
32074 T51672: Test for brackets in attributes of elements in external link texts
32075 !! wikitext
32076 [http://example.com/ link <span title="title with [brackets]">span</span>]
32077 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
32078
32079 !! html/php
32080 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
32081 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
32082 </p>
32083 !! html/parsoid
32084 <p><a rel="mw:ExtLink" href="http://example.com/" class="external text">link <span title="title with [brackets]">span</span></a>
32085 <a rel="mw:ExtLink" href="http://example.com/" class="external text">link <span title="title with [brackets]" data-parsoid='{"stx":"html","a":{"title":"title with [brackets]"},"sa":{"title":"title with &amp;#91;brackets&amp;#93;"}}'>span</span></a></p>
32086 !! end
32087
32088 !! test
32089 T72875: Test for brackets in attributes of elements in internal link texts
32090 !! wikitext
32091 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
32092 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
32093
32094 !! html/php
32095 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
32096 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
32097 </p>
32098 !! html/parsoid
32099 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
32100 <a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]" data-parsoid='{"stx":"html","a":{"title":"title with [[double brackets]]"},"sa":{"title":"title with &amp;#91;&amp;#91;double brackets&amp;#93;&amp;#93;"}}'>span</span></a></p>
32101 !! end
32102
32103 !! test
32104 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
32105 !! options
32106 parsoid={
32107 "modes": ["html2wt"]
32108 }
32109 !! html/parsoid
32110 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
32111 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total">10</a>
32112 !! wikitext
32113 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
32114 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
32115 !! end
32116
32117 ## FIXME: "gerrit" isn't in PHP's setupInterwikis
32118 !! test
32119 T199926: Hash only interwiki link
32120 !! wikitext
32121 [[meatball:Test#1/2]]
32122 [[gerrit:#/q/project:mediawiki/services/parsoid|Gerrit]]
32123 !! html/php+tidy
32124 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" class="extiw" title="meatball:Test">meatball:Test#1/2</a>
32125 <a href="/index.php?title=Gerrit:&amp;action=edit&amp;redlink=1" class="new" title="Gerrit: (page does not exist)">Gerrit</a>
32126 </p>
32127 !! html/parsoid
32128 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" title="meatball:Test" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2"},"sa":{"href":"meatball:Test#1/2"},"isIW":true}'>meatball:Test#1/2</a>
32129 <a rel="mw:WikiLink/Interwiki" href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid">Gerrit</a></p>
32130 !! end
32131
32132 !! test
32133 T179544: {{anchorencode:}} output should be always usable in links
32134 !! config
32135 wgFragmentMode=[ 'html5' ]
32136 !! wikitext
32137 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
32138 !! html/php
32139 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
32140 </p>
32141 !! html/parsoid
32142 <p><span id="[foo]" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"id":"[foo]"},"sa":{"id":"{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[10,32,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'></span><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Parser_test#[foo]" data-parsoid='{"stx":"simple","a":{"href":"./Parser_test#[foo]"},"sa":{"href":"#{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"#&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[44,66,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt2\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'>#[foo]</a></p>
32143 !! end
32144
32145 ## ------------------------------
32146 ## Parsoid section-wrapping tests
32147 ## ------------------------------
32148 !! test
32149 Section wrapping for well-nested sections (no leading content)
32150 !! options
32151 notoc
32152 parsoid={
32153 "wrapSections": true
32154 }
32155 !! wikitext
32156 =1=
32157 a
32158
32159 =2=
32160 b
32161
32162 ==2.1==
32163 c
32164
32165 ==2.2==
32166 d
32167
32168 ===2.2.1===
32169 e
32170
32171 =3=
32172 f
32173 !! html/php+tidy
32174
32175 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32176 <p>a
32177 </p>
32178 <h1><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=2" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32179 <p>b
32180 </p>
32181 <h2><span class="mw-headline" id="2.1">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=3" title="Edit section: 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32182 <p>c
32183 </p>
32184 <h2><span class="mw-headline" id="2.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=4" title="Edit section: 2.2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32185 <p>d
32186 </p>
32187 <h3><span class="mw-headline" id="2.2.1">2.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=5" title="Edit section: 2.2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
32188 <p>e
32189 </p>
32190 <h1><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=6" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32191 <p>f
32192 </p>
32193 !! html/parsoid
32194 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32195 <p>a</p>
32196
32197 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
32198 <p>b</p>
32199
32200 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
32201 <p>c</p>
32202
32203 </section><section data-mw-section-id="4"><h2 id="2.2" data-parsoid="{}">2.2</h2>
32204 <p>d</p>
32205
32206 <section data-mw-section-id="5"><h3 id="2.2.1" data-parsoid="{}">2.2.1</h3>
32207 <p>e</p>
32208
32209 </section></section></section><section data-mw-section-id="6"><h1 id="3" data-parsoid="{}">3</h1>
32210 <p>f</p>
32211
32212 </section>
32213 !! end
32214
32215 !! test
32216 Section wrapping for well-nested sections (with leading content)
32217 !! options
32218 notoc
32219 parsoid={
32220 "wrapSections": true
32221 }
32222 !! wikitext
32223 Para 1.
32224
32225 Para 2 with a <div>nested in it</div>
32226
32227 Para 3.
32228
32229 =1=
32230 a
32231
32232 =2=
32233 b
32234
32235 ==2.1==
32236 c
32237 !! html/php+tidy
32238 <p>Para 1.
32239 </p><p>
32240 Para 2 with a </p><div>nested in it</div>
32241 <p>Para 3.
32242 </p>
32243 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32244 <p>a
32245 </p>
32246 <h1><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=2" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32247 <p>b
32248 </p>
32249 <h2><span class="mw-headline" id="2.1">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=3" title="Edit section: 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32250 <p>c
32251 </p>
32252 !! html/parsoid
32253 <section data-mw-section-id="0"><p>Para 1.</p>
32254
32255 <p>Para 2 with a </p><div>nested in it</div>
32256
32257 <p>Para 3.</p>
32258
32259 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32260 <p>a</p>
32261
32262 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
32263 <p>b</p>
32264
32265 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
32266 <p>c</p>
32267
32268 </section></section>
32269 !! end
32270
32271 !! test
32272 Section wrapping with template-generated sections (good nesting 1)
32273 !! options
32274 notoc
32275 parsoid={
32276 "wrapSections": true
32277 }
32278 !! wikitext
32279 =1=
32280 a
32281
32282 {{echo|1=
32283 ==1.1==
32284 b
32285 }}
32286 ==1.2==
32287 c
32288
32289 =2=
32290 d
32291 !! html/php+tidy
32292
32293 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32294 <p>a
32295 </p>
32296 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32297 <p>b
32298 </p>
32299 <h2><span class="mw-headline" id="1.2">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=3" title="Edit section: 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32300 <p>c
32301 </p>
32302 <h1><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=4" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32303 <p>d
32304 </p>
32305 !! html/parsoid
32306 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32307 <p>a</p>
32308
32309 <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.1" data-parsoid='{"dsr":[9,33,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.1==\nb"}},"i":0}}]}'>1.1</h2><span about="#mwt1">
32310 </span><p about="#mwt1">b</p>
32311 </section><section data-mw-section-id="3"><h2 id="1.2" data-parsoid="{}">1.2</h2>
32312 <p>c</p>
32313
32314 </section></section><section data-mw-section-id="4"><h1 id="2" data-parsoid="{}">2</h1>
32315 <p>d</p></section>
32316 !! end
32317
32318 # In this example, the template scope is mildly expanded to incorporate the
32319 # trailing newline after the transclusion since that is part of section 1.1.1
32320 !! test
32321 Section wrapping with template-generated sections (good nesting 2)
32322 !! options
32323 notoc
32324 parsoid={
32325 "wrapSections": true,
32326 "modes": ["wt2html", "wt2wt"]
32327 }
32328 !! wikitext
32329 =1=
32330 a
32331
32332 {{echo|1=
32333 ==1.1==
32334 b
32335 ===1.1.1===
32336 d
32337 }}
32338 =2=
32339 e
32340 !! html/php+tidy
32341
32342 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32343 <p>a
32344 </p>
32345 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32346 <p>b
32347 </p>
32348 <h3><span class="mw-headline" id="1.1.1">1.1.1</span></h3>
32349 <p>d
32350 </p>
32351 <h1><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=4" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32352 <p>e
32353 </p>
32354 !! html/parsoid
32355 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
32356 <p>a</p>
32357
32358 <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.1" data-parsoid='{"dsr":[9,50,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.1==\nb\n===1.1.1===\nd"}},"i":0}},"\n"]}'>1.1</h2><span about="#mwt1">
32359 </span><p about="#mwt1">b</p><span about="#mwt1">
32360 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
32361 </span><p about="#mwt1">d</p><span about="#mwt1">
32362 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
32363 <p>e</p></section>
32364 !! end
32365
32366 # In this example, the template scope is mildly expanded to incorporate the
32367 # trailing newline after the transclusion since that is part of section 1.2.1
32368 !! test
32369 Section wrapping with template-generated sections (good nesting 3)
32370 !! options
32371 notoc
32372 parsoid={
32373 "wrapSections": true,
32374 "modes": ["wt2html", "wt2wt"]
32375 }
32376 !! wikitext
32377 =1=
32378 a
32379
32380 {{echo|1=
32381 x
32382 ==1.1==
32383 b
32384 ==1.2==
32385 c
32386 ===1.2.1===
32387 d
32388 }}
32389 =2=
32390 e
32391 !! html/php+tidy
32392
32393 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32394 <p>a
32395 </p><p>x
32396 </p>
32397 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32398 <p>b
32399 </p>
32400 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32401 <p>c
32402 </p>
32403 <h3><span class="mw-headline" id="1.2.1">1.2.1</span></h3>
32404 <p>d
32405 </p>
32406 <h1><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=5" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32407 <p>e
32408 </p>
32409 !! html/parsoid
32410 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
32411 <p>a</p>
32412
32413 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[9,60,0,0],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"x\n==1.1==\nb\n==1.2==\nc\n===1.2.1===\nd"}},"i":0}},"\n"]}'>x</p><span about="#mwt1">
32414 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
32415 </span><p about="#mwt1">b</p><span about="#mwt1">
32416 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
32417 </span><p about="#mwt1">c</p><span about="#mwt1">
32418 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
32419 </span><p about="#mwt1">d</p><span about="#mwt1">
32420 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
32421 <p>e</p></section>
32422 !! end
32423
32424 # Because of section-wrapping and template-wrapping interactions,
32425 # the scope of the template is expanded so that the template markup
32426 # is valid in the presence of <section> tags.
32427 # This exercises the s1 is null scenario in the wrapSections code
32428 !! test
32429 Section wrapping with template-generated sections (bad nesting 1)
32430 !! options
32431 notoc
32432 parsoid={
32433 "wrapSections": true
32434 }
32435 !! wikitext
32436 <div>
32437 a
32438
32439 {{echo|1=
32440 =1=
32441 b
32442 }}
32443
32444 c
32445 </div>
32446 !! html/php+tidy
32447 <div>
32448 <p>a
32449 </p>
32450 <h1><span class="mw-headline" id="1">1</span></h1>
32451 <p>b
32452 </p><p>c
32453 </p>
32454 </div>
32455 !! html/parsoid
32456 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
32457 <p>a</p>
32458
32459 <section data-mw-section-id="-1"><h1 about="#mwt1" typeof="mw:Transclusion" id="1" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"=1=\nb"}},"i":0}}]}'>1</h1><span about="#mwt1">
32460 </span><p about="#mwt1">b</p>
32461
32462 <p>c</p>
32463 </section></div></section>
32464 !! end
32465
32466 # Because of section-wrapping and template-wrapping interactions,
32467 # the scope of the template is expanded so that the template markup
32468 # is valid in the presence of <section> tags.
32469 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
32470 !! test
32471 Section wrapping with template-generated sections (bad nesting 2)
32472 !! options
32473 notoc
32474 parsoid={
32475 "wrapSections": true
32476 }
32477 !! wikitext
32478 =1=
32479 a
32480
32481 {{echo|1=
32482 =2=
32483 b
32484 ==2.1==
32485 c
32486 }}
32487
32488 d
32489
32490 =3=
32491 e
32492 !! html/php+tidy
32493
32494 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32495 <p>a
32496 </p>
32497 <h1><span class="mw-headline" id="2">2</span></h1>
32498 <p>b
32499 </p>
32500 <h2><span class="mw-headline" id="2.1">2.1</span></h2>
32501 <p>c
32502 </p><p>d
32503 </p>
32504 <h1><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=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32505 <p>e
32506 </p>
32507 !! html/parsoid
32508 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32509 <p>a</p>
32510
32511 </section><section data-mw-section-id="-1"><h1 about="#mwt1" typeof="mw:Transclusion" id="2" data-parsoid='{"dsr":[9,45,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"=2=\nb\n==2.1==\nc"}},"i":0}},"\n\nd\n\n"]}'>2</h1><span about="#mwt1">
32512 </span><p about="#mwt1">b</p><span about="#mwt1">
32513 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
32514 </span><p about="#mwt1">c</p><span about="#mwt1">
32515
32516 </span><p about="#mwt1">d</p><span about="#mwt1">
32517
32518 </span></section></section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32519 <p>e</p></section>
32520 !! end
32521
32522 # Because of section-wrapping and template-wrapping interactions,
32523 # additional template wrappers are added to <section> tags
32524 # so that template wrapping semantics are valid whether section
32525 # tags are retained or stripped. But, the template scope can expand
32526 # greatly when accounting for section tags.
32527 # This exercises the s1 and s2 are in different subtrees scenario
32528 !! test
32529 Section wrapping with template-generated sections (bad nesting 3)
32530 !! options
32531 notoc
32532 parsoid={
32533 "wrapSections": true,
32534 "modes": ["wt2html", "wt2wt"]
32535 }
32536 !! wikitext
32537 =1=
32538 a
32539
32540 {{echo|1=
32541 ==1.2==
32542 b
32543 =2=
32544 c
32545 }}
32546
32547 d
32548
32549 =3=
32550 e
32551 !! html/php+tidy
32552
32553 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32554 <p>a
32555 </p>
32556 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32557 <p>b
32558 </p>
32559 <h1><span class="mw-headline" id="2">2</span></h1>
32560 <p>c
32561 </p><p>d
32562 </p>
32563 <h1><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=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32564 <p>e
32565 </p>
32566 !! html/parsoid
32567 <section data-mw-section-id="0"></section><section data-mw-section-id="1" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["=1=\na\n\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.2==\nb\n=2=\nc"}},"i":0}},"\n\nd\n\n"]}'><h1 id="1">1</h1>
32568 <p>a</p>
32569
32570 <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.2==\nb\n=2=\nc"}},"i":0}}]}'>1.2</h2><span about="#mwt1">
32571 </span><p about="#mwt1">b</p><span about="#mwt1">
32572 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
32573 </span><p about="#mwt1">c</p>
32574
32575 <p>d</p>
32576 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
32577 <p>e</p></section>
32578 !! end
32579
32580 !! test
32581 Section wrapping with uneditable lead section + div wrapping multiple sections
32582 !! options
32583 notoc
32584 parsoid={
32585 "wrapSections": true
32586 }
32587 !! wikitext
32588 foo
32589
32590 <div style="border:1px solid red;">
32591 =1=
32592 a
32593
32594 ==1.1==
32595 b
32596
32597 =2=
32598 c
32599 </div>
32600
32601 =3=
32602 d
32603
32604 ==3.1==
32605 e
32606 !! html/php+tidy
32607 <p>foo
32608 </p>
32609 <div style="border:1px solid red;">
32610
32611 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32612 <p>a
32613 </p>
32614 <h2><span class="mw-headline" id="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=2" title="Edit section: 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32615 <p>b
32616 </p>
32617 <h1><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=3" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32618 <p>c
32619 </p>
32620 </div>
32621 <h1><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=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32622 <p>d
32623 </p>
32624 <h2><span class="mw-headline" id="3.1">3.1</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: 3.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32625 <p>e
32626 </p>
32627 !! html/parsoid
32628 <section data-mw-section-id="-1"><p>foo</p>
32629
32630 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32631 <section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32632 <p>a</p>
32633
32634 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32635 <p>b</p>
32636
32637 </section></section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32638 <p>c</p>
32639 </section></div>
32640
32641 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32642 <p>d</p>
32643
32644 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32645 <p>e</p>
32646 </section></section>
32647 !! end
32648
32649 !! test
32650 Section wrapping with editable lead section + div overlapping multiple sections
32651 !! options
32652 notoc
32653 parsoid={
32654 "wrapSections": true
32655 }
32656 !! wikitext
32657 foo
32658
32659 =1=
32660 a
32661 <div style="border:1px solid red;">
32662 b
32663
32664 ==1.1==
32665 c
32666
32667 =2=
32668 d
32669 </div>
32670 e
32671
32672 =3=
32673 f
32674
32675 ==3.1==
32676 g
32677 !! html/php+tidy
32678 <p>foo
32679 </p>
32680
32681 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32682 <p>a
32683 </p>
32684 <div style="border:1px solid red;">
32685 <p>b
32686 </p>
32687 <h2><span class="mw-headline" id="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=2" title="Edit section: 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32688 <p>c
32689 </p>
32690 <h1><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=3" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32691 <p>d
32692 </p>
32693 </div>
32694 <p>e
32695 </p>
32696 <h1><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=4" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32697 <p>f
32698 </p>
32699 <h2><span class="mw-headline" id="3.1">3.1</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: 3.1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32700 <p>g
32701 </p>
32702 !! html/parsoid
32703 <section data-mw-section-id="0"><p>foo</p>
32704
32705 </section><section data-mw-section-id="-1"><h1 id="1" data-parsoid="{}">1</h1>
32706 <p>a</p>
32707 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32708 <p>b</p>
32709
32710 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32711 <p>c</p>
32712
32713 </section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32714 <p>d</p>
32715 </section></div>
32716 <p>e</p>
32717
32718 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32719 <p>f</p>
32720
32721 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32722 <p>g</p>
32723 </section></section>
32724 !! end
32725
32726 !! test
32727 HTML header tags should not be wrapped in section tags
32728 !! options
32729 notoc
32730 parsoid={
32731 "wrapSections": true
32732 }
32733 !! wikitext
32734 foo
32735
32736 <h1>a</h1>
32737
32738 =b=
32739
32740 <h1>c</h1>
32741
32742 =d=
32743 !! html/php+tidy
32744 <p>foo
32745 </p>
32746
32747 <h1><span class="mw-headline" id="a">a</span></h1>
32748 <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>
32749 <h1><span class="mw-headline" id="c">c</span></h1>
32750 <h1><span class="mw-headline" id="d">d</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: d">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32751 !! html/parsoid
32752 <section data-mw-section-id="0"><p>foo</p>
32753
32754 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32755
32756 </section><section data-mw-section-id="1"><h1 id="b" data-parsoid="{}">b</h1>
32757
32758 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32759
32760 </section><section data-mw-section-id="2"><h1 id="d" data-parsoid="{}">d</h1></section>
32761 !! end
32762
32763 !! test
32764 Lead section containing only whitespace and comments.
32765 !! options
32766 notoc
32767 parsoid={
32768 "wrapSections": true
32769 }
32770 !! wikitext
32771
32772 <!-- this is a comment, presumably significant to editors -->
32773 =1=
32774 a
32775
32776 =2=
32777 b
32778 !! html/php+tidy
32779 <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=1" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32780 <p>a
32781 </p>
32782 <h1><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=2" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
32783 <p>b
32784 </p>
32785 !! html/parsoid
32786 <section data-mw-section-id="0" data-parsoid="{}">
32787 <!-- this is a comment, presumably significant to editors -->
32788 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32789 <p>a</p>
32790
32791 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
32792 <p>b</p>
32793 </section>
32794 !! end
32795
32796 !! test
32797 Pseudo-sections emitted by templates should have id -2
32798 !! options
32799 notoc
32800 parsoid={
32801 "wrapSections": true
32802 }
32803 !! wikitext
32804 foo
32805 {{echo|<div>
32806 ==a==
32807 ==b==
32808 </div>
32809 }}
32810 !! html/php+tidy
32811 <p>foo
32812 </p>
32813 <div>
32814 <h2><span class="mw-headline" id="a">a</span></h2>
32815 <h2><span class="mw-headline" id="b">b</span></h2>
32816 </div>
32817 !! html/parsoid
32818 <section data-mw-section-id="-1"><p>foo</p>
32819 </section><section data-mw-section-id="-2"><div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>\n==a==\n==b==\n&lt;/div>\n"}},"i":0}}]}'>
32820 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32821 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32822 </section></div><span about="#mwt1">
32823 </span></section>
32824 !! end
32825
32826 !! test
32827 T213468: Transcluded sections don't get PHP section numbers
32828 !! options
32829 notoc
32830 parsoid={
32831 "wrapSections": true
32832 }
32833 !! wikitext
32834 ==PHP section=1==
32835 {{echo|1=
32836 == This is counted as if it were section 2 ==
32837 }}
32838 ==PHP section=3==
32839 !! html/php+tidy
32840 <h2><span class="mw-headline" id="PHP_section.3D1">PHP 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: PHP section=1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32841 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_2">This is counted as if it were section 2</span></h2>
32842 <h2><span class="mw-headline" id="PHP_section.3D3">PHP 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: PHP section=3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32843 !! html/parsoid
32844 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="PHP_section=1" data-parsoid="{}"><span id="PHP_section.3D1" typeof="mw:FallbackId"></span>PHP section=1</h2>
32845 </section><section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="This_is_counted_as_if_it_were_section_2" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"== This is counted as if it were section 2 =="}},"i":0}}]}'>This is counted as if it were section 2</h2>
32846 </section><section data-mw-section-id="3"><h2 id="PHP_section=3" data-parsoid="{}"><span id="PHP_section.3D3" typeof="mw:FallbackId"></span>PHP section=3</h2></section>
32847 !! end
32848
32849 !! test
32850 T213468: Corner cases in edit section ID assignment in tokenizer
32851 !! options
32852 notoc
32853 parsoid={
32854 "wrapSections": true
32855 }
32856 !! wikitext
32857 ==PHP section=1==
32858 {{echo|Not a section|
32859 == This is counted as if it were section 2 ==
32860 }}
32861 ==PHP section=3==
32862 {{echo3|1=
32863 == This is counted as if it were section 4 ==
32864 }}
32865 ==PHP section=5==
32866 {{#tag:p|Not a section|data-ignored=
32867 == This is counted as if it were section 6 ==
32868 }}
32869 ==PHP section=7==
32870 {{echo|1=Not a ==heading==}}
32871 ==PHP section=8==
32872 [[File:Foobar.jpg|thumb|
32873 ==This is section 9, even though it's in a caption==
32874 ]]
32875 ==PHP section=10==
32876 !! html/php+tidy
32877
32878 <h2><span class="mw-headline" id="PHP_section.3D1">PHP 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: PHP section=1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32879 <p>Not a section
32880 </p>
32881 <h2><span class="mw-headline" id="PHP_section.3D3">PHP 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: PHP section=3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32882 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_4">This is counted as if it were section 4</span></h2>
32883 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_4_2">This is counted as if it were section 4</span></h2>
32884 <h2><span class="mw-headline" id="This_is_counted_as_if_it_were_section_4_3">This is counted as if it were section 4</span></h2>
32885 <h2><span class="mw-headline" id="PHP_section.3D5">PHP 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: PHP section=5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32886 <p data-ignored="== This is counted as if it were section 6 ==">Not a section</p>
32887 <h2><span class="mw-headline" id="PHP_section.3D7">PHP section=7</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: PHP section=7">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32888 <p>Not a ==heading==
32889 </p>
32890 <h2><span class="mw-headline" id="PHP_section.3D8">PHP section=8</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: PHP section=8">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32891 <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" decoding="async" 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><h2><span class="mw-headline" id="This_is_section_9.2C_even_though_it.27s_in_a_caption">This is section 9, even though it's in a caption</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: This is section 9, even though it&#039;s in a caption">edit</a><span class="mw-editsection-bracket">]</span></span></h2></div></div></div>
32892 <h2><span class="mw-headline" id="PHP_section.3D10">PHP section=10</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: PHP section=10">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32893 !! html/parsoid
32894 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h2 id="PHP_section=1" data-parsoid="{}"><span id="PHP_section.3D1" typeof="mw:FallbackId"></span>PHP section=1</h2>
32895 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Not a section"},"2":{"wt":"\n== This is counted as if it were section 2 ==\n"}},"i":0}}]}'>Not a section</p>
32896 </section><section data-mw-section-id="3"><h2 id="PHP_section=3" data-parsoid="{}"><span id="PHP_section.3D3" typeof="mw:FallbackId"></span>PHP section=3</h2>
32897 </section><section data-mw-section-id="-1" about="#mwt5" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"echo3","href":"./Template:Echo3"},"params":{"1":{"wt":"== This is counted as if it were section 4 =="}},"i":0}},"\n"]}'><h2 about="#mwt2" typeof="mw:Transclusion" id="This_is_counted_as_if_it_were_section_4" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo3","href":"./Template:Echo3"},"params":{"1":{"wt":"== This is counted as if it were section 4 =="}},"i":0}}]}'>This is counted as if it were section 4</h2><span about="#mwt2">
32898 </span></section><section data-mw-section-id="-1" about="#mwt5"><h2 about="#mwt2" id="This_is_counted_as_if_it_were_section_4_2">This is counted as if it were section 4</h2><span about="#mwt2">
32899 </span></section><section data-mw-section-id="-1" about="#mwt5"><h2 about="#mwt2" id="This_is_counted_as_if_it_were_section_4_3">This is counted as if it were section 4</h2>
32900 </section><section data-mw-section-id="5"><h2 id="PHP_section=5" data-parsoid="{}"><span id="PHP_section.3D5" typeof="mw:FallbackId"></span>PHP section=5</h2>
32901 <p data-ignored=" This is counted as if it were section 6 " about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"data-ignored","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:p","function":"tag"},"params":{"1":{"wt":"Not a section"},"data-ignored":{"wt":"== This is counted as if it were section 6 =="}},"i":0}}]}'>Not a section</p>
32902 </section><section data-mw-section-id="7"><h2 id="PHP_section=7" data-parsoid="{}"><span id="PHP_section.3D7" typeof="mw:FallbackId"></span>PHP section=7</h2>
32903 <p about="#mwt4" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Not a ==heading=="}},"i":0}}]}'>Not a ==heading==</p>
32904 </section><section data-mw-section-id="8"><h2 id="PHP_section=8" data-parsoid="{}"><span id="PHP_section.3D8" typeof="mw:FallbackId"></span>PHP section=8</h2>
32905 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n== This is counted as if it were section 9 ==\n"}]}'><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>
32906 <section data-mw-section-id="-1"><h2 id="This_is_section_9,_even_though_it's_in_a_caption" data-parsoid="{}"><span id="This_is_section_9.2C_even_though_it.27s_in_a_caption" typeof="mw:FallbackId"></span>This is section 9, even though it's in a caption</h2>
32907 </section></figcaption></figure>
32908 </section><section data-mw-section-id="10"><h2 id="PHP_section=10" data-parsoid="{}"><span id="PHP_section.3D10" typeof="mw:FallbackId" data-parsoid='{"dsr":[412,412]}'></span>PHP section=10</h2></section>
32909 !! end
32910
32911 !! test
32912 T215628: Section numbering and <includeonly> and <noinclude> on a page
32913 !! options
32914 notoc
32915 parsoid={
32916 "wrapSections": true
32917 }
32918 !! wikitext
32919 ==PHP section=1==
32920 <noinclude>
32921 ==PHP section=2==
32922 </noinclude>
32923 ==PHP section=3==
32924 <includeonly>
32925 ==This is not counted as section 4==
32926 </includeonly>
32927 ==PHP section=4==
32928 !! html/php+tidy
32929
32930 <h2><span class="mw-headline" id="PHP_section.3D1">PHP 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: PHP section=1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32931 <h2><span class="mw-headline" id="PHP_section.3D2">PHP 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: PHP section=2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32932 <h2><span class="mw-headline" id="PHP_section.3D3">PHP 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: PHP section=3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32933 <h2><span class="mw-headline" id="PHP_section.3D4">PHP 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: PHP section=4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32934 !! html/parsoid
32935 PARSOID HAS A BUG HERE: T215628
32936 !! end
32937
32938 ##########################################################################
32939 Tests demonstrating white-space insensitivity in input wikitext
32940 for wikitext headings, wikitext list items, and wikitext table captions,
32941 headings, and cells. HTML versions of the same should preserve whitespace.
32942 ##########################################################################
32943 !! test
32944 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32945 !! options
32946 parsoid={
32947 "modes": ["wt2html"],
32948 "preserveIEW": true
32949 }
32950 !! wikitext
32951 __NOTOC__
32952 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32953 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32954 == <!--Headings with fallback ids--> Личная жизнь ==
32955 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32956 ; <!--term to define--> term : <!--term's definition--> definition
32957 {|
32958 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32959 |-
32960 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32961 |-
32962 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32963 |-
32964 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32965 |-
32966 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32967 |}
32968 : {|
32969 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32970 |} foo <!--c1-->
32971 !! html/php+tidy
32972 <h2><span class="mw-headline" id="Spaces">Spaces</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: Spaces">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32973 <h2><span class="mw-headline" id="Tabs">Tabs</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: Tabs">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32974 <h2><span class="mw-headline" id=".D0.9B.D0.B8.D1.87.D0.BD.D0.B0.D1.8F_.D0.B6.D0.B8.D0.B7.D0.BD.D1.8C">Личная жизнь</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: Личная жизнь">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
32975 <ul><li>List item</li></ul>
32976 <dl><dt>term&#160;</dt>
32977 <dd>definition</dd></dl>
32978 <table>
32979 <caption>Table Caption
32980 </caption>
32981 <tbody><tr>
32982 <th>Table Heading 1</th>
32983 <th>Table Heading 2
32984 </th></tr>
32985 <tr>
32986 <td>Table Cell 1</td>
32987 <td>Table Cell 2
32988 </td></tr>
32989 <tr>
32990 <td>class="foo"</td>
32991 <td>Table Cell 3
32992 </td></tr>
32993 <tr>
32994 <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | some content
32995 </td></tr></tbody></table>
32996 <dl><dd><table>
32997 <tbody><tr>
32998 <td>Table Cell 1</td>
32999 <td>Table Cell 2
33000 </td></tr></tbody></table> foo</dd></dl>
33001 !! html/parsoid
33002 <meta property="mw:PageProp/notoc">
33003 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
33004 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
33005 <h2 id="Личная_жизнь"><span id=".D0.9B.D0.B8.D1.87.D0.BD.D0.B0.D1.8F_.D0.B6.D0.B8.D0.B7.D0.BD.D1.8C" typeof="mw:FallbackId"></span><!--Headings with fallback ids-->Личная жизнь</h2>
33006 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
33007 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
33008 <table>
33009 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
33010 <tbody><tr>
33011 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
33012 <tr>
33013 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
33014 <tr>
33015 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
33016 <tr>
33017 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
33018 </tbody></table>
33019 <dl><dd><table>
33020 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
33021 </tbody></table> foo<!--c1--></dd></dl>
33022 !! end
33023
33024 # Looks like <caption> is not accepted in HTML
33025 !! test
33026 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
33027 !! options
33028 parsoid={
33029 "modes": ["wt2html"],
33030 "preserveIEW": true
33031 }
33032 !! wikitext
33033 __NOTOC__
33034 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
33035 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
33036 <table>
33037 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
33038 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
33039 </table>
33040 !! html/php+tidy
33041 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
33042 <ul><li> List item </li></ul>
33043 <table>
33044 <tbody><tr><th> Table Heading </th><th></th></tr>
33045 <tr><td> Table Cell </td><th></th></tr>
33046 </tbody></table>
33047 !! html/parsoid
33048 <meta property="mw:PageProp/notoc"/>
33049 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
33050 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
33051 <table>
33052 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
33053 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
33054 </tbody></table>
33055 !! end
33056
33057 !! test
33058 Do not trim whitespace in links and quotes
33059 !! options
33060 parsoid={
33061 "modes": ["wt2html"],
33062 "preserveIEW": true
33063 }
33064 !! wikitext
33065 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
33066 [[Foo| some text ]]
33067 !! html/php+tidy
33068 <p>foo <i> italic </i> and <b> bold </b>
33069 <a href="/wiki/Foo" title="Foo"> some text </a>
33070 </p>
33071 !! html/parsoid
33072 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
33073 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
33074 !! end
33075
33076 !! test
33077 Remove p tags surrounding a single element in a figcaption
33078 !! options
33079 parsoid=html2wt
33080 !! wikitext
33081 [[File:Foobar.jpg|right|200x200px|Caption]]
33082 !! html/parsoid
33083 <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><p>Caption</p></figcaption></figure>
33084 !! end
33085
33086 !! test
33087 Selser preserves lack of newline before list and allows newline after the list
33088 !! options
33089 parsoid={
33090 "modes": ["selser"],
33091 "scrubWikitext": true,
33092 "changes": [
33093 [ "ul", "after", "<p>footer</p>" ]
33094 ]
33095 }
33096 !! wikitext
33097 header
33098 *foo
33099 *bar
33100 !! wikitext/edited
33101 header
33102 *foo
33103 *bar
33104
33105 footer
33106 !! end
33107
33108
33109 !! test
33110 Selser does not introduce newlines between unedited paragraph preceding the list
33111 !! options
33112 parsoid={
33113 "modes": ["selser"],
33114 "changes": [
33115 [ "table tbody tr td p:last-child", "empty" ]
33116 ]
33117 }
33118 !! wikitext
33119 {|
33120 |
33121 header
33122 *foo
33123 *bar
33124 footer
33125 |}
33126 !! wikitext/edited
33127 {|
33128 |
33129 header
33130 *foo
33131 *bar
33132
33133 |}
33134 !! end
33135
33136 !! test
33137 Selser does not introduce newlines between unedited paragraph following the list
33138 !! options
33139 parsoid={
33140 "modes": ["selser"],
33141 "changes": [
33142 [ "table tbody tr td p:first-child", "empty" ]
33143 ]
33144 }
33145 !! wikitext
33146 {|
33147 |
33148 header
33149 *foo
33150 *bar
33151 footer
33152 |}
33153 !! wikitext/edited
33154 {|
33155 |
33156
33157 *foo
33158 *bar
33159 footer
33160 |}
33161 !! end
33162
33163 !! test
33164 Remove a list item but do not insert newline above list
33165 !! options
33166 parsoid={
33167 "modes": ["selser"],
33168 "changes": [
33169 [ "ul li:last-child", "remove" ]
33170 ]
33171 }
33172 !! wikitext
33173 header
33174 *foo
33175 *bar
33176 footer
33177 !! wikitext/edited
33178 header
33179 *foo
33180 footer
33181 !! end
33182
33183 !! test
33184 Ensure disambiguation links are marked properly
33185 !! options
33186 parsoid=wt2html
33187 !! wikitext
33188 [[Disambiguation]]
33189 !! html/parsoid
33190 <p><a rel="mw:WikiLink" href="./Disambiguation" title="Disambiguation" class="mw-disambig">Disambiguation</a></p>
33191 !! end