Merge "ApiFeedContributions: Drop 'newbies' feature"
[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" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
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" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" 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" class="external text" href="http://example.org/index.php?title=Parser_test&amp;action=edit" typeof="mw:Transclusion" 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" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
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 whitelist:
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" class="external autonumber" href="http://example.com"></a>
4832 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
4833 Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></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" class="external autonumber" href="http://example.com/1$2345"></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" class="external free" href="http://example.com/1">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" class="external text" href="http://example.com/1">[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" class="external autonumber" href="//example.com"></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" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></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" class="external free" href="http://example.com">http://example.com</a>,
5047 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
5048 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
5049 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
5050 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
5051 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
5052 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
5053 <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
5054 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
5055 (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
5056 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5057 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5058 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
5059 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
5060 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
5061 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
5062 <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">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" class="external free" href="http://example.com/url_with_entity">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" class="external free" href="http://example.com/url_with_entity">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" class="external free" href="http://example.com/url_with_entity&amp;amp">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" class="external free" href="news:'a'b">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" class="external text" href="http://+www.librarieswithoutborders.org" 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" class="external text" href="http://example.com">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" class="external text" href="http://example.com"><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" class="external free" href="http://x&amp;y">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" class="external free" href="http://example.com/?foo=bar">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" class="external autonumber" href="http://x&amp;y"></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" class="external autonumber" href="http://x&amp;y"></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" class="external autonumber" href="http://example.com/?foo=bar"></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" class="external autonumber" href="http://example.com/?foo=bar"></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" class="external autonumber" href="http://example.com/"></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" class="external free" href="http://example.com/">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" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></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" class="external free" href="http://www.example.com/" 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" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5516 <p><a rel="mw:ExtLink" class="external text" href="http://example.com">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" class="external free" href="http://example.com">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" class="external free" href="http://example.com">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 !! test
5599 T4702: Mismatched <i>, <b> and <a> tags are invalid
5600 !! wikitext
5601 ''[http://example.com text'']
5602 [http://example.com '''text]'''
5603 ''Something [http://example.com in italic'']
5604 ''Something [http://example.com mixed''''', even bold]'''
5605 '''''Now [http://example.com both''''']
5606 !! html
5607 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5608 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5609 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5610 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5611 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5612 </p>
5613 !! end
5614
5615
5616 !! test
5617 T6781: %26 in URL
5618 !! wikitext
5619 http://www.example.com/?title=AT%26T
5620 !! html/php
5621 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5622 </p>
5623 !! html/parsoid
5624 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5625 !! end
5626
5627 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5628 # % is actually legal in HTML5. Any change in output would need testing though.
5629 !! test
5630 T6781, T7267: %25 in URL
5631 !! wikitext
5632 http://www.example.com/?title=100%25_Bran
5633 !! html/php
5634 <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>
5635 </p>
5636 !! html/parsoid
5637 <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5638 !! end
5639
5640 !! test
5641 T6781, T7267: %28, %29 in URL
5642 !! wikitext
5643 http://www.example.com/?title=Ben-Hur_%281959_film%29
5644 !! html/php
5645 <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>
5646 </p>
5647 !! html/parsoid
5648 <p><a rel="mw:ExtLink" 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></p>
5649 !! end
5650
5651
5652 !! test
5653 T6781: %26 in autonumber URL
5654 !! wikitext
5655 [http://www.example.com/?title=AT%26T]
5656 !! html/php
5657 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5658 </p>
5659 !! html/parsoid
5660 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
5661 !! end
5662
5663 !! test
5664 T6781, T7267: %26 in autonumber URL
5665 !! wikitext
5666 [http://www.example.com/?title=100%25_Bran]
5667 !! html/php
5668 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5669 </p>
5670 !! html/parsoid
5671 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
5672 !! end
5673
5674 !! test
5675 T6781, T7267: %28, %29 in autonumber URL
5676 !! wikitext
5677 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5678 !! html/php
5679 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5680 </p>
5681 !! html/parsoid
5682 <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5683 !! end
5684
5685
5686 !! test
5687 T6781: %26 in bracketed URL
5688 !! wikitext
5689 [http://www.example.com/?title=AT%26T link]
5690 !! html/php
5691 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5692 </p>
5693 !! html/parsoid
5694 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
5695 !! end
5696
5697 !! test
5698 T6781, T7267: %25 in bracketed URL
5699 !! wikitext
5700 [http://www.example.com/?title=100%25_Bran link]
5701 !! html
5702 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5703 </p>
5704 !! end
5705
5706 !! test
5707 T6781, T7267: %28, %29 in bracketed URL
5708 !! wikitext
5709 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5710 !! html/php
5711 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5712 </p>
5713 !! html/parsoid
5714 <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5715 !! end
5716
5717 !! test
5718 External link containing a period in the anchor. (T65947)
5719 !! wikitext
5720 [//foo.org/bar#baz. bang]
5721
5722 [//foo.org/bar. bang]
5723 !! html/php
5724 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5725 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5726 </p>
5727 !! html/parsoid
5728 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
5729 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
5730 !! end
5731
5732 !! test
5733 External link containing a single quote. (T65947)
5734 !! wikitext
5735 [//foo.org/bar'baz]
5736
5737 [//foo.org/bar'baz bang]
5738 !! html/php
5739 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
5740 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
5741 </p>
5742 !! html/parsoid
5743 <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
5744 <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
5745 !! end
5746
5747 !! test
5748 External link containing double-single-quotes in text '' (T6598 sanity check)
5749 !! wikitext
5750 Some [http://example.com/ pretty ''italics'' and stuff]!
5751 !! html
5752 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5753 </p>
5754 !! end
5755
5756 !! test
5757 External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
5758 !! wikitext
5759 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5760 !! html
5761 <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>
5762 </p>
5763 !! end
5764
5765 # Don't add the html/php section since the output is broken and there isn't any reason to spec it
5766 !! test
5767 External link containing double-single-quotes with no space separating the url from text in italics
5768 !! wikitext
5769 [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]].]
5770 !! html/php+tidy
5771 <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>.
5772 </p>
5773 !! html/parsoid
5774 <p><a rel="mw:ExtLink" 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 rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5775 !! end
5776
5777 !! test
5778 External link with comments in link text
5779 !! wikitext
5780 [http://www.google.com Google <!-- comment -->]
5781 !! html/php
5782 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5783 </p>
5784 !! html/parsoid
5785 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
5786 !! end
5787
5788 !! test
5789 External link to bare IPv4 address
5790 !! wikitext
5791 [http://192.168.0.1 Link]
5792 !! html/php
5793 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5794 </p>
5795 !! html/parsoid
5796 <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
5797 !! end
5798
5799 !! test
5800 URL-encoding in URL functions (single parameter)
5801 !! wikitext
5802 {{localurl:Some page|amp=&}}
5803 !! html
5804 <p>/index.php?title=Some_page&amp;amp=&amp;
5805 </p>
5806 !! end
5807
5808 !! test
5809 URL-encoding in URL functions (multiple parameters)
5810 !! wikitext
5811 {{localurl:Some page|q=?&amp=&}}
5812 !! html
5813 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5814 </p>
5815 !! end
5816
5817 !! test
5818 Brackets in urls
5819 !! wikitext
5820 http://example.com/index.php?foozoid%5B%5D=bar
5821
5822 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5823 !! html/php
5824 <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>
5825 </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>
5826 </p>
5827 !! html/parsoid
5828 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5829
5830 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" 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>
5831 !! end
5832
5833 !! test
5834 IPv6 urls, autolink format (T23261)
5835 !! wikitext
5836 http://[2404:130:0:1000::187:2]/index.php
5837
5838 Examples from RFC 2373, section 2.2:
5839
5840 *http://[1080::8:800:200C:417A]/unicast
5841 *http://[FF01::101]/multicast
5842 *http://[::1]/loopback
5843 *http://[::]/unspecified
5844 *http://[::13.1.68.3]/ipv4compat
5845 *http://[::FFFF:129.144.52.38]/ipv4compat
5846
5847 Examples from RFC 2732, section 2:
5848
5849 *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5850 *http://[1080:0:0:0:8:800:200C:417A]/index.html
5851 *http://[3ffe:2a00:100:7031::1]
5852 *http://[1080::8:800:200C:417A]/foo
5853 *http://[::192.9.5.5]/ipng
5854 *http://[::FFFF:129.144.52.38]:80/index.html
5855 *http://[2010:836B:4179::836B:4179]
5856 !! html/php
5857 <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>
5858 </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:
5859 </p>
5860 <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>
5861 <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5862 <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5863 <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5864 <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5865 <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>
5866 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5867 </p>
5868 <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>
5869 <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>
5870 <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5871 <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5872 <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5873 <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>
5874 <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5875 !! html/parsoid
5876 <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5877
5878 <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>
5879 <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5880 <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5881 <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5882 <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5883 <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5884 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5885
5886 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5887 <ul><li><a rel="mw:ExtLink" 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>
5888 <li><a rel="mw:ExtLink" 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>
5889 <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5890 <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5891 <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5892 <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5893 <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5894 !! end
5895
5896 !! test
5897 IPv6 urls, bracketed format (T23261)
5898 !! wikitext
5899 [http://[2404:130:0:1000::187:2]/index.php test]
5900
5901 Examples from RFC 2373, section 2.2:
5902
5903 *[http://[1080::8:800:200C:417A] unicast]
5904 *[http://[FF01::101] multicast]
5905 *[http://[::1]/ loopback]
5906 *[http://[::] unspecified]
5907 *[http://[::13.1.68.3] ipv4compat]
5908 *[http://[::FFFF:129.144.52.38] ipv4compat]
5909
5910 Examples from RFC 2732, section 2:
5911
5912 *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5913 *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5914 *[http://[3ffe:2a00:100:7031::1] 3]
5915 *[http://[1080::8:800:200C:417A]/foo 4]
5916 *[http://[::192.9.5.5]/ipng 5]
5917 *[http://[::FFFF:129.144.52.38]:80/index.html 6]
5918 *[http://[2010:836B:4179::836B:4179] 7]
5919 !! html/php
5920 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5921 </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:
5922 </p>
5923 <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5924 <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5925 <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5926 <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5927 <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5928 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5929 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5930 </p>
5931 <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5932 <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5933 <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5934 <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5935 <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5936 <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5937 <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5938 !! html/parsoid
5939 <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5940
5941 <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>
5942 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5943 <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
5944 <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
5945 <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
5946 <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5947 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5948
5949 <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external mw-magiclink">RFC 2732</a>, section 2:</p>
5950 <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5951 <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5952 <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5953 <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5954 <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5955 <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5956 <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5957 !! end
5958
5959 !! test
5960 Non-extlinks in brackets
5961 !! wikitext
5962 [foo]
5963 [foo bar]
5964 [foo ''bar'']
5965 [fool's] errand
5966 [fool's errand]
5967 [{{echo|foo}}]
5968 [{{echo|foo}} bar]
5969 [{{echo|foo}} ''bar'']
5970 [{{echo|foo}}l's] errand
5971 [{{echo|foo}}l's errand]
5972 [url={{echo|foo}}]
5973 [url=http://example.com]
5974 [http:// bare protocols don't count]
5975 !! html/php
5976 <p>[foo]
5977 [foo bar]
5978 [foo <i>bar</i>]
5979 [fool's] errand
5980 [fool's errand]
5981 [foo]
5982 [foo bar]
5983 [foo <i>bar</i>]
5984 [fool's] errand
5985 [fool's errand]
5986 [url=foo]
5987 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5988 [http:// bare protocols don't count]
5989 </p>
5990 !! html/parsoid
5991 <p>[foo]
5992 [foo bar]
5993 [foo <i>bar</i>]
5994 [fool's] errand
5995 [fool's errand]
5996 [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
5997 [<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]
5998 [<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>]
5999 [<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
6000 [<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]
6001 [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>]
6002 [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
6003 [http:// bare protocols don't count]</p>
6004 !! end
6005
6006 !! test
6007 Percent encoding in external links
6008 !! wikitext
6009 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
6010 !! html/php
6011 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
6012 </p>
6013 !! html/parsoid
6014 <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
6015 !! end
6016
6017 !! test
6018 Use url link syntax for links where the content is equal the link target
6019 !! wikitext
6020 http://example.com
6021 !! html/php
6022 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
6023 </p>
6024 !! html/parsoid
6025 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
6026 !! end
6027
6028 !! test
6029 Parenthesis in external links, especially URL links
6030 !! wikitext
6031 http://example.com)
6032
6033 http://example.com/test)
6034
6035 http://example.com/(test)
6036
6037 http://example.com/((test)
6038
6039 (http://example.com/(test))
6040
6041 (http://example.com/(test)))))
6042
6043 http://example.com/a)b
6044
6045 [http://example.com) foo]
6046 !! html/php
6047 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6048 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
6049 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
6050 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
6051 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
6052 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
6053 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
6054 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
6055 </p>
6056 !! html/parsoid
6057 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
6058 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
6059 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
6060 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
6061 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
6062 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
6063 <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
6064 <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
6065 !! end
6066
6067 !! test
6068 Parenthesis in external links, w/ transclusion or comment
6069 !! wikitext
6070 (http://example.com/{{echo|hi}})
6071
6072 (http://example.com<!-- hi -->)
6073 !! html/php
6074 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
6075 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
6076 </p>
6077 !! html/parsoid
6078 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#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>
6079
6080 <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
6081 !! end
6082
6083 !! test
6084 Serialize <a> tags with invalid link targets as plain text
6085 !! options
6086 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
6087 !! html/parsoid
6088 <a rel="mw:WikiLink" href="[[foo]]">text</a>
6089 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
6090 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
6091 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
6092 !! wikitext
6093 text
6094 <nowiki>*</nowiki>text
6095 <nowiki>[[foo]]</nowiki>
6096 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
6097 !! end
6098
6099 !! test
6100 mw:ExtLink -vs- mw:WikiLink (T94723)
6101 !! options
6102 parsoid=html2wt
6103 !! html/parsoid
6104 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
6105 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
6106 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6107 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
6108 <p>
6109 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6110 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
6111 </p>
6112 !! wikitext
6113 [[Foo|Bar]]
6114 [[Foo|Bar]]
6115 [[:en:Foo|Bar]]
6116 [[:en:Foo|Bar]]
6117
6118 [[:en:European_Robin|European Robin]]
6119 [[:en:European_Robin|European Robin]]
6120 !! end
6121
6122 !! test
6123 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
6124 !! options
6125 parsoid=wt2wt
6126 !! wikitext
6127 [http://en.wikipedia.org/wiki/European_Robin European Robin]
6128 !! html/parsoid
6129 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
6130 !! end
6131
6132
6133 ###
6134 ### Quotes
6135 ###
6136
6137 !! test
6138 Quotes
6139 !! wikitext
6140 Normal text. '''Bold text.''' Normal text. ''Italic text.''
6141
6142 Normal text. '''''Bold italic text.''''' Normal text.
6143 !! html
6144 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
6145 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
6146 </p>
6147 !! end
6148
6149 !! test
6150 Quotes wrapping HTML table
6151 !! wikitext
6152 '''<table><tr><td>hi</td></tr></table>'''
6153 !! html/php+tidy
6154 <b><table><tbody><tr><td>hi</td></tr></tbody></table></b>
6155 !! html/parsoid
6156 <b><table data-parsoid='{"stx":"html"}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>hi</td></tr></tbody></table></b>
6157 !! end
6158
6159 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
6160 # parser strips. The wikitext contains just the first half of the bold
6161 # quote pair.
6162 !! test
6163 Unclosed and unmatched quotes
6164 !! wikitext
6165 '''''Bold italic text '''with bold deactivated''' in between.'''''
6166
6167 '''''Bold italic text ''with italic deactivated'' in between.'''''
6168
6169 '''Bold text..
6170
6171 ..spanning two paragraphs (should not work).'''
6172
6173 '''Bold tag left open
6174
6175 ''Italic tag left open
6176
6177 Normal text.
6178
6179 <!-- Unmatching number of opening, closing tags: -->
6180 '''This year''''s election ''should'' beat '''last year''''s.
6181
6182 ''Tom'''s car is bigger than ''Susan'''s.
6183
6184 Plain ''italic'''s plain
6185 !! html/php
6186 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6187 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6188 </p><p><b>Bold text..</b>
6189 </p><p>..spanning two paragraphs (should not work).
6190 </p><p><b>Bold tag left open</b>
6191 </p><p><i>Italic tag left open</i>
6192 </p><p>Normal text.
6193 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6194 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6195 </p><p>Plain <i>italic'</i>s plain
6196 </p>
6197 !! html/parsoid
6198 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
6199 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
6200 </p><p><b>Bold text..</b>
6201 </p><p>..spanning two paragraphs (should not work).<b></b>
6202 </p><p><b>Bold tag left open</b>
6203 </p><p><i>Italic tag left open</i>
6204 </p><p>Normal text.
6205 </p>
6206 <!-- Unmatching number of opening, closing tags: -->
6207 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
6208 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
6209 </p><p>Plain <i>italic'</i>s plain
6210 </p>
6211 !! end
6212
6213 ###
6214 ### Tables
6215 ###
6216 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
6217 ###
6218
6219 # This should not produce <table></table> as <table><tr><td></td></tr></table>
6220 # is the bare minimum required by the spec, see:
6221 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
6222 # Parsoid team replies: empty table tags are legal in HTML5
6223 !! test
6224 A table with no data.
6225 !! options
6226 parsoid=wt2html
6227 !! wikitext
6228 {||}
6229 !! html/php
6230 !! html/parsoid
6231 <table></table>
6232 !! end
6233
6234 !! test
6235 A table with stray table end tags on start tag line (wt2html)
6236 !! options
6237 parsoid=wt2html
6238 !! wikitext
6239 {|style="color: red;"|}
6240
6241 {|style="color: red;" |}
6242 |foo
6243 |}
6244
6245 {|style="color: red;"|} id="foo"
6246 |foo
6247 |}
6248
6249 {|style="color: red;" |} id="foo"
6250 |foo
6251 |}
6252 !! html/php+tidy
6253 <table style="color: red;">
6254
6255 </table><table style="color: red;">
6256 <tbody><tr>
6257 <td>foo
6258 </td></tr></tbody></table>
6259 <table style="color: red;" id="foo">
6260 <tbody><tr>
6261 <td>foo
6262 </td></tr></tbody></table>
6263 <table style="color: red;" id="foo">
6264 <tbody><tr>
6265 <td>foo
6266 </td></tr></tbody></table>
6267 !! html/parsoid
6268 <table style="color: red;"></table>
6269
6270 <table style="color: red;">
6271 <tbody><tr>
6272 <td>foo</td>
6273 </tr></tbody>
6274 </table>
6275
6276 <table style="color: red;" id="foo">
6277 <tbody><tr>
6278 <td>foo</td>
6279 </tr></tbody>
6280 </table>
6281
6282 <table style="color: red;" id="foo">
6283 <tbody><tr>
6284 <td>foo</td>
6285 </tr></tbody>
6286 </table>
6287 !! end
6288
6289 !! test
6290 A table with no data (take 2)
6291 !! wikitext
6292 {|
6293 |}
6294 !! html/parsoid
6295 <table></table>
6296 !! end
6297
6298 # A table with nothing but a caption is invalid XHTML, we might want to render
6299 # this as <p>caption</p>
6300 # Parsoid team replies: table with only a caption is legal in HTML5
6301 !! test
6302 A table with nothing but a caption
6303 !! wikitext
6304 {|
6305 |+caption
6306 |}
6307 !! html/php
6308 <table>
6309 <caption>caption
6310 </caption><tr><td></td></tr></table>
6311 !! html/parsoid
6312 <table><caption>caption</caption></table>
6313 !! end
6314
6315 !! test
6316 A table with caption with default-spaced attributes and a table row
6317 !! wikitext
6318 {|
6319 |+ style="color: red;" |caption1
6320 |-
6321 |foo
6322 |}
6323 !! html
6324 <table>
6325 <caption style="color: red;">caption1
6326 </caption>
6327 <tr>
6328 <td>foo
6329 </td></tr></table>
6330 !! end
6331
6332 !! test
6333 A table with captions with non-default spaced attributes and a table row
6334 !! wikitext
6335 {|
6336 |+style="color: red;"|caption2
6337 |+ style="color: red;"|caption3
6338 |-
6339 |foo
6340 |}
6341 !! html
6342 <table>
6343 <caption style="color: red;">caption2
6344 </caption>
6345 <caption style="color: red;">caption3
6346 </caption>
6347 <tr>
6348 <td>foo
6349 </td></tr></table>
6350 !! end
6351
6352 !! test
6353 Table td-cell syntax variations
6354 !! wikitext
6355 {|
6356 |foo bar foo|baz
6357 |foo bar foo||baz
6358 |style='color:red;'|baz
6359 |style='color:red;'||baz
6360 |}
6361 !! html
6362 <table>
6363 <tr>
6364 <td>baz
6365 </td>
6366 <td>foo bar foo</td>
6367 <td>baz
6368 </td>
6369 <td style="color:red;">baz
6370 </td>
6371 <td>style='color:red;'</td>
6372 <td>baz
6373 </td></tr></table>
6374 !! end
6375
6376 !! test
6377 Simple table
6378 !! wikitext
6379 {|
6380 |1||2
6381 |-
6382 |3||4
6383 |}
6384 !! html
6385 <table>
6386 <tr>
6387 <td>1</td>
6388 <td>2
6389 </td></tr>
6390 <tr>
6391 <td>3</td>
6392 <td>4
6393 </td></tr></table>
6394 !! end
6395
6396 !! test
6397 Simple table but with multiple dashes for row wikitext
6398 !! wikitext
6399 {|
6400 |foo
6401 |-----
6402 |bar
6403 |}
6404 !! html
6405 <table>
6406 <tr>
6407 <td>foo
6408 </td></tr>
6409 <tr>
6410 <td>bar
6411 </td></tr></table>
6412 !! end
6413
6414 !! test
6415 Multiplication table
6416 !! wikitext
6417 {| border="1" cellpadding="2"
6418 |+Multiplication table
6419 |-
6420 !&times;!!1!!2!!3
6421 |-
6422 !1
6423 |1||2||3
6424 |-
6425 !2
6426 |2||4||6
6427 |-
6428 !3
6429 |3||6||9
6430 |-
6431 !4
6432 |4||8||12
6433 |-
6434 !5
6435 |5||10||15
6436 |}
6437 !! html
6438 <table border="1" cellpadding="2">
6439 <caption>Multiplication table
6440 </caption>
6441 <tr>
6442 <th>&#215;</th>
6443 <th>1</th>
6444 <th>2</th>
6445 <th>3
6446 </th></tr>
6447 <tr>
6448 <th>1
6449 </th>
6450 <td>1</td>
6451 <td>2</td>
6452 <td>3
6453 </td></tr>
6454 <tr>
6455 <th>2
6456 </th>
6457 <td>2</td>
6458 <td>4</td>
6459 <td>6
6460 </td></tr>
6461 <tr>
6462 <th>3
6463 </th>
6464 <td>3</td>
6465 <td>6</td>
6466 <td>9
6467 </td></tr>
6468 <tr>
6469 <th>4
6470 </th>
6471 <td>4</td>
6472 <td>8</td>
6473 <td>12
6474 </td></tr>
6475 <tr>
6476 <th>5
6477 </th>
6478 <td>5</td>
6479 <td>10</td>
6480 <td>15
6481 </td></tr></table>
6482 !! end
6483
6484 !! test
6485 Accept "||" in table headings
6486 !! wikitext
6487 {|
6488 !h1||h2
6489 |}
6490 !! html
6491 <table>
6492 <tr>
6493 <th>h1</th>
6494 <th>h2
6495 </th></tr></table>
6496 !! end
6497
6498 !! test
6499 Accept "!!" in table data
6500 !! wikitext
6501 {|
6502 |Foo!!||
6503 |}
6504 !! html
6505 <table>
6506 <tr>
6507 <td>Foo!!</td>
6508 <td>
6509 </td></tr></table>
6510 !! html/parsoid
6511 <table>
6512 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
6513 </tbody></table>
6514 !! end
6515
6516 !! test
6517 Accept "||" in indented table headings
6518 !! wikitext
6519 :{|
6520 !h1||h2
6521 |}
6522 !! html
6523 <dl><dd><table>
6524 <tr>
6525 <th>h1</th>
6526 <th>h2
6527 </th></tr></table></dd></dl>
6528 !! end
6529
6530 !! test
6531 Accept "!!" in templates
6532 !! wikitext
6533 {|
6534 !a {{echo|b!!c}}
6535 |}
6536 !! html/php
6537 <table>
6538 <tr>
6539 <th>a b</th>
6540 <th>c
6541 </th></tr></table>
6542 !! html/parsoid
6543 <table>
6544 <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>
6545 !! end
6546
6547 !! test
6548 Accept "!!" in table headings after newline
6549 !! wikitext
6550 {|
6551 !a
6552 b!!c
6553 |}
6554 !! html/php
6555 <table>
6556 <tr>
6557 <th>a
6558 <p>b!!c
6559 </p>
6560 </th></tr></table>
6561 !! html/parsoid
6562 <table>
6563 <tbody><tr><th>a
6564 <p>b!!c</p></th></tr>
6565 </tbody></table>
6566 !! end
6567
6568 !! test
6569 Accept "!!" in table data of mixed wikitext / html syntax
6570 !! wikitext
6571 {|
6572 !a
6573 <tr><td>b!!c</td></tr>
6574 |}
6575 !! html/php+tidy
6576 <table>
6577 <tbody><tr>
6578 <th>a
6579 </th></tr><tr><td>b!!c</td></tr>
6580 </tbody></table>
6581 !! html/parsoid
6582 <table>
6583 <tbody><tr><th>a</th></tr>
6584 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6585 </tbody></table>
6586 !! end
6587
6588 !! test
6589 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6590 !! wikitext
6591 {|
6592 !|h1
6593 ||a
6594 |}
6595 !! html
6596 <table>
6597 <tr>
6598 <th>h1
6599 </th>
6600 <td>a
6601 </td></tr></table>
6602 !! end
6603
6604 !!test
6605 Accept "| !" at start of line in tables (ignore !-attribute)
6606 !! wikitext
6607 {|
6608 |-
6609 |!style="color:red"|bar
6610 |}
6611 !! html
6612 <table>
6613
6614 <tr>
6615 <td>bar
6616 </td></tr></table>
6617 !!end
6618
6619 !!test
6620 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 +/-
6621 !! wikitext
6622 {|
6623 |-
6624 |style='color:red;'|+1
6625 |style='color:blue;'|-1
6626 |-
6627 |1||2||3
6628 |1||+2||-3
6629 |-
6630 | +1
6631 | -1
6632 |}
6633 !! html
6634 <table>
6635
6636 <tr>
6637 <td style="color:red;">+1
6638 </td>
6639 <td style="color:blue;">-1
6640 </td></tr>
6641 <tr>
6642 <td>1</td>
6643 <td>2</td>
6644 <td>3
6645 </td>
6646 <td>1</td>
6647 <td>+2</td>
6648 <td>-3
6649 </td></tr>
6650 <tr>
6651 <td>+1
6652 </td>
6653 <td>-1
6654 </td></tr></table>
6655 !!end
6656
6657 !! test
6658 Table rowspan
6659 !! wikitext
6660 {| border=1
6661 |Cell 1, row 1
6662 |rowspan=2|Cell 2, row 1 (and 2)
6663 |Cell 3, row 1
6664 |-
6665 |Cell 1, row 2
6666 |Cell 3, row 2
6667 |}
6668 !! html
6669 <table border="1">
6670 <tr>
6671 <td>Cell 1, row 1
6672 </td>
6673 <td rowspan="2">Cell 2, row 1 (and 2)
6674 </td>
6675 <td>Cell 3, row 1
6676 </td></tr>
6677 <tr>
6678 <td>Cell 1, row 2
6679 </td>
6680 <td>Cell 3, row 2
6681 </td></tr></table>
6682 !! end
6683
6684 !! test
6685 Nested table
6686 !! wikitext
6687 {| border=1
6688 | &alpha;
6689 |
6690 {| bgcolor=#ABCDEF border=2
6691 |nested
6692 |-
6693 |table
6694 |}
6695 |the original table again
6696 |}
6697 !! html
6698 <table border="1">
6699 <tr>
6700 <td>&#945;
6701 </td>
6702 <td>
6703 <table bgcolor="#ABCDEF" border="2">
6704 <tr>
6705 <td>nested
6706 </td></tr>
6707 <tr>
6708 <td>table
6709 </td></tr></table>
6710 </td>
6711 <td>the original table again
6712 </td></tr></table>
6713 !! end
6714
6715 !! test
6716 Invalid attributes in table cell (T3830)
6717 !! wikitext
6718 {|
6719 |Cell:|broken
6720 |}
6721 !! html
6722 <table>
6723 <tr>
6724 <td>broken
6725 </td></tr></table>
6726 !! end
6727
6728 !! test
6729 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6730 !! wikitext
6731 {|
6732 |title="foo" |bar
6733 |title="foo<nowiki>|</nowiki>" |bar
6734 |title="foo<nowiki>|</nowiki>" bar
6735 |}
6736 !! html/php
6737 <table>
6738 <tr>
6739 <td title="foo">bar
6740 </td>
6741 <td title="foo&#124;">bar
6742 </td>
6743 <td>title="foo|" bar
6744 </td></tr></table>
6745 !! html/parsoid
6746 <table>
6747 <tbody><tr><td title="foo">bar</td>
6748 <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>
6749 <td>title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6750 </tbody></table>
6751 !! end
6752
6753 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6754 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6755 # *2wt modes will fail.
6756 !! test
6757 Table security: embedded pipes
6758 !! options
6759 parsoid=wt2html,html2html
6760 !! wikitext
6761 {|
6762 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6763 !! html/php
6764 <table>
6765 <tr>
6766 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6767 <td>]" onmouseover="alert(document.cookie)"&gt;test
6768 </td>
6769 </tr>
6770 </table>
6771 !! html/parsoid
6772 <table><tbody>
6773 <tr>
6774 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" 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>
6775 !! end
6776
6777 !! test
6778 Element attributes with double ! should not be broken up by <th>
6779 !! wikitext
6780 {|
6781 !hi <div class="!!">ha</div> ho
6782 |}
6783 !! html/php
6784 <table>
6785 <tr>
6786 <th>hi <div class="!!">ha</div> ho
6787 </th></tr></table>
6788 !! html/parsoid
6789 <table>
6790 <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6791 </tbody></table>
6792 !! end
6793
6794 !! test
6795 ! and || in element attributes should not be parsed as <th>/<td>
6796 !! wikitext
6797 {|
6798 |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
6799 |}
6800 !! html/php
6801 <table>
6802 <tr>
6803 <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6804 </td></tr></table>
6805 !! html/parsoid
6806 <table>
6807 <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6808 </tbody></table>
6809 !! end
6810
6811 # FIXME: The output seems broken. Filed as T110268.
6812 !! test
6813 ! and || in td attributes should not be parsed as <th>/<td>
6814 !! options
6815 parsoid=wt2html
6816 !! wikitext
6817 {|
6818 |style="color: red !important;" data-contrived="put this here ||"|foo
6819 |}
6820 !! html/php
6821 <table>
6822 <tr>
6823 <td>style="color: red !important;" data-contrived="put this here</td>
6824 <td>foo
6825 </td></tr></table>
6826 !! html/parsoid
6827 <table>
6828 <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>
6829 </tbody></table>
6830 !! end
6831
6832 !! test
6833 Break on | in element attribute in template
6834 !! options
6835 parsoid=wt2html,html2html
6836 !! wikitext
6837 {{echo|1=<div class="hi|ho">ha</div>}}
6838 !! html/php
6839 <p>ho"&gt;ha&lt;/div&gt;
6840 </p>
6841 !! html/parsoid
6842 <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>
6843 !! end
6844
6845 !! test
6846 Break on | in element attribute name in template
6847 !! wikitext
6848 {{echo|<div cla|ss="hiho">ha</div>}}
6849 !! html/parsoid
6850 <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>
6851 !! end
6852
6853 !! test
6854 Don't break on | in extension attribute in template
6855 !! wikitext
6856 {{echo|<ref name="hi|ho">ha</ref>}}
6857
6858 <references />
6859 !! html/parsoid
6860 <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>
6861
6862 <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>
6863 !! end
6864
6865 ## We don't support roundtripping of these attributes in Parsoid.
6866 ## Selective serialization takes care of preventing dirty diffs.
6867 ## But, on edits, we dirty-diff the invalid attribute text.
6868 !! test
6869 Invalid text in table attributes should be discarded
6870 !! options
6871 parsoid=wt2html
6872 !! wikitext
6873 {| <span>boo</span> style='border:1px solid black'
6874 | <span>boo</span> style='color:blue' |1
6875 |<span>boo</span> style='color:blue'|2
6876 |}
6877 !! html/php
6878 <table style="border:1px solid black">
6879 <tr>
6880 <td style="color:blue">1
6881 </td>
6882 <td style="color:blue">2
6883 </td></tr></table>
6884 !! html/parsoid
6885 <table style="border:1px solid black">
6886 <tr>
6887 <td style="color:blue">1</td>
6888 <td style="color:blue">2</td>
6889 </tr>
6890 </table>
6891 !! end
6892
6893 !! test
6894 Invalid text in table attributes should be preserved by selective serializer
6895 !! options
6896 parsoid={
6897 "modes": ["selser"],
6898 "changes": [
6899 ["td:first-child", "text", "abc"],
6900 ["td + td", "text", "xyz"]
6901 ]
6902 }
6903 !! wikitext
6904 {| <span>boo</span> style='border:1px solid black'
6905 | <span>boo</span> style='color:blue' | 1
6906 |<span>boo</span> style='color:blue'| 2
6907 |}
6908 !! wikitext/edited
6909 {| <span>boo</span> style='border:1px solid black'
6910 | <span>boo</span> style='color:blue' | abc
6911 |<span>boo</span> style='color:blue'| xyz
6912 |}
6913 !! end
6914
6915 !! test
6916 1. Template-generated table cell attributes and cell content
6917 !! wikitext
6918 {|
6919 |{{table_attribs}}
6920 | {{table_attribs}}
6921 || {{table_attribs_5}}
6922 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6923 |align=center {{table_attribs}}
6924 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6925 |}
6926 !! html
6927 <table>
6928 <tr>
6929 <td style="color:red;">Foo
6930 </td>
6931 <td style="color:red;">Foo
6932 </td>
6933 <td>style="color:red;"</td>
6934 <td>Bar
6935 </td>
6936 <td style="color:red;">Foo
6937 </td>
6938 <td align="center" style="color:red;">Foo
6939 </td>
6940 <td align="center" style="color:red;">Foo
6941 </td></tr></table>
6942 !! end
6943
6944 !! test
6945 2. Template-generated table cell attributes and cell content
6946 !! wikitext
6947 {|
6948 |{{table_attribs_2}}
6949 |}
6950 !! html/php
6951 <table>
6952 <tr>
6953 <td style="color:red;">Foo
6954 </td>
6955 <td>Bar</td>
6956 <td>Baz
6957 </td></tr></table>
6958 !! html/parsoid
6959 <table>
6960 <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>
6961 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6962 </tbody></table>
6963 !! end
6964
6965 !! test
6966 3. Template-generated table cell attributes and cell content
6967 !! wikitext
6968 {|
6969 !align=center {{table_header_cells}}
6970 |-
6971 |align=center {{table_cells}}
6972 |}
6973 !! html/php
6974 <table>
6975 <tr>
6976 <th align="center" style="color:red;">Foo</th>
6977 <th style="color:red;"><i>Bar</i></th>
6978 <th style="color:brown;"><i>Foo</i> and Baz
6979 </th></tr>
6980 <tr>
6981 <td align="center" style="color:red;">Foo</td>
6982 <td style="color:red;"><i>Bar</i></td>
6983 <td style="color:brown;"><i>Foo</i> and Baz
6984 </td></tr></table>
6985 !! html/parsoid
6986 <table>
6987 <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>
6988 <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>
6989 </tbody></table>
6990 !! end
6991
6992 !! test
6993 4. Template-generated table cell attributes and cell content inside a templated table
6994 !! wikitext
6995 {{tbl-start}}
6996 !align=center {{table_header_cells}}
6997 |-
6998 |align=center {{table_cells}}
6999 {{tbl-end}}
7000 !! html/php
7001 <table>
7002 <tr>
7003 <th align="center" style="color:red;">Foo</th>
7004 <th style="color:red;"><i>Bar</i></th>
7005 <th style="color:brown;"><i>Foo</i> and Baz
7006 </th></tr>
7007 <tr>
7008 <td align="center" style="color:red;">Foo</td>
7009 <td style="color:red;"><i>Bar</i></td>
7010 <td style="color:brown;"><i>Foo</i> and Baz
7011 </td></tr></table>
7012 !! html/parsoid
7013 <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}}]}'>
7014 <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>
7015 <tr>
7016 <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>
7017 </tbody></table>
7018 !! end
7019
7020 ## Edge case fix to prevent future regressions
7021 !! test
7022 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
7023 !! wikitext
7024 {|
7025 |{{table_attribs_7}}
7026 |}
7027 <references />
7028 !! html/parsoid
7029 <table>
7030 <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>
7031 </tbody></table>
7032 <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>
7033 !! end
7034
7035 !! test
7036 Table with row followed by newlines and table heading
7037 !! options
7038 parsoid=wt2html,html2html
7039 !! wikitext
7040 {|
7041 |-
7042
7043 !foo
7044 |}
7045 !! html/*
7046 <table>
7047
7048
7049 <tr>
7050 <th>foo
7051 </th></tr></table>
7052 !! end
7053
7054 !! test
7055 Table with empty line following the start tag
7056 !! options
7057 parsoid=wt2html,html2html
7058 !! wikitext
7059 {|
7060
7061 |-
7062 |foo
7063 |}
7064 !! html/*
7065 <table>
7066
7067
7068 <tr>
7069 <td>foo
7070 </td></tr></table>
7071 !! end
7072
7073 !! test
7074 Table attributes with empty value
7075 !! options
7076 parsoid=wt2html,html2html
7077 !! wikitext
7078 {|
7079 | style=|hello
7080 |}
7081 !! html/php
7082 <table>
7083 <tr>
7084 <td style="">hello
7085 </td></tr></table>
7086 !! html/parsoid
7087 <table>
7088 <tbody><tr><td style="">hello</td></tr>
7089 </tbody></table>
7090 !! end
7091
7092 !! test
7093 Wikitext table with a lot of comments
7094 !! wikitext
7095 {|
7096 <!-- c0 -->
7097 |foo
7098 <!-- c1 -->
7099 |-<!-- c2 -->
7100 <!-- c3 -->
7101 |<!-- c4 -->
7102 <!-- c5 -->
7103 |}
7104 !! html
7105 <table>
7106 <tr>
7107 <td>foo
7108 </td></tr>
7109 <tr>
7110 <td>
7111 </td></tr></table>
7112 !! end
7113
7114 !! test
7115 Wikitext table comments represented in parsoid dom
7116 !! wikitext
7117 {|<!--c1--><!--c2-->
7118 |-<!--c3-->
7119 |x
7120 |}
7121 !! html/php+tidy
7122 <table>
7123
7124 <tbody><tr>
7125 <td>x
7126 </td></tr></tbody></table>
7127 !! html/parsoid
7128 <table><!--c1--><!--c2-->
7129 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
7130 <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
7131 </tbody></table>
7132 !! end
7133
7134 !! test
7135 Wikitext table with double-line table cell
7136 !! wikitext
7137 {|
7138 |a
7139 b
7140 |}
7141 !! html
7142 <table>
7143 <tr>
7144 <td>a
7145 <p>b
7146 </p>
7147 </td></tr></table>
7148 !! end
7149
7150 !! test
7151 Table cell with a single comment
7152 !! wikitext
7153 {|
7154 |<!-- c1 -->
7155 |a
7156 |}
7157 !! html
7158 <table>
7159 <tr>
7160 <td>
7161 </td>
7162 <td>a
7163 </td></tr></table>
7164 !! end
7165
7166 !! test
7167 Table-cell after a comment-only-empty-line
7168 !! wikitext
7169 {|
7170 |a
7171 <!--c1-->
7172 <!--c2-->|b
7173 |}
7174 !! html
7175 <table>
7176 <tr>
7177 <td>a
7178 </td>
7179 <td>b
7180 </td></tr></table>
7181 !! html/parsoid
7182 <table>
7183 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
7184 <!--c1-->
7185 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
7186 </tbody></table>
7187 !! end
7188
7189 !! test
7190 Build table with {{!}}
7191 !! wikitext
7192 {{{!}} class="wikitable"
7193 !header
7194 !second header
7195 {{!}}- style="color:red;"
7196 {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
7197 {{!}}}
7198 !! html
7199 <table class="wikitable">
7200 <tr>
7201 <th>header
7202 </th>
7203 <th>second header
7204 </th></tr>
7205 <tr style="color:red;">
7206 <td>data</td>
7207 <td style="color:red;">second data
7208 </td></tr></table>
7209 !! end
7210
7211 !! test
7212 Build table with pipe as data
7213 !! wikitext
7214 {| class="wikitable"
7215 !header
7216 !second header
7217 |- style="color:red;"
7218 |data|| style="color:red;" |second data
7219 |-
7220 | style="color:red;" |data with | || style="color:red;" | second data with |
7221 |-
7222 ||data with | |||second data with |
7223 |}
7224 !! html
7225 <table class="wikitable">
7226 <tr>
7227 <th>header
7228 </th>
7229 <th>second header
7230 </th></tr>
7231 <tr style="color:red;">
7232 <td>data</td>
7233 <td style="color:red;">second data
7234 </td></tr>
7235 <tr>
7236 <td style="color:red;">data with |</td>
7237 <td style="color:red;">second data with |
7238 </td></tr>
7239 <tr>
7240 <td>data with |</td>
7241 <td>second data with |
7242 </td></tr></table>
7243 !! end
7244
7245 !! test
7246 Build table with wikilink
7247 !! wikitext
7248 {| class="wikitable"
7249 !header||second header
7250 |- style="color:red;"
7251 |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
7252 |-
7253 |data||second data [[Main Page|link|text with pipe]]
7254 |}
7255 !! html
7256 <table class="wikitable">
7257 <tr>
7258 <th>header</th>
7259 <th>second header
7260 </th></tr>
7261 <tr style="color:red;">
7262 <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
7263 <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
7264 </td></tr>
7265 <tr>
7266 <td>data</td>
7267 <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
7268 </td></tr></table>
7269 !! end
7270
7271 # The expected HTML structure in this test is debatable. The PHP parser does
7272 # not parse this kind of table at all. The main focus for Parsoid is on
7273 # round-tripping, so this output is ok for now. TODO: revisit!
7274 !! test
7275 Wikitext table with html-syntax row
7276 !! wikitext
7277 {|
7278 |-
7279 <td>foo</td>
7280 |}
7281 !! html/parsoid
7282 <table>
7283 <tbody>
7284 <tr>
7285 <td>foo</td></tr></tbody></table>
7286 !! end
7287
7288 ## Remex doesn't account for fostered content.
7289 !! test
7290 Fostered content in tables: Plain text
7291 !! options
7292 parsoid=wt2html
7293 !! wikitext
7294 {|
7295 |-
7296 a
7297 |}
7298 !! html/php
7299 <table>
7300
7301 a
7302 </table>
7303 !! html/php+tidy
7304
7305
7306 a
7307 <table></table>
7308 !! html/parsoid
7309 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
7310 a</p>
7311 <table>
7312 <tbody><tr class="mw-empty-elt" data-parsoid='{"startTagSrc":"|-"}'></tr></tbody></table>
7313 !! end
7314
7315 !! test
7316 Fostered content in tables: Lists
7317 !! options
7318 parsoid=wt2html,html2html
7319 !! wikitext
7320 {|
7321 |-
7322 *a
7323 |}
7324 !! html/php
7325 <table>
7326
7327 <ul><li>a</li></ul>
7328 </table>
7329 !! html/php+tidy
7330 <ul><li>a</li></ul><table>
7331
7332
7333 </table>
7334 !! html/parsoid
7335 <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
7336 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7337
7338 </tr></tbody></table>
7339 !! end
7340
7341 !! test
7342 Template generated table cell with attributes
7343 !! wikitext
7344 {|
7345 |-
7346 {{table_attribs_4}} ||a||b
7347 |}
7348 !! html/php+tidy
7349 <table>
7350
7351 <tbody><tr>
7352 <td style="background-color:#DC241f;" width="10px"></td>
7353 <td>a</td>
7354 <td>b
7355 </td></tr></tbody></table>
7356 !! html/parsoid
7357 <table>
7358 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7359 <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>
7360 !! end
7361
7362 !! test
7363 Parsoid: Round-trip tables directly followed by content (T53219)
7364 !! options
7365 parsoid=wt2html,wt2wt
7366 !! wikitext
7367 {|
7368 |foo
7369 |} bar
7370
7371 {|
7372 |baz
7373 |}<b>quux</b>
7374 !! html+tidy
7375 <table>
7376 <tbody><tr>
7377 <td>foo
7378 </td></tr></tbody></table><p> bar
7379 </p><table>
7380 <tbody><tr>
7381 <td>baz
7382 </td></tr></tbody></table><p><b>quux</b></p>
7383 !! end
7384
7385 !! test
7386 Parsoid: Default to a newline after tables in new content (T53219)
7387 !! options
7388 parsoid=html2wt
7389 !! html/parsoid
7390 <table><tbody>
7391 <tr><td>foo</td></tr></tbody></table> bar
7392 <table><tbody>
7393 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7394 !! wikitext
7395 {|
7396 |foo
7397 |}
7398 <nowiki> </nowiki>bar
7399 {|
7400 |baz
7401 |}
7402 '''quux'''
7403 !! end
7404
7405 !! test
7406 Parsoid: Row-syntax table headings followed by comment & table cells
7407 !! options
7408 parsoid=wt2html,wt2wt
7409 !! wikitext
7410 {|
7411 !foo||bar
7412 <!-- foo --> ||baz||quux
7413 |}
7414 !! html/php
7415 <table>
7416 <tr>
7417 <th>foo</th>
7418 <th>bar
7419 </th>
7420 <td>baz</td>
7421 <td>quux
7422 </td></tr></table>
7423 !! html/parsoid
7424 <table>
7425 <tbody><tr><th>foo</th><th>bar
7426 <!-- foo --></th><td> baz </td><td>quux</td></tr>
7427 </tbody></table>
7428 !! end
7429
7430 !!test
7431 Parsoid: Recover better from broken table attributes
7432 !!options
7433 parsoid=wt2html
7434 !!wikitext
7435 {| class="foo
7436 | class="bar" |
7437 foo
7438 |}
7439 !!html/php+tidy
7440 <table class="foo">
7441 <tbody><tr>
7442 <td class="bar">
7443 <p>foo
7444 </p>
7445 </td></tr></tbody></table>
7446 !!html/parsoid
7447 <table class="foo">
7448 <tr>
7449 <td class="bar">
7450 <p>foo</p></td></tr>
7451 </tbody></table>
7452 !!end
7453
7454 # Note: PHP parser omits empty rows
7455 !! test
7456 Tables: Digest broken attributes on table and tr tag
7457 !! options
7458 parsoid=wt2html
7459 !! wikitext
7460 {| || |} ++
7461 |- || || ++ --
7462 |- > [
7463 |}
7464 !! html/php+tidy
7465 <table>
7466
7467
7468 </table>
7469 !! html/parsoid
7470 <table>
7471 <tbody>
7472 <tr class='mw-empty-elt'></tr>
7473 <tr class='mw-empty-elt'></tr>
7474 </tbody></table>
7475 !! end
7476
7477 !! test
7478 Table with missing opening <tr> tag
7479 !! options
7480 parsoid=wt2html,wt2wt
7481 !! wikitext
7482 <table>
7483 <td>foo</td>
7484 </tr>
7485 </table>
7486 !! html+tidy
7487 <table>
7488 <tbody><tr><td>foo</td>
7489 </tr>
7490 </tbody></table>
7491 !! end
7492
7493 # T137406: Whitespace in the HTML
7494 !! test
7495 1. Generate correct wikitext for tables with thead/tbody/tfoot
7496 !! options
7497 parsoid=html2wt
7498 !! html/parsoid
7499 <table>
7500 <caption>Test</caption>
7501 <thead>
7502 <tr>
7503 <th>Month</th>
7504 <th>Savings</th>
7505 </tr>
7506 </thead>
7507 <tbody>
7508 <tr>
7509 <td>January</td>
7510 <td>$100</td>
7511 </tr>
7512 <tr>
7513 <td>February</td>
7514 <td>$80</td>
7515 </tr>
7516 </tbody>
7517 <tfoot>
7518 <tr>
7519 <td>Sum</td>
7520 <td>$180</td>
7521 </tr>
7522 </tfoot>
7523 </table>
7524 !! wikitext
7525 {|
7526 |+Test
7527 !Month
7528 !Savings
7529 |-
7530 |January
7531 |$100
7532 |-
7533 |February
7534 |$80
7535 |-
7536 |Sum
7537 |$180
7538 |}
7539 !! html/php+tidy
7540 <table>
7541 <caption>Test
7542 </caption>
7543 <tbody><tr>
7544 <th>Month
7545 </th>
7546 <th>Savings
7547 </th></tr>
7548 <tr>
7549 <td>January
7550 </td>
7551 <td>$100
7552 </td></tr>
7553 <tr>
7554 <td>February
7555 </td>
7556 <td>$80
7557 </td></tr>
7558 <tr>
7559 <td>Sum
7560 </td>
7561 <td>$180
7562 </td></tr></tbody></table>
7563 !! end
7564
7565 # T137406: No whitespace in the HTML
7566 !! test
7567 2. Generate correct wikitext for tables with thead/tbody/tfoot
7568 !! options
7569 parsoid=html2wt
7570 !! html/parsoid
7571 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7572 !! wikitext
7573 {|
7574 !heading
7575 |-
7576 |foo
7577 |}
7578 !! end
7579
7580 !! test
7581 Wikitext tables can be nested inside HTML tables
7582 !! options
7583 parsoid=html2wt
7584 !! html/parsoid
7585 <table data-parsoid='{"stx":"html"}'>
7586 <tr><td>
7587 <table>
7588 <tr><td>foo</td></tr>
7589 </table>
7590 </td></tr>
7591 </table>
7592 !! wikitext
7593 <table>
7594 <tr><td>
7595 {|
7596 |foo
7597 |}
7598 </td></tr>
7599 </table>
7600 !! html/php+tidy
7601 <table>
7602 <tbody><tr><td>
7603 <table>
7604 <tbody><tr>
7605 <td>foo
7606 </td></tr></tbody></table>
7607 </td></tr>
7608 </tbody></table>
7609 !! end
7610
7611 ###
7612 ### Internal links
7613 ###
7614 !! test
7615 Plain link, capitalized
7616 !! wikitext
7617 [[Main Page]]
7618 !! html
7619 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7620 </p>
7621 !! end
7622
7623 !! test
7624 Plain link, uncapitalized
7625 !! wikitext
7626 [[main Page]]
7627 !! html
7628 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7629 </p>
7630 !! end
7631
7632 !! test
7633 Piped link
7634 !! wikitext
7635 [[Main Page|The Main Page]]
7636 !! html
7637 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7638 </p>
7639 !! end
7640
7641 !! test
7642 Piped link with comment in link text
7643 !! wikitext
7644 [[Main Page|The Main<!--front--> Page]]
7645 !! html
7646 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7647 </p>
7648 !! end
7649
7650 !! test
7651 Piped link with multiple pipe characters in link text
7652 !! wikitext
7653 [[Main Page||The|Main|Page|]]
7654 !! html/php
7655 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7656 </p>
7657 !! html/parsoid
7658 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
7659 !! end
7660
7661 !! test
7662 Piped link with no link text
7663 !! wikitext
7664 [[Thomas Bek (bishop of St David's)|]]
7665 !! html/php
7666 <p>[[Thomas Bek (bishop of St David's)|]]
7667 </p>
7668 !! html/parsoid
7669 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7670 !! end
7671
7672 !! test
7673 Piped link with empty link text
7674 !! wikitext
7675 [[Main Page|<nowiki/>]] - empty nowiki
7676 [[Main Page| ]] - empty space
7677 [[Main Page|&nbsp;]] - empty non breaking space
7678 !! html/php
7679 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7680 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7681 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7682 </p>
7683 !! html/parsoid
7684 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
7685 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7686 <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>
7687 !! end
7688
7689 !! test
7690 Broken link
7691 !! wikitext
7692 [[Zigzagzogzagzig]]
7693 !! html
7694 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7695 </p>
7696 !! end
7697
7698 !! test
7699 Broken link with fragment
7700 !! wikitext
7701 [[Zigzagzogzagzig#zug]]
7702 !! html
7703 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7704 </p>
7705 !! end
7706
7707 !! test
7708 Special page link with fragment
7709 !! wikitext
7710 [[Special:Version#anchor]]
7711 !! html
7712 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7713 </p>
7714 !! end
7715
7716 !! test
7717 Nonexistent special page link with fragment
7718 !! wikitext
7719 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7720 !! html
7721 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7722 </p>
7723 !! end
7724
7725 !! test
7726 Link with prefix
7727 !! wikitext
7728 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7729 !! html
7730 <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>
7731 </p>
7732 !! end
7733
7734 !! test
7735 Link with suffix
7736 !! wikitext
7737 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7738 !! html
7739 <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>!!!
7740 </p>
7741 !! end
7742
7743 !! article
7744 prefixed article
7745 !! text
7746 Some text
7747 !! endarticle
7748
7749 !! test
7750 T45661: Piped links with identical prefixes
7751 !! wikitext
7752 [[prefixed article|prefixed articles with spaces]]
7753
7754 [[prefixed article|prefixed articlesaoeu]]
7755
7756 [[Main Page|Main Page test]]
7757 !! html
7758 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7759 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7760 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7761 </p>
7762 !! end
7763
7764
7765 !! test
7766 Link with HTML entity in suffix / tail
7767 !! wikitext
7768 [[Main Page]]&quot;, [[Main Page]]&#97;
7769 !! html/php
7770 <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;
7771 </p>
7772 !! html/parsoid
7773 <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>
7774 !! end
7775
7776 !! test
7777 Link with 3 brackets
7778 !! wikitext
7779 [[[Main Page]]]
7780 Foo [[[Main Page]]]
7781 !! html
7782 <p>[[[Main Page]]]
7783 Foo [[[Main Page]]]
7784 </p>
7785 !! end
7786
7787 !! test
7788 Link with 4 brackets
7789 !! wikitext
7790 [[[[Main Page]]]]
7791 !! html
7792 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7793 </p>
7794 !! end
7795
7796 !! test
7797 Piped link with 3 brackets
7798 !! wikitext
7799 [[[main page|the main page]]]
7800 !! html
7801 <p>[[[main page|the main page]]]
7802 </p>
7803 !! end
7804
7805 !! test
7806 Piped link with extlink-like text
7807 !! wikitext
7808 [[Main Page|[bar]]]
7809 [[Main Page|This is a [bar]]]
7810 [[Main Page|[bar]]
7811 !! html/php
7812 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7813 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7814 <a href="/wiki/Main_Page" title="Main Page">[bar</a>
7815 </p>
7816 !! html/parsoid
7817 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7818 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
7819 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
7820 !! end
7821
7822 !! test
7823 Link with multiple pipes
7824 !! wikitext
7825 [[Main Page|The|Main|Page]]
7826 !! html
7827 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7828 </p>
7829 !! end
7830
7831 !! test
7832 Anchor containing a #. (T65430)
7833 !! config
7834 wgFragmentMode=[ 'html5', 'legacy' ]
7835 !! wikitext
7836 [[Main Page#And#Link]]
7837 !! html/php
7838 <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
7839 </p>
7840 !! html/parsoid
7841 <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>
7842 !! end
7843
7844 !! test
7845 Link to namespaces
7846 !! wikitext
7847 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7848 !! html
7849 <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>
7850 </p>
7851 !! end
7852
7853 !! test
7854 Link with space in namespace
7855 !! wikitext
7856 [[User talk:Foo bar]]
7857 !! html
7858 <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>
7859 </p>
7860 !! end
7861
7862 !! article
7863 MemoryAlpha:AlphaTest
7864 !! text
7865 This is an article in the MemoryAlpha namespace
7866 (which shadows the memoryalpha interwiki link).
7867 !! endarticle
7868
7869 !! test
7870 Namespace takes precedence over interwiki link (T53680)
7871 !! wikitext
7872 [[MemoryAlpha:AlphaTest]]
7873 !! html
7874 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7875 </p>
7876 !! end
7877
7878 # The previous test doesn't work correctly in html2*, due to not recognizing the
7879 # link as an internal one. This one checks for the correct behavior.
7880 !! test
7881 Link to namespace preferred over interwiki with correct rel attribute
7882 !! options
7883 parsoid=html2wt,html2html
7884 !! html/parsoid
7885 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7886 !! wikitext
7887 [[MemoryAlpha:AlphaTest]]
7888 !! end
7889
7890 !! test
7891 Piped link to namespace
7892 !! wikitext
7893 [[Meta:Disclaimers|The disclaimers]]
7894 !! html
7895 <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>
7896 </p>
7897 !! end
7898
7899 !! test
7900 Link containing }
7901 !! wikitext
7902 [[Usually caused by a typo (oops}]]
7903 !! html
7904 <p>[[Usually caused by a typo (oops}]]
7905 </p>
7906 !! end
7907
7908 !! article
7909 7% Solution
7910 !! text
7911 Just a test of an article title containing a percent.
7912 !! endarticle
7913
7914 !! test
7915 Link containing % (not as a hex sequence)
7916 !! wikitext
7917 [[7% Solution]]
7918 [[7% Solution|7%25 Solution]]
7919 !! html/php
7920 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7921 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7922 </p>
7923 !! html/parsoid
7924 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7925 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7926 !! end
7927
7928 # note that the parsoid HTML is identical to the previous test output,
7929 # so the previous test ensures that the html2wt mode will generate the
7930 # "not as a hex sequence" wikitext.
7931 !! test
7932 Link containing % as a single hex sequence interpreted to char
7933 !! options
7934 parsoid=wt2wt,wt2html,html2html
7935 !! wikitext
7936 [[7%25 Solution]]
7937 [[7%25 Solution|7%25 Solution]]
7938 !! html/php
7939 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7940 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7941 </p>
7942 !! html/parsoid
7943 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7944 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7945 !!end
7946
7947 !! test
7948 Link containing % as a double hex sequence interpreted to hex sequence
7949 !! wikitext
7950 [[7%2525 Solution]]
7951 !! html
7952 <p>[[7%2525 Solution]]
7953 </p>
7954 !!end
7955
7956 ## Example for such a section: == < ==
7957 !! test
7958 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7959 !! options
7960 title=[[Main Page]]
7961 !! config
7962 wgFragmentMode=[ 'html5', 'legacy' ]
7963 !! wikitext
7964 [[%23%3c]][[%23%3e]]
7965 !! html/php
7966 <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
7967 </p>
7968 !! html/parsoid
7969 <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>
7970 !! end
7971
7972 ## Example for such a section: == < ==
7973 !! test
7974 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
7975 !! config
7976 wgFragmentMode=[ 'legacy' ]
7977 !! wikitext
7978 [[%23%3c]][[%23%3e]]
7979 !! html/php
7980 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7981 </p>
7982 !! end
7983
7984 !! test
7985 Link containing "<#" and ">#" as a hex sequences
7986 !! wikitext
7987 [[%3c%23]][[%3e%23]]
7988 !! html
7989 <p>[[%3c%23]][[%3e%23]]
7990 </p>
7991 !! end
7992
7993 !! test
7994 Link containing an equals sign
7995 !! wikitext
7996 [[Special:BookSources/isbn=4-00-026157-6]]
7997 !! html/php
7998 <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>
7999 </p>
8000 !! html/parsoid
8001 <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>
8002 !! end
8003
8004 !! article
8005 Foo & bar
8006 !! text
8007 Just a test of an article title containing an ampersand
8008 !! endarticle
8009
8010 !! test
8011 Link containing an ampersand
8012 !! wikitext
8013 [[Foo & bar]]
8014
8015 [[Foo &amp; bar]]
8016
8017 [[Foo &amp;amp; bar]]
8018 !! html/php+tidy
8019 <p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8020 </p><p><a href="/wiki/Foo_%26_bar" title="Foo &amp; bar">Foo &amp; bar</a>
8021 </p><p>[[Foo &amp;amp; bar]]
8022 </p>
8023 !! html/parsoid
8024 <p><a rel="mw:WikiLink" href="./Foo_&amp;_bar" title="Foo &amp; bar">Foo &amp; bar</a></p>
8025 <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>
8026 <p>[[Foo <span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp; bar]]</p>
8027 !! end
8028
8029 !! article
8030 Foo~bar
8031 !! text
8032 Just a test of an article title containing a tilde.
8033 !! endarticle
8034
8035 # note that links containing signatures, like [[Foo~~~~]], are
8036 # massaged by the pre-save transform (PST) and so the tildes are never
8037 # seen by the parser.
8038 !! test
8039 Link containing a tilde
8040 !! wikitext
8041 [[Foo~bar]]
8042 !! html/php
8043 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
8044 </p>
8045 !! html/parsoid
8046 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
8047 !! end
8048
8049 !! test
8050 Link containing double-single-quotes '' (T6598)
8051 !! wikitext
8052 [[Lista d''e paise d''o munno]]
8053 !! html/php
8054 <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>
8055 </p>
8056 !! html/parsoid
8057 <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>
8058 !! end
8059
8060 !! test
8061 Link containing double quotes and spaces
8062 !! wikitext
8063 [[Cool "Gator"]]
8064 !! html/php
8065 <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>
8066 </p>
8067 !! html/parsoid
8068 <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
8069 !! end
8070
8071 !! test
8072 File containing double quotes and spaces
8073 !! wikitext
8074 [[File:Cool "Gator".png]]
8075 !! html/php+tidy
8076 <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>
8077 </p>
8078 !! html/parsoid
8079 <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>
8080 !! end
8081
8082 !! test
8083 File containing single quotes
8084 !! wikitext
8085 [[File:Foo's ''italic'' bar.jpg]]
8086 [[File:Foo's ''italic'' bar.jpg|Foo's ''italic'' bar]]
8087 !! html/php+tidy
8088 <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>
8089 <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>
8090 </p>
8091 !! end
8092
8093 !! test
8094 Redirect containing double quotes and spaces
8095 !! wikitext
8096 #REDIRECT [[Cool "Gator"]]
8097 !! html/parsoid
8098 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8099 !! end
8100
8101 !! test
8102 Link containing double-single-quotes '' in text (T6598 sanity check)
8103 !! wikitext
8104 Some [[Link|pretty ''italics'' and stuff]]!
8105 !! html/php
8106 <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>!
8107 </p>
8108 !! html/parsoid
8109 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8110 !! end
8111
8112 !! test
8113 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8114 !! wikitext
8115 ''Some [[Link|pretty ''italics'' and stuff]]!''
8116 !! html
8117 <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>
8118 </p>
8119 !! end
8120
8121 ## FIXME: Title part of filename is interpreted in php
8122 !! test
8123 Link with double quotes in title part (literal) and alternate part (interpreted)
8124 !! wikitext
8125 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8126
8127 [[''Pentecoste'']]
8128
8129 [[''Pentecoste''|Pentecoste]]
8130
8131 [[''Pentecoste''|''Pentecoste'']]
8132 !! html/php
8133 <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>
8134 </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>
8135 </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>
8136 </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>
8137 </p>
8138 !! html/parsoid
8139 <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>
8140 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8141 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8142 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8143 !! end
8144
8145 !! test
8146 Broken image links with HTML captions (T41700)
8147 !! wikitext
8148 [[File:Nonexistent|<script></script>]]
8149 [[File:Nonexistent|100x100px|<script></script>]]
8150 [[File:Nonexistent|&lt;]]
8151 [[File:Nonexistent|a<i>b</i>c]]
8152 !! html/php
8153 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script>&lt;/script></a>
8154 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script>&lt;/script></a>
8155 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8156 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8157 </p>
8158 !! html/parsoid
8159 <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>
8160 <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>
8161 <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>
8162 <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>
8163 !! end
8164
8165 !! test
8166 Plain link to URL
8167 !! wikitext
8168 [[http://www.example.com]]
8169 !! html/php
8170 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8171 </p>
8172 !! html/parsoid
8173 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8174 !! end
8175
8176 !! test
8177 Plain link to URL with link text
8178 !! wikitext
8179 [[http://www.example.com Link text]]
8180 !! html
8181 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8182 </p>
8183 !! end
8184
8185 !! test
8186 Plain link to URL containing special characters, with link text (see T213950).
8187 !! wikitext
8188 [[http://www.example.com/?q=%7Babc%7D Link text]]
8189 !! html
8190 <p>[<a rel="nofollow" class="external text" href="http://www.example.com/?q=%7Babc%7D">Link text</a>]
8191 </p>
8192 !! end
8193
8194 !! test
8195 Plain link to protocol-relative URL
8196 !! wikitext
8197 [[//www.example.com]]
8198 !! html/php
8199 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8200 </p>
8201 !! html/parsoid
8202 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8203 !! end
8204
8205 !! test
8206 Plain link to protocol-relative URL with link text
8207 !! wikitext
8208 [[//www.example.com Link text]]
8209 !! html
8210 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8211 </p>
8212 !! end
8213
8214 !! test
8215 Plain link to page with question mark in title
8216 !! wikitext
8217 [[A?b]]
8218
8219 [[A?b|Baz]]
8220 !! html
8221 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8222 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8223 </p>
8224 !! end
8225
8226 # I'm fairly sure the expected result here is wrong.
8227 # We want these to be URL links, not pseudo-pages with URLs for titles....
8228 # However the current output is also pretty screwy.
8229 #
8230 # ----
8231 # I'm changing it to match the current output--it arguably makes more
8232 # sense in the light of the test above. Old expected result was:
8233 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8234 #</p>
8235 # But I think this test is bordering on "garbage in, garbage out" anyway.
8236 # -- wtm
8237 !! test
8238 Piped link to URL
8239 !! wikitext
8240 Piped link to URL: [[http://www.example.com|an example URL]]
8241 !! html/php
8242 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8243 </p>
8244 !! html/parsoid
8245 <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
8246 !! end
8247
8248 !! test
8249 Plain link in template argument
8250 !! options
8251 parsoid=wt2html
8252 !! wikitext
8253 {{echo|[http://www.example.com |123]}}
8254
8255 {{echo|[[http://www.example.com |123]]}}
8256
8257 {{echo|[[http://www.example.com |123]}}
8258
8259 {{echo|[http://www.example.com |123]]}}
8260 !! html/php
8261 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8262 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8263 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8264 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8265 </p>
8266 !! html/parsoid
8267 <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" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8268
8269 <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" class="external text" href="http://www.example.com">|123</a>]</p>
8270
8271 <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
8272
8273 <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" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
8274 !! end
8275
8276 !! test
8277 T2002: [[page|http://url/]] should link to page, not http://url/
8278 !! wikitext
8279 [[Main Page|http://url/]]
8280 !! html/php
8281 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8282 </p>
8283 !! html/parsoid
8284 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8285 !! end
8286
8287 # Parsoid does not mark self-links, by design.
8288 !! test
8289 T2337: Escaped self-links should be bold
8290 !! options
8291 title=[[Bug462]]
8292 !! wikitext
8293 [[Bu&#103;462]] [[Bug462]]
8294 !! html/php+tidy
8295 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8296 </p>
8297 !! html/parsoid
8298 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8299 !! end
8300
8301 !! test
8302 Self-link to section should not be bold
8303 !! options
8304 title=[[Main Page]]
8305 !! wikitext
8306 [[Main Page#section]]
8307 !! html
8308 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8309 </p>
8310 !! end
8311
8312 !! article
8313 00
8314 !! text
8315 This is 00.
8316 !! endarticle
8317
8318 !!test
8319 Self-link to numeric title
8320 !!options
8321 title=[[0]]
8322 !! wikitext
8323 [[0]]
8324 !! html
8325 <p><a class="mw-selflink selflink">0</a>
8326 </p>
8327 !!end
8328
8329 !!test
8330 Link to numeric-equivalent title
8331 !!options
8332 title=[[0]]
8333 !! wikitext
8334 [[00]]
8335 !! html
8336 <p><a href="/wiki/00" title="00">00</a>
8337 </p>
8338 !!end
8339
8340 !! test
8341 <nowiki> inside a link
8342 !! wikitext
8343 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8344 !! html/php+tidy
8345 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8346 </p>
8347 !! html/parsoid
8348 <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>
8349 !! end
8350
8351 ## Parsoid doesn't get this right and even fails wt2html because, when doing the
8352 ## normalization for comparison, the html serialization / re-parse doesn't
8353 ## roundtrip. This is T49963
8354 !! test
8355 <pre> inside a link
8356 !! wikitext
8357 [[Main<pre> Page</pre>]] [[Main Page|the main page <pre>[it's not very good]</pre>]]
8358 !! html/php+tidy
8359 <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>
8360 !! html/parsoid
8361 <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>
8362 !! end
8363
8364 !! test
8365 Non-breaking spaces in title
8366 !! wikitext
8367 [[&nbsp; Main &nbsp; Page &nbsp;]]
8368 !! html
8369 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8370 </p>
8371 !!end
8372
8373 # Add new article for the test below so that it doesn't red-link
8374 !! article
8375 Foo bar baz
8376 !! text
8377 boo
8378 !! endarticle
8379
8380 !! test
8381 Multiple spaces in titles should normalize to a single underscore
8382 !! options
8383 parsoid=wt2html,wt2wt
8384 !! wikitext
8385 [[Foo bar baz|x]]
8386 [[Foo bar baz|x]]
8387 [[Foo bar baz|x]]
8388 !! html/php
8389 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8390 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8391 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8392 </p>
8393 !! html/parsoid
8394 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8395 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8396 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8397 </p>
8398 !! end
8399
8400 !! test
8401 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8402 !! options
8403 language=ca
8404 !! wikitext
8405 '''[[Main Page]]'''
8406 !! html
8407 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8413 !! options
8414 language=ca
8415 !! wikitext
8416 ''[[Main Page]]''
8417 !! html
8418 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8419 </p>
8420 !! end
8421
8422 !! test
8423 Internal link with en linktrail: no apostrophes (T29473)
8424 !! options
8425 language=en
8426 !! wikitext
8427 [[Something]]'nice
8428 !! html
8429 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8430 </p>
8431 !! end
8432
8433 !! test
8434 Internal link with ca linktrail with apostrophes (T29473)
8435 !! options
8436 language=ca
8437 !! wikitext
8438 [[Something]]'nice
8439 !! html
8440 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8441 </p>
8442 !! end
8443
8444 !! test
8445 Internal link with kaa linktrail with apostrophes (T29473)
8446 !! options
8447 language=kaa
8448 !! wikitext
8449 [[Something]]'nice
8450 !! html
8451 <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>
8452 </p>
8453 !! end
8454
8455 !! test
8456 Link with multiple ":" in a subpage-supporting namespace (T65636)
8457 !! wikitext
8458 [[User:Foo/Test/63636:Bar|Test]]
8459 !! html/php
8460 <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>
8461 </p>
8462 !! html/parsoid
8463 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8464 !! end
8465
8466 ## Mainly a sanity check for Parsoid
8467 !! test
8468 Handle title parsing for subpages
8469 !! options
8470 title=[[/123123]]
8471 subpage
8472 !! wikitext
8473 123
8474 !! html/php
8475 <p>123
8476 </p>
8477 !! html/parsoid
8478 <p>123</p>
8479 !! end
8480
8481 !! article
8482 User:Test/123
8483 !! text
8484 test 123
8485 !! endarticle
8486
8487 !! test
8488 Link to a subpage from a namespace other than main
8489 !! options
8490 title=[[User:Test]]
8491 subpage
8492 !! wikitext
8493 [[/123]]
8494 !! html/php
8495 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8496 </p>
8497 !! html/parsoid
8498 <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>
8499 !! end
8500
8501 !! test
8502 Ensure that transclusion titles are not url-decoded
8503 !! options
8504 subpage title=[[Test]]
8505 parsoid=wt2html
8506 !! wikitext
8507 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8508 !! html/php
8509 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8510 </p>
8511 !! html/parsoid
8512 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8513 !! end
8514
8515 !! test
8516 Purely hash wikilink
8517 !! options
8518 title=[[User:Test/123]]
8519 subpage
8520 !! wikitext
8521 [[#a|b]]
8522 !! html/php
8523 <p><a href="#a">b</a>
8524 </p>
8525 !! html/parsoid
8526 <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>
8527 !! end
8528
8529 !! test
8530 Serialization of purely hash wikilink
8531 !! options
8532 title=[[User:Test/123]]
8533 subpage
8534 parsoid=html2wt
8535 !! html/parsoid
8536 <p><a href="#a">[[</a></p>
8537 !! wikitext
8538 [[#a|<nowiki>[[</nowiki>]]
8539 !! html/php
8540 <p><a href="#a">[[</a>
8541 </p>
8542 !! end
8543
8544 !! test
8545 1. Interaction of linktrail and template encapsulation
8546 !! wikitext
8547 {{echo|[[Foo]]}}l
8548 !! html/php+tidy
8549 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8550 </p>
8551 !! html/parsoid
8552 <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>
8553 !! end
8554
8555 !! test
8556 2. Interaction of linktrail and template encapsulation
8557 !! wikitext
8558 {{echo|Some [[Fool]]}}s
8559 !! html/php+tidy
8560 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8561 </p>
8562 !! html/parsoid
8563 <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>
8564 !! end
8565
8566 !! test
8567 3. Interaction of linktrail and template encapsulation
8568 !! wikitext
8569 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8570 !! html/php+tidy
8571 <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>
8572 </p>
8573 !! html/parsoid
8574 <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>
8575 !! end
8576
8577 !! article
8578 Söfnuður
8579 !! text
8580 Test.
8581 !! endarticle
8582
8583 !! test
8584 Internal link with is link prefix
8585 !! options
8586 language=is
8587 !! wikitext
8588 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8589 !! html
8590 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8591 </p>
8592 !! end
8593
8594 !! article
8595 Mótmælendatrú
8596 !! text
8597 Test.
8598 !! endarticle
8599
8600 !! test
8601 Internal link with is link trail and link prefix
8602 !! options
8603 language=is
8604 !! wikitext
8605 [[mótmælendatrú|xxx]]ar
8606 [[mótmælendatrú]]ar
8607 mótmælenda[[söfnuður]]
8608 mótmælenda[[söfnuður|söfnuðir]]
8609 mótmælenda[[söfnuður|söfnuðir]]xxx
8610 !! html
8611 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8612 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8613 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8614 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8615 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8616 </p>
8617 !! end
8618
8619 !! test
8620 Parsoid link trail escaping
8621 !! options
8622 parsoid=html2wt,html2html
8623 !! html/parsoid
8624 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8625 !! wikitext
8626 [[apple]]<nowiki/>s
8627 !! end
8628
8629 !! test
8630 Parsoid link prefix escaping
8631 !! options
8632 language=is
8633 parsoid=html2wt,html2html
8634 !! html/parsoid
8635 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8636 !! wikitext
8637 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8638 !! end
8639
8640 !! test
8641 Parsoid link bracket escaping
8642 !! options
8643 parsoid=html2wt,html2html
8644 !! html/parsoid
8645 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8646 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8647 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8648 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8649 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8650 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8651 !! wikitext
8652 [[Test]]
8653
8654 [<nowiki/>[[Test]]]
8655
8656 [[[[Test]]]]
8657
8658 [[[<nowiki/>[[Test]]]]]
8659
8660 [[[[[[Test]]]]]]
8661
8662 [[[[[<nowiki/>[[Test]]]]]]]
8663 !! end
8664
8665 !! test
8666 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8667 !! wikitext
8668 [[Foo| bar]]
8669
8670 [[Foo| ''bar'']]
8671
8672 [http://wp.org foo]
8673
8674 [http://wp.org ''foo'']
8675 !! html
8676 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8677 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8678 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8679 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8680 </p>
8681 !! end
8682
8683 !! test
8684 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8685 !! wikitext
8686 [[Foo|{{echo|a}} b {{echo|c}}]]
8687 !! html/parsoid
8688 <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>
8689 !! end
8690
8691 !! test
8692 Link with angle bracket after anchor
8693 !! config
8694 wgFragmentMode=[ 'html5', 'legacy' ]
8695 !! wikitext
8696 [[Foo#<bar>]]
8697 !! html/php
8698 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8699 </p>
8700 !! html/parsoid
8701 <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>
8702 !! end
8703
8704 !! test
8705 Link with angle bracket after anchor (legacy)
8706 !! config
8707 wgFragmentMode=[ 'legacy' ]
8708 !! wikitext
8709 [[Foo#<bar>]]
8710 !! html/php
8711 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8712 </p>
8713 !! end
8714
8715 ###
8716 ### Interwiki links (see maintenance/interwiki.sql)
8717 ###
8718
8719 !! test
8720 Inline interwiki link
8721 !! options
8722 parsoid=wt2html,wt2wt,html2html
8723 !! wikitext
8724 [[MeatBall:SoftSecurity]]
8725 !! html/php
8726 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8727 </p>
8728 !! html/parsoid
8729 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8730 !! end
8731
8732 !! test
8733 Inline interwiki link with empty title (T4372)
8734 !! options
8735 parsoid=wt2html,wt2wt,html2html
8736 !! wikitext
8737 [[MeatBall:]]
8738 !! html/php
8739 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8740 </p>
8741 !! html/parsoid
8742 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8743 !! end
8744
8745 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8746 !! test
8747 Interwiki link encoding conversion (T3636)
8748 !! options
8749 parsoid=wt2html,wt2wt
8750 !! wikitext
8751 *[[Wikipedia:ro:Olteni&#0355;a]]
8752 *[[Wikipedia:ro:Olteni&#355;a]]
8753 !! html/php
8754 <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>
8755 <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>
8756 !! html/php+tidy
8757 <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>
8758 <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>
8759 !! html/parsoid
8760 <ul>
8761 <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>
8762 <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>
8763 </ul>
8764 !! end
8765
8766 !! test
8767 Interwiki link with fragment (T4130)
8768 !! wikitext
8769 [[MeatBall:SoftSecurity#foo]]
8770 !! html
8771 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8772 </p>
8773 !! end
8774
8775 ## The interwiki case here continued to be legacy escaped because of the
8776 ## default setting of $wgExternalInterwikiFragmentMode
8777 !! test
8778 Link scenarios with escaped fragments
8779 !! options
8780 title=[[Main Page]]
8781 !! config
8782 wgFragmentMode=[ 'html5', 'legacy' ]
8783 !! wikitext
8784 [[#Is this great?]]
8785 [[Foo#Is this great?]]
8786 [[meatball:Foo#Is this great?]]
8787 !! html/php
8788 <p><a href="#Is_this_great?">#Is this great?</a>
8789 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8790 <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>
8791 </p>
8792 !! html/parsoid
8793 <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>
8794 <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>
8795 <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>
8796 !! end
8797
8798 !! test
8799 Link scenarios with escaped fragments (legacy)
8800 !! config
8801 wgFragmentMode=[ 'legacy' ]
8802 !! wikitext
8803 [[#Is this great?]]
8804 [[Foo#Is this great?]]
8805 [[meatball:Foo#Is this great?]]
8806 !! html/php
8807 <p><a href="#Is_this_great.3F">#Is this great?</a>
8808 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8809 <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>
8810 </p>
8811 !! end
8812
8813 # Ideally the wikipedia: prefix here should be proto-relative too
8814 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8815 # define the 'en' prefix, and originally the test used 'wikipedia',
8816 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8817 # article.
8818 !! test
8819 Different interwiki prefixes mapping to the same URL
8820 !! wikitext
8821 [[:en:Foo]]
8822
8823 [[:en:Foo|Foo]]
8824
8825 [[wikipedia:Foo]]
8826
8827 [[:wikipedia:Foo|Foo]]
8828
8829 [[wikipedia:en:Foo]]
8830
8831 [[:wikipedia:en:Foo]]
8832
8833 [[ wikiPEdia :Foo]]
8834 !! html/parsoid
8835 <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>
8836
8837 <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>
8838
8839 <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>
8840
8841 <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>
8842
8843 <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>
8844
8845 <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>
8846
8847 <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>
8848 !! end
8849
8850 !! test
8851 Interwiki links that cannot be represented in wiki syntax
8852 !! wikitext
8853 [[meatball:ok]]
8854 [[meatball:ok#foo|ok with fragment]]
8855 [[meatball:ok_as_well?|ok ending with ? mark]]
8856 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8857 [http://de.wikipedia.org/wiki/#foo is just fragment]
8858
8859 !! html/php
8860 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8861 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8862 <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>
8863 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8864 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8865 </p>
8866 !! html/parsoid
8867 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8868 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8869 <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>
8870 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8871 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8872 !! end
8873
8874 !! test
8875 Interwiki links: trail
8876 !! wikitext
8877 [[wikipedia:Foo|Ba]]r
8878 !! html/php
8879 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8880 </p>
8881 !! html/parsoid
8882 <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>
8883 !! end
8884
8885 !! test
8886 Local interwiki link
8887 !! options
8888 parsoid=wt2html,wt2wt,html2html
8889 !! wikitext
8890 [[local:Template:Foo]]
8891 !! html/php
8892 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8893 </p>
8894 !! html/parsoid
8895 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8896 !! end
8897
8898 # Parsoid does not mark self-links, by design.
8899 !! test
8900 Local interwiki link: self-link to current page
8901 !! options
8902 title=[[Main Page]]
8903 parsoid=wt2html,wt2wt,html2html
8904 !! wikitext
8905 [[local:Main Page]]
8906 !! html/php
8907 <p><a class="mw-selflink selflink">local:Main Page</a>
8908 </p>
8909 !! html/parsoid
8910 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8911 !! end
8912
8913 !! test
8914 Local interwiki link: prefix only (T66167)
8915 !! options
8916 parsoid=wt2html,wt2wt,html2html
8917 !! wikitext
8918 [[local:]]
8919 !! html/php
8920 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8921 </p>
8922 !! html/parsoid
8923 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8924 !! end
8925
8926 !! test
8927 Local interwiki link: with additional interwiki prefix (T63357)
8928 !! options
8929 parsoid=wt2html,wt2wt,html2html
8930 !! wikitext
8931 [[local:meatball:Hello]]
8932 !! html/php
8933 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8934 </p>
8935 !! html/parsoid
8936 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8937 !! end
8938
8939 !! test
8940 Multiple local interwiki link prefixes
8941 !! wikitext
8942 [[local:local:local:local:mi:local:Foo]]
8943 !! options
8944 parsoid=wt2html,wt2wt,html2html
8945 !! html/php
8946 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8947 </p>
8948 !! html/parsoid
8949 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8950 !! end
8951
8952 !! test
8953 Interwiki link with percent encoded target
8954 !! wikitext
8955 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8956 !! html/php
8957 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8958 </p>
8959 !! html/parsoid
8960 <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>
8961 !! end
8962
8963 ###
8964 ### Interlanguage links
8965 ### Language links (so that searching for '### language' matches..)
8966 ###
8967
8968 !! test
8969 Interlanguage link
8970 !! wikitext
8971 Blah blah blah
8972 [[zh:Chinese]]
8973 !! html/php
8974 <p>Blah blah blah
8975 </p>
8976 !! html/parsoid
8977 <p>Blah blah blah</p>
8978 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8979 !! end
8980
8981 ## parsoid html2wt will lose the space variations
8982 !! test
8983 Interlanguage link with spacing
8984 !! options
8985 parsoid=wt2html,wt2wt,html2html
8986 !! wikitext
8987 Blah blah blah
8988 [[ zh : Chinese ]]
8989 !! html/php
8990 <p>Blah blah blah
8991 </p>
8992 !! html/parsoid
8993 <p>Blah blah blah</p>
8994 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8995 !! end
8996
8997 !! test
8998 Double interlanguage link
8999 !! wikitext
9000 Blah blah blah
9001 [[es:Spanish]]
9002 [[zh:Chinese]]
9003 !! html/php
9004 <p>Blah blah blah
9005 </p>
9006 !! html/parsoid
9007 <p>Blah blah blah</p>
9008 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9009 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9010 !! end
9011
9012 ## parsoid html2wt will lose the space variations
9013 !! test
9014 Interlanguage link variations
9015 !! options
9016 parsoid=wt2html,wt2wt,html2html
9017 !! wikitext
9018 Blah blah blah
9019 [[ es :Spanish]]
9020 [[ ZH :Chinese]]
9021 [[es:Foo_bar]]
9022 !! html/php
9023 <p>Blah blah blah
9024 </p>
9025 !! html/parsoid
9026 <p>Blah blah blah</p>
9027 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9028 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9029 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9030 !! end
9031
9032 !! test
9033 Escaping of interlanguage links (T129218, T156308)
9034 !! wikitext
9035 Blah blah blah
9036 [[:es:Spanish]]
9037 [[ : zh : Chinese ]]
9038 !! html/php
9039 <p>Blah blah blah
9040 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9041 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9042 </p>
9043 !! html/parsoid
9044 <p>Blah blah blah
9045 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9046 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9047 !! end
9048
9049 !! test
9050 Multiple colons escaping interlanguage links
9051 !! options
9052 parsoid=wt2html
9053 !! wikitext
9054 [[:es:Spanish]]
9055 [[::es:Spanish]]
9056 [[:::es:Spanish]]
9057 !! html/php
9058 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9059 [[::es:Spanish]]
9060 [[:::es:Spanish]]
9061 </p>
9062 !! html/parsoid
9063 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9064 [[::es:Spanish]]
9065 [[:::es:Spanish]]</p>
9066 !! end
9067
9068 ## parsoid html2wt will normalize the space to _
9069 !! test
9070 Space and question mark encoding in interlanguage links (T95473)
9071 !! options
9072 parsoid=wt2html,wt2wt,html2html
9073 !! wikitext
9074 Blah blah blah
9075 [[es:Foo bar?]]
9076 !! html/php
9077 <p>Blah blah blah
9078 </p>
9079 !! html/parsoid
9080 <p>Blah blah blah</p>
9081 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9082 !! end
9083
9084 !! test
9085 Interlanguage link, with prefix links
9086 !! options
9087 language=ln
9088 !! wikitext
9089 Blah blah blah
9090 [[zh:Chinese]]
9091 !! html/php
9092 <p>Blah blah blah
9093 </p>
9094 !! html/parsoid
9095 <p>Blah blah blah</p>
9096 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9097 !! end
9098
9099 !! test
9100 Double interlanguage link, with prefix links (T10897)
9101 !! options
9102 language=ln
9103 !! wikitext
9104 Blah blah blah
9105 [[es:Spanish]]
9106 [[zh:Chinese]]
9107 !! html/php
9108 <p>Blah blah blah
9109 </p>
9110 !! html/parsoid
9111 <p>Blah blah blah</p>
9112 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9113 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9114 !! end
9115
9116 !! test
9117 "Extra" interlanguage links (T34189 / gerrit 111390)
9118 !! wikitext
9119 Blah blah blah
9120 [[mul:Article]]
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" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9127 !! end
9128
9129 ## PHP parser tests script needs an update
9130 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9131 !! test
9132 Language links render as inline links if $wgInterwikiMagic=false
9133 !! options
9134 wgInterwikiMagic=false
9135 parsoid=wt2html,wt2wt,html2html
9136 !! wikitext
9137 Blah blah blah
9138 [[zh:Chinese]]
9139 !! html/parsoid
9140 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9141 !! end
9142
9143 ## PHP parser tests script needs an update
9144 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9145 !! test
9146 Language links render as inline links in the Talk namespace
9147 !! options
9148 title=Talk:Foo
9149 parsoid=wt2html,wt2wt,html2html
9150 !! wikitext
9151 Blah blah blah
9152 [[zh:Chinese]]
9153 !! html/parsoid
9154 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9155 !! end
9156
9157 !! test
9158 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9159 !! options
9160 language=ln
9161 !! wikitext
9162 [[WW&nbsp;II]]
9163 !! html
9164 <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>
9165 </p>
9166 !! end
9167
9168 !! test
9169 Parsoid T55221: Wikilinks should be properly entity-escaped
9170 !! options
9171 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9172 !! html/parsoid
9173 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9174 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9175 !! wikitext
9176 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9177
9178 He&amp;nbsp;llo He&amp;nbsp;llo
9179 !! html/php
9180 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9181 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9182 </p>
9183 !! end
9184
9185 # html2wt will fail because of title normalization without data-parsoid
9186 !! test
9187 Parsoid: handle constructor well
9188 !! options
9189 parsoid=wt2html,wt2wt
9190 !! wikitext
9191 [[constructor]]
9192
9193 [[constructor:foo]]
9194 !! html/php
9195 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9196 </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>
9197 </p>
9198 !! html/parsoid
9199 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9200
9201 <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>
9202 !! end
9203
9204 !! test
9205 Template parameter named "constructor"
9206 !! wikitext
9207 {{echo| constructor = |hi}}
9208 !! html/parsoid
9209 <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":{"1":{"wt":"hi"},"constructor":{"wt":""}},"i":0}}]}'>hi</p>
9210 !! end
9211
9212 !! article
9213 ko:
9214 !! text
9215 Test.
9216 !! endarticle
9217
9218 # Note that `ko` isn't a known interlanguage prefix
9219 !! test
9220 Parsoid: recognize interlanguage links without a target page
9221 !! options
9222 ill
9223 !! wikitext
9224 [[es:]]
9225
9226 [[ko:]]
9227 !! html/php
9228 es:
9229 !! html/parsoid
9230 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9231
9232 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9233 !! end
9234
9235 # Note that `ko` isn't a known interwiki prefix
9236 !! test
9237 Parsoid: recognize interwiki links without a target page
9238 !! options
9239 parsoid=wt2html,wt2wt,html2html
9240 !! wikitext
9241 [[:es:]]
9242
9243 [[:ko:]]
9244 !! html/php
9245 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9246 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9247 </p>
9248 !! html/parsoid
9249 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9250 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9251 !! end
9252
9253 !! test
9254 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9255 !! wikitext
9256 [[mi:Foo]]
9257 !! html/php
9258 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9259 </p>
9260 !! html/parsoid
9261 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9262 !! end
9263
9264 !! test
9265 Interlanguage link with preceding local interwiki link (T70085)
9266 !! options
9267 parsoid=wt2html,wt2wt,html2html
9268 !! wikitext
9269 Blah blah blah
9270 [[local:es:Spanish]]
9271 !! html/php
9272 <p>Blah blah blah
9273 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9274 </p>
9275 !! html/parsoid
9276 <p>Blah blah blah
9277 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9278 !! end
9279
9280 !! test
9281 Looks like an interlanguage link, but is actually a local interwiki
9282 !! options
9283 parsoid=wt2html,wt2wt,html2html
9284 !! wikitext
9285 Blah blah blah
9286 [[mi:Template:Foo]]
9287 !! html/php
9288 <p>Blah blah blah
9289 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9290 </p>
9291 !! html/parsoid
9292 <p>Blah blah blah
9293 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9294 !! end
9295
9296 ###
9297 ### Redirects, Parsoid-only
9298 ###
9299
9300 !! test
9301 1. Simple redirect to page
9302 !! wikitext
9303 #REDIRECT [[Main Page]]
9304 !! html/parsoid
9305 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9306 !! end
9307
9308 !! test
9309 2. Other redirect variants
9310 !! wikitext
9311 #REDIRECT [[Main_Page]]
9312 !! html/parsoid
9313 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9314 !! end
9315
9316 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9317 # This tests the Parsoid bail-out code.
9318 !! test
9319 3. Other redirect variants
9320 !! options
9321 parsoid=wt2html
9322 !! wikitext
9323 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9324 !! html/parsoid
9325 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9326 !! end
9327
9328 !! test
9329 4. Redirect to a templated destination
9330 !! wikitext
9331 #REDIRECT [[{{echo|Foo}}bar]]
9332 !! html/parsoid
9333 <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"}]]}'/>
9334 !! end
9335
9336 !! test
9337 Empty redirect
9338 !! options
9339 parsoid=wt2html,wt2wt
9340 !! wikitext
9341 #REDIRECT [[]]
9342 !! html/parsoid
9343 <ol>
9344 <li>REDIRECT [[]]</li></ol>
9345 !! end
9346
9347 !! test
9348 Optional colon in #REDIRECT
9349 !! options
9350 # the colon is archaic syntax. we support it for wt2html, but we
9351 # don't care that it roundtrips back to the modern syntax.
9352 parsoid=wt2html,html2html
9353 !! wikitext
9354 #REDIRECT:[[Main Page]]
9355 !! html/parsoid
9356 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9357 !! end
9358
9359 !! test
9360 Whitespace in #REDIRECT with optional colon
9361 !! options
9362 # the colon and gratuitous whitespace is archaic syntax. we support
9363 # it for wt2html, but we don't care that it roundtrips back to the
9364 # modern syntax (without extra whitespace)
9365 parsoid=wt2html,html2html
9366 !! wikitext
9367
9368 #REDIRECT
9369 :
9370 [[Main Page]]
9371 !! html/parsoid
9372 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9373 !! end
9374
9375 !! test
9376 Piped link in #REDIRECT
9377 !! options
9378 # content after piped link is ignored. we support this syntax,
9379 # but don't care that the piped link is lost when we roundtrip this.
9380 parsoid=wt2html
9381 !! wikitext
9382 #REDIRECT [[Main Page|bar]]
9383 !! html/parsoid
9384 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9385 !! end
9386
9387 !! test
9388 Redirect to category (T104502)
9389 !! options
9390 parsoid=wt2html,wt2wt
9391 !! wikitext
9392 #REDIRECT [[Category:Foo]]
9393 !! html/parsoid
9394 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9395 !! end
9396
9397 !! test
9398 Redirect to category with URL encoding (T104502)
9399 !! options
9400 parsoid=wt2html
9401 !! wikitext
9402 #REDIRECT [[Category%3AFoo]]
9403 !! html/parsoid
9404 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9405 !! end
9406
9407 !! test
9408 Redirect to category page
9409 !! wikitext
9410 #REDIRECT [[:Category:Foo]]
9411 !! html/parsoid
9412 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9413 !! end
9414
9415 !! test
9416 Redirect to image page (1)
9417 !! wikitext
9418 #REDIRECT [[File:Wiki.png]]
9419 !! html/parsoid
9420 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9421 !! end
9422
9423 !! test
9424 Redirect to image page (2)
9425 !! wikitext
9426 #REDIRECT [[Image:Wiki.png]]
9427 !! html/parsoid
9428 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9429 !! end
9430
9431 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9432 # Next test confirms this.
9433 !! test
9434 Redirect to language (1) (T104918)
9435 !! options
9436 parsoid=wt2html,wt2wt,html2html
9437 !! wikitext
9438 #REDIRECT [[en:File:Wiki.png]]
9439 !! html/parsoid
9440 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9441 !! end
9442
9443 !! test
9444 Redirect to language (2) (T104918)
9445 !! wikitext
9446 #REDIRECT [[:en:File:Wiki.png]]
9447 !! html/parsoid
9448 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9449 !! end
9450
9451 !! test
9452 Redirect to interwiki (T104918)
9453 !! wikitext
9454 #REDIRECT [[meatball:File:Wiki.png]]
9455 !! html/parsoid
9456 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9457 !! end
9458
9459 !! test
9460 Non-English #REDIRECT
9461 !! options
9462 language=is
9463 !! wikitext
9464 #TILVÍSUN [[Main Page]]
9465 !! html/parsoid
9466 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9467 !! end
9468
9469 !! test
9470 Redirect syntax under text isn't considered a redirect
9471 !! wikitext
9472 some text
9473
9474 #redirect [[Main Page]]
9475 !! html/parsoid
9476 <p>some text</p>
9477 <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>
9478 !! end
9479
9480 !! test
9481 New redirect
9482 !! options
9483 parsoid=html2wt
9484 !! html/parsoid
9485 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9486 !! wikitext
9487 #REDIRECT [[Foo]]
9488 Foo
9489 !! end
9490
9491 !! test
9492 Redirect followed by block on the same line
9493 !! options
9494 parsoid=wt2html
9495 !! wikitext
9496 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9497 !! html/parsoid
9498 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9499 !! end
9500
9501 !! test
9502 Redirect followed by a newline
9503 !! wikitext
9504 #REDIRECT [[Main Page]]
9505 A newline
9506 !! html/parsoid
9507 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9508 <p>A newline</p>
9509 !! end
9510
9511 !! test
9512 Redirect followed by multiple newlines
9513 !! wikitext
9514 #REDIRECT [[Main Page]]
9515
9516
9517 A newline
9518 !! html/parsoid
9519 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9520
9521 <p><br/>
9522 A newline</p>
9523 !! end
9524
9525 !! test
9526 Drop duplicate redirects
9527 !! options
9528 parsoid=html2wt
9529 !! html/parsoid
9530 <link rel="mw:PageProp/redirect" href="./Foo"/>
9531 <link rel="mw:PageProp/redirect" href="./Bar"/>
9532 <link rel="mw:PageProp/redirect" href="./Baz"/>
9533 !! wikitext
9534 #REDIRECT [[Foo]]
9535 !! end
9536
9537 ##
9538 ## XHTML tidiness
9539 ###
9540
9541 !! test
9542 <br> to <br />
9543 !! wikitext
9544 1<br>2<br />3
9545 !! html
9546 <p>1<br />2<br />3
9547 </p>
9548 !! end
9549
9550 !! test
9551 Broken br tag sanitization
9552 !! wikitext
9553 </br>
9554 !! html/php
9555 <p>&lt;/br&gt;
9556 </p>
9557 !! end
9558
9559 # TODO: Fix html2html mode (T53055)!
9560 !! test
9561 Parsoid: Broken br tag recognition
9562 !! options
9563 parsoid=wt2html
9564 !! wikitext
9565 </br>
9566
9567 <br/ >
9568 !! html+tidy
9569 <p><br />
9570 </p><p><br />
9571 </p>
9572 !! end
9573
9574 !! test
9575 Incorrecly removing closing slashes from correctly formed XHTML
9576 !! wikitext
9577 <br style="clear:both;" />
9578 !! html
9579 <p><br style="clear:both;" />
9580 </p>
9581 !! end
9582
9583 !! test
9584 Failing to transform badly formed HTML into correct XHTML
9585 !! wikitext
9586 <br style="clear: left;">
9587 <br style="clear: right;">
9588 <br style="clear: both;">
9589 !! html
9590 <p><br style="clear: left;" />
9591 <br style="clear: right;" />
9592 <br style="clear: both;" />
9593 </p>
9594 !!end
9595
9596 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9597 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9598 !! test
9599 Handling html with a div self-closing tag
9600 !! wikitext
9601 <div title />
9602 <div title/>
9603 <div title/ >
9604 <div title=bar />
9605 <div title=bar/>
9606 <div title=bar/ >
9607 !! html/php+tidy
9608 <div title=""></div>
9609 <div title=""></div>
9610 <div title="">
9611 <div title="bar"></div>
9612 <div title="bar"></div>
9613 <div title="bar/"></div></div>
9614 !! html/parsoid
9615 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9616 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9617 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9618 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9619 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9620 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9621 !! end
9622
9623 !! test
9624 Elements with solidus in various attribute positions
9625 !! options
9626 parsoid=wt2html,html2html
9627 !! wikitext
9628 <div cla/ss="123">ha</div>
9629
9630 <div / class="123">ha</div>
9631
9632 <div class= / "123">ha</div>
9633 !! html/php+tidy
9634 <div>ha</div>
9635 <div class="123">ha</div>
9636 <div class="/">ha</div>
9637 !! html/parsoid
9638 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9639
9640 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9641
9642 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9643 !! end
9644
9645 !! test
9646 Handling html with a br self-closing tag
9647 !! wikitext
9648 <br title />
9649 <br title/>
9650 <br title/ >
9651 <br title=bar />
9652 <br title=bar/>
9653 <br title=bar/ >
9654 !! html/php+tidy
9655 <p><br title="" />
9656 <br title="" />
9657 <br title="" />
9658 <br title="bar" />
9659 <br title="bar" />
9660 <br title="bar/" />
9661 </p>
9662 !! html/parsoid
9663 <p><br title="" />
9664 <br title="" />
9665 <br title="" />
9666 <br title="bar" />
9667 <br title="bar" />
9668 <br title="bar/" />
9669 </p>
9670 !! end
9671
9672 !! test
9673 Quoted attributes without spaces
9674 !! options
9675 parsoid=wt2html
9676 !! wikitext
9677 <div class="foo"style="color:red">red</div>
9678 !! html/php+tidy
9679 <div class="foo" style="color:red">red</div>
9680 !! html/parsoid
9681 <div class="foo" style="color:red">red</div>
9682 !! end
9683
9684 !! test
9685 Horizontal ruler (should it add that extra space?)
9686 !! wikitext
9687 <hr>
9688 <hr >
9689 foo <hr
9690 > bar
9691 !! html+tidy
9692 <hr />
9693 <hr /><p>
9694 foo </p><hr /><p> bar</p>
9695 !! end
9696
9697 !! test
9698 Horizontal ruler -- 4+ dashes render hr
9699 !! wikitext
9700 ----
9701 !! html
9702 <hr />
9703 !! end
9704
9705 !! test
9706 Horizontal ruler -- eats additional dashes on the same line
9707 !! wikitext
9708 ---------
9709 !! html
9710 <hr />
9711 !! end
9712
9713 !! test
9714 Horizontal ruler -- does not collapse dashes on consecutive lines
9715 !! wikitext
9716 ----
9717 ----
9718 !! html
9719 <hr />
9720 <hr />
9721 !! end
9722
9723 !! test
9724 Horizontal ruler -- <4 dashes render as plain text
9725 !! wikitext
9726 ---
9727 !! html
9728 <p>---
9729 </p>
9730 !! end
9731
9732 !! test
9733 Horizontal ruler -- Supports content following dashes on same line
9734 !! wikitext
9735 ---- Foo
9736 !! html
9737 <hr /> Foo
9738 !! html+tidy
9739 <hr /><p> Foo</p>
9740 !! end
9741
9742 ###
9743 ### Block-level elements
9744 ###
9745 !! test
9746 Common list
9747 !! wikitext
9748 *Common list
9749 *item 2
9750 *item 3
9751 !! html
9752 <ul><li>Common list</li>
9753 <li>item 2</li>
9754 <li>item 3</li></ul>
9755 !! end
9756
9757 !! test
9758 Numbered list
9759 !! wikitext
9760 #Numbered list
9761 #item 2
9762 #item 3
9763 !! html
9764 <ol><li>Numbered list</li>
9765 <li>item 2</li>
9766 <li>item 3</li></ol>
9767 !! end
9768
9769 # the switch from level 3 to ordered should not introduce a newline between
9770 !! test
9771 Mixed list
9772 !! wikitext
9773 *Mixed list
9774 *#with numbers
9775 **and bullets
9776 *#and numbers
9777 *bullets again
9778 **bullet level 2
9779 ***bullet level 3
9780 ***#Number on level 4
9781 **bullet level 2
9782 **#Number on level 3
9783 **#Number on level 3
9784 *#number level 2
9785 *Level 1
9786 ***Level 3
9787 #**Level 3, but ordered
9788 !! html
9789 <ul><li>Mixed list
9790 <ol><li>with numbers</li></ol>
9791 <ul><li>and bullets</li></ul>
9792 <ol><li>and numbers</li></ol></li>
9793 <li>bullets again
9794 <ul><li>bullet level 2
9795 <ul><li>bullet level 3
9796 <ol><li>Number on level 4</li></ol></li></ul></li>
9797 <li>bullet level 2
9798 <ol><li>Number on level 3</li>
9799 <li>Number on level 3</li></ol></li></ul>
9800 <ol><li>number level 2</li></ol></li>
9801 <li>Level 1
9802 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9803 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9804 !! end
9805
9806 !! test
9807 1. Nested mixed wikitext and html list
9808 !! wikitext
9809 *hi
9810 *<ul><li>ho</li></ul>
9811 *hi
9812 **ho
9813 !! html/php
9814 <ul><li>hi</li>
9815 <li><ul><li>ho</li></ul></li>
9816 <li>hi
9817 <ul><li>ho</li></ul></li></ul>
9818 !! html/parsoid
9819 <ul><li>hi</li>
9820 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9821 <li>hi
9822 <ul><li>ho</li></ul></li></ul>
9823 !! end
9824
9825 !! test
9826 2. Nested mixed wikitext and html list (incompatible)
9827 !! wikitext
9828 ;hi
9829 :{{echo|<li>ho</li>}}
9830 !! html/php
9831 <dl><dt>hi</dt>
9832 <dd><li>ho</li></dd></dl>
9833 !! html/parsoid
9834 <dl><dt>hi</dt>
9835 <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>
9836 !! end
9837
9838 !! test
9839 Nested lists 1
9840 !! wikitext
9841 *foo
9842 **bar
9843 !! html
9844 <ul><li>foo
9845 <ul><li>bar</li></ul></li></ul>
9846 !! end
9847
9848 !! test
9849 Nested lists 2
9850 !! wikitext
9851 **foo
9852 *bar
9853 !! html
9854 <ul><li><ul><li>foo</li></ul></li>
9855 <li>bar</li></ul>
9856 !! end
9857
9858 !! test
9859 Nested lists 3 (first element empty)
9860 !! wikitext
9861 *
9862 **bar
9863 !! html
9864 <ul><li>
9865 <ul><li>bar</li></ul></li></ul>
9866 !! end
9867
9868 !! test
9869 Nested lists 4 (first element empty)
9870 !! wikitext
9871 **
9872 *bar
9873 !! html
9874 <ul><li><ul><li></li></ul></li>
9875 <li>bar</li></ul>
9876 !! end
9877
9878 !! test
9879 Nested lists 5 (both elements empty)
9880 !! wikitext
9881 **
9882 *
9883 !! html
9884 <ul><li><ul><li></li></ul></li>
9885 <li></li></ul>
9886 !! end
9887
9888 !! test
9889 Nested lists 6 (both elements empty)
9890 !! wikitext
9891 *
9892 **
9893 !! html
9894 <ul><li>
9895 <ul><li></li></ul></li></ul>
9896 !! end
9897
9898 !! test
9899 Nested lists 7 (skip initial nesting levels)
9900 !! wikitext
9901 ***foo
9902 !! html
9903 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9904 !! end
9905
9906 !! test
9907 Nested lists 8 (multiple nesting transitions)
9908 !! wikitext
9909 *foo
9910 ***bar
9911 **baz
9912 *boo
9913 !! html
9914 <ul><li>foo
9915 <ul><li><ul><li>bar</li></ul></li>
9916 <li>baz</li></ul></li>
9917 <li>boo</li></ul>
9918 !! end
9919
9920 # XXX this test should be moved to citeParserTests, since it depends
9921 # on the Cite extension, which is "built in" to Parsoid.
9922 !! test
9923 Nested lists 9 (extension interaction)
9924 !! wikitext
9925 *<references />
9926 !! html/php+tidy-DISABLED
9927 <ul><li class="mw-empty-elt"></li></ul>
9928 !! html/parsoid
9929 <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>
9930 !! end
9931
9932 !! test
9933 1. Lists with start-of-line-transparent tokens before bullets: Comments
9934 !! wikitext
9935 *foo
9936 *<!--cmt-->bar
9937 <!--cmt-->*baz
9938 !! html
9939 <ul><li>foo</li>
9940 <li>bar</li>
9941 <li>baz</li></ul>
9942 !! end
9943
9944 !! test
9945 Nested lists 10 (list and span siblings: wt2wt regression)
9946 !! wikitext
9947 *a <span>x</span>
9948 **b <span>y</span>
9949 !! html/parsoid
9950 <ul><li>a <span>x</span>
9951 <ul><li>b <span>y</span></li></ul></li></ul>
9952 !! end
9953
9954 !! test
9955 2. Lists with start-of-line-transparent tokens before bullets: Template close
9956 !! wikitext
9957 *foo {{echo|bar
9958 }}*baz
9959 !! html
9960 <ul><li>foo bar</li>
9961 <li>baz</li></ul>
9962 !! end
9963
9964 !! test
9965 List items are not parsed correctly following a <pre> block (T2785)
9966 !! wikitext
9967 *<pre>foo</pre>
9968 *<pre>bar</pre>
9969 *zar
9970 !! html/php
9971 <ul><li><pre>foo</pre></li>
9972 <li><pre>bar</pre></li>
9973 <li>zar</li></ul>
9974 !! html/parsoid
9975 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9976 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9977 <li>zar</li></ul>
9978 !! end
9979
9980 # FIXME: Might benefit from a html/parsoid since this has a template
9981 !! test
9982 List items from template
9983 !! wikitext
9984
9985 {{inner list}}
9986 *item 2
9987
9988 *item 0
9989 {{inner list}}
9990 *item 2
9991
9992 *item 0
9993 *notSOL{{inner list}}
9994 *item 2
9995 !! html
9996 <ul><li>item 1</li>
9997 <li>item 2</li></ul>
9998 <ul><li>item 0</li>
9999 <li>item 1</li>
10000 <li>item 2</li></ul>
10001 <ul><li>item 0</li>
10002 <li>notSOL</li>
10003 <li>item 1</li>
10004 <li>item 2</li></ul>
10005 !! end
10006
10007 !! test
10008 List interrupted by empty line or heading
10009 !! wikitext
10010 *foo
10011
10012 **bar
10013 ==A heading==
10014 *Another list item
10015 !! html
10016 <ul><li>foo</li></ul>
10017 <ul><li><ul><li>bar</li></ul></li></ul>
10018 <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>
10019 <ul><li>Another list item</li></ul>
10020 !!end
10021
10022 !! test
10023 Multiple list tags generated by templates
10024 !! wikitext
10025 {{echo|<li>}}a
10026 {{echo|<li>}}b
10027 {{echo|<li>}}c
10028 !! html
10029 <li>a
10030 <li>b
10031 <li>c</li>
10032 </li>
10033 </li>
10034
10035 !! html+tidy
10036 <li>a
10037 </li><li>b
10038 </li><li>c</li>
10039 !! html/parsoid
10040 <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>
10041 <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>
10042 <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>
10043 !! end
10044
10045 !! test
10046 Multiple newlines in between HTML list items don't induce paragraph wrapping
10047 !! wikitext
10048 <ul>
10049 <li>hi</li>
10050
10051
10052
10053
10054 <li>ho</li>
10055 </ul>
10056
10057 <dl>
10058 <dt>hi</dt>
10059 <dd>ho<div>123</div>
10060 </dd>
10061
10062
10063 </dl>
10064 !! html/php+tidy
10065 <ul>
10066 <li>hi</li>
10067
10068
10069
10070
10071 <li>ho</li>
10072 </ul>
10073 <dl>
10074 <dt>hi</dt>
10075 <dd>ho<div>123</div>
10076 </dd>
10077
10078
10079 </dl>
10080 !! end
10081
10082 !!test
10083 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10084 !! wikitext
10085 *a
10086 <!--This line will NOT split the list-->
10087 *b
10088 <!--This line will NOT split the list either-->
10089 *c
10090 <!--foo--> <!----> <!--This line NOT split the list either-->
10091 *d
10092 !! html
10093 <ul><li>a</li>
10094 <li>b</li>
10095 <li>c</li>
10096 <li>d</li></ul>
10097 !!end
10098
10099 !!test
10100 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10101 !! wikitext
10102 *a
10103 <!--This line will NOT split the list-->
10104 *b
10105 <!--This line will NOT split the list either-->
10106 *c
10107 <!--foo--> <!----> <!--This line NOT split the list
10108 either-->
10109 *d
10110 !! html
10111 <ul><li>a</li>
10112 <li>b</li>
10113 <li>c</li>
10114 <li>d</li></ul>
10115 !!end
10116
10117 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10118 # That pass could possibly be removed.
10119 !!test
10120 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10121 !!options
10122 parsoid=wt2html,wt2wt
10123 !! wikitext
10124 *foo
10125 *<li>li-hack
10126 *{{echo|<li>templated li-hack}}
10127 *<!--foo--><li> unsupported li-hack with preceding comments
10128
10129 <ul>
10130 <li><li>not a li-hack
10131 </li>
10132 </ul>
10133 !! html+tidy
10134 <ul><li>foo</li>
10135 <li class="mw-empty-elt"></li><li>li-hack</li>
10136 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10137 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10138 <ul>
10139 <li class="mw-empty-elt"></li><li>not a li-hack
10140 </li>
10141 </ul>
10142 !! html/parsoid
10143 <ul><li> foo</li>
10144 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10145 <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>
10146 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10147
10148 <ul data-parsoid='{"stx":"html"}'>
10149 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10150 </li>
10151 </ul>
10152 !! end
10153
10154 !! test
10155 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10156 !! wikitext
10157 #foo
10158 ##bar
10159
10160 *foo
10161 **bar
10162
10163 :foo
10164 ::bar
10165 !! html/php+tidy
10166 <ol><li>foo
10167 <ol><li>bar</li></ol></li></ol>
10168 <ul><li>foo
10169 <ul><li>bar</li></ul></li></ul>
10170 <dl><dd>foo
10171 <dl><dd>bar</dd></dl></dd></dl>
10172 !! html/parsoid
10173 <ol>
10174 <li>foo<ol>
10175 <li>bar</li>
10176 </ol></li>
10177 </ol><ul>
10178 <li>foo<ul>
10179 <li>bar</li>
10180 </ul></li>
10181 </ul><dl>
10182 <dd>foo<dl>
10183 <dd>bar</dd>
10184 </dl></dd>
10185 </dl>
10186 !! end
10187
10188 !! test
10189 Parsoid: Test of whitespace serialization with Templated bullets
10190 !! options
10191 parsoid=wt2html
10192 !! wikitext
10193 * {{bullet}}
10194 !! html/parsoid
10195 <ul>
10196 <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>
10197 </ul>
10198 !! end
10199
10200 # ------------------------------------------------------------------------
10201 # The next set of tests are about Parsoid's ability to handle badly nested
10202 # tags (parse, minimize scope of fixup, and roundtrip back)
10203 # ------------------------------------------------------------------------
10204
10205 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10206 # Parsoid's list handling is more aware of block structure.
10207 !! test
10208 Unbalanced closing block tags break a list
10209 !! wikitext
10210 <div>
10211 *a</div><div>
10212 *b</div>
10213 !! html+tidy
10214 <div>
10215 <ul><li>a</li></ul></div><div>
10216 <li>b</li></div>
10217 !! html/parsoid
10218 <div><ul>
10219 <li>a</li>
10220 </ul></div>
10221 <div><ul>
10222 <li>b</li>
10223 </ul></div>
10224 !! end
10225
10226 !! test
10227 Unbalanced closing non-block tags don't break a list
10228 !! options
10229 parsoid=wt2html,html2html
10230 !! wikitext
10231 <span>
10232 *a</span><span>
10233 *b</span>
10234 !! html/php+tidy
10235 <p><span>
10236 </span></p>
10237 <ul><li>a<span></span></li>
10238 <li>b</li></ul>
10239 !! html/parsoid
10240 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10241 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10242 <li>b</li></ul>
10243 !! end
10244
10245 # Parsoid does some post-dom-building cleanup
10246 # which is why its output differs from Remex.
10247 !! test
10248 Unclosed formatting tags that straddle lists are closed and reopened
10249 !! options
10250 parsoid=wt2html,wt2wt,html2html
10251 !! wikitext
10252 #<s> a
10253 #b </s>
10254 !! html/php+tidy
10255 <ol><li><s> a</s></li><s>
10256 </s><li><s>b </s></li></ol>
10257 !! html/parsoid
10258 <ol><li><s> a</s></li>
10259 <li><s>b </s></li></ol>
10260 !! end
10261
10262 # Output is ugly because of all the misnested tag fixups.
10263 !! test
10264 1. List embedded in a formatting tag
10265 !! wikitext
10266 <small>
10267 *foo
10268 </small>
10269 !! html/php+tidy
10270 <p><small>
10271 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10272 </p>
10273 !! html/parsoid
10274 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10275 <ul><li data-parsoid='{}'>foo</li></ul></small>
10276 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10277 !! end
10278
10279 # Output is ugly because of all the misnested tag fixups.
10280 !! test
10281 2. List embedded in a formatting tag in a misnested way
10282 !! wikitext
10283 <small>
10284 *a
10285 *b</small>
10286 !! html/php+tidy
10287 <p><small>
10288 </small></p><small></small><ul><small><li>a</li>
10289 </small><li><small>b</small></li></ul>
10290 !! html/parsoid
10291 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10292 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10293 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10294 !! end
10295
10296 # Output is ugly because of all the misnested tag fixups.
10297 !! test
10298 3. List embedded in a formatting tag in a misnested way
10299 !! wikitext
10300 <small>
10301
10302 ** 123</small>
10303 !! html/php+tidy
10304 <p><small>
10305 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10306 !! html/parsoid
10307 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10308
10309 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10310 !! end
10311
10312 ###
10313 ### Magic Words
10314 ###
10315
10316 # Note that the current date is hard-coded as
10317 # 1970-01-01T00:02:03Z (a Thursday)
10318 # when running parser tests. The timezone is also fixed to GMT, so
10319 # local date will be identical to current date.
10320
10321 !! test
10322 Magic Word: {{CURRENTDAY}}
10323 !! wikitext
10324 {{CURRENTDAY}}
10325 !! html
10326 <p>1
10327 </p>
10328 !! end
10329
10330 !! test
10331 Magic Word: {{CURRENTDAY2}}
10332 !! wikitext
10333 {{CURRENTDAY2}}
10334 !! html
10335 <p>01
10336 </p>
10337 !! end
10338
10339 !! test
10340 Magic Word: {{CURRENTDAYNAME}}
10341 !! wikitext
10342 {{CURRENTDAYNAME}}
10343 !! html
10344 <p>Thursday
10345 </p>
10346 !! end
10347
10348 !! test
10349 Magic Word: {{CURRENTDOW}}
10350 !! wikitext
10351 {{CURRENTDOW}}
10352 !! html
10353 <p>4
10354 </p>
10355 !! end
10356
10357 !! test
10358 Magic Word: {{CURRENTMONTH}}
10359 !! wikitext
10360 {{CURRENTMONTH}}
10361 !! html
10362 <p>01
10363 </p>
10364 !! end
10365
10366 !! test
10367 Magic Word: {{CURRENTMONTH1}}
10368 !! wikitext
10369 {{CURRENTMONTH1}}
10370 !! html
10371 <p>1
10372 </p>
10373 !! end
10374
10375 !! test
10376 Magic Word: {{CURRENTMONTHABBREV}}
10377 !! wikitext
10378 {{CURRENTMONTHABBREV}}
10379 !! html
10380 <p>Jan
10381 </p>
10382 !! end
10383
10384 !! test
10385 Magic Word: {{CURRENTMONTHNAME}}
10386 !! wikitext
10387 {{CURRENTMONTHNAME}}
10388 !! html
10389 <p>January
10390 </p>
10391 !! end
10392
10393 !! test
10394 Magic Word: {{CURRENTMONTHNAMEGEN}}
10395 !! wikitext
10396 {{CURRENTMONTHNAMEGEN}}
10397 !! html
10398 <p>January
10399 </p>
10400 !! end
10401
10402 !! test
10403 Magic Word: {{CURRENTTIME}}
10404 !! wikitext
10405 {{CURRENTTIME}}
10406 !! html
10407 <p>00:02
10408 </p>
10409 !! end
10410
10411 !! test
10412 Magic Word: {{CURRENTHOUR}}
10413 !! wikitext
10414 {{CURRENTHOUR}}
10415 !! html
10416 <p>00
10417 </p>
10418 !! end
10419
10420 !! test
10421 Magic Word: {{CURRENTWEEK}} (T6594)
10422 !! wikitext
10423 {{CURRENTWEEK}}
10424 !! html
10425 <p>1
10426 </p>
10427 !! end
10428
10429 !! test
10430 Magic Word: {{CURRENTYEAR}}
10431 !! wikitext
10432 {{CURRENTYEAR}}
10433 !! html
10434 <p>1970
10435 </p>
10436 !! end
10437
10438 !! test
10439 Magic Word: {{CURRENTTIMESTAMP}}
10440 !! wikitext
10441 {{CURRENTTIMESTAMP}}
10442 !! html
10443 <p>19700101000203
10444 </p>
10445 !! end
10446
10447 !! test
10448 Magic Words LOCAL (UTC)
10449 !! wikitext
10450 *{{LOCALMONTH}}
10451 *{{LOCALMONTH1}}
10452 *{{LOCALMONTHNAME}}
10453 *{{LOCALMONTHNAMEGEN}}
10454 *{{LOCALMONTHABBREV}}
10455 *{{LOCALDAY}}
10456 *{{LOCALDAY2}}
10457 *{{LOCALDAYNAME}}
10458 *{{LOCALYEAR}}
10459 *{{LOCALTIME}}
10460 *{{LOCALHOUR}}
10461 *{{LOCALWEEK}}
10462 *{{LOCALDOW}}
10463 *{{LOCALTIMESTAMP}}
10464 !! html
10465 <ul><li>01</li>
10466 <li>1</li>
10467 <li>January</li>
10468 <li>January</li>
10469 <li>Jan</li>
10470 <li>1</li>
10471 <li>01</li>
10472 <li>Thursday</li>
10473 <li>1970</li>
10474 <li>00:02</li>
10475 <li>00</li>
10476 <li>1</li>
10477 <li>4</li>
10478 <li>19700101000203</li></ul>
10479 !! end
10480
10481 !! test
10482 Magic Word: {{FULLPAGENAME}}
10483 !! options
10484 title=[[User:Ævar Arnfjörð Bjarmason]]
10485 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10486 !! wikitext
10487 {{FULLPAGENAME}}
10488 !! html/*
10489 <p>User:Ævar Arnfjörð Bjarmason
10490 </p>
10491 !! end
10492
10493 !! test
10494 Magic Word: {{FULLPAGENAMEE}}
10495 !! options
10496 title=[[User:Ævar Arnfjörð Bjarmason]]
10497 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10498 !! wikitext
10499 {{FULLPAGENAMEE}}
10500 !! html/*
10501 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10502 </p>
10503 !! end
10504
10505 !! test
10506 Magic Word: {{TALKSPACE}}
10507 !! options
10508 title=[[User:Ævar Arnfjörð Bjarmason]]
10509 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10510 !! wikitext
10511 {{TALKSPACE}}
10512 !! html/*
10513 <p>User talk
10514 </p>
10515 !! end
10516
10517 !! test
10518 Magic Word: {{TALKSPACE}}, same namespace
10519 !! options
10520 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10521 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10522 !! wikitext
10523 {{TALKSPACE}}
10524 !! html/*
10525 <p>User talk
10526 </p>
10527 !! end
10528
10529 !! test
10530 Magic Word: {{TALKSPACE}}, main namespace
10531 !! options
10532 title=[[Parser Test]]
10533 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10534 !! wikitext
10535 {{TALKSPACE}}
10536 !! html/*
10537 <p>Talk
10538 </p>
10539 !! end
10540
10541 !! test
10542 Magic Word: {{TALKSPACEE}}
10543 !! options
10544 title=[[User:Ævar Arnfjörð Bjarmason]]
10545 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10546 !! wikitext
10547 {{TALKSPACEE}}
10548 !! html/*
10549 <p>User_talk
10550 </p>
10551 !! end
10552
10553 !! test
10554 Magic Word: {{SUBJECTSPACE}}
10555 !! options
10556 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10557 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10558 !! wikitext
10559 {{SUBJECTSPACE}}
10560 !! html/*
10561 <p>User
10562 </p>
10563 !! end
10564
10565 !! test
10566 Magic Word: {{SUBJECTSPACE}}, same namespace
10567 !! options
10568 title=[[User:Ævar Arnfjörð Bjarmason]]
10569 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10570 !! wikitext
10571 {{SUBJECTSPACE}}
10572 !! html/*
10573 <p>User
10574 </p>
10575 !! end
10576
10577 !! test
10578 Magic Word: {{SUBJECTSPACE}}, main namespace
10579 !! options
10580 title=[[Parser Test]]
10581 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10582 !! wikitext
10583 {{SUBJECTSPACE}}
10584 !! html/*
10585 !! end
10586
10587 !! test
10588 Magic Word: {{SUBJECTSPACEE}}
10589 !! options
10590 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10591 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10592 !! wikitext
10593 {{SUBJECTSPACEE}}
10594 !! html/*
10595 <p>User
10596 </p>
10597 !! end
10598
10599 !! test
10600 Magic Word: {{NAMESPACE}}
10601 !! options
10602 title=[[User:Ævar Arnfjörð Bjarmason]]
10603 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10604 !! wikitext
10605 {{NAMESPACE}}
10606 !! html/*
10607 <p>User
10608 </p>
10609 !! end
10610
10611 !! test
10612 Magic Word: {{NAMESPACEE}}
10613 !! options
10614 title=[[User:Ævar Arnfjörð Bjarmason]]
10615 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10616 !! wikitext
10617 {{NAMESPACEE}}
10618 !! html/*
10619 <p>User
10620 </p>
10621 !! end
10622
10623 !! test
10624 Magic Word: {{NAMESPACENUMBER}}
10625 !! options
10626 title=[[User:Ævar Arnfjörð Bjarmason]]
10627 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10628 !! wikitext
10629 {{NAMESPACENUMBER}}
10630 !! html/*
10631 <p>2
10632 </p>
10633 !! end
10634
10635 !! test
10636 Magic Word: {{SUBPAGENAME}}
10637 !! options
10638 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10639 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10640 !! wikitext
10641 {{SUBPAGENAME}}
10642 !! html/*
10643 <p>sub ö
10644 </p>
10645 !! end
10646
10647 !! test
10648 Magic Word: {{SUBPAGENAMEE}}
10649 !! options
10650 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10651 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10652 !! wikitext
10653 {{SUBPAGENAMEE}}
10654 !! html/*
10655 <p>sub_%C3%B6
10656 </p>
10657 !! end
10658
10659 !! test
10660 Magic Word: {{ROOTPAGENAME}}
10661 !! options
10662 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10663 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10664 !! wikitext
10665 {{ROOTPAGENAME}}
10666 !! html/*
10667 <p>Ævar Arnfjörð Bjarmason
10668 </p>
10669 !! end
10670
10671 !! test
10672 Magic Word: {{ROOTPAGENAMEE}}
10673 !! options
10674 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10675 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10676 !! wikitext
10677 {{ROOTPAGENAMEE}}
10678 !! html/*
10679 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10680 </p>
10681 !! end
10682
10683 !! test
10684 Magic Word: {{BASEPAGENAME}}
10685 !! options
10686 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10687 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10688 !! wikitext
10689 {{BASEPAGENAME}}
10690 !! html/*
10691 <p>Ævar Arnfjörð Bjarmason
10692 </p>
10693 !! end
10694
10695 !! test
10696 Magic Word: {{BASEPAGENAMEE}}
10697 !! options
10698 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10699 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10700 !! wikitext
10701 {{BASEPAGENAMEE}}
10702 !! html/*
10703 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10704 </p>
10705 !! end
10706
10707 !! test
10708 Magic Word: {{TALKPAGENAME}}
10709 !! options
10710 title=[[User:Ævar Arnfjörð Bjarmason]]
10711 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10712 !! wikitext
10713 {{TALKPAGENAME}}
10714 !! html/*
10715 <p>User talk:Ævar Arnfjörð Bjarmason
10716 </p>
10717 !! end
10718
10719 !! test
10720 Magic Word: {{TALKPAGENAMEE}}
10721 !! options
10722 title=[[User:Ævar Arnfjörð Bjarmason]]
10723 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10724 !! wikitext
10725 {{TALKPAGENAMEE}}
10726 !! html/*
10727 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10728 </p>
10729 !! end
10730
10731 !! test
10732 Magic Word: {{SUBJECTPAGENAME}}
10733 !! options
10734 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10735 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10736 !! wikitext
10737 {{SUBJECTPAGENAME}}
10738 !! html/*
10739 <p>User:Ævar Arnfjörð Bjarmason
10740 </p>
10741 !! end
10742
10743 !! test
10744 Magic Word: {{SUBJECTPAGENAMEE}}
10745 !! options
10746 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10747 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10748 !! wikitext
10749 {{SUBJECTPAGENAMEE}}
10750 !! html/*
10751 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10752 </p>
10753 !! end
10754
10755 !! test
10756 Magic Word: {{NUMBEROFFILES}}
10757 !! options
10758 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10759 !! wikitext
10760 {{NUMBEROFFILES}}
10761 !! html/*
10762 <p>7
10763 </p>
10764 !! end
10765
10766 !! test
10767 Magic Word: {{PAGENAME}}
10768 !! options
10769 title=[[User:Ævar Arnfjörð Bjarmason]]
10770 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10771 !! wikitext
10772 {{PAGENAME}}
10773 !! html/*
10774 <p>Ævar Arnfjörð Bjarmason
10775 </p>
10776 !! end
10777
10778 !! test
10779 Magic Word: {{PAGENAME}} with metacharacters
10780 !! options
10781 title=[['foo & bar = baz']]
10782 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10783 !! wikitext
10784 ''{{PAGENAME}}''
10785 !! html+tidy
10786 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10787 </p>
10788 !! end
10789
10790 !! test
10791 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10792 !! options
10793 title=[[*RFC 1234 http://example.com/]]
10794 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10795 !! wikitext
10796 {{PAGENAME}}
10797 !! html+tidy
10798 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10799 </p>
10800 !! end
10801
10802 !! test
10803 Magic Word: {{PAGENAMEE}}
10804 !! options
10805 title=[[User:Ævar Arnfjörð Bjarmason]]
10806 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10807 !! wikitext
10808 {{PAGENAMEE}}
10809 !! html/*
10810 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10811 </p>
10812 !! end
10813
10814 !! test
10815 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10816 !! options
10817 title=[[*RFC 1234 http://example.com/]]
10818 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10819 !! wikitext
10820 {{PAGENAMEE}}
10821 !! html+tidy
10822 <p>&#42;RFC_1234_http&#58;//example.com/
10823 </p>
10824 !! end
10825
10826 !! test
10827 Magic Word: {{REVISIONID}} on latest revision
10828 !! options
10829 lastsavedrevision
10830 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10831 showflags
10832 !! wikitext
10833 {{REVISIONID}}
10834 !! html/*
10835 <p>1337
10836 </p>
10837 flags=vary-revision-id
10838 !! end
10839
10840 !! test
10841 Magic Word: {{REVISIONID}} on non-latest revision
10842 !! options
10843 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10844 showflags
10845 !! wikitext
10846 {{REVISIONID}}
10847 !! html/*
10848 <p>1337
10849 </p>
10850 flags=vary-revision-id
10851 !! end
10852
10853 !! test
10854 Magic Word: {{REVISIONTIMESTAMP}} on latest revision
10855 !! options
10856 lastsavedrevision
10857 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10858 showflags
10859 !! wikitext
10860 {{REVISIONTIMESTAMP}}
10861 !! html/*
10862 <p>19700101000203
10863 </p>
10864 flags=
10865 !! end
10866
10867 !! test
10868 Magic Word: {{REVISIONTIMESTAMP}} on non-existing page
10869 !! options
10870 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10871 showflags
10872 !! wikitext
10873 {{REVISIONTIMESTAMP}}
10874 !! html/*
10875 <p>123
10876 </p>
10877 flags=vary-revision-timestamp
10878 !! end
10879
10880 !! test
10881 Magic Word: {{REVISIONUSER}} on latest revision
10882 !! options
10883 lastsavedrevision
10884 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10885 showflags
10886 !! wikitext
10887 {{REVISIONUSER}}
10888 !! html/*
10889 <p>127.0.0.1
10890 </p>
10891 flags=vary-user
10892 !! end
10893
10894 !! test
10895 Parser Function: {{REVISIONID:{{PAGENAME}}}} on latest revision
10896 !! options
10897 lastsavedrevision
10898 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10899 showflags
10900 !! wikitext
10901 {{REVISIONID:{{PAGENAME}}}}
10902 !! html/*
10903 <p>1337
10904 </p>
10905 flags=vary-revision-id
10906 !! end
10907
10908 !! test
10909 Parser Function: {{REVISIONID:{{PAGENAME}}}} on non-saved revision
10910 !! options
10911 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10912 showflags
10913 !! wikitext
10914 {{REVISIONID:{{PAGENAME}}}}
10915 !! html/*
10916
10917 flags=vary-revision-id
10918 !! end
10919
10920 !! test
10921 Parser Function: {{REVISIONTIMESTAMP:{{PAGENAME}}}} on latest revision
10922 !! options
10923 lastsavedrevision
10924 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10925 showflags
10926 !! wikitext
10927 {{REVISIONTIMESTAMP:{{PAGENAME}}}}
10928 !! html/*
10929 <p>19700101000203
10930 </p>
10931 flags=vary-revision-timestamp
10932 !! end
10933
10934 !! test
10935 Parser Function: {{REVISIONDAY:{{PAGENAME}}}} on latest revision
10936 !! options
10937 lastsavedrevision
10938 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10939 showflags
10940 !! wikitext
10941 {{REVISIONDAY:{{PAGENAME}}}}
10942 !! html/*
10943 <p>1
10944 </p>
10945 flags=vary-revision-timestamp
10946 !! end
10947
10948 !! test
10949 Parser Function: {{REVISIONMONTH:{{PAGENAME}}}} on latest revision
10950 !! options
10951 lastsavedrevision
10952 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10953 showflags
10954 !! wikitext
10955 {{REVISIONMONTH:{{PAGENAME}}}}
10956 !! html/*
10957 <p>01
10958 </p>
10959 flags=vary-revision-timestamp
10960 !! end
10961
10962 !! test
10963 Parser Function: {{REVISIONYEAR:{{PAGENAME}}}} on latest revision
10964 !! options
10965 lastsavedrevision
10966 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10967 showflags
10968 !! wikitext
10969 {{REVISIONYEAR:{{PAGENAME}}}}
10970 !! html/*
10971 <p>1970
10972 </p>
10973 flags=vary-revision-timestamp
10974 !! end
10975
10976 !! test
10977 Parser Function: {{PAGESIZE:{{PAGENAME}}}} on latest revision
10978 !! options
10979 lastsavedrevision
10980 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10981 showflags
10982 !! wikitext
10983 {{PAGESIZE:{{PAGENAME}}}}
10984 !! html/*
10985 <p>25
10986 </p>
10987 flags=vary-revision-sha1
10988 !! end
10989
10990 !! test
10991 Magic Word: {{SCRIPTPATH}}
10992 !! options
10993 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10994 !! wikitext
10995 {{SCRIPTPATH}}
10996 !! html/*
10997 !! end
10998
10999 !! test
11000 Magic Word: {{STYLEPATH}}
11001 !! options
11002 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11003 !! wikitext
11004 {{STYLEPATH}}
11005 !! html/*
11006 <p>/skins
11007 </p>
11008 !! end
11009
11010 !! test
11011 Magic Word: {{SERVER}}
11012 !! options
11013 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11014 !! wikitext
11015 {{SERVER}}
11016 !! html/*
11017 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11018 </p>
11019 !! end
11020
11021 !! test
11022 Magic Word: {{SERVERNAME}}
11023 !! options
11024 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11025 !! wikitext
11026 {{SERVERNAME}}
11027 !! html/*
11028 <p>example.org
11029 </p>
11030 !! end
11031
11032 !! test
11033 Magic Word: {{SITENAME}}
11034 !! options
11035 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11036 !! wikitext
11037 {{SITENAME}}
11038 !! html/*
11039 <p>MediaWiki
11040 </p>
11041 !! end
11042
11043 !! test
11044 Magic Word: {{PAGELANGUAGE}}
11045 !! options
11046 language=fr
11047 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11048 !! wikitext
11049 {{PAGELANGUAGE}}
11050 !! html/*
11051 <p>fr
11052 </p>
11053 !! end
11054
11055 !! test
11056 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
11057 !! options
11058 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11059 !! wikitext
11060 {{PAGELANGUAGE}}
11061 !! html/*
11062 <p>en
11063 </p>
11064 !! end
11065
11066 !! test
11067 Case-sensitive magic words, when cased differently, should just be template transclusions
11068 !! wikitext
11069 {{CurrentMonth}}
11070 {{currentday}}
11071 {{cURreNTweEK}}
11072 {{currentHour}}
11073 !! html
11074 <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>
11075 <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>
11076 <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>
11077 <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>
11078 </p>
11079 !! end
11080
11081 !! test
11082 Case-insensitive magic words should still work with weird casing.
11083 !! wikitext
11084 {{sErVeRNaMe}}
11085 {{LCFirst:AOEU}}
11086 {{ucFIRST:aoeu}}
11087 {{SERver}}
11088 !! html
11089 <p>example.org
11090 aOEU
11091 Aoeu
11092 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11093 </p>
11094 !! end
11095
11096 # From plwiki:PLOS_ONE
11097 !! test
11098 Parsoid: Page property magic word with magic word contents
11099 !! options
11100 showtitle
11101 !! config
11102 wgAllowDisplayTitle=true
11103 wgRestrictDisplayTitle=false
11104 !! wikitext
11105 {{DISPLAYTITLE:''{{PAGENAME}}''}}
11106 !! html/php+tidy
11107 <i>Parser test</i>
11108
11109 !! html/parsoid
11110 <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>"}]]}'/>
11111 !! end
11112
11113 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
11114 # But, this is a limitation of our representation and is documented in
11115 # TemplateHandler.js in processSpecialMagicWord
11116 !! test
11117 Parsoid: Template-generated DISPLAYTITLE
11118 !! wikitext
11119 {{{{echo|DISPLAYTITLE}}:Foo}}
11120 !! options
11121 showtitle
11122 !! config
11123 wgAllowDisplayTitle=true
11124 wgRestrictDisplayTitle=false
11125 !! html/php
11126 Foo
11127
11128 !! html/parsoid
11129 <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"}]]}'/>
11130 !! end
11131
11132 !! test
11133 Namespace 1 {{ns:1}}
11134 !! wikitext
11135 {{ns:1}}
11136 !! html
11137 <p>Talk
11138 </p>
11139 !! end
11140
11141 !! test
11142 Namespace 1 {{ns:01}}
11143 !! wikitext
11144 {{ns:01}}
11145 !! html
11146 <p>Talk
11147 </p>
11148 !! end
11149
11150 !! test
11151 Namespace 0 {{ns:0}} (T6783)
11152 !! wikitext
11153 {{ns:0}}
11154 !! html
11155 !! end
11156
11157 !! test
11158 Namespace 0 {{ns:00}} (T6783)
11159 !! wikitext
11160 {{ns:00}}
11161 !! html
11162 !! end
11163
11164 !! test
11165 Namespace -1 {{ns:-1}}
11166 !! wikitext
11167 {{ns:-1}}
11168 !! html
11169 <p>Special
11170 </p>
11171 !! end
11172
11173 !! test
11174 Namespace User {{ns:User}}
11175 !! wikitext
11176 {{ns:User}}
11177 !! html
11178 <p>User
11179 </p>
11180 !! end
11181
11182 !! test
11183 Namespace User talk {{ns:User_talk}}
11184 !! wikitext
11185 {{ns:User_talk}}
11186 !! html
11187 <p>User talk
11188 </p>
11189 !! end
11190
11191 !! test
11192 Namespace User talk {{ns:uSeR tAlK}}
11193 !! wikitext
11194 {{ns:uSeR tAlK}}
11195 !! html
11196 <p>User talk
11197 </p>
11198 !! end
11199
11200 !! test
11201 Namespace File {{ns:File}}
11202 !! wikitext
11203 {{ns:File}}
11204 !! html
11205 <p>File
11206 </p>
11207 !! end
11208
11209 !! test
11210 Namespace File {{ns:Image}}
11211 !! wikitext
11212 {{ns:Image}}
11213 !! html
11214 <p>File
11215 </p>
11216 !! end
11217
11218 !! test
11219 Namespace (lang=de) Benutzer {{ns:User}}
11220 !! options
11221 language=de
11222 !! wikitext
11223 {{ns:User}}
11224 !! html
11225 <p>Benutzer
11226 </p>
11227 !! end
11228
11229 !! test
11230 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11231 !! options
11232 language=de
11233 !! wikitext
11234 {{ns:3}}
11235 !! html
11236 <p>Benutzer Diskussion
11237 </p>
11238 !! end
11239
11240 !! test
11241 Urlencode
11242 !! wikitext
11243 {{urlencode:hi world?!}}
11244 {{urlencode:hi world?!|WIKI}}
11245 {{urlencode:hi world?!|PATH}}
11246 {{urlencode:hi world?!|QUERY}}
11247 !! html/php
11248 <p>hi+world%3F%21
11249 hi_world%3F!
11250 hi%20world%3F%21
11251 hi+world%3F%21
11252 </p>
11253 !! end
11254
11255 !! test
11256 Magic Word: prioritize type info over data-parsoid
11257 !! options
11258 parsoid=html2wt
11259 !! html/parsoid
11260 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11261 !! wikitext
11262 __FORCETOC__
11263 !! end
11264
11265 !! test
11266 Magic Word: serialize on separate line (parsoid)
11267 !! options
11268 parsoid=wt2wt,html2wt
11269 !! wikitext
11270 foo
11271 __NOTOC__
11272 bar
11273 !! html/parsoid
11274 foo<meta property="mw:PageProp/notoc"/>bar
11275 !! end
11276
11277 !! test
11278 Magic Word: rt non-english wikis
11279 !! options
11280 parsoid=wt2wt
11281 language=de
11282 !! wikitext
11283 __NOEDITSECTION__
11284 !! html/parsoid
11285 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11286 !! end
11287
11288 !!test
11289 __proto__ is treated as normal wikitext (T105997)
11290 !!wikitext
11291 __proto__
11292 !!html
11293 <p>__proto__
11294 </p>
11295 !!end
11296
11297 ###
11298 ### Magic links
11299 ###
11300 !! test
11301 Magic links: internal link to RFC (T2479)
11302 !! wikitext
11303 [[RFC 123]]
11304 !! html/php
11305 <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>
11306 </p>
11307 !! html/parsoid
11308 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11309 !! end
11310
11311 !! test
11312 Magic links: RFC (T2479)
11313 !! wikitext
11314 RFC 822
11315 !! html/php
11316 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11317 </p>
11318 !! html/parsoid
11319 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11320 !! end
11321
11322 !! test
11323 Magic links: RFC (T67278)
11324 !! wikitext
11325 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11326 !! html/php
11327 <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.
11328 </p>
11329 !! html/parsoid
11330 <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>
11331 !! end
11332
11333 !! test
11334 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11335 !! wikitext
11336 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11337 RFC
11338 822
11339 !! html/php
11340 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11341 RFC
11342 822
11343 </p>
11344 !! html/parsoid
11345 <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>
11346 RFC
11347 822</p>
11348 !! end
11349
11350 !! test
11351 Magic links: ISBN (T3937)
11352 !! wikitext
11353 ISBN 0-306-40615-2
11354 !! html/php
11355 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11356 </p>
11357 !! html/parsoid
11358 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11359 !! end
11360
11361 !! test
11362 Magic links: ISBN (T67278)
11363 !! wikitext
11364 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11365 !! html/php
11366 <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.
11367 </p>
11368 !! html/parsoid
11369 <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>
11370 !! end
11371
11372 !! test
11373 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11374 !! wikitext
11375 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11376 ISBN
11377 9780316098113
11378 ISBN 978
11379 0316098113
11380 !! html/php
11381 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11382 ISBN
11383 9780316098113
11384 ISBN 978
11385 0316098113
11386 </p>
11387 !! html/parsoid
11388 <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>
11389 ISBN
11390 9780316098113
11391 ISBN 978
11392 0316098113</p>
11393 !! end
11394
11395 !! test
11396 Magic links: PMID incorrectly converts space to underscore
11397 !! wikitext
11398 PMID 1234
11399 !! html/php
11400 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11401 </p>
11402 !! html/parsoid
11403 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11404 !! end
11405
11406 !! test
11407 Magic links: PMID (T67278)
11408 !! wikitext
11409 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11410 !! html/php
11411 <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.
11412 </p>
11413 !! html/parsoid
11414 <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>
11415 !! end
11416
11417 !! test
11418 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11419 !! wikitext
11420 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11421 PMID
11422 1234
11423 !! html/php
11424 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11425 PMID
11426 1234
11427 </p>
11428 !! html/parsoid
11429 <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>
11430 PMID
11431 1234</p>
11432 !! end
11433
11434 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11435 # since these are ExtLinkText, not MagicLinkText
11436 !! test
11437 Magic links: use appropriate serialization for "almost" magic links.
11438 !! wikitext
11439 X[[Special:BookSources/0978739256|foo]]
11440
11441 X[https://tools.ietf.org/html/rfc1234 foo]
11442 !! html/php
11443 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11444 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11445 </p>
11446 !! html/parsoid
11447 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11448 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11449 !! end
11450
11451 !! test
11452 Magic links: All disabled (T47942)
11453 !! options
11454 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11455 !! wikitext
11456 ISBN 0-306-40615-2
11457 PMID 1234
11458 RFC 4321
11459 !! html/php
11460 <p>ISBN 0-306-40615-2
11461 PMID 1234
11462 RFC 4321
11463 </p>
11464 !! end
11465
11466 ###
11467 ### Templates
11468 ####
11469
11470 !! test
11471 Nonexistent template
11472 !! wikitext
11473 {{thistemplatedoesnotexist}}
11474 !! html
11475 <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>
11476 </p>
11477 !! end
11478
11479 !! test
11480 Template with invalid target containing tags
11481 !! wikitext
11482 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11483 !! html
11484 <p>{{a<b>b</b>|foo|a=b|a = b}}
11485 </p>
11486 !! end
11487
11488 !! test
11489 Template with invalid target containing unclosed tag
11490 !! wikitext
11491 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11492 !! html
11493 <p>{{a<b>|foo|a=b|a = b}}</b>
11494 </p>
11495 !! end
11496
11497 !! test
11498 Template with invalid target containing wikilink
11499 !! wikitext
11500 {{[[Main Page]]}}
11501 !! html/php
11502 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11503 </p>
11504 !! html/parsoid
11505 <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>
11506 !! end
11507
11508 !! test
11509 Template with just whitespace in it, T70421
11510 !! wikitext
11511 {{echo|{{ }}}}
11512 !! html/parsoid
11513 <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>
11514 !! end
11515
11516 !! article
11517 Template:test
11518 !! text
11519 This is a test template
11520 !! endarticle
11521
11522 !! test
11523 Simple template
11524 !! wikitext
11525 {{test}}
11526 !! html
11527 <p>This is a test template
11528 </p>
11529 !! end
11530
11531 !! test
11532 Template with explicit namespace
11533 !! wikitext
11534 {{Template:test}}
11535 !! html
11536 <p>This is a test template
11537 </p>
11538 !! end
11539
11540
11541 !! article
11542 Template:paramtest
11543 !! text
11544 This is a test template with parameter {{{param}}}
11545 !! endarticle
11546
11547 !! test
11548 Template parameter
11549 !! wikitext
11550 {{paramtest|param=foo}}
11551 !! html
11552 <p>This is a test template with parameter foo
11553 </p>
11554 !! end
11555
11556 !! article
11557 Template:paramtestnum
11558 !! text
11559 [[{{{1}}}|{{{2}}}]]
11560 !! endarticle
11561
11562 !! test
11563 Template unnamed parameter
11564 !! wikitext
11565 {{paramtestnum|Main Page|the main page}}
11566 !! html
11567 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11568 </p>
11569 !! end
11570
11571 !! article
11572 Template:templatesimple
11573 !! text
11574 (test)
11575 !! endarticle
11576
11577 !! article
11578 Template:templateredirect
11579 !! text
11580 #redirect [[Template:templatesimple]]
11581 !! endarticle
11582
11583 !! article
11584 Template:templateasargtestnum
11585 !! text
11586 {{{{{1}}}}}
11587 !! endarticle
11588
11589 !! article
11590 Template:templateasargtest
11591 !! text
11592 {{template{{{templ}}}}}
11593 !! endarticle
11594
11595 !! article
11596 Template:templateasargtest2
11597 !! text
11598 {{{{{templ}}}}}
11599 !! endarticle
11600
11601 !! test
11602 Template with template name as unnamed argument
11603 !! wikitext
11604 {{templateasargtestnum|templatesimple}}
11605 !! html
11606 <p>(test)
11607 </p>
11608 !! end
11609
11610 !! test
11611 Template with template name as argument
11612 !! wikitext
11613 {{templateasargtest|templ=simple}}
11614 !! html
11615 <p>(test)
11616 </p>
11617 !! end
11618
11619 !! test
11620 Template with template name as argument (2)
11621 !! wikitext
11622 {{templateasargtest2|templ=templatesimple}}
11623 !! html
11624 <p>(test)
11625 </p>
11626 !! end
11627
11628 !! article
11629 Template:templateasargtestdefault
11630 !! text
11631 {{{{{templ|templatesimple}}}}}
11632 !! endarticle
11633
11634 !! article
11635 Template:templa
11636 !! text
11637 '''templ'''
11638 !! endarticle
11639
11640 !! test
11641 Template with default value
11642 !! wikitext
11643 {{templateasargtestdefault}}
11644 !! html
11645 <p>(test)
11646 </p>
11647 !! end
11648
11649 !! test
11650 Template with default value (value set)
11651 !! wikitext
11652 {{templateasargtestdefault|templ=templa}}
11653 !! html
11654 <p><b>templ</b>
11655 </p>
11656 !! end
11657
11658 !! test
11659 Template redirect
11660 !! wikitext
11661 {{templateredirect}}
11662 !! html/php
11663 <p>(test)
11664 </p>
11665 !! html/parsoid
11666 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11667 !! end
11668
11669 !! test
11670 Template with argument in separate line
11671 !! wikitext
11672 {{ templateasargtest |
11673 templ = simple }}
11674 !! html
11675 <p>(test)
11676 </p>
11677 !! end
11678
11679 !! test
11680 Template with complex template as argument
11681 !! wikitext
11682 {{paramtest|
11683 param ={{ templateasargtest |
11684 templ = simple }}}}
11685 !! html
11686 <p>This is a test template with parameter (test)
11687 </p>
11688 !! end
11689
11690 !! test
11691 Templates with templated name
11692 !! wikitext
11693 {{{{echo|echo}}|foo}}
11694 {{{{echo|inner list}} }}
11695 !! html
11696 <p>foo
11697 </p>
11698 <ul><li>item 1</li></ul>
11699 !! html/parsoid
11700 <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>
11701 <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>
11702 !! end
11703
11704 ## Regression test; the output here isn't really that interesting.
11705 !! test
11706 Templates with templated name and top level template args
11707 !! wikitext
11708 {{1{{2{{{3}}}|4=5}}}}
11709 !! html/parsoid
11710 <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>
11711 !! end
11712
11713 # Parsoid markup is deliberate "broken". This is an edge case.
11714 # See long comment in TemplateHandler.js:convertAttribsToString.
11715 !! test
11716 Templates with invalid templated targets
11717 !! wikitext
11718 {{echo
11719 {{echo|foo}}
11720 }}
11721 !! html/php
11722 <p>{{echo
11723 foo
11724 }}
11725 </p>
11726 !! html/parsoid
11727 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11728 foo }}</p>
11729 !! end
11730
11731 !! test
11732 Template with thumb image (with link in description)
11733 !! wikitext
11734 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11735 !! html/php
11736 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>
11737 !! html+tidy
11738 <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>
11739 !! html/parsoid
11740 <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>
11741 !! end
11742
11743 !! article
11744 Template:complextemplate
11745 !! text
11746 {{{1}}} {{paramtest|
11747 param ={{{param}}}}}
11748 !! endarticle
11749
11750 !! test
11751 Template with complex arguments
11752 !! wikitext
11753 {{complextemplate|
11754 param ={{ templateasargtest |
11755 templ = simple }}|[[Template:complextemplate|link]]}}
11756 !! html
11757 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11758 </p>
11759 !! end
11760
11761 !! test
11762 T2553: link with two variables in a piped link
11763 !! wikitext
11764 {|
11765 |[[{{{1}}}|{{{2}}}]]
11766 |}
11767 !! html/php
11768 <table>
11769 <tr>
11770 <td>[[{{{1}}}|{{{2}}}]]
11771 </td></tr></table>
11772 !! html/parsoid
11773 <table>
11774 <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>
11775 </tbody></table>
11776 !! end
11777
11778 # See: T2553
11779 !! test
11780 Abort table cell attribute parsing on wikilink
11781 !! wikitext
11782 {|
11783 |testing [[one|two]] |three||four
11784 |testing one two |three||four
11785 |testing="[[one|two]]" |three||four
11786 |}
11787 !! html/php
11788 <table>
11789 <tr>
11790 <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>
11791 <td>four
11792 </td>
11793 <td>three</td>
11794 <td>four
11795 </td>
11796 <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>
11797 <td>four
11798 </td></tr></table>
11799 !! html/parsoid
11800 <table>
11801 <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>
11802 <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>
11803 <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>
11804 </tbody></table>
11805 !! end
11806
11807 !! test
11808 Don't abort table cell attribute parsing if wikilink is found in template arg
11809 !! wikitext
11810 {|
11811 |Test {{#tag:ref|One two "[[three]]" four}}
11812 |}
11813 !! html/parsoid
11814 <table>
11815 <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>
11816 </tbody></table>
11817 !! end
11818
11819 !! test
11820 Magic variable as template parameter
11821 !! wikitext
11822 {{paramtest|param={{SITENAME}}}}
11823 !! html
11824 <p>This is a test template with parameter MediaWiki
11825 </p>
11826 !! end
11827
11828 !! article
11829 Template:linktest
11830 !! text
11831 [[{{{param}}}|link]]
11832 !! endarticle
11833
11834 !! test
11835 Template parameter as link source
11836 !! wikitext
11837 {{linktest|param=Main Page}}
11838 !! html
11839 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11840 </p>
11841 !! end
11842
11843 !!article
11844 Template:paramtest2
11845 !! text
11846 including another template, {{paramtest|param={{{arg}}}}}
11847 !! endarticle
11848
11849 !! test
11850 Template passing argument to another template
11851 !! wikitext
11852 {{paramtest2|arg='hmm'}}
11853 !! html
11854 <p>including another template, This is a test template with parameter 'hmm'
11855 </p>
11856 !! end
11857
11858 !! article
11859 Template:Linktest2
11860 !! text
11861 Main Page
11862 !! endarticle
11863
11864 !! test
11865 Template as link source
11866 !! wikitext
11867 [[{{linktest2}}]]
11868
11869 [[{{linktest2}}|Main Page]]
11870
11871 [[{{linktest2}}]]Page
11872 !! html
11873 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11874 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11875 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11876 </p>
11877 !! end
11878
11879
11880 !! article
11881 Template:loop1
11882 !! text
11883 {{loop2}}
11884 !! endarticle
11885
11886 !! article
11887 Template:loop2
11888 !! text
11889 {{loop1}}
11890 !! endarticle
11891
11892 !! test
11893 Template infinite loop
11894 !! wikitext
11895 {{loop1}}
11896 !! html
11897 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11898 </p>
11899 !! end
11900
11901 !! test
11902 Template from main namespace
11903 !! wikitext
11904 {{:Main Page}}
11905 !! html
11906 <p>blah blah
11907 </p>
11908 !! end
11909
11910 !! test
11911 Template from non-includable namespace
11912 !! options
11913 wgNonincludableNamespaces=10
11914 !! wikitext
11915 {{echo|uh oh!}}
11916 !! html
11917 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11918 </p>
11919 !! end
11920
11921 !! article
11922 Template:table
11923 !! text
11924 {|
11925 | 1 || 2
11926 |-
11927 | 3 || 4
11928 |}
11929 !! endarticle
11930
11931 !! test
11932 T2529: Template with table, not included at beginning of line
11933 !! wikitext
11934 foo {{table}}
11935 !! html
11936 <p>foo
11937 </p>
11938 <table>
11939 <tr>
11940 <td>1</td>
11941 <td>2
11942 </td></tr>
11943 <tr>
11944 <td>3</td>
11945 <td>4
11946 </td></tr></table>
11947 !! end
11948
11949 !! test
11950 T2523: Template shouldn't eat newline (or add an extra one before table)
11951 !! wikitext
11952 foo
11953 {{table}}
11954 !! html
11955 <p>foo
11956 </p>
11957 <table>
11958 <tr>
11959 <td>1</td>
11960 <td>2
11961 </td></tr>
11962 <tr>
11963 <td>3</td>
11964 <td>4
11965 </td></tr></table>
11966 !! end
11967
11968 !! test
11969 T2041: Template parameters shown as broken links
11970 !! wikitext
11971 {{{parameter}}}
11972 !! html
11973 <p>{{{parameter}}}
11974 </p>
11975 !! end
11976
11977 !! test
11978 Template with targets containing wikilinks
11979 !! options
11980 parsoid=wt2html
11981 !! wikitext
11982 {{[[foo]]}}
11983
11984 {{[[{{echo|foo}}]]}}
11985
11986 {{{{echo|[[foo}}]]}}
11987 !! html/php
11988 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11989 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11990 </p><p>{{[[foo}}]]
11991 </p>
11992 !! html/parsoid
11993 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11994 <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>
11995 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11996 !! end
11997
11998 !! article
11999 Template:''
12000 !! text
12001 bar
12002 !! endarticle
12003
12004 !! test
12005 Templates: Double quotes as template target
12006 !! wikitext
12007 foo {{''}} baz
12008 !! html/php
12009 <p>foo bar baz
12010 </p>
12011 !! html/parsoid
12012 <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
12013 </p>
12014 !! end
12015
12016 ## This test is about making sure Parsoid's data-mw is well formed in the
12017 ## face of multiple templates with intersecting and overlapping ranges. The
12018 ## wikitext itself is wretched.
12019 !! test
12020 Templates with intersecting and overlapping ranges
12021 !! wikitext
12022 {|{{echo|
12023 <p>ha</p>}}
12024 {|{{echo|
12025 <p>ho</p>}}
12026 {{echo|{{!}}hi}}
12027 |}
12028 !! html/php+tidy
12029 <p>ha</p><table>
12030
12031 </table><p>ho</p><table>
12032
12033 <tbody><tr>
12034 <td>hi
12035 </td></tr></tbody></table>
12036 !! html/parsoid
12037 <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":""}]]}'>
12038
12039 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
12040
12041 <tbody><tr><td>hi</td></tr>
12042 </tbody></table>
12043 !! end
12044
12045 !! article
12046 Template:MSGNW test
12047 !! text
12048 ''None'' of '''this''' should be
12049 * interpreted
12050 but rather passed unmodified
12051 {{test}}
12052 <gallery>
12053 File:Foobar.jpg
12054 </gallery>
12055 <!-- comment -->
12056 !! endarticle
12057
12058 # hmm, fix this or just deprecate msgnw and document its behavior?
12059 !! test
12060 msgnw keyword
12061 !! wikitext
12062 {{msgnw:MSGNW test}}
12063 !! html/php
12064 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
12065 &#42; interpreted
12066 &#32;but rather passed unmodified
12067 &#123;&#123;test&#125;&#125;
12068 &#60;gallery&#62;
12069 File:Foobar.jpg
12070 &#60;/gallery&#62;
12071 &#60;!-- comment --&#62;
12072 </p>
12073 !! end
12074
12075 !! test
12076 int keyword
12077 !! wikitext
12078 {{int:youhavenewmessages|lots of money|not!}}
12079 !! html
12080 <p>You have lots of money (not!).
12081 </p>
12082 !! end
12083
12084 !! test
12085 int keyword - non-existing message
12086 !! wikitext
12087 {{int:var}}
12088 !! html
12089 <p>⧼var⧽
12090 </p>
12091 !! end
12092
12093 !! article
12094 Template:Includes
12095 !! text
12096 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12097 !! endarticle
12098
12099 !! test
12100 <includeonly> and <noinclude> being included
12101 !! wikitext
12102 {{Includes}}
12103 !! html
12104 <p>Foobar
12105 </p>
12106 !! end
12107
12108 !! article
12109 Template:Includes2
12110 !! text
12111 <onlyinclude>Foo</onlyinclude>bar
12112 !! endarticle
12113
12114 !! test
12115 <onlyinclude> being included
12116 !! wikitext
12117 {{Includes2}}
12118 !! html
12119 <p>Foo
12120 </p>
12121 !! end
12122
12123
12124 !! article
12125 Template:Includes3
12126 !! text
12127 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
12128 !! endarticle
12129
12130 !! test
12131 <onlyinclude> and <includeonly> being included
12132 !! wikitext
12133 {{Includes3}}
12134 !! html
12135 <p>Foo
12136 </p>
12137 !! end
12138
12139 # FIXME: Parsoid's markup for this is quite ugly.
12140 !! test
12141 <includeonly> and <noinclude> on a page
12142 !! wikitext
12143 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12144 !! html/php+tidy
12145 <p>Foozar
12146 </p>
12147 !! html/parsoid
12148 <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="{}"/>
12149 !! end
12150
12151 !! test
12152 Un-closed <noinclude>
12153 !! wikitext
12154 <noinclude>
12155 !! html
12156 !! end
12157
12158 !! test
12159 <onlyinclude> on a page
12160 !! wikitext
12161 <onlyinclude>Foo</onlyinclude>bar
12162 !! html
12163 <p>Foobar
12164 </p>
12165 !! end
12166
12167 !! test
12168 Un-closed <onlyinclude>
12169 !! wikitext
12170 <onlyinclude>
12171 !! html
12172 !! end
12173
12174 !!test
12175 Self-closed noinclude, includeonly, onlyinclude tags
12176 !! wikitext
12177 <noinclude />
12178 <includeonly />
12179 <onlyinclude />
12180 !! html
12181 <p><br />
12182 </p>
12183 !!end
12184
12185 !!test
12186 Unbalanced includeonly and noinclude tags
12187 !! wikitext
12188 {|
12189 |a</noinclude>
12190 |b</noinclude></noinclude>
12191 |c</noinclude></includeonly>
12192 |d</includeonly></includeonly>
12193 |}
12194 !! html
12195 <table>
12196 <tr>
12197 <td>a
12198 </td>
12199 <td>b
12200 </td>
12201 <td>c&lt;/includeonly&gt;
12202 </td>
12203 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12204 </td></tr></table>
12205 !!end
12206
12207 !! article
12208 Template:Includeonly section
12209 !! text
12210 <includeonly>
12211 ==Includeonly section==
12212 </includeonly>
12213 ==Section T-1==
12214 !!endarticle
12215
12216 !! test
12217 T8563: Edit link generation for section shown by <includeonly>
12218 !! wikitext
12219 {{includeonly section}}
12220 !! html
12221 <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>
12222 <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>
12223 !! end
12224
12225 # Uses same input as the contents of [[Template:Includeonly section]]
12226 !! test
12227 T8563: Section extraction for section shown by <includeonly>
12228 !! options
12229 section=T-2
12230 !! wikitext
12231 <includeonly>
12232 ==Includeonly section==
12233 </includeonly>
12234 ==Section T-2==
12235 !! html
12236 ==Section T-2==
12237 !! end
12238
12239 !! test
12240 T8563: Edit link generation for section suppressed by <includeonly>
12241 !! wikitext
12242 <includeonly>
12243 ==Includeonly section==
12244 </includeonly>
12245 ==Section 1==
12246 !! html
12247 <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>
12248 !! end
12249
12250 !! test
12251 T8563: Section extraction for section suppressed by <includeonly>
12252 !! options
12253 section=1
12254 !! wikitext
12255 <includeonly>
12256 ==Includeonly section==
12257 </includeonly>
12258 ==Section 1==
12259 !! html
12260 ==Section 1==
12261 !! end
12262
12263 !! test
12264 Un-closed <includeonly>
12265 !! wikitext
12266 <includeonly>
12267 !! html/php
12268 !! html/parsoid
12269 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12270 !! end
12271
12272 ## We used to, but no longer wt2wt this test since the default serializer
12273 ## will normalize the include directives to serialize on their own line.
12274 ## Selser will take care of preserving formatting in scenarios where they
12275 ## intermingled with other wikitext.
12276 !! test
12277 Includes and comments at SOL
12278 !! options
12279 parsoid=wt2html,html2html
12280 !! wikitext
12281 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12282
12283 <noinclude>
12284 some
12285 </noinclude>*stuff
12286 *here
12287
12288 <noinclude>
12289 some</noinclude>* stuff
12290 * here
12291
12292 <includeonly>can have stuff</includeonly>===here===
12293
12294 !! html/php
12295 <h2><span class="mw-headline" id="hu">hu</span></h2>
12296 <p>some
12297 </p>
12298 <ul><li>stuff</li>
12299 <li>here</li></ul>
12300 <p><br />
12301 some* stuff
12302 </p>
12303 <ul><li>here</li></ul>
12304 <h3><span class="mw-headline" id="here">here</span></h3>
12305 !! html/parsoid
12306 <!-- 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>
12307
12308 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12309 <p>some</p>
12310 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12311 <li>here</li></ul>
12312
12313 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12314 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12315 <ul><li>here</li></ul>
12316
12317 <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>
12318 !! end
12319
12320 # TODO: test with DOM fragment reuse!
12321 !! test
12322 Parsoid: DOM fragment reuse
12323 !! options
12324 parsoid=wt2wt,wt2html
12325 !! wikitext
12326 a{{echo|b<table></table>c}}d
12327
12328 a{{echo|b
12329 <table></table>
12330 c}}d
12331
12332 {{echo|a
12333
12334 <table></table>
12335
12336 b}}
12337 !! html/php+tidy
12338 <p>ab</p><table></table><p>cd
12339 </p><p>ab
12340 </p>
12341 <table></table>
12342 <p>cd
12343 </p><p>a
12344 </p>
12345 <table></table>
12346 <p>b
12347 </p>
12348 !! html/parsoid
12349 <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>
12350
12351 <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">
12352 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12353 </span><p about="#mwt2">cd</p>
12354
12355 <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">
12356
12357 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12358
12359 </span><p about="#mwt3">b</p>
12360 !! end
12361
12362 !! test
12363 Parsoid: Merge double tds (T52603)
12364 !! wikitext
12365 {|
12366 |{{echo|{{!}} foo}}
12367 |}
12368 !! html/php+tidy
12369 <table>
12370 <tbody><tr>
12371 <td>foo
12372 </td></tr></tbody></table>
12373 !! html/parsoid
12374 <table><tbody>
12375 <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>
12376 </tbody></table>
12377 !! end
12378
12379 !! test
12380 Parsoid: Merge double tds in nested transclusion content (T52603)
12381 !! wikitext
12382 {{echo|<div>}}
12383 {|
12384 |{{echo|{{!}} foo}}
12385 |}
12386 {{echo|</div>}}
12387 !! html/php+tidy
12388 <div>
12389 <table>
12390 <tbody><tr>
12391 <td>foo
12392 </td></tr></tbody></table>
12393 </div>
12394 !! html/parsoid
12395 <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}}]}'>
12396 <table><tbody>
12397 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12398 </tbody></table>
12399 </div>
12400 !! end
12401
12402 ###
12403 ### <includeonly> and <noinclude> in attributes
12404 ###
12405 !!test
12406 0. includeonly around the entire attribute
12407 !! wikitext
12408 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12409 !! html
12410 <p><span id="v2">bar</span>
12411 </p>
12412 !!end
12413
12414 !!test
12415 1. includeonly in html attr key
12416 !! wikitext
12417 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12418 !! html
12419 <p><span id="foo">bar</span>
12420 </p>
12421 !!end
12422
12423 !!test
12424 2. includeonly in html attr value
12425 !! wikitext
12426 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12427 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12428 !! html
12429 <p><span id="v1">bar</span>
12430 <span id="v1">bar</span>
12431 </p>
12432 !!end
12433
12434 !!test
12435 3. includeonly in part of an attr value
12436 !! wikitext
12437 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12438 !! html
12439 <p><span style="color:red;">bar</span>
12440 </p>
12441 !!end
12442
12443 !!test
12444 4. includeonly in table attributes
12445 !! wikitext
12446 {|
12447 |- <noinclude>
12448 |-
12449 |a
12450 </noinclude>
12451 |- <includeonly>
12452 |-
12453 |b
12454 </includeonly>
12455 |}
12456 !! html
12457 <table>
12458
12459
12460 <tr>
12461 <td>a
12462 </td></tr>
12463 </table>
12464 !!end
12465
12466 ###
12467 ### Preprocessor precedence tests
12468 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12469 ###
12470 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12471 !! test
12472 Preprocessor precedence 1: link is rightmost opening
12473 !! options
12474 parsoid=wt2html
12475 !! wikitext
12476 {{[[Foo|bar}}]]
12477
12478 But close-brace is not a valid character in a link title:
12479 {{[[Foo}}|bar]]
12480
12481 However, we can still tell this was handled as a link in the preprocessor:
12482 {{echo|[[Foo}}|bar]]|bat}}
12483 !! html/php
12484 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12485 </p><p>But close-brace is not a valid character in a link title:
12486 {{[[Foo}}|bar]]
12487 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12488 [[Foo}}|bar]]
12489 </p>
12490 !! html/parsoid
12491 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12492 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12493 <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>
12494 !! end
12495
12496 !! test
12497 Preprocessor precedence 2: template is rightmost opening
12498 !! options
12499 language=zh
12500 !! wikitext
12501 -{{echo|foo}-}}-
12502 !! html/php
12503 <p>-foo}--
12504 </p>
12505 !! html/parsoid
12506 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12507 !! end
12508
12509 !! test
12510 Preprocessor precedence 3: language converter is rightmost opening
12511 !! options
12512 language=zh
12513 parsoid=wt2html
12514 !! wikitext
12515 {{echo|hi}}
12516
12517 {{-{R|echo|hi}}}-
12518
12519 [[-{R|raw]]}-
12520 !! html/php
12521 <p>hi
12522 </p><p>{{echo|hi}}
12523 </p><p>[[raw]]
12524 </p>
12525 !! html/parsoid
12526 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12527 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12528 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12529 !! end
12530
12531 !! test
12532 Preprocessor precedence 4: left-most angle bracket
12533 !! options
12534 language=zh
12535 !! wikitext
12536 <!--{raw}-->
12537 !! html/php
12538 !! html/parsoid
12539 <!--{raw}-->
12540 !! end
12541
12542 !! article
12543 Template:Precedence5
12544 !! text
12545 {{{{{1}}}}}
12546 !! endarticle
12547
12548 !! test
12549 Preprocessor precedence 5: tplarg takes precedence over template
12550 !! wikitext
12551 {{Precedence5|Bullet}}
12552 !! html/php
12553 <ul><li>Bar</li></ul>
12554 !! html/parsoid
12555 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12556 !! end
12557
12558 !! test
12559 Preprocessor precedence 6: broken link is rightmost opening
12560 !! options
12561 parsoid=wt2html
12562 !! wikitext
12563 {{echo|[[Foo}}
12564
12565 {{echo|[[Foo|bar|bat=baz}}
12566 !! html/php
12567 <p>{{echo|[[Foo}}
12568 </p><p>{{echo|[[Foo|bar|bat=baz}}
12569 </p>
12570 !! html/parsoid
12571 <p>{{echo|[[Foo}}</p>
12572 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12573 !! end
12574
12575 # This next test exposes a difference between PHP and Parsoid:
12576 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12577 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12578 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12579 # outer `[[Foo` extends until the `y]]`
12580 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12581 # intermediate result (after template expansion), and link processing
12582 # happens on this intermediate result, which moves the wikilink
12583 # boundary leftward to `[[Foo|Bar]]`
12584 # 2b) Parsoid works in a single step, so it's going to keep the
12585 # wikilink as extending to the `y]]`
12586 # 3a) Then PHP does linktrail processing which slurps up the trailing
12587 # `xy` inside the link.
12588 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12589 # `z` inside the link.
12590 # This is "correct" behavior. Parsoid's basic worldview is that the
12591 # `]]` inside the template shouldn't be allowed to leak out to affect
12592 # the surrounding wikilink. PHP may match Parsoid (in the future)
12593 # if you use {{#balance}} (T114445).
12594
12595 !! test
12596 Preprocessor precedence 7: broken template is rightmost opening
12597 !! options
12598 parsoid=wt2html
12599 !! wikitext
12600 [[Foo|{{echo|Bar]]
12601
12602 [[Foo|{{echo|Bar]]-x}}-y]]-z
12603
12604 Careful: linktrails can move the end of the wikilink:
12605 [[Foo|{{echo|y']]a}}l]]l
12606 !! html/php
12607 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12608 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12609 </p><p>Careful: linktrails can move the end of the wikilink:
12610 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12611 </p>
12612 !! html/parsoid
12613 <p>[[Foo|{{echo|Bar]]</p>
12614 <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>
12615 <p>Careful: linktrails can move the end of the wikilink:
12616 <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>
12617 !! end
12618
12619 !! test
12620 Preprocessor precedence 8: broken language converter is rightmost opening
12621 !! options
12622 language=zh
12623 !! wikitext
12624 [[Foo-{R|raw]]
12625 !! html
12626 <p>[[Foo-{R|raw]]
12627 </p>
12628 !! end
12629
12630 !! article
12631 Template:Preprocessor_precedence_9
12632 !! text
12633 ;4: {{{{1}}}}
12634 ;5: {{{{{2}}}}}
12635 ;6: {{{{{{3}}}}}}
12636 ;7: {{{{{{{4}}}}}}}
12637 !! endarticle
12638
12639 !! test
12640 Preprocessor precedence 9: groups of braces
12641 !! wikitext
12642 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12643 !! html/php
12644 <dl><dt>4</dt>
12645 <dd>{Four}</dd>
12646 <dt>5</dt>
12647 <dd></dd></dl>
12648 <ul><li>Bar</li></ul>
12649 <dl><dt>6</dt>
12650 <dd>Four</dd>
12651 <dt>7</dt>
12652 <dd>{Bullet}</dd></dl>
12653 !! html/parsoid
12654 <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}}]}'>
12655 <dt>4</dt>
12656 <dd>{Four}</dd>
12657 <dt>5</dt>
12658 <dd></dd>
12659 </dl><ul about="#mwt1">
12660 <li>Bar</li>
12661 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12662 <dt>6</dt>
12663 <dd>Four</dd>
12664 <dt>7</dt>
12665 <dd>{Bullet}</dd>
12666 </dl>
12667 !! end
12668
12669 !! article
12670 Template:Preprocessor_precedence_10
12671 !! text
12672 ;1: -{R|raw}-
12673 ;2: -{{Bullet}}-
12674 ;3: -{{{1}}}-
12675 ;4: -{{{{2}}}}-
12676 ;5: -{{{{{3}}}}}-
12677 ;6: -{{{{{{4}}}}}}-
12678 ;7: -{{{{{{{5}}}}}}}-
12679 !! endarticle
12680
12681 !! test
12682 Preprocessor precedence 10: groups of braces with leading dash
12683 !! options
12684 language=zh
12685 !! wikitext
12686 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12687 !! html/php
12688 <dl><dt>1</dt>
12689 <dd>raw</dd>
12690 <dt>2</dt>
12691 <dd>-</dd></dl>
12692 <ul><li>Bar-</li></ul>
12693 <dl><dt>3</dt>
12694 <dd>-Three-</dd>
12695 <dt>4</dt>
12696 <dd>raw2</dd>
12697 <dt>5</dt>
12698 <dd>-</dd></dl>
12699 <ul><li>Bar-</li></ul>
12700 <dl><dt>6</dt>
12701 <dd>-Three-</dd>
12702 <dt>7</dt>
12703 <dd>raw2</dd></dl>
12704 !! html/parsoid
12705 <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}}]}'>
12706 <dt>1</dt>
12707 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12708 <dt>2</dt>
12709 <dd>-</dd>
12710 </dl><ul about="#mwt1">
12711 <li>Bar-</li>
12712 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12713 <dt>3</dt>
12714 <dd>-Three-</dd>
12715 <dt>4</dt>
12716 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12717 <dt>5</dt>
12718 <dd>-</dd>
12719 </dl><ul about="#mwt1">
12720 <li>Bar-</li>
12721 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12722 <dt>6</dt>
12723 <dd>-Three-</dd>
12724 <dt>7</dt>
12725 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12726 </dl>
12727 !! end
12728
12729 !! test
12730 Preprocessor precedence 11: found during visual diff testing
12731 !! wikitext
12732 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12733
12734 {{echo|-{{echo|-{{echo|x}}}}}}
12735
12736 {{echo|-{{echo|x}}}}
12737 !! html/php
12738 <p><span>-<span>-x</span></span>
12739 </p><p>--x
12740 </p><p>-x
12741 </p>
12742 !! html/parsoid
12743 <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>
12744
12745 <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>
12746
12747 <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>
12748 !! end
12749
12750 !! test
12751 Preprocessor precedence 12: broken language converter closed by brace.
12752 !! options
12753 parsoid=wt2html
12754 !! wikitext
12755 This form breaks the template, which is unfortunate:
12756 *{{echo|foo-{bar}bat}}
12757
12758 But if the broken language converter markup is inside an extension
12759 tag, nothing bad happens:
12760 *<nowiki>foo-{bar}bat</nowiki>
12761 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12762 *<pre>foo-{bar}bat</pre>
12763 *{{echo|<pre>foo-{bar}bat</pre>}}
12764
12765 <tag>foo-{bar}bat</tag>
12766 {{echo|<tag>foo-{bar}bat</tag>}}
12767
12768 !! html/php+tidy
12769 <p>This form breaks the template, which is unfortunate:
12770 </p>
12771 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12772 <p>But if the broken language converter markup is inside an extension
12773 tag, nothing bad happens:
12774 </p>
12775 <ul><li>foo-&#123;bar}bat</li>
12776 <li>foo-&#123;bar}bat</li>
12777 <li><pre>foo-{bar}bat</pre></li>
12778 <li><pre>foo-{bar}bat</pre></li></ul>
12779 <pre>'foo-{bar}bat'
12780 array (
12781 )
12782 </pre>
12783 <pre>'foo-{bar}bat'
12784 array (
12785 )
12786 </pre>
12787 !! html/parsoid
12788 <p>This form breaks the template, which is unfortunate:</p>
12789 <ul>
12790 <li>{{echo|foo-{bar}bat}}</li>
12791 </ul>
12792 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12793 <ul>
12794 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12795 <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>
12796 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12797 <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>
12798 </ul>
12799 <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>
12800 !! end
12801
12802 !! test
12803 Preprocessor precedence 13: broken language converter in external link
12804 !! options
12805 parsoid=wt2html
12806 !! wikitext
12807 *[http://example.com/-{foo Example in URL]
12808 *[http://example.com Example in -{link} description]
12809 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12810 !! html/php+tidy
12811 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12812 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12813 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12814 !! html/parsoid
12815 <ul>
12816 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12817 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12818 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12819 </ul>
12820 !! end
12821
12822 !! test
12823 Preprocessor precedence 14: broken language converter in comment
12824 !! wikitext
12825 *<!--{{foo}}-->...should be ok
12826 *<!---{{foo}}-->...extra dashes
12827 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12828 !! html/php+tidy
12829 <ul><li>...should be ok</li>
12830 <li>...extra dashes</li>
12831 <li>foobat...should be ok</li></ul>
12832 !! html/parsoid
12833 <ul>
12834 <li><!--{{foo}}-->...should be ok</li>
12835 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12836 <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>
12837 </ul>
12838 !! end
12839
12840 !! test
12841 Preprocessor precedence 15: broken brace markup in headings
12842 !! config
12843 wgFragmentMode=[ 'html5', 'legacy' ]
12844 !! options
12845 parsoid=wt2html
12846 !! wikitext
12847 __NOTOC__ __NOEDITSECTION__
12848 ===1 foo[bar 1===
12849 1
12850 ===2 foo[[bar 2===
12851 2
12852 ===3 foo{bar 3===
12853 3
12854 ===4 foo{{bar 4===
12855 4
12856 ===5 foo{{{bar 5===
12857 5
12858 ===6 foo-{bar 6===
12859 6
12860 !! html/php+tidy
12861 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12862 <p>1
12863 </p>
12864 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12865 <p>2
12866 </p>
12867 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12868 <p>3
12869 </p>
12870 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12871 <p>4
12872 </p>
12873 <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>
12874 <p>5
12875 </p>
12876 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12877 <p>6
12878 </p>
12879 !! html/parsoid
12880 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12881 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12882 <p>1</p>
12883 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12884 <p>2</p>
12885 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12886 <p>3</p>
12887 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12888 <p>4</p>
12889 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12890 <p>5</p>
12891 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12892 <p>6</p>
12893 !! end
12894
12895 !! test
12896 Preprocessor precedence 16: matching closing braces to opening braces
12897 !! options
12898 language=zh
12899 parsoid=wt2html
12900 !! wikitext
12901 -{{{echo|foo}}bar}-
12902 !! html/php
12903 <p>foobar
12904 </p>
12905 !! html/parsoid
12906 <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>
12907 !! end
12908
12909 !! test
12910 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12911 !! options
12912 parsoid=wt2html
12913 !! wikitext
12914 {{echo|hi {{}}}}
12915 !! html/php
12916 <p>hi {{}}
12917 </p>
12918 !! html/parsoid
12919 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12920 !! end
12921
12922 # Ensure we're using a language without variants for this test; even
12923 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12924 !! test
12925 Preprocessor precedence 18: another rightmost wins scenario
12926 !! options
12927 parsoid=wt2html
12928 language=de
12929 !! wikitext
12930 {{ -{{{{1|tplarg}}} }} }-
12931 !! html/php
12932 <p>{{ -{tplarg }} }-
12933 </p>
12934 !! html/parsoid
12935 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12936 !! end
12937
12938 !! test
12939 Preprocessor precedence 19: break syntax
12940 !! options
12941 parsoid=wt2html
12942 !! wikitext
12943 -{{
12944 !! html/php
12945 <p>-{{
12946 </p>
12947 !! html/parsoid
12948 <p>-{{</p>
12949 !! end
12950
12951 ###
12952 ### Token Stream Patcher tests
12953 ###
12954 ### These tests won't always pass wt2wt and other modes because
12955 ### on serialization, the table will be output on a new line.
12956 ### For now, we are blacklisting them, and using this to test selser.
12957 ###
12958
12959 !!test
12960 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12961 !!options
12962 parsoid=wt2html,wt2wt
12963 !!wikitext
12964 {{echo|}}{| width = '100%'
12965 |foo
12966 |}
12967 !!html/parsoid
12968 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12969 <tbody><tr><td>foo</td></tr>
12970 </tbody></table>
12971 !!end
12972
12973 ## We used to, but no longer wt2wt this test since the default serializer
12974 ## will normalize the include directives to serialize on their own line.
12975 ## Selser will take care of preserving formatting in scenarios where they
12976 ## intermingled with other wikitext.
12977 !!test
12978 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12979 !!options
12980 parsoid=wt2html
12981 !!wikitext
12982 <includeonly>a</includeonly>{| {{{b}}}
12983 |c
12984 |}
12985 !!html/parsoid
12986 <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":""}]]}'>
12987 <tbody><tr><td>c</td></tr>
12988 </tbody></table>
12989 !!end
12990
12991 !! test
12992 Table wikitext syntax outside wiki-tables
12993 !! wikitext
12994 a
12995 |+ not a caption
12996 ! not a table heading
12997 |- not a table row
12998 | not a table cell
12999 | class="foo bar" | baz
13000 b
13001 |}
13002 |-
13003 c
13004 !! html
13005 <p>a
13006 |+ not a caption
13007 ! not a table heading
13008 |- not a table row
13009 | not a table cell
13010 | class="foo bar" | baz
13011 b
13012 |}
13013 |-
13014 c
13015 </p>
13016 !! end
13017
13018 ###
13019 ### Testing parsing of templates where a template arg
13020 ### has the same name as the template itself.
13021 ###
13022
13023 !! article
13024 Template:quote
13025 !! text
13026 {{{quote|{{{1}}}}}}
13027 !! endarticle
13028
13029 !!test
13030 Templates: Template Name/Arg clash: 1. Use of positional param
13031 !! wikitext
13032 {{quote|foo}}
13033 !! html
13034 <p>foo
13035 </p>
13036 !!end
13037
13038 !!test
13039 Templates: Template Name/Arg clash: 2. Use of named param
13040 !! wikitext
13041 {{quote|quote=foo}}
13042 !! html
13043 <p>foo
13044 </p>
13045 !!end
13046
13047 !!test
13048 Templates: Template Name/Arg clash: 3. Use of named param with empty input
13049 !! wikitext
13050 {{quote|quote}}
13051 !! html
13052 <p>quote
13053 </p>
13054 !!end
13055
13056 ###
13057 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
13058 ###
13059
13060 !!test
13061 Templates: 1. Simple use
13062 !! wikitext
13063 {{echo|Foo}}
13064 !! html
13065 <p>Foo
13066 </p>
13067 !!end
13068
13069 !!test
13070 Templates: 2. Inside a block tag
13071 !! wikitext
13072 <div>{{echo|Foo}}</div>
13073 <blockquote>{{echo|Foo}}</blockquote>
13074 !! html
13075 <div>Foo</div>
13076 <blockquote>Foo</blockquote>
13077 !! html+tidy
13078 <div>Foo</div>
13079 <blockquote><p>Foo</p></blockquote>
13080 !!end
13081
13082 !!test
13083 Templates: P-wrapping: 1a. Templates on consecutive lines
13084 !! wikitext
13085 {{echo|Foo}}
13086 {{echo|bar}}
13087 !! html
13088 <p>Foo
13089 bar
13090 </p>
13091 !!end
13092
13093 !!test
13094 Templates: P-wrapping: 1b. Templates on consecutive lines
13095 !! wikitext
13096 Foo
13097
13098 {{echo|bar}}
13099 {{echo|baz}}
13100 !! html
13101 <p>Foo
13102 </p><p>bar
13103 baz
13104 </p>
13105 !!end
13106
13107 !!test
13108 Templates: P-wrapping: 1c. Templates on consecutive lines
13109 !! wikitext
13110 {{echo|Foo}}
13111 {{echo|bar}} <div>baz</div>
13112 !! html
13113 <p>Foo
13114 </p>
13115 bar <div>baz</div>
13116 !! html+tidy
13117 <p>Foo
13118 </p><p>
13119 bar </p><div>baz</div>
13120 !! end
13121
13122 !! test
13123 Templates: P-wrapping: 1d. Template preceded by comment-only line
13124 !! wikitext
13125 <!-- foo -->
13126 {{echo|Bar}}
13127 !! html/php+tidy
13128 <p>Bar
13129 </p>
13130 !! html/parsoid
13131 <!-- foo -->
13132
13133 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
13134 !!end
13135
13136 !! test
13137 Templates: Scopes should not be expanded unnecessarily
13138 !! options
13139 parsoid=wt2html,wt2wt
13140 !! wikitext
13141 {{echo|<div>a</div>}}b{{echo|
13142 <div>c</div>}}
13143 !! html/php+tidy
13144 <div>a</div><p>b
13145 </p><div>c</div>
13146 !! html/parsoid
13147 <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}}]}'>
13148 </span><div about="#mwt2">c</div>
13149 !! end
13150
13151 !!test
13152 Templates: Inline Text: 1. Multiple template uses
13153 !! wikitext
13154 {{echo|Foo}}bar{{echo|baz}}
13155 !! html
13156 <p>Foobarbaz
13157 </p>
13158 !!end
13159
13160 !!test
13161 Templates: Inline Text: 2. Back-to-back template uses
13162 !! wikitext
13163 {{echo|Foo}}{{echo|bar}}
13164 !! html
13165 <p>Foobar
13166 </p>
13167 !!end
13168
13169 !!test
13170 Templates: Block Tags: 1. Multiple template uses
13171 !! wikitext
13172 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13173 !! html
13174 <div>Foo</div><div>bar</div><div>baz</div>
13175 !!end
13176
13177 !!test
13178 Templates: Block Tags: 2. Back-to-back template uses
13179 !! wikitext
13180 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13181 !! html
13182 <div>Foo</div><div>bar</div>
13183 !!end
13184
13185 ## Parsoid drops empty elements in templates.
13186 !! test
13187 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13188 !! wikitext
13189 {{echo|a
13190 b</p>}}
13191 !! html/php+tidy
13192 <p>a
13193 </p><p>
13194 b</p><p class="mw-empty-elt"></p>
13195 !! html/parsoid
13196 <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">
13197 </span><p about="#mwt1">b</p>
13198 !! end
13199
13200 !!test
13201 Templates: Links: 1. Simple example
13202 !! wikitext
13203 {{echo|[[Foo|bar]]}}
13204 !! html
13205 <p><a href="/wiki/Foo" title="Foo">bar</a>
13206 </p>
13207 !!end
13208
13209 !!test
13210 Templates: Links: 2. Generation of link href
13211 !! wikitext
13212 [[{{echo|Foo}}|bar]]
13213 !! html
13214 <p><a href="/wiki/Foo" title="Foo">bar</a>
13215 </p>
13216 !!end
13217
13218 !!test
13219 Templates: Links: 3. Generation of part of a link href
13220 !! wikitext
13221 [[Fo{{echo|o}}|bar]]
13222
13223 [[Foo{{echo|bar}}]]
13224
13225 [[Foo{{echo|bar}}baz]]
13226
13227 [[Foo{{echo|bar}}|bar]]
13228
13229 [[:Foo{{echo|bar}}]]
13230
13231 [[:Foo{{echo|bar}}|bar]]
13232 !! html
13233 <p><a href="/wiki/Foo" title="Foo">bar</a>
13234 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13235 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13236 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13237 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13238 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13239 </p>
13240 !!end
13241
13242 !!test
13243 Templates: Links: 4. Multiple templates generating link href
13244 !! wikitext
13245 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13246 !! html
13247 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13248 </p>
13249 !!end
13250
13251 !!test
13252 Templates: Links: 5. Generation of link text
13253 !! wikitext
13254 [[Foo|{{echo|bar}}]]
13255 !! html
13256 <p><a href="/wiki/Foo" title="Foo">bar</a>
13257 </p>
13258 !!end
13259
13260 !!test
13261 Templates: Links: 5. Nested templates (only outermost template should be marked)
13262 !! wikitext
13263 {{echo|[[{{echo|Foo}}|bar]]}}
13264 !! html
13265 <p><a href="/wiki/Foo" title="Foo">bar</a>
13266 </p>
13267 !!end
13268
13269 !! test
13270 File with template filename
13271 !! wikitext
13272 [[File:{{echo|Foobar.jpg}}]]
13273 !! html/parsoid
13274 <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>
13275 !! end
13276
13277 !!test
13278 Templates: HTML Tag: 1. Generation of HTML attr. key
13279 !! wikitext
13280 <div {{echo|style}}="color:red;">foo</div>
13281 !! html
13282 <div style="color:red;">foo</div>
13283 !!end
13284
13285 !!test
13286 Templates: HTML Tag: 2. Generation of HTML attr. value
13287 !! wikitext
13288 <div style={{echo|'color:red;'}}>foo</div>
13289 !! html
13290 <div style="color:red;">foo</div>
13291 !!end
13292
13293 !!test
13294 Templates: HTML Tag: 3. Generation of HTML attr key and value
13295 !! wikitext
13296 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13297 !! html
13298 <div style="color:red;">foo</div>
13299 !!end
13300
13301 !!test
13302 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13303 !! wikitext
13304 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13305 !! html
13306 <div title="This is a long title with just one piece templated">foo</div>
13307 !!end
13308
13309 !!test
13310 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13311 !! wikitext
13312 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13313 !! html
13314 <div title="This is a long title with just one piece templated">foo</div>
13315 !!end
13316
13317 !!test
13318 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13319 !! wikitext
13320 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13321 !! html
13322 <div title="This is a long title with just one piece templated">foo</div>
13323 !!end
13324
13325 # SSS FIXME: While it is great we added support for all this,
13326 # do we want to make this part of the spec? Maybe we want to
13327 # deprecate this kind of usage in the future?
13328 !!test
13329 Templates: HTML Tag: 7. Generation of partial attribute key string
13330 !! wikitext
13331 <div st{{echo|yle}}="color:red;">foo</div>
13332 !! html
13333 <div style="color:red;">foo</div>
13334 !!end
13335
13336 !! test
13337 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13338 !! wikitext
13339 <div {{echo|1=id="v1"}}>bar</div>
13340 !! html
13341 <div id="v1">bar</div>
13342 !!end
13343
13344 !! test
13345 Templates: HTML Tag: 9. Multiple template-generated attributes
13346 !! wikitext
13347 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13348 !! html
13349 <div id="v1" title="foo">bar</div>
13350 !!end
13351
13352 !! test
13353 Templates: Support for templates generating attributes and content
13354 !! wikitext
13355 {| {{mixed_attr_content_template}}
13356 |-
13357 |bar
13358 |}
13359 !! html/php
13360 <table style="color:red;" title="T48811">
13361
13362 <tr>
13363 <td>foo
13364 </td></tr>
13365 <tr>
13366 <td>bar
13367 </td></tr></table>
13368 !! html/parsoid
13369 <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|}"]}'>
13370 <tbody><tr>
13371 <td>foo</td></tr>
13372 <tr>
13373 <td>bar</td></tr>
13374 </tbody></table>
13375 !!end
13376
13377 !! article
13378 Template:attribute_from_template
13379 !! text
13380 class="123"
13381 !! endarticle
13382
13383 !! test
13384 Table cell with attribute before expanded attribute
13385 !! wikitext
13386 {|
13387 | align="center" {{attribute_from_template}} |456
13388 |}
13389 !! html/parsoid
13390 <table>
13391 <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>
13392 </tbody></table>
13393 !! end
13394
13395 !! test
13396 1. Entities and nowikis inside templated attributes should be handled correctly
13397 !! wikitext
13398 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13399 !! html/php
13400 <div style="background:#f9f9f9;">foo</div>
13401 !! html/parsoid
13402 <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>
13403 !! end
13404
13405 !! test
13406 2. Entities and nowikis inside templated attributes should be handled correctly
13407 !! wikitext
13408 {|
13409 |{{table_attribs_3}}
13410 |}
13411 !! html/php
13412 <table>
13413 <tr>
13414 <td style="background:#f9f9f9;">Foo
13415 </td></tr></table>
13416 !! html/parsoid
13417 <table>
13418 <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>
13419 </tbody></table>
13420 !! end
13421
13422 !! test
13423 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13424 !! wikitext
13425 {{tbl-start}}
13426 |{{table_attribs_3}}
13427 {{tbl-end}}
13428 !! html/php
13429 <table>
13430 <tr>
13431 <td style="background:#f9f9f9;">Foo
13432 </td></tr></table>
13433 !! html/parsoid
13434 <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}}]}'>
13435 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13436 </tbody></table>
13437 !! end
13438
13439 # T107622
13440 !! test
13441 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13442 !! wikitext
13443 {|
13444 |{{table_attribs_6}} hi
13445 |}
13446 !! html/php
13447 <table>
13448 <tr>
13449 <td style="background: red;">hi
13450 </td></tr></table>
13451 !! html/parsoid
13452 <table>
13453 <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>
13454 </tbody></table>
13455 !! end
13456
13457 !!test
13458 Templates: HTML Tables: 1. Generating start of a HTML table
13459 !! wikitext
13460 {{echo|<table><tr><td>foo</td>}}</tr></table>
13461 !! html
13462 <table><tr><td>foo</td></tr></table>
13463 !!end
13464
13465 !!test
13466 Templates: HTML Tables: 2a. Generating middle of a HTML table
13467 !! wikitext
13468 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13469 !! html
13470 <table><tr><td>foo</td></tr></table>
13471 !!end
13472
13473 !!test
13474 Templates: HTML Tables: 2b. Generating middle of a HTML table
13475 !! wikitext
13476 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13477 !! html
13478 <table><tr><td>foo</td></tr></table>
13479 !!end
13480
13481 !!test
13482 Templates: HTML Tables: 3. Generating end of a HTML table
13483 !! wikitext
13484 <table><tr>{{echo|<td>foo</td></tr></table>}}
13485 !! html
13486 <table><tr><td>foo</td></tr></table>
13487 !! end
13488
13489 !!test
13490 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13491 !! wikitext
13492 {{echo|<table>}}<tr><td>foo</td></tr></table>
13493 !! html
13494 <table><tr><td>foo</td></tr></table>
13495 !! end
13496
13497 !!test
13498 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13499 !! wikitext
13500 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13501 !! html
13502 <table><tr><td>foo</td></tr></table>
13503 !! end
13504
13505 !!test
13506 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13507 !! wikitext
13508 <table><tr>{{echo|<td>}}foo</td></tr></table>
13509 !! html
13510 <table><tr><td>foo</td></tr></table>
13511 !! end
13512
13513 !!test
13514 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13515 !! wikitext
13516 <table><tr><td>foo{{echo|</td>}}</tr></table>
13517 !! html
13518 <table><tr><td>foo</td></tr></table>
13519 !! end
13520
13521 !!test
13522 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13523 !! wikitext
13524 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13525 !! html
13526 <table><tr><td>foo</td></tr></table>
13527 !! end
13528
13529 !!test
13530 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13531 !! wikitext
13532 <table><tr><td>foo</td></tr>{{echo|</table>}}
13533 !! html
13534 <table><tr><td>foo</td></tr></table>
13535 !! end
13536
13537 !!test
13538 Templates: HTML Tables: 5. Proper fostering of categories from inside
13539 !!options
13540 parsoid=wt2html,wt2wt
13541 !! wikitext
13542 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13543 <!--Two categories (T52330)-->
13544 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13545 !! html/php+tidy
13546 <table><tbody><tr><td>foo</td></tr></tbody></table>
13547 <table><tbody><tr><td>foo</td></tr></tbody></table>
13548 !! html/parsoid
13549 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13550 <!--Two categories (T52330)-->
13551 <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>
13552 !!end
13553
13554 ## Remex doesn't account for fostered content.
13555 !! test
13556 Templates: Wiki Tables: 1a. Fostering of entire template content
13557 !! wikitext
13558 {|
13559 {{echo|a}}
13560 |}
13561 !! html/php
13562 <table>
13563 a
13564 <tr><td></td></tr></table>
13565 !! html/php+tidy
13566
13567 a
13568 <table><tbody><tr><td></td></tr></tbody></table>
13569 !! html/parsoid
13570 <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">
13571
13572 </table>
13573 !! end
13574
13575 !!test
13576 Templates: Wiki Tables: 1b. Fostering of entire template content
13577 !! wikitext
13578 {|
13579 {{echo|<div>}}
13580 foo
13581 {{echo|</div>}}
13582 |}
13583 !! html
13584 <table>
13585 <div>
13586 <p>foo
13587 </p>
13588 </div>
13589 <tr><td></td></tr></table>
13590 !! html/php+tidy
13591 <div>
13592 <p>foo
13593 </p>
13594 </div><table>
13595
13596 <tbody><tr><td></td></tr></tbody></table>
13597 !! html/parsoid
13598 <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|}"]}'>
13599 <p>foo</p>
13600 </div><table about="#mwt3">
13601
13602 </table>
13603 !! end
13604
13605 ## Remex doesn't account for fostered content.
13606 !! test
13607 Templates: Wiki Tables: 2. Fostering of partial template content
13608 !! wikitext
13609 {|
13610 {{echo|a
13611 <div>b</div>}}
13612 |}
13613 !! html/php
13614 <table>
13615 a
13616 <div>b</div>
13617 <tr><td></td></tr></table>
13618 !! html/php+tidy
13619
13620 a
13621 <div>b</div><table>
13622 <tbody><tr><td></td></tr></tbody></table>
13623 !! html/parsoid
13624 <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">
13625
13626
13627 </table>
13628 !! end
13629
13630 !!test
13631 Templates: Wiki Tables: 3. td-content via multiple templates
13632 !! wikitext
13633 {|
13634 {{echo|{{pipe}}a}}{{echo|b}}
13635 |}
13636 !! html
13637 <table>
13638 <tr>
13639 <td>ab
13640 </td></tr></table>
13641 !! end
13642
13643 !!test
13644 Templates: Wiki Tables: 4. Templated tags, no content
13645 !! wikitext
13646 {{tbl-start}}
13647 {{tbl-end}}
13648 !! html
13649 <table>
13650 <tr><td></td></tr></table>
13651 !! end
13652
13653 !!test
13654 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13655 !! wikitext
13656 {{tbl-start}}
13657 |foo
13658 {{tbl-end}}
13659 !! html
13660 <table>
13661 <tr>
13662 <td>foo
13663 </td></tr></table>
13664 !! end
13665
13666 !!test
13667 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13668 !! wikitext
13669 {{tbl-start}}
13670 {{!}}foo
13671 {{tbl-end}}
13672 !! html
13673 <table>
13674 <tr>
13675 <td>foo
13676 </td></tr></table>
13677 !! end
13678
13679 ## This test case is very specific to Parsoid's internals
13680 ## and is hence only tested for Parsoid's code. Parsoid uses
13681 ## a <meta> marker tag for <ref> tags and they are expanded
13682 ## much later. We are verifying that this <meta> tag usage
13683 ## doesn't prevent foster parenting.
13684 !! test
13685 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13686 !! wikitext
13687 {{PartialTable}}<ref>foo</ref>
13688 |}
13689
13690 <references />
13691 !! html/parsoid
13692 <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">
13693 <tbody>
13694 </tbody></table>
13695
13696 <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>
13697 !! end
13698
13699 !! test
13700 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13701 !! wikitext
13702 {{echo|
13703 {{{!}}
13704 {{!}}-}}
13705 <onlyinclude>
13706 |foo
13707 </onlyinclude>
13708 {{!}}}
13709 !! html/parsoid
13710 <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{{!}}}"]}'>
13711 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13712 <tbody><tr>
13713
13714 <td>foo
13715 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13716 </tbody></table>
13717 !! end
13718
13719 !!test
13720 Templates: Lists: Multi-line list-items via templates
13721 !! wikitext
13722 *{{echo|a {{nonexistent|
13723 unused}}}}
13724 *{{echo|b {{nonexistent|
13725 unused}}}}
13726 !! html
13727 <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>
13728 <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>
13729 !!end
13730
13731 !!test
13732 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13733 !! wikitext
13734 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13735 !! html
13736 <p><i>ab</i>c<i>d</i>e
13737 </p>
13738 !!end
13739
13740 !!test
13741 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13742 (PHP parser generates misnested html)
13743 !! wikitext
13744 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13745 !! html/parsoid
13746 <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>
13747 !!end
13748
13749 !!test
13750 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13751 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13752 !! options
13753 parsoid=wt2html,wt2wt
13754 !! wikitext
13755 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13756 !! html/php+tidy
13757 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13758 !! html/parsoid
13759 <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>
13760 <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>
13761 <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>
13762 !!end
13763
13764 !!test
13765 Templates: Ugly nesting: 4. Divs opened/closed across templates
13766 !! wikitext
13767 a<div>b{{echo|c</div>d}}e
13768 !! html
13769 a<div>bc</div>de
13770 !! html+tidy
13771 <p>a</p><div>bc</div><p>de</p>
13772 !! end
13773
13774 !! test
13775 Templates: Ugly templates: 3. newline-only template parameter
13776 !! wikitext
13777 foo {{echo|
13778 }}
13779 !! html
13780 <p>foo
13781 </p>
13782 !! end
13783
13784 # This looks like a bug: a single newline triggers p/br for some reason.
13785 !! test
13786 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13787 !! wikitext
13788 {{echo|
13789 }}
13790 !! html
13791 <p><br />
13792 </p>
13793 !! end
13794
13795 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13796 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13797 !! test
13798 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13799 !! wikitext
13800 {{echo|<table>}}
13801 {{echo|<div>foo}}
13802 {{echo|</table>}}
13803 !! html/parsoid
13804 <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">
13805 </span><table about="#mwt1">
13806 </table>
13807 !! end
13808
13809 # T66017 -- ugly wikitext with fostered content generates two template ranges
13810 # that are "identical" and generate nesting cycles in the algorithm
13811 !! test
13812 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13813 !! wikitext
13814 {{echo|<table><tr><td><table>}}
13815 {{echo|<div>}}
13816 {{echo|</div>}}
13817 !! html/parsoid
13818 <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"}'>
13819 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13820 </table></td></tr></tbody></table>
13821 !! end
13822
13823 !! test
13824 Templates: Parameters substituted at the top-level
13825 !! wikitext
13826 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13827
13828 {{{foo|bar|baz}}}
13829 !! html/php
13830 <p><i>who</i> me? <b>never!</b>
13831 </p><p>bar
13832 </p>
13833 !! html/parsoid
13834 <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>
13835
13836 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13837 !! end
13838
13839 !! test
13840 Templates: Param with empty arg in the final position
13841 !! wikitext
13842 {{{hi|}}}
13843 !! html/parsoid
13844 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13845 !! end
13846
13847 !!test
13848 Parser Functions: 1. Simple example
13849 !! wikitext
13850 {{uc:foo}}
13851 !! html
13852 <p>FOO
13853 </p>
13854 !!end
13855
13856 !!test
13857 Parser Functions: 2. Nested use (only outermost should be marked up)
13858 !! wikitext
13859 {{uc:{{lc:FOO}}}}
13860 !! html
13861 <p>FOO
13862 </p>
13863 !!end
13864
13865 ## Note that the templates inside the references are not wrapped
13866 !! test
13867 Template nested in extension tag in template
13868 !! options
13869 title=[[Main Page]]
13870 language=zh
13871 !! wikitext
13872 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13873 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13874 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13875 <references />
13876 !! html/parsoid
13877 <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>
13878 <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>
13879 <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>
13880 <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" class="external autonumber" href="http://test.com?q=ho"></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>
13881 !! end
13882
13883 ###
13884 ### Pre-save transform tests
13885 ###
13886
13887 !! test
13888 pre-save transform: subst:
13889 !! options
13890 pst
13891 !! wikitext
13892 {{subst:test}}
13893 !! html/php
13894 This is a test template
13895 !! end
13896
13897 !! test
13898 pre-save transform: normal template
13899 !! options
13900 pst
13901 !! wikitext
13902 {{test}}
13903 !! html/php
13904 {{test}}
13905 !! end
13906
13907 !! test
13908 pre-save transform: nonexistent template
13909 !! options
13910 pst
13911 !! wikitext
13912 {{thistemplatedoesnotexist}}
13913 !! html/php
13914 {{thistemplatedoesnotexist}}
13915 !! end
13916
13917 !! test
13918 pre-save transform: subst magic variables
13919 !! options
13920 pst
13921 !! wikitext
13922 {{subst:SITENAME}}
13923 !! html/php
13924 MediaWiki
13925 !! end
13926
13927 # This is T2089, which I fixed. -- wtm
13928 !! test
13929 pre-save transform: subst: templates with parameters
13930 !! options
13931 pst
13932 !! wikitext
13933 {{subst:paramtest|param="something else"}}
13934 !! html/php
13935 This is a test template with parameter "something else"
13936 !! end
13937
13938 !! article
13939 Template:nowikitest
13940 !! text
13941 <nowiki>'''not wiki'''</nowiki>
13942 !! endarticle
13943
13944 !! test
13945 pre-save transform: nowiki in subst (T3188)
13946 !! options
13947 pst
13948 !! wikitext
13949 {{subst:nowikitest}}
13950 !! html/php
13951 <nowiki>'''not wiki'''</nowiki>
13952 !! end
13953
13954 !! article
13955 Template:commenttest
13956 !! text
13957 This template has <!-- a comment --> in it.
13958 !! endarticle
13959
13960 !! test
13961 pre-save transform: comment in subst (T3936)
13962 !! options
13963 pst
13964 !! wikitext
13965 {{subst:commenttest}}
13966 !! html/php
13967 This template has <!-- a comment --> in it.
13968 !! end
13969
13970 !! test
13971 pre-save transform: unclosed tag
13972 !! options
13973 pst
13974 !! wikitext
13975 <nowiki>'''not wiki'''
13976 !! html/php
13977 <nowiki>'''not wiki'''
13978 !! end
13979
13980 !! test
13981 pre-save transform: mixed tag case
13982 !! options
13983 pst
13984 !! wikitext
13985 <NOwiki>'''not wiki'''</noWIKI>
13986 !! html/php
13987 <NOwiki>'''not wiki'''</noWIKI>
13988 !! end
13989
13990 !! test
13991 pre-save transform: unclosed comment in <nowiki>
13992 !! options
13993 pst
13994 !! wikitext
13995 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13996 !! html/php
13997 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13998 !!end
13999
14000 # Leading @ in this template definition works around a limitation
14001 # in parsoid's parserTests which otherwise strips the <span> from the
14002 # result (confusing it for a template wrapper)
14003 !! article
14004 Template:dangerous
14005 !!text
14006 @<span onmouseover="alert('crap')">Oh no</span>
14007 !!endarticle
14008
14009 !!test
14010 (confirming safety of fix for subst T3936)
14011 !! wikitext
14012 {{Template:dangerous}}
14013 !! html
14014 <p>@<span>Oh no</span>
14015 </p>
14016 !! end
14017
14018 !! test
14019 pre-save transform: comment containing gallery (T7024)
14020 !! options
14021 pst
14022 !! wikitext
14023 <!-- <gallery>data</gallery> -->
14024 !! html/php
14025 <!-- <gallery>data</gallery> -->
14026 !!end
14027
14028 !! test
14029 pre-save transform: comment containing extension
14030 !! options
14031 pst
14032 !! wikitext
14033 <!-- <tag>data</tag> -->
14034 !! html/php
14035 <!-- <tag>data</tag> -->
14036 !!end
14037
14038 !! test
14039 pre-save transform: comment containing nowiki
14040 !! options
14041 pst
14042 !! wikitext
14043 <!-- <nowiki>data</nowiki> -->
14044 !! html/php
14045 <!-- <nowiki>data</nowiki> -->
14046 !!end
14047
14048 !! test
14049 pre-save transform: <noinclude> in subst (T5298)
14050 !! options
14051 pst
14052 !! wikitext
14053 {{subst:Includes}}
14054 !! html/php
14055 Foobar
14056 !! end
14057
14058 !! test
14059 pre-save transform: <onlyinclude> in subst (T5298)
14060 !! options
14061 pst
14062 !! wikitext
14063 {{subst:Includes2}}
14064 !! html/php
14065 Foo
14066 !! end
14067
14068 !! article
14069 Template:SubstTest
14070 !!text
14071 {{<includeonly>subst:</includeonly>Includes}}
14072 !! endarticle
14073
14074 !! article
14075 Template:SafeSubstTest
14076 !! text
14077 {{<includeonly>safesubst:</includeonly>Includes}}
14078 !! endarticle
14079
14080 !! test
14081 T24297: safesubst: works during PST
14082 !! options
14083 pst
14084 !! wikitext
14085 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
14086 !! html/php
14087 FoobarFoobar
14088 !! end
14089
14090 !! test
14091 T24297: safesubst: works during normal parse
14092 !! wikitext
14093 {{SafeSubstTest}}
14094 !! html
14095 <p>Foobar
14096 </p>
14097 !! end
14098
14099 !! test
14100 subst: does not work during normal parse
14101 !! wikitext
14102 {{SubstTest}}
14103 !! html
14104 <p>{{subst:Includes}}
14105 </p>
14106 !! end
14107
14108 !! test
14109 pre-save transform: context links ("pipe trick")
14110 !! options
14111 pst
14112 !! wikitext
14113 [[Article (context)|]]
14114 [[Bar:Article|]]
14115 [[:Bar:Article|]]
14116 [[Bar:Article (context)|]]
14117 [[:Bar:Article (context)|]]
14118 [[|Article]]
14119 [[|Article (context)]]
14120 [[Bar:X (Y) Z|]]
14121 [[:Bar:X (Y) Z|]]
14122 !! html/php
14123 [[Article (context)|Article]]
14124 [[Bar:Article|Article]]
14125 [[:Bar:Article|Article]]
14126 [[Bar:Article (context)|Article]]
14127 [[:Bar:Article (context)|Article]]
14128 [[Article]]
14129 [[Article (context)]]
14130 [[Bar:X (Y) Z|X (Y) Z]]
14131 [[:Bar:X (Y) Z|X (Y) Z]]
14132 !! end
14133
14134 !! test
14135 pre-save transform: context links ("pipe trick") with interwiki prefix
14136 !! options
14137 pst
14138 !! wikitext
14139 [[interwiki:Article|]]
14140 [[:interwiki:Article|]]
14141 [[interwiki:Bar:Article|]]
14142 [[:interwiki:Bar:Article|]]
14143 !! html/php
14144 [[interwiki:Article|Article]]
14145 [[:interwiki:Article|Article]]
14146 [[interwiki:Bar:Article|Bar:Article]]
14147 [[:interwiki:Bar:Article|Bar:Article]]
14148 !! end
14149
14150 !! test
14151 pre-save transform: context links ("pipe trick") with parens in title
14152 !! options
14153 pst title=[[Somearticle (context)]]
14154 !! wikitext
14155 [[|Article]]
14156 !! html/php
14157 [[Article (context)|Article]]
14158 !! end
14159
14160 !! test
14161 pre-save transform: context links ("pipe trick") with comma in title
14162 !! options
14163 pst title=[[Someplace, Somewhere]]
14164 !! wikitext
14165 [[|Otherplace]]
14166 [[Otherplace, Elsewhere|]]
14167 [[Otherplace, Elsewhere, Anywhere|]]
14168 !! html/php
14169 [[Otherplace, Somewhere|Otherplace]]
14170 [[Otherplace, Elsewhere|Otherplace]]
14171 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14172 !! end
14173
14174 !! test
14175 pre-save transform: context links ("pipe trick") with parens and comma
14176 !! options
14177 pst title=[[Someplace (IGNORED), Somewhere]]
14178 !! wikitext
14179 [[|Otherplace]]
14180 [[Otherplace (place), Elsewhere|]]
14181 !! html/php
14182 [[Otherplace, Somewhere|Otherplace]]
14183 [[Otherplace (place), Elsewhere|Otherplace]]
14184 !! end
14185
14186 !! test
14187 pre-save transform: context links ("pipe trick") with comma and parens
14188 !! options
14189 pst title=[[Who, me? (context)]]
14190 !! wikitext
14191 [[|Yes, you.]]
14192 [[Me, Myself, and I (1937 song)|]]
14193 !! html/php
14194 [[Yes, you. (context)|Yes, you.]]
14195 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14196 !! end
14197
14198 !! test
14199 pre-save transform: context links ("pipe trick") with namespace
14200 !! options
14201 pst title=[[Ns:Somearticle]]
14202 !! wikitext
14203 [[|Article]]
14204 !! html/php
14205 [[Ns:Article|Article]]
14206 !! end
14207
14208 !! test
14209 pre-save transform: context links ("pipe trick") with namespace and parens
14210 !! options
14211 pst title=[[Ns:Somearticle (context)]]
14212 !! wikitext
14213 [[|Article]]
14214 !! html/php
14215 [[Ns:Article (context)|Article]]
14216 !! end
14217
14218 !! test
14219 pre-save transform: context links ("pipe trick") with namespace and comma
14220 !! options
14221 pst title=[[Ns:Somearticle, Context, Whatever]]
14222 !! wikitext
14223 [[|Article]]
14224 !! html/php
14225 [[Ns:Article, Context, Whatever|Article]]
14226 !! end
14227
14228 !! test
14229 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14230 !! options
14231 pst title=[[Ns:Somearticle, Context (context)]]
14232 !! wikitext
14233 [[|Article]]
14234 !! html/php
14235 [[Ns:Article (context)|Article]]
14236 !! end
14237
14238 !! test
14239 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14240 !! options
14241 pst title=[[Ns:Somearticle (IGNORED), Context]]
14242 !! wikitext
14243 [[|Article]]
14244 !! html/php
14245 [[Ns:Article, Context|Article]]
14246 !! end
14247
14248 !! test
14249 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14250 !! options
14251 pst
14252 !! wikitext
14253 [[Article(context)|]]
14254 [[Bar:Article(context)|]]
14255 [[:Bar:Article(context)|]]
14256 [[|Article(context)]]
14257 [[Bar:X(Y)Z|]]
14258 [[:Bar:X(Y)Z|]]
14259 !! html/php
14260 [[Article(context)|Article]]
14261 [[Bar:Article(context)|Article]]
14262 [[:Bar:Article(context)|Article]]
14263 [[Article(context)]]
14264 [[Bar:X(Y)Z|X(Y)Z]]
14265 [[:Bar:X(Y)Z|X(Y)Z]]
14266 !! end
14267
14268 !! test
14269 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14270 !! options
14271 pst
14272 !! wikitext
14273 [[Article (context)|]]
14274 [[Bar:Article (context)|]]
14275 [[:Bar:Article (context)|]]
14276 [[|Article (context)]]
14277 [[Bar:X (Y) Z|]]
14278 [[:Bar:X (Y) Z|]]
14279 !! html/php
14280 [[Article (context)|Article]]
14281 [[Bar:Article (context)|Article]]
14282 [[:Bar:Article (context)|Article]]
14283 [[Article (context)]]
14284 [[Bar:X (Y) Z|X (Y) Z]]
14285 [[:Bar:X (Y) Z|X (Y) Z]]
14286 !! end
14287
14288 !! test
14289 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14290 !! options
14291 pst
14292 !! wikitext
14293 [[Article(context)|]]
14294 [[Bar:Article(context)|]]
14295 [[:Bar:Article(context)|]]
14296 [[|Article(context)]]
14297 [[Bar:X(Y)Z|]]
14298 [[:Bar:X(Y)Z|]]
14299 !! html/php
14300 [[Article(context)|Article]]
14301 [[Bar:Article(context)|Article]]
14302 [[:Bar:Article(context)|Article]]
14303 [[Article(context)]]
14304 [[Bar:X(Y)Z|X(Y)Z]]
14305 [[:Bar:X(Y)Z|X(Y)Z]]
14306 !! end
14307
14308 !! test
14309 pre-save transform: context links ("pipe trick") with commas (T23660)
14310 !! options
14311 pst
14312 !! wikitext
14313 [[Article (context), context|]]
14314 [[Article (context),context|]]
14315 [[Bar:Article (context), context|]]
14316 [[Bar:Article (context),context|]]
14317 [[:Bar:Article (context), context|]]
14318 [[:Bar:Article (context),context|]]
14319 !! html/php
14320 [[Article (context), context|Article]]
14321 [[Article (context),context|Article]]
14322 [[Bar:Article (context), context|Article]]
14323 [[Bar:Article (context),context|Article]]
14324 [[:Bar:Article (context), context|Article]]
14325 [[:Bar:Article (context),context|Article]]
14326 !! end
14327
14328 !! test
14329 Parsoid: backwards pipe trick
14330 !! wikitext
14331 [[|'''bar''']]
14332 !! html/php
14333 <p>[[|<b>bar</b>]]
14334 </p>
14335 !! html/parsoid
14336 <p>[[|<b>bar</b>]]</p>
14337 !! end
14338
14339 !! test
14340 pre-save transform: trim trailing empty lines
14341 !! options
14342 pst
14343 !! wikitext
14344 Empty lines are trimmed
14345
14346
14347
14348
14349 !! html/php
14350 Empty lines are trimmed
14351 !! end
14352
14353 !! test
14354 pre-save transform: Signature expansion
14355 !! options
14356 pst
14357 !! wikitext
14358 * ~~~
14359 * ~~~~
14360 * ~~~~~
14361 * <noinclude>~~~</noinclude>
14362 * <includeonly>~~~</includeonly>
14363 * <onlyinclude>~~~</onlyinclude>
14364 !! html/php
14365 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14366 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14367 * 00:02, 1 January 1970 (UTC)
14368 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14369 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14370 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14371 !! end
14372
14373
14374 !! test
14375 ParserOutput flags from signature expansion (T84843)
14376 !! options
14377 pst
14378 showflags
14379 !! wikitext
14380 ~~~~
14381 !! html/php
14382 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14383 flags=user-signature
14384 !! end
14385
14386
14387 !! test
14388 pre-save transform: Signature expansion in nowiki tags (T2093)
14389 !! options
14390 pst disabled
14391 !! wikitext
14392 Shall not expand:
14393
14394 <nowiki>~~~~</nowiki>
14395
14396 <includeonly><nowiki>~~~~</nowiki></includeonly>
14397
14398 <noinclude><nowiki>~~~~</nowiki></noinclude>
14399
14400 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14401
14402 {{subst:Foo}} shall be converted to FOO
14403
14404 As well as inside noinclude/onlyinclude
14405 <noinclude>{{subst:Foo}}</noinclude>
14406 <onlyinclude>{{subst:Foo}}</onlyinclude>
14407
14408 But not inside includeonly
14409 <includeonly>{{subst:Foo}}</includeonly>
14410 !! html/php
14411 Shall not expand:
14412
14413 <nowiki>~~~~</nowiki>
14414
14415 <includeonly><nowiki>~~~~</nowiki></includeonly>
14416
14417 <noinclude><nowiki>~~~~</nowiki></noinclude>
14418
14419 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14420
14421 FOO shall be converted to FOO
14422
14423 As well as inside noinclude/onlyinclude
14424 <noinclude>FOO</noinclude>
14425 <onlyinclude>FOO</onlyinclude>
14426
14427 But not inside includeonly
14428 <includeonly>{{subst:Foo}}</includeonly>
14429 !! end
14430
14431 !! test
14432 Parsoid: Recognize nowiki with trailing space in tags
14433 !! options
14434 parsoid=wt2html
14435 !! wikitext
14436 <nowiki ><div>[[foo]]</nowiki >
14437
14438 a<nowiki / >b
14439
14440 c<nowiki />d
14441
14442 e<nowiki/ >f
14443 !! html/php+tidy
14444 <p>&lt;div&gt;[[foo]]
14445 </p><p>a&lt;nowiki / &gt;b
14446 </p><p>cd
14447 </p><p>e&lt;nowiki/ &gt;f
14448 </p>
14449 !! html/parsoid
14450 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14451
14452 <p>a&lt;nowiki / >b</p>
14453
14454 <p>c<span typeof="mw:Nowiki"></span>d</p>
14455
14456 <p>e&lt;nowiki/ >f</p>
14457 !! end
14458
14459 !! test
14460 Parsoid: Recognize nowiki with odd capitalization
14461 !! options
14462 parsoid=wt2html
14463 !! wikitext
14464 <noWikI ><div>[[foo]]</Nowiki >
14465 !! html/php+tidy
14466 <p>&lt;div&gt;[[foo]]
14467 </p>
14468 !! html/parsoid
14469 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14470 !! end
14471
14472
14473 !! test
14474 Parsoid: Escape nowiki with trailing space in tags
14475 !! options
14476 parsoid=html2wt
14477 !! html/parsoid
14478 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14479 <p>a&lt;nowiki /&gt;b</p>
14480 <p>c&lt;nowiki/ &gt;d</p>
14481 !! wikitext
14482 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14483
14484 a&lt;nowiki /&gt;b
14485
14486 c&lt;nowiki/ &gt;d
14487 !! end
14488
14489 !! test
14490 Parsoid: Escape weird noWikI capitalizations
14491 !! options
14492 parsoid=html2wt
14493 !! html/parsoid
14494 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14495 !! wikitext
14496 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14497 !! end
14498
14499 ###
14500 ### Message transform tests
14501 ###
14502 !! test
14503 message transform: magic variables
14504 !! options
14505 msg
14506 !! wikitext
14507 {{SITENAME}}
14508 !! html
14509 MediaWiki
14510 !! end
14511
14512 !! test
14513 message transform: should not transform wiki markup
14514 !! options
14515 msg
14516 !! wikitext
14517 ''test''
14518 !! html
14519 ''test''
14520 !! end
14521
14522 !! test
14523 message transform: <noinclude> in transcluded template (T6926)
14524 !! options
14525 msg
14526 !! wikitext
14527 {{Includes}}
14528 !! html
14529 Foobar
14530 !! end
14531
14532 !! test
14533 message transform: <onlyinclude> in transcluded template (T6926)
14534 !! options
14535 msg
14536 !! wikitext
14537 {{Includes2}}
14538 !! html
14539 Foo
14540 !! end
14541
14542 !! test
14543 {{#special:}} page name, known
14544 !! options
14545 msg
14546 !! wikitext
14547 {{#special:Recentchanges}}
14548 !! html
14549 Special:RecentChanges
14550 !! end
14551
14552 !! test
14553 {{#special:}} page name with subpage, known
14554 !! options
14555 msg
14556 !! wikitext
14557 {{#special:Recentchanges/param}}
14558 !! html
14559 Special:RecentChanges/param
14560 !! end
14561
14562 !! test
14563 {{#special:}} page name, unknown
14564 !! options
14565 msg
14566 !! wikitext
14567 {{#special:foobar nonexistent}}
14568 !! html
14569 Special:Foobar nonexistent
14570 !! end
14571
14572 !! test
14573 {{#speciale:}} page name, known
14574 !! options
14575 msg
14576 !! wikitext
14577 {{#speciale:Recentchanges}}
14578 !! html
14579 Special:RecentChanges
14580 !! end
14581
14582 !! test
14583 {{#speciale:}} page name with subpage, known
14584 !! options
14585 msg
14586 !! wikitext
14587 {{#speciale:Recentchanges/param}}
14588 !! html
14589 Special:RecentChanges/param
14590 !! end
14591
14592 !! test
14593 {{#speciale:}} page name, unknown
14594 !! options
14595 msg
14596 !! wikitext
14597 {{#speciale:foobar nonexistent}}
14598 !! html
14599 Special:Foobar_nonexistent
14600 !! end
14601
14602 ###
14603 ### Images
14604 ###
14605 ### For Parsoid-specific tests, see
14606 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14607
14608 !! test
14609 Simple image
14610 !! options
14611 parsoid=wt2html,wt2wt,html2html
14612 !! wikitext
14613 [[Image:foobar.jpg]]
14614 !! html/php
14615 <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>
14616 </p>
14617 !! html/parsoid
14618 <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>
14619 !! end
14620
14621 !! test
14622 Serialize simple image with span wrapper
14623 !! options
14624 parsoid=html2wt
14625 !! html/parsoid
14626 <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>
14627 !! wikitext
14628 [[File:Foobar.jpg]]
14629 !! end
14630
14631 !! test
14632 Simple image (using File: namespace, now canonical)
14633 !! wikitext
14634 [[File:Foobar.jpg]]
14635 !! html/php
14636 <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>
14637 </p>
14638 !! html/parsoid
14639 <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>
14640 !! end
14641
14642 !! test
14643 Right-aligned image
14644 !! wikitext
14645 [[File:Foobar.jpg|right]]
14646 !! html/php
14647 <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>
14648 !! html/parsoid
14649 <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>
14650 !! end
14651
14652 !! test
14653 Image with caption
14654 !! wikitext
14655 [[File:Foobar.jpg|right|Caption text]]
14656 !! html/php
14657 <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>
14658 !! html/parsoid
14659 <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>
14660 !! end
14661
14662 !! test
14663 Image with caption, T55312 #1
14664 !! wikitext
14665 [[File:Foobar.jpg|right|Caption page stuff]]
14666 !! html/php
14667 <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>
14668 !! html/parsoid
14669 <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>
14670 !! end
14671
14672 !! test
14673 Image with caption, T55312 #2
14674 !! wikitext
14675 [[File:Foobar.jpg|right|Caption page=]]
14676 !! html/php
14677 <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>
14678 !! html/parsoid
14679 <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>
14680 !! end
14681
14682 !! test
14683 Image with caption, T55312 #3
14684 !! wikitext
14685 [[File:Foobar.jpg|right|Caption page=stuff]]
14686 !! html/php
14687 <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>
14688 !! html/parsoid
14689 <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>
14690 !! end
14691
14692 !! test
14693 Image caption with pipe entity
14694 !! wikitext
14695 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14696 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14697 !! html/php
14698 <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>
14699 <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>
14700 !! html/parsoid
14701 <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>
14702 <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>
14703 !! end
14704
14705 !! test
14706 Allow empty links in image captions (T62753)
14707 !! options
14708 thumbsize=220
14709 !! wikitext
14710 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14711 [[]]
14712 [[Link2]]
14713 ]]
14714 !! html/php
14715 <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>
14716 !! html/parsoid
14717 <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>
14718 [[]]
14719 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14720 </figcaption></figure>
14721 !! end
14722
14723 !! test
14724 Titles in unlinked images (T23454)
14725 !! wikitext
14726 [[File:Foobar.jpg|link=|stuff]]
14727 !! html/php
14728 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" title="stuff" width="1941" height="220" />
14729 </p>
14730 !! html/parsoid
14731 <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>
14732 !! end
14733
14734 !! test
14735 Link with empty target
14736 !! wikitext
14737 [[]]
14738 !! html
14739 <p>[[]]
14740 </p>
14741 !! end
14742
14743 !! test
14744 Image with link trail
14745 !! wikitext
14746 Linktrails should not work for images: [[File:Foobar.jpg]]s
14747 !! html/php
14748 <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
14749 </p>
14750 !! html/parsoid
14751 <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>
14752 !! end
14753
14754 !! test
14755 Image with empty attribute
14756 !! options
14757 parsoid=wt2html,wt2wt,html2html
14758 !! wikitext
14759 [[File:Foobar.jpg|right||Caption text]]
14760 !! html/php
14761 <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>
14762 !! html/parsoid
14763 <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>
14764 !! end
14765
14766 !! test
14767 1. Block image with individual attributes from templates
14768 !! wikitext
14769 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14770 !! html/php
14771 <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>
14772 !! html/parsoid
14773 <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>
14774 !! end
14775
14776 !! test
14777 2. Block Image with individual attributes from templates
14778 !! wikitext
14779 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14780 !! html/php
14781 <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>
14782 !! html/parsoid
14783 <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>
14784 !! end
14785
14786 !! test
14787 3. Inline image with individual attributes from templates
14788 !! wikitext
14789 [[File:Foobar.jpg|{{echo|50px}}]]
14790 !! html/php
14791 <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>
14792 </p>
14793 !! html/parsoid
14794 <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>
14795 !! end
14796
14797 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14798 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14799 !! test
14800 Image with multiple attributes from the same template
14801 !! wikitext
14802 [[File:Foobar.jpg|{{image_attribs}}]]
14803 !! html/php
14804 <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>
14805 !! html/parsoid
14806 <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>
14807 !! end
14808
14809 !! test
14810 Image with link tails
14811 !! options
14812 thumbsize=220
14813 !! wikitext
14814 123[[File:Foobar.jpg]]456
14815 123[[File:Foobar.jpg|right]]456
14816 123[[File:Foobar.jpg|thumb]]456
14817 !! html/php
14818 <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
14819 </p>
14820 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
14821 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
14822 !! html/php+tidy
14823 <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
14824 </p><p>
14825 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
14826 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>
14827 !! html/parsoid
14828 <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>
14829 <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
14830 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>
14831 !! end
14832
14833 !! test
14834 Image with multiple captions -- only last one is accepted
14835 !! wikitext
14836 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14837 !! html/php
14838 <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>
14839 !! html/parsoid
14840 <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>
14841 !! end
14842
14843 !! test
14844 Image with multiple widths -- use last
14845 !! wikitext
14846 [[File:Foobar.jpg|200px|300px|caption]]
14847 !! html/php
14848 <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>
14849 </p>
14850 !! html/parsoid
14851 <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>
14852 !! end
14853
14854 !! test
14855 Image with multiple alignments -- use first (T50664)
14856 !! options
14857 thumbsize=220
14858 !! wikitext
14859 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14860
14861 [[File:Foobar.jpg|middle|text-top|caption]]
14862 !! html/php
14863 <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>
14864 <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>
14865 </p>
14866 !! html/parsoid
14867 <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>
14868 <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>
14869 !! end
14870
14871 !! test
14872 Image with width attribute at different positions
14873 !! wikitext
14874 [[File:Foobar.jpg|200px|right|Caption]]
14875 [[File:Foobar.jpg|right|200px|Caption]]
14876 [[File:Foobar.jpg|right|Caption|200px]]
14877 !! html/php
14878 <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>
14879 <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>
14880 <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>
14881 !! html/parsoid
14882 <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>
14883 <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>
14884 <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>
14885 !! end
14886
14887 # a sad bit of backward-compatibility
14888 !! test
14889 Image with size specified with pxpx (T15500, T53628)
14890 !! options
14891 parsoid=wt2html,wt2wt,html2html
14892 !! wikitext
14893 [[File:Foobar.jpg|20pxpx]]
14894 [[File:Foobar.jpg|200x20pxpx]]
14895 !! html/php
14896 <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>
14897 <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>
14898 </p>
14899 !! html/parsoid
14900 <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>
14901 !! end
14902
14903 !! test
14904 Image with link parameter, wiki target
14905 !! wikitext
14906 [[File:Foobar.jpg|link=Main Page]]
14907 !! html/php
14908 <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>
14909 </p>
14910 !! html/parsoid
14911 <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>
14912 !! end
14913
14914 # parsoid T51293 (part 1)
14915 !! test
14916 Image with link parameter, URL target
14917 !! wikitext
14918 [[File:Foobar.jpg|link=http://example.com/]]
14919 !! html/php
14920 <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>
14921 </p>
14922 !! html/parsoid
14923 <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>
14924 !! end
14925
14926 # parsoid T51293 (part 2)
14927 !! test
14928 Image with link parameter, protocol-less URL target
14929 !! wikitext
14930 [[File:Foobar.jpg|link=//example.com/]]
14931 !! html/php
14932 <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>
14933 </p>
14934 !! html/parsoid
14935 <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>
14936 !! end
14937
14938 !! test
14939 Escaping non-block captions (T107435)
14940 !! options
14941 parsoid={
14942 "modes": ["wt2wt"],
14943 "changes": [
14944 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14945 ]
14946 }
14947 !! wikitext
14948 [[Image:Foobar.jpg|caption]]
14949 !! wikitext/edited
14950 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14951 !! end
14952
14953 # wgExternalLinkTarget not supported by Parsoid
14954 !! test
14955 Image with link parameter, wgExternalLinkTarget
14956 !! wikitext
14957 [[Image:foobar.jpg|link=http://example.com/]]
14958 !! config
14959 wgExternalLinkTarget='foobar'
14960 !! html/php
14961 <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>
14962 </p>
14963 !! end
14964
14965 !! test
14966 Image with link parameter, wgNoFollowLinks set to false
14967 !! wikitext
14968 [[Image:foobar.jpg|link=http://example.com/]]
14969 !! config
14970 wgNoFollowLinks=false
14971 !! html/php
14972 <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>
14973 </p>
14974 !! end
14975
14976 !! test
14977 Image with link parameter, wgNoFollowDomainExceptions
14978 !! wikitext
14979 [[Image:foobar.jpg|link=http://example.com/]]
14980 !! config
14981 wgNoFollowDomainExceptions='example.com'
14982 !! html/php
14983 <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>
14984 </p>
14985 !! end
14986
14987 # wgExternalLinkTarget not supported by Parsoid
14988 !! test
14989 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14990 !! wikitext
14991 [[Image:foobar.jpg|link=http://example.com/|Title]]
14992 !! config
14993 wgExternalLinkTarget='foobar'
14994 !! html/php
14995 <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>
14996 </p>
14997 !! end
14998
14999 !! test
15000 Image with empty link parameter
15001 !! wikitext
15002 [[File:Foobar.jpg|link=]]
15003 !! html/php
15004 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" />
15005 </p>
15006 !! html/parsoid
15007 <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>
15008 !! end
15009
15010 !! test
15011 Image with link parameter (wiki target) and unnamed parameter
15012 !! wikitext
15013 [[File:Foobar.jpg|link=Main_Page|Title]]
15014 !! html/php
15015 <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>
15016 </p>
15017 !! html/parsoid
15018 <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>
15019 !! end
15020
15021 !! test
15022 Image with link parameter (URL target) and unnamed parameter
15023 !! wikitext
15024 [[File:Foobar.jpg|link=http://example.com/|Title]]
15025 !! html/php
15026 <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>
15027 </p>
15028 !! html/parsoid
15029 <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>
15030 !! end
15031
15032 !! test
15033 Thumbnail image with link parameter
15034 !! options
15035 thumbsize=220
15036 parsoid=wt2html,wt2wt,html2html
15037 !! wikitext
15038 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
15039 !! html/php
15040 <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>
15041 !! html/parsoid
15042 <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>
15043 !! end
15044
15045 !! test
15046 Manually-specified thumbnail image
15047 !! options
15048 thumbsize=220
15049 !! wikitext
15050 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15051 !! html/php
15052 <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>
15053 !! html/parsoid
15054 <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>
15055 !! end
15056
15057 !! test
15058 Manually-specified thumbnail image (backwards compat)
15059 !! options
15060 thumbsize=220
15061 parsoid=html2wt
15062 !! wikitext
15063 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15064 !! html/php
15065 <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>
15066 !! html/parsoid
15067 <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>
15068 !! end
15069
15070 !! test
15071 Manually-specified thumbnail image with explicit link to wiki page
15072 !! options
15073 thumbsize=220
15074 parsoid=wt2html,wt2wt,html2html
15075 !! wikitext
15076 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
15077 !! html/php
15078 <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>
15079 !! html/parsoid
15080 <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>
15081 !! end
15082
15083 !! test
15084 Manually-specified thumbnail image with explicit link to url
15085 !! options
15086 thumbsize=220
15087 parsoid=wt2html,wt2wt,html2html
15088 !! wikitext
15089 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
15090 !! html/php
15091 <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>
15092 !! html/parsoid
15093 <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>
15094 !! end
15095
15096 !! test
15097 Manually-specified thumbnail image with explicit no link
15098 !! options
15099 thumbsize=220
15100 parsoid=wt2html,wt2wt,html2html
15101 !! wikitext
15102 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
15103 !! html/php
15104 <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>
15105 !! html/parsoid
15106 <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>
15107 !! end
15108
15109 !! test
15110 Manually-specified thumbnail image with explicit link and alt text
15111 !! options
15112 thumbsize=220
15113 parsoid=wt2html,wt2wt,html2html
15114 !! wikitext
15115 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
15116 !! html/php
15117 <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>
15118 !! html/parsoid
15119 <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>
15120 !! end
15121
15122 !! test
15123 Image with frame and link
15124 !! options
15125 parsoid=wt2html,wt2wt,html2html
15126 !! wikitext
15127 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
15128 !! html/php
15129 <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>
15130 !! html/parsoid
15131 <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>
15132 !! end
15133
15134 !! test
15135 Image with frame and link and explicit alt
15136 !! options
15137 parsoid=wt2html,wt2wt,html2html
15138 !! wikitext
15139 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15140 !! html/php
15141 <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>
15142 !! html/parsoid
15143 <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>
15144 !! end
15145
15146 !! test
15147 Image with wiki markup in implicit alt
15148 !! wikitext
15149 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15150
15151 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15152 !! html/php
15153 <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>
15154 </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>
15155 </p>
15156 !! html/parsoid
15157 <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>
15158
15159 <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>
15160 !! end
15161
15162 !! test
15163 Alt image option should handle most kinds of wikitext without barfing
15164 !! wikitext
15165 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15166 !! html/php
15167 <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>
15168 !! html/parsoid
15169 <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>
15170 !! end
15171
15172 !! test
15173 Ampersand in alt attribute (T206940)
15174 !! wikitext
15175 [[File:Foobar.jpg|alt=&amp;amp;]]
15176
15177 <!-- consistency with gallery extension -->
15178 <gallery>
15179 File:Foobar.jpg|alt=&amp;amp;
15180 </gallery>
15181 !! html/php+tidy
15182 <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>
15183 </p>
15184 <ul class="gallery mw-gallery-traditional">
15185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15186 <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>
15187 <div class="gallerytext">
15188 </div>
15189 </div></li>
15190 </ul>
15191 !! html/parsoid
15192 <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>
15193
15194 <!-- consistency with gallery extension -->
15195 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15196 <li class="gallerybox" style="width: 155px;">
15197 <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>
15198 <div class="gallerytext"></div>
15199 </li>
15200 </ul>
15201 !! end
15202
15203 ## FIXME: The inconsistency in the gallery extension on the php side is T49646
15204 !! test
15205 Link with encoded pipe in alt option
15206 !! options
15207 parsoid={
15208 "modes": ["wt2html", "html2html"]
15209 }
15210 !! wikitext
15211 [[File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption]]
15212
15213 <!-- consistency with gallery extension -->
15214 <gallery>
15215 File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption
15216 </gallery>
15217 !! html/php+tidy
15218 <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>
15219 </p>
15220 <ul class="gallery mw-gallery-traditional">
15221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15222 <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>
15223 <div class="gallerytext">
15224 </div>
15225 </div></li>
15226 </ul>
15227 !! html/parsoid
15228 <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>
15229
15230 <!-- consistency with gallery extension -->
15231 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15232 <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>
15233 !! end
15234
15235 !! test
15236 Italics markup in alt attribute (T206940)
15237 !! options
15238 parsoid=wt2html,html2html
15239 !! wikitext
15240 [[File:Foobar.jpg|alt=''x''|caption]]
15241
15242 <!-- consistency with gallery extension -->
15243 <gallery>
15244 File:Foobar.jpg|alt=''x''|caption
15245 </gallery>
15246 !! html/php+tidy
15247 <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>
15248 </p>
15249 <ul class="gallery mw-gallery-traditional">
15250 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15251 <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>
15252 <div class="gallerytext">
15253 <p>caption
15254 </p>
15255 </div>
15256 </div></li>
15257 </ul>
15258 !! html/parsoid
15259 <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>
15260
15261 <!-- consistency with gallery extension -->
15262 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15263 <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>
15264 </ul>
15265 !! end
15266
15267 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15268 ## are no longer in storage.
15269 !! test
15270 Nowiki markup in alt attribute (T206940)
15271 !! options
15272 parsoid=html2wt
15273 !! wikitext
15274 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15275
15276 <!-- consistency with gallery extension -->
15277 <gallery>
15278 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15279 </gallery>
15280 !! html/php+tidy
15281 <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>
15282 </p>
15283 <ul class="gallery mw-gallery-traditional">
15284 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15285 <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>
15286 <div class="gallerytext">
15287 <p>caption
15288 </p>
15289 </div>
15290 </div></li>
15291 </ul>
15292 !! html/parsoid
15293 <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>
15294
15295 <!-- consistency with gallery extension -->
15296 <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"}}'>
15297 <li class="gallerybox" style="width: 155px;">
15298 <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>
15299 <div class="gallerytext">caption</div>
15300 </li>
15301 </ul>
15302 !! end
15303
15304 !! test
15305 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15306 !! wikitext
15307 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15308
15309 <!-- consistency with gallery extension -->
15310 <gallery>
15311 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15312 </gallery>
15313 !! html/php+tidy
15314 <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>
15315 </p>
15316 <ul class="gallery mw-gallery-traditional">
15317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15318 <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>
15319 <div class="gallerytext">
15320 <p>caption
15321 </p>
15322 </div>
15323 </div></li>
15324 </ul>
15325 !! html/parsoid
15326 <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>
15327
15328 <!-- consistency with gallery extension -->
15329 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt9" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15330 <li class="gallerybox" style="width: 155px;">
15331 <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>
15332 <div class="gallerytext">caption</div>
15333 </li>
15334 </ul>
15335 !! end
15336
15337 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15338 ## are no longer in storage.
15339 !! test
15340 Ampersand in link attribute (T206940)
15341 !! options
15342 parsoid=html2wt
15343 !! wikitext
15344 [[File:Foobar.jpg|link=Foo &amp; bar]]
15345
15346 <!-- consistency with gallery extension -->
15347 <gallery>
15348 File:Foobar.jpg|link=Foo &amp; bar
15349 </gallery>
15350 !! html/php+tidy
15351 <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>
15352 </p>
15353 <ul class="gallery mw-gallery-traditional">
15354 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15355 <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>
15356 <div class="gallerytext">
15357 </div>
15358 </div></li>
15359 </ul>
15360 !! html/parsoid
15361 <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>
15362
15363 <!-- consistency with gallery extension -->
15364 <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"}}'>
15365 <li class="gallerybox">
15366 <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>
15367 <div class="gallerytext"></div>
15368 </li>
15369 </ul>
15370 !! end
15371
15372 !! test
15373 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15374 !! wikitext
15375 [[File:Foobar.jpg|link=Foo_&_bar]]
15376
15377 <!-- consistency with gallery extension -->
15378 <gallery>
15379 File:Foobar.jpg|link=Foo_&_bar
15380 </gallery>
15381 !! html/php+tidy
15382 <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>
15383 </p>
15384 <ul class="gallery mw-gallery-traditional">
15385 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15386 <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>
15387 <div class="gallerytext">
15388 </div>
15389 </div></li>
15390 </ul>
15391 !! html/parsoid
15392 <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>
15393
15394 <!-- consistency with gallery extension -->
15395 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15396 <li class="gallerybox">
15397 <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>
15398 <div class="gallerytext"></div>
15399 </li>
15400 </ul>
15401 !! end
15402
15403 !! test
15404 Italics markup in link attribute (T206940)
15405 !! options
15406 parsoid=wt2html,html2html
15407 !! wikitext
15408 [[Foo''s bar''s]]
15409
15410 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15411 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15412
15413 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15414
15415 <!-- consistency with gallery extension -->
15416 <gallery>
15417 File:Foobar.jpg|link=Foo''s bar''s|caption1
15418 File:Foobar.jpg|link=''Main Page''|caption2
15419 </gallery>
15420 !! html/php+tidy
15421 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15422 </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>
15423 </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>
15424 </p>
15425 <ul class="gallery mw-gallery-traditional">
15426 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15427 <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>
15428 <div class="gallerytext">
15429 <p>caption1
15430 </p>
15431 </div>
15432 </div></li>
15433 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15434 <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>
15435 <div class="gallerytext">
15436 <p>caption2
15437 </p>
15438 </div>
15439 </div></li>
15440 </ul>
15441 !! html/parsoid
15442 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15443
15444 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15445 <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>
15446
15447 <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>
15448
15449 <!-- consistency with gallery extension -->
15450 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15451 <li class="gallerybox">
15452 <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>
15453 <div class="gallerytext">caption1</div>
15454 </li>
15455 <li class="gallerybox">
15456 <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>
15457 <div class="gallerytext">caption2</div>
15458 </li>
15459 </ul>
15460 !! end
15461
15462 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15463 ## are no longer in storage.
15464 !! test
15465 Nowiki markup in link attribute (T206940)
15466 !! options
15467 parsoid=html2wt
15468 !! wikitext
15469 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15470
15471 <!-- consistency with gallery extension -->
15472 <gallery>
15473 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15474 </gallery>
15475 !! html/php+tidy
15476 <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>
15477 </p>
15478 <ul class="gallery mw-gallery-traditional">
15479 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15480 <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>
15481 <div class="gallerytext">
15482 <p>caption
15483 </p>
15484 </div>
15485 </div></li>
15486 </ul>
15487 !! html/parsoid
15488 <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>
15489
15490 <!-- consistency with gallery extension -->
15491 <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"}}'>
15492 <li class="gallerybox">
15493 <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>
15494 <div class="gallerytext">caption</div>
15495 </li>
15496 </ul>
15497 !! end
15498
15499 !! test
15500 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15501 !! wikitext
15502 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15503
15504 <!-- consistency with gallery extension -->
15505 <gallery>
15506 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15507 </gallery>
15508 !! html/php+tidy
15509 <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>
15510 </p>
15511 <ul class="gallery mw-gallery-traditional">
15512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15513 <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>
15514 <div class="gallerytext">
15515 <p>caption
15516 </p>
15517 </div>
15518 </div></li>
15519 </ul>
15520 !! html/parsoid
15521 <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>
15522
15523 <!-- consistency with gallery extension -->
15524 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15525 <li class="gallerybox">
15526 <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>
15527 <div class="gallerytext">caption</div>
15528 </li>
15529 </ul>
15530 !! end
15531
15532 !! test
15533 HTML entity prefix in link markup (T209236)
15534 !! wikitext
15535 [[File:Foobar.jpg|link=https://example.com?foo&params=bar]]
15536
15537 <!-- consistency with gallery extension -->
15538 <gallery>
15539 File:Foobar.jpg|link=https://example.com?foo&params=bar
15540 </gallery>
15541 !! html/php+tidy
15542 <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>
15543 </p>
15544 <ul class="gallery mw-gallery-traditional">
15545 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15546 <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>
15547 <div class="gallerytext">
15548 </div>
15549 </div></li>
15550 </ul>
15551 !! html/parsoid
15552 <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>
15553
15554 <!-- consistency with gallery extension -->
15555 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15556 <li class="gallerybox">
15557 <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>
15558 <div class="gallerytext"></div>
15559 </li>
15560 </ul>
15561 !! end
15562
15563 !! test
15564 Image with table with attributes in caption
15565 !! options
15566 parsoid=wt2html,html2html
15567 !! wikitext
15568 [[File:Foobar.jpg|thumb|
15569 {| class="123" |
15570 |- class="456" |
15571 | ha
15572 |}
15573 ]]
15574 !! html/parsoid
15575 <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>
15576 <table class="123">
15577 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15578 <td> ha</td></tr>
15579 </tbody></table>
15580 </figcaption></figure>
15581 !! end
15582
15583 !! test
15584 Image with table with rows from templates in caption
15585 !! wikitext
15586 [[File:Foobar.jpg|thumb|
15587 {|
15588 {{echo|{{!}} hi}}
15589 |}
15590 ]]
15591 !! html/parsoid
15592 <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>
15593 <table>
15594 <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>
15595 </tbody></table>
15596 </figcaption></figure>
15597 !! end
15598
15599 !! test
15600 Image with nested tables in caption
15601 !! wikitext
15602 [[File:Foobar.jpg|thumb|Foo<br />
15603 {|
15604 |
15605 {|
15606 |z
15607 |}
15608 |}
15609 ]]
15610 !! html/parsoid
15611 <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}'/>
15612 <table>
15613 <tbody><tr><td>
15614 <table>
15615 <tbody><tr><td>z</td></tr>
15616 </tbody></table></td></tr>
15617 </tbody></table>
15618 </figcaption></figure>
15619 !! end
15620
15621 !! test
15622 Image with heading and horizontal rule in caption
15623 !! wikitext
15624 [[File:Foobar.jpg|thumb|
15625 ===Testing===
15626 123
15627 --------------
15628 ]]
15629 !! html/php
15630 <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>
15631 !! html/parsoid
15632 <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>
15633 <h3 id="Testing">Testing</h3>
15634 123
15635 <hr data-parsoid='{"extra_dashes":10}'/>
15636 </figcaption></figure>
15637 !! end
15638
15639 ###################
15640 # Conflicting image format options.
15641 # First option specified should 'win'.
15642 # All three cases in each test should be identical.
15643
15644 !! test
15645 Image with 'frameless' first.
15646 !! options
15647 parsoid=wt2html,wt2wt,html2html
15648 !! wikitext
15649 [[File:Foobar.jpg|frameless|caption]]
15650
15651 [[File:Foobar.jpg|frameless|frame|caption]]
15652
15653 [[File:Foobar.jpg|frameless|thumb|caption]]
15654 !! html/php
15655 <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>
15656 </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>
15657 </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>
15658 </p>
15659 !! html/parsoid
15660 <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>
15661 <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>
15662 <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>
15663 !! end
15664
15665 !! test
15666 Image with 'frame' first.
15667 !! options
15668 parsoid=wt2html,wt2wt,html2html
15669 !! wikitext
15670 [[File:Foobar.jpg|frame|caption]]
15671 [[File:Foobar.jpg|frame|frameless|caption]]
15672 [[File:Foobar.jpg|frame|thumb|caption]]
15673 !! html/php
15674 <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>
15675 <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>
15676 <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>
15677 !! html/parsoid
15678 <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>
15679 <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>
15680 <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>
15681 !! end
15682
15683 !! test
15684 Image with 'thumb' first.
15685 !! options
15686 parsoid=wt2html,wt2wt,html2html
15687 !! wikitext
15688 [[File:Foobar.jpg|thumb|caption]]
15689 [[File:Foobar.jpg|thumb|frameless|caption]]
15690 [[File:Foobar.jpg|thumb|frame|caption]]
15691 !! html/php
15692 <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>
15693 <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>
15694 <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>
15695 !! html/parsoid
15696 <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>
15697 <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>
15698 <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>
15699 !! end
15700
15701 ###################
15702 # Image sizing.
15703 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15704 # and https://phabricator.wikimedia.org/T64258
15705 # Foobar has actual size of 1941x220
15706 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15707 # a scalable format.
15708 # 2. Framed images always ignore size options; always render at default size.
15709 # 3. "Unspecified format" and border are the only types which can be
15710 # enlarged.
15711
15712 !! test
15713 Image: unspecified format and border enlarge
15714 !! options
15715 parsoid=wt2html,wt2wt,html2html
15716 !! wikitext
15717 [[File:Foobar.jpg|2000px]]
15718
15719 [[File:Foobar.jpg|border|2000px]]
15720 !! html/php
15721 <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>
15722 </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>
15723 </p>
15724 !! html/parsoid
15725 <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>
15726 <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>
15727 !! end
15728
15729 !! test
15730 Image: "unspecified format" and border reduce
15731 !! options
15732 parsoid=wt2html,wt2wt,html2html
15733 !! wikitext
15734 [[File:Foobar.jpg|1000px]]
15735
15736 [[File:Foobar.jpg|border|1000px]]
15737 !! html/php
15738 <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>
15739 </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>
15740 </p>
15741 !! html/parsoid
15742 <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>
15743 <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>
15744 !! end
15745
15746 !! test
15747 Image: thumbs reduce
15748 !! options
15749 parsoid=wt2html,wt2wt,html2html
15750 !! wikitext
15751 [[File:Foobar.jpg|thumb|50px]]
15752 !! html/php
15753 <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>
15754 !! html/parsoid
15755 <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>
15756 !! end
15757
15758 !! test
15759 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15760 !! options
15761 parsoid=wt2html,wt2wt,html2html
15762 !! wikitext
15763 [[File:Foobar.jpg|thumb|2000px]]
15764
15765 [[File:Foobar.svg|thumb|2000px]]
15766 !! html/php
15767 <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>
15768 <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>
15769 !! html/parsoid
15770 <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>
15771 <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>
15772 !! end
15773
15774 !! test
15775 Image: frameless can reduce in size
15776 !! options
15777 parsoid=wt2html,wt2wt,html2html
15778 !! wikitext
15779 [[File:Foobar.jpg|frameless|50px]]
15780 !! html/php
15781 <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>
15782 </p>
15783 !! html/parsoid
15784 <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>
15785 !! end
15786
15787 !! test
15788 Image: bitmap frameless can't be enlarged past original size, but vector can
15789 !! options
15790 parsoid=wt2html,wt2wt,html2html
15791 !! wikitext
15792 [[File:Foobar.jpg|frameless|2000px]]
15793
15794 [[File:Foobar.svg|frameless|2000px]]
15795 !! html/php
15796 <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>
15797 </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>
15798 </p>
15799 !! html/parsoid
15800 <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>
15801 <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>
15802 !! end
15803
15804 !! test
15805 Image: framed images are always unscaled.
15806 !! options
15807 parsoid=wt2html,wt2wt,html2html
15808 !! wikitext
15809 [[File:Foobar.jpg|frame]]
15810
15811 [[File:Foobar.jpg|frame|50px]]
15812
15813 [[File:Foobar.jpg|frame|50x50px]]
15814
15815 [[File:Foobar.jpg|frame|2000px]]
15816 !! html/php
15817 <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>
15818 <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>
15819 <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>
15820 <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>
15821 !! html/parsoid
15822 <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>
15823 <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>
15824 <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>
15825 <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>
15826 !! end
15827
15828 ###################
15829
15830 !! test
15831 Link to image page- image page normally doesn't exist, hence edit link
15832 Add test with existing image page
15833 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15834 !! wikitext
15835 [[:Image:test]]
15836 !! html
15837 <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>
15838 </p>
15839 !! end
15840
15841 !! test
15842 T20784 Link to non-existent image page with caption should use caption as link text
15843 !! wikitext
15844 [[:Image:test|caption]]
15845 !! html
15846 <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>
15847 </p>
15848 !! end
15849
15850 !! test
15851 Frameless image caption with a free URL
15852 !! wikitext
15853 [[File:Foobar.jpg|http://example.com]]
15854 !! html/php
15855 <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>
15856 </p>
15857 !! html/parsoid
15858 <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>
15859 !! end
15860
15861 !! test
15862 Thumbnail image caption with a free URL
15863 !! options
15864 thumbsize=220
15865 !! wikitext
15866 [[File:Foobar.jpg|thumb|http://example.com]]
15867 !! html/php
15868 <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>
15869 !! html/parsoid
15870 <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" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
15871 !! end
15872
15873 !! test
15874 Thumbnail image caption with a free URL and explicit alt
15875 !! options
15876 thumbsize=220
15877 parsoid=wt2html,wt2wt,html2html
15878 !! wikitext
15879 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15880 !! html/php
15881 <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>
15882 !! html/parsoid
15883 <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" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
15884 !! end
15885
15886 !! test
15887 SVG thumbnails with no language set
15888 !! options
15889 !! wikitext
15890 [[File:Foobar.svg|thumb|caption]]
15891 !! html/php
15892 <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>
15893 !! html/parsoid
15894 <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>
15895 !! end
15896
15897 !! test
15898 SVG thumbnails with language de
15899 !! options
15900 parsoid=wt2html,wt2wt,html2html
15901 !! wikitext
15902 [[File:Foobar.svg|thumb|caption|lang=de]]
15903 !! html/php
15904 <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>
15905 !! html/parsoid
15906 <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>
15907 !! end
15908
15909 !! test
15910 SVG thumbnails with invalid language code
15911 !! options
15912 parsoid=wt2html,wt2wt,html2html
15913 !! wikitext
15914 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15915 !! html/php
15916 <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>
15917 !! html/parsoid
15918 <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>
15919 !! end
15920
15921 !! test
15922 SVG thumbnails in page language
15923 !! options
15924 language=ru
15925 !! wikitext
15926 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15927 !! html/php
15928 <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>
15929 </p>
15930 !! end
15931
15932 !! test
15933 SVG thumbnails in page language not present in the file
15934 !! options
15935 language=de
15936 !! wikitext
15937 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15938 !! html/php
15939 <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>
15940 </p>
15941 !! end
15942
15943 !! test
15944 T3887: A ISBN with a thumbnail
15945 !! wikitext
15946 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15947 !! html/php
15948 <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>
15949 !! html/parsoid
15950 <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>
15951 !! end
15952
15953 !! test
15954 T3887: A RFC with a thumbnail
15955 !! wikitext
15956 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15957 !! html/php
15958 <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>
15959 !! html/parsoid
15960 <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>
15961 !! end
15962
15963 !! test
15964 T3887: A mailto link with a thumbnail
15965 !! wikitext
15966 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15967 !! html/php
15968 <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>
15969 !! html/parsoid
15970 <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" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
15971 !! end
15972
15973 # Pending resolution to T2368
15974 !! test
15975 T2648: Frameless image caption with a link
15976 !! wikitext
15977 [[File:Foobar.jpg|text with a [[link]] in it]]
15978 !! html/php
15979 <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>
15980 </p>
15981 !! html/parsoid
15982 <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>
15983 !! end
15984
15985 !! test
15986 T2648: Frameless image caption with a link (suffix)
15987 !! wikitext
15988 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15989 !! html/php
15990 <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>
15991 </p>
15992 !! html/parsoid
15993 <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>
15994 !! end
15995
15996 !! test
15997 T2648: Frameless image caption with an interwiki link
15998 !! wikitext
15999 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
16000 !! html/php
16001 <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>
16002 </p>
16003 !! html/parsoid
16004 <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>
16005 !! end
16006
16007 !! test
16008 T2648: Frameless image caption with a piped interwiki link
16009 !! wikitext
16010 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
16011 !! html/php
16012 <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>
16013 </p>
16014 !! html/parsoid
16015 <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>
16016 !! end
16017
16018 !! test
16019 T107474: Frameless image caption with <nowiki>
16020 !! wikitext
16021 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
16022 !! html/parsoid
16023 <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>
16024 !! end
16025
16026 !! test
16027 Escape HTML special chars in image alt text
16028 !! wikitext
16029 [[File:Foobar.jpg|& < > "]]
16030 !! html/php
16031 <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>
16032 </p>
16033 !! html/parsoid
16034 <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>
16035 !! end
16036
16037 !! test
16038 Escape HTML special chars in image alt text with LanguageConverter
16039 !! options
16040 language=zh
16041 !! wikitext
16042 [[File:Foobar.jpg|& < > "]]
16043 !! html/php
16044 <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>
16045 </p>
16046 !! html/parsoid
16047 <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>
16048 !! end
16049
16050 !! test
16051 Entities in file name and attributes
16052 !! wikitext
16053 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
16054 !! html/php
16055 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
16056 </p>
16057 !! html/parsoid
16058 <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>
16059 !! end
16060
16061 !! test
16062 T2499: Alt text should have &#1234;, not &amp;1234;
16063 !! wikitext
16064 [[File:Foobar.jpg|&#9792;]]
16065 !! html/php
16066 <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>
16067 </p>
16068 !! html/parsoid
16069 <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>
16070 !! end
16071
16072 !! test
16073 Broken image caption with link
16074 !! options
16075 parsoid=wt2html,wt2wt,html2html
16076 !! wikitext
16077 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
16078 !! html/php
16079 <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.
16080 </p>
16081 !! html/parsoid
16082 <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>
16083 !! end
16084
16085 !! test
16086 Image caption containing another image
16087 !! wikitext
16088 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
16089 !! html/php
16090 <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>
16091 !! html/parsoid
16092 <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>
16093 !! end
16094
16095 !! test
16096 Image: caption containing a newline
16097 !! wikitext
16098 [[File:Foobar.jpg|This
16099 *is some text]]
16100 !! html/php
16101 <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>
16102 </p>
16103 !! html/parsoid
16104 <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>
16105 !!end
16106
16107 !!test
16108 Image: caption containing leading space
16109 (The leading space should not trigger nowiki escaping in wt2wt mode)
16110 !! wikitext
16111 [[File:Foobar.jpg|thumb| bar]]
16112 !! html/php
16113 <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>
16114 !! html/parsoid
16115 <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>
16116 !!end
16117
16118 # html/php output not have newlines after table, td, th, etc. because
16119 # Linker::makeThumbLink2() replaces the newlines with spaces since
16120 # the table is inside a caption.
16121 # FIXME: Verify if that circa 2004 fix is still required.
16122 !! test
16123 Image: caption containing a table
16124 !! options
16125 parsoid=wt2html,wt2wt,html2html
16126 !! wikitext
16127 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
16128 {|
16129 !Foo!!Bar
16130 |-
16131 |Foo1||Bar1
16132 |}
16133 and some more text.]]
16134 !! html/php
16135 <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>
16136 !! html/parsoid
16137 <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
16138 <table>
16139 <tbody>
16140 <tr><th>Foo</th><th>Bar</th></tr>
16141 <tr>
16142 <td>Foo1</td>
16143 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
16144 !! end
16145
16146 !! test
16147 T5090: External links other than http: in image captions
16148 !! wikitext
16149 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
16150 !! html/php
16151 <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>
16152 !! html/parsoid
16153 <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" class="external text" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" class="external text" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
16154 !! end
16155
16156 !! test
16157 Custom class
16158 !! options
16159 parsoid=wt2html,wt2wt,html2html
16160 !! wikitext
16161 [[Image:foobar.jpg|a|class=b]]
16162 !! html/php
16163 <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>
16164 </p>
16165 !! html/parsoid
16166 <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>
16167 !! end
16168
16169 !! test
16170 Localized image handling (1).
16171 !! options
16172 parsoid=wt2html,wt2wt,html2html
16173 language=es
16174 !! wikitext
16175 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16176 !! html/php
16177 <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>
16178 !! html/parsoid
16179 <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>
16180 !! end
16181
16182 !! test
16183 Localized image handling (2).
16184 !! options
16185 thumbsize=220
16186 parsoid=wt2html,wt2wt,html2html
16187 language=es
16188 !! wikitext
16189 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16190 !! html/php
16191 <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>
16192 !! html/parsoid
16193 <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>
16194 !! end
16195
16196 !! test
16197 Localized image handling (3).
16198 !! options
16199 language=fa
16200 parsoid=html2wt
16201 !! html/parsoid
16202 <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>
16203 !! wikitext
16204 [[File:Foobar.jpg|بندانگشتی]]
16205 !! end
16206
16207 !! test
16208 "border", "frameless" and "class" attributes on an image.
16209 !! options
16210 thumbsize=220
16211 parsoid=wt2html,wt2wt,html2html
16212 !! wikitext
16213 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16214 !! html/php
16215 <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>
16216 </p>
16217 !! html/parsoid
16218 <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>
16219 !! end
16220
16221 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16222 !! test
16223 Invalid image attributes (T64500)
16224 !! options
16225 thumbsize=220
16226 parsoid=wt2html,wt2wt,html2html
16227 !! wikitext
16228 [[File:Foobar.jpg|thumb|float|left|caption]]
16229
16230 [[File:Foobar.jpg|thumb|righ|caption]]
16231
16232 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16233 !! html/php
16234 <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>
16235 <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>
16236 <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>
16237 !! html/parsoid
16238 <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>
16239 <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>
16240 <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>
16241 !! end
16242
16243 !! article
16244 File:Barfoo.jpg
16245 !! text
16246 #REDIRECT [[File:Barfoo.jpg]]
16247 !! endarticle
16248
16249 # FIXME: Parsoid should run this test -- but we'd need to teach the
16250 # mockAPI about the redirected Barfoo.jpg image.
16251 !! test
16252 Redirected image
16253 !! wikitext
16254 [[Image:Barfoo.jpg]]
16255 !! html/php
16256 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16257 </p>
16258 !! end
16259
16260 ## FIXME: Parsoid needs to learn about this flag.
16261 !! test
16262 Missing image with uploads disabled
16263 !! options
16264 wgEnableUploads=0
16265 !! wikitext
16266 [[File:Foobaz.jpg]]
16267 !! html/php
16268 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16269 </p>
16270 !! html/parsoid
16271 <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>
16272 !! end
16273
16274 # Parsoid-specific testing for images
16275 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16276 # Currently imperfect due to a flaw in the Parsoid testrunner
16277 # Work in progress
16278 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16279 # image tests.
16280
16281 !! test
16282 Parsoid-specific image handling - simple image with size and middle alignment
16283 !! wikitext
16284 [[File:Foobar.jpg|middle|50px]]
16285 !! html/parsoid
16286 <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>
16287 !! end
16288
16289 !! test
16290 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16291 !! options
16292 parsoid=wt2wt,wt2html,html2html
16293 !! wikitext
16294 [[Image:Foobar.jpg|middle|50px]]
16295 !! html/parsoid
16296 <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>
16297 !! end
16298
16299 !! test
16300 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16301 !! wikitext
16302 [[File:Foobar.jpg|50px|middle]]
16303 !! html/parsoid
16304 <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>
16305 !! end
16306
16307 !! test
16308 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16309 !! options
16310 parsoid=wt2html,wt2wt,html2html
16311 !! wikitext
16312 [[Image:Foobar.jpg|50px|middle]]
16313 !! html/parsoid
16314 <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>
16315 !! end
16316
16317 !! test
16318 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16319 !! wikitext
16320 [[File:Foobar.jpg|500x10px|baseline|caption]]
16321 !! html/parsoid
16322 <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>
16323 !! end
16324
16325 !! test
16326 Parsoid-specific image handling - simple image with border and size spec
16327 !! wikitext
16328 [[File:Foobar.jpg|50px|border|caption]]
16329 !! html/parsoid
16330 <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>
16331 !! end
16332
16333 !! test
16334 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16335 !! options
16336 parsoid=wt2html,html2html
16337 !! wikitext
16338 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16339 !! html/parsoid
16340 <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>
16341 !! end
16342
16343 !! test
16344 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16345 !! options
16346 parsoid=wt2html,html2html
16347 !! wikitext
16348 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16349 !! html/parsoid
16350 <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>
16351 !! end
16352
16353 !! test
16354 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16355 !! options
16356 parsoid=wt2html,html2html
16357 !! wikitext
16358 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16359 !! html/parsoid
16360 <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>
16361 !! end
16362
16363 !! test
16364 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16365 !! options
16366 parsoid=wt2html,html2html
16367 !! wikitext
16368 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16369 !! html/parsoid
16370 <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>
16371 !! end
16372
16373 !! test
16374 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16375 !! options
16376 parsoid=wt2html,wt2wt,html2html
16377 !! wikitext
16378 [[File:Foobar.jpg|frame|500x50px|caption]]
16379 !! html/parsoid
16380 <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>
16381 !! end
16382
16383 !! test
16384 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16385 !! options
16386 parsoid=wt2html,html2html
16387 !! wikitext
16388 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16389 !! html/parsoid
16390 <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>
16391 !! end
16392
16393 !! test
16394 Parsoid-specific image handling - frameless image with specific size, border, and caption
16395 !! wikitext
16396 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16397 !! html/parsoid
16398 <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>
16399 !! end
16400
16401 !! test
16402 Parsoid-specific image handling - simple image with a formatted caption
16403 !! wikitext
16404 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16405 !! html/parsoid
16406 <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>
16407 !! end
16408
16409 !! test
16410 Parsoid-specific image handling - caption with a template in it
16411 !! wikitext
16412 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16413 !! html/parsoid
16414 <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>
16415 !! end
16416
16417 !! test
16418 Parsoid-specific image handling - caption with unbalanced tags in it
16419 !! options
16420 parsoid=wt2html,wt2wt,html2html
16421 !! wikitext
16422 foo
16423 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16424 bar
16425 !! html/parsoid
16426 <p>foo</p>
16427 <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>
16428 <p>bar</p>
16429 !! end
16430
16431 !! test
16432 Parsoid-specific image handling - empty caption (1)
16433 !! options
16434 parsoid=wt2html,wt2wt
16435 !! wikitext
16436 [[File:Foobar.jpg|thumb|]]
16437 !! html/parsoid
16438 <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>
16439 !! end
16440
16441 # empty captions don't get serialized unless we're in the "round trip" case
16442 !! test
16443 Parsoid-specific image handling - empty caption (2)
16444 !! options
16445 parsoid=html2wt
16446 !! html/parsoid
16447 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16448 <a href="./File:Foobar.jpg">
16449 <img resource="./File:Foobar.jpg"
16450 src="//example.com/images/3/3a/Foobar.jpg"
16451 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16452 height="25" width="220"/>
16453 </a>
16454 <figcaption></figcaption>
16455 </figure>
16456 !! wikitext
16457 [[File:Foobar.jpg|thumb]]
16458 !! end
16459
16460 !! test
16461 Parsoid-specific image handling - whitespace caption
16462 !! wikitext
16463 [[File:Foobar.jpg|thumb| ]]
16464 !! html/parsoid
16465 <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>
16466 !! end
16467
16468 !! test
16469 Parsoid-specific image handling - lang option
16470 !! wikitext
16471 foo
16472 [[File:Foobar.svg|lang=de|caption]]
16473 bar
16474 !! html/parsoid
16475 <p>foo
16476 <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>
16477 bar</p>
16478 !! end
16479
16480 ## Edge case bugs in Parsoid from T93580
16481 !! test
16482 T93580: 1. Templated <ref> inside block images
16483 !! wikitext
16484 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16485
16486 <references />
16487 !! html/parsoid
16488 <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>
16489
16490 <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>
16491 !! end
16492
16493 !! test
16494 T93580: 2. <ref> inside inline images
16495 !! wikitext
16496 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16497
16498 <references />
16499 !! html/parsoid
16500 <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>
16501
16502 <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>
16503 !! end
16504
16505 !! test
16506 T93580: 3. Templated <ref> inside inline images
16507 !! wikitext
16508 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16509
16510 <references />
16511 !! html/parsoid
16512 <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>
16513
16514 <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>
16515 !! end
16516
16517 ###
16518 ### Subpages
16519 ###
16520 !! article
16521 Subpage test/subpage
16522 !! text
16523 foo
16524 !! endarticle
16525
16526 !! test
16527 Subpage link
16528 !! options
16529 subpage title=[[Subpage test]]
16530 !! wikitext
16531 [[/subpage]]
16532 !! html
16533 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16534 </p>
16535 !! end
16536
16537 !! test
16538 Subpage noslash link
16539 !! options
16540 subpage title=[[Subpage test]]
16541 !! wikitext
16542 [[/subpage/]]
16543 !! html
16544 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
16545 </p>
16546 !! end
16547
16548 !! article
16549 Subpage test/1/2/subpage
16550 !! text
16551 blah
16552 !! endarticle
16553
16554 !! test
16555 Relative subpage noslash link
16556 !! options
16557 parsoid=wt2wt,wt2html,html2html
16558 subpage title=[[Subpage test/1/2/3/4]]
16559 !! wikitext
16560 [[../../subpage/]]
16561
16562 [[../../subpage]]
16563 !! html/php
16564 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16565 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16566 </p>
16567 !! html/parsoid
16568 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16569 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16570 !! end
16571
16572 !! test
16573 Parsoid: dot-slash prefixed wikilinks
16574 !! wikitext
16575 [[./foo]]
16576
16577 [[././bar]]
16578
16579 [[././baz/]]
16580 !! html/php
16581 <p>[[./foo]]
16582 </p><p>[[././bar]]
16583 </p><p>[[././baz/]]
16584 </p>
16585 !! html/parsoid
16586 <p>[[./foo]]
16587 </p><p>[[././bar]]
16588 </p><p>[[././baz/]]
16589 </p>
16590 !! end
16591
16592 !! test
16593 Render invalid page names as plain text (T53090)
16594 !! wikitext
16595 [[./../foo|bar]]
16596 [[foo�|bar]]
16597 [[foo/.|bar]]
16598 [[foo/..|bar]]
16599 [[foo~~~bar]]
16600 [[foo>bar]]
16601 [[foo[bar]]
16602 [[.]]
16603 [[..]]
16604 [[foo././bar]]
16605 [[foo[http://example.com]xyz]]
16606
16607 [[{{echo|./../foo}}|bar]]
16608 [[{{echo|foo/.}}|bar]]
16609 [[{{echo|foo/..}}|bar]]
16610 [[{{echo|foo~~~~bar}}]]
16611 [[{{echo|foo>bar}}]]
16612 [[{{echo|foo././bar}}]]
16613 [[{{echo|foo{bar}}]]
16614 [[{{echo|foo}bar}}]]
16615 [[{{echo|foo[bar}}]]
16616 [[{{echo|foo]bar}}]]
16617 [[{{echo|foo<bar}}]]
16618 !!html/php
16619 <p>[[./../foo|bar]]
16620 [[foo�|bar]]
16621 [[foo/.|bar]]
16622 [[foo/..|bar]]
16623 [[foo~~~bar]]
16624 [[foo&gt;bar]]
16625 [[foo[bar]]
16626 [[.]]
16627 [[..]]
16628 [[foo././bar]]
16629 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16630 </p><p>[[./../foo|bar]]
16631 [[foo/.|bar]]
16632 [[foo/..|bar]]
16633 [[foo~~~~bar]]
16634 [[foo&gt;bar]]
16635 [[foo././bar]]
16636 [[foo{bar]]
16637 [[foo}bar]]
16638 [[foo[bar]]
16639 [[foo]bar]]
16640 [[foo&lt;bar]]
16641 </p>
16642 !!html/parsoid
16643 <p>[[./../foo|bar]]
16644 [[foo�|bar]]
16645 [[foo/.|bar]]
16646 [[foo/..|bar]]
16647 [[foo~~~bar]]
16648 [[foo>bar]]
16649 [[foo[bar]]
16650 [[.]]
16651 [[..]]
16652 [[foo././bar]]
16653 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16654
16655 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16656 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16657 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16658 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16659 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16660 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16661 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16662 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16663 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16664 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16665 [[<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>
16666 !!end
16667
16668 !! test
16669 Disabled subpages
16670 !! wikitext
16671 [[/subpage]]
16672 !! html
16673 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16674 </p>
16675 !! end
16676
16677 !! test
16678 T2561: {{/Subpage}}
16679 !! options
16680 subpage title=[[Page]]
16681 !! wikitext
16682 {{/Subpage}}
16683 !! html
16684 <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>
16685 </p>
16686 !! end
16687
16688 ###
16689 ### Categories
16690 ###
16691 !! article
16692 Category:MediaWiki User's Guide
16693 !! text
16694 blah
16695 !! endarticle
16696
16697 !! test
16698 Link to category
16699 !! wikitext
16700 [[:Category:MediaWiki User's Guide]]
16701 !! html
16702 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16703 </p>
16704 !! end
16705
16706 !! test
16707 Simple category
16708 !! options
16709 cat
16710 !! wikitext
16711 [[Category:MediaWiki User's Guide]]
16712 !! html/php
16713 cat=MediaWiki_User's_Guide sort=
16714 !! html/parsoid
16715 <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"}}'/>
16716 !! end
16717
16718 !! test
16719 PAGESINCATEGORY invalid title fatal (r33546 fix)
16720 !! wikitext
16721 {{PAGESINCATEGORY:<bogus>}}
16722 !! html
16723 <p>0
16724 </p>
16725 !! end
16726
16727 !! test
16728 Category with different sort key
16729 !! options
16730 cat
16731 !! wikitext
16732 [[Category:MediaWiki User's Guide|Foo]]
16733 !! html/php
16734 cat=MediaWiki_User's_Guide sort=Foo
16735 !! html/parsoid
16736 <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"}}'/>
16737 !! end
16738
16739 !! test
16740 Category with identical sort key
16741 !! options
16742 cat
16743 !! wikitext
16744 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16745 !! html/php
16746 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16747 !! html/parsoid
16748 <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"}}'/>
16749 !! end
16750
16751 !! test
16752 Category with empty sort key
16753 !! options
16754 cat
16755 pst
16756 !! wikitext
16757 [[Category:MediaWiki User's Guide|]]
16758 !! html/php
16759 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16760 !! end
16761
16762 !! test
16763 Category with empty sort key and parentheses
16764 !! options
16765 cat
16766 pst
16767 !! wikitext
16768 [[Category:Foo (bar)|]]
16769 !! html/php
16770 [[Category:Foo (bar)|Foo]]
16771 !! end
16772
16773 !! test
16774 Category with link tail
16775 !! options
16776 cat
16777 pst
16778 !! wikitext
16779 123[[Category:Foo]]456
16780 !! html/php
16781 123[[Category:Foo]]456
16782 !! end
16783
16784 !! test
16785 Category with template
16786 !! options
16787 cat
16788 pst
16789 !! wikitext
16790 [[Category:{{echo|Foo}}]]
16791 !! html/php
16792 [[Category:{{echo|Foo}}]]
16793 !! end
16794
16795 !! test
16796 Category with template in sort key
16797 !! options
16798 cat
16799 pst
16800 !! wikitext
16801 [[Category:Foo|{{echo|Bar}}]]
16802 !! html/php
16803 [[Category:Foo|{{echo|Bar}}]]
16804 !! end
16805
16806 !! test
16807 Category with template in sort key and title
16808 !! options
16809 cat
16810 pst
16811 !! wikitext
16812 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16813 !! html/php
16814 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16815 !! end
16816
16817 ## We used to, but no longer wt2wt this test since the default serializer
16818 ## will normalize all categories to serialize on their own line.
16819 ## This wikitext usage is going to be fairly uncommon in production and
16820 ## selser will take care of preserving formatting in those scenarios.
16821 !! test
16822 Category / paragraph interactions
16823 !! options
16824 parsoid=wt2html
16825 !! wikitext
16826 Foo [[Category:Baz]] Bar
16827
16828 Foo [[Category:Baz]]
16829 Bar
16830
16831 Foo
16832 [[Category:Baz]]
16833 Bar
16834
16835 Foo
16836 [[Category:Baz]] Bar
16837
16838 Foo
16839 [[Category:Baz]]
16840 [[Category:Baz]]
16841 [[Category:Baz]]
16842 Bar
16843
16844 [[Category:Baz]]
16845 [[Category:Baz]]
16846 [[Category:Baz]]
16847
16848 [[Category:Baz]]
16849 {{echo|[[Category:Baz]]}}
16850 [[Category:Baz]]
16851 !! html/php
16852 <p>Foo Bar
16853 </p><p>Foo
16854 Bar
16855 </p><p>Foo
16856 Bar
16857 </p><p>Foo Bar
16858 </p><p>Foo
16859 Bar
16860 </p>
16861 !! html/parsoid
16862 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16863 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16864 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16865 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16866 <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>
16867 <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}}]}'/>
16868 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16869 !! end
16870
16871 ## We used to, but no longer wt2wt this test since the default serializer
16872 ## will normalize all categories to serialize on their own line.
16873 ## This wikitext usage is going to be fairly uncommon in production and
16874 ## selser will take care of preserving formatting in those scenarios.
16875 ##
16876 ## The whitespace on the empty line is part of the test. Please do not delete
16877 !! test
16878 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16879 !! options
16880 parsoid=wt2html
16881 !! wikitext
16882 This
16883
16884 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16885
16886 {{echo|[[Category:Foo]] and so should this!}}
16887 !! html/php
16888 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16889 </p>
16890 !! html/parsoid
16891 <p>This
16892
16893 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16894
16895 <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>
16896 !! end
16897
16898 ## Parsoid will not try to wt2wt this while preserving newlines because
16899 ## it suppresses excess newlines within list items -- and we don't want to
16900 ## introduce a special case just for categories, which is, in reality somewhat
16901 ## odd behavior -- categories are unlikely to be used in list items like this
16902 ## in top-level pages and are only likely to show up in template-generated
16903 ## list items where this RT-ing is a non-issue.
16904 ##
16905 ## The whitespace on the empty line is part of the test. Please do not delete
16906 !! test
16907 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16908 !! options
16909 parsoid=wt2html
16910 !! wikitext
16911 * This
16912
16913 [[Category:Foo]] and this should be part of the same list item
16914 * So should this
16915
16916 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16917 !! html/php+tidy
16918 <ul><li>This and this should be part of the same list item</li>
16919 <li>So should this and this should be part of the same list item</li></ul>
16920 !! html/parsoid
16921 <ul>
16922 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16923 <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>
16924 </ul>
16925 !! end
16926
16927 ## Newlines and categories that follow the last item of a list
16928 ## are treated differently because this (list followed by categories)
16929 ## is an extremely common pattern on wikis.
16930 !! test
16931 3. Categories and newlines: newline suppression for last list item should RT properly
16932 !! wikitext
16933 *a
16934 *b
16935
16936 [[Category:Foo]]
16937
16938 [[Category:Bar]]
16939 [[Category:Baz]]
16940
16941 :c
16942
16943 [[Category:C]]
16944
16945 ;d
16946
16947 [[Category:D]]
16948 !! html/parsoid
16949 <ul><li>a</li>
16950 <li>b</li></ul>
16951
16952 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16953
16954 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16955 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16956
16957 <dl><dd>c</dd></dl>
16958
16959 <link rel="mw:PageProp/Category" href="./Category:C"/>
16960
16961 <dl><dt>d</dt></dl>
16962
16963 <link rel="mw:PageProp/Category" href="./Category:D"/>
16964 !! end
16965
16966 !! test
16967 4. Categories and newlines: newline suppression for last list item should RT properly
16968 !! wikitext
16969 *a
16970 ****b
16971
16972 [[Category:Foo]]
16973 !! html/parsoid
16974 <ul><li>a
16975 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16976
16977 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16978 !! end
16979
16980 ## only wt2html for this to make sure the algo only applies to the rightmost path
16981 !! test
16982 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16983 !! options
16984 parsoid=wt2html
16985 !! wikitext
16986 *a
16987 **b
16988 [[Category:Foo]]
16989 *c
16990 **d
16991 [[Category:Foo]]
16992 !! html/parsoid
16993 <ul><li>a
16994 <ul><li>b
16995 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16996 <li>c
16997 <ul><li>d</li></ul></li></ul>
16998 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16999 !! end
17000
17001 ## We used to, but no longer wt2wt this test since the default serializer
17002 ## will normalize all categories to serialize on their own line.
17003 ## This wikitext usage is going to be fairly uncommon in production and
17004 ## selser will take care of preserving formatting in those scenarios.
17005 !! test
17006 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
17007 !! options
17008 parsoid=wt2html
17009 !! wikitext
17010 *a [[Category:Foo]]
17011 !! html/parsoid
17012 <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>
17013 !! end
17014
17015 # This test also demonstrates because of newline+category tunneling
17016 # through the list hander, template wrapping doesn't expand to the
17017 # containing list when the list item swallows the category.
17018 !! test
17019 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
17020 !! wikitext
17021 *{{echo|a
17022 [[Category:Foo]]}}
17023 !! html/parsoid
17024 <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
17025 </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>
17026 !! end
17027
17028 !! test
17029 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
17030 !! wikitext
17031 *a
17032
17033 {{echo|[[Category:Foo]]
17034 [[Category:Bar]]}}
17035 [[Category:Baz]]
17036 !! html/parsoid
17037 <ul><li>a</li></ul>
17038
17039 <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">
17040 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
17041 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
17042 !! end
17043
17044 !! test
17045 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
17046 !! wikitext
17047 *a
17048
17049 [[Category:Bar]]<!--boo1--> <!--boo2-->
17050 [[Category:Baz]]<!--boo3--> <!--boo4-->
17051 !! html/parsoid
17052 <ul><li>a</li></ul>
17053
17054 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
17055 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
17056 !! end
17057
17058 !! test
17059 Categories and newlines: should behave properly with linkprefix (T87753)
17060 !! options
17061 language=ar
17062 !! wikitext
17063 foo bar
17064 foo bar
17065 [[تصنيف:Foo]]
17066 [[تصنيف:Bar]]
17067 !! html/php
17068 <p>foo bar
17069 foo bar
17070 </p>
17071 !! html/parsoid
17072 <p>foo bar
17073 foo bar</p>
17074 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
17075 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
17076 !! end
17077
17078 !! test
17079 No regressions on internal links following category (T174639)
17080 !! options
17081 parsoid=wt2html,html2html
17082 !! wikitext
17083 [[Category:Foo]]<div>a
17084
17085 [[Foo]]</div>
17086 !! html/php
17087 <div>a
17088 <a href="/wiki/Foo" title="Foo">Foo</a></div>
17089 !! html/parsoid
17090 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
17091
17092 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
17093 !! end
17094
17095 # Note that Parsoid differs slightly from PHP due to T175421
17096 !! test
17097 11. Special case where only newlines separate links (T175416)
17098 !! options
17099 parsoid=wt2html,html2html
17100 !! wikitext
17101 [[Category:Foo]]
17102
17103 [[Foo]][[es:Alimento]]
17104
17105 [[Foo]]
17106 !! html/php
17107 <p><br />
17108 <a href="/wiki/Foo" title="Foo">Foo</a>
17109 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
17110 </p>
17111 !! html/parsoid
17112 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17113
17114 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17115
17116 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
17117 !! end
17118
17119 !! test
17120 Category links with multiple namespaces
17121 !! wikitext
17122 [[Category:Project:Foo]]
17123 !! html/parsoid
17124 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
17125 !! end
17126
17127 !! test
17128 Parsoid: Serialize link to category page with colon escape
17129 !! wikitext
17130
17131 [[:Category:Foo]]
17132 [[:Category:Foo|Bar]]
17133 !! html/php+tidy
17134 <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>
17135 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
17136 </p>
17137 !! html/parsoid
17138 <p>
17139 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
17140 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
17141 </p>
17142 !! end
17143
17144 # We used to, but no longer wt2wt this test since the default serializer
17145 # will normalize all categories to serialize on their own line.
17146 # This wikitext usage is going to be fairly uncommon in production and
17147 # selser will take care of preventing whitespace insertion if this
17148 # occurs in an article.
17149 #
17150 # html2html disabled for the same reason (whitespace insertion between
17151 # x and y).
17152 #
17153 # html2wt disabled because it localizes the "Category" namespace.
17154 !! test
17155 Link prefix/suffixes aren't applied to category links
17156 !! options
17157 parsoid=wt2html
17158 language=is
17159 !! wikitext
17160 x[[Category:Foo]]y
17161 !! html/php
17162 <p>xy
17163 </p>
17164 !! html/parsoid
17165 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17166 !! end
17167
17168 !! test
17169 Link prefix/suffixes aren't applied to language links
17170 !! options
17171 parsoid=wt2html
17172 language=is
17173 !! wikitext
17174 x[[es:Foo]]y
17175 !! html/php
17176 <p>xy
17177 </p>
17178 !! html/parsoid
17179 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17180 !! end
17181
17182 !! test
17183 Parsoid: Serialize link to file page with colon escape
17184 !! wikitext
17185
17186 [[:File:Foo.png]]
17187 [[:File:Foo.png|Bar]]
17188 !! html/php+tidy
17189 <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>
17190 <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>
17191 </p>
17192 !! html/parsoid
17193 <p>
17194 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17195 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17196 </p>
17197 !! end
17198
17199 !! test
17200 Parsoid: Serialize a genuine category link without colon escape
17201 !! wikitext
17202 [[Category:Foo]]
17203 [[Category:Foo|Bar]]
17204 !! html/php+tidy
17205 !! html/parsoid
17206 <link rel="mw:PageProp/Category" href="./Category:Foo">
17207 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17208 !! end
17209
17210 !! test
17211 Normalize hrefs properly before testing for invalid link targets (T72894)
17212 !! options
17213 parsoid=html2wt
17214 !! html/parsoid
17215 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17216 !! wikitext
17217 [[Category:Toxine bactérienne]]
17218 !! end
17219
17220 !! test
17221 Parsoid: Defaultsort
17222 !! wikitext
17223 {{DEFAULTSORT:Foo}}
17224 !! html/parsoid
17225 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17226 !! end
17227
17228 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17229 # But, this is a limitation of our representation and is documented in
17230 # TemplateHandler.js in processSpecialMagicWord
17231 !! test
17232 Parsoid: Defaultsort (template-generated)
17233 !! wikitext
17234 {{{{echo|DEFAULTSORT}}:Foo}}
17235 !! html/parsoid
17236 <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"}]]}'/>
17237 !! end
17238
17239 ###
17240 ### Inter-language links
17241 ###
17242 !! test
17243 Interlanguage links
17244 !! options
17245 ill
17246 !! wikitext
17247 [[es:Alimento]]
17248 [[fr:Nourriture]]
17249 [[zh:食品]]
17250 !! html/php
17251 es:Alimento fr:Nourriture zh:食品
17252 !! html/parsoid
17253 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17254 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17255 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17256 !! end
17257
17258 !! test
17259 Duplicate interlanguage links (T26502)
17260 !! options
17261 ill
17262 !! wikitext
17263 [[es:1]]
17264 [[es:2]]
17265 [[fr:1]]
17266 [[fr:2]]
17267 !! html/php
17268 es:1 fr:1
17269 !! html/parsoid
17270 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17271 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17272 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17273 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17274 !! end
17275
17276 ###
17277 ### Sections
17278 ###
17279 !! test
17280 Basic section headings
17281 !! wikitext
17282 ==Headline 1==
17283 Some text
17284
17285 ==Headline 2==
17286 More
17287 ===Smaller headline===
17288 Blah blah
17289 !! html
17290 <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>
17291 <p>Some text
17292 </p>
17293 <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>
17294 <p>More
17295 </p>
17296 <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>
17297 <p>Blah blah
17298 </p>
17299 !! end
17300
17301 !! test
17302 Section headings with TOC
17303 !! wikitext
17304 ==Headline 1==
17305 ===Subheadline 1===
17306 =====Skipping a level=====
17307 ======Skipping a level======
17308
17309 ==Headline 2==
17310 Some text
17311 ===Another headline===
17312 !! html
17313 <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>
17314 <ul>
17315 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17316 <ul>
17317 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17318 <ul>
17319 <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>
17320 <ul>
17321 <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>
17322 </ul>
17323 </li>
17324 </ul>
17325 </li>
17326 </ul>
17327 </li>
17328 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17329 <ul>
17330 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17331 </ul>
17332 </li>
17333 </ul>
17334 </div>
17335
17336 <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>
17337 <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>
17338 <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>
17339 <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>
17340 <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>
17341 <p>Some text
17342 </p>
17343 <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>
17344 !! end
17345
17346 !! test
17347 TOC anchors don't collide
17348 !! wikitext
17349 __FORCETOC__
17350 ==Headline 2==
17351 ==Headline==
17352 ==Headline 2==
17353 ==Headline==
17354 !! html/php
17355 <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>
17356 <ul>
17357 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17358 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17359 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17360 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17361 </ul>
17362 </div>
17363
17364 <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>
17365 <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>
17366 <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>
17367 <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>
17368 !! end
17369
17370 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17371 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17372 !! test
17373 Handling of sections up to level 6 and beyond
17374 !! options
17375 parsoid=wt2html
17376 !! wikitext
17377 =Level 1 Heading=
17378 ==Level 2 Heading==
17379 ===Level 3 Heading===
17380 ====Level 4 Heading====
17381 =====Level 5 Heading=====
17382 ======Level 6 Heading======
17383 =======Level 7 Heading=======
17384 ========Level 8 Heading========
17385 =========Level 9 Heading=========
17386 ==========Level 10 Heading==========
17387 !! html/php
17388 <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>
17389 <ul>
17390 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17391 <ul>
17392 <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>
17393 <ul>
17394 <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>
17395 <ul>
17396 <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>
17397 <ul>
17398 <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>
17399 <ul>
17400 <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>
17401 <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>
17402 <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>
17403 <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>
17404 <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>
17405 </ul>
17406 </li>
17407 </ul>
17408 </li>
17409 </ul>
17410 </li>
17411 </ul>
17412 </li>
17413 </ul>
17414 </li>
17415 </ul>
17416 </div>
17417
17418 <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>
17419 <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>
17420 <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>
17421 <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>
17422 <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>
17423 <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>
17424 <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>
17425 <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>
17426 <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>
17427 <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>
17428 !! html/parsoid
17429 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17430 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17431 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17432 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17433 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17434 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17435 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17436 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17437 <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>
17438 <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>
17439 !! end
17440
17441 !! test
17442 TOC regression (T11764)
17443 !! wikitext
17444 ==title 1==
17445 ===title 1.1===
17446 ====title 1.1.1====
17447 ===title 1.2===
17448 ==title 2==
17449 ===title 2.1===
17450 !! html
17451 <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>
17452 <ul>
17453 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17454 <ul>
17455 <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>
17456 <ul>
17457 <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>
17458 </ul>
17459 </li>
17460 <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>
17461 </ul>
17462 </li>
17463 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17464 <ul>
17465 <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>
17466 </ul>
17467 </li>
17468 </ul>
17469 </div>
17470
17471 <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>
17472 <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>
17473 <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>
17474 <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>
17475 <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>
17476 <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>
17477 !! end
17478
17479 !! test
17480 TOC for heading containing <span id="..."></span> (T96153)
17481 !! wikitext
17482 __FORCETOC__
17483 ==<span id="old-anchor"></span>New title==
17484 !! html/php
17485 <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>
17486 <ul>
17487 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17488 </ul>
17489 </div>
17490
17491 <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>
17492 !! end
17493
17494 !! test
17495 TOC with wgMaxTocLevel=3 (T8204)
17496 !! options
17497 wgMaxTocLevel=3
17498 !! wikitext
17499 ==title 1==
17500 ===title 1.1===
17501 ====title 1.1.1====
17502 ===title 1.2===
17503 ==title 2==
17504 ===title 2.1===
17505 !! html
17506 <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>
17507 <ul>
17508 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17509 <ul>
17510 <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>
17511 <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>
17512 </ul>
17513 </li>
17514 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17515 <ul>
17516 <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>
17517 </ul>
17518 </li>
17519 </ul>
17520 </div>
17521
17522 <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>
17523 <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>
17524 <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>
17525 <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>
17526 <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>
17527 <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>
17528 !! end
17529
17530 !! test
17531 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17532 !! options
17533 wgMaxTocLevel=3
17534 !! wikitext
17535 ==Section 1==
17536 ===Section 1.1===
17537 ====Section 1.1.1====
17538 ====Section 1.1.1.1====
17539 ==Section 2==
17540 !! html
17541 <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>
17542 <ul>
17543 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17544 <ul>
17545 <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>
17546 </ul>
17547 </li>
17548 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17549 </ul>
17550 </div>
17551
17552 <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>
17553 <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>
17554 <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>
17555 <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>
17556 <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>
17557 !! end
17558
17559
17560 !! test
17561 Resolving duplicate section names
17562 !! wikitext
17563 ==Foo bar==
17564 ==Foo bar==
17565 !! html
17566 <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>
17567 <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>
17568 !! end
17569
17570 !! test
17571 Resolving duplicate section names with differing case (T12721)
17572 !! wikitext
17573 ==Foo bar==
17574 ==Foo Bar==
17575 !! html
17576 <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>
17577 <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>
17578 !! end
17579
17580 !! article
17581 Template:sections
17582 !! text
17583 ===Section 1===
17584 ==Section 2==
17585 !! endarticle
17586
17587 !! test
17588 Template with sections, __NOTOC__
17589 !! wikitext
17590 __NOTOC__
17591 ==Section 0==
17592 {{sections}}
17593 ==Section 4==
17594 !! html
17595 <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>
17596 <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>
17597 <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>
17598 <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>
17599 !! end
17600
17601 !! test
17602 __NOEDITSECTION__ keyword
17603 !! wikitext
17604 __NOEDITSECTION__
17605 ==Section 1==
17606 ==Section 2==
17607 !! html
17608 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17609 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17610 !! end
17611
17612 !! test
17613 Link inside a section heading
17614 !! wikitext
17615 ==Section with a [[Main Page|link]] in it==
17616 !! html
17617 <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>
17618 !! end
17619
17620 !! test
17621 TOC regression (T14077)
17622 !! wikitext
17623 __TOC__
17624 ==title 1==
17625 ===title 1.1===
17626 ==title 2==
17627 !! html
17628 <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>
17629 <ul>
17630 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17631 <ul>
17632 <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>
17633 </ul>
17634 </li>
17635 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17636 </ul>
17637 </div>
17638
17639 <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>
17640 <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>
17641 <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>
17642 !! end
17643
17644 !! test
17645 T3219 URL next to image (good)
17646 !! wikitext
17647 http://example.com [[File:Foobar.jpg]]
17648 !! html/php
17649 <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>
17650 </p>
17651 !! html/parsoid
17652 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">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>
17653 !!end
17654
17655 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17656 !! test
17657 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17658 !! options
17659 parsoid=wt2html,html2html
17660 !! wikitext
17661 ===
17662 The line above must have a trailing space!
17663 === <!--
17664 --> <!-- -->
17665 But just in case it doesn't...
17666 !! html/php
17667 <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>
17668 <p>The line above must have a trailing space!
17669 </p>
17670 <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>
17671 <p>But just in case it doesn't...
17672 </p>
17673 !! html/parsoid
17674 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17675 <p>The line above must have a trailing space!</p>
17676 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17677 --> <!-- -->
17678 <p>But just in case it doesn't...</p>
17679 !! end
17680
17681 !! test
17682 Header with special characters (T27462)
17683 !! wikitext
17684 The tooltips shall not show entities to the user (ie. be double escaped)
17685
17686 ==text > text==
17687 section 1
17688
17689 ==text < text==
17690 section 2
17691
17692 ==text & text==
17693 section 3
17694
17695 ==text ' text==
17696 section 4
17697
17698 ==text " text==
17699 section 5
17700 !! html/php
17701 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17702 </p>
17703 <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>
17704 <ul>
17705 <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>
17706 <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>
17707 <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>
17708 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17709 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17710 </ul>
17711 </div>
17712
17713 <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>
17714 <p>section 1
17715 </p>
17716 <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>
17717 <p>section 2
17718 </p>
17719 <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>
17720 <p>section 3
17721 </p>
17722 <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>
17723 <p>section 4
17724 </p>
17725 <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>
17726 <p>section 5
17727 </p>
17728 !! html/parsoid
17729 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17730
17731 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17732 <p>section 1</p>
17733
17734 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17735 <p>section 2</p>
17736
17737 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17738 <p>section 3</p>
17739
17740 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17741 <p>section 4</p>
17742
17743 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17744 <p>section 5</p>
17745 !! end
17746
17747 !! test
17748 Header with space, plus and underscore as entity
17749 !! wikitext
17750 Id should not contain + for spaces
17751
17752 ==Space between Text==
17753 section 1
17754
17755 ==Space-Entity&#32;between&#32;Text==
17756 section 2
17757
17758 ==Plus+between+Text==
17759 section 3
17760
17761 ==Plus-Entity&#43;between&#43;Text==
17762 section 4
17763
17764 ==Underscore_between_Text==
17765 section 5
17766
17767 ==Underscore-Entity&#95;between&#95;Text==
17768 section 6
17769
17770 [[#Space between Text]]
17771 [[#Space-Entity&#32;between&#32;Text]]
17772 [[#Plus+between+Text]]
17773 [[#Plus-Entity&#43;between&#43;Text]]
17774 [[#Underscore_between_Text]]
17775 [[#Underscore-Entity&#95;between&#95;Text]]
17776 !! html/php
17777 <p>Id should not contain + for spaces
17778 </p>
17779 <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>
17780 <ul>
17781 <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>
17782 <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>
17783 <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>
17784 <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>
17785 <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>
17786 <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>
17787 </ul>
17788 </div>
17789
17790 <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>
17791 <p>section 1
17792 </p>
17793 <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>
17794 <p>section 2
17795 </p>
17796 <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>
17797 <p>section 3
17798 </p>
17799 <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>
17800 <p>section 4
17801 </p>
17802 <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>
17803 <p>section 5
17804 </p>
17805 <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>
17806 <p>section 6
17807 </p><p><a href="#Space_between_Text">#Space between Text</a>
17808 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17809 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17810 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17811 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17812 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17813 </p>
17814 !! html/parsoid
17815 <p>Id should not contain + for spaces</p>
17816
17817 <h2 id="Space_between_Text">Space between Text</h2>
17818 <p>section 1</p>
17819
17820 <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>
17821 <p>section 2</p>
17822
17823 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17824 <p>section 3</p>
17825
17826 <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>
17827 <p>section 4</p>
17828
17829 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17830 <p>section 5</p>
17831
17832 <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>
17833 <p>section 6</p>
17834
17835 <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>
17836 <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>
17837 <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>
17838 <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>
17839 <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>
17840 <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>
17841 !! end
17842
17843 # Parsoid html2wt disabled because it adds padding spaces around =
17844 !! test
17845 Headers with excess '=' characters
17846 (Are similar tests necessary beyond the 1st level?)
17847 !! options
17848 parsoid=wt2html,wt2wt,html2html
17849 !! wikitext
17850 =foo==
17851 ==foo=
17852 =''italic'' heading==
17853 ==''italic'' heading=
17854 !! html/php
17855 <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>
17856 <ul>
17857 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17858 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17859 <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>
17860 <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>
17861 </ul>
17862 </div>
17863
17864 <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>
17865 <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>
17866 <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>
17867 <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>
17868 !! html/parsoid
17869 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17870 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17871 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17872 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17873 !! end
17874
17875 !! test
17876 HTML headers vs TOC (T25393)
17877 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17878 !! wikitext
17879 <h1>Header 1</h1>
17880 ==Header 1.1==
17881 ==Header 1.2==
17882
17883 <h1>Header 2
17884 </h1>
17885 ==Header 2.1==
17886 ==Header 2.2==
17887 __NOEDITSECTION__
17888 !! html/php
17889 <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>
17890 <ul>
17891 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17892 <ul>
17893 <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>
17894 <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>
17895 </ul>
17896 </li>
17897 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17898 <ul>
17899 <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>
17900 <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>
17901 </ul>
17902 </li>
17903 </ul>
17904 </div>
17905
17906 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17907 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17908 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17909 <h1><span class="mw-headline" id="Header_2">Header 2
17910 </span></h1>
17911 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17912 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17913 !! html/parsoid
17914 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17915 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17916 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17917
17918 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17919 </h1>
17920 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17921 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17922 <meta property="mw:PageProp/noeditsection"/>
17923 !! end
17924
17925 !! test
17926 Single-line or multiline-comments can follow headings
17927 !! options
17928 parsoid=wt2html,wt2wt
17929 !! wikitext
17930 ==foo==<!---->
17931 ==bar==<!--c1-->
17932 ==baz==<!--
17933 c2
17934 c3-->
17935 !! html/php
17936 <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>
17937 <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>
17938 <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>
17939 !! html/parsoid
17940 <h2 id="foo">foo</h2><!---->
17941 <h2 id="bar">bar</h2><!--c1-->
17942 <h2 id="baz">baz</h2><!--
17943 c2
17944 c3-->
17945 !! end
17946
17947 !! test
17948 T3219 URL next to image (broken)
17949 !! wikitext
17950 http://example.com[[File:Foobar.jpg]]
17951 !! html/php
17952 <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>
17953 </p>
17954 !! html/parsoid
17955 <p><a rel="mw:ExtLink" class="external free" href="http://example.com">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>
17956 !!end
17957
17958 !! test
17959 T3186 news: in the middle of text
17960 !! wikitext
17961 http://en.wikinews.org/wiki/Wikinews:Workplace
17962 !! html
17963 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17964 </p>
17965 !!end
17966
17967
17968 !! test
17969 Namespaced link must have a title
17970 !! wikitext
17971 [[Project:]]
17972 !! html
17973 <p>[[Project:]]
17974 </p>
17975 !!end
17976
17977 !! test
17978 Namespaced link must have a title (bad fragment version)
17979 !! wikitext
17980 [[Project:#fragment]]
17981 !! html
17982 <p>[[Project:#fragment]]
17983 </p>
17984 !!end
17985
17986
17987 ###
17988 ### HTML tags and HTML attributes
17989 ###
17990
17991 !! test
17992 div with no attributes
17993 !! wikitext
17994 <div>HTML rocks</div>
17995 !! html
17996 <div>HTML rocks</div>
17997 !! end
17998
17999 !! test
18000 div with double-quoted attribute
18001 !! wikitext
18002 <div id="rock">HTML rocks</div>
18003 !! html
18004 <div id="rock">HTML rocks</div>
18005 !! end
18006
18007 !! test
18008 div with single-quoted attribute
18009 !! wikitext
18010 <div id='rock'>HTML rocks</div>
18011 !! html
18012 <div id="rock">HTML rocks</div>
18013 !! end
18014
18015 !! test
18016 div with unquoted attribute
18017 !! wikitext
18018 <div id=rock>HTML rocks</div>
18019 !! html
18020 <div id="rock">HTML rocks</div>
18021 !! end
18022
18023 !! test
18024 div with illegal double attributes
18025 !! wikitext
18026 <div id="a" id="b">HTML rocks</div>
18027 !! html
18028 <div id="b">HTML rocks</div>
18029 !! end
18030
18031 !! test
18032 div with empty attribute value, space before equals
18033 !! options
18034 parsoid=wt2html,html2html
18035 !! wikitext
18036 <div class =>HTML rocks</div>
18037 !! html/php
18038 <div class="">HTML rocks</div>
18039 !! html/parsoid
18040 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18041 !! end
18042
18043 !! test
18044 div with multiple empty attribute values
18045 !! config
18046 wgFragmentMode=[ 'html5', 'legacy' ]
18047 !! options
18048 parsoid=wt2html,html2html
18049 !! wikitext
18050 <div id= title=>HTML rocks</div>
18051 !! html/php
18052 <div id="title=">HTML rocks</div>
18053 !! html/parsoid
18054 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18055 !! end
18056
18057 # FIXME Parsoid doesn't actually match PHP here.
18058 !! test
18059 Extension tag in attribute value
18060 !! options
18061 wgRawHtml=1
18062 !! wikitext
18063 <span title="<html><div>123</div></html>">ok</span>
18064 !! html/php+tidy
18065 <p><span title="&lt;div&gt;123&lt;/div&gt;">ok</span>
18066 </p>
18067 !! html/parsoid
18068 <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>
18069 !! end
18070
18071 !! test
18072 table with multiple empty attribute values
18073 !! options
18074 parsoid=wt2html,html2html
18075 !! wikitext
18076 {| title= id=
18077 |hi
18078 |}
18079 !! html/php
18080 <table title="id=">
18081 <tr>
18082 <td>hi
18083 </td></tr></table>
18084 !! html/parsoid
18085 <table title="id=">
18086 <tbody><tr><td>hi</td></tr>
18087 </tbody></table>
18088 !! end
18089
18090 !! test
18091 div with braces in attribute value
18092 !! wikitext
18093 <div title="{}">Foo</div>
18094 !! html/php
18095 <div title="&#123;&#125;">Foo</div>
18096 !! html/parsoid
18097 <div title="{}">Foo</div>
18098 !! end
18099
18100 !! test
18101 div with empty attribute value, no space before equals
18102 !! options
18103 parsoid=wt2html,html2html
18104 !! wikitext
18105 <div class=>HTML rocks</div>
18106 !! html/php
18107 <div class="">HTML rocks</div>
18108 !! html/parsoid
18109 <div class="">HTML rocks</div>
18110 !! end
18111
18112 !! test
18113 HTML multiple attributes correction
18114 !! wikitext
18115 <p class="error" class="awesome">Awesome!</p>
18116 !! html
18117 <p class="awesome">Awesome!</p>
18118 !! end
18119
18120 !! test
18121 Table multiple attributes correction
18122 !! wikitext
18123 {|
18124 !+ class="error" class="awesome"|status
18125 |}
18126 !! html
18127 <table>
18128 <tr>
18129 <th class="awesome">status
18130 </th></tr></table>
18131 !! end
18132
18133 !! test
18134 DIV IN UPPERCASE
18135 !! wikitext
18136 <DIV ID="x">HTML ROCKS</DIV>
18137 !! html
18138 <div id="x">HTML ROCKS</div>
18139 !! end
18140
18141 !! test
18142 Non-ASCII pseudo-tags are rendered as text
18143 !! wikitext
18144 <khyô>
18145 !! html
18146 <p>&lt;khyô&gt;
18147 </p>
18148 !! end
18149
18150 !! test
18151 Pseudo-tag with URL 'name' renders as url link
18152 !! wikitext
18153 <http://example.com/>
18154 !! html
18155 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
18156 </p>
18157 !! end
18158
18159 !! test
18160 text with amp in the middle of nowhere
18161 !! wikitext
18162 Remember AT&T?
18163 !! html
18164 <p>Remember AT&amp;T?
18165 </p>
18166 !! end
18167
18168 !! test
18169 text with character entity: eacute
18170 !! wikitext
18171 I always thought &eacute; was a cute letter.
18172 !! html+tidy
18173 <p>I always thought &#233; was a cute letter.
18174 </p>
18175 !! end
18176
18177 !! test
18178 text with entity-escaped character entity-like string: eacute
18179 !! wikitext
18180 I always thought &amp;eacute; was a cute letter.
18181 !! html
18182 <p>I always thought &amp;eacute; was a cute letter.
18183 </p>
18184 !! end
18185
18186 !! test
18187 text with undefined character entity: xacute
18188 !! wikitext
18189 I always thought &xacute; was a cute letter.
18190 !! html
18191 <p>I always thought &amp;xacute; was a cute letter.
18192 </p>
18193 !! end
18194
18195 !! test
18196 HTML5 tags
18197 !! wikitext
18198 <data value="5">five</data>
18199 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18200 <mark>This highlighted text</mark>
18201 !! html
18202 <p><data value="5">five</data>
18203 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18204 <mark>This highlighted text</mark>
18205 </p>
18206 !! end
18207
18208 !! test
18209 HTML tag with leading space is parsed as text
18210 !! wikitext
18211 < div>foo< /div>
18212 !! html
18213 <p>&lt; div&gt;foo&lt; /div&gt;
18214 </p>
18215 !! end
18216
18217 ## FIXME: The untrimmed attribute in Parsoid is T205737
18218 !! test
18219 Element with broken attribute syntax
18220 !! options
18221 parsoid=wt2html
18222 !! wikitext
18223 <div style=" style="123">hi</div>
18224 <div =>ho</div>
18225 !! html/php
18226 <div style="style=">hi</div>
18227 <div>ho</div>
18228 !! html/parsoid
18229 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18230 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18231 !! end
18232
18233 ###
18234 ### Nesting tests (see T43545, T52604, T53081)
18235 ###
18236
18237 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18238 # Note that html2wt is considerably more difficult if we use <b> in
18239 # the test case, instead of <small>
18240 !! test
18241 Ensure that HTML adoption agency algorithm is properly implemented.
18242 !! wikitext
18243 <small>X<small>Y</small>Z</small>
18244 !! html
18245 <p><small>X<small>Y</small>Z</small>
18246 </p>
18247 !! end
18248
18249 # This was T43545 in the PHP parser.
18250 !! test
18251 Nesting of <kbd>
18252 !! wikitext
18253 <kbd>X<kbd>Y</kbd>Z</kbd>
18254 !! html+tidy
18255 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18256 </p>
18257 !! end
18258
18259 # The following cases were T53081 in the PHP parser.
18260 # Note that there are some other nestable tags (b, i, etc) which are
18261 # not covered; see T53081 for discussion.
18262
18263 !! test
18264 Nesting of <em>
18265 !! wikitext
18266 <em>X<em>Y</em>Z</em>
18267 !! html+tidy
18268 <p><em>X<em>Y</em>Z</em>
18269 </p>
18270 !! end
18271
18272 !! test
18273 Nesting of <strong>
18274 !! wikitext
18275 <strong>X<strong>Y</strong>Z</strong>
18276 !! html+tidy
18277 <p><strong>X<strong>Y</strong>Z</strong>
18278 </p>
18279 !! end
18280
18281 !! test
18282 Nesting of <q>
18283 !! wikitext
18284 <q>X<q>Y</q>Z</q>
18285 !! html+tidy
18286 <p><q>X<q>Y</q>Z</q>
18287 </p>
18288 !! end
18289
18290 !! test
18291 Nesting of <ruby>
18292 !! wikitext
18293 <ruby>X<ruby>Y</ruby>Z</ruby>
18294 !! html
18295 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18296 </p>
18297 !! end
18298
18299 !! test
18300 Nesting of <bdo>
18301 !! wikitext
18302 <bdo>X<bdo>Y</bdo>Z</bdo>
18303 !! html
18304 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18305 </p>
18306 !! end
18307
18308
18309 ###
18310 ### Media links
18311 ###
18312
18313 !! test
18314 Media link
18315 !! wikitext
18316 [[Media:Foobar.jpg]]
18317 [[Media:Video.ogv]]
18318 [[:Media:Video.ogv]]
18319 !! html/php
18320 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18321 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18322 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18323 </p>
18324 !! html/parsoid
18325 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18326 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18327 <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>
18328 !! end
18329
18330 !! test
18331 Media link with text
18332 !! wikitext
18333 [[Media:Foobar.jpg|A neat file to look at]]
18334 !! html/php
18335 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18336 </p>
18337 !! html/parsoid
18338 <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>
18339 !! end
18340
18341 !! test
18342 Localized media link
18343 !! options
18344 language=is
18345 !! wikitext
18346 [[Miðill:Foobar.jpg]]
18347
18348 [[Miðill:Foobar.jpg|Icelandic]]
18349 !! html/php
18350 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18351 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18352 </p>
18353 !! html/parsoid
18354 <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>
18355 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18356 !! end
18357
18358 # FIXME: this is still bad HTML tag nesting
18359 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18360 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18361 !! test
18362 Media link with nasty text
18363 !! options
18364 parsoid=wt2html,html2html
18365 !! wikitext
18366 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18367 !! html/php
18368 <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>
18369 !! html/php+tidy
18370 <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>
18371 !! html/parsoid
18372 <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>
18373 !! end
18374
18375 !! test
18376 Media link from missing resource (parsoid-only)
18377 !! options
18378 parsoid=html2wt
18379 !! html/parsoid
18380 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18381 !! wikitext
18382 [[Media:Foobar.jpg|Bat!]]
18383 !! end
18384
18385 !! test
18386 Media link from missing resource, localized (parsoid-only)
18387 !! options
18388 parsoid=html2wt
18389 language=is
18390 !! html/parsoid
18391 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18392 !! wikitext
18393 [[Miðill:Foobar.jpg|Bat!]]
18394 !! end
18395
18396 # This is a sanity test to ensure we don't crash or choke when given
18397 # old cached 1.7.0 HTML for media links; we don't require that the
18398 # result be "valid" because wt2wt was completely broken in 1.7.0
18399 !! test
18400 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18401 !! options
18402 parsoid=html2wt
18403 !! html/parsoid
18404 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18405 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18406 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18407 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18408 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18409 !! wikitext
18410 This is what Parsoid would emit (and we still handle this HTML fine):
18411
18412 [[Media:Foobar.jpg|A neat file to look at]]
18413
18414 But VisualEditor would mangle the rel attribute, and give us back this:
18415
18416 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18417
18418 But at least we don't crash when trying to handle the mangled HTML!
18419 !! end
18420
18421 !! test
18422 Media link to nonexistent file (T3702)
18423 !! wikitext
18424 [[Media:No such.jpg]]
18425 [[Media:No_such file.jpg]]
18426 !! html/php
18427 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18428 <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>
18429 </p>
18430 !! html/parsoid
18431 <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>
18432 <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>
18433 !! end
18434
18435 !! test
18436 Image link to nonexistent file (T3850 - good)
18437 !! wikitext
18438 [[File:No_such.jpg]]
18439 !! html/php
18440 <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>
18441 </p>
18442 !! html/parsoid
18443 <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>
18444 !! end
18445
18446 !! test
18447 :Image link to nonexistent file (T3850 - bad)
18448 !! wikitext
18449 [[:Image:No such.jpg]]
18450 !! html/php
18451 <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>
18452 </p>
18453 !! html/parsoid
18454 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18455 !! end
18456
18457 !! test
18458 Character reference normalization in link text (T3938)
18459 !! wikitext
18460 [[Main Page|this&that]]
18461 !! html
18462 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18463 </p>
18464 !!end
18465
18466 !! article
18467 אַ
18468 !! text
18469 Test for unicode normalization
18470
18471 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18472 !! endarticle
18473
18474 !! test
18475 (T21451) Links should refer to the normalized form.
18476 !! wikitext
18477 [[&#xFB2E;]]
18478 [[&#x5d0;&#x5b7;]]
18479 [[&#x5d0;ַ]]
18480 [[א&#x5b7;]]
18481 [[אַ]]
18482 !! html
18483 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18484 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18485 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18486 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18487 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18488 </p>
18489 !! end
18490
18491 !! test
18492 Empty attribute crash test (T4067)
18493 !! wikitext
18494 <font color="">foo</font>
18495 !! html
18496 <p><font color="">foo</font>
18497 </p>
18498 !! end
18499
18500 !! test
18501 Empty attribute crash test single-quotes (T4067)
18502 !! wikitext
18503 <font color=''>foo</font>
18504 !! html
18505 <p><font color="">foo</font>
18506 </p>
18507 !! end
18508
18509 !! test
18510 Attribute test: equals, then nothing
18511 !! options
18512 parsoid=wt2html,html2html
18513 !! wikitext
18514 <font color=>foo</font>
18515 !! html/php
18516 <p><font color="">foo</font>
18517 </p>
18518 !! html/parsoid
18519 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18520 !! end
18521
18522 !! test
18523 Attribute test: unquoted value
18524 !! options
18525 parsoid=wt2html,html2html
18526 !! wikitext
18527 <font color=x>foo</font>
18528 !! html/php
18529 <p><font color="x">foo</font>
18530 </p>
18531 !! html/parsoid
18532 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18533 !! end
18534
18535 !! test
18536 Attribute test: unquoted but illegal value (hash)
18537 !! wikitext
18538 <font color=#x>foo</font>
18539 !! html
18540 <p><font color="#x">foo</font>
18541 </p>
18542 !! end
18543
18544 # Parsoid does not serialize to empty attribute syntax,
18545 # so wt2wt and html2wt cases are skipped
18546 !! test
18547 Attribute test: no value (T54330)
18548 !! options
18549 parsoid=wt2html,html2html
18550 !! wikitext
18551 <font color>foo</font>
18552 !! html/php
18553 <p><font color="">foo</font>
18554 </p>
18555 !! html/parsoid
18556 <p><font color="">foo</font></p>
18557 !! end
18558
18559 !! test
18560 T4095: link with three closing brackets
18561 !! wikitext
18562 [[Main Page]]]
18563 !! html/php
18564 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18565 </p>
18566 !! html/parsoid
18567 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18568 !! end
18569
18570 !! test
18571 T4095: link with pipe and three closing brackets
18572 !! wikitext
18573 [[Main Page|link]]]
18574 !! html/php
18575 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18576 </p>
18577 !! html/parsoid
18578 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18579 !! end
18580
18581 !! test
18582 T4095: link with pipe and three closing brackets, version 2
18583 !! wikitext
18584 [[Main Page|[http://example.com/]]]
18585 !! html/php
18586 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18587 </p>
18588 !! html/parsoid
18589 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18590 !! end
18591
18592
18593 ###
18594 ### Safety
18595 ###
18596
18597 !! article
18598 Template:Dangerous attribute
18599 !! text
18600 " onmouseover="alert(document.cookie)
18601 !! endarticle
18602
18603 !! article
18604 Template:Dangerous style attribute
18605 !! text
18606 border-size: expression(alert(document.cookie))
18607 !! endarticle
18608
18609 !! article
18610 Template:Div style
18611 !! text
18612 <div style="float: right; {{{1}}}">Magic div</div>
18613 !! endarticle
18614
18615 !! test
18616 T4304: HTML attribute safety (safe template; regression T4309)
18617 !! wikitext
18618 <div title="{{test}}"></div>
18619 !! html/php
18620 <div title="This is a test template"></div>
18621 !! html/parsoid
18622 <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>
18623 !! end
18624
18625 # Parsoid has enough context to handle this case
18626 !! test
18627 T4304: HTML attribute safety (dangerous template; 2309)
18628 !! wikitext
18629 <div title="{{dangerous attribute}}"></div>
18630 !! html/php
18631 <div title=""></div>
18632 !! html/parsoid
18633 <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>
18634 !! end
18635
18636 !! test
18637 T4304: HTML attribute safety (dangerous style template; 2309)
18638 !! wikitext
18639 <div style="{{dangerous style attribute}}"></div>
18640 !! html/php
18641 <div style="/* insecure input */"></div>
18642 !! html/parsoid
18643 <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>
18644 !! end
18645
18646 !! test
18647 T4304: HTML attribute safety (safe parameter; 2309)
18648 !! wikitext
18649 {{div style|width: 200px}}
18650 !! html/php
18651 <div style="float: right; width: 200px">Magic div</div>
18652 !! html/parsoid
18653 <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>
18654 !! end
18655
18656 !! test
18657 T4304: HTML attribute safety (unsafe parameter; 2309)
18658 !! wikitext
18659 {{div style|width: expression(alert(document.cookie))}}
18660 !! html/php
18661 <div style="/* insecure input */">Magic div</div>
18662 !! html/parsoid
18663 <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>
18664 !! end
18665
18666 ## Parsoid output here differs; needs investigation.
18667 !! test
18668 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18669 !! wikitext
18670 {{div style|"><script>alert(document.cookie)</script>}}
18671 !! html
18672 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18673 !! end
18674
18675 ## Parsoid output here differs; needs investigation.
18676 !! test
18677 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18678 !! wikitext
18679 {{div style|" ><script>alert(document.cookie)</script>}}
18680 !! html
18681 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18682 !! end
18683
18684 !! test
18685 T4304: HTML attribute safety (link)
18686 !! wikitext
18687 <div title="[[Main Page]]"></div>
18688 !! html/php
18689 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18690 !! html/parsoid
18691 <div title="[[Main Page]]"></div>
18692 !! end
18693
18694 !! test
18695 T4304: HTML attribute safety (italics)
18696 !! wikitext
18697 <div title="''foobar''"></div>
18698 !! html
18699 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18700 !! end
18701
18702 !! test
18703 T4304: HTML attribute safety (bold)
18704 !! wikitext
18705 <div title="'''foobar'''"></div>
18706 !! html
18707 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18708 !! end
18709
18710 !! test
18711 T4304: HTML attribute safety (ISBN)
18712 !! wikitext
18713 <div title="ISBN 1234567890"></div>
18714 !! html
18715 <div title="&#73;SBN 1234567890"></div>
18716 !! end
18717
18718 !! test
18719 T4304: HTML attribute safety (RFC)
18720 !! wikitext
18721 <div title="RFC 1234"></div>
18722 !! html
18723 <div title="&#82;FC 1234"></div>
18724 !! end
18725
18726 !! test
18727 T4304: HTML attribute safety (PMID)
18728 !! wikitext
18729 <div title="PMID 1234567890"></div>
18730 !! html
18731 <div title="&#80;MID 1234567890"></div>
18732 !! end
18733
18734 !! test
18735 T4304: HTML attribute safety (web link)
18736 !! wikitext
18737 <div title="http://example.com/"></div>
18738 !! html
18739 <div title="http&#58;//example.com/"></div>
18740 !! end
18741
18742 !! test
18743 T4304: HTML attribute safety (named web link)
18744 !! wikitext
18745 <div title="[http://example.com/ link]"></div>
18746 !! html/php
18747 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18748 !! html/parsoid
18749 <div title="[http://example.com/ link]"></div>
18750 !! end
18751
18752 !! test
18753 T5244: HTML attribute safety (extension; safe)
18754 !! wikitext
18755 <div style="<nowiki>background:blue</nowiki>"></div>
18756 !! html/php
18757 <div style="background:blue"></div>
18758 !! html/parsoid
18759 <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>
18760 !! end
18761
18762 !! test
18763 T5244: HTML attribute safety (extension; unsafe)
18764 !! wikitext
18765 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18766 !! html/php
18767 <div style="/* insecure input */"></div>
18768 !! html/parsoid
18769 <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>
18770 !! end
18771
18772 # More MSIE fun discovered by Tom Gilder
18773
18774 !! test
18775 MSIE CSS safety test: spurious slash
18776 !! wikitext
18777 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18778 !! html/php
18779 <div style="/* insecure input */">evil</div>
18780 !! html/parsoid
18781 <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>
18782 !! end
18783
18784 !! test
18785 MSIE CSS safety test: hex code
18786 !! wikitext
18787 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18788 !! html/php
18789 <div style="/* insecure input */">evil</div>
18790 !! html/parsoid
18791 <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>
18792 !! end
18793
18794 !! test
18795 MSIE CSS safety test: comment in url
18796 !! wikitext
18797 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18798 !! html/php
18799 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18800 !! html/parsoid
18801 <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>
18802 !! end
18803
18804 !! test
18805 MSIE CSS safety test: comment in expression
18806 !! wikitext
18807 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18808 !! html/php
18809 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18810 !! html/parsoid
18811 <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>
18812 !! end
18813
18814 !! test
18815 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18816 !! wikitext
18817 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18818 !! html/php
18819 <p style="/* invalid control char */">A</p>
18820 !! html/parsoid
18821 <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>
18822 !! end
18823
18824 !! test
18825 MSIE 6 CSS safety test: Fullwidth (T57332)
18826 !! wikitext
18827 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18828 <div style="top:EXPRESSION(alert())">B</div>
18829 !! html/php
18830 <p style="/* insecure input */">A</p>
18831 <div style="/* insecure input */">B</div>
18832 !! html/parsoid
18833 <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>
18834 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18835 !! end
18836
18837 !! test
18838 MSIE 6 CSS safety test: IPA extensions (T57332)
18839 !! wikitext
18840 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18841 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18842 !! html/php
18843 <div style="/* insecure input */">A</div>
18844 <p style="/* insecure input */">B</p>
18845 !! html/parsoid
18846 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18847 <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>
18848 !! end
18849
18850 !! test
18851 MSIE 6 CSS safety test: sup/sub script (T57332)
18852 !! wikitext
18853 <div style="background-image:url⁽javascript:alert())">A</div>
18854 <div style="background-image:url₍javascript:alert())">B</div>
18855 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18856 !! html/php
18857 <div style="/* insecure input */">A</div>
18858 <div style="/* insecure input */">B</div>
18859 <p style="/* insecure input */">C</p>
18860 !! html/parsoid
18861 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18862 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18863 <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>
18864 !! end
18865
18866 !! test
18867 Opera -o-link CSS
18868 !! options
18869 parsoid=wt2html,html2html
18870 !! wikitext
18871 <div
18872 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;"
18873 style="-o-link:attr(title);-o-link-source:current">X</div>
18874 !! html/php
18875 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18876 !! html/parsoid
18877 <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>
18878 !! end
18879
18880 !! test
18881 MSIE 6 CSS safety test: Repetition markers (T57332)
18882 !! wikitext
18883 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18884 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18885 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18886 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18887 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18888 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18889 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18890 !! html/php
18891 <p style="/* insecure input */">A</p>
18892 <p style="/* insecure input */">B</p>
18893 <p style="/* insecure input */">C</p>
18894 <p style="/* insecure input */">D</p>
18895 <p style="/* insecure input */">E</p>
18896 <p style="/* insecure input */">F</p>
18897 <p style="/* insecure input */">G</p>
18898 !! html/parsoid
18899 <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>
18900 <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>
18901 <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>
18902 <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>
18903 <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>
18904 <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>
18905 <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>
18906 !! end
18907
18908 !! test
18909 Table attribute legitimate extension
18910 !! wikitext
18911 {|
18912 !+ style="<nowiki>color:blue</nowiki>"|status
18913 |}
18914 !! html
18915 <table>
18916 <tr>
18917 <th style="color:blue">status
18918 </th></tr></table>
18919 !! end
18920
18921 !! test
18922 Table attribute safety
18923 !! wikitext
18924 {|
18925 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18926 |}
18927 !! html
18928 <table>
18929 <tr>
18930 <th style="/* insecure input */">status
18931 </th></tr></table>
18932 !! end
18933
18934 !! test
18935 CSS line continuation 1
18936 !! wikitext
18937 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18938 !! html
18939 <div style="/* insecure input */"></div>
18940 !! end
18941
18942 !! test
18943 CSS line continuation 2
18944 !! wikitext
18945 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18946 !! html
18947 <div style="/* invalid control char */"></div>
18948 !! end
18949
18950 !! article
18951 Template:Identity
18952 !! text
18953 {{{1}}}
18954 !! endarticle
18955
18956 !! test
18957 Expansion of multi-line templates in attribute values (T8255)
18958 !! wikitext
18959 <div style="background: {{identity|#00FF00}}">-</div>
18960 !! html
18961 <div style="background: #00FF00">-</div>
18962 !! end
18963
18964 !! test
18965 Expansion of multi-line templates in attribute values (T8255 sanity check)
18966 !! wikitext
18967 <div style="background:
18968 #00FF00">-</div>
18969 !! html/php
18970 <div style="background: #00FF00">-</div>
18971 !! html/parsoid
18972 <div style="background:
18973 #00FF00">-</div>
18974 !! end
18975
18976 !! test
18977 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18978 !! wikitext
18979 <div style="background: &#10;#00FF00">-</div>
18980 !! html
18981 <div style="background: &#10;#00FF00">-</div>
18982 !! end
18983
18984 !! test
18985 Tags which are hidden from tidiers cannot pass through the Sanitizer
18986 !! wikitext
18987 <mw:toc><script>alert();</script></mw:toc>
18988 !! html+tidy
18989 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18990 </p>
18991 !! end
18992
18993 ###
18994 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
18995 ###
18996
18997 !! test
18998 Parser hook: empty input
18999 !! wikitext
19000 <tag></tag>
19001 !! html/php
19002 <pre>
19003 ''
19004 array (
19005 )
19006 </pre>
19007 !! html/parsoid
19008 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19009 !! end
19010
19011 ## Don't expect parsoid to rt this form.
19012 !! test
19013 Parser hook: empty input using terminated empty elements
19014 !! options
19015 parsoid=wt2html,html2html
19016 !! wikitext
19017 <tag/>
19018 !! html/php
19019 <pre>
19020 NULL
19021 array (
19022 )
19023 </pre>
19024 !! html/parsoid
19025 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19026 !! end
19027
19028 !! test
19029 Parser hook: empty input using terminated empty elements (space before)
19030 !! wikitext
19031 <tag />
19032 !! html/php
19033 <pre>
19034 NULL
19035 array (
19036 )
19037 </pre>
19038 !! html/parsoid
19039 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19040 !! end
19041
19042 !! test
19043 Parser hook: basic input
19044 !! wikitext
19045 <tag>input</tag>
19046 !! html/php
19047 <pre>
19048 'input'
19049 array (
19050 )
19051 </pre>
19052 !! html/parsoid
19053 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19054 !! end
19055
19056 ## Don't expect parsoid to rt this form.
19057 !! test
19058 Parser hook: case insensitive
19059 !! options
19060 parsoid=wt2html,html2html
19061 !! wikitext
19062 <TAG>input</TAG>
19063 !! html/php
19064 <pre>
19065 'input'
19066 array (
19067 )
19068 </pre>
19069 !! html/parsoid
19070 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19071 !! end
19072
19073 ## Don't expect parsoid to rt this form.
19074 !! test
19075 Parser hook: case insensitive, redux
19076 !! options
19077 parsoid=wt2html,html2html
19078 !! wikitext
19079 <TaG>input</TAg>
19080 !! html/php
19081 <pre>
19082 'input'
19083 array (
19084 )
19085 </pre>
19086 !! html/parsoid
19087 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19088 !! end
19089
19090 !! test
19091 Parser hook: nested tags
19092 !! options
19093 parsoid=wt2html
19094 !! wikitext
19095 <tag><tag></tag></tag>
19096 !! html/php
19097 <pre>
19098 '<tag>'
19099 array (
19100 )
19101 </pre>&lt;/tag&gt;
19102 !! html/php+tidy
19103 <pre>'<tag>'
19104 array (
19105 )
19106 </tag></pre><p>&lt;/tag&gt;</p>
19107 !! html/parsoid
19108 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
19109 !! end
19110
19111 !! test
19112 Parser hook: basic arguments
19113 !! wikitext
19114 <tag width="200" height="100" depth="50" square=""></tag>
19115 !! html/php
19116 <pre>
19117 ''
19118 array (
19119 'width' => '200',
19120 'height' => '100',
19121 'depth' => '50',
19122 'square' => '',
19123 )
19124 </pre>
19125 !! html/parsoid
19126 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19127 !! end
19128
19129 ## Don't expect parsoid to rt this form.
19130 !! test
19131 Parser hook: basic arguments, variations
19132 !! options
19133 parsoid=wt2html,html2html
19134 !! wikitext
19135 <tag width=200 height = "100" depth = '50' square></tag>
19136 !! html/php
19137 <pre>
19138 ''
19139 array (
19140 'width' => '200',
19141 'height' => '100',
19142 'depth' => '50',
19143 'square' => '',
19144 )
19145 </pre>
19146 !! html/parsoid
19147 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19148 !! end
19149
19150 !! test
19151 Parser hook: argument containing a forward slash (T7344)
19152 !! wikitext
19153 <tag filename="/tmp/bla"></tag>
19154 !! html/php
19155 <pre>
19156 ''
19157 array (
19158 'filename' => '/tmp/bla',
19159 )
19160 </pre>
19161 !! html/parsoid
19162 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19163 !! end
19164
19165 ## Don't expect parsoid to rt this form.
19166 !! test
19167 Parser hook: empty input using terminated empty elements (T4374)
19168 !! options
19169 parsoid=wt2html,html2html
19170 !! wikitext
19171 <tag foo=bar/>text
19172 !! html/php
19173 <pre>
19174 NULL
19175 array (
19176 'foo' => 'bar',
19177 )
19178 </pre>text
19179 !! html/parsoid
19180 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19181 !! end
19182
19183 ## </tag> should be output literally since there is no matching tag that begins it
19184 ## Don't expect parsoid to rt this form.
19185 !! test
19186 Parser hook: basic arguments using terminated empty elements (T4374)
19187 !! options
19188 parsoid=wt2html
19189 !! wikitext
19190 <tag width=200 height = "100" depth = '50' square/>
19191 other stuff
19192 </tag>
19193 !! html/php
19194 <pre>
19195 NULL
19196 array (
19197 'width' => '200',
19198 'height' => '100',
19199 'depth' => '50',
19200 'square' => '',
19201 )
19202 </pre>
19203 <p>other stuff
19204 &lt;/tag&gt;
19205 </p>
19206 !! html/parsoid
19207 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19208 &lt;/tag></p>
19209 !! end
19210
19211 ## Don't expect parsoid to rt this form.
19212 !! test
19213 Parser hook: Don't allow unclosed extension tags
19214 !! options
19215 parsoid=wt2html
19216 !! wikitext
19217 test <tag>123
19218
19219 this is a '''test'''
19220 !! html/php
19221 <p>test &lt;tag&gt;123
19222 </p><p>this is a <b>test</b>
19223 </p>
19224 !! html/parsoid
19225 <p>test &lt;tag>123</p>
19226
19227 <p>this is a <b>test</b></p>
19228 !! end
19229
19230 !! test
19231 Parser hook: horizontal rule inside extension tag that outputs <pre>
19232 !! wikitext
19233 <tag>
19234 Hello
19235 <hr/>
19236 Goodbye
19237 </tag>
19238 !! html/php
19239 <pre>
19240 '
19241 Hello
19242 <hr/>
19243 Goodbye
19244 '
19245 array (
19246 )
19247 </pre>
19248 !! end
19249
19250 ###
19251 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
19252 ###
19253
19254 !! test
19255 Parser hook: static parser hook not inside a comment
19256 !! wikitext
19257 <statictag>hello, world</statictag>
19258
19259 <statictag action="flush" />
19260 !! html/php
19261 <p><br />
19262 hello, world
19263 </p>
19264 !! html/parsoid
19265 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
19266 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
19267 !! end
19268
19269 !! test
19270 Parser hook: static parser hook inside a comment
19271 !! wikitext
19272 <!-- <statictag>hello, world</statictag> -->
19273 <statictag action="flush" />
19274 !! html/php
19275 <p><br />
19276 </p>
19277 !! html/parsoid
19278 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19279 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
19280 !! end
19281
19282 # Nested template calls; this case was broken by Parser.php rev 1.506,
19283 # since reverted.
19284
19285 !! article
19286 Template:One-parameter
19287 !! text
19288 (My parameter is: {{{1}}})
19289 !! endarticle
19290
19291 !! article
19292 Template:Map-one-parameter
19293 !! text
19294 {{{{{1}}}|{{{2}}}}}
19295 !! endarticle
19296
19297 !! test
19298 Nested template calls
19299 !! wikitext
19300 {{Map-one-parameter|One-parameter|param}}
19301 !! html
19302 <p>(My parameter is: param)
19303 </p>
19304 !! end
19305
19306
19307 ###
19308 ### Sanitizer
19309 ###
19310
19311 !! test
19312 Sanitizer: Closing of open tags
19313 !! wikitext
19314 <s></s><table></table>
19315 !! html/php+tidy
19316 <p><s></s></p><table></table>
19317 !! html/parsoid
19318 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19319 !! end
19320
19321 !! test
19322 Sanitizer: Closing of open but not closed tags
19323 !! wikitext
19324 <s>foo
19325 !! html
19326 <p><s>foo</s>
19327 </p>
19328 !! end
19329
19330 !! test
19331 Sanitizer: Closing of closed but not open tags
19332 !! options
19333 parsoid=wt2html
19334 !! wikitext
19335 </s>
19336 !! html+tidy
19337 <p class="mw-empty-elt">
19338 </p>
19339 !! end
19340
19341 !! test
19342 Sanitizer: Closing of closed but not open table tags
19343 !! options
19344 parsoid=wt2html
19345 !! wikitext
19346 Table not started</td></tr></table>
19347 !! html+tidy
19348 <p>Table not started</p>
19349 !! end
19350
19351 !! test
19352 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19353 !! options
19354 title=[[Main Page]]
19355 !! config
19356 wgFragmentMode=[ 'html5', 'legacy' ]
19357 !! wikitext
19358 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19359 !! html/php
19360 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19361 </p>
19362 !! html/parsoid
19363 <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>
19364 !! end
19365
19366 !! test
19367 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19368 !! config
19369 wgFragmentMode=[ 'legacy' ]
19370 !! wikitext
19371 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19372 !! html/php
19373 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19374 </p>
19375 !! end
19376
19377 # In HTML5, the restrictions are that id must contain at least one character,
19378 # and must not contain any space characters.
19379 !! test
19380 Sanitizer: Validating the contents of the id attribute (T6515)
19381 !! options
19382 disabled
19383 !! wikitext
19384 <br id="" /><br id="a space" />
19385 !! html
19386 Something ...
19387 !! end
19388
19389 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19390 !! test
19391 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19392 !! options
19393 disabled
19394 !! wikitext
19395 <br id="foo" /><br id="foo" />
19396 !! html
19397 Something need to be done. foo-2 ?
19398 !! end
19399
19400 !! test
19401 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19402 !! wikitext
19403 <div itemscope>
19404 <meta itemprop="hello" content="world">
19405 <meta http-equiv="refresh" content="5">
19406 <meta itemprop="hello" http-equiv="refresh" content="5">
19407 <link itemprop="hello" href="{{SERVER}}">
19408 <link rel="stylesheet" href="{{SERVER}}">
19409 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19410 </div>
19411 !! html
19412 <div itemscope="">
19413 <p> <meta itemprop="hello" content="world" />
19414 &lt;meta http-equiv="refresh" content="5"&gt;
19415 <meta itemprop="hello" content="5" />
19416 <link itemprop="hello" href="http&#58;//example.org" />
19417 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19418 <link itemprop="hello" href="http&#58;//example.org" />
19419 </p>
19420 </div>
19421 !! end
19422
19423 !! test
19424 Sanitizer: Strip comments from CSS attributes
19425 !! options
19426 parsoid=wt2html,wt2wt
19427 !! wikitext
19428 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19429 !! html/php
19430 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19431 </p>
19432 !! html/parsoid
19433 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19434 !! end
19435
19436 !! test
19437 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19438 !! wikitext
19439 [[meatball:Soft"Security]]
19440 !! html/php
19441 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19442 </p>
19443 !! html/parsoid
19444 <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>
19445 !! end
19446
19447 !! test
19448 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19449 !! wikitext
19450 [[meatball:Foo<Bar]]
19451 [[meatball:Foo>Bar]]
19452 [[meatball:Foo&lt;bar]]
19453 [[meatball:Foo&gt;bar]]
19454 !! html/php
19455 <p>[[meatball:Foo&lt;Bar]]
19456 [[meatball:Foo&gt;Bar]]
19457 [[meatball:Foo&lt;bar]]
19458 [[meatball:Foo&gt;bar]]
19459 </p>
19460 !! html/parsoid
19461 <p>[[meatball:Foo&lt;Bar]]
19462 [[meatball:Foo>Bar]]
19463 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19464 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19465 !! end
19466
19467 !! test
19468 Language converter: output gets cut off unexpectedly (T7757)
19469 !! options
19470 language=zh
19471 !! wikitext
19472 this bit is safe: }-
19473
19474 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19475
19476 then we get cut off here: }-
19477
19478 all additional text is vanished
19479 !! html/php
19480 <p>this bit is safe: }-
19481 </p><p>but if we add a conversion instance: xxx
19482 </p><p>then we get cut off here: }-
19483 </p><p>all additional text is vanished
19484 </p>
19485 !! html/parsoid
19486 <p>this bit is safe: }-</p>
19487 <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>
19488 <p>then we get cut off here: }-</p>
19489 <p>all additional text is vanished</p>
19490 !! end
19491
19492 !! test
19493 Language converter glossary rules inside attributes (T119158)
19494 !! options
19495 language=sr variant=sr-el
19496 !! wikitext
19497 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19498
19499 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19500 !! html/php
19501 <p>
19502 </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>
19503 </p>
19504 !! html/parsoid
19505 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19506
19507 <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>
19508 !! end
19509
19510 !! test
19511 Self closed html pairs (T7487)
19512 !! wikitext
19513 <center><font id="bug" />Centered text</center>
19514 <div><font id="bug2" />In div text</div>
19515 !! html+tidy
19516 <center><font id="bug"></font>Centered text</center>
19517 <div><font id="bug2"></font>In div text</div>
19518 !! end
19519
19520 !! test
19521 Punctuation: nbsp before exclamation
19522 !! wikitext
19523 C'est grave !
19524 !! html
19525 <p>C'est grave&#160;!
19526 </p>
19527 !! end
19528
19529 !! test
19530 Punctuation: CSS !important (T13874)
19531 !! wikitext
19532 <div style="width:50% !important">important</div>
19533 !! html
19534 <div style="width:50% !important">important</div>
19535 !! end
19536
19537 !! test
19538 Punctuation: CSS ! important (T13874; with space after)
19539 !! wikitext
19540 <div style="width:50% ! important">important</div>
19541 !! html
19542 <div style="width:50%&#32;! important">important</div>
19543 !! end
19544
19545 !! test
19546 HTML bullet list, closed tags (T7497)
19547 !! wikitext
19548 <ul>
19549 <li>One</li>
19550 <li>Two</li>
19551 </ul>
19552 !! html/php
19553 <ul>
19554 <li>One</li>
19555 <li>Two</li>
19556 </ul>
19557 !! html/parsoid
19558 <ul data-parsoid='{"stx":"html"}'>
19559 <li data-parsoid='{"stx":"html"}'>One</li>
19560 <li data-parsoid='{"stx":"html"}'>Two</li>
19561 </ul>
19562 !! end
19563
19564 !! test
19565 HTML bullet list, unclosed tags (T7497)
19566 !! wikitext
19567 <ul>
19568 <li>One
19569 <li>Two
19570 </ul>
19571 !! html/php+tidy
19572 <ul>
19573 <li>One
19574 </li><li>Two
19575 </li></ul>
19576 !! html/parsoid
19577 <ul data-parsoid='{"stx":"html"}'>
19578 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19579 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19580 </ul>
19581 !! end
19582
19583 !! test
19584 HTML ordered list, closed tags (T7497)
19585 !! wikitext
19586 <ol>
19587 <li>One</li>
19588 <li>Two</li>
19589 </ol>
19590 !! html/php
19591 <ol>
19592 <li>One</li>
19593 <li>Two</li>
19594 </ol>
19595 !! html/parsoid
19596 <ol data-parsoid='{"stx":"html"}'>
19597 <li data-parsoid='{"stx":"html"}'>One</li>
19598 <li data-parsoid='{"stx":"html"}'>Two</li>
19599 </ol>
19600 !! end
19601
19602 !! test
19603 HTML ordered list, unclosed tags (T7497)
19604 !! options
19605 !! wikitext
19606 <ol>
19607 <li>One
19608 <li>Two
19609 </ol>
19610 !! html/php+tidy
19611 <ol>
19612 <li>One
19613 </li><li>Two
19614 </li></ol>
19615 !! html/parsoid
19616 <ol data-parsoid='{"stx":"html"}'>
19617 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19618 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19619 </ol>
19620 !! end
19621
19622 !! test
19623 HTML nested bullet list, closed tags (T7497)
19624 !! wikitext
19625 <ul>
19626 <li>One</li>
19627 <li>Two:
19628 <ul>
19629 <li>Sub-one</li>
19630 <li>Sub-two</li>
19631 </ul>
19632 </li>
19633 </ul>
19634 !! html/php
19635 <ul>
19636 <li>One</li>
19637 <li>Two:
19638 <ul>
19639 <li>Sub-one</li>
19640 <li>Sub-two</li>
19641 </ul>
19642 </li>
19643 </ul>
19644 !! html/parsoid
19645 <ul data-parsoid='{"stx":"html"}'>
19646 <li data-parsoid='{"stx":"html"}'>One</li>
19647 <li data-parsoid='{"stx":"html"}'>Two:
19648 <ul data-parsoid='{"stx":"html"}'>
19649 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19650 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19651 </ul>
19652 </li>
19653 </ul>
19654 !! end
19655
19656 !! test
19657 HTML nested bullet list, open tags (T7497)
19658 !! wikitext
19659 <ul>
19660 <li>One
19661 <li>Two:
19662 <ul>
19663 <li>Sub-one
19664 <li>Sub-two
19665 </ul>
19666 </ul>
19667 !! html+tidy
19668 <ul>
19669 <li>One
19670 </li><li>Two:
19671 <ul>
19672 <li>Sub-one
19673 </li><li>Sub-two
19674 </li></ul>
19675 </li></ul>
19676 !! end
19677
19678 !! test
19679 HTML nested ordered list, closed tags (T7497)
19680 !! wikitext
19681 <ol>
19682 <li>One</li>
19683 <li>Two:
19684 <ol>
19685 <li>Sub-one</li>
19686 <li>Sub-two</li>
19687 </ol>
19688 </li>
19689 </ol>
19690 !! html
19691 <ol>
19692 <li>One</li>
19693 <li>Two:
19694 <ol>
19695 <li>Sub-one</li>
19696 <li>Sub-two</li>
19697 </ol>
19698 </li>
19699 </ol>
19700 !! end
19701
19702 !! test
19703 HTML nested ordered list, open tags (T7497)
19704 !! wikitext
19705 <ol>
19706 <li>One
19707 <li>Two:
19708 <ol>
19709 <li>Sub-one
19710 <li>Sub-two
19711 </ol>
19712 </ol>
19713 !! html/php
19714 <ol>
19715 <li>One
19716 <li>Two:
19717 <ol>
19718 <li>Sub-one
19719 <li>Sub-two
19720 </ol>
19721 </ol>
19722 !! html/parsoid
19723 <ol>
19724 <li>One
19725 </li>
19726 <li>Two:
19727 <ol>
19728 <li>Sub-one
19729 </li>
19730 <li>Sub-two
19731 </li>
19732 </ol>
19733 </li>
19734 </ol>
19735 !! end
19736
19737 !! test
19738 HTML ordered list item with parameters oddity
19739 !! wikitext
19740 <ol><li id="fragment">One</li>
19741 </ol>
19742 !! html
19743 <ol><li id="fragment">One</li>
19744 </ol>
19745 !! end
19746
19747 # parsoid doesn't explicitly mark autonumbered links, see T55505
19748 !!test
19749 T7918: autonumbering
19750 !! wikitext
19751 [http://first/] [http://second] [ftp://ftp]
19752
19753 ftp://inlineftp
19754
19755 [mailto:enclosed@mail.tld With target]
19756
19757 [mailto:enclosed@mail.tld]
19758
19759 mailto:inline@mail.tld
19760 !! html/php
19761 <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>
19762 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19763 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19764 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19765 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19766 </p>
19767 !! html/parsoid
19768 <p><a rel="mw:ExtLink" class="external autonumber" href="http://first/"></a> <a rel="mw:ExtLink" class="external autonumber" href="http://second"></a> <a rel="mw:ExtLink" class="external autonumber" href="ftp://ftp"></a></p>
19769 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19770 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19771 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19772 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19773 !! end
19774
19775
19776 #
19777 # Security and HTML correctness
19778 # From Nick Jenkins' fuzz testing
19779 #
19780
19781 !! test
19782 Fuzz testing: Parser13
19783 !! wikitext
19784 {|
19785 | http://a|
19786 !! html
19787 <table>
19788 <tr>
19789 <td>
19790 </td>
19791 </tr>
19792 </table>
19793 !! end
19794
19795 # Note that Parsoid output differs from the PHP parser here: the PHP
19796 # parser breaks the URL for the magic word, while in Parsoid the URL
19797 # production takes precedence.
19798 !! test
19799 Fuzz testing: Parser14
19800 !! wikitext
19801 ==onmouseover===
19802 http://__TOC__
19803 !! html/php
19804 <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>
19805 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>
19806 <ul>
19807 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19808 </ul>
19809 </div>
19810
19811 !! html/php+tidy
19812 <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>
19813 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>
19814 <ul>
19815 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19816 </ul>
19817 </div>
19818 !! html/parsoid
19819 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19820 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19821 !! end
19822
19823 !! test
19824 Fuzz testing: Parser14-table
19825 !! options
19826 parsoid=wt2html,html2html
19827 !! wikitext
19828 ==a==
19829 {| STYLE=__TOC__
19830 !! html/php
19831 <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>
19832 <table style="&#95;_TOC&#95;_">
19833 <tr><td></td></tr>
19834 </table>
19835 !! html/php+tidy
19836 <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>
19837 <table style="&#95;_TOC&#95;_">
19838 <tbody><tr><td></td></tr>
19839 </tbody></table>
19840 !! html/parsoid
19841 <h2 id="a">a</h2>
19842 <table style="__TOC__"></table>
19843 !! end
19844
19845 # Known to produce bogus xml (extra </td>)
19846 # Don't add the html/php section since it generates broken HTML
19847 !! test
19848 Fuzz testing: Parser16
19849 !! wikitext
19850 {|
19851 !https://||||||
19852 !! html+tidy
19853 <table>
19854 <tbody><tr>
19855 <th>https://</th>
19856 <th></th>
19857 <th></th>
19858 <th>
19859
19860 </th></tr>
19861 </tbody></table>
19862 !! end
19863
19864 !! test
19865 Fuzz testing: Parser21
19866 !! wikitext
19867 {|
19868 !irc://{{ftp://a" onmouseover="alert('hello world');"
19869 |
19870 !! html
19871 <table>
19872 <tr>
19873 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19874 </th>
19875 <td>
19876 </td>
19877 </tr>
19878 </table>
19879 !! end
19880
19881 !! test
19882 Fuzz testing: Parser22
19883 !! wikitext
19884 http://===r:::https://b
19885
19886 {|
19887 !! html
19888 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19889 </p>
19890 <table>
19891 <tr><td></td></tr>
19892 </table>
19893 !! end
19894
19895 ## Remex doesn't account for fostered content.
19896 ## Known to produce bad XML for now
19897 !! test
19898 Fuzz testing: Parser24
19899 !! options
19900 parsoid=wt2html
19901 !! wikitext
19902 {|
19903 {{{|
19904 <u CLASS=
19905 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19906 <br style="onmouseover='alert(document.cookie);' " />
19907
19908 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19909 |
19910 !! html/php
19911 <table>
19912 {{{|
19913 <u class="&#124;">}}}} &gt;
19914 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19915
19916 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19917 <tr>
19918 <td></u>
19919 </td>
19920 </tr>
19921 </table>
19922 !! html/php+tidy
19923
19924 {{{|
19925 <u class="&#124;">}}}} &gt;
19926 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19927
19928 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19929 </u><table><tbody><tr>
19930 <td>
19931 </td>
19932 </tr>
19933 </tbody></table>
19934 !! html/parsoid
19935 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19936 {{{|
19937 <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>"}'/>}}}} >
19938 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19939
19940 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19941 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19942 !! end
19943
19944 # Note: the current result listed for this is not what the original one was,
19945 # but the original bug was JavaScript injection, which is fixed in any case.
19946 # It's not clear that the original result listed was any more correct than the
19947 # current one. Original result:
19948 # <p>{{{|
19949 # </p>
19950 # <li class="&#124;&#124;">
19951 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19952 !!test
19953 Fuzz testing: Parser25 (T8055)
19954 !! wikitext
19955 {{{
19956 |
19957 <LI CLASS=||
19958 >
19959 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19960 !! html/php
19961 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19962 </p>
19963 !! html/parsoid
19964 <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"]}'>
19965 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19966 !! end
19967
19968 !!test
19969 Fuzz testing: URL adjacent extension (with space, clean)
19970 !! wikitext
19971 http://example.com <nowiki>junk</nowiki>
19972 !! html/php
19973 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19974 </p>
19975 !! html/parsoid
19976 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
19977 !! end
19978
19979 !!test
19980 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
19981 !! wikitext
19982 http://example.com<nowiki>junk</nowiki>
19983 !! html/php
19984 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
19985 </p>
19986 !! html/parsoid
19987 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
19988 !! end
19989
19990 !! test
19991 Fuzz testing: URL adjacent extension (no space, dirty; pre)
19992 !! wikitext
19993 http://example.com<pre>junk</pre>
19994 !! html/php
19995 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19996 !! html/php+tidy
19997 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19998 !! html/parsoid
19999 <p><a rel="mw:ExtLink" class="external free" href="http://example.com" 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>
20000 !! end
20001
20002 !! test
20003 Fuzz testing: image with bogus manual thumbnail
20004 !! wikitext
20005 [[Image:foobar.jpg|thumbnail= ]]
20006 !! html/php
20007 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
20008 !! html/parsoid
20009 <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>
20010 !! end
20011
20012 # Parsoid will emit the newline literally in wt2wt; see next test case.
20013 !! test
20014 Fuzz testing: encoded newline in generated HTML replacements (T8577)
20015 !! options
20016 parsoid=wt2html
20017 !! wikitext
20018 <pre dir="&#10;"></pre>
20019 !! html/php
20020 <pre dir="&#10;"></pre>
20021 !! html/parsoid
20022 <pre dir="
20023 " typeof="mw:Extension/pre" about="#mwt2"data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20024 !! end
20025
20026 !! test
20027 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
20028 !! options
20029 parsoid=html2wt
20030 !! html/parsoid
20031 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20032 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20033 !! wikitext
20034 <pre dir="
20035 "></pre>
20036 !! html/php
20037 <pre dir=""></pre>
20038 !! end
20039
20040 !! test
20041 Templates in extension attributes are not expanded
20042 !! wikitext
20043 <pre dir="{{echo|ltr}}"></pre>
20044 !! html/php
20045 <pre dir="{{echo|ltr}}"></pre>
20046 !! html/parsoid
20047 <pre dir="{{echo|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
20048 !! end
20049
20050 !! test
20051 Parsing optional HTML elements (T8171)
20052 !! options
20053 !! wikitext
20054 <table>
20055 <tr>
20056 <td> Some tabular data</td>
20057 <td> More tabular data ...
20058 <td> And yet som tabular data</td>
20059 </tr>
20060 </table>
20061 !! html
20062 <table>
20063 <tr>
20064 <td> Some tabular data</td>
20065 <td> More tabular data ...
20066 </td><td> And yet som tabular data</td>
20067 </tr>
20068 </table>
20069 !! end
20070
20071 !! test
20072 Correct handling of <td>, <tr> (T8171)
20073 !! options
20074 !! wikitext
20075 <table>
20076 <tr>
20077 <td> Some tabular data</td>
20078 <td> More tabular data ...</td>
20079 <td> And yet som tabular data</td>
20080 </tr>
20081 </table>
20082 !! html
20083 <table>
20084 <tr>
20085 <td> Some tabular data</td>
20086 <td> More tabular data ...</td>
20087 <td> And yet som tabular data</td>
20088 </tr>
20089 </table>
20090 !! end
20091
20092
20093 !! test
20094 Parsing crashing regression (fr:JavaScript)
20095 !! wikitext
20096 </body></x>
20097 !! html
20098 <p>&lt;/body&gt;&lt;/x&gt;
20099 </p>
20100 !! end
20101
20102 !! test
20103 Inline wiki vs wiki block nesting
20104 !! wikitext
20105 '''Bold paragraph
20106
20107 New wiki paragraph
20108 !! html
20109 <p><b>Bold paragraph</b>
20110 </p><p>New wiki paragraph
20111 </p>
20112 !! end
20113
20114 # FIXME: The current php output is documented
20115 # and desired output is the parsoid target.
20116 !! test
20117 Inline HTML vs wiki block nesting
20118 !! wikitext
20119 <b>Bold paragraph
20120
20121 New wiki paragraph
20122 !! html/php
20123 <p><b>Bold paragraph
20124 </p><p>New wiki paragraph</b>
20125 </p>
20126 !! html/php+tidy
20127 <p><b>Bold paragraph
20128 </b></p><p><b>New wiki paragraph
20129 </b></p>
20130 !! html/parsoid
20131 <p><b>Bold paragraph</b>
20132 </p><p>New wiki paragraph
20133 </p>
20134 !! end
20135
20136 # Original result was this:
20137 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20138 # </p>
20139 # While that might be marginally more intuitive, maybe, the six-apostrophe
20140 # construct is clearly pathological and the result stated here (which is what
20141 # the parser actually does) is about as reasonable as anything.
20142 !!test
20143 Mixing markup for italics and bold
20144 !! options
20145 !! wikitext
20146 '''bold''''''bold''bolditalics'''''
20147 !! html
20148 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20149 </p>
20150 !! end
20151
20152
20153 !! article
20154 Xyzzyx
20155 !! text
20156 Article for special page transclusion test
20157 !! endarticle
20158
20159 !! test
20160 Special page transclusion
20161 !! options
20162 !! wikitext
20163 {{Special:Prefixindex/Xyzzyx}}
20164 !! html
20165 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20166 </ul>
20167 !! end
20168
20169 !! test
20170 Special page transclusion twice (T7021)
20171 !! options
20172 !! wikitext
20173 {{Special:Prefixindex/Xyzzyx}}
20174 {{Special:Prefixindex/Xyzzyx}}
20175 !! html
20176 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20177 </ul>
20178 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20179 </ul>
20180 !! end
20181
20182 !! test
20183 Transclusion of default MediaWiki message
20184 !! wikitext
20185 {{MediaWiki:Mainpage}}
20186 !! html
20187 <p>Main Page
20188 </p>
20189 !! end
20190
20191 !! test
20192 Transclusion of nonexistent MediaWiki message
20193 !! wikitext
20194 {{MediaWiki:Mainpagexxx}}
20195 !! html
20196 <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>
20197 </p>
20198 !! end
20199
20200 !! test
20201 Transclusion of MediaWiki message with underscore
20202 !! wikitext
20203 {{MediaWiki:history_short}}
20204 !! html
20205 <p>History
20206 </p>
20207 !! end
20208
20209 !! test
20210 Transclusion of MediaWiki message with space
20211 !! wikitext
20212 {{MediaWiki:history short}}
20213 !! html
20214 <p>History
20215 </p>
20216 !! end
20217
20218 !! test
20219 Invalid header with following text
20220 !! wikitext
20221 = x = y
20222 !! html
20223 <p>= x = y
20224 </p>
20225 !! end
20226
20227
20228 !! test
20229 Section extraction test (section 0)
20230 !! options
20231 section=0
20232 !! wikitext
20233 start
20234 ==a==
20235 ===aa===
20236 ====aaa====
20237 ==b==
20238 ===ba===
20239 ===bb===
20240 ====bba====
20241 ===bc===
20242 ==c==
20243 ===ca===
20244 !! html/php
20245 start
20246 !! end
20247
20248 !! test
20249 Section extraction test (section 1)
20250 !! options
20251 section=1
20252 !! wikitext
20253 start
20254 ==a==
20255 ===aa===
20256 ====aaa====
20257 ==b==
20258 ===ba===
20259 ===bb===
20260 ====bba====
20261 ===bc===
20262 ==c==
20263 ===ca===
20264 !! html/php
20265 ==a==
20266 ===aa===
20267 ====aaa====
20268 !! end
20269
20270 !! test
20271 Section extraction test (section 2)
20272 !! options
20273 section=2
20274 !! wikitext
20275 start
20276 ==a==
20277 ===aa===
20278 ====aaa====
20279 ==b==
20280 ===ba===
20281 ===bb===
20282 ====bba====
20283 ===bc===
20284 ==c==
20285 ===ca===
20286 !! html/php
20287 ===aa===
20288 ====aaa====
20289 !! end
20290
20291 !! test
20292 Section extraction test (section 3)
20293 !! options
20294 section=3
20295 !! wikitext
20296 start
20297 ==a==
20298 ===aa===
20299 ====aaa====
20300 ==b==
20301 ===ba===
20302 ===bb===
20303 ====bba====
20304 ===bc===
20305 ==c==
20306 ===ca===
20307 !! html/php
20308 ====aaa====
20309 !! end
20310
20311 !! test
20312 Section extraction test (section 4)
20313 !! options
20314 section=4
20315 !! wikitext
20316 start
20317 ==a==
20318 ===aa===
20319 ====aaa====
20320 ==b==
20321 ===ba===
20322 ===bb===
20323 ====bba====
20324 ===bc===
20325 ==c==
20326 ===ca===
20327 !! html/php
20328 ==b==
20329 ===ba===
20330 ===bb===
20331 ====bba====
20332 ===bc===
20333 !! end
20334
20335 !! test
20336 Section extraction test (section 5)
20337 !! options
20338 section=5
20339 !! wikitext
20340 start
20341 ==a==
20342 ===aa===
20343 ====aaa====
20344 ==b==
20345 ===ba===
20346 ===bb===
20347 ====bba====
20348 ===bc===
20349 ==c==
20350 ===ca===
20351 !! html/php
20352 ===ba===
20353 !! end
20354
20355 !! test
20356 Section extraction test (section 6)
20357 !! options
20358 section=6
20359 !! wikitext
20360 start
20361 ==a==
20362 ===aa===
20363 ====aaa====
20364 ==b==
20365 ===ba===
20366 ===bb===
20367 ====bba====
20368 ===bc===
20369 ==c==
20370 ===ca===
20371 !! html/php
20372 ===bb===
20373 ====bba====
20374 !! end
20375
20376 !! test
20377 Section extraction test (section 7)
20378 !! options
20379 section=7
20380 !! wikitext
20381 start
20382 ==a==
20383 ===aa===
20384 ====aaa====
20385 ==b==
20386 ===ba===
20387 ===bb===
20388 ====bba====
20389 ===bc===
20390 ==c==
20391 ===ca===
20392 !! html/php
20393 ====bba====
20394 !! end
20395
20396 !! test
20397 Section extraction test (section 8)
20398 !! options
20399 section=8
20400 !! wikitext
20401 start
20402 ==a==
20403 ===aa===
20404 ====aaa====
20405 ==b==
20406 ===ba===
20407 ===bb===
20408 ====bba====
20409 ===bc===
20410 ==c==
20411 ===ca===
20412 !! html/php
20413 ===bc===
20414 !! end
20415
20416 !! test
20417 Section extraction test (section 9)
20418 !! options
20419 section=9
20420 !! wikitext
20421 start
20422 ==a==
20423 ===aa===
20424 ====aaa====
20425 ==b==
20426 ===ba===
20427 ===bb===
20428 ====bba====
20429 ===bc===
20430 ==c==
20431 ===ca===
20432 !! html/php
20433 ==c==
20434 ===ca===
20435 !! end
20436
20437 !! test
20438 Section extraction test (section 10)
20439 !! options
20440 section=10
20441 !! wikitext
20442 start
20443 ==a==
20444 ===aa===
20445 ====aaa====
20446 ==b==
20447 ===ba===
20448 ===bb===
20449 ====bba====
20450 ===bc===
20451 ==c==
20452 ===ca===
20453 !! html/php
20454 ===ca===
20455 !! end
20456
20457 !! test
20458 Section extraction test (nonexistent section 11)
20459 !! options
20460 section=11
20461 !! wikitext
20462 start
20463 ==a==
20464 ===aa===
20465 ====aaa====
20466 ==b==
20467 ===ba===
20468 ===bb===
20469 ====bba====
20470 ===bc===
20471 ==c==
20472 ===ca===
20473 !! html/php
20474 !! end
20475
20476 !! test
20477 Section extraction test with bogus heading (section 1)
20478 !! options
20479 section=1
20480 !! wikitext
20481 ==a==
20482 ==bogus== not a legal section
20483 ==b==
20484 !! html/php
20485 ==a==
20486 ==bogus== not a legal section
20487 !! end
20488
20489 !! test
20490 Section extraction test with bogus heading (section 2)
20491 !! options
20492 section=2
20493 !! wikitext
20494 ==a==
20495 ==bogus== not a legal section
20496 ==b==
20497 !! html/php
20498 ==b==
20499 !! end
20500
20501 !! test
20502 Section extraction test with comment after heading (section 1)
20503 !! options
20504 section=1
20505 !! wikitext
20506 ==a==
20507 ==b== <!-- -->
20508 ==c==
20509 !! html/php
20510 ==a==
20511 !! end
20512
20513 !! test
20514 Section extraction test with comment after heading (section 2)
20515 !! options
20516 section=2
20517 !! wikitext
20518 ==a==
20519 ==b== <!-- -->
20520 ==c==
20521 !! html/php
20522 ==b== <!-- -->
20523 !! end
20524
20525 !! test
20526 Section extraction test with bogus <nowiki> heading (section 1)
20527 !! options
20528 section=1
20529 !! wikitext
20530 ==a==
20531 ==bogus== <nowiki>not a legal section</nowiki>
20532 ==b==
20533 !! html/php
20534 ==a==
20535 ==bogus== <nowiki>not a legal section</nowiki>
20536 !! end
20537
20538 !! test
20539 Section extraction test with bogus <nowiki> heading (section 2)
20540 !! options
20541 section=2
20542 !! wikitext
20543 ==a==
20544 ==bogus== <nowiki>not a legal section</nowiki>
20545 ==b==
20546 !! html/php
20547 ==b==
20548 !! end
20549
20550 # Formerly testing for T4587, now resolved by the use of unmarked sections
20551 # instead of respecting commented sections
20552 !! test
20553 Section extraction prefixed by comment (section 1)
20554 !! options
20555 section=1
20556 !! wikitext
20557 <!-- -->==sec1==
20558 ==sec2==
20559 !! html/php
20560 ==sec2==
20561 !!end
20562
20563 !! test
20564 Section extraction prefixed by comment (section 2)
20565 !! options
20566 section=2
20567 !! wikitext
20568 <!-- -->==sec1==
20569 ==sec2==
20570 !! html/php
20571 !! end
20572
20573 # Formerly testing for T4607, now resolved by the use of unmarked sections
20574 # instead of respecting HTML-style headings
20575 !! test
20576 Section extraction, mixed wiki and html (section 1)
20577 !! options
20578 section=1
20579 !! wikitext
20580 <h2>unmarked</h2>
20581 unmarked
20582 ==1==
20583 one
20584 ==2==
20585 two
20586 !! html/php
20587 ==1==
20588 one
20589 !! end
20590
20591 !! test
20592 Section extraction, mixed wiki and html (section 2)
20593 !! options
20594 section=2
20595 !! wikitext
20596 <h2>unmarked</h2>
20597 unmarked
20598 ==1==
20599 one
20600 ==2==
20601 two
20602 !! html/php
20603 ==2==
20604 two
20605 !! end
20606
20607
20608 # Formerly testing for T5342
20609 !! test
20610 Section extraction, heading surrounded by <noinclude>
20611 !! options
20612 section=1
20613 !! wikitext
20614 <noinclude>==unmarked==</noinclude>
20615 ==marked==
20616 !! html/php
20617 ==marked==
20618 !!end
20619
20620 # Test behavior of T21910
20621 !! test
20622 Sectiion with all-equals
20623 !! options
20624 section=2
20625 !! wikitext
20626 ===
20627 The line above must have a trailing space
20628 === <!--
20629 --> <!-- -->
20630 But just in case it doesn't...
20631 !! html/php
20632 === <!--
20633 --> <!-- -->
20634 But just in case it doesn't...
20635 !! end
20636
20637 !! test
20638 Section replacement test (section 0)
20639 !! options
20640 replace=0,"xxx"
20641 !! wikitext
20642 start
20643 ==a==
20644 ===aa===
20645 ====aaa====
20646 ==b==
20647 ===ba===
20648 ===bb===
20649 ====bba====
20650 ===bc===
20651 ==c==
20652 ===ca===
20653 !! html/php
20654 xxx
20655
20656 ==a==
20657 ===aa===
20658 ====aaa====
20659 ==b==
20660 ===ba===
20661 ===bb===
20662 ====bba====
20663 ===bc===
20664 ==c==
20665 ===ca===
20666 !! end
20667
20668 !! test
20669 Section replacement test (section 1)
20670 !! options
20671 replace=1,"xxx"
20672 !! wikitext
20673 start
20674 ==a==
20675 ===aa===
20676 ====aaa====
20677 ==b==
20678 ===ba===
20679 ===bb===
20680 ====bba====
20681 ===bc===
20682 ==c==
20683 ===ca===
20684 !! html/php
20685 start
20686 xxx
20687
20688 ==b==
20689 ===ba===
20690 ===bb===
20691 ====bba====
20692 ===bc===
20693 ==c==
20694 ===ca===
20695 !! end
20696
20697 !! test
20698 Section replacement test (section 2)
20699 !! options
20700 replace=2,"xxx"
20701 !! wikitext
20702 start
20703 ==a==
20704 ===aa===
20705 ====aaa====
20706 ==b==
20707 ===ba===
20708 ===bb===
20709 ====bba====
20710 ===bc===
20711 ==c==
20712 ===ca===
20713 !! html/php
20714 start
20715 ==a==
20716 xxx
20717
20718 ==b==
20719 ===ba===
20720 ===bb===
20721 ====bba====
20722 ===bc===
20723 ==c==
20724 ===ca===
20725 !! end
20726
20727 !! test
20728 Section replacement test (section 3)
20729 !! options
20730 replace=3,"xxx"
20731 !! wikitext
20732 start
20733 ==a==
20734 ===aa===
20735 ====aaa====
20736 ==b==
20737 ===ba===
20738 ===bb===
20739 ====bba====
20740 ===bc===
20741 ==c==
20742 ===ca===
20743 !! html/php
20744 start
20745 ==a==
20746 ===aa===
20747 xxx
20748
20749 ==b==
20750 ===ba===
20751 ===bb===
20752 ====bba====
20753 ===bc===
20754 ==c==
20755 ===ca===
20756 !! end
20757
20758 !! test
20759 Section replacement test (section 4)
20760 !! options
20761 replace=4,"xxx"
20762 !! wikitext
20763 start
20764 ==a==
20765 ===aa===
20766 ====aaa====
20767 ==b==
20768 ===ba===
20769 ===bb===
20770 ====bba====
20771 ===bc===
20772 ==c==
20773 ===ca===
20774 !! html/php
20775 start
20776 ==a==
20777 ===aa===
20778 ====aaa====
20779 xxx
20780
20781 ==c==
20782 ===ca===
20783 !! end
20784
20785 !! test
20786 Section replacement test (section 5)
20787 !! options
20788 replace=5,"xxx"
20789 !! wikitext
20790 start
20791 ==a==
20792 ===aa===
20793 ====aaa====
20794 ==b==
20795 ===ba===
20796 ===bb===
20797 ====bba====
20798 ===bc===
20799 ==c==
20800 ===ca===
20801 !! html/php
20802 start
20803 ==a==
20804 ===aa===
20805 ====aaa====
20806 ==b==
20807 xxx
20808
20809 ===bb===
20810 ====bba====
20811 ===bc===
20812 ==c==
20813 ===ca===
20814 !! end
20815
20816 !! test
20817 Section replacement test (section 6)
20818 !! options
20819 replace=6,"xxx"
20820 !! wikitext
20821 start
20822 ==a==
20823 ===aa===
20824 ====aaa====
20825 ==b==
20826 ===ba===
20827 ===bb===
20828 ====bba====
20829 ===bc===
20830 ==c==
20831 ===ca===
20832 !! html/php
20833 start
20834 ==a==
20835 ===aa===
20836 ====aaa====
20837 ==b==
20838 ===ba===
20839 xxx
20840
20841 ===bc===
20842 ==c==
20843 ===ca===
20844 !! end
20845
20846 !! test
20847 Section replacement test (section 7)
20848 !! options
20849 replace=7,"xxx"
20850 !! wikitext
20851 start
20852 ==a==
20853 ===aa===
20854 ====aaa====
20855 ==b==
20856 ===ba===
20857 ===bb===
20858 ====bba====
20859 ===bc===
20860 ==c==
20861 ===ca===
20862 !! html/php
20863 start
20864 ==a==
20865 ===aa===
20866 ====aaa====
20867 ==b==
20868 ===ba===
20869 ===bb===
20870 xxx
20871
20872 ===bc===
20873 ==c==
20874 ===ca===
20875 !! end
20876
20877 !! test
20878 Section replacement test (section 8)
20879 !! options
20880 replace=8,"xxx"
20881 !! wikitext
20882 start
20883 ==a==
20884 ===aa===
20885 ====aaa====
20886 ==b==
20887 ===ba===
20888 ===bb===
20889 ====bba====
20890 ===bc===
20891 ==c==
20892 ===ca===
20893 !! html/php
20894 start
20895 ==a==
20896 ===aa===
20897 ====aaa====
20898 ==b==
20899 ===ba===
20900 ===bb===
20901 ====bba====
20902 xxx
20903
20904 ==c==
20905 ===ca===
20906 !!end
20907
20908 !! test
20909 Section replacement test (section 9)
20910 !! options
20911 replace=9,"xxx"
20912 !! wikitext
20913 start
20914 ==a==
20915 ===aa===
20916 ====aaa====
20917 ==b==
20918 ===ba===
20919 ===bb===
20920 ====bba====
20921 ===bc===
20922 ==c==
20923 ===ca===
20924 !! html/php
20925 start
20926 ==a==
20927 ===aa===
20928 ====aaa====
20929 ==b==
20930 ===ba===
20931 ===bb===
20932 ====bba====
20933 ===bc===
20934 xxx
20935 !! end
20936
20937 !! test
20938 Section replacement test (section 10)
20939 !! options
20940 replace=10,"xxx"
20941 !! wikitext
20942 start
20943 ==a==
20944 ===aa===
20945 ====aaa====
20946 ==b==
20947 ===ba===
20948 ===bb===
20949 ====bba====
20950 ===bc===
20951 ==c==
20952 ===ca===
20953 !! html/php
20954 start
20955 ==a==
20956 ===aa===
20957 ====aaa====
20958 ==b==
20959 ===ba===
20960 ===bb===
20961 ====bba====
20962 ===bc===
20963 ==c==
20964 xxx
20965 !! end
20966
20967 !! test
20968 Section replacement test with initial whitespace (T15728)
20969 !! options
20970 replace=2,"xxx"
20971 !! wikitext
20972 Preformatted initial line
20973 ==a==
20974 ===a===
20975 !! html/php
20976 Preformatted initial line
20977 ==a==
20978 xxx
20979 !! end
20980
20981
20982 !! test
20983 Section extraction, heading followed by pre with 20 spaces (T8398)
20984 !! options
20985 section=1
20986 !! wikitext
20987 ==a==
20988 a
20989 !! html/php
20990 ==a==
20991 a
20992 !! end
20993
20994 !! test
20995 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20996 !! options
20997 section=1
20998 !! wikitext
20999 ==a==
21000 a
21001 !! html/php
21002 ==a==
21003 a
21004 !! end
21005
21006
21007 !! test
21008 Section extraction, <pre> around bogus header (T12309)
21009 !! options
21010 section=2
21011 !! wikitext
21012 == Section One ==
21013 <pre>
21014 =======
21015 </pre>
21016
21017 == Section Two ==
21018 stuff
21019 !! html/php
21020 == Section Two ==
21021 stuff
21022 !! end
21023
21024 !! test
21025 Section replacement, <pre> around bogus header (T12309)
21026 !! options
21027 replace=2,"xxx"
21028 !! wikitext
21029 == Section One ==
21030 <pre>
21031 =======
21032 </pre>
21033
21034 == Section Two ==
21035 stuff
21036 !! html/php
21037 == Section One ==
21038 <pre>
21039 =======
21040 </pre>
21041
21042 xxx
21043 !! end
21044
21045 !! test
21046 Handling of &#x0A; in URLs
21047 !! wikitext
21048 *irc://&#x0A;a
21049 !! html/php
21050 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21051 !! html/parsoid
21052 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul>
21053 !! end
21054
21055 !! test
21056 Handling of %0A in URLs
21057 !! wikitext
21058 *irc://%0Aa
21059 !! html/php
21060 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21061 !! html/parsoid
21062 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21063 !! end
21064
21065 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
21066 !! test
21067 5 quotes, code coverage +1 line
21068 !! options
21069 parsoid=wt2html
21070 !! wikitext
21071 '''''
21072 !! html/php
21073 !! html/parsoid
21074 <p><b><i></i></b></p>
21075 !! end
21076
21077 # same html as previous, but wikitext adjusted to match parsoid html2wt
21078 # note that wt2html and html2html will put the <i> before the <b>
21079 !! test
21080 5 quotes, code coverage +1 line w/ nowiki (1)
21081 !! options
21082 parsoid=wt2wt,html2wt
21083 !! wikitext
21084 '''''<nowiki/>'''''
21085 !! html/php
21086 <p><i></i>
21087 </p>
21088 !! html/parsoid
21089 <p><b><i></i></b></p>
21090 !! end
21091
21092 # same as previous, just swapping the <i> and <b>
21093 !! test
21094 5 quotes, code coverage +1 line w/ nowiki (2)
21095 !! wikitext
21096 '''''<nowiki/>'''''
21097 !! html/php
21098 <p><i></i>
21099 </p>
21100 !! html/parsoid
21101 <p><i><b></b></i></p>
21102 !! end
21103
21104 !! test
21105 Special:Search page linking.
21106 !! wikitext
21107 {{Special:search}}
21108 !! html
21109 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21110 </p>
21111 !! end
21112
21113 !! test
21114 {{!}} is a magic word
21115 !! wikitext
21116 {{!}} is a magic word there and {{!}} is still a magic word here
21117 | is not a magic word here but {{!}} is still a magic word here
21118 !! html/php
21119 <p>| is a magic word there and | is still a magic word here
21120 | is not a magic word here but | is still a magic word here
21121 </p>
21122 !! html/parsoid
21123 <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
21124 | 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>
21125 !! end
21126
21127 !! test
21128 Say the magic word
21129 !! options
21130 title=[[Parser test]]
21131 !! wikitext
21132 *{{PAGENAME}}
21133 *{{PAGENAMEE}}
21134 *{{FULLPAGENAME}}
21135 *{{FULLPAGENAMEE}}
21136 *{{BASEPAGENAME}}
21137 *{{BASEPAGENAMEE}}
21138 *{{SUBPAGENAME}}
21139 *{{SUBPAGENAMEE}}
21140 *{{ROOTPAGENAME}}
21141 *{{ROOTPAGENAMEE}}
21142 *{{TALKPAGENAME}}
21143 *{{TALKPAGENAMEE}}
21144 *{{SUBJECTPAGENAME}}
21145 *{{SUBJECTPAGENAMEE}}
21146 *{{NAMESPACEE}}
21147 *{{NAMESPACE}}
21148 *{{NAMESPACENUMBER}}
21149 *{{TALKSPACE}}
21150 *{{TALKSPACEE}}
21151 *{{SUBJECTSPACE}}
21152 *{{SUBJECTSPACEE}}
21153 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21154 !! html
21155 <ul><li>Parser test</li>
21156 <li>Parser_test</li>
21157 <li>Parser test</li>
21158 <li>Parser_test</li>
21159 <li>Parser test</li>
21160 <li>Parser_test</li>
21161 <li>Parser test</li>
21162 <li>Parser_test</li>
21163 <li>Parser test</li>
21164 <li>Parser_test</li>
21165 <li>Talk:Parser test</li>
21166 <li>Talk:Parser_test</li>
21167 <li>Parser test</li>
21168 <li>Parser_test</li>
21169 <li></li>
21170 <li></li>
21171 <li>0</li>
21172 <li>Talk</li>
21173 <li>Talk</li>
21174 <li></li>
21175 <li></li>
21176 <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>
21177 !! end
21178 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21179
21180 !! test
21181 Gallery with valid attributes
21182 !! wikitext
21183 <gallery type="123" summary="345">
21184 File:File:Foobar.jpg
21185 </gallery>
21186 !! html/php
21187 <ul class="gallery mw-gallery-traditional" type="123">
21188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21189 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21190 <div class="gallerytext">
21191 </div>
21192 </div></li>
21193 </ul>
21194 !! html/parsoid
21195 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{}}'>
21196 <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>
21197 </ul>
21198 !! end
21199
21200 ## Parsoid thinks the "centre" here is a property, not a caption.
21201 !! test
21202 Gallery
21203 !! options
21204 parsoid={
21205 "modes": ["wt2html"]
21206 }
21207 !! wikitext
21208 <gallery>
21209 image1.png |
21210 image2.gif|||||
21211
21212 image3|
21213 image4 |300px| centre
21214 image5.svg| http://///////
21215 [[x|xx]]]]
21216 * image6
21217 </gallery>
21218 !! html/php
21219 <ul class="gallery mw-gallery-traditional">
21220 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21221 <div class="thumb" style="height: 150px;">Image1.png</div>
21222 <div class="gallerytext">
21223 </div>
21224 </div></li>
21225 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21226 <div class="thumb" style="height: 150px;">Image2.gif</div>
21227 <div class="gallerytext">
21228 </div>
21229 </div></li>
21230 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21231 <div class="thumb" style="height: 150px;">Image3</div>
21232 <div class="gallerytext">
21233 </div>
21234 </div></li>
21235 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21236 <div class="thumb" style="height: 150px;">Image4</div>
21237 <div class="gallerytext">
21238 <pre>centre
21239 </pre>
21240 </div>
21241 </div></li>
21242 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21243 <div class="thumb" style="height: 150px;">Image5.svg</div>
21244 <div class="gallerytext">
21245 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21246 </p>
21247 </div>
21248 </div></li>
21249 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21250 <div class="thumb" style="height: 150px;">* image6</div>
21251 <div class="gallerytext">
21252 </div>
21253 </div></li>
21254 </ul>
21255 !! html/parsoid
21256 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21257 <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>
21258 <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>
21259 <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>
21260 <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>
21261 <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" class="external free" href="http://///////">http://///////</a></div></li>
21262 <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>
21263 </ul>
21264 !! end
21265
21266 !! test
21267 Gallery (with options, html)
21268 !! options
21269 parsoid={
21270 "modes": ["wt2html", "html2html"]
21271 }
21272 !! wikitext
21273 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21274 File:Nonexistent.jpg|caption
21275 File:Nonexistent.jpg
21276 image:foobar.jpg|some '''caption''' [[Main Page]]
21277 image:foobar.jpg
21278 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21279 </gallery>
21280 !! html/php
21281 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21282 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21283 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21284 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21285 <div class="gallerytext">
21286 <p>caption
21287 </p>
21288 </div>
21289 </div></li>
21290 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21291 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21292 <div class="gallerytext">
21293 </div>
21294 </div></li>
21295 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21296 <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>
21297 <div class="gallerytext">
21298 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21299 </p>
21300 </div>
21301 </div></li>
21302 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21303 <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>
21304 <div class="gallerytext">
21305 </div>
21306 </div></li>
21307 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21308 <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>
21309 <div class="gallerytext">
21310 <p>blabla.
21311 </p>
21312 </div>
21313 </div></li>
21314 </ul>
21315 !! html/parsoid
21316 <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":{}}'>
21317 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21318 <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>
21319 <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>
21320 <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>
21321 <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>
21322 <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>
21323 </ul>
21324 !! end
21325
21326 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
21327 ## are no longer in storage.
21328 !! test
21329 Gallery (with options, extsrc)
21330 !! options
21331 parsoid=html2wt
21332 !! wikitext
21333 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21334 File:Nonexistent.jpg|caption
21335 File:Nonexistent.jpg
21336 image:foobar.jpg|some '''caption''' [[Main Page]]
21337 image:foobar.jpg
21338 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21339 </gallery>
21340 !! html/php
21341 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21342 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21343 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21344 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21345 <div class="gallerytext">
21346 <p>caption
21347 </p>
21348 </div>
21349 </div></li>
21350 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21351 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21352 <div class="gallerytext">
21353 </div>
21354 </div></li>
21355 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21356 <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>
21357 <div class="gallerytext">
21358 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21359 </p>
21360 </div>
21361 </div></li>
21362 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21363 <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>
21364 <div class="gallerytext">
21365 </div>
21366 </div></li>
21367 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21368 <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>
21369 <div class="gallerytext">
21370 <p>blabla.
21371 </p>
21372 </div>
21373 </div></li>
21374 </ul>
21375 !! html/parsoid
21376 <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"}}'>
21377 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21378 <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>
21379 <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>
21380 <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>
21381 <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>
21382 <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>
21383 </ul>
21384 !! end
21385
21386 !! test
21387 Gallery (without px units)
21388 !! wikitext
21389 <gallery widths="70" heights="40">
21390 File:Foobar.jpg
21391 </gallery>
21392 !! html/php
21393 <ul class="gallery mw-gallery-traditional">
21394 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21395 <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>
21396 <div class="gallerytext">
21397 </div>
21398 </div></li>
21399 </ul>
21400 !! html/parsoid
21401 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{}}'>
21402 <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>
21403 </ul>
21404 !! end
21405
21406 !! test
21407 Gallery (with invalid units)
21408 !! wikitext
21409 <gallery widths="70em" heights="40em">
21410 File:Foobar.jpg
21411 </gallery>
21412 !! html/php
21413 <ul class="gallery mw-gallery-traditional">
21414 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21415 <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>
21416 <div class="gallerytext">
21417 </div>
21418 </div></li>
21419 </ul>
21420 !! html/parsoid
21421 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{}}'>
21422 <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>
21423 </ul>
21424 !! end
21425
21426 !! test
21427 Gallery with link that has fragment
21428 !! options
21429 parsoid={
21430 "modes": ["wt2html", "html2html"]
21431 }
21432 !! wikitext
21433 <gallery>
21434 image:foobar.jpg|link=Main_Page
21435 image:foobar.jpg|link=Main_Page#section
21436 image:foobar.jpg|link=Main Page#section|caption
21437 </gallery>
21438 !! html/php
21439 <ul class="gallery mw-gallery-traditional">
21440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21441 <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>
21442 <div class="gallerytext">
21443 </div>
21444 </div></li>
21445 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21446 <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>
21447 <div class="gallerytext">
21448 </div>
21449 </div></li>
21450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21451 <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>
21452 <div class="gallerytext">
21453 <p>caption
21454 </p>
21455 </div>
21456 </div></li>
21457 </ul>
21458 !! html/parsoid
21459 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21460 <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>
21461 <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>
21462 <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>
21463 </ul>
21464 !! end
21465
21466 !! test
21467 Gallery with template inside caption
21468 !! wikitext
21469 <gallery caption="{{echo|hi}}">
21470 File:Foobar.jpg|{{echo|ho}}
21471 </gallery>
21472 !! html/php
21473 <ul class="gallery mw-gallery-traditional">
21474 <li class='gallerycaption'>hi</li>
21475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21476 <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>
21477 <div class="gallerytext">
21478 <p>ho
21479 </p>
21480 </div>
21481 </div></li>
21482 </ul>
21483 !! html/parsoid
21484 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21485 <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>
21486 <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>
21487 </ul>
21488 !! end
21489
21490 !! test
21491 Gallery with wikitext inside gallery caption
21492 !! options
21493 parsoid={
21494 "modes": ["wt2html", "html2html"]
21495 }
21496 !! wikitext
21497 <gallery caption="# This should not be a list item
21498
21499 Text '''bold''' [[link]] {{ns:-1}}
21500
21501 [[File:Foobar.jpg|thumb|File in gallery caption]]">
21502 File:Foobar.jpg|Image caption
21503 </gallery>
21504 !! html/php
21505 <ul class="gallery mw-gallery-traditional">
21506 <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>
21507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21508 <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>
21509 <div class="gallerytext">
21510 <p>Image caption
21511 </p>
21512 </div>
21513 </div></li>
21514 </ul>
21515 !! html/parsoid
21516 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21517 <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>
21518 <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>
21519 </ul>
21520 !! end
21521
21522 !! test
21523 Gallery with wikitext inside caption
21524 !! wikitext
21525 <gallery>
21526 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21527 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21528 </gallery>
21529 !! html/php
21530 <ul class="gallery mw-gallery-traditional">
21531 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21532 <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>
21533 <div class="gallerytext">
21534 <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>
21535 </p>
21536 </div>
21537 </div></li>
21538 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21539 <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>
21540 <div class="gallerytext">
21541 <p>This is a test template
21542 </p>
21543 </div>
21544 </div></li>
21545 </ul>
21546 !! html/parsoid
21547 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21548 <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>
21549 <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>
21550 </ul>
21551 !! end
21552
21553 !! test
21554 Gallery (with showfilename option)
21555 !! wikitext
21556 <gallery showfilename="">
21557 File:Nonexistent.jpg|caption
21558 File:Nonexistent.jpg
21559 File:Foobar.jpg|some '''caption''' [[Main Page]]
21560 File:Foobar.jpg
21561 </gallery>
21562 !! html/php
21563 <ul class="gallery mw-gallery-traditional">
21564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21565 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21566 <div class="gallerytext">
21567 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21568 caption
21569 </p>
21570 </div>
21571 </div></li>
21572 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21573 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21574 <div class="gallerytext">
21575 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21576 </p>
21577 </div>
21578 </div></li>
21579 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21580 <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>
21581 <div class="gallerytext">
21582 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21583 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21584 </p>
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/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>
21589 <div class="gallerytext">
21590 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21591 </p>
21592 </div>
21593 </div></li>
21594 </ul>
21595 !! html/parsoid
21596 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21597 <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>
21598 <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>
21599 <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>
21600 <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>
21601 </ul>
21602 !! end
21603
21604 ## Should Parsoid be preserving these variations? See T151367
21605 !! test
21606 Gallery (with namespace-less filenames)
21607 !! options
21608 parsoid={
21609 "modes": ["wt2html", "html2html"]
21610 }
21611 !! wikitext
21612 <gallery>
21613 File:Nonexistent.jpg
21614 Nonexistent.jpg
21615 image:foobar.jpg
21616 foobar.jpg
21617 </gallery>
21618 !! html/php
21619 <ul class="gallery mw-gallery-traditional">
21620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21621 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21622 <div class="gallerytext">
21623 </div>
21624 </div></li>
21625 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21626 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21627 <div class="gallerytext">
21628 </div>
21629 </div></li>
21630 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21631 <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>
21632 <div class="gallerytext">
21633 </div>
21634 </div></li>
21635 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21636 <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>
21637 <div class="gallerytext">
21638 </div>
21639 </div></li>
21640 </ul>
21641 !! html/parsoid
21642 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21643 <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>
21644 <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>
21645 <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>
21646 <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>
21647 </ul>
21648 !! end
21649
21650 !! test
21651 Gallery override link with wikilink (T36852)
21652 !! wikitext
21653 <gallery>
21654 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21655 </gallery>
21656 !! html/php
21657 <ul class="gallery mw-gallery-traditional">
21658 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21659 <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>
21660 <div class="gallerytext">
21661 </div>
21662 </div></li>
21663 </ul>
21664 !! html/parsoid
21665 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21666 <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>
21667 </ul>
21668 !! end
21669
21670 !! test
21671 Gallery override link with absolute external link (T36852)
21672 !! wikitext
21673 <gallery>
21674 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21675 </gallery>
21676 !! html/php
21677 <ul class="gallery mw-gallery-traditional">
21678 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21679 <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>
21680 <div class="gallerytext">
21681 </div>
21682 </div></li>
21683 </ul>
21684 !! html/parsoid
21685 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21686 <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>
21687 </ul>
21688 !! end
21689
21690 ## Putting the caption at the end here runs into T49646 on the php side
21691 ## so reducing the modes this runs in Parsoid
21692 !! test
21693 Gallery override link with absolute external link with LanguageConverter
21694 !! options
21695 language=zh
21696 parsoid=wt2html,html2html
21697 !! wikitext
21698 <gallery>
21699 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21700 </gallery>
21701 !! html/php
21702 <ul class="gallery mw-gallery-traditional">
21703 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21704 <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>
21705 <div class="gallerytext">
21706 <p>caption
21707 </p>
21708 </div>
21709 </div></li>
21710 </ul>
21711 !! html/parsoid
21712 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21713 <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>
21714 </ul>
21715 !! end
21716
21717 !! test
21718 Gallery override link with malicious javascript (T36852)
21719 !! options
21720 parsoid={
21721 "modes": ["wt2html", "html2html"]
21722 }
21723 !! wikitext
21724 <gallery>
21725 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21726 </gallery>
21727 !! html/php
21728 <ul class="gallery mw-gallery-traditional">
21729 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21730 <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>
21731 <div class="gallerytext">
21732 </div>
21733 </div></li>
21734 </ul>
21735 !! html/parsoid
21736 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21737 <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>
21738 </ul>
21739 !! end
21740
21741 !! test
21742 Gallery with invalid title as link (T45964)
21743 !! options
21744 parsoid={
21745 "modes": ["wt2html", "html2html"]
21746 }
21747 !! wikitext
21748 <gallery>
21749 File:Foobar.jpg|link=<
21750 </gallery>
21751 !! html/php
21752 <ul class="gallery mw-gallery-traditional">
21753 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21754 <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>
21755 <div class="gallerytext">
21756 </div>
21757 </div></li>
21758 </ul>
21759 !! html/parsoid
21760 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21761 <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>
21762 </ul>
21763 !! end
21764
21765 !! test
21766 Serialize gallery without attrs in data-mw
21767 !! options
21768 parsoid={
21769 "modes": ["html2wt"]
21770 }
21771 !! html/parsoid
21772 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21773 <li class="gallerycaption">123</li>
21774 <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>
21775 </ul>
21776 !! wikitext
21777 <gallery caption="123">
21778 File:Test.png
21779 </gallery>
21780 !! end
21781
21782 !! test
21783 Gallery with class and style attributes
21784 !! wikitext
21785 <gallery class="center" style="text-align: center;">
21786 File:Foobar.jpg
21787 </gallery>
21788 !! html/php
21789 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21790 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21791 <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>
21792 <div class="gallerytext">
21793 </div>
21794 </div></li>
21795 </ul>
21796 !! html/parsoid
21797 <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":{}}'>
21798 <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>
21799 </ul>
21800 !! end
21801
21802 !! test
21803 Gallery in slideshow mode
21804 !! wikitext
21805 <gallery mode="slideshow" showthumbnails="">
21806 File:Foobar.jpg
21807 </gallery>
21808 !! html/php
21809 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21810 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21811 <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>
21812 <div class="gallerytext">
21813 </div>
21814 </div></li>
21815 </ul>
21816 !! html/parsoid
21817 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21818 <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>
21819 </ul>
21820 !! end
21821
21822 !! test
21823 Gallery in packed mode
21824 !! wikitext
21825 <gallery mode="packed">
21826 File:Foobar.jpg
21827 </gallery>
21828 !! html/php
21829 <ul class="gallery mw-gallery-packed">
21830 <li class="gallerybox" style="width: 1061.3333333333px"><div style="width: 1061.3333333333px">
21831 <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>
21832 <div class="gallerytext">
21833 </div>
21834 </div></li>
21835 </ul>
21836 !! html/parsoid
21837 <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":{}}'>
21838 <li class="gallerybox" style="width: 1061px;"><div class="thumb" style="width: 1059px;"><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="1059"/></a></figure-inline></div><div class="gallerytext"></div></li>
21839 </ul>
21840 !! end
21841
21842 !! test
21843 Serialize gallery image captions on a line
21844 !! options
21845 parsoid={
21846 "modes": ["html2wt"]
21847 }
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;"><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>
21851 <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>
21852 </ul>
21853 !! wikitext
21854 <gallery>
21855 File:Foobar.jpg| hi ho
21856 File:Foobar.jpg|hi<br />ho
21857 </gallery>
21858 !! end
21859
21860 !! test
21861 HTML Hex character encoding (spells the word "JavaScript")
21862 !! options
21863 parsoid=wt2html,wt2wt,html2html
21864 !! wikitext
21865 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21866 !! html/php
21867 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21868 </p>
21869 !! html/parsoid
21870 <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>
21871 !! end
21872
21873 !! test
21874 HTML Hex character encoding bogus encoding (T28437 regression check)
21875 !! wikitext
21876 &#xsee;&#XSEE;
21877 !! html
21878 <p>&amp;#xsee;&amp;#XSEE;
21879 </p>
21880 !! end
21881
21882 !! test
21883 HTML Hex character encoding mixed case
21884 !! options
21885 parsoid=wt2html,wt2wt,html2html
21886 !! wikitext
21887 &#xEE;&#Xee;
21888 !! html/php
21889 <p>&#xee;&#xee;
21890 </p>
21891 !! html/parsoid
21892 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21893 !! end
21894
21895 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21896 # Note that U+000C (form feed) is not a valid XML character, so
21897 # it is banned even though allowed in HTML5.
21898 !! test
21899 Illegal character references (T106578)
21900 !! wikitext
21901 ; Null: &#00;
21902 ; FF: &#xC;
21903 ; CR: &#xD;
21904 ; Control (low): &#8;
21905 ; Control (high): &#x7F; &#x9F;
21906 ; Surrogate: &#xD83D;&#xDCA9;
21907 ; This is an okay astral character: &#x1F4A9;
21908 !! html+tidy
21909 <dl><dt>Null</dt>
21910 <dd>&amp;#00;</dd>
21911 <dt>FF</dt>
21912 <dd>&amp;#xC;</dd>
21913 <dt>CR</dt>
21914 <dd>&amp;#xD;</dd>
21915 <dt>Control (low)</dt>
21916 <dd>&amp;#8;</dd>
21917 <dt>Control (high)</dt>
21918 <dd>&amp;#x7F; &amp;#x9F;</dd>
21919 <dt>Surrogate</dt>
21920 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21921 <dt>This is an okay astral character</dt>
21922 <dd>&#x1f4a9;</dd></dl>
21923 !! end
21924
21925 !! test
21926 __FORCETOC__ override
21927 !! wikitext
21928 __NEWSECTIONLINK__
21929 __FORCETOC__
21930 !! html/php
21931 <p><br />
21932 </p>
21933 !! end
21934
21935 !! test
21936 ISBN code coverage
21937 !! wikitext
21938 ISBN 978-0-1234-56&#x20;789
21939 !! html/php
21940 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21941 </p>
21942 !! html/parsoid
21943 <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>
21944 !! end
21945
21946 !! test
21947 ISBN followed by 5 spaces
21948 !! wikitext
21949 ISBN
21950 !! html
21951 <p>ISBN
21952 </p>
21953 !! end
21954
21955 !! test
21956 Double ISBN
21957 !! wikitext
21958 ISBN ISBN 1234567890
21959 !! html/php
21960 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21961 </p>
21962 !! html/parsoid
21963 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21964 !! end
21965
21966 # Uppercase X and lowercase x as well
21967 !! test
21968 ISBN with an X
21969 !! wikitext
21970 ISBN 3-462-04561-X
21971 ISBN 3-462-04561-x
21972 ISBN 080442957X
21973 ISBN 080442957x
21974 ISBN 978080442957X
21975 ISBN 978080442957x
21976 !! html/php
21977 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21978 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21979 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21980 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21981 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21982 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21983 </p>
21984 !! html/parsoid
21985 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21986 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21987 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21988 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21989 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21990 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21991 !! end
21992
21993 !! test
21994 ISBN with empty prefix (parsoid test)
21995 !! wikitext
21996 ISBN 1234567890
21997 !! html/php
21998 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21999 </p>
22000 !! html/parsoid
22001 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
22002 !! end
22003
22004 !! test
22005 T24905: <abbr> followed by ISBN followed by </a>
22006 !! wikitext
22007 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
22008 !! html/php
22009 <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>
22010 </p>
22011 !! html/parsoid
22012 <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" class="external text" href="http://www.example.com">example.com</a></p>
22013 !! end
22014
22015 !! test
22016 Double RFC
22017 !! wikitext
22018 RFC RFC 1234
22019 !! html/php
22020 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
22021 </p>
22022 !! html/parsoid
22023 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
22024 !! end
22025
22026 !! test
22027 Double RFC with a wiki link
22028 !! wikitext
22029 RFC [[RFC 1234]]
22030 !! html/php
22031 <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>
22032 </p>
22033 !! html/parsoid
22034 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
22035 !! end
22036
22037 !! test
22038 RFC code coverage
22039 !! wikitext
22040 RFC 983&#x20;987
22041 !! html/php
22042 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
22043 </p>
22044 !! html/parsoid
22045 <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>
22046 !! end
22047
22048 !! test
22049 Centre-aligned image
22050 !! wikitext
22051 [[Image:foobar.jpg|centre]]
22052 !! html/php
22053 <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>
22054 !! html/parsoid
22055 <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>
22056 !! end
22057
22058 !! test
22059 None-aligned image
22060 !! wikitext
22061 [[Image:foobar.jpg|none]]
22062 !! html/php
22063 <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>
22064 !! html/parsoid
22065 <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>
22066 !! end
22067
22068 !! test
22069 Width + Height sized image (using px) (height is ignored)
22070 !! wikitext
22071 [[Image:foobar.jpg|640x480px]]
22072 !! html/php
22073 <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>
22074 </p>
22075 !! html/parsoid
22076 <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>
22077 !! end
22078
22079 !! test
22080 Width-sized image (using px, no following whitespace)
22081 !! wikitext
22082 [[Image:foobar.jpg|640px]]
22083 !! html/php
22084 <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>
22085 </p>
22086 !! html/parsoid
22087 <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>
22088 !! end
22089
22090 !! test
22091 Width-sized image (using px, with following whitespace - test regression from r39467)
22092 !! wikitext
22093 [[Image:foobar.jpg|640px ]]
22094 !! html/php
22095 <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>
22096 </p>
22097 !! html/parsoid
22098 <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>
22099 !!end
22100
22101 !! test
22102 Width-sized image (using px, with preceding whitespace - test regression from r39467)
22103 !! wikitext
22104 [[Image:foobar.jpg| 640px]]
22105 !! html/php
22106 <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>
22107 </p>
22108 !! html/parsoid
22109 <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>
22110 !! end
22111
22112 ## FIXME: Parsoid mocking should include the page in the url to catch regressions
22113 !! test
22114 Image with page parameter
22115 !! options
22116 djvu
22117 !! wikitext
22118 [[File:LoremIpsum.djvu|page=2]]
22119 !! html/php
22120 <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>
22121 </p>
22122 !! html/parsoid
22123 <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>
22124 !! end
22125
22126 !! test
22127 Another italics / bold test
22128 !! wikitext
22129 ''' ''x'
22130 !! html
22131 <pre>'<i> </i>x'
22132 </pre>
22133 !!end
22134
22135 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22136 !! test
22137 dt/dd/dl test
22138 !! wikitext
22139 :;;;::
22140 !! html/php
22141 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22142 !! html/parsoid
22143 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22144 !! end
22145
22146 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22147 !! test
22148 Images with the "|" character in the comment
22149 !! wikitext
22150 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22151 !! html/php
22152 <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>
22153 !! html/parsoid
22154 <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" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" 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>
22155 !! end
22156
22157 !! test
22158 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22159 !! wikitext
22160 <html><script>alert(1);</script></html>
22161 !! html
22162 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22163 </p>
22164 !! end
22165
22166 !! test
22167 HTML with raw HTML ($wgRawHtml==true)
22168 !! options
22169 wgRawHtml=1
22170 !! wikitext
22171 <html><script>alert(1);</script></html>
22172 !! html/php
22173 <p><script>alert(1);</script>
22174 </p>
22175 !! html/parsoid
22176 <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>
22177 !! end
22178
22179 !! test
22180 Parents of subpages, one level up
22181 !! options
22182 subpage title=[[Subpage test/L1/L2/L3]]
22183 !! wikitext
22184 [[../|L2]]
22185 !! html
22186 <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>
22187 </p>
22188 !! end
22189
22190
22191 !! test
22192 Parents of subpages, one level up, not named
22193 !! options
22194 subpage title=[[Subpage test/L1/L2/L3]]
22195 !! wikitext
22196 [[../]]
22197 !! html
22198 <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>
22199 </p>
22200 !! end
22201
22202
22203
22204 !! test
22205 Parents of subpages, two levels up
22206 !! options
22207 subpage title=[[Subpage test/L1/L2/L3]]
22208 !! wikitext
22209 [[../../|L1]]2
22210
22211 [[../../|L1]]l
22212 !! html
22213 <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
22214 </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>
22215 </p>
22216 !! end
22217
22218 !! test
22219 Parents of subpages, two levels up, without trailing slash or name.
22220 !! options
22221 subpage title=[[Subpage test/L1/L2/L3]]
22222 !! wikitext
22223 [[../..]]
22224 !! html
22225 <p>[[../..]]
22226 </p>
22227 !! end
22228
22229 !! test
22230 Parents of subpages, two levels up, with lots of extra trailing slashes.
22231 !! options
22232 subpage title=[[Subpage test/L1/L2/L3]]
22233 !! wikitext
22234 [[../../////]]
22235 !! html
22236 <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>
22237 </p>
22238 !! end
22239
22240 !! article
22241 Subpage test/L1/L2/L3Sibling
22242 !! text
22243 Sibling article
22244 !! endarticle
22245
22246 !! test
22247 Transclusion of a sibling page (one level up)
22248 !! options
22249 subpage title=[[Subpage test/L1/L2/L3]]
22250 !! wikitext
22251 {{../L3Sibling}}
22252 !! html
22253 <p>Sibling article
22254 </p>
22255 !! end
22256
22257 !! test
22258 Transclusion of a child page
22259 !! options
22260 subpage title=[[Subpage test/L1/L2]]
22261 !! wikitext
22262 {{/L3Sibling}}
22263 !! html
22264 <p>Sibling article
22265 </p>
22266 !! end
22267
22268 # This is wt2html only in Parsoid because we add <nowiki>
22269 # because of {{..}} and we don't expect to fix that to
22270 # eliminate the nowikis selective for {{..}} markup.
22271 !! test
22272 Non-transclusion because of too many up levels
22273 !! options
22274 subpage title=[[Subpage test/L1/L2/L3]]
22275 parsoid=wt2html
22276 !! wikitext
22277 {{../../../../More than parent}}
22278 !! html/php
22279 <p>{{../../../../More than parent}}
22280 </p>
22281 !! html/parsoid
22282 <p>{{../../../../More than parent}}</p>
22283 !! end
22284
22285 !! test
22286 Definition list code coverage
22287 !! wikitext
22288 ;title :def
22289 ;title :def
22290 ;title:def
22291 !! html/php
22292 <dl><dt>title</dt>
22293 <dd>def</dd>
22294 <dt>title</dt>
22295 <dd>def</dd>
22296 <dt>title</dt>
22297 <dd>def</dd></dl>
22298 !! html/parsoid
22299 <dl><dt>title </dt><dd>def</dd>
22300 <dt>title </dt><dd>def</dd>
22301 <dt>title</dt><dd>def</dd></dl>
22302 !! end
22303
22304 !! test
22305 Don't fall for the self-closing div
22306 !! wikitext
22307 <div>hello world</div/>
22308 !! html
22309 <div>hello world</div>
22310 !! end
22311
22312 !! test
22313 MSGNW magic word
22314 !! wikitext
22315 {{MSGNW:msg}}
22316 !! html/php
22317 <p>&#91;&#91;:Template:Msg&#93;&#93;
22318 </p>
22319 !! end
22320
22321 !! test
22322 RAW magic word
22323 !! wikitext
22324 {{RAW:QUERTY}}
22325 !! html
22326 <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>
22327 </p>
22328 !! end
22329
22330 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22331 !! test
22332 Always escape literal '>' in output, not just after '<'
22333 !! wikitext
22334 ><>
22335 !! html
22336 <p>&gt;&lt;&gt;
22337 </p>
22338 !! end
22339
22340 !! test
22341 Template caching
22342 !! wikitext
22343 {{Test}}
22344 {{Test}}
22345 !! html
22346 <p>This is a test template
22347 This is a test template
22348 </p>
22349 !! end
22350
22351
22352 !! article
22353 MediaWiki:Fake
22354 !! text
22355 ==header==
22356 !! endarticle
22357
22358 !! test
22359 Inclusion of !userCanEdit() content
22360 !! wikitext
22361 {{MediaWiki:Fake}}
22362 !! html
22363 <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>
22364 !! end
22365
22366
22367 !! test
22368 Out-of-order TOC heading levels
22369 !! wikitext
22370 ==2==
22371 ======6======
22372 ===3===
22373 =1=
22374 =====5=====
22375 ==2==
22376 !! html
22377 <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>
22378 <ul>
22379 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22380 <ul>
22381 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22382 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22383 </ul>
22384 </li>
22385 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22386 <ul>
22387 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22388 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22389 </ul>
22390 </li>
22391 </ul>
22392 </div>
22393
22394 <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>
22395 <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>
22396 <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>
22397 <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>
22398 <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>
22399 <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>
22400 !! end
22401
22402
22403 !! test
22404 ISBN with a dummy number
22405 !! wikitext
22406 ISBN ---
22407 !! html
22408 <p>ISBN ---
22409 </p>
22410 !! end
22411
22412
22413 !! test
22414 ISBN with space-delimited number
22415 !! wikitext
22416 ISBN 92 9017 032 8
22417 !! html/php
22418 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22419 </p>
22420 !! html/parsoid
22421 <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>
22422 !! end
22423
22424
22425 !! test
22426 ISBN with multiple spaces, no number
22427 !! wikitext
22428 ISBN foo
22429 !! html
22430 <p>ISBN foo
22431 </p>
22432 !! end
22433
22434
22435 !! test
22436 ISBN length
22437 !! wikitext
22438 ISBN 123456789
22439
22440 ISBN 1234567890
22441
22442 ISBN 12345678901
22443 !! html/php
22444 <p>ISBN 123456789
22445 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22446 </p><p>ISBN 12345678901
22447 </p>
22448 !! html/parsoid
22449 <p>ISBN 123456789</p>
22450
22451 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22452
22453 <p>ISBN 12345678901</p>
22454 !! end
22455
22456
22457 !! test
22458 ISBN with trailing year (T9110)
22459 !! wikitext
22460 ISBN 1-234-56789-0 - 2006
22461
22462 ISBN 1 234 56789 0 - 2006
22463 !! html/php
22464 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22465 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22466 </p>
22467 !! html/parsoid
22468 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22469
22470 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22471 !! end
22472
22473
22474 !! test
22475 anchorencode
22476 !! config
22477 wgFragmentMode=[ 'html5', 'legacy' ]
22478 !! wikitext
22479 {{anchorencode:foo bar©#%n}}
22480 !! html/php
22481 <p>foo_bar©#%n
22482 </p>
22483 !! html/parsoid
22484 <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>
22485 !! end
22486
22487 !! test
22488 anchorencode (legacy)
22489 !! config
22490 wgFragmentMode=[ 'legacy' ]
22491 !! wikitext
22492 {{anchorencode:foo bar©#%n}}
22493 !! html/php
22494 <p>foo_bar.C2.A9.23.25n
22495 </p>
22496 !! end
22497
22498 !! test
22499 anchorencode trims spaces
22500 !! config
22501 wgFragmentMode=[ 'html5', 'legacy' ]
22502 !! wikitext
22503 {{anchorencode: __pretty__please__}}
22504 !! html/php
22505 <p>pretty_please
22506 </p>
22507 !! html/parsoid
22508 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22509 !! end
22510
22511 !! test
22512 anchorencode deals with links
22513 !! config
22514 wgFragmentMode=[ 'html5', 'legacy' ]
22515 !! wikitext
22516 {{anchorencode: [[hello|world]] [[hi]]}}
22517 !! html/php
22518 <p>world_hi
22519 </p>
22520 !! html/parsoid
22521 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22522 !! end
22523
22524 !! test
22525 anchorencode deals with templates
22526 !! config
22527 wgFragmentMode=[ 'html5', 'legacy' ]
22528 !! wikitext
22529 {{anchorencode: {{Foo}} x}}
22530 !! html/php
22531 <p>FOO_x
22532 </p>
22533 !! html/parsoid
22534 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22535 !! end
22536
22537 !! test
22538 anchorencode encodes like the TOC generator: (T20431)
22539 !! config
22540 wgFragmentMode=[ 'html5', 'legacy' ]
22541 !! wikitext
22542 ===_ +:.3A%3A _ &&amp;]] x===
22543 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22544 __NOEDITSECTION__
22545 !! html/php
22546 <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>
22547 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22548 </p>
22549 !! html/parsoid
22550 <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>
22551 <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>
22552 <meta property="mw:PageProp/noeditsection"/>
22553 !! end
22554
22555 !! test
22556 anchorencode encodes like the TOC generator: (T20431) (legacy)
22557 !! config
22558 wgFragmentMode=[ 'legacy' ]
22559 !! wikitext
22560 ===_ +:.3A%3A&&amp;]]===
22561 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22562 __NOEDITSECTION__
22563 !! html/php
22564 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22565 <p>.2B:.3A.253A.26.26.5D.5D
22566 </p>
22567 !! end
22568
22569 !! test
22570 T8200: blockquotes and paragraph formatting
22571 !! wikitext
22572 <blockquote>
22573 foo
22574 </blockquote>
22575
22576 bar
22577
22578 baz
22579 !! html
22580 <blockquote>
22581 <p>foo
22582 </p>
22583 </blockquote>
22584 <p>bar
22585 </p>
22586 <pre>baz
22587 </pre>
22588 !! end
22589
22590 !! test
22591 T10293: Use of center tag ruins paragraph formatting
22592 !! wikitext
22593 <center>
22594 foo
22595 </center>
22596
22597 bar
22598
22599 baz
22600 !! html
22601 <center>
22602 <p>foo
22603 </p>
22604 </center>
22605 <p>bar
22606 </p>
22607 <pre>baz
22608 </pre>
22609 !! end
22610
22611 !!test
22612 Parsing of overlapping (improperly nested) inline html tags
22613 !! wikitext
22614 <span><s>x</span></s>
22615 !! html/php
22616 <p><span><s>x&lt;/span&gt;</s></span>
22617 </p>
22618 !! html/parsoid
22619 <p><span><s>x</s></span>
22620 </p>
22621 !!end
22622
22623 ###
22624 ### Language variants related tests
22625 ###
22626
22627 # Parsoid does not mark self-links.
22628 # Parsoid does not convert links; PHP will do any necessary redirects.
22629
22630 !! test
22631 Self-link in language variants
22632 !! options
22633 title=[[Dunav]] language=sr
22634 !! wikitext
22635 Both [[Dunav]] and [[Дунав]] are names for this river.
22636 !! html/php
22637 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22638 </p>
22639 !! html/parsoid
22640 <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>
22641 !! end
22642
22643 !! article
22644 Дуна
22645 !! text
22646 content
22647 !! endarticle
22648
22649 !! test
22650 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22651 !! options
22652 title=[[Duna]] language=sr
22653 !! wikitext
22654 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22655 !! html/php
22656 <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.
22657 </p>
22658 !! html/parsoid
22659 <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>
22660 !! end
22661
22662 !! test
22663 Link to a section of a variant of this title shouldn't be parsed as self-link
22664 !! options
22665 title=[[Duna]] language=sr
22666 !! wikitext
22667 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22668 !! html/php
22669 <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.
22670 </p>
22671 !! html/parsoid
22672 <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>
22673 !! end
22674
22675 !! test
22676 Link to pages in language variants
22677 !! options
22678 language=sr
22679 !! wikitext
22680 Main Page can be written as [[Маин Паге]]
22681 !! html/php
22682 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22683 </p>
22684 !! html/parsoid
22685 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22686 !! end
22687
22688
22689 !! test
22690 Multiple links to pages in language variants
22691 !! options
22692 language=sr
22693 !! wikitext
22694 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22695 !! html/php
22696 <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>.
22697 </p>
22698 !! html/parsoid
22699 <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>
22700 !! end
22701
22702
22703 !! test
22704 Simple template in language variants
22705 !! options
22706 language=sr
22707 !! wikitext
22708 {{тест}}
22709 !! html/php
22710 <p>This is a test template
22711 </p>
22712 !! end
22713
22714
22715 !! test
22716 Template with explicit namespace in language variants
22717 !! options
22718 language=sr
22719 !! wikitext
22720 {{Template:тест}}
22721 !! html/php
22722 <p>This is a test template
22723 </p>
22724 !! end
22725
22726
22727 !! test
22728 Basic test for template parameter in language variants
22729 !! options
22730 language=sr
22731 !! wikitext
22732 {{парамтест|param=foo}}
22733 !! html/php
22734 <p>This is a test template with parameter foo
22735 </p>
22736 !! end
22737
22738 !! test
22739 Simple category in language variants
22740 !! options
22741 language=sr cat
22742 !! wikitext
22743 [[Category:МедиаWики Усер'с Гуиде]]
22744 !! html/php
22745 cat=МедиаWики_Усер'с_Гуиде sort=
22746 !! html/parsoid
22747 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22748 !! end
22749
22750 !! article
22751 Category:分类
22752 !! text
22753 blah
22754 !! endarticle
22755
22756 !! article
22757 Category:分類
22758 !! text
22759 blah
22760 !! endarticle
22761
22762 ## We used to, but no longer wt2wt this test since the default serializer
22763 ## will normalize all categories to serialize on their own line.
22764 ## This wikitext usage is going to be fairly uncommon in production and
22765 ## selser will take care of preserving formatting in those scenarios.
22766 !! test
22767 Don't convert blue categorylinks to another variant (T35210)
22768 !! options
22769 cat
22770 language=zh
22771 parsoid=wt2html
22772 !! wikitext
22773 [[A]][[Category:分类]]
22774 !! html/php
22775 cat=分类 sort=
22776 !! html/parsoid
22777 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22778 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22779 !! end
22780
22781 !! test
22782 Stripping -{}- tags (language variants)
22783 !! options
22784 language=sr
22785 !! wikitext
22786 Latin proverb: -{Ne nuntium necare}-
22787 !! html/php
22788 <p>Latin proverb: Ne nuntium necare
22789 </p>
22790 !! html/parsoid
22791 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22792 !! end
22793
22794
22795 !! test
22796 Prevent conversion with -{}- tags (language variants)
22797 !! options
22798 language=sr variant=sr-ec
22799 !! wikitext
22800 Latinski: -{Ne nuntium necare}-
22801 !! html/php
22802 <p>Латински: Ne nuntium necare
22803 </p>
22804 !! html/parsoid
22805 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22806 !! end
22807
22808
22809 !! test
22810 Prevent conversion of text with -{}- tags (language variants)
22811 !! options
22812 language=sr variant=sr-ec
22813 !! wikitext
22814 Latinski: -{Ne nuntium necare}-
22815 !! html/php
22816 <p>Латински: Ne nuntium necare
22817 </p>
22818 !! html/parsoid
22819 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22820 !! end
22821
22822
22823 !! test
22824 Prevent conversion of links with -{}- tags (language variants)
22825 !! options
22826 language=sr variant=sr-ec
22827 !! wikitext
22828 -{[[Main Page]]}-
22829 !! html/php
22830 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22831 </p>
22832 !! html/parsoid
22833 <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>
22834 !! end
22835
22836
22837 !! test
22838 -{}- tags within headlines (within html for parserConvert())
22839 !! config
22840 wgFragmentMode=[ 'html5', 'legacy' ]
22841 !! options
22842 language=sr variant=sr-ec
22843 !! wikitext
22844 ==-{Naslov}-==
22845
22846 Note that even an unprotected headline ID is not affected by language
22847 conversion:
22848
22849 ==Latinski==
22850 !! html/php
22851 <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>
22852 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22853 цонверсион:
22854 </p>
22855 <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>
22856 !! html/parsoid
22857 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22858
22859 <p>Note that even an unprotected headline ID is not affected by language
22860 conversion:</p>
22861
22862 <h2 id="Latinski">Latinski</h2>
22863 !! end
22864
22865 !! test
22866 Explicit definition of language variant alternatives
22867 !! options
22868 language=zh variant=zh-tw
22869 !! wikitext
22870 -{zh:China;zh-tw:Taiwan}-, not China
22871 !! html/php
22872 <p>Taiwan, not China
22873 </p>
22874 !! html/parsoid
22875 <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>
22876 !! end
22877
22878 !! test
22879 Explicit definition of language variant alternatives (BCP 47 codes)
22880 !! options
22881 language=zh variant=zh-tw
22882 !! wikitext
22883 -{zh:China;zh-Hant-TW:Taiwan}-, not China
22884 !! html/php
22885 <p>Taiwan, not China
22886 </p>
22887 !! html/parsoid
22888 <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>
22889 !! end
22890
22891 !! test
22892 Filter syntax for language variants
22893 !! options
22894 language=zh variant=zh-tw
22895 !! wikitext
22896 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22897 !! html/php
22898 <p>fooblog, WEBJOURNAL, WEBLOGquux
22899 </p>
22900 !! html/parsoid
22901 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22902 !! end
22903
22904 # Note that Parsoid post-processing for language variants needs to
22905 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22906 !! test
22907 Conversion around HTML tags
22908 !! options
22909 language=sr variant=sr-ec
22910 !! wikitext
22911 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22912 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22913 !! html/php
22914 <p>
22915 <span title="ЛаCтин">ски</span>
22916 </p>
22917 !! html/parsoid
22918 <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"}]}'/>
22919 <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>
22920 !! end
22921
22922 !! test
22923 Explicit session-wise two-way language variant mapping (A flag and - flag)
22924 !! options
22925 language=zh variant=zh-tw
22926 !! wikitext
22927 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22928
22929 Taiwan is not China.
22930
22931 But -{A|zh:China; zh-tw:Taiwan}- is China,
22932
22933 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22934
22935 and -{China}- is China.
22936 !! html/php
22937 <p>This is Taiwan, but we'll forget that now.
22938 </p><p>Taiwan is not China.
22939 </p><p>But Taiwan is Taiwan,
22940 </p><p>(This should be stripped!)
22941 </p><p>and China is China.
22942 </p>
22943 !! html/parsoid
22944 <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>
22945 <p>Taiwan is not China.</p>
22946 <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>
22947 <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>
22948 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22949 !! end
22950
22951 !! test
22952 Explicit session-wise one-way language variant mapping (A flag and - flag)
22953 !! options
22954 language=zh variant=zh-tw
22955 !! wikitext
22956 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22957
22958 COUNTRY is China or Taiwan.
22959
22960 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22961
22962 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22963
22964 and -{COUNTRY}- is COUNTRY.
22965 !! html/php
22966 <p>This is Taiwan, but we'll forget that now.
22967 </p><p>COUNTRY is China or Taiwan.
22968 </p><p>But Taiwan is Taiwan,
22969 </p><p>(This should be stripped!)
22970 </p><p>and COUNTRY is COUNTRY.
22971 </p>
22972 !! html/parsoid
22973 <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>
22974 <p>COUNTRY is China or Taiwan.</p>
22975 <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>
22976 <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>
22977 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22978 !! end
22979
22980 !! test
22981 Explicit session-wise two-way language variant mapping (H flag for hide)
22982 !! options
22983 language=zh variant=zh-tw
22984 !! wikitext
22985 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22986
22987 Taiwan is China.
22988 !! html/php
22989 <p>(This should be stripped!)
22990 </p><p>Taiwan is Taiwan.
22991 </p>
22992 !! html/parsoid
22993 <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>
22994 <p>Taiwan is China.</p>
22995 !! end
22996
22997 !! test
22998 Explicit session-wise one-way language variant mapping (H flag for hide)
22999 !! options
23000 language=zh variant=zh-tw
23001 !! wikitext
23002 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
23003
23004 COUNTRY is Taiwan or China.
23005 !! html/php
23006 <p>(This should be stripped!)
23007 </p><p>Taiwan is Taiwan or China.
23008 </p>
23009 !! html/parsoid
23010 <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>
23011 <p>COUNTRY is Taiwan or China.</p>
23012 !! end
23013
23014 ## Note that parsoid test runner does not support 'showtitle' option.
23015 !! test
23016 Adding explicit conversion rule for title (T flag)
23017 !! options
23018 language=zh variant=zh-tw showtitle
23019 !! wikitext
23020 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
23021
23022 Taiwan is China.
23023 !! html/php
23024 Taiwan
23025 <p>Should be stripped!
23026 </p><p>Taiwan is China.
23027 </p>
23028 !! html/parsoid
23029 <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>
23030 <p>Taiwan is China.</p>
23031 !! end
23032
23033 !! test
23034 Code coverage: T combined with H flag
23035 !! options
23036 language=zh variant=zh-tw showtitle
23037 !! wikitext
23038 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
23039
23040 Taiwan is China.
23041 !! html/php
23042 Taiwan
23043 <p>Should be stripped!
23044 </p><p>Taiwan is Taiwan.
23045 </p>
23046 !! html/parsoid
23047 <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>
23048 <p>Taiwan is China.</p>
23049 !! end
23050
23051 !! test
23052 Code coverage: T with no variants
23053 !! options
23054 language=zh variant=zh-tw showtitle
23055 !! wikitext
23056 -{H|zh:China; zh-tw:Taiwan}-
23057 Taiwan is China.-{T|Taiwan is China}-
23058 !! html/php
23059 Taiwan is China
23060 <p>
23061 Taiwan is Taiwan.
23062 </p>
23063 !! html/parsoid
23064 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23065 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
23066 !! end
23067
23068 !! test
23069 Code coverage: rules with no variants
23070 !! options
23071 language=zh variant=zh-tw
23072 !! wikitext
23073 -{H|zh:China; zh-tw:Taiwan}-
23074 Taiwan is China.
23075 -{H|China}-
23076 Taiwan is China.
23077 !! html/php
23078 <p>
23079 Taiwan is Taiwan.
23080
23081 Taiwan is China.
23082 </p>
23083 !! html/parsoid
23084 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23085 Taiwan is China.
23086 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23087 Taiwan is China.</p>
23088 !! end
23089
23090
23091 !! test
23092 Code coverage: D flag for conversion rule
23093 !! options
23094 language=zh variant=zh-tw
23095 !! wikitext
23096 -{D|zh-cn:XA; zh-tw:YA}-
23097 -{A;D|zh-cn:XB; zh-tw:YB}-
23098 -{D;H|zh-cn:XC; zh-tw:YC}-
23099
23100 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23101
23102 -{D|0=>zh-tw:1}-
23103 -{A;D|2=>zh-tw:3}-
23104 -{D;H|4=>zh-tw:5}-
23105
23106 XA XB XC YA YB YC FOO BAR BAT 012345
23107 !! html/php
23108 <p>大陆:XA;台灣:YA;
23109
23110 大陆:XC;台灣:YC;
23111 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23112 </p><p>0⇒台灣:1;
23113
23114 4⇒台灣:5;
23115 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23116 </p>
23117 !! html/parsoid
23118 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23119 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23120 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23121 <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>
23122 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23123 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23124 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23125 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23126 !! end
23127
23128 !! test
23129 Code coverage: N flag for conversion rule
23130 !! options
23131 language=zh variant=zh-cn
23132 !! wikitext
23133 -{N|zh-cn}-
23134
23135 -{N|zh-tw}-
23136
23137 -{N|sr-ec}-
23138 !! html/php
23139 <p>大陆
23140 </p><p>台灣
23141 </p><p>српски (ћирилица)‎
23142 </p>
23143 !! html/parsoid
23144 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23145 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23146 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23147 !! end
23148
23149 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23150 !! test
23151 Code coverage: N flag for conversion rule (wt2html only)
23152 !! options
23153 language=zh variant=zh-cn
23154 parsoid=wt2html,html2html
23155 !! wikitext
23156 -{D;N|en}-
23157 !! html/php
23158 <p>English
23159 </p>
23160 !! html/parsoid
23161 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23162 !! end
23163
23164 !! test
23165 Testing that changing the language variant here in the tests actually works
23166 !! options
23167 language=zh variant=zh showtitle
23168 !! wikitext
23169 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23170 !! html/php
23171 China
23172 <p>Should be stripped!
23173 </p>
23174 !! html/parsoid
23175 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23176 !! end
23177
23178 !! test
23179 Recursive conversion of alt and title attrs shouldn't clear converter state
23180 !! options
23181 language=zh variant=zh-cn
23182 showtitle
23183 !! wikitext
23184 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23185 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23186 !! html/php
23187 China
23188 <p>
23189 Should be stripped<span title="Exclamation">!</span>
23190 </p>
23191 !! html/parsoid
23192 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23193 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>
23194 !! end
23195
23196 !! test
23197 T26072: more test on conversion rule for title
23198 !! options
23199 language=zh variant=zh-tw showtitle
23200 !! wikitext
23201 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23202
23203 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23204 !! html/php
23205 Taiwan
23206 <p>This should be stripped!
23207 </p><p>This won't take interferes with the title rule.
23208 </p>
23209 !! html/parsoid
23210 <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>
23211 <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>
23212 !! end
23213
23214 !! test
23215 Partly disable title conversion if variant == main language code
23216 !! options
23217 language=zh variant=zh title=[[ZH]] showtitle
23218 !! wikitext
23219 -{T|zh-cn:CN;zh-tw:TW}-
23220 !! html/php
23221 ZH
23222 <p>
23223 </p>
23224 !! html/parsoid
23225 <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>
23226 !! end
23227
23228 !! test
23229 Partly disable title conversion if variant == main language code, more
23230 !! options
23231 language=zh variant=zh title=[[ZH]] showtitle
23232 !! wikitext
23233 -{T|TW}-
23234 !! html/php
23235 ZH
23236 <p>
23237 </p>
23238 !! html/parsoid
23239 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23240 !! end
23241
23242 !! test
23243 Raw output of variant escape tags (R flag)
23244 !! options
23245 language=zh variant=zh-tw
23246 !! wikitext
23247 Raw: -{R|zh:China;zh-tw:Taiwan}-
23248 !! html/php
23249 <p>Raw: zh:China;zh-tw:Taiwan
23250 </p>
23251 !! html/parsoid
23252 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23253 !! end
23254
23255 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23256 !! test
23257 Raw output of variant escape tags (R flag) (wt2html only)
23258 !! options
23259 language=zh variant=zh-tw
23260 parsoid=wt2html,html2html
23261 !! wikitext
23262 -{Variant}- -{D|syntax}- -{D;R|options}-
23263 !! html/php
23264 <p>Variant syntax options
23265 </p>
23266 !! html/parsoid
23267 <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>
23268 !! end
23269
23270 !! test
23271 Nested markup inside raw output of variant escape tags (R flag)
23272 !! options
23273 language=zh variant=zh-tw
23274 !! wikitext
23275 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23276 !! html/php
23277 <p>Nested raw: nested Taiwan nested
23278 </p>
23279 !! html/parsoid
23280 <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>
23281 !! end
23282
23283 !! test
23284 Nested markup and spaces inside raw output of variant escape tags (R flag)
23285 !! options
23286 language=zh variant=zh-tw
23287 !! wikitext
23288 X-{ outer -{ inner }- outer }-X
23289 !! html/php
23290 <p>X outer inner outer X
23291 </p>
23292 !! html/parsoid
23293 <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>
23294 !! end
23295
23296 !! test
23297 Templates inside raw output of variant escape tags (R flag)
23298 !! options
23299 language=zh variant=zh-tw
23300 !! wikitext
23301 Nested raw: -{R|nested {{echo|hi}} templates}-
23302 !! html/php
23303 <p>Nested raw: nested hi templates
23304 </p>
23305 !! html/parsoid
23306 <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>
23307 !! end
23308
23309 !! test
23310 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23311 !! options
23312 language=zh variant=zh-cn
23313 !! wikitext
23314 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23315 !! html/php
23316 <p>0
23317 </p>
23318 !! html/parsoid
23319 <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>
23320 !! end
23321
23322 !! test
23323 Conversion rules from [numeric-only string] to [something else] (T48634)
23324 !! options
23325 language=zh variant=zh-cn
23326 !! wikitext
23327 -{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
23328 !! html/php
23329 <p>D12345EE12345
23330 </p>
23331 !! html/parsoid
23332 <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>
23333 !! end
23334
23335 !! test
23336 Two-way converter rule entries with an empty value should be ignored (T53551)
23337 !! options
23338 language=zh variant=zh-cn
23339 !! wikitext
23340 -{H|zh-cn:foo;zh-tw:;}-foobar
23341 !! html/php
23342 <p>foobar
23343 </p>
23344 !! html/parsoid
23345 <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>
23346 !! end
23347
23348 !! test
23349 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23350 !! options
23351 language=zh variant=zh-cn
23352 !! wikitext
23353 -{H|=>zh-cn:foo;}-foobar
23354 !! html/php
23355 <p>foobar
23356 </p>
23357 !! html/parsoid
23358 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23359 !! end
23360
23361 !! test
23362 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23363 !! options
23364 language=zh variant=zh-cn
23365 !! wikitext
23366 -{H|}-foobar
23367 !! html/php
23368 <p>foobar
23369 </p>
23370 !! html/parsoid
23371 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23372 !! end
23373
23374 !! test
23375 Nested using of manual convert syntax
23376 !! options
23377 language=zh variant=zh-hk
23378 !! wikitext
23379 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23380 !! html/php
23381 <p>Nested: Hello Hong Kong!
23382 </p>
23383 !! html/parsoid
23384 <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,null,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,null,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,null,2]}&amp;apos;>&amp;lt;/span>ong\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&apos;>&lt;/span>"}]}'></span>!</p>
23385 !! end
23386
23387 !! test
23388 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23389 !! options
23390 language=zh variant=zh-cn
23391 !! wikitext
23392 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23393 !! html/php
23394 <p><span title="X">A</span>
23395 </p>
23396 !! html/parsoid
23397 <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,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
23398 !! end
23399
23400 !! test
23401 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23402 !! options
23403 language=zh variant=zh-cn
23404 !! wikitext
23405 -{<span title="-{X}-">A</span>}-
23406 !! html/php+disabled
23407 <p><span title="X">A</span>
23408 </p>
23409 !! html/parsoid
23410 <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,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
23411 !! end
23412
23413 # Parsoid and PHP disagree on how to parse this example: Parsoid
23414 # insists that the content of a language converter element be a valid
23415 # DOM fragment or attribute string
23416 !! test
23417 Language converter markup with block content
23418 !! options
23419 language=zh variant=zh-cn
23420 !! wikitext
23421 <span>a-{b<div>c}-d
23422
23423 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23424
23425 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23426 !! html/php+tidy
23427 <span>ab<div>cd
23428 <span>ab<div>cd
23429 <span>ad</span></div></span></div></span>
23430 !! html/parsoid
23431 <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
23432
23433 <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
23434
23435 <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>
23436 !! end
23437
23438 !! test
23439 LanguageConverter selser (1)
23440 !! options
23441 language=zh variant=zh-cn
23442 parsoid={
23443 "modes": ["wt2wt", "selser"],
23444 "changes": [
23445 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23446 ]
23447 }
23448 !! wikitext
23449 -{raw}-
23450 !! wikitext/edited
23451 -{edited}-
23452 !! end
23453
23454 !! test
23455 LanguageConverter selser (2)
23456 !! options
23457 language=zh variant=zh-cn
23458 parsoid={
23459 "modes": ["wt2wt", "selser"],
23460 "changes": [
23461 ["span[class='x']", "contents", "text", "-{foo}-"],
23462 ["a", "contents", "text", "-{"],
23463 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23464 ]
23465 }
23466 !! wikitext
23467 <span class="x">TEXT1</span>
23468 [http://example.com TEXT2]
23469 [[Foo|TEXT3]]
23470 {{echo|TEXT4}}
23471 !! wikitext/edited
23472 <span class="x"><nowiki>-{foo}-</nowiki></span>
23473 [http://example.com -{]
23474 [[Foo|<nowiki>-{</nowiki>]]
23475 {{1x|<nowiki>-{</nowiki>}}
23476 !! end
23477
23478 # Tests LanguageVariantText in ConstrainedText
23479 !! test
23480 LanguageConverter selser (3)
23481 !! options
23482 language=zh variant=zh-cn
23483 parsoid={
23484 "modes": ["wt2wt", "selser"],
23485 "changes": [
23486 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23487 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23488 ]
23489 }
23490 !! wikitext
23491 {|
23492 |-
23493 |<span>Foo</span>
23494 |}
23495 !! wikitext/edited
23496 {|
23497 |-
23498 |<nowiki/>-{edited}-
23499 |}
23500 !! end
23501
23502 # Tests LanguageVariantText._fromSelSer
23503 !! test
23504 LanguageConverter selser (4)
23505 !! options
23506 language=zh variant=zh-cn
23507 parsoid={
23508 "modes": ["wt2wt", "selser"],
23509 "changes": [
23510 ["td > span.x", "remove"]
23511 ]
23512 }
23513 !! wikitext
23514 {|
23515 |-
23516 |<span class="x">Foo</span>-{Bar}-
23517 ||<span class="x">Foo</span>-{Bar}-
23518 |}
23519 !! wikitext/edited
23520 {|
23521 |-
23522 |<nowiki/>-{Bar}-
23523 ||-{Bar}-
23524 |}
23525 !! end
23526
23527 # Since Parsoid is starting to emit canonical wikitext for links,
23528 # [http://example.com http://example.com] will not RT back to that
23529 # form anymore.
23530 # Parsoid does not language-convert links (it is done in a
23531 # post-processing step)
23532 !! test
23533 Proper conversion of text in external links
23534 !! options
23535 language=sr variant=sr-ec
23536 parsoid=wt2html
23537 !! wikitext
23538 http://www.google.com
23539 gopher://www.google.com
23540 [http://www.google.com http://www.google.com]
23541 [gopher://www.google.com gopher://www.google.com]
23542 [https://www.google.com irc://www.google.com]
23543 [ftp://www.google.com www.google.com/ftp://dir]
23544 [//www.google.com www.google.com]
23545 !! html/php
23546 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23547 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23548 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23549 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23550 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23551 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23552 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23553 </p>
23554 !! html/parsoid
23555 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23556 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23557 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23558 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23559 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23560 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23561 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23562 !! end
23563
23564 !! test
23565 Do not convert roman numbers to language variants
23566 !! options
23567 language=sr variant=sr-ec
23568 !! wikitext
23569 Fridrih IV je car.
23570 !! html/php
23571 <p>Фридрих IV је цар.
23572 </p>
23573 !! html/parsoid
23574 <p>Fridrih IV je car.</p>
23575 !! end
23576
23577 !! test
23578 Unclosed language converter markup "-{"
23579 !! options
23580 language=sr
23581 !! wikitext
23582 -{T|hello
23583 !! html
23584 <p>-{T|hello
23585 </p>
23586 !! end
23587
23588 !! test
23589 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23590 !! options
23591 language=sr
23592 !! wikitext
23593 -{R|=&gt;}-
23594 !! html/php
23595 <p>=&gt;
23596 </p>
23597 !! html/parsoid
23598 <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>
23599 !!end
23600
23601 !! test
23602 Don't break link parsing if language converter markup is in the caption.
23603 !! options
23604 language=sr variant=sr-ec
23605 !! wikitext
23606 [[Main Page|-{R|main page}-]]
23607 !! html/php
23608 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23609 </p>
23610 !! html/parsoid
23611 <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>
23612 !! end
23613
23614 !! test
23615 T146304: Don't break template parsing if language converter markup is in the parameter.
23616 !! options
23617 language=sr variant=sr-ec
23618 !! wikitext
23619 {{echo|-{R|foo}-}}
23620 !! html/php
23621 <p>foo
23622 </p>
23623 !! html/parsoid
23624 <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>
23625 !! end
23626
23627 !! test
23628 T146305: Don't break image parsing if language converter markup is in the caption.
23629 !! options
23630 language=sr
23631 !! wikitext
23632 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23633 !! html/php
23634 <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>
23635 !! html/parsoid
23636 <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>
23637 !! end
23638
23639 !! test
23640 T146305: Don't break image parsing if nested language converter markup is in the caption.
23641 !! options
23642 language=zh variant=zh-cn
23643 !! wikitext
23644 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23645 !! html/php
23646 <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>
23647 !! html/parsoid
23648 <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>
23649 !! end
23650
23651 # XXX html2wt disabled because rich markup in alt is not preserved.
23652 !! test
23653 Don't break gallery if language converter markup is inside.
23654 !! options
23655 language=zh
23656 parsoid=wt2html,html2html
23657 !! wikitext
23658 <gallery>
23659 File:Foobar.jpg|alt=-{R|bat}-|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]
23660 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=-{R|param}-}}
23661 </gallery>
23662 !! html/php
23663 <ul class="gallery mw-gallery-traditional">
23664 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23665 <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>
23666 <div class="gallerytext">
23667 <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>
23668 </p>
23669 </div>
23670 </div></li>
23671 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23672 <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>
23673 <div class="gallerytext">
23674 <p>This is a test template
23675 </p>
23676 </div>
23677 </div></li>
23678 </ul>
23679 !! html/parsoid
23680 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
23681 <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>
23682 <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>
23683 </ul>
23684 !! end
23685
23686 !! test
23687 T153135: Don't break list handling if language converter markup is in the item.
23688 !! options
23689 language=zh variant=zh-cn
23690 !! wikitext
23691 ;-{zh-cn:AAA;zh-tw:BBB}-
23692 ;-{R|foo:bar}-
23693 !! html/php
23694 <dl><dt>AAA</dt>
23695 <dt>foo:bar</dt></dl>
23696 !! html/parsoid
23697 <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>
23698 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23699 </dl>
23700 !! end
23701
23702 // Note that parsoid does not protect colons unless language converter
23703 // markup is properly nested, because it is a backtracking parser.
23704 !! test
23705 T153135: Unclosed markup in definition list (code coverage)
23706 !! options
23707 language=zh variant=zh-cn
23708 !! wikitext
23709 ;<b>foo:bar
23710 ;-{zh-cn:AAA
23711 !! html/php+tidy
23712 <dl><dt><b>foo:bar</b></dt><b>
23713 <dt>-{zh-cn:AAA</dt></b></dl>
23714 !! html/parsoid
23715 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23716 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23717 !! end
23718
23719 !! test
23720 T153135: Nested language converter markup in definition list (code coverage)
23721 !! options
23722 language=zh variant=zh-cn
23723 !! wikitext
23724 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23725 !! html/php
23726 <dl><dt>AAA foo:bar bat:baz</dt>
23727 <dd>def</dd></dl>
23728 !! html/parsoid
23729 <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>
23730 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23731 </dl>
23732 !! end
23733
23734 # html2wt mode disabled due to <nowiki> insertion.
23735 !! test
23736 T153140: Don't break table handling if language converter markup is in the cell.
23737 !! options
23738 language=sr variant=sr-ec
23739 parsoid=wt2html,wt2wt,html2html
23740 !! wikitext
23741 {|
23742 |-
23743 | -{R|B}-
23744 |}
23745 !! html/php
23746 <table>
23747
23748 <tr>
23749 <td>B
23750 </td></tr></table>
23751 !! html/parsoid
23752 <table>
23753 <tbody>
23754 <tr>
23755 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23756 </tr>
23757 </tbody>
23758 </table>
23759 !! end
23760
23761 !! test
23762 Language converter tricky html2wt cases (1)
23763 !! options
23764 language=sr
23765 parsoid=html2wt,wt2wt
23766 !! html/parsoid
23767 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23768 !! wikitext
23769 -{<nowiki>}-</nowiki>}-
23770 !! html/php
23771 <p>&#125;-
23772 </p>
23773 !! end
23774
23775 !! test
23776 Language converter tricky html2wt cases (2)
23777 !! options
23778 language=sr
23779 parsoid=html2wt,wt2wt
23780 !! html/parsoid
23781 <p>-{foo}-</p>
23782 !! wikitext
23783 <nowiki>-{foo}-</nowiki>
23784 !! html/php
23785 <p>-&#123;foo&#125;-
23786 </p>
23787 !! end
23788
23789 !! test
23790 Language converter tricky html2wt cases (3)
23791 !! options
23792 language=sr
23793 parsoid=html2wt,wt2wt
23794 !! html/parsoid
23795 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23796 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23797 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23798 !! wikitext
23799 -{R||}-
23800
23801 -{R|R|raw}-
23802
23803 -{<nowiki>-{foo}-</nowiki>}-
23804 !! html/php
23805 <p>|
23806 </p><p>R|raw
23807 </p><p>-&#123;foo&#125;-
23808 </p>
23809 !! end
23810
23811 !! test
23812 Language converter tricky html2wt cases (4)
23813 !! options
23814 language=sr
23815 parsoid=html2wt,wt2wt
23816 !! html/parsoid
23817 <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>
23818 !! wikitext
23819 -{R|{{echo|hey}}}-
23820 !! html/php
23821 <p>hey
23822 </p>
23823 !! end
23824
23825 # Note that the <nowiki> escaping added by parsoid for source text,
23826 # destination text, and language names only works on the PHP side
23827 # for *destination text*. (HTML entity escaping wouldn't work
23828 # any better.) This is probably a bug, at least for source texts.
23829 # (For language names PHP uses a precise regexp based on the languages
23830 # it currently knows have variants, which is fragile since this set
23831 # can grow/shrink over time.)
23832 !! test
23833 Language converter tricky html2wt cases (5)
23834 !! options
23835 language=zh variant=zh-cn
23836 !! html/parsoid
23837 <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>
23838 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23839 <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>
23840 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23841 <p>a:b=>c xyz</p>
23842 !! wikitext
23843 -{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
23844
23845 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23846
23847 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23848
23849 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23850
23851 a:b=>c xyz
23852 !! html/php+disabled
23853 <p>foobat;xyz=&gt;zh-cn:abc
23854 </p><p>A
23855 </p><p>0;zh-tw:bar
23856 </p><p>abc
23857 </p><p>a:b=&gt;c 0;zh-tw:bar
23858 </p>
23859 !! end
23860
23861 !! test
23862 T179579: Nowiki and lc interaction
23863 !! options
23864 parsoid=wt2html
23865 language=sr
23866 !! wikitext
23867 -{</nowiki>123}-
23868
23869 -{123<nowiki>|</nowiki>456}-
23870 !! html/parsoid
23871 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23872
23873 <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>
23874 !! end
23875
23876 !! test
23877 T2529: Uncovered bullet
23878 !! wikitext
23879 *Foo {{bullet}}
23880 !! html
23881 <ul><li>Foo</li>
23882 <li>Bar</li></ul>
23883 !! end
23884
23885 !! test
23886 T2529: Uncovered bullet in a deeply nested list
23887 !! wikitext
23888 *******Foo {{bullet}}
23889 !! html
23890 <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>
23891 <li>Bar</li></ul>
23892 !! end
23893
23894 !! test
23895 T2529: Uncovered table already at line-start
23896 !! wikitext
23897 x
23898
23899 {{table}}
23900 y
23901 !! html
23902 <p>x
23903 </p>
23904 <table>
23905 <tr>
23906 <td>1</td>
23907 <td>2
23908 </td></tr>
23909 <tr>
23910 <td>3</td>
23911 <td>4
23912 </td></tr></table>
23913 <p>y
23914 </p>
23915 !! end
23916
23917 !! test
23918 T2529: Uncovered bullet in parser function result
23919 !! wikitext
23920 *Foo {{lc:{{bullet}} }}
23921 !! html
23922 <ul><li>Foo</li>
23923 <li>bar</li></ul>
23924 !! end
23925
23926 !! test
23927 T7678: Double-parsed template argument
23928 !! wikitext
23929 {{lc:{{{1}}}|hello}}
23930 !! html
23931 <p>{{{1}}}
23932 </p>
23933 !! end
23934
23935 !! test
23936 T7678: Double-parsed template invocation
23937 !! wikitext
23938 {{lc:{{paramtest {{!}} param = hello }} }}
23939 !! html
23940 <p>{{paramtest | param = hello }}
23941 </p>
23942 !! end
23943
23944 !! test
23945 Case insensitivity of parser functions for non-ASCII characters (T10143)
23946 !! options
23947 language=cs
23948 title=[[Main Page]]
23949 !! wikitext
23950 {{PRVNÍVELKÉ:ěščř}}
23951 {{prvnívelké:ěščř}}
23952 {{PRVNÍMALÉ:ěščř}}
23953 {{prvnímalé:ěščř}}
23954 {{MALÁ:ěščř}}
23955 {{malá:ěščř}}
23956 {{VELKÁ:ěščř}}
23957 {{velká:ěščř}}
23958 !! html
23959 <p>Ěščř
23960 Ěščř
23961 ěščř
23962 ěščř
23963 ěščř
23964 ěščř
23965 ĚŠČŘ
23966 ĚŠČŘ
23967 </p>
23968 !! end
23969
23970 !! test
23971 Morwen/13: Unclosed link followed by heading
23972 !! wikitext
23973 [[link
23974 ==heading==
23975 !! html
23976 <p>[[link
23977 </p>
23978 <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>
23979 !! end
23980
23981 !! test
23982 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23983 !! wikitext
23984 {{foo|
23985 =heading=
23986 !! html
23987 <p>{{foo|
23988 </p>
23989 <h1><span class="mw-headline" id="heading">heading</span></h1>
23990 !! end
23991
23992 !! test
23993 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23994 !! wikitext
23995 {{foo|
23996 ==heading==
23997 !! html
23998 <p>{{foo|
23999 </p>
24000 <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>
24001 !! end
24002
24003 !! test
24004 Tildes in comments
24005 !! options
24006 pst
24007 !! wikitext
24008 <!-- ~~~~ -->
24009 !! html/php
24010 <!-- ~~~~ -->
24011 !! end
24012
24013 !! test
24014 Paragraphs inside divs (no extra line breaks)
24015 !! wikitext
24016 <div>Line one
24017
24018 Line two</div>
24019 !! html
24020 <div>Line one
24021 Line two</div>
24022 !! end
24023
24024 !! test
24025 Paragraphs inside divs (extra line break on open)
24026 !! wikitext
24027 <div>
24028 Line one
24029
24030 Line two</div>
24031 !! html
24032 <div>
24033 <p>Line one
24034 </p>
24035 Line two</div>
24036 !! end
24037
24038 !! test
24039 Paragraphs inside divs (extra line break on close)
24040 !! wikitext
24041 <div>Line one
24042
24043 Line two
24044 </div>
24045 !! html
24046 <div>Line one
24047 <p>Line two
24048 </p>
24049 </div>
24050 !! end
24051
24052 !! test
24053 Paragraphs inside divs (extra line break on open and close)
24054 !! wikitext
24055 <div>
24056 Line one
24057
24058 Line two
24059 </div>
24060 !! html
24061 <div>
24062 <p>Line one
24063 </p><p>Line two
24064 </p>
24065 </div>
24066 !! end
24067
24068 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24069 !! test
24070 Nesting tags, paragraphs on lines which begin with <div>
24071 !! wikitext
24072 <div></div><strong>A
24073 B</strong>
24074 !! html/php+tidy
24075 <div></div><p><strong>A
24076 </strong></p><strong></strong><p><strong>B</strong>
24077 </p>
24078 !! html/parsoid
24079 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24080 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24081 !! end
24082
24083 # T8200: <blockquote> should behave like <div> with respect to line breaks
24084 !! test
24085 T8200: paragraphs inside blockquotes (no extra line breaks)
24086 !! wikitext
24087 <blockquote>Line one
24088
24089 Line two</blockquote>
24090 !! html
24091 <blockquote>Line one
24092 Line two</blockquote>
24093 !! html+tidy
24094 <blockquote><p>Line one
24095 Line two</p></blockquote>
24096 !! end
24097
24098 !! test
24099 T8200: paragraphs inside blockquotes (extra line break on open)
24100 !! wikitext
24101 <blockquote>
24102 Line one
24103
24104 Line two</blockquote>
24105 !! html
24106 <blockquote>
24107 <p>Line one
24108 </p>
24109 Line two</blockquote>
24110 !! html+tidy
24111 <blockquote>
24112 <p>Line one
24113 </p><p>
24114 Line two</p></blockquote>
24115 !! end
24116
24117 !! test
24118 T8200: paragraphs inside blockquotes (extra line break on close)
24119 !! wikitext
24120 <blockquote>Line one
24121
24122 Line two
24123 </blockquote>
24124 !! html
24125 <blockquote>Line one
24126 <p>Line two
24127 </p>
24128 </blockquote>
24129 !! html+tidy
24130 <blockquote><p>Line one
24131 </p><p>Line two
24132 </p>
24133 </blockquote>
24134 !! end
24135
24136 !! test
24137 T8200: paragraphs inside blockquotes (extra line break on open and close)
24138 !! wikitext
24139 <blockquote>
24140 Line one
24141
24142 Line two
24143 </blockquote>
24144 !! html
24145 <blockquote>
24146 <p>Line one
24147 </p><p>Line two
24148 </p>
24149 </blockquote>
24150 !! end
24151
24152 ## This is a corner case interaction between the paragraph wrapping in the
24153 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24154 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24155 ## of which "div" is one, but do p-wrapping inside them. These are referred
24156 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24157 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24158 !! test
24159 Paragraphs inside blockquotes/divs (no extra line breaks)
24160 !! wikitext
24161 <blockquote><div>Line one
24162
24163 Line two</div></blockquote>
24164 !! html
24165 <blockquote><div>Line one
24166 Line two</div></blockquote>
24167 !! end
24168
24169 !! test
24170 Paragraphs inside blockquotes/divs (extra line break on open)
24171 !! wikitext
24172 <blockquote><div>
24173 Line one
24174
24175 Line two</div></blockquote>
24176 !! html
24177 <blockquote><div>
24178 <p>Line one
24179 </p>
24180 Line two</div></blockquote>
24181 !! end
24182
24183 !! test
24184 Paragraphs inside blockquotes/divs (extra line break on close)
24185 !! wikitext
24186 <blockquote><div>Line one
24187
24188 Line two
24189 </div></blockquote>
24190 !! html
24191 <blockquote><div>Line one
24192 <p>Line two
24193 </p>
24194 </div></blockquote>
24195 !! end
24196
24197 !! test
24198 Paragraphs inside blockquotes/divs (extra line break on open and close)
24199 !! wikitext
24200 <blockquote><div>
24201 Line one
24202
24203 Line two
24204 </div></blockquote>
24205 !! html
24206 <blockquote><div>
24207 <p>Line one
24208 </p><p>Line two
24209 </p>
24210 </div></blockquote>
24211 !! end
24212
24213 !! test
24214 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24215 !! options
24216 wgLinkHolderBatchSize=0
24217 !! wikitext
24218 [[meatball:1]]
24219 [[meatball:2]]
24220 [[meatball:3]]
24221 !! html
24222 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24223 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24224 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24225 </p>
24226 !! end
24227
24228 !! test
24229 Free external link invading image caption
24230 !! wikitext
24231 [[Image:Foobar.jpg|thumb|http://x|hello]]
24232 !! html/php
24233 <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>
24234 !! html/parsoid
24235 <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>
24236 !! end
24237
24238 !! test
24239 T17196: localised external link numbers
24240 !! options
24241 language=fa
24242 !! wikitext
24243 [http://en.wikipedia.org/]
24244 !! html/php
24245 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24246 </p>
24247 !! html/parsoid
24248 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24249 !! end
24250
24251 !! test
24252 Multibyte character in padleft
24253 !! wikitext
24254 {{padleft:-Hello|7|Æ}}
24255 !! html/php
24256 <p>Æ-Hello
24257 </p>
24258 !! html/parsoid
24259 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24260 !! end
24261
24262 !! test
24263 Multibyte character in padright
24264 !! wikitext
24265 {{padright:Hello-|7|Æ}}
24266 !! html/php
24267 <p>Hello-Æ
24268 </p>
24269 !! html/parsoid
24270 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24271 !! end
24272
24273 !!test
24274 formatdate parser function
24275 !! wikitext
24276 {{#formatdate:2009-03-24}}
24277 !! html
24278 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24279 </p>
24280 !! end
24281
24282 !!test
24283 formatdate parser function, with default format
24284 !! wikitext
24285 {{#formatdate:2009-03-24|mdy}}
24286 !! html
24287 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24288 </p>
24289 !! end
24290
24291 !! test
24292 Spacing of numbers in formatted dates
24293 !! wikitext
24294 {{#formatdate:January 15}}
24295 !! html
24296 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24297 </p>
24298 !! end
24299
24300 !! test
24301 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
24302 !! options
24303 language=nl title=[[MediaWiki:Common.css]]
24304 !! wikitext
24305 {{#formatdate:2009-03-24|dmy}}
24306 !! html
24307 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24308 </p>
24309 !! end
24310
24311 !! test
24312 formatdate with invalid month
24313 !! wikitext
24314 {{#formatdate:2019-22-22|dmy}}
24315 !! html
24316 <p>2019-22-22
24317 </p>
24318 !! end
24319
24320 !! test
24321 formatdate: dots in month name do not match any char (T220563)
24322 !! options
24323 language=de
24324 !! wikitext
24325 {{#formatdate:jun. 3|dmy}}
24326 {{#formatdate:junx 3|dmy}}
24327 !! html
24328 <p><span class="mw-formatted-date" title="06-03">3 Juni</span>
24329 junx 3
24330 </p>
24331 !! end
24332
24333 !! test
24334 formatdate uses correct capitalisation in French
24335 !! options
24336 language=fr
24337 !! wikitext
24338 {{#formatdate:Juin 3|dmy}}
24339 !! html
24340 <p><span class="mw-formatted-date" title="06-03">3 juin</span>
24341 </p>
24342 !! end
24343
24344 !! test
24345 formatdate uses correct capitalisation in English
24346 !! wikitext
24347 {{#formatdate:june 3|dmy}}
24348 !! html
24349 <p><span class="mw-formatted-date" title="06-03">3 June</span>
24350 </p>
24351 !! end
24352
24353
24354 #
24355 #
24356 #
24357
24358 #
24359 # Edit comments
24360 #
24361
24362 !! test
24363 Edit comment with link
24364 !! options
24365 comment
24366 !! wikitext
24367 I like the [[Main Page]] a lot
24368 !! html/php
24369 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24370 !!end
24371
24372 !! test
24373 Edit comment with link and link text
24374 !! options
24375 comment
24376 !! wikitext
24377 I like the [[Main Page|best pages]] a lot
24378 !! html/php
24379 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24380 !!end
24381
24382 !! test
24383 Edit comment with link and link text with suffix
24384 !! options
24385 comment
24386 !! wikitext
24387 I like the [[Main Page|best page]]s a lot
24388 !! html/php
24389 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24390 !!end
24391
24392 !! test
24393 Edit comment with section link (non-local, eg in history list)
24394 !! options
24395 comment title=[[Main Page]]
24396 !! wikitext
24397 /* External links */ removed bogus entries
24398 !! html/php
24399 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→‎External links</a>: </span> removed bogus entries</span>
24400 !!end
24401
24402 !! test
24403 Edit comment with section link and text before it (non-local, eg in history list)
24404 !! options
24405 comment title=[[Main Page]]
24406 !! wikitext
24407 pre-comment text /* External links */ removed bogus entries
24408 !! html/php
24409 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>
24410 !!end
24411
24412 !! test
24413 Edit comment with section link (local, eg in diff view)
24414 !! options
24415 comment local title=[[Main Page]]
24416 !! wikitext
24417 /* External links */ removed bogus entries
24418 !! html/php
24419 <span dir="auto"><span class="autocomment"><a href="#External_links">→‎External links</a>: </span> removed bogus entries</span>
24420 !!end
24421
24422 !! test
24423 Edit comment with section link that has a link in it
24424 !! options
24425 comment local title=[[Main Page]]
24426 !! wikitext
24427 /* [[A link]] */
24428 !! html/php
24429 <span dir="auto"><span class="autocomment"><a href="#A_link">→‎&#91;[A link]]</a></span></span>
24430 !! end
24431
24432 !! test
24433 Edit comment with section link that has a template in it
24434 !! options
24435 comment local title=[[Main Page]]
24436 !! wikitext
24437 /* {{foobar|param}} */
24438 !! html/php
24439 <span dir="auto"><span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→‎{{foobar|param}}</a></span></span>
24440 !! end
24441
24442 !! test
24443 Edit comment with subpage link (T16080)
24444 !! options
24445 comment
24446 subpage
24447 title=[[Subpage test]]
24448 !! wikitext
24449 Poked at a [[/subpage]] here...
24450 !! html/php
24451 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24452 !!end
24453
24454 !! test
24455 Edit comment with subpage link and link text (T16080)
24456 !! options
24457 comment
24458 subpage
24459 title=[[Subpage test]]
24460 !! wikitext
24461 Poked at a [[/subpage|neat little page]] here...
24462 !! html/php
24463 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24464 !!end
24465
24466 !! test
24467 Edit comment with bogus subpage link in non-subpage NS (T16080)
24468 !! options
24469 comment
24470 title=[[Subpage test]]
24471 !! wikitext
24472 Poked at a [[/subpage]] here...
24473 !! html/php
24474 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...
24475 !!end
24476
24477 !! test
24478 Edit comment with bare anchor link (local, as on diff)
24479 !! options
24480 comment
24481 local
24482 title=[[Main Page]]
24483 !! wikitext
24484 [[#section]]
24485 !! html/php
24486 <a href="#section">#section</a>
24487 !! end
24488
24489 !! test
24490 Edit comment with bare anchor link (non-local, as on history)
24491 !! options
24492 comment
24493 title=[[Main Page]]
24494 !! wikitext
24495 [[#section]]
24496 !! html/php
24497 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24498 !! end
24499
24500 !! test
24501 Anchor starting with underscore
24502 !! options
24503 title=[[Foo]]
24504 !! wikitext
24505 [[#_ref|One]]
24506 !! html/php
24507 <p><a href="#_ref">One</a>
24508 </p>
24509 !! html/parsoid
24510 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24511 !! end
24512
24513 !! test
24514 Id starting with underscore
24515 !! wikitext
24516 <div id="_ref"></div>
24517 !! html/*
24518 <div id="_ref"></div>
24519 !! end
24520
24521 !! test
24522 Edit comment with link with more than one pipe (T99346)
24523 !! options
24524 comment
24525 !! wikitext
24526 [[Main Page|Many|pipes]]
24527 !! html/php
24528 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24529 !! end
24530
24531 !! test
24532 Complex edit comment with link with more than one pipe (T99346)
24533 !! options
24534 comment
24535 !! wikitext
24536 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24537 !! html/php
24538 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;
24539 !! end
24540
24541 !! test
24542 Space normalisation on autocomment (T24784)
24543 !! options
24544 comment
24545 title=[[Main Page]]
24546 !! wikitext
24547 /* __hello__world__ */
24548 !! html/php
24549 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→‎__hello__world__</a></span></span>
24550 !! end
24551
24552 !! test
24553 percent-encoding and + signs in comments (T28410)
24554 !! options
24555 comment
24556 !! wikitext
24557 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24558 !! html/php
24559 <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>
24560 !! end
24561
24562 # Parsoid doesn't support this yet: see T75581
24563 # but it *should* omit the 'src' attribute if the image is bad.
24564 # PHP side of tests was disabled in
24565 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24566 # because of issues in the PHP parserTests infrastructure
24567 # (but the output below is indeed what the PHP side emits)
24568 !! test
24569 Bad images - basic functionality
24570 !! wikitext
24571 [[File:Bad.jpg]]
24572 !! html/php+disabled
24573 !! html/parsoid
24574 <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>
24575 !! end
24576
24577 !! test
24578 Bad images - T18039: text after bad image disappears
24579 !! wikitext
24580 Foo bar
24581 [[File:Bad.jpg]]
24582 Bar foo
24583 !! html/php+disabled
24584 <p>Foo bar
24585 </p><p>Bar foo
24586 </p>
24587 !! html/parsoid
24588 <p>Foo bar
24589 <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>
24590 Bar foo</p>
24591 !! end
24592
24593 !! test
24594 Verify that displaytitle works (T24501) no displaytitle
24595 !! options
24596 showtitle
24597 !! config
24598 wgAllowDisplayTitle=true
24599 wgRestrictDisplayTitle=false
24600 !! wikitext
24601 this is not the the title
24602 !! html/php
24603 Parser test
24604 <p>this is not the the title
24605 </p>
24606 !! end
24607
24608 !! test
24609 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24610 !! options
24611 showtitle
24612 title=[[Screen]]
24613 !! config
24614 wgAllowDisplayTitle=true
24615 wgRestrictDisplayTitle=false
24616 !! wikitext
24617 this is not the the title
24618 {{DISPLAYTITLE:whatever}}
24619 !! html/php
24620 whatever
24621 <p>this is not the the title
24622 </p>
24623 !! end
24624
24625 !! test
24626 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24627 !! options
24628 showtitle
24629 title=[[Screen]]
24630 !! config
24631 wgAllowDisplayTitle=true
24632 wgRestrictDisplayTitle=true
24633 !! wikitext
24634 this is not the the title
24635 {{DISPLAYTITLE:whatever}}
24636 !! html/php
24637 Screen
24638 <p>this is not the the title
24639 </p>
24640 !! end
24641
24642 !! test
24643 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24644 !! options
24645 showtitle
24646 title=[[Screen]]
24647 !! config
24648 wgAllowDisplayTitle=true
24649 wgRestrictDisplayTitle=true
24650 !! wikitext
24651 this is not the the title
24652 {{DISPLAYTITLE:screen}}
24653 !! html/php
24654 screen
24655 <p>this is not the the title
24656 </p>
24657 !! end
24658
24659 !! test
24660 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24661 !! options
24662 showtitle
24663 title=[[Screen]]
24664 !! config
24665 wgAllowDisplayTitle=false
24666 !! wikitext
24667 this is not the the title
24668 {{DISPLAYTITLE:screen}}
24669 !! html/php
24670 Screen
24671 <p>this is not the the title
24672 <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>
24673 </p>
24674 !! end
24675
24676 !! test
24677 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24678 !! options
24679 showtitle
24680 title=[[Screen]]
24681 !! config
24682 wgAllowDisplayTitle=false
24683 !! wikitext
24684 this is not the the title
24685 !! html/php
24686 Screen
24687 <p>this is not the the title
24688 </p>
24689 !! end
24690
24691 !! test
24692 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24693 !! options
24694 showtitle
24695 title=[[Screen]]
24696 !! config
24697 wgAllowDisplayTitle=true
24698 wgRestrictDisplayTitle=true
24699 !! wikitext
24700 this is not the the title
24701 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24702 !! html/php
24703 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24704 <p>this is not the the title
24705 </p>
24706 !! end
24707
24708 !! test
24709 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24710 !! options
24711 showtitle
24712 title=[[Screen]]
24713 !! config
24714 wgAllowDisplayTitle=true
24715 wgRestrictDisplayTitle=true
24716 !! wikitext
24717 this is not the the title
24718 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24719 !! html/php
24720 <span style="color: red;">s</span>creen
24721 <p>this is not the the title
24722 </p>
24723 !! end
24724
24725 !! test
24726 Page status indicators: Empty name is invalid
24727 !! options
24728 showindicators
24729 !! wikitext
24730 <indicator name=" "></indicator>
24731 <indicator></indicator>
24732 !! html/php
24733 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24734 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24735 </p>
24736 !! end
24737
24738 !! test
24739 Page status indicators: Weird syntaxes that are okay
24740 !! options
24741 showindicators
24742 !! wikitext
24743 <indicator name="empty" />
24744 <indicator name="name"></indicator>
24745 !! html/php
24746 empty=
24747 name=
24748 <p><br />
24749 </p>
24750 !! end
24751
24752 !! test
24753 Page status indicators: Torture test
24754 !! options
24755 showindicators
24756 !! wikitext
24757 <indicator name="01">hello world</indicator>
24758 <indicator name="02">[[Main Page]]</indicator>
24759 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24760 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24761 <indicator name="05">*foo
24762 *bar</indicator>
24763 <indicator name="06"><nowiki>foo</nowiki></indicator>
24764 <indicator name="07"> Preformatted</indicator>
24765 <indicator name="08"><div>Broken tag</indicator>
24766 <indicator name="09">{| class=wikitable
24767 |cell
24768 |}</indicator>
24769 <indicator name="10">Two
24770
24771 paragraphs</indicator>
24772 !! html/php
24773 01=hello world
24774 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24775 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" />
24776 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>
24777 05=<ul><li>foo</li>
24778 <li>bar</li></ul>
24779 06=foo
24780 07=<pre>Preformatted
24781 </pre>
24782 08=<div>Broken tag</div>
24783
24784 09=<table class="wikitable">
24785 <tr>
24786 <td>cell
24787 </td></tr></table>
24788 10=<p>Two
24789 </p><p>paragraphs
24790 </p>
24791 <p><br />
24792 </p><p><br />
24793 </p><p><br />
24794 </p><p><br />
24795 </p><p><br />
24796 </p>
24797 !! end
24798
24799 !! test
24800 preload: check <noinclude> and <includeonly>
24801 !! options
24802 preload
24803 !! wikitext
24804 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24805 !! html/php
24806 Hello kind world.
24807 !! end
24808
24809 !! test
24810 preload: check <onlyinclude>
24811 !! options
24812 preload
24813 !! wikitext
24814 Goodbye <onlyinclude>Hello world</onlyinclude>
24815 !! html/php
24816 Hello world
24817 !! end
24818
24819 !! test
24820 preload: can pass tags through if we want to
24821 !! options
24822 preload
24823 !! wikitext
24824 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24825 !! html/php
24826 <includeonly>Hello world</includeonly>
24827 !! end
24828
24829 !! test
24830 preload: check that it doesn't try to do tricks
24831 !! options
24832 preload
24833 !! wikitext
24834 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24835 !! html/php
24836 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24837 !! end
24838
24839 !! test
24840 Play a bit with r67090 and T5158
24841 !! wikitext
24842 <div style="width:50% !important">&nbsp;</div>
24843 <div style="width:50%&nbsp;!important">&nbsp;</div>
24844 <div style="width:50%&#160;!important">&nbsp;</div>
24845 <div style="border : solid;">&nbsp;</div>
24846 !! html/php
24847 <div style="width:50% !important">&#160;</div>
24848 <div style="width:50% !important">&#160;</div>
24849 <div style="width:50% !important">&#160;</div>
24850 <div style="border&#32;: solid;">&#160;</div>
24851 !! html/parsoid
24852 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24853 <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>
24854 <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>
24855 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24856 !! end
24857
24858 !! test
24859 French spaces in wikitext
24860 !! wikitext
24861 foo ! bar ? bat 50 % is less than 75 %.
24862
24863 Hello : this ; is « something ‹ else › again »
24864 !! html
24865 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24866 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24867 </p>
24868 !! end
24869
24870 # It would be reasonable for Parsoid and PHP to differ here.
24871 # The PHP behavior is arguably a bug.
24872 !! test
24873 Corner case: french spaces in definition list
24874 !! wikitext
24875 ;foo : bar
24876 !! html+tidy
24877 <dl><dt>foo&#160;</dt>
24878 <dd>bar</dd></dl>
24879 !! end
24880
24881 !! test
24882 T5158: Test for French spaces in attributes
24883 !! wikitext
24884 <br style=" clear : both ; " />
24885 !! html/php
24886 <p><br style="clear&#32;: both&#32;;" />
24887 </p>
24888 !! end
24889
24890 !! test
24891 HTML5 data attributes
24892 !! wikitext
24893 <span data-foo="bar">Baz</span>
24894 <p data-abc-def_hij="">Quuz</p>
24895 !! html/php
24896 <p><span data-foo="bar">Baz</span>
24897 </p>
24898 <p data-abc-def_hij="">Quuz</p>
24899 !! html/parsoid
24900 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24901 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24902 !! end
24903
24904 !! test
24905 Strip reserved data attributes
24906 !! wikitext
24907 <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>
24908 !! html/php
24909 <div data-ok="fred" data-object-id="123">d</div>
24910 !! html/parsoid
24911 <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>
24912 !! end
24913
24914 !! test
24915 percent-encoding and + signs in internal links (T28410)
24916 !! wikitext
24917 [[User:+%]] [[Page+title%]]
24918 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24919 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24920 [[%33%45]] [[%33%45+]]
24921 !! html/php
24922 <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>
24923 <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>
24924 <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>
24925 <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>
24926 </p>
24927 !! html/parsoid
24928 <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>
24929 <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>
24930 <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>
24931 <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>
24932 !! end
24933
24934 !! test
24935 Special characters in embedded file links (T29679)
24936 !! wikitext
24937 [[File:Contains & ampersand.jpg]]
24938 [[File:Does not exist.jpg|Title with & ampersand]]
24939 !! html/php
24940 <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>
24941 <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>
24942 </p>
24943 !! html/parsoid
24944 <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>
24945 <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>
24946 !! end
24947
24948 !! test
24949 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24950 !! wikitext
24951 Text&apos;s been normalized?
24952 !! html
24953 <p>Text&#39;s been normalized?
24954 </p>
24955 !! end
24956
24957 !! test
24958 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24959 !! wikitext
24960 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24961 !! html
24962 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24963 </p>
24964 !! end
24965
24966 !! test
24967 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24968 !! wikitext
24969 [http://www.example.org/ ideograms]
24970 !! html
24971 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24972 </p>
24973 !! end
24974
24975 !! test
24976 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24977 !! wikitext
24978 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24979 !! html
24980 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24981 </p>
24982 !! end
24983
24984 !! article
24985 Mediawiki:loop1
24986 !! text
24987 {{Identical|A}}
24988 !! endarticle
24989
24990 !! article
24991 Mediawiki:loop2
24992 !! text
24993 {{Identical|B}}
24994 !! endarticle
24995
24996 !! article
24997 Template:Identical
24998 !! text
24999 {{int:loop1}}
25000 {{int:loop2}}
25001 !! endarticle
25002
25003 !! test
25004 T33098 Template which includes system messages which includes the template
25005 !! wikitext
25006 {{Identical}}
25007 !! html
25008 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25009 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
25010 </p>
25011 !! end
25012
25013 !! test
25014 T33490 Turkish: ucfirst 'blah'
25015 !! options
25016 language=tr
25017 !! wikitext
25018 {{ucfirst:blah}}
25019 !! html
25020 <p>Blah
25021 </p>
25022 !! end
25023
25024 !! test
25025 T33490 Turkish: ucfirst 'ix'
25026 !! options
25027 language=tr
25028 !! wikitext
25029 {{ucfirst:ix}}
25030 !! html
25031 <p>İx
25032 </p>
25033 !! end
25034
25035 !! test
25036 T33490 Turkish: lcfirst 'BLAH'
25037 !! options
25038 language=tr
25039 !! wikitext
25040 {{lcfirst:BLAH}}
25041 !! html
25042 <p>bLAH
25043 </p>
25044 !! end
25045
25046 !! test
25047 T33490 Turkish: ucfırst (with a dotless i)
25048 !! options
25049 language=tr
25050 !! wikitext
25051 {{ucfırst:blah}}
25052 !! html
25053 <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>
25054 </p>
25055 !! end
25056
25057 !! test
25058 T33490 ucfırst (with a dotless i) with English language
25059 !! options
25060 language=en
25061 !! wikitext
25062 {{ucfırst:blah}}
25063 !! html
25064 <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>
25065 </p>
25066 !! end
25067
25068 # Note that Parsoid doesn't emit an explicit TOC.
25069 # Note also that the html2wt direction tends to emit an extra newline
25070 # between the __TOC__ magicword and the first heading unless *both*
25071 # the <meta> and the <h2> have a data-parsoid attribute set (even if
25072 # it's "{}").
25073
25074 !! test
25075 T28375: TOC with italics
25076 !! options
25077 title=[[Main Page]]
25078 !! wikitext
25079 __TOC__
25080 ==''Lost'' episodes==
25081 !! html/php
25082 <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>
25083 <ul>
25084 <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>
25085 </ul>
25086 </div>
25087
25088 <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>
25089 !! html/parsoid
25090 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25091 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
25092 !! end
25093
25094 !! test
25095 T28375: TOC with bold
25096 !! options
25097 title=[[Main Page]]
25098 !! wikitext
25099 __TOC__
25100 =='''should be bold''' then normal text==
25101 !! html/php
25102 <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>
25103 <ul>
25104 <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>
25105 </ul>
25106 </div>
25107
25108 <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>
25109 !! html/parsoid
25110 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25111 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25112 !! end
25113
25114 !! test
25115 T35845: Headings become cursive in TOC when they contain an image
25116 !! options
25117 title=[[Main Page]]
25118 !! wikitext
25119 __TOC__
25120 ==Image [[Image:foobar.jpg]]==
25121 !! html/php
25122 <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>
25123 <ul>
25124 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25125 </ul>
25126 </div>
25127
25128 <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>
25129 !! html/parsoid
25130 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25131 <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>
25132 !! end
25133
25134 !! test
25135 T35845 (2): Headings become bold in TOC when they contain a blockquote
25136 !! options
25137 title=[[Main Page]]
25138 !! wikitext
25139 __TOC__
25140 ==<blockquote>Quote</blockquote>==
25141 !! html/php
25142 <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>
25143 <ul>
25144 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25145 </ul>
25146 </div>
25147
25148 <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>
25149 !! html/php+tidy
25150 <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>
25151 <ul>
25152 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25153 </ul>
25154 </div>
25155
25156 <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>
25157 !! html/parsoid
25158 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25159 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25160 !! end
25161
25162 !! test
25163 Unclosed tags in TOC
25164 !! config
25165 wgFragmentMode=[ 'html5', 'legacy' ]
25166 !! options
25167 title=[[Main Page]]
25168 !! wikitext
25169 __TOC__
25170 ==Proof: 2 < 3==
25171 <small>Hanc marginis exiguitas non caperet.</small>
25172 QED
25173 !! html/php
25174 <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>
25175 <ul>
25176 <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>
25177 </ul>
25178 </div>
25179
25180 <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>
25181 <p><small>Hanc marginis exiguitas non caperet.</small>
25182 QED
25183 </p>
25184 !! html/parsoid
25185 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25186 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25187 <p><small>Hanc marginis exiguitas non caperet.</small>
25188 QED</p>
25189 !! end
25190
25191 !! test
25192 Multiple tags in TOC
25193 !! wikitext
25194 __TOC__
25195 ==<i>Foo</i> <b>Bar</b>==
25196
25197 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25198 !! html/php
25199 <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>
25200 <ul>
25201 <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>
25202 <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>
25203 </ul>
25204 </div>
25205
25206 <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>
25207 <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>
25208 !! html/php+tidy
25209 <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>
25210 <ul>
25211 <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>
25212 <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>
25213 </ul>
25214 </div>
25215
25216 <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>
25217 <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>
25218 !! html/parsoid
25219 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25220 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25221
25222 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25223 !! end
25224
25225 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25226 # html5 tag parsing.
25227 !! test
25228 Tags with parameters in TOC
25229 !! options
25230 parsoid=wt2html
25231 !! wikitext
25232 __TOC__
25233 ==<sup class="in-h2">Hello</sup>==
25234
25235 ==<sup class="a > b">Evilbye</sup>==
25236 !! html/php
25237 <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>
25238 <ul>
25239 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25240 <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>
25241 </ul>
25242 </div>
25243
25244 <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>
25245 <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>
25246 !! html/parsoid
25247 <meta property="mw:PageProp/toc" />
25248 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25249
25250 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25251 !! end
25252
25253 !! test
25254 span tags with directionality in TOC
25255 !! wikitext
25256 __TOC__
25257 ==<span dir="ltr">C++</span>==
25258
25259 ==<span dir="rtl">זבנג!</span>==
25260
25261 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25262
25263 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25264
25265 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25266 !! html/php
25267 <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>
25268 <ul>
25269 <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>
25270 <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>
25271 <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>
25272 <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>
25273 <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>
25274 </ul>
25275 </div>
25276
25277 <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>
25278 <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>
25279 <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>
25280 <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>
25281 <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>
25282 !! html/parsoid
25283 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25284 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25285 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25286 <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>
25287 <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>
25288 <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>
25289 !! end
25290
25291 !! test
25292 T74884: bdi element in ToC
25293 !! wikitext
25294 __TOC__
25295 ==<bdi>test</bdi>==
25296 !! html/php
25297 <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>
25298 <ul>
25299 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25300 </ul>
25301 </div>
25302
25303 <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>
25304 !! html/parsoid
25305 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25306 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25307 !! end
25308
25309 !! test
25310 T35715: s/strike element in ToC
25311 !! wikitext
25312 __TOC__
25313 ==<s>test</s> test <strike>test</strike>==
25314 !! html/php
25315 <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>
25316 <ul>
25317 <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>
25318 </ul>
25319 </div>
25320
25321 <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>
25322 !! html/parsoid
25323 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25324 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25325 !! end
25326
25327 !! test
25328 T198618: style element in ToC
25329 !! options
25330 styletag=1
25331 !! wikitext
25332 __TOC__
25333 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25334 !! html/php
25335 <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>
25336 <ul>
25337 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25338 </ul>
25339 </div>
25340
25341 <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>
25342 !! html/parsoid
25343 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25344 <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>
25345 !! end
25346
25347 !! test
25348 T198618: script element in ToC
25349 !! options
25350 wgRawHtml=1
25351 !! wikitext
25352 __TOC__
25353 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25354 !! html/php
25355 <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>
25356 <ul>
25357 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25358 </ul>
25359 </div>
25360
25361 <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>
25362 !! html/parsoid
25363 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25364 <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>
25365 !! end
25366
25367 !! test
25368 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25369 !! wikitext
25370 __TOC__
25371 ==x==
25372 !! html/php
25373 <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>
25374 <ul>
25375 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25376 </ul>
25377 </div>
25378
25379 <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>
25380 !! html/parsoid
25381 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25382 <h2 id="x" data-parsoid='{}'>x</h2>
25383 !! end
25384
25385 !! article
25386 MediaWiki:T34057
25387 !! text
25388 == {{int:headline_sample}} ==
25389 !! endarticle
25390
25391 !! test
25392 T34057: Title needed when expanding <h> nodes.
25393 !! options
25394 title=[[Main Page]]
25395 !! wikitext
25396 {{int:T34057}}
25397 !! html
25398 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
25399 !! end
25400
25401 !! test
25402 Strip marker in urlencode
25403 !! wikitext
25404 {{urlencode:x<nowiki/>y}}
25405 {{urlencode:x<nowiki/>y|wiki}}
25406 {{urlencode:x<nowiki/>y|path}}
25407 {{urlencode:x<pre id="one">two</pre>y}}
25408 !! html/php
25409 <p>xy
25410 xy
25411 xy
25412 xy
25413 </p>
25414 !! end
25415
25416 !! test
25417 Strip marker in lc
25418 !! wikitext
25419 {{lc:x<nowiki/>y}}
25420 !! html
25421 <p>xy
25422 </p>
25423 !! end
25424
25425 !! test
25426 Strip marker in uc
25427 !! wikitext
25428 {{uc:x<nowiki/>y}}
25429 !! html
25430 <p>XY
25431 </p>
25432 !! end
25433
25434 !! test
25435 Strip marker in formatNum
25436 !! wikitext
25437 {{formatnum:1<nowiki/>2}}
25438 {{formatnum:1<nowiki/>2|R}}
25439 !! html
25440 <p>12
25441 12
25442 </p>
25443 !! end
25444
25445 !! test
25446 Check noCommafy in formatNum
25447 !! options
25448 language=be-tarask
25449 !! wikitext
25450 {{formatnum:123456.78}}
25451 {{formatnum:123456.78|NOSEP}}
25452 !! html
25453 <p>123 456,78
25454 123456.78
25455 </p>
25456 !! end
25457
25458 !! test
25459 Wrong option for formatNum (T58199)
25460 !! wikitext
25461 {{formatnum:1,234.56|Random}}
25462 {{formatnum:1,234.56|EVERYTHING}}
25463 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25464 !! html
25465 <p>1,234.56
25466 1,234.56
25467 1,234.56
25468 </p>
25469 !! end
25470
25471 !! test
25472 Strip marker in grammar
25473 !! options
25474 language=fi
25475 !! wikitext
25476 {{grammar:elative|foo<nowiki/>bar}}
25477 !! html
25478 <p>foobarista
25479 </p>
25480 !! end
25481
25482 !! test
25483 Strip marker in padleft
25484 !! wikitext
25485 {{padleft:|2|x<nowiki/>y}}
25486 !! html
25487 <p>xy
25488 </p>
25489 !! end
25490
25491 !! test
25492 Strip marker in padright
25493 !! wikitext
25494 {{padright:|2|x<nowiki/>y}}
25495 !! html
25496 <p>xy
25497 </p>
25498 !! end
25499
25500 !! test
25501 Strip marker in anchorencode
25502 !! wikitext
25503 {{anchorencode:x<nowiki/>y}}
25504 !! html/php
25505 <p>xy
25506 </p>
25507 !! html/parsoid
25508 <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>
25509 !! end
25510
25511 !! test
25512 nowiki inside link inside heading (T20295)
25513 !! wikitext
25514 ==[[foo|x<nowiki>y</nowiki>z]]==
25515 !! html
25516 <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>
25517 !! end
25518
25519 !! test
25520 new support for bdi element (T33817)
25521 !! wikitext
25522 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25523 !! html
25524 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25525 !! end
25526
25527 !! test
25528 Ignore pipe between table row attributes
25529 !! wikitext
25530 {|
25531 |quux
25532 |- id=foo | style='color: red'
25533 |bar
25534 |}
25535 !! html
25536 <table>
25537 <tr>
25538 <td>quux
25539 </td></tr>
25540 <tr id="foo" style="color: red">
25541 <td>bar
25542 </td></tr></table>
25543 !! end
25544
25545 !!test
25546 Language parser function
25547 !! wikitext
25548 {{#language:ar}}
25549 !! html
25550 <p>العربية
25551 </p>
25552 !! end
25553
25554 !!test
25555 Padleft and padright (default 0-padding)
25556 !! wikitext
25557 {{padleft:xyz|5}}
25558 {{padright:xyz|5}}
25559 !! html/php
25560 <p>00xyz
25561 xyz00
25562 </p>
25563 !! html/parsoid
25564 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25565 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25566 !! end
25567
25568 !!test
25569 Padleft and padright (partial fill)
25570 !! wikitext
25571 {{padleft:xyz|6|ab}}
25572 {{padright:xyz|6|ab}}
25573 !! html/php
25574 <p>abaxyz
25575 xyzaba
25576 </p>
25577 !! html/parsoid
25578 <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>
25579 <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>
25580 !! end
25581
25582 !!test
25583 Padleft and padright as substr
25584 !! wikitext
25585 {{padleft:|3|abcde}}
25586 {{padright:|3|abcde}}
25587 !! html/php
25588 <p>abc
25589 abc
25590 </p>
25591 !! html/parsoid
25592 <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>
25593 <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>
25594 !! end
25595
25596 !! test
25597 Padleft and padright with non-numerical length (T180403)
25598 !! wikitext
25599 {{padleft:abcdef|junk}}
25600 {{padright:abcdef|junk}}
25601 !! html/php
25602 <p>abcdef
25603 abcdef
25604 </p>
25605 !! end
25606
25607 !!test
25608 Special parser function
25609 !! wikitext
25610 {{#special:RandomPage}}
25611 {{#special:BaDtItLe}}
25612 {{#special:Foobar}}
25613 !! html
25614 <p>Special:Random
25615 Special:Badtitle
25616 Special:Foobar
25617 </p>
25618 !! end
25619
25620 !!test
25621 T36939 - Case insensitive link parsing ([HttP://])
25622 !! wikitext
25623 [HttP://MediaWiki.Org/]
25624 !! html/php
25625 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25626 </p>
25627 !! html/parsoid
25628 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25629 !! end
25630
25631 !!test
25632 T36939 - Case insensitive link parsing ([HttP:// title])
25633 !! wikitext
25634 [HttP://MediaWiki.Org/ MediaWiki]
25635 !! html
25636 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25637 </p>
25638 !! end
25639
25640 !!test
25641 T36939 - Case insensitive link parsing (HttP://)
25642 !! wikitext
25643 HttP://MediaWiki.Org/
25644 !! html/php
25645 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25646 </p>
25647 !! html/parsoid
25648 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25649 !! end
25650
25651 !!test
25652 Disable TOC
25653 !! options
25654 notoc
25655 !! wikitext
25656 Lead
25657 ==Section 1==
25658 ==Section 2==
25659 ==Section 3==
25660 ==Section 4==
25661 ==Section 5==
25662 !! html
25663 <p>Lead
25664 </p>
25665
25666 <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>
25667 <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>
25668 <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>
25669 <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>
25670 <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>
25671 !! end
25672
25673
25674 ###
25675 ### Parsoid-specific tests
25676 ### Parsoid-PHP parser incompatibilities
25677 ###
25678 !!test
25679 1. SOL-sensitive wikitext tokens as template-args
25680 !! options
25681 parsoid=wt2html,wt2wt
25682 !! wikitext
25683 {{echo|*a}}
25684 {{echo|#a}}
25685 {{echo|:a}}
25686 !! html/php+tidy
25687 <ul><li>a</li></ul>
25688 <ol><li>a</li></ol>
25689 <dl><dd>a</dd></dl>
25690 !! html/parsoid
25691 <span about="#mwt1" typeof="mw:Transclusion">
25692 </span><ul about="#mwt1"><li>a</li>
25693 </ul>
25694 <span about="#mwt2" typeof="mw:Transclusion">
25695 </span><ol about="#mwt2"><li>a</li>
25696 </ol>
25697 <span about="#mwt3" typeof="mw:Transclusion">
25698 </span><dl about="#mwt3"><dd>a</dd>
25699 </dl>
25700 !!end
25701
25702 #### -----------------------------------------------------------------
25703 #### Parsoid-specific functionality tests
25704 #### -----------------------------------------------------------------
25705
25706 # T65642/T68749: Formatting elt fixup around images.
25707 # We know wt2wt will fail, but we expect selser to pass.
25708 # Due to the nature of our testing, wt2wt and selser tests will enter the
25709 # blacklist and we'll catch selser regressions based on changes to the
25710 # blacklist entries for selser tests.
25711 !! test
25712 1. Treebuilder fixup of formatting elt
25713 !! options
25714 parsoid=wt2html,wt2wt
25715 !! wikitext
25716 {|
25717 |
25718 <small>
25719 [[Image:Foobar.jpg|right|Test]]
25720 </small>
25721 |}
25722 !! html/php+tidy
25723 <table>
25724 <tbody><tr>
25725 <td>
25726 <p><small>
25727 </small></p><small>
25728 <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>
25729 </small><p><small></small>
25730 </p>
25731 </td></tr></tbody></table>
25732 !! html/parsoid
25733 <table>
25734 <tbody><tr><td>
25735 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25736 <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>
25737 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25738 </tbody></table>
25739 !! end
25740
25741 !! test
25742 2. Treebuilder fixup of formatting elt
25743 !! options
25744 parsoid=wt2html,wt2wt
25745 !! wikitext
25746 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25747
25748 <small>[[Image:Foobar.jpg|right|300px]]</small>
25749 !! html/php+tidy
25750 <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>
25751 </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>
25752 !! html/parsoid
25753 <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>
25754
25755 <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>
25756 !! end
25757
25758 !! test
25759 3. Treebuilder fixup of formatting elt
25760 !! options
25761 parsoid=wt2html,wt2wt
25762 !! wikitext
25763 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25764 !! html/php+tidy
25765 <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>
25766 !! html/parsoid
25767 <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>
25768 !! end
25769
25770 !! test
25771 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25772 !! options
25773 parsoid=wt2html,wt2wt
25774 !! wikitext
25775 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25776 !! html/php+tidy
25777 <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>
25778 !! html/parsoid
25779 <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>
25780 !! end
25781
25782 #### ----------------------------------------------------------------
25783 #### Parsoid-only testing of Parsoid's impl of LST
25784 #### Not implemented yet, see
25785 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25786 #### ----------------------------------------------------------------
25787
25788 ## We still need to support serializing the older format while content is stored.
25789 !! test
25790 LST Sections: Backwards compatibility
25791 !! options
25792 parsoid={
25793 "suppressErrors": true,
25794 "modes": ["html2wt"]
25795 }
25796 !! wikitext
25797 <section begin="2011-05-16" />
25798 <section end="2014-04-10 (MW 1.23wmf22)" />
25799 !! html/parsoid
25800 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25801 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25802 !! end
25803
25804 !! test
25805 LST Sections: Newfangled approach
25806 !! wikitext
25807 <section begin="2011-05-16" />
25808 <section end="2014-04-10 (MW 1.23wmf22)" />
25809 !! html/parsoid
25810 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25811 </span>
25812 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25813 </span></p>
25814 !! end
25815
25816 #--------- Test stripping of empty nodes in template content ----------
25817
25818 !! test
25819 Empty LI and TR nodes should be stripped from template content
25820 !! wikitext
25821 {{EmptyLITest}}
25822 {{EmptyTRTest}}
25823 !! html/parsoid
25824 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25825 <li>a</li>
25826 <li>b</li>
25827 </ul>
25828 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25829 <tbody>
25830 <tr>
25831 <td>foo</td>
25832 </tr>
25833 <tr>
25834 <td>bar</td>
25835 </tr>
25836 </tbody>
25837 </table>
25838 !! end
25839
25840 !! test
25841 Empty LI and TR nodes should not be stripped from top-level content
25842 !! wikitext
25843 *a
25844 *
25845 *b
25846
25847 {|
25848 |-
25849 |-
25850 |foo
25851 |}
25852 !! html/parsoid
25853 <ul>
25854 <li>a</li>
25855 <li class='mw-empty-elt'></li>
25856 <li>b</li>
25857 </ul>
25858 <table>
25859 <tbody>
25860 <tr class='mw-empty-elt'></tr>
25861 <tr>
25862 <td>foo</td>
25863 </tr>
25864 </tbody>
25865 </table>
25866 !! end
25867
25868 !! test
25869 Empty TR nodes should not be stripped if they have any attributes set
25870 !! wikitext
25871 {{EmptyTRWithHTMLAttrTest}}
25872 !! html/parsoid
25873 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25874 <tr align='center'></tr>
25875 <tr><td>foo</td></tr>
25876 <tr align='center'></tr>
25877 <tr><td>bar</td></tr>
25878 </table>
25879 !! end
25880
25881 #### ----------------------------------------------------------------
25882 #### The following section of tests are primarily to test
25883 #### wikitext escaping capabilities of Parsoid. Given that
25884 #### escaping can be done any number of ways, the wikitext (input)
25885 #### is always adjusted to reflect how Parsoid adds nowiki
25886 #### escape tags.
25887 ####
25888 #### We are marking several tests as parsoid-only since the
25889 #### HTML in the result section is different from what the
25890 #### PHP parser generates for it.
25891 #### ----------------------------------------------------------------
25892
25893
25894 #### --------------- Headings ---------------
25895 #### 0. Unnested
25896 #### 1. Nested inside html <h1>=foo=</h1>
25897 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25898 #### 3. Nested inside html with wikitext split by html tags
25899 #### 4. No escape needed
25900 #### 5. Empty headings <h1></h1>
25901 #### 6. Heading chars in SOL context
25902 #### ----------------------------------------
25903 !! test
25904 Headings: 0. Unnested
25905 !! options
25906 parsoid=html2wt
25907 !! html/parsoid
25908 <p>=foo=</p>
25909
25910 <p> =foo=
25911 <!--cmt-->
25912 =foo=</p>
25913
25914 <p>=foo<i>a</i>=</p>
25915 !! wikitext
25916 <nowiki>=foo=</nowiki>
25917
25918 <nowiki> </nowiki>=foo=
25919 <!--cmt-->
25920 <nowiki>=foo=</nowiki>
25921
25922 =foo''a''<nowiki>=</nowiki>
25923 !!end
25924
25925 # New headings and existing headings are handled differently
25926 !! test
25927 Headings: 1. Nested inside html
25928 !! options
25929 parsoid=html2wt
25930 !! html/parsoid
25931 <h1>=foo=</h1>
25932 <h2>=foo=</h2>
25933 <h3>=foo=</h3>
25934
25935 <h1 data-parsoid='{}'>=foo=</h1>
25936 <h2 data-parsoid='{}'>=foo=</h2>
25937 <h3 data-parsoid='{}'>=foo=</h3>
25938 <h4 data-parsoid='{}'>=foo=</h4>
25939 <h5 data-parsoid='{}'>=foo=</h5>
25940 <h6 data-parsoid='{}'>=foo=</h6>
25941 !! wikitext
25942 = =foo= =
25943
25944 == =foo= ==
25945
25946 === =foo= ===
25947
25948 =<nowiki>=foo=</nowiki>=
25949 ==<nowiki>=foo=</nowiki>==
25950 ===<nowiki>=foo=</nowiki>===
25951 ====<nowiki>=foo=</nowiki>====
25952 =====<nowiki>=foo=</nowiki>=====
25953 ======<nowiki>=foo=</nowiki>======
25954 !! end
25955
25956 !! test
25957 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25958 !! options
25959 parsoid=html2wt
25960 !! html/parsoid
25961 <h1>foo</h1>*bar
25962 <h1>foo</h1>=bar
25963 <h1>foo</h1>=bar=
25964 !! wikitext
25965 = foo =
25966 <nowiki>*</nowiki>bar
25967
25968 = foo =
25969 =bar
25970
25971 = foo =
25972 <nowiki>=bar=</nowiki>
25973 !!end
25974
25975 !! test
25976 Headings: 3. Nested inside html with wikitext split by html tags
25977 !! options
25978 parsoid=html2wt
25979 !! html/parsoid
25980 <h1>=<b>bold</b>foo=</h1>
25981 !! wikitext
25982 = ='''bold'''foo= =
25983 !!end
25984
25985 !! test
25986 Headings: 4a. No escaping needed (testing just h1 and h2)
25987 !! options
25988 parsoid=html2wt
25989 !! html/parsoid
25990 <h1>=foo</h1>
25991 <h1>foo=</h1>
25992 <h1> =foo= </h1>
25993 <h1>=foo= bar</h1>
25994 <h2>=foo</h2>
25995 <h2>foo=</h2>
25996 <h1>=</h1>
25997 <h1><i>=</i>foo=</h1>
25998 !! wikitext
25999 = =foo =
26000
26001 = foo= =
26002
26003 = =foo= =
26004
26005 = =foo= bar =
26006
26007 == =foo ==
26008
26009 == foo= ==
26010
26011 = = =
26012
26013 = ''=''foo= =
26014 !!end
26015
26016 !! test
26017 Headings: 4b. No escaping needed (inside p-tags)
26018 !! options
26019 parsoid=html2wt
26020 !! html/parsoid
26021 <p>=foo= x
26022 =foo= <s></s>
26023 </p>
26024 !! wikitext
26025 =foo= x
26026 =foo= <s></s>
26027 !! html/php
26028 <p>=foo= x
26029 =foo= <s></s>
26030 </p>
26031 !!end
26032
26033 !! test
26034 Headings: 4c. Short headings (1)
26035 !! options
26036 parsoid=html2wt
26037 !! html/parsoid
26038 <p>===
26039 </p>
26040 !! wikitext
26041 <nowiki>===</nowiki>
26042 !! html/php
26043 <p>===
26044 </p>
26045 !! end
26046
26047 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
26048 !! test
26049 Headings: 4d. Short headings (2)
26050 !! options
26051 parsoid=wt2html,html2html
26052 !! wikitext
26053 =
26054 ==
26055 ===
26056 ====
26057 =====
26058 !! html/php
26059 <p>=
26060 ==
26061 </p>
26062 <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>
26063 <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>
26064 <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>
26065 !! html/parsoid
26066 <p>=
26067 ==</p>
26068 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
26069 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
26070 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
26071 !! end
26072
26073 !! test
26074 Headings: 5. Empty headings
26075 !! options
26076 parsoid=html2wt
26077 !! html/parsoid
26078 <h1 data-parsoid='{}'></h1>
26079
26080 <h2 data-parsoid='{}'></h2>
26081
26082 <h3 data-parsoid='{}'></h3>
26083
26084 <h4 data-parsoid='{}'></h4>
26085
26086 <h5 data-parsoid='{}'></h5>
26087
26088 <h6 data-parsoid='{}'></h6>
26089 !! wikitext
26090 =<nowiki/>=
26091
26092 ==<nowiki/>==
26093
26094 ===<nowiki/>===
26095
26096 ====<nowiki/>====
26097
26098 =====<nowiki/>=====
26099
26100 ======<nowiki/>======
26101 !!end
26102
26103 !! test
26104 Headings: 6a. Heading chars in SOL context (with trailing spaces)
26105 !! options
26106 parsoid=html2wt
26107 !! html/parsoid
26108 <p>=a=</p>
26109
26110 <p>=a=</p>
26111
26112 <p>=a=</p>
26113 !! wikitext
26114 <nowiki>=a=</nowiki>
26115
26116 <nowiki>=a=</nowiki>
26117
26118 <nowiki>=a=</nowiki>
26119 !!end
26120
26121 !! test
26122 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26123 !! options
26124 parsoid=html2wt
26125 !! html/parsoid
26126 <p>=a=
26127 b</p>
26128
26129 <p>=a=
26130 b</p>
26131
26132 <p>=a=
26133 b</p>
26134 !! wikitext
26135 <nowiki>=a=</nowiki>
26136 b
26137
26138 <nowiki>=a=</nowiki>
26139 b
26140
26141 <nowiki>=a=</nowiki>
26142 b
26143 !!end
26144
26145 !! test
26146 Headings: 6c. Heading chars in SOL context (leading newline break)
26147 !! options
26148 parsoid=html2wt
26149 !! html/parsoid
26150 <p>a
26151 =b=</p>
26152 !! wikitext
26153 a
26154 <nowiki>=b=</nowiki>
26155 !!end
26156
26157 !! test
26158 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <!--c0--><p>=a=</p>
26163
26164 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26165 !! wikitext
26166 <!--c0--><nowiki>=a=</nowiki>
26167
26168 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26169 !!end
26170
26171 !! test
26172 Headings: 6d. Heading chars in SOL context (No escaping needed)
26173 !! options
26174 parsoid=html2wt
26175 !! html/parsoid
26176 =a=<div>b</div>
26177 !! wikitext
26178 =a=<div>b</div>
26179 !!end
26180
26181 !! test
26182 Headings: 7. Insert a newline between new content and headings
26183 !! options
26184 parsoid=html2wt
26185 !! html/parsoid
26186 <h2>NEW</h2>
26187 <p>new</p>
26188 <h2 data-parsoid='{}'>A</h2>
26189 <p data-parsoid='{}'>a</p>
26190 !! wikitext
26191 == NEW ==
26192 new
26193
26194 ==A==
26195 a
26196 !! end
26197
26198 !! test
26199 Headings: Used as horizontal rule
26200 !! config
26201 wgFragmentMode=[ 'html5', 'legacy' ]
26202 !! options
26203 parsoid=wt2html
26204 !! wikitext
26205 ===============
26206 !! html/php
26207 <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>
26208 !! html/parsoid
26209 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26210 !! end
26211
26212 #### --------------- Lists ---------------
26213 #### 0. Outside nests (*foo, etc.)
26214 #### 1. Nested inside html <ul><li>*foo</li></ul>
26215 #### 2. Inside definition lists
26216 #### 3. Only bullets at start should be escaped
26217 #### 4. No escapes needed
26218 #### 5. No unnecessary escapes
26219 #### 6. Escape bullets in SOL position
26220 #### 7. Escape bullets in a multi-line context
26221 #### ----------------------------------------
26222
26223 !! test
26224 Lists: 0. Outside nests
26225 !! options
26226 parsoid=html2wt
26227 !! html/parsoid
26228 <p>*foo</p>
26229
26230 <p>#foo</p>
26231
26232 <p>;Foo:bar</p>
26233 !! wikitext
26234 <nowiki>*</nowiki>foo
26235
26236 <nowiki>#</nowiki>foo
26237
26238 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26239 !!end
26240
26241 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26242 ## to test wikitext escaping, and insignificant whitespace diffs
26243 ## cause PHP parser tests to barf
26244 !! test
26245 Lists: 1. Nested inside html (No unnecessary escapes)
26246 !! options
26247 parsoid=html2wt
26248 !! html/parsoid
26249 <ul>
26250 <li>*foo</li>
26251 <li>#foo</li>
26252 <li>:foo</li>
26253 <li>;foo</li>
26254 <li data-parsoid='{}'>*foo</li>
26255 <li data-parsoid='{}'>#foo</li>
26256 <li data-parsoid='{}'>:foo</li>
26257 <li data-parsoid='{}'>;foo</li>
26258 </ul>
26259
26260 <ol>
26261 <li>*foo</li>
26262 <li>#foo</li>
26263 <li>:foo</li>
26264 <li>;foo</li>
26265 <li data-parsoid='{}'>*foo</li>
26266 <li data-parsoid='{}'>#foo</li>
26267 <li data-parsoid='{}'>:foo</li>
26268 <li data-parsoid='{}'>;foo</li>
26269 </ol>
26270 !! wikitext
26271 * *foo
26272 * #foo
26273 * :foo
26274 * ;foo
26275 *<nowiki>*foo</nowiki>
26276 *<nowiki>#foo</nowiki>
26277 *<nowiki>:foo</nowiki>
26278 *<nowiki>;foo</nowiki>
26279
26280 # *foo
26281 # #foo
26282 # :foo
26283 # ;foo
26284 #<nowiki>*foo</nowiki>
26285 #<nowiki>#foo</nowiki>
26286 #<nowiki>:foo</nowiki>
26287 #<nowiki>;foo</nowiki>
26288 !!end
26289
26290 !! test
26291 Lists: 2. Inside definition lists
26292 !! options
26293 parsoid=html2wt
26294 !! html/parsoid
26295 <dl><dt>;foo</dt></dl>
26296 <dl><dt>:foo</dt></dl>
26297 <dl><dt>:foo</dt>
26298 <dd>bar</dd></dl>
26299 <dl><dd>:foo</dd></dl>
26300 !! wikitext
26301 ; ;foo
26302
26303 ; <nowiki>:foo</nowiki>
26304
26305 ; <nowiki>:foo</nowiki>
26306 : bar
26307
26308 : :foo
26309 !!end
26310
26311 !! test
26312 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26313 !! options
26314 parsoid=html2wt
26315 !! html/parsoid
26316 <ul>
26317 <li>*foo*bar</li>
26318 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26319 </ul>
26320 !! wikitext
26321 * *foo*bar
26322 *<nowiki>*foo</nowiki>''it''*bar
26323 !!end
26324
26325 !! test
26326 Lists: 4. No escapes needed
26327 !! options
26328 parsoid=html2wt
26329 !! html/parsoid
26330 <ul>
26331 <li>foo*bar
26332 </li>
26333 </ul>
26334 <ul>
26335 <li><i>foo</i>*bar
26336 </li>
26337 </ul>
26338 <ul>
26339 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26340 </li>
26341 </ul>
26342 <ul>
26343 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26344 </li>
26345 </ul>
26346 !! wikitext
26347 *foo*bar
26348
26349 *''foo''*bar
26350
26351 *[[Foo]]: bar
26352
26353 *[[Foo]]*bar
26354 !!end
26355
26356 !! test
26357 Lists: 5. No unnecessary escapes
26358 !! options
26359 parsoid=html2wt
26360 !! html/parsoid
26361 <ul><li> bar <span>[[foo]]</span></li></ul>
26362 <ul><li> =bar <span>[[foo]]</span></li></ul>
26363 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26364 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26365 <ul><li> =bar <span>foo]]</span>=</li></ul>
26366 <ul><li> <s></s>: a</li></ul>
26367 <ul><li> <i>* foo</i></li></ul>
26368
26369 !! wikitext
26370 * bar <span><nowiki>[[foo]]</nowiki></span>
26371
26372 * =bar <span><nowiki>[[foo]]</nowiki></span>
26373
26374 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26375
26376 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26377
26378 * =bar <span>foo]]</span>=
26379
26380 * <s></s>: a
26381
26382 * ''* foo''
26383 !!end
26384
26385 !! test
26386 Lists: 6. Escape bullets in SOL position
26387 !! options
26388 parsoid=html2wt
26389 !! html/parsoid
26390 <p><!--cmt-->*foo</p>
26391 !! wikitext
26392 <!--cmt--><nowiki>*</nowiki>foo
26393 !!end
26394
26395 !! test
26396 Lists: 7. Escape bullets in a multi-line context
26397 !! options
26398 parsoid=html2wt
26399 !! html/parsoid
26400 <p>a
26401 *b
26402 </p>
26403 !! wikitext
26404 a
26405 <nowiki>*</nowiki>b
26406 !!end
26407
26408 !! test
26409 Lists: 8. Escape colons only if not present in tags
26410 !! options
26411 parsoid=html2wt
26412 !! html/parsoid
26413 <dl><dt>a:b<i>c:d</i></dt></dl>
26414 !! wikitext
26415 ; <nowiki>a:b</nowiki>''c:d''
26416 !! end
26417
26418 #### --------------- HRs ---------------
26419 #### 1. Single line
26420 #### -----------------------------------
26421
26422 !! test
26423 HRs: 1. Single line
26424 !! options
26425 parsoid=html2wt
26426 !! html/parsoid
26427 <hr />----
26428 <hr />=foo=
26429 <hr />*foo
26430 !! wikitext
26431 ----<nowiki>----</nowiki>
26432 ----=foo=
26433 ----*foo
26434 !! end
26435
26436 #### --------------- Tables ---------------
26437 #### 1a. Simple example
26438 #### 1b. No escaping needed (!foo)
26439 #### 1c. No escaping needed (|foo)
26440 #### 1d. No escaping needed (|}foo)
26441 ####
26442 #### 2a. Nested in td (<td>foo|bar</td>)
26443 #### 2b. Nested in td (<td>foo||bar</td>)
26444 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26445 ####
26446 #### 3a. Nested in th (<th>foo!bar</th>)
26447 #### 3b. Nested in th (<th>foo!!bar</th>)
26448 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26449 ####
26450 #### 4a. Escape -
26451 #### 4b. Escape +
26452 #### 4c. No escaping needed
26453 #### --------------------------------------
26454
26455 !! test
26456 Tables: 1a. Simple example
26457 !! options
26458 parsoid=html2wt
26459 !! html/parsoid
26460 <p>{|
26461 |}
26462 </p>
26463 !! wikitext
26464 <nowiki>{|</nowiki>
26465 |}
26466 !! end
26467
26468 !! test
26469 Tables: 1b. No escaping needed
26470 !! options
26471 parsoid=html2wt
26472 !! html/parsoid
26473 <p>!foo
26474 </p>
26475 !! wikitext
26476 !foo
26477 !! end
26478
26479 !! test
26480 Tables: 1c. No escaping needed
26481 !! options
26482 parsoid=html2wt
26483 !! html/parsoid
26484 <p>|foo
26485 </p>
26486 !! wikitext
26487 |foo
26488 !! end
26489
26490 !! test
26491 Tables: 1d. No escaping needed
26492 !! options
26493 parsoid=html2wt
26494 !! html/parsoid
26495 <p>|}foo
26496 </p>
26497 !! wikitext
26498 |}foo
26499 !! end
26500
26501 !! test
26502 Tables: 2a. Nested in td
26503 !! options
26504 parsoid=html2wt
26505 !! html/parsoid
26506 <table><tbody><tr>
26507 <td>foo|bar</td></tr>
26508 <tr><td>x<div>a|b</div></td>
26509 </tbody></table>
26510 !! wikitext
26511 {|
26512 |<nowiki>foo|bar</nowiki>
26513 |-
26514 |x<div><nowiki>a|b</nowiki></div>
26515 |}
26516 !! html/php+tidy
26517 <table>
26518 <tbody><tr>
26519 <td>foo|bar
26520 </td></tr>
26521 <tr>
26522 <td>x<div>a|b</div>
26523 </td></tr></tbody></table>
26524 !! end
26525
26526 !! test
26527 Tables: 2b. Nested in td
26528 !! options
26529 parsoid=html2wt
26530 !! html/parsoid
26531 <table><tbody><tr>
26532 <td>foo||bar</td>
26533 <td>a<i>b||c</i></td>
26534 <td>a<i><div>b||c</div></i></td>
26535 </tr></tbody></table>
26536 !! wikitext
26537 {|
26538 |<nowiki>foo||bar</nowiki>
26539 |a''<nowiki>b||c</nowiki>''
26540 |a''<div><nowiki>b||c</nowiki></div>''
26541 |}
26542 !! html/php
26543 <table>
26544 <tr>
26545 <td>foo||bar
26546 </td>
26547 <td>a<i>b||c</i>
26548 </td>
26549 <td>a<i><div>b||c</div></i>
26550 </td></tr></table>
26551 !! end
26552
26553 !! test
26554 Tables: 2c. Nested in td -- no escaping needed
26555 !! options
26556 parsoid=html2wt
26557 !! html/*
26558 <table>
26559 <tr>
26560 <td>foo!!bar
26561 </td></tr></table>
26562 !! wikitext
26563 {|
26564 |foo!!bar
26565 |}
26566 !! end
26567
26568 !! test
26569 Tables: 3a. Nested in th
26570 !! options
26571 parsoid=html2wt
26572 !! html/*
26573 <table>
26574 <tr>
26575 <th>foo!bar
26576 </th></tr></table>
26577 !! wikitext
26578 {|
26579 !foo!bar
26580 |}
26581 !! end
26582
26583 !! test
26584 Tables: 3b. Nested in th
26585 !! options
26586 parsoid=html2wt
26587 !! html/parsoid
26588 <table><tbody>
26589 <tr><th>foo!!bar</th>
26590 <th><i>foo|bar</i></th>
26591 <th><i>foo!!bar</i></th>
26592 <th><i><span>foo!!bar</span></i></th>
26593 </tr></tbody></table>
26594 !! wikitext
26595 {|
26596 !<nowiki>foo!!bar</nowiki>
26597 !''<nowiki>foo|bar</nowiki>''
26598 !''<nowiki>foo!!bar</nowiki>''
26599 !''<span><nowiki>foo!!bar</nowiki></span>''
26600 |}
26601 !! html/php
26602 <table>
26603 <tr>
26604 <th>foo!!bar
26605 </th>
26606 <th><i>foo|bar</i>
26607 </th>
26608 <th><i>foo!!bar</i>
26609 </th>
26610 <th><i><span>foo!!bar</span></i>
26611 </th></tr></table>
26612 !! end
26613
26614 !! test
26615 Tables: 3c. Nested in th
26616 !! options
26617 parsoid=html2wt
26618 !! html/parsoid
26619 <table><tbody>
26620 <tr><th>foo||bar</th>
26621 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26622 </tr></tbody></table>
26623 !! wikitext
26624 {|
26625 !<nowiki>foo||bar</nowiki>
26626 !<nowiki>foo||bar</nowiki>
26627 |}
26628 !! html/php
26629 <table>
26630 <tr>
26631 <th>foo||bar
26632 </th>
26633 <th>foo||bar
26634 </th></tr></table>
26635 !! end
26636
26637 !! test
26638 Tables: 4a. Escape -
26639 !! options
26640 parsoid=html2wt
26641 !! html/*
26642 <table>
26643 <tr>
26644 <th>-bar
26645 </th></tr>
26646 <tr>
26647 <td>-bar
26648 </td></tr></table>
26649 !! wikitext
26650 {|
26651 !-bar
26652 |-
26653 |<nowiki>-bar</nowiki>
26654 |}
26655 !! end
26656
26657 !! test
26658 Tables: 4b. Escape +
26659 !! options
26660 parsoid=html2wt
26661 !! html/*
26662 <table>
26663 <tr>
26664 <th>+bar
26665 </th></tr>
26666 <tr>
26667 <td>+bar
26668 </td></tr></table>
26669 !! wikitext
26670 {|
26671 !+bar
26672 |-
26673 |<nowiki>+bar</nowiki>
26674 |}
26675 !! end
26676
26677 !! test
26678 Tables: 4c. No escaping needed
26679 !! options
26680 parsoid=html2wt
26681 !! html/parsoid
26682 <table><tbody>
26683 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26684 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26685 <tr><td>foo
26686 <p>bar|baz
26687 +bar
26688 -bar</p></td></tr>
26689 <tr><td>x
26690 <div>a|b</div></td>
26691 </tbody></table>
26692 !! wikitext
26693 {|
26694 |foo-bar
26695 |foo+bar
26696 |-
26697 |''foo''-bar
26698 |''foo''+bar
26699 |-
26700 |foo
26701 bar|baz
26702 +bar
26703 -bar
26704 |-
26705 |x
26706 <div>a|b</div>
26707 |}
26708 !! html/php
26709 <table>
26710 <tr>
26711 <td>foo-bar
26712 </td>
26713 <td>foo+bar
26714 </td></tr>
26715 <tr>
26716 <td><i>foo</i>-bar
26717 </td>
26718 <td><i>foo</i>+bar
26719 </td></tr>
26720 <tr>
26721 <td>foo
26722 <p>bar|baz
26723 +bar
26724 -bar
26725 </p>
26726 </td></tr>
26727 <tr>
26728 <td>x
26729 <div>a|b</div>
26730 </td></tr></table>
26731 !! end
26732
26733 !! test
26734 Tables: 4d. No escaping needed
26735 !! options
26736 parsoid=html2wt
26737 !! html/parsoid
26738 <table>
26739 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26740 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26741 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26742 </tbody></table>
26743 !! wikitext
26744 {|
26745 |[[Foo]]-bar
26746 ||+1
26747 ||-2
26748 |}
26749 !! html/php
26750 <table>
26751 <tr>
26752 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26753 </td>
26754 <td>+1
26755 </td>
26756 <td>-2
26757 </td></tr></table>
26758 !! end
26759
26760 !! test
26761 Tables: 4e. Escape }
26762 !! options
26763 parsoid=html2wt
26764 !! html/parsoid
26765 <table>
26766 <tr><td>}</td></tr>
26767 <tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table>
26768 </table>
26769 !! wikitext
26770 {|
26771 |<nowiki>}</nowiki>
26772 |-
26773 |x||}
26774 |}
26775 !! html/php
26776 <table>
26777 <tr>
26778 <td>}
26779 </td></tr>
26780 <tr>
26781 <td>x</td>
26782 <td>}
26783 </td></tr></table>
26784 !! end
26785
26786 !! test
26787 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26788 !! options
26789 parsoid=html2wt
26790 !! html/parsoid
26791 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26792
26793 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26794
26795 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26796
26797 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26798 !! wikitext
26799 {|
26800 | || align="center" | ||
26801 |}
26802
26803 {|
26804 |
26805 | align="center" |
26806 |
26807 |}
26808
26809 {|
26810 | {{!}}{{!}} align="center" | ||
26811 |}
26812
26813 {|
26814 ! !! align="center" | !!
26815 |}
26816 !! html/php+tidy
26817 <table>
26818 <tbody><tr>
26819 <td></td>
26820 <td align="center"></td>
26821 <td>
26822 </td></tr></tbody></table>
26823 <table>
26824 <tbody><tr>
26825 <td>
26826 </td>
26827 <td align="center">
26828 </td>
26829 <td>
26830 </td></tr></tbody></table>
26831 <table>
26832 <tbody><tr>
26833 <td></td>
26834 <td align="center"></td>
26835 <td>
26836 </td></tr></tbody></table>
26837 <table>
26838 <tbody><tr>
26839 <th></th>
26840 <th align="center"></th>
26841 <th>
26842 </th></tr></tbody></table>
26843 !! end
26844
26845 !! test
26846 T97430: Don't emit empty nowiki pairs around marker meta tags
26847 !! options
26848 parsoid=html2wt
26849 !! html/parsoid
26850 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26851 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26852 !! wikitext
26853 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26854 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26855 !! end
26856
26857 !! test
26858 Unclosed xmlish element in table line shouldn't eat end delimiters
26859 !! options
26860 parsoid=html2wt
26861 !! html/parsoid
26862 <table>
26863 <tbody><tr><td> &lt;foo</td>
26864 <td> bar></td></tr>
26865 </tbody></table>
26866 !! wikitext
26867 {|
26868 | <foo
26869 | bar>
26870 |}
26871 !! html/php
26872 <table>
26873 <tr>
26874 <td>&lt;foo
26875 </td>
26876 <td>bar&gt;
26877 </td></tr></table>
26878 !! end
26879
26880 #### --------------- Links ----------------
26881 #### 1. Quote marks in link text
26882 #### 2. Wikilinks: Escapes needed
26883 #### 3. Wikilinks: No escapes needed
26884 #### 4. Extlinks: Escapes needed
26885 #### 5. Extlinks: No escapes needed
26886 #### --------------------------------------
26887 !! test
26888 Links 1. WikiLinks: No escapes needed
26889 !! options
26890 parsoid=html2wt
26891 !! html/parsoid
26892 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26893 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26894 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26895 !! wikitext
26896 [[Foo|Foo''boo'']]
26897 [[Foo|[Foobar]]]
26898 [[Foo|x [Foobar] x]]
26899 !! html/php
26900 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26901 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26902 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26903 </p>
26904 !! end
26905
26906 !! test
26907 Links 2. WikiLinks: Escapes needed
26908 !! options
26909 parsoid=html2wt
26910 !! html/parsoid
26911 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26912 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26913 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26914 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26915 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26916 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26917 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26918 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26919 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26920 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26921 !! wikitext
26922 [[Foo|<nowiki>Foobar]</nowiki>]]
26923 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26924 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26925 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26926 [[Foo||Bar]]
26927 [[Foo|<nowiki>]]bar</nowiki>]]
26928 [[Foo|<nowiki>[[bar</nowiki>]]
26929 [[Foo|<nowiki>x [[ y</nowiki>]]
26930 [[Foo|<nowiki>x ]] y</nowiki>]]
26931 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26932 !! html/php
26933 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26934 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26935 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26936 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26937 <a href="/wiki/Foo" title="Foo">|Bar</a>
26938 <a href="/wiki/Foo" title="Foo">]]bar</a>
26939 <a href="/wiki/Foo" title="Foo">[[bar</a>
26940 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26941 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26942 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26943 </p>
26944 !! end
26945
26946 !! test
26947 Links 3. WikiLinks: No escapes needed
26948 !! options
26949 parsoid=html2wt
26950 !! html/parsoid
26951 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26952 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26953 !! wikitext
26954 [[Foo|[Foobar]]
26955 [[Foo|foo|bar]]
26956 !! html/php
26957 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26958 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26959 </p>
26960 !! end
26961
26962 !! test
26963 Links 4. ExtLinks: Escapes needed
26964 !! options
26965 parsoid=html2wt
26966 !! html/parsoid
26967 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26968 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26969 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26970 <p>[http://google.com]</p>
26971 <p>[http://google.com google]</p>
26972 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26973 <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>
26974 !! wikitext
26975 [http://google.com <nowiki>[google]</nowiki>]
26976 [http://google.com <nowiki>google]</nowiki>]
26977 [http://google.com <nowiki>goog] le</nowiki>]
26978
26979 <nowiki>[http://google.com]</nowiki>
26980
26981 <nowiki>[http://google.com google]</nowiki>
26982
26983 [http://google.com<nowiki>]</nowiki>
26984
26985 [{{echo|http://google.com}}<nowiki>]</nowiki>
26986 !! html/php
26987 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26988 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26989 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26990 </p><p>[http://google.com]
26991 </p><p>[http://google.com google]
26992 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26993 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26994 </p>
26995 !! end
26996
26997 !! test
26998 Links 5. ExtLinks: No escapes needed
26999 !! options
27000 parsoid=html2wt
27001 !! html/parsoid
27002 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
27003 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
27004 !! wikitext
27005 [http://google.com [google]
27006
27007 [[http://google.com]]
27008 !! html/php
27009 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
27010 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
27011 </p>
27012 !! end
27013
27014 !! test
27015 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
27016 !! options
27017 parsoid=html2wt
27018 !! html/parsoid
27019 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
27020 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
27021 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
27022 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
27023 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
27024 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
27025 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27026 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
27027 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27028 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
27029 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
27030 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
27031 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
27032 </p>
27033 !! wikitext
27034 x<nowiki/>http://example.com<nowiki/>y
27035 http://example.com<nowiki/>?x
27036 http://example.com<nowiki/>&x
27037 http://example.com<nowiki/>'x
27038 http://example.com<nowiki/>,x
27039 http://example.com<nowiki/>.x
27040 http://example.com<nowiki/>;x
27041 http://example.com<nowiki/>:x
27042 http://example.com<nowiki/>;x
27043 http://example.com<nowiki/>!x
27044 http://example.com<nowiki/>=x
27045 http://example.com<nowiki/>(x)
27046 http://example.com(x<nowiki/>)
27047 !! end
27048
27049 !! test
27050 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27051 !! options
27052 parsoid=html2wt
27053 !! html/parsoid
27054 <p>x
27055 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
27056 y
27057 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
27058 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
27059 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
27060 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
27061 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
27062 </p>
27063 !! wikitext
27064 x
27065 http://example.com
27066 y
27067 "http://example.com"
27068 (http://example.com)
27069 (http://example.com) foo
27070 http://example.com,
27071 http://example.com, foo
27072 !! html/php
27073 <p>x
27074 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
27075 y
27076 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
27077 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
27078 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
27079 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
27080 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
27081 </p>
27082 !! end
27083
27084 !! test
27085 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27086 !! options
27087 parsoid=html2wt
27088 !! html/parsoid
27089 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
27090 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
27091 !! wikitext
27092 http://example.com.,;:!?\
27093 -http://example.com:
27094 !! html/php
27095 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
27096 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
27097 </p>
27098 !! end
27099
27100 !! test
27101 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
27102 !! options
27103 parsoid=html2wt
27104 !! html/parsoid
27105 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
27106 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
27107 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
27108 !! wikitext
27109 RFC 123<nowiki/>4
27110 RFC 123<nowiki/>y
27111 X<nowiki/>RFC 123<nowiki/>y
27112 !! end
27113
27114 !! test
27115 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
27116 !! options
27117 parsoid=html2wt
27118 !! html/parsoid
27119 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
27120 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
27121 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
27122 </p>
27123 !! wikitext
27124 RFC 123?foo
27125 RFC 123&foo
27126 -RFC 123-
27127 !! html/php
27128 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
27129 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
27130 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
27131 </p>
27132 !! end
27133
27134 !! test
27135 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27136 !! options
27137 parsoid=html2wt
27138 !! html/parsoid
27139 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27140 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27141 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27142 !! wikitext
27143 PMID 123<nowiki/>4
27144 PMID 123<nowiki/>y
27145 X<nowiki/>PMID 123<nowiki/>y
27146 !! end
27147
27148 !! test
27149 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27150 !! options
27151 parsoid=html2wt
27152 !! html/parsoid
27153 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27154 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27155 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27156 </p>
27157 !! wikitext
27158 PMID 123?foo
27159 PMID 123&foo
27160 -PMID 123-
27161 !! html/php
27162 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27163 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27164 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27165 </p>
27166 !! end
27167
27168 !! test
27169 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27170 !! options
27171 parsoid=html2wt
27172 !! html/parsoid
27173 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27174 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27175 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27176 </p>
27177 !! wikitext
27178 ISBN 1234567890<nowiki/>1
27179 ISBN 1234567890<nowiki/>x
27180 a<nowiki/>ISBN 1234567890<nowiki/>b
27181 !! end
27182
27183 !! test
27184 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27185 !! options
27186 parsoid=html2wt
27187 !! html/parsoid
27188 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27189 !! wikitext
27190 -ISBN 1234567890's
27191 !! html/php
27192 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27193 </p>
27194 !! end
27195
27196 !! test
27197 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27198 !! options
27199 parsoid=html2wt
27200 !! html/*
27201 <p>this is not a link: http://example.com
27202 </p>
27203 !! wikitext
27204 this is not a link: <nowiki>http://example.com</nowiki>
27205 !! end
27206
27207 !! test
27208 Links 15. Link trails can't become link prefixes.
27209 !! options
27210 language=is
27211 parsoid=html2wt
27212 !! html/parsoid
27213 <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>
27214 !! wikitext
27215 [[Söfnuður]]-[[00]]
27216 !! html/php
27217 <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>
27218 </p>
27219 !! end
27220
27221 #### --------------- Quotes ---------------
27222 #### 1. Quotes inside <b> and <i>
27223 #### 2. Link fragments separated by <i> and <b> tags
27224 #### 3. Link fragments inside <i> and <b>
27225 #### 4. No escaping needed
27226 #### --------------------------------------
27227 !! test
27228 1a. Quotes inside <b> and <i>
27229 !! options
27230 parsoid=html2wt
27231 !! html/*
27232 <p><i>'foo'</i>
27233 <i>''foo''</i>
27234 <i>'''foo'''</i>
27235 <i>foo</i>'s
27236 <b>'foo'</b>
27237 <b>''foo''</b>
27238 <b>'''foo'''</b>
27239 <b>foo'<i>bar'</i>baz</b>
27240 <b>foo</b>'s
27241 '<i>foo</i>
27242 <i>foo</i>'
27243 <i>foo'</i>'
27244 '<i>foo</i>'
27245 '<b>foo</b>
27246 <b>foo</b>'
27247 '<b>foo</b>'
27248 <i>fools'<span> errand</span></i>
27249 <i><span>fool</span>'s errand</i>
27250 '<i>foo</i> bar '<i>baz</i>
27251 a|!*#-:;+-~[]{}b'<i>x</i>
27252 </p>
27253 !! wikitext
27254 ''<nowiki/>'foo'''
27255 ''<nowiki>''foo''</nowiki>''
27256 ''<nowiki>'''foo'''</nowiki>''
27257 ''foo''<nowiki/>'s
27258 '''<nowiki/>'foo''''
27259 '''<nowiki>''foo''</nowiki>'''
27260 '''<nowiki>'''foo'''</nowiki>'''
27261 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27262 '''foo'''<nowiki/>'s
27263 '''foo''
27264 ''foo''<nowiki/>'
27265 ''foo'''<nowiki/>'
27266 '''foo''<nowiki/>'
27267 ''''foo'''
27268 '''foo'''<nowiki/>'
27269 ''''foo'''<nowiki/>'
27270 ''fools'<span> errand</span>''
27271 ''<span>fool</span>'s errand''
27272 '<nowiki/>''foo'' bar '''baz''
27273 a|!*#-:;+-~[]{}b'''x''
27274 !! end
27275
27276 !! test
27277 1b. Quotes inside <b> and <i> with other tags on same line
27278 !! options
27279 parsoid=html2wt
27280 !! html/parsoid
27281 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27282 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27283 <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>
27284 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27285 '<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>
27286 '<i>foo</i> <div title="name">test</div>
27287 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27288 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27289 <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>
27290 </ol>
27291 !! wikitext
27292 '''a'' foo ''[[bar]]''
27293 ''a''' foo ''[[bar]]''
27294 ''a''' foo '''{{echo|[[bar]]}}'''
27295 [[foo]] x'''[[bar]]''
27296 '''foo'' <ref>test</ref>
27297 '''foo'' <div title="name">test</div>
27298 '''foo'' and <br> bar
27299 <references />
27300 !! end
27301
27302 !! test
27303 2. Link fragments separated by <i> and <b> tags
27304 !! options
27305 parsoid=html2wt
27306 !! html/parsoid
27307 <p>[[<i>foo</i>hello]]</p>
27308 <p>[[<b>foo</b>hello]]</p>
27309 !! wikitext
27310 [[''foo''<nowiki>hello]]</nowiki>
27311
27312 [['''foo'''<nowiki>hello]]</nowiki>
27313 !! end
27314
27315 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27316 # this is one of the shortcomings of this format
27317 !! test
27318 3. Link fragments inside <i> and <b>
27319 !! options
27320 parsoid=html2wt
27321 !! html/parsoid
27322 <p><i>[[foo</i>]]</p>
27323 <p><b>[[foo</b>]]</p>
27324 !! wikitext
27325 ''[[foo''<nowiki>]]</nowiki>
27326
27327 '''[[foo'''<nowiki>]]</nowiki>
27328 !! end
27329
27330 !! test
27331 4. No escaping needed
27332 !! options
27333 parsoid=html2wt
27334 !! html/parsoid
27335 <p>'<span><i>bar</i></span>'
27336 '<span><b>bar</b></span>'
27337 'a:b'foo
27338 </p>
27339 !! wikitext
27340 '<span>''bar''</span>'
27341 '<span>'''bar'''</span>'
27342 'a:b'foo
27343 !! end
27344
27345 #### ----------- Paragraphs ---------------
27346 #### 1. No unnecessary escapes
27347 #### --------------------------------------
27348
27349 !! test
27350 1. No unnecessary escapes
27351 !! options
27352 parsoid=html2wt
27353 !! html/parsoid
27354 <p>bar <span>[[foo]]</span>
27355 </p><p>=bar <span>[[foo]]</span>
27356 </p><p>[[bar <span>[[foo]]</span>
27357 </p><p>]]bar <span>[[foo]]</span>
27358 </p><p>=bar <span>foo]]</span>=
27359 </p>
27360 !! wikitext
27361 bar <span><nowiki>[[foo]]</nowiki></span>
27362
27363 =bar <span><nowiki>[[foo]]</nowiki></span>
27364
27365 [[bar <span><nowiki>[[foo]]</nowiki></span>
27366
27367 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27368
27369 =bar <span>foo]]</span><nowiki>=</nowiki>
27370 !!end
27371
27372 #### ----------------------- PRE --------------------------
27373 !! test
27374 1. Leading whitespace in SOL context should be escaped
27375 !! options
27376 parsoid=html2wt
27377 !! html/parsoid
27378 <p> a</p>
27379
27380 <p> a</p>
27381
27382 <p> a(tab)</p>
27383
27384 <p> a
27385 <!--cmt-->
27386 a</p>
27387
27388 <p>a
27389 b</p>
27390
27391 <p>a
27392 b</p>
27393
27394 <p>a
27395 b</p>
27396 !! wikitext
27397 <nowiki> </nowiki>a
27398
27399 <nowiki> </nowiki> a
27400
27401 a(tab)
27402
27403 <nowiki> </nowiki> a
27404 <!--cmt-->
27405 <nowiki> </nowiki>a
27406
27407 a
27408 <nowiki> </nowiki>b
27409
27410 a
27411 b
27412
27413 a
27414 b
27415 !! html/php
27416 <p> a
27417 </p><p> a
27418 </p><p> a(tab)
27419 </p><p> a
27420 a
27421 </p><p>a
27422 b
27423 </p><p>a
27424 b
27425 </p><p>a
27426 b
27427 </p>
27428 !! end
27429
27430 !! test
27431 2. Leading whitespace in non-indent-pre contexts should not be escaped
27432 !! options
27433 parsoid=html2wt
27434 !! html/parsoid
27435 <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>
27436 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27437 <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>
27438 b</span></li>
27439 </ol>
27440 !! wikitext
27441 foo <ref>''a''
27442 b</ref>
27443 <references />
27444 !! end
27445
27446 !! test
27447 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27448 !! options
27449 parsoid=html2wt
27450 !! html/parsoid
27451 <blockquote>
27452 <p>
27453 a
27454 <span>b</span>
27455 c</p>
27456 </blockquote>
27457 !! wikitext
27458 <blockquote>
27459 a
27460 <span>b</span>
27461 c
27462 </blockquote>
27463 !! end
27464
27465 !! test
27466 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27467 !! options
27468 parsoid=html2wt
27469 !! html/parsoid
27470 <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>
27471 !! wikitext
27472 [[File:Foobar.jpg|thumb|caption]]
27473 !! end
27474
27475 !! test
27476 5. Nowiki escaping should account for indent-pres
27477 !! options
27478 parsoid=html2wt
27479 !! html/parsoid
27480 <pre>==foo==</pre>
27481 !! wikitext
27482 ==foo==
27483 !! end
27484
27485 !! test
27486 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27487 !! options
27488 parsoid=html2wt
27489 !! html/parsoid
27490 <pre>
27491 * foo
27492 * bar
27493 </pre>
27494 !! wikitext
27495 * foo
27496 * bar
27497 !! end
27498
27499 !! test
27500 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27501 !! options
27502 parsoid = {
27503 "modes": ["html2wt"],
27504 "scrubWikitext": true
27505 }
27506 !! html/parsoid
27507 <p> foo</p>
27508 <p> %foo</p>
27509 <p> *foo</p>
27510 <p> #foo</p>
27511 <p> =foo=</p>
27512 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27513 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27514 <p> <!--boo-->*foo</p>
27515 <p><!--boo--> *foo</p>
27516 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27517 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27518 !! wikitext
27519 foo
27520
27521 %foo
27522
27523 <nowiki/>*foo
27524
27525 <nowiki/>#foo
27526
27527 <nowiki/>=foo=
27528
27529 [[Category:Foo]]
27530 <nowiki/>*foo
27531
27532 [[Category:Foo]]
27533 <nowiki>*</nowiki>foo
27534
27535 <nowiki/><!--boo-->*foo
27536
27537 <!--boo--><nowiki/>*foo
27538
27539 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27540
27541 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27542 !! end
27543
27544 #### --------------- Behavior Switches --------------------
27545
27546 !! test
27547 1. Valid behavior switches should be escaped
27548 !! options
27549 parsoid=html2wt
27550 !! html/parsoid
27551 __TOC__
27552 <i>__TOC__</i>
27553 !! wikitext
27554 <nowiki>__TOC__</nowiki>
27555 ''<nowiki>__TOC__</nowiki>''
27556 !! end
27557
27558 !! test
27559 2. Invalid behavior switches should not be escaped
27560 !! options
27561 parsoid=html2wt
27562 !! html/parsoid
27563 __TOO__
27564 __|__
27565 !! wikitext
27566 __TOO__
27567 __|__
27568 !! end
27569
27570 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27571 !! test
27572 Behavior switches should be SOL-transparent
27573 !! options
27574 parsoid=html2wt
27575 !! html/parsoid
27576 <meta property="mw:PageProp/toc" />
27577
27578 <!-- this one's bogus -->
27579 <pre>__TOO__</pre>
27580
27581 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27582
27583 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27584 !! wikitext
27585 __TOC__
27586
27587 <!-- this one's bogus -->
27588 __TOO__
27589
27590 __TOC__ foo
27591
27592 __TOC__
27593 bar
27594 !! end
27595
27596 #### --------------- HTML tags ---------------
27597 #### 1. a tags
27598 #### 2. other tags
27599 #### 3. multi-line html tag
27600 #### 4. extension tags
27601 #### -----------------------------------------
27602 !! test
27603 1. a tags
27604 !! options
27605 parsoid=html2wt
27606 !! html/parsoid
27607 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27608 !! wikitext
27609 <a href="http://google.com">google</a>
27610 !! end
27611
27612 !! test
27613 2. other tags
27614 !! options
27615 parsoid=html2wt
27616 !! html/parsoid
27617 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27618 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27619 <li> &lt;td&gt;</li></ul>
27620
27621 !! wikitext
27622 * <nowiki><div>foo</div></nowiki>
27623 * <nowiki><div style="color:red">foo</div></nowiki>
27624 * <nowiki><td></nowiki>
27625 !! end
27626
27627 !! test
27628 3. multi-line html tag
27629 !! options
27630 parsoid=html2wt
27631 !! html/parsoid
27632 <p>&lt;div
27633 &gt;foo&lt;/div
27634 &gt;
27635 </p>
27636 !! wikitext
27637 <nowiki><div
27638 >foo</div
27639 ></nowiki>
27640 !! end
27641
27642 !! test
27643 4. extension tags
27644 !! options
27645 parsoid=html2wt
27646 !! html/parsoid
27647 <p>&lt;ref&gt;foo&lt;/ref&gt;
27648 </p><p>&lt;ref&gt;bar
27649 </p><p>baz&lt;/ref&gt;
27650 </p>
27651 !! wikitext
27652 <nowiki><ref>foo</ref></nowiki>
27653
27654 <nowiki><ref>bar</nowiki>
27655
27656 baz<nowiki></ref></nowiki>
27657 !! end
27658
27659 !! test
27660 Parsoid: newline inducing block nodes don't suppress <nowiki>
27661 !! options
27662 parsoid=html2wt
27663 !! html/parsoid
27664 a<h1>foo</h1>
27665 !! wikitext
27666 <nowiki> </nowiki>a
27667
27668 = foo =
27669 !! end
27670
27671 #### --------------- Others ---------------
27672 !! test
27673 Escaping nowikis
27674 !! options
27675 parsoid=html2wt
27676 !! html/parsoid
27677 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27678 </p>
27679 !! wikitext
27680 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27681 !! end
27682
27683 ## The quote-char in the input is necessary for triggering the bug
27684 !! test
27685 (T54035) Nowiki-escaping should not get tripped by " :" in text
27686 !! options
27687 parsoid=html2wt
27688 !! html/parsoid
27689 <p>foo's bar :</p>
27690 !! wikitext
27691 foo's bar :
27692 !! end
27693
27694 #----------- End of wikitext escaping tests --------------
27695
27696 !! test
27697
27698 Tag-like HTML structures are passed through as text
27699 !! wikitext
27700 <x y>
27701
27702 <x.y>
27703
27704 <x-y>
27705
27706 1>2
27707
27708 x<y
27709
27710 a>b
27711
27712 1<d e>f
27713 !! html
27714 <p>&lt;x y&gt;
27715 </p><p>&lt;x.y&gt;
27716 </p><p>&lt;x-y&gt;
27717 </p><p>1&gt;2
27718 </p><p>x&lt;y
27719 </p><p>a&gt;b
27720 </p><p>1&lt;d e&gt;f
27721 </p>
27722 !! end
27723
27724 !! test
27725 HTML tag with necessary entities in attributes
27726 !! wikitext
27727 <span title="&amp;amp;">foo</span>
27728 !! html
27729 <p><span title="&amp;amp;">foo</span>
27730 </p>
27731 !! end
27732
27733 !! test
27734 HTML tag with 'unnecessary' entity encoding in attributes
27735 !! wikitext
27736 <span title="&amp;">foo</span>
27737 !! html
27738 <p><span title="&amp;">foo</span>
27739 </p>
27740 !! end
27741
27742 !! test
27743 HTML tag with broken attribute value quoting
27744 !! options
27745 parsoid=wt2html,html2html
27746 !! wikitext
27747 <span title="Hello world>Foo</span>
27748 !! html/php
27749 <p><span title="Hello world">Foo</span>
27750 </p>
27751 !! html/parsoid
27752 <p><span title="Hello world">Foo</span></p>
27753 !! end
27754
27755 !! test
27756 Self-closed tag with broken attribute value quoting
27757 !! options
27758 parsoid=wt2html,html2html
27759 !! wikitext
27760 <div title="Hello world />Foo
27761 !! html/php+tidy
27762 <div title="Hello world"></div><p>Foo</p>
27763 !! html/parsoid
27764 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27765 !! end
27766
27767 !! test
27768 Table with broken attribute value quoting
27769 !! options
27770 parsoid=wt2html,html2html
27771 !! wikitext
27772 {|
27773 | title="Hello world|Foo
27774 |}
27775 !! html/php
27776 <table>
27777 <tr>
27778 <td title="Hello world">Foo
27779 </td></tr></table>
27780 !! html/parsoid
27781 <table>
27782 <tr>
27783 <td title="Hello world">Foo
27784 </td></tr></table>
27785 !! end
27786
27787 !! test
27788 Table with broken attribute value quoting on consecutive lines
27789 !! options
27790 parsoid=wt2html,html2html
27791 !! wikitext
27792 {|
27793 | title="Hello world|Foo
27794 | style="color:red|Bar
27795 |}
27796 !! html/php
27797 <table>
27798 <tr>
27799 <td title="Hello world">Foo
27800 </td>
27801 <td style="color:red">Bar
27802 </td></tr></table>
27803 !! html/parsoid
27804 <table><tbody>
27805 <tr>
27806 <td title="Hello world">Foo
27807 </td><td style="color: red">Bar
27808 </td></tr></tbody></table>
27809 !! end
27810
27811 !!test
27812 Accept empty td cell attribute
27813 !! wikitext
27814 {|
27815 | align="center" |foo|| |
27816 |}
27817 !! html
27818 <table>
27819 <tr>
27820 <td align="center">foo</td>
27821 <td>
27822 </td></tr></table>
27823 !! end
27824
27825 !!test
27826 Non-empty attributes in th-cells
27827 !! wikitext
27828 {|
27829 !Foo!! style="color: red" |Bar
27830 |}
27831 !! html
27832 <table>
27833 <tr>
27834 <th>Foo</th>
27835 <th style="color: red">Bar
27836 </th></tr></table>
27837 !! end
27838
27839 !!test
27840 Accept empty attributes in th-cells
27841 !! wikitext
27842 {|
27843 !|foo!!|bar
27844 |}
27845 !! html
27846 <table>
27847 <tr>
27848 <th>foo</th>
27849 <th>bar
27850 </th></tr></table>
27851 !! end
27852
27853 !!test
27854 Empty table rows go away
27855 !! wikitext
27856 {|
27857 |Hello
27858 |there
27859 |- class="foo"
27860 |-
27861 |}
27862 !! html
27863 <table>
27864 <tr>
27865 <td>Hello
27866 </td>
27867 <td>there
27868 </td></tr>
27869
27870 </table>
27871 !! end
27872
27873 ###
27874 ### Parsoid-centric tests for testing RTing of inter-element separators
27875 ### Edge cases not tested by existing parser tests and specific to
27876 ### Parsoid-specific serialization strategies.
27877 ###
27878
27879 !!test
27880 RT-ed inter-element separators should be valid separators
27881 !! wikitext
27882 {|
27883 |- [[foo]]
27884 |}
27885 !! html/php
27886 <table>
27887
27888 </table>
27889 !! html/parsoid
27890 <table>
27891 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27892 </tbody></table>
27893 !!end
27894
27895 # Parsoid-only test of a DOM pass
27896 !!test
27897 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27898 !! wikitext
27899 {|
27900 |<small>foo
27901 bar
27902 |}
27903
27904 {|
27905 |<small>foo<small>
27906 |}
27907 !! html/parsoid
27908 <table>
27909 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27910 <p>bar</p></small></td></tr>
27911 </tbody></table>
27912
27913 <table>
27914 <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>
27915 </tbody></table>
27916 !!end
27917
27918 # Note that the "style" attribute is really a template parameter here.
27919 # The = would have to be {{=}} if you wanted the literal.
27920 !!test
27921 Empty TD followed by TD with tpl-generated attribute
27922 !! wikitext
27923 {|
27924 |-
27925 |
27926 |{{echo|style='color:red'}}|foo
27927 |}
27928 !! html
27929 <table>
27930
27931 <tr>
27932 <td>
27933 </td>
27934 <td>foo
27935 </td></tr></table>
27936 !! end
27937
27938 !!test
27939 Indented table with an empty td
27940 !! wikitext
27941 {|
27942 |-
27943 |
27944 |foo
27945 |}
27946 !! html
27947 <table>
27948
27949 <tr>
27950 <td>
27951 </td>
27952 <td>foo
27953 </td></tr></table>
27954 !! end
27955
27956 !! test
27957 Indented table with blank lines in between (T85627)
27958 !! wikitext
27959 {|
27960 |foo
27961
27962
27963 |}
27964 !! html/php
27965 <table>
27966 <tr>
27967 <td>foo
27968 <p><br />
27969 </p>
27970 </td></tr></table>
27971 !! html/parsoid
27972 <table>
27973 <tbody><tr><td>foo
27974 <p>
27975 <br /></p></td></tr>
27976 </tbody></table>
27977 !! end
27978
27979 !!test
27980 Indented block & table
27981 !! wikitext
27982 <div>foo</div>
27983 {|
27984 |foo
27985 |}
27986 !! html/php
27987 <div>foo</div>
27988 <table>
27989 <tr>
27990 <td>foo
27991 </td></tr></table>
27992 !! html/parsoid
27993 <div data-parsoid='{"stx":"html"}'>foo</div>
27994 <table><tbody>
27995 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27996 </tbody></table>
27997 !!end
27998
27999 !! test
28000 Indent and comment before table row
28001 !! wikitext
28002 {|
28003 <!--hi-->|-
28004 |there
28005 |}
28006 !! html/php
28007 <table>
28008
28009 <tr>
28010 <td>there
28011 </td></tr></table>
28012 !! html/parsoid
28013 <table>
28014 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
28015 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
28016 </tbody></table>
28017 !! end
28018
28019 # PHP parser omits empty TR
28020 !!test
28021 Empty TR followed by a template-generated TR
28022 !! wikitext
28023 {|
28024 |-
28025 {{echo|<tr><td>foo</td></tr>}}
28026 |}
28027 !! html/php+tidy
28028 <table>
28029
28030 <tbody><tr><td>foo</td></tr>
28031 </tbody></table>
28032 !! html/parsoid
28033 <table>
28034 <tbody>
28035 <tr class='mw-empty-elt'></tr>
28036 <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}}]}'>
28037 <td>foo</td></tr>
28038 </tbody></table>
28039 !!end
28040
28041 ## PHP and parsoid output differ for this; as usual PHP omits empty
28042 ## elements, and since it strips the comments the TR is empty.
28043 !!test
28044 Empty TR followed by mixed-ws-comment line should RT correctly
28045 !! wikitext
28046 {|
28047 |-
28048 <!--c-->
28049 |-
28050 <!--c--> <!--d-->
28051 |}
28052 !! html/php+tidy
28053 <table>
28054
28055
28056 </table>
28057 !! html/parsoid
28058 <table>
28059 <tbody>
28060 <tr class='mw-empty-elt'></tr>
28061 <!--c-->
28062 <tr>
28063 <!--c--> </tr><!--d-->
28064 </tbody></table>
28065 !! end
28066
28067 !!test
28068 Multi-line image caption generated by templates with/without trailing newlines
28069 !! wikitext
28070 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
28071 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
28072 !! html/parsoid
28073 <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>
28074 <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>
28075 !!end
28076
28077 !! test
28078 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
28079 !! options
28080 parsoid=html2wt
28081 !! html/parsoid
28082 <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>
28083
28084 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
28085 !! wikitext
28086 <includeonly>foo</includeonly>
28087 new para
28088
28089 [[Category:Foo]]
28090
28091 = new heading =
28092 !! end
28093
28094 ## PHP emits broken html for this, and since this is primarily
28095 ## a Parsoid serializer test, marking this Parsoid only
28096 !!test
28097 Improperly nested inline or quotes tags with whitespace in between
28098 !! wikitext
28099 <span> <s>x</span> </s>
28100 ''' ''x''' ''
28101 !! html/parsoid
28102 <p><span> <s>x</s></span><s> </s>
28103 <b> <i>x</i></b><i> </i>
28104 </p>
28105 !!end
28106
28107 !!test
28108 Encapsulate protected attributes from wt
28109 !! wikitext
28110 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
28111
28112 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
28113 |ok
28114 |}
28115 !! html/parsoid
28116 <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>
28117
28118 <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">
28119 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
28120 </tbody></table>
28121 !!end
28122
28123 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28124 ## Having nested or stray pre tags results in the attempt to add duplicates,
28125 ## causing an assertion fail. This test tries to prevent that situation.
28126 !! test
28127 Ensure ParagraphWrapper can deal with stray closing pre tags
28128 !! options
28129 parsoid=wt2html
28130 !! wikitext
28131 plain text</pre>
28132 !! html/parsoid
28133 <p>plain text</p>
28134 !! end
28135
28136 ## Remex doesn't account for fostered content.
28137 !! test
28138 1. Ensure fostered text content is wrapped in element nodes
28139 !! options
28140 parsoid=wt2html
28141 !! wikitext
28142 <table>hi</table><table>ho</table>
28143 !! html/php+tidy
28144 hi<table></table>ho<table></table>
28145 !! html/parsoid
28146 <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>
28147 !! end
28148
28149 ## Remex doesn't account for fostered content.
28150 !! test
28151 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28152 !! options
28153 parsoid=wt2html,wt2wt
28154 !! wikitext
28155 <table>
28156 <tr> || ||
28157 <td> a
28158 </table>
28159 !! html/php+tidy
28160 || ||
28161 <table>
28162 <tbody><tr><td> a
28163 </td></tr></tbody></table>
28164 !! html/parsoid
28165 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28166 <table data-parsoid='{"stx":"html"}'>
28167 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28168 </td></tr></tbody></table>
28169 !! end
28170
28171 ## Remex doesn't account for fostered content.
28172 !! test
28173 Encapsulation properly handles null DSR information from foster box
28174 !! options
28175 parsoid=wt2html,wt2wt
28176 !! wikitext
28177 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28178 !! html/parsoid
28179 <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>
28180 !! end
28181
28182 ## Remex doesn't account for fostered content.
28183 !! test
28184 1. Encapsulate foster-parented transclusion content
28185 !! options
28186 parsoid=wt2wt,wt2html
28187 !! wikitext
28188 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28189 !! html/php+tidy
28190 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28191 !! html/parsoid
28192 <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>
28193 !! end
28194
28195 !! test
28196 2. Encapsulate foster-parented transclusion content
28197 !! options
28198 parsoid=wt2wt,wt2html
28199 !! wikitext
28200 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28201 !! html/parsoid
28202 <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>
28203 <table>
28204 <tbody>
28205 <tr>
28206 <td>bar</td>
28207 </tr>
28208 </tbody>
28209 </table>
28210 !! end
28211
28212 !! test
28213 3. Encapsulate foster-parented transclusion content
28214 !! options
28215 parsoid=wt2wt,wt2html
28216 !! wikitext
28217 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28218 !! html/parsoid
28219 <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;]}">
28220 <p>foo</p>
28221 </div>
28222 <table>
28223 <tbody>
28224 <tr>
28225 <td>bar</td>
28226 </tr>
28227 </tbody>
28228 </table>
28229 !! end
28230
28231 !! test
28232 4. Encapsulate foster-parented transclusion content
28233 !! options
28234 parsoid=wt2wt,wt2html
28235 !! wikitext
28236 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28237 !! html/parsoid
28238 <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;]}">
28239 <p>foo</p>
28240 </div>
28241 <table>
28242 <tbody>
28243 <tr>
28244 <td>bar</td>
28245 </tr>
28246 </tbody>
28247 </table>
28248 !! end
28249
28250 ## Remex doesn't account for fostered content.
28251 !! test
28252 5. Encapsulate foster-parented transclusion content
28253 !!options
28254 parsoid=wt2wt,wt2html
28255 !! wikitext
28256 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28257 !! html/php+tidy
28258 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28259 !! html/parsoid
28260 <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>
28261 !! end
28262
28263 ## Remex doesn't account for fostered content.
28264 !! test
28265 6. Encapsulate foster-parented transclusion content
28266 !! options
28267 parsoid=wt2wt,wt2html
28268 !! wikitext
28269 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28270 !! html/php+tidy
28271 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28272 !! html/parsoid
28273 <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>
28274 !! end
28275
28276 !! test
28277 7. Encapsulate foster-parented transclusion content
28278 !!options
28279 parsoid=wt2wt,wt2html
28280 !! wikitext
28281 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28282 !! html/parsoid
28283 <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>
28284 <table>
28285 <tbody>
28286 <tr>
28287 <td>bar</td>
28288 </tr>
28289 </tbody>
28290 </table>
28291 !! end
28292
28293 ## Remex doesn't account for fostered content.
28294 # Note that the wt is broken on purpose: the = should be {{=}} if you
28295 # don't want it to be a template parameter key.
28296 !! test
28297 8. Encapsulate foster-parented transclusion content
28298 !! options
28299 parsoid=wt2wt,wt2html
28300 !! wikitext
28301 {{echo|a
28302 }}{|{{echo|style='color:red'}}
28303 |-
28304 |b
28305 |}
28306 !! html/php+tidy
28307 <p>a
28308 </p>
28309 <table>
28310
28311 <tbody><tr>
28312 <td>b
28313 </td></tr></tbody></table>
28314 !! html/parsoid
28315 <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">
28316 </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">
28317 <tbody><tr>
28318 <td>b
28319 </td></tr></tbody></table>
28320 !! end
28321
28322 ## Remex doesn't account for fostered content.
28323 !! test
28324 9. Encapsulate foster-parented transclusion content
28325 !!options
28326 parsoid=wt2wt,wt2html
28327 !! wikitext
28328 <table>{{echo|hi</table>hello}}
28329 !! html/php+tidy
28330 hi<table></table><p>hello</p>
28331 !! html/parsoid
28332 <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>
28333 !! end
28334
28335 !! test
28336 Table in fosterable position
28337 !!options
28338 parsoid=wt2html
28339 !! wikitext
28340 {{OpenTable}}
28341 <div>
28342 {|
28343 |}
28344 </div>
28345 |}
28346 !! html/parsoid
28347 <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">
28348 </span>
28349 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28350
28351 <table>
28352 </table>
28353 !! end
28354
28355 # Parsoid only for T66747
28356 # (Also core doesn't define {{#if}} in default install)
28357 !! test
28358 Properly encapsulate empty-content transclusions in fosterable positions
28359 !! wikitext
28360 <table>
28361 {{#if:|
28362 <td>foo</td>
28363 }}
28364 </table>
28365 !! html/parsoid
28366 <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"}]]}'>
28367
28368 </table>
28369 !! end
28370
28371 ## No longer captures its original intention
28372 !! test
28373 Always encapsulate foster box when template range is expanded to table
28374 !! options
28375 disabled
28376 parsoid=wt2wt
28377 !! wikitext
28378 {|
28379 hello
28380 {{OpenTable}}
28381 |}
28382 !! html/parsoid
28383 !! end
28384
28385 !! test
28386 T115289: Unclosed table
28387 !! wikitext
28388 {{echo|<table>}}<!--c-->[[Category:Two]]
28389 !! html/parsoid
28390 <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>
28391 !! end
28392
28393 !! test
28394 T115289: Don't migrate newlines out of tables with fostered content
28395 !! wikitext
28396 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28397 !! html/parsoid
28398 <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>
28399 !! end
28400
28401 !! test
28402 T73074: More fostering fun
28403 !! wikitext
28404 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28405 !! html/parsoid
28406 <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>
28407 !! end
28408
28409 !!test
28410 Support <object> element with .data attribute
28411 !!options
28412 parsoid=html2wt
28413 !! html/parsoid
28414 <object data="test.swf"></object>
28415 !! wikitext
28416 <object data="test.swf"></object>
28417 !!end
28418
28419 !! test
28420 Don't block XML namespace declaration
28421 !! wikitext
28422 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28423 !! html/php
28424 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28425 </p>
28426 !! html/parsoid
28427 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28428 !! end
28429
28430 # -----------------------------------------------------------------
28431 # The following section of tests are primarily to spec requirements
28432 # around Parsoid's serialization (old, new, edited content)
28433 #
28434 # All these tests are marked Parsoid html2wt and html2html only
28435 # ----------------------------------------------------------------
28436
28437 !! test
28438 Ignore rel attribute in a-tags during serialization to url-links
28439 !! options
28440 parsoid=html2wt
28441 !! html/parsoid
28442 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28443 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28444 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28445 !! wikitext
28446 http://en.wikipedia.org/wiki/Foobar
28447 http://en.wikipedia.org/wiki/Foobar
28448 http://en.wikipedia.org/wiki/Foobar
28449 !! end
28450
28451 # 'mi' is a localinterwiki prefix as well as a language
28452 !! test
28453 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28454 !! options
28455 parsoid=html2wt
28456 !! html/parsoid
28457 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28458 !! wikitext
28459 [[Foo]]
28460 !! end
28461
28462 !! test
28463 Parsoid should accept interwiki shortcuts
28464 !! options
28465 parsoid=html2wt
28466 !! html/parsoid
28467 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28468 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28469 <a href='./fr:Foo'>Foo</a></p>
28470 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28471 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28472 <a href='fr%3AFoo'>Foo</a></p>
28473 <p><a href='FR%3AFoo'>Foo</a>
28474 <a href='./FR:Foo'>Foo</a></p>
28475 !! wikitext
28476 [[:fr:Foo|Foo]]
28477 [[:fr:Foo|Foo]]
28478 [[:fr:Foo|Foo]]
28479
28480 [[:fr:Foo|Foo]]
28481 [[:fr:Foo|Foo]]
28482 [[:fr:Foo|Foo]]
28483
28484 [[:fr:Foo|Foo]]
28485 [[:fr:Foo|Foo]]
28486 !! end
28487
28488 !! test
28489 Parsoid should not accept invalid interwiki shortcuts
28490 !! options
28491 parsoid=html2wt
28492 !! html/parsoid
28493 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28494 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28495 <a href='news:Foo'>Foo</a></p>
28496 !! wikitext
28497 [news:Foo Foo]
28498 [news:Foo Foo]
28499 [news:Foo Foo]
28500 !! end
28501
28502 # See T93839
28503 !! test
28504 New wikilinks should be serialized properly
28505 !! options
28506 parsoid=html2wt
28507 !! html/parsoid
28508 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28509 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28510 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28511 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28512 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28513 !! wikitext
28514 [[Foo]]
28515 [[Foo]]
28516 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28517 http://en.wikipedia.org/wiki/Foo
28518 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28519 !! end
28520
28521 !! test
28522 New wiki links (href variations)
28523 !! options
28524 parsoid=html2wt
28525 !! html/parsoid
28526 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28527 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28528 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28529 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28530 !! wikitext
28531 [[Foo_bar]]
28532 [[Foo_bar]]
28533 [[Foo_bar]]
28534 [[Toxine bactérienne]]
28535 !! end
28536
28537 !! test
28538 New wiki links (content string variations)
28539 !! options
28540 parsoid=html2wt
28541 !! html/parsoid
28542 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28543 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28544 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28545 !! wikitext
28546 [[Foo_bar]]
28547 [[Foo bar]]
28548 [[Foo_bar|./Foo_bar]]
28549 !! end
28550
28551 !! test
28552 New category links (href variations)
28553 !! options
28554 parsoid=html2wt
28555 !! html/parsoid
28556 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28557 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28558 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28559 !! wikitext
28560 [[Category:Toxine bactérienne]]
28561 [[Category:Toxine bactérienne]]
28562 [[Category:Toxine bactérienne]]
28563 !! end
28564
28565 !! test
28566 New sol transparent links don't need indent-pre nowiki protection
28567 !! options
28568 parsoid=html2wt
28569 language=de
28570 !! html/parsoid
28571 <link rel="mw:PageProp/redirect" href="./Main_Page">
28572 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28573 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28574 !! wikitext
28575 #WEITERLEITUNG [[Main Page]]
28576 <!-- this is good --> [[Category:Good]]
28577 <!-- this is great --> [[Kategorie:Great]]
28578 !! end
28579
28580 !! test
28581 New interlanguage links (href variations)
28582 !! options
28583 parsoid=html2wt
28584 !! html/parsoid
28585 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28586 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28587 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28588 !! wikitext
28589 [[es:Toxine bactérienne]]
28590 [[es:Toxine_bactérienne]]
28591 [[es:Toxine_bactérienne]]
28592 !! end
28593
28594 !! test
28595 Image: Modifying size of an image (1)
28596 !! options
28597 parsoid={
28598 "modes": ["wt2wt"],
28599 "changes": [
28600 ["img[height]", "attr", "height", "22"],
28601 ["img[width]", "attr", "width", "200"]
28602 ]
28603 }
28604 !! wikitext
28605 [[Image:Foobar.jpg|230x230px]]
28606 !! wikitext/edited
28607 [[Image:Foobar.jpg|200x200px]]
28608 !!end
28609
28610 !! test
28611 Image: Modifying size of an image (2)
28612 !! options
28613 parsoid={
28614 "modes": ["wt2wt"],
28615 "changes": [
28616 ["img[height]", "attr", "height", "100"],
28617 ["img[width]", "attr", "width", "500"]
28618 ]
28619 }
28620 !! wikitext
28621 [[Image:Foobar.jpg|230x230px]]
28622 !! wikitext/edited
28623 [[Image:Foobar.jpg|500x500px]]
28624 !!end
28625
28626 # Change in size is ignored so long as class='mw-default-size'
28627 !! test
28628 Image: Modifying size of an image (3)
28629 !! options
28630 parsoid={
28631 "modes": ["wt2wt"],
28632 "changes": [
28633 ["figure[class]", "removeClass", "mw-default-size"],
28634 ["figure img", "attr", "height", "19"],
28635 ["figure img", "attr", "width", "170"]
28636 ]
28637 }
28638 !! wikitext
28639 [[Image:Foobar.jpg|thumb]]
28640 !! wikitext/edited
28641 [[Image:Foobar.jpg|thumb|170x170px]]
28642 !!end
28643
28644 !! test
28645 Image: Modifying alignment of an image (T50665)
28646 !! options
28647 parsoid={
28648 "modes": ["wt2wt"],
28649 "changes": [
28650 ["figure[class]", "removeClass", "mw-halign-right"],
28651 ["figure[class]", "addClass", "mw-halign-left"]
28652 ]
28653 }
28654 !! wikitext
28655 [[Image:Foobar.jpg|thumb|caption|right]]
28656 !! wikitext/edited
28657 [[Image:Foobar.jpg|thumb|caption|left]]
28658 !! end
28659
28660 !! test
28661 Image: Modifying mw-default-size of an frameless image (T64805)
28662 !! options
28663 parsoid={
28664 "modes": ["wt2wt"],
28665 "changes": [
28666 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28667 ]
28668 }
28669 !! wikitext
28670 [[Image:Foobar.jpg|frameless|right]]
28671 !! wikitext/edited
28672 [[Image:Foobar.jpg|frameless|right|220x220px]]
28673 !! end
28674
28675 !! test
28676 Image: Modifying valign of an image (T51221)
28677 !! options
28678 parsoid={
28679 "modes": ["wt2wt"],
28680 "changes": [
28681 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28682 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28683 ]
28684 }
28685 !! wikitext
28686 [[File:Foobar.jpg|20px|middle]]
28687 !! wikitext/edited
28688 [[File:Foobar.jpg|20px|text-top]]
28689 !! end
28690
28691 !! test
28692 Image: Modifying alt attribute of an image (T58400)
28693 !! options
28694 disabled
28695 parsoid={
28696 "modes": ["wt2wt"],
28697 "changes": [
28698 ["img[alt]", "attr", "alt", "some alternate edited text"]
28699 ]
28700 }
28701 !! wikitext
28702 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28703 !! wikitext/edited
28704 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28705 !!end
28706
28707 !! test
28708 Image: Modifying caption of an image
28709 !! options
28710 parsoid={
28711 "modes": ["wt2wt"],
28712 "changes": [
28713 ["figcaption", "text", "new caption"]
28714 ]
28715 }
28716 !! wikitext
28717 [[Image:Foobar.jpg|thumb|original caption]]
28718 !! wikitext/edited
28719 [[Image:Foobar.jpg|thumb|new caption]]
28720 !!end
28721
28722 !! test
28723 Image: empty alt attribute (T50924)
28724 !! wikitext
28725 [[File:Foobar.jpg|thumb|alt=|bar]]
28726 !! html/php+tidy
28727 <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>
28728 !! html/parsoid
28729 <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>
28730 !! end
28731
28732 !! test
28733 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28734 !! options
28735 parsoid=html2wt
28736 language=ar
28737 disabled
28738 !! html/parsoid
28739 <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>
28740 !! wikitext
28741 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28742 !! end
28743
28744 !! test
28745 Image: Block level image should have \n before and after
28746 !! wikitext
28747 123
28748 [[File:Foobar.jpg|right|thumb|150x150px]]
28749 456
28750 !! html/parsoid
28751 <p>123</p>
28752 <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>
28753 <p>456</p>
28754 !! end
28755
28756 !! test
28757 Image: New block level image should have \n before and after (existing content)
28758 !! wikitext
28759 123
28760 [[File:Foobar.jpg|right|thumb|150x150px]]
28761 456
28762 !! html/parsoid
28763 <p>123</p>
28764 <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>
28765 <p>456</p>
28766 !! end
28767
28768 !! test
28769 Image: upright option (parsoid)
28770 !! wikitext
28771 [[File:Foobar.jpg|thumb|upright|caption]]
28772 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28773 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28774 !! html/parsoid
28775 <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>
28776 <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>
28777 <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>
28778 !! end
28779
28780 !! test
28781 Image: upright option is ignored on inline and frame images (parsoid)
28782 !! wikitext
28783 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28784 !! html/parsoid
28785 <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>
28786 !! end
28787
28788 !! test
28789 Image: in template parameter with empty parameter
28790 !! wikitext
28791 {{echo|[[File:Foobar.jpg|link=]]}}
28792 !! html/parsoid
28793 <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>
28794 !! end
28795
28796 !! test
28797 Image: from basic HTML (1)
28798 !! options
28799 parsoid=html2wt
28800 !! html/parsoid
28801 <span typeof="mw:Image">
28802 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28803 </span>
28804 !! wikitext
28805 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28806 !! end
28807
28808 !! test
28809 Image: from basic HTML (2)
28810 !! options
28811 parsoid=html2wt
28812 !! html/parsoid
28813 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28814 !! wikitext
28815 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28816 !! end
28817
28818 !! test
28819 Image: from basic HTML (3)
28820 !! options
28821 parsoid=html2wt
28822 !! html/parsoid
28823 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28824 !! wikitext
28825 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28826 !! end
28827
28828 !! test
28829 Image: from basic HTML (4)
28830 !! options
28831 parsoid=html2wt
28832 !! html/parsoid
28833 <img src="./File:Foobar.jpg">
28834 !! wikitext
28835 [[File:Foobar.jpg|link=]]
28836 !! end
28837
28838 !! test
28839 Image: Invalid title as link
28840 !! wikitext
28841 [[File:Foobar.jpg|link=<]]
28842 !! html/php
28843 <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>
28844 </p>
28845 !! html/parsoid
28846 <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>
28847 !! end
28848
28849 !! test
28850 Various link types in alt and link options
28851 !! wikitext
28852 [[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
28853
28854 [[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
28855
28856 [[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
28857 !! html/php+tidy
28858 <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>
28859 </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>
28860 </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>
28861 </p>
28862 !! html/parsoid
28863 <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>
28864
28865 <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>
28866
28867 <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>
28868 !! end
28869
28870 !! test
28871 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28872 !! options
28873 parsoid=html2wt
28874 !! html/parsoid
28875 <ul>
28876 <li><p>foo</p></li>
28877 </ul>
28878 !! wikitext
28879 * foo
28880 !! end
28881
28882 !! test
28883 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28884 !! options
28885 parsoid=html2wt
28886 !! html/parsoid
28887 <ul> <li>foo</li></ul>
28888 !! wikitext
28889 * foo
28890 !! end
28891
28892 !! test
28893 Don't strip leading whitespace when handling indent-pre suppressing tags
28894 !! options
28895 parsoid=html2wt
28896 !! html/parsoid
28897 <table>
28898 <tr><td> indented row</td></tr>
28899 </table>
28900 <blockquote><p>
28901 <b>This is very bold of you!</b>
28902 </p>
28903 <table><tr><td>
28904 indented cell (no pre-wrapping!)
28905 </td></tr></table>
28906 </blockquote>
28907 <p>foo</p>
28908 <div>bar</div>
28909 !! wikitext
28910 {|
28911 | indented row
28912 |}
28913 <blockquote>
28914 '''This is very bold of you!'''
28915
28916 {|
28917 |
28918 indented cell (no pre-wrapping!)
28919 |}
28920 </blockquote>
28921 foo
28922 <div>bar</div>
28923 !! end
28924
28925 !! test
28926 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28927 !! options
28928 parsoid=html2wt
28929 !! html/parsoid
28930 <p>foo</p>
28931 <span>bar</span>
28932
28933 <span>foo2
28934 </span>bar2
28935
28936 <div>foo</div>
28937 <span>bar</span>
28938
28939 <div>
28940 <span>foo</span>
28941 </div>
28942 !! wikitext
28943 foo
28944
28945 <span>bar</span>
28946
28947 <span>foo2
28948 <nowiki> </nowiki></span>bar2
28949
28950 <div>foo</div>
28951 <nowiki> </nowiki><span>bar</span>
28952
28953 <div>
28954 <nowiki> </nowiki><span>foo</span>
28955 </div>
28956 !! end
28957
28958 !! test
28959 Lists: Dont insert newlines in a serialized list item.
28960 !! options
28961 parsoid=html2wt
28962 !! html/parsoid
28963 <ul><li>a<br>b</li><li>c</li></ul>
28964 !! wikitext
28965 * a<br />b
28966 * c
28967 !! end
28968
28969 !! test
28970 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28971 !! options
28972 parsoid={
28973 "modes": ["html2wt"],
28974 "scrubWikitext": false
28975 }
28976 !! html/parsoid
28977 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28978 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28979
28980 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28981 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28982
28983 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28984
28985 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28986 !! wikitext
28987 == hello there [[Category:A1]] ==
28988
28989 == [[Category:A2]] hi pal ==
28990
28991 == <!--foo--> [[Category:A3]] how goes it ==
28992
28993 == it goes well [[Category:A4]] <!--bar--> ==
28994
28995 ==howdy [[Category:A5]]==
28996
28997 == __TOC__ ok ==
28998 !! end
28999
29000 !! test
29001 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
29002 !! options
29003 parsoid={
29004 "modes": ["html2wt"],
29005 "scrubWikitext": true
29006 }
29007 !! html/parsoid
29008 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
29009 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
29010
29011 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29012 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29013
29014 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29015 !! wikitext
29016 == hello there ==
29017 [[Category:A1]]
29018 [[Category:A2]]
29019
29020 == hi pal ==
29021
29022 <!--foo-->[[Category:A3]]
29023
29024 == how goes it ==
29025
29026 == it goes well ==
29027 [[Category:A4]] <!--bar-->
29028
29029 __TOC__
29030
29031 == ok ==
29032 !! end
29033
29034 !! test
29035 Headings: Don't hoist metas that come from templates
29036 !! options
29037 parsoid={
29038 "modes": ["html2wt"],
29039 "scrubWikitext": true
29040 }
29041 !! html/parsoid
29042 <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>
29043 !! wikitext
29044 == {{echo|foo [[Category:Foo]]}} ==
29045 !! end
29046
29047 !! test
29048 Headings: Category in ref isn't hoisted
29049 !! options
29050 parsoid={
29051 "modes": ["html2wt"],
29052 "scrubWikitext": true
29053 }
29054 !! html/parsoid
29055 <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>
29056
29057 <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>
29058 !! wikitext
29059 == foo <ref>bar
29060 [[Category:Baz]] </ref> ==
29061
29062 <references />
29063 !! end
29064
29065 !! test
29066 Parsoid: Serialize positional parameters with = in them as named parameter
29067 !! options
29068 parsoid=html2wt
29069 !! html/parsoid
29070 <p about="#mwt1" typeof="mw:Transclusion"
29071 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
29072
29073 <p about="#mwt1" typeof="mw:Transclusion"
29074 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
29075
29076 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29077 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29078 <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>
29079 !! wikitext
29080 {{echo|1=f=oo}}
29081
29082 {{echo|1=f=oo|2=bar}}
29083
29084 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29085 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29086 {{echo|<nowiki>f=oo</nowiki>|bar}}
29087 !! end
29088
29089 !! test
29090 Parsoid: Serialize positional parameters with = in extlink as named parameter
29091 !! options
29092 parsoid=html2wt
29093 !! html/parsoid
29094 <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>
29095 !! wikitext
29096 {{echo|1=http://stuff?is=ok}}
29097 !! end
29098
29099 !! test
29100 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
29101 !! options
29102 parsoid=html2wt
29103 !! html/parsoid
29104 <div>a<p>b</p></div>
29105 <div>a
29106 <p>b</p></div>
29107 <div>
29108 a
29109 <p>b</p></div>
29110 !! wikitext
29111 <div>a
29112 b
29113 </div>
29114 <div>a
29115 b
29116 </div>
29117 <div>
29118 a
29119
29120 b
29121 </div>
29122 !! end
29123
29124 !! test
29125 Substrings resembling wikitext in hrefs should not get nowiki escapes
29126 !! options
29127 parsoid=html2wt
29128 !! html/parsoid
29129 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
29130 !! wikitext
29131 [[Foo''bar''baz]]
29132 !! end
29133
29134 !! test
29135 Enforce single-line context in the serializer
29136 !! options
29137 parsoid=html2wt
29138 !! html/parsoid
29139 <h2>testing
29140 123</h2>
29141
29142 <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">
29143 </span><span about="#mwt1">you</span> </h2>
29144
29145 <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>
29146
29147 <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
29148 there</span></li></ol>
29149
29150 <ul><li>asd
29151 sdf</li></ul>
29152
29153 <ul><li>foo
29154 bar
29155 baz</li>
29156 <li>foo <b>bar</b>
29157 baz</li></ul>
29158
29159 <dl><dt>hi
29160 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29161 ho</dd></dl>
29162
29163 <dl><dd> <table>
29164 <tbody><tr><td> ha
29165 ha
29166 ha</td></tr>
29167 </tbody></table></dd></dl>
29168 !! wikitext
29169 == testing 123 ==
29170
29171 == hi {{bogus|there
29172 you}} ==
29173
29174 == foo <ref>hello
29175 there</ref> ==
29176
29177 <references />
29178
29179 * asd sdf
29180
29181 * foo bar baz
29182 * foo '''bar''' baz
29183
29184 ; hi ho : hi ho
29185
29186 : {|
29187 | ha
29188 ha
29189 ha
29190 |}
29191 !! end
29192
29193 !! test
29194 Serialize new placeholder space without spans
29195 !! options
29196 parsoid=html2wt
29197 !! html/parsoid
29198 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29199
29200 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29201
29202 <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>
29203 !! wikitext
29204 foo : bar
29205
29206 foo : bar
29207
29208 <ref>foo : bar</ref>ok
29209 !! end
29210
29211
29212 #-----------------------
29213 # Tag minimization tests
29214 #-----------------------
29215
29216 !! test
29217 1. I/B quote minimization: wikitext-only tags should be combined
29218 !! options
29219 parsoid=html2wt
29220 !! html/parsoid
29221 <p><i>A</i><i>B</i></p>
29222 <p><b>A</b><b>B</b></p>
29223 <p><i>A</i><b><i>B</i></b></p>
29224 <p><b>A</b><i><b>B</b></i></p>
29225 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29226 <p><i><b>A</b></i><i><b>B</b></i></p>
29227 <p><i><b>A</b></i><b><i>B</i></b></p>
29228 <p><b><i>A</i></b><i><b>B</b></i></p>
29229 !! wikitext
29230 ''AB''
29231
29232 '''AB'''
29233
29234 ''A'''B'''''
29235
29236 '''A''B'''''
29237
29238 '''A''BC''D'''
29239
29240 '''''AB'''''
29241
29242 '''''AB'''''
29243
29244 '''''AB'''''
29245 !! end
29246
29247 !! test
29248 2. I/B quote minimization: wikitext and html tags should not be combined
29249 !! options
29250 parsoid=html2wt
29251 !! html/parsoid
29252 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29253 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29254 !! wikitext
29255 ''A''<i>B</i>
29256
29257 ''A''<nowiki/>'''<i>B</i>'''
29258 !! end
29259
29260 !! test
29261 3. I/B quote minimization: templated content stops minimization
29262 !! options
29263 parsoid=html2wt
29264 !! html/parsoid
29265 <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>
29266 <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>
29267 !! wikitext
29268 ''A''{{echo|''B''}}
29269
29270 ''A''{{echo|'''''B'''''}}
29271 !! end
29272
29273 !! test
29274 4. I/B quote minimization: new content should be mimimized with adjacent old content
29275 !! options
29276 parsoid=html2wt
29277 !! html/parsoid
29278 <p><i>A</i><i>B</i></p>
29279 <p><b>A</b><b>B</b></p>
29280 <p><i>A</i><b><i>B</i></b></p>
29281 !! wikitext
29282 ''AB''
29283
29284 '''AB'''
29285
29286 ''A'''B'''''
29287 !! end
29288
29289 !! test
29290 5a. Merge adjacent quote nodes if they've been edited
29291 !! options
29292 parsoid={
29293 "modes": ["wt2wt", "selser"],
29294 "changes": [
29295 ["p", "contents", "remove", ":contains('b')"]
29296 ]
29297 }
29298 !! wikitext
29299 ''a''b''c''
29300 !! wikitext/edited
29301 ''ac''
29302 !! end
29303
29304 !! test
29305 5b. Merge adjacent quote nodes if they've been edited
29306 !! options
29307 parsoid={
29308 "modes": ["wt2wt", "selser"],
29309 "changes": [
29310 ["#x", "remove"]
29311 ]
29312 }
29313 !! wikitext
29314 ''a''<span id="x">b</span>''c''
29315 !! wikitext/edited
29316 ''ac''
29317 !! end
29318
29319 !! test
29320 1. Merge adjacent link nodes as long as at least one element is new
29321 !! options
29322 parsoid={
29323 "modes": ["html2wt"],
29324 "scrubWikitext": true
29325 }
29326 !! html/parsoid
29327 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29328 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29329 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29330 !! wikitext
29331 [[Football]]
29332 [[Football]]
29333 [[Football|Foot]][[Football|ball]]
29334 !! end
29335
29336 !! test
29337 2. Merge adjacent link nodes and enable additional normalizations
29338 !! options
29339 parsoid={
29340 "modes": ["html2wt"],
29341 "scrubWikitext": true
29342 }
29343 !! html/parsoid
29344 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29345 !! wikitext
29346 ''[[Football]]''
29347 !! end
29348
29349 !! test
29350 3. Don't merge adjacent link nodes if scrubWikitext is false
29351 !! options
29352 parsoid={
29353 "modes": ["html2wt"],
29354 "scrubWikitext": false
29355 }
29356 !! html/parsoid
29357 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29358 !! wikitext
29359 [[Football|Foot]][[Football|ball]]
29360 !! end
29361
29362 !! test
29363 1. Move format tags outside of WikiLink
29364 !! options
29365 parsoid={
29366 "modes": ["html2wt"],
29367 "scrubWikitext": true
29368 }
29369 !! html/parsoid
29370 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29371 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29372 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29373 !! wikitext
29374 ''[[Football]]''
29375 '''''[[Football]]'''''
29376 <u>'''''[[Football]]'''''</u>
29377 !! end
29378
29379 !! test
29380 2. Move format tags outside of WikiLink with mergable A tags
29381 !! options
29382 parsoid={
29383 "modes": ["html2wt"],
29384 "scrubWikitext": true
29385 }
29386 !! html/parsoid
29387 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29388 !! wikitext
29389 '''''[[Football]]'''''
29390 !! end
29391
29392 !! test
29393 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29394 !! options
29395 parsoid={
29396 "modes": ["html2wt"],
29397 "scrubWikitext": true
29398 }
29399 !! html/parsoid
29400 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29401 !! wikitext
29402 <font color="red"><u>'''[[Foo]]'''</u></font>
29403 !! end
29404
29405 !! test
29406 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29407 !! options
29408 parsoid={
29409 "modes": ["html2wt"],
29410 "scrubWikitext": true
29411 }
29412 !! html/parsoid
29413 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29414 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29415 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29416 !! wikitext
29417 [[Foo|<font color="red">Foo</font>]]
29418 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29419 [[Foo|<span class="Bar">Foo</span>]]
29420 !! end
29421
29422 !! test
29423 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29424 !! options
29425 parsoid={
29426 "modes": ["selser"],
29427 "scrubWikitext": true,
29428 "changes": [
29429 ["a", "html", "<i>Foo</i>"]
29430 ]
29431 }
29432 !! wikitext
29433 [[Foo]]
29434 !! wikitext/edited
29435 ''[[Foo]]''
29436 !! end
29437
29438 !! test
29439 6. Regression test: Manual edit test to ensure diff markers are not lost
29440 !! options
29441 parsoid={
29442 "modes": ["selser"],
29443 "scrubWikitext": true,
29444 "changes": [
29445 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29446 ]
29447 }
29448 !! wikitext
29449 ''Foo''
29450 !! wikitext/edited
29451 ''[[Foo]]''
29452 !! end
29453
29454 !! test
29455 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29456 !! options
29457 parsoid={
29458 "modes": ["selser"],
29459 "scrubWikitext": true,
29460 "changes": [
29461 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29462 ]
29463 }
29464 !! wikitext
29465 <div>placeholder</div>
29466 !! wikitext/edited
29467 <div>placeholder</div>
29468 [[Foo]] , placeholder
29469 !! end
29470
29471 #------------------------------
29472 # End of tag minimization tests
29473 #------------------------------
29474
29475 !!test
29476 T56262: New entities
29477 !! options
29478 parsoid=html2wt
29479 !! html/parsoid
29480 <span typeof="mw:Entity">&nbsp;</span>
29481 !! wikitext
29482 &nbsp;
29483 !! end
29484
29485 ## Note that there is no wikitext output for 'unknownproperty' ##
29486 ## Unknown magic words are silently dropped ##
29487
29488 !! test
29489 Magic words
29490 !! options
29491 parsoid=html2wt
29492 !! html/parsoid
29493 <meta property='mw:PageProp/toc' />
29494 <meta property='mw:PageProp/notoc' />
29495 <meta property='mw:PageProp/forcetoc' />
29496 <meta property='mw:PageProp/index' />
29497 <meta property='mw:PageProp/noindex' />
29498 <meta property='mw:PageProp/nogallery' />
29499 <meta property='mw:PageProp/noeditsection' />
29500 <meta property='mw:PageProp/notitleconvert' />
29501 <meta property='mw:PageProp/nocontentconvert' />
29502 <meta property='mw:PageProp/unknownproperty' />
29503 !! wikitext
29504 __TOC__
29505 __NOTOC__
29506 __FORCETOC__
29507 __INDEX__
29508 __NOINDEX__
29509 __NOGALLERY__
29510 __NOEDITSECTION__
29511 __NOTITLECONVERT__
29512 __NOCONTENTCONVERT__
29513 !! end
29514
29515 !! test
29516 Consecutive <pre>s should not get merged
29517 !! options
29518 parsoid=html2wt,html2html
29519 !! html/parsoid
29520 <pre>a</pre><pre>b</pre>
29521
29522 <pre>c
29523 </pre><pre>
29524 d</pre>
29525
29526 <pre>e
29527
29528 </pre><pre>
29529
29530 f</pre>
29531 !! wikitext
29532 a
29533
29534 b
29535
29536 c
29537
29538 d
29539
29540 e
29541
29542
29543
29544 f
29545 !! end
29546
29547 !! test
29548 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29549 !! options
29550 parsoid=html2wt
29551 !! html/parsoid
29552 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29553 !! wikitext
29554 [[Special:BookSources/1234567890|ISBN 1234567895]]
29555 !! end
29556
29557 !! test
29558 Edited RFC links not serializable as RFC links should serialize as extlinks
29559 !! options
29560 parsoid=html2wt
29561 !! html/parsoid
29562 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29563 !! wikitext
29564 [https://tools.ietf.org/html/rfc123 New RFC]
29565 !! end
29566
29567 !! test
29568 Edited PMID links not serializable as PMID links should serialize as extlinks
29569 !! options
29570 parsoid=html2wt
29571 !! html/parsoid
29572 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29573 !! wikitext
29574 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29575 !! end
29576
29577 !! test
29578 WTS of autolinks with trailing/surrounding context
29579 !! options
29580 parsoid=html2wt
29581 !! html/parsoid
29582 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29583 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29584 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29585 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29586 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29587 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29588 !! wikitext
29589 http://cscott.net'''foo'''
29590
29591 http://cscott.net<b>foo</b>
29592
29593 '''http://cscott.net'''
29594
29595 '''http://cscott.net '''
29596
29597 '''http://cscott.net<nowiki/>x'''
29598
29599 http://cscott.net<nowiki/>x
29600 !! end
29601
29602 !! test
29603 WTS of autolinks with nowikis (round-trip)
29604 !! wikitext
29605 x<nowiki/>http://cscott.net<nowiki/>x
29606 !! html/parsoid
29607 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29608 !! end
29609
29610 # this is the "easy" test because it leaves in place all the
29611 # data-parsoid information indicating this is an autolink
29612 !! test
29613 WTS of autolinks with escapes (editing)
29614 !! options
29615 parsoid={
29616 "modes": ["wt2wt"],
29617 "changes": [
29618 [ "span", "remove" ]
29619 ]
29620 }
29621 !! wikitext
29622 x<nowiki/>http://cscott.net<nowiki/>x
29623 !! wikitext/edited
29624 x<nowiki/>http://cscott.net<nowiki/>x
29625 !! end
29626
29627 !! test
29628 WTS of edited autolink-like text (T103364)
29629 !! options
29630 parsoid={
29631 "modes": ["wt2wt"],
29632 "changes": [
29633 [ "span[typeof]", "removeAttr", "typeof" ]
29634 ]
29635 }
29636 !! wikitext
29637 Not a link: <nowiki>http://example.com</nowiki>.
29638 !! wikitext/edited
29639 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29640 !! end
29641
29642 !! test
29643 WTS of newly-authored autolink-like text (T103364)
29644 !! options
29645 parsoid=html2wt
29646 !! html/parsoid
29647 <p>http://example.com is not a link.</p>
29648 !! wikitext
29649 <nowiki>http://example.com</nowiki> is not a link.
29650 !! end
29651
29652 !! test
29653 WTS of autolink-like text after an autolink (T108563)
29654 !! options
29655 parsoid=html2wt
29656 !! html/parsoid
29657 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29658 !! wikitext
29659 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29660 !! end
29661
29662 !! test
29663 Magic links inside links (not autolinked)
29664 !! wikitext
29665 [[Foo|http://example.com]]
29666 [[Foo|RFC 1234]]
29667 [[Foo|PMID 1234]]
29668 [[Foo|ISBN 123456789x]]
29669
29670 [http://foo.com http://example.com]
29671 [http://foo.com RFC 1234]
29672 [http://foo.com PMID 1234]
29673 [http://foo.com ISBN 123456789x]
29674 !! html+tidy
29675 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29676 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29677 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29678 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29679 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29680 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29681 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29682 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29683 </p>
29684 !! html/parsoid
29685 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29686 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29687 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29688 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29689
29690 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29691 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29692 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29693 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29694 !! end
29695
29696 !! test
29697 Magic links inside image captions (autolinked)
29698 !! wikitext
29699 [[File:Foobar.jpg|thumb|http://example.com]]
29700 [[File:Foobar.jpg|thumb|RFC 1234]]
29701 [[File:Foobar.jpg|thumb|PMID 1234]]
29702 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29703 !! html+tidy
29704 <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>
29705 <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>
29706 <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>
29707 <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>
29708 !! html/parsoid
29709 <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" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
29710 <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>
29711 <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>
29712 <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>
29713 !! end
29714
29715 !! test
29716 WTS of magic word text (T109371)
29717 !! options
29718 parsoid=html2wt
29719 !! html/parsoid
29720 <p>RFC 1234</p>
29721 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29722 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29723 !! wikitext
29724 <nowiki>RFC 1234</nowiki>
29725
29726 [http://foo.com RFC 1234]
29727
29728 [[Foo|RFC 1234]]
29729 !! end
29730
29731 !! test
29732 Edited Redirect link should emit a non-piped wikitext link
29733 !! options
29734 parsoid=html2wt
29735 !! html/parsoid
29736 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29737 !! wikitext
29738 #REDIRECT [[Bar]]
29739 !! end
29740
29741 !! test
29742 T75121: Infer extension name from typeOf if data-mw is not present
29743 !! options
29744 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29745 !! html/parsoid
29746 <div typeOf="mw:Extension/foo"></div>
29747 !! wikitext
29748 <foo />
29749 !! end
29750
29751 # Note that the <p> wrapping isn't present in PHP parser output
29752 # The important thing for this test is that P-wrapping doesn't
29753 # interfere with the <nowiki> protection for leading - in <td>
29754 # (which isn't necessary for <th>).
29755 !! test
29756 T88318: p-wrapped dash in table.
29757 !! options
29758 parsoid=html2wt,wt2wt
29759 !! html/parsoid
29760 <table><tbody>
29761 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29762 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29763 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29764 </tbody></table>
29765 !! wikitext
29766 {|
29767 !-
29768 !-
29769 |-
29770 |<nowiki>-</nowiki>
29771 |<nowiki>- </nowiki>
29772 |-
29773 |<small>-</small>
29774 |<br />
29775 -
29776 |<br />-
29777 |}
29778 !! html/php+tidy
29779 <table>
29780 <tbody><tr>
29781 <th>-
29782 </th>
29783 <th>-
29784 </th></tr>
29785 <tr>
29786 <td>-
29787 </td>
29788 <td>-
29789 </td></tr>
29790 <tr>
29791 <td><small>-</small>
29792 </td>
29793 <td><br />
29794 <p>-
29795 </p>
29796 </td>
29797 <td><br />-
29798 </td></tr></tbody></table>
29799 !! end
29800
29801 !! test
29802 T149209: WTS: Handle newlines in table cells properly
29803 !! options
29804 parsoid=html2wt
29805 !! html/parsoid
29806 <table>
29807 <tbody>
29808 <tr><td>a
29809 b
29810 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29811 <tr><td><p>x</p>
29812 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29813 </tbody></table>
29814 <table>
29815 <tbody>
29816 <tr><th>a
29817 b
29818 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29819 <tr><th><p>x</h>
29820 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29821 </tbody></table>
29822 !! wikitext
29823 {|
29824 |a
29825 b
29826 |c
29827 |-
29828 |x
29829 {{!}}y
29830 |}
29831 {|
29832 !a
29833 b
29834 !c
29835 |-
29836 !x
29837 !y
29838 |}
29839 !! end
29840
29841 !! test
29842 T149209: Selser: Handle newlines in table cells properly
29843 !! options
29844 parsoid={
29845 "modes": ["selser"],
29846 "changes": [
29847 [ "#h1", "html", "a\nb\n" ],
29848 [ "#h2", "html", "a\nb\n" ],
29849 [ "#c1", "html", "a\nb\n" ],
29850 [ "#c2", "html", "<p>a</p>" ],
29851 [ "#c3", "html", "<p>a</p>" ],
29852 [ "#c4", "html", "edit-me<p>a</p>" ]
29853 ]
29854 }
29855 !! wikitext
29856 {|
29857 ! id="h1" |edit-me!!1
29858 |-
29859 ! id="h2" |edit-me||2
29860 |-
29861 | id="c1" |edit-me||3
29862 |-
29863 | id="c2" |edit-me||4
29864 |-
29865 | id="c3" |edit-me||p||q||r
29866 |-
29867 | id="c4" |edit-me||p||q||r
29868 |}
29869 !! wikitext/edited
29870 {|
29871 ! id="h1" |a
29872 b
29873 !1
29874 |-
29875 ! id="h2" |a
29876 b
29877 !2
29878 |-
29879 | id="c1" |a
29880 b
29881 |3
29882 |-
29883 | id="c2" |a
29884 |4
29885 |-
29886 | id="c3" |a
29887 |p||q||r
29888 |-
29889 | id="c4" |edit-me
29890 a
29891 |p||q||r
29892 |}
29893 !! end
29894
29895 !! test
29896 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29897 !! options
29898 parsoid=html2wt
29899 !! html/parsoid
29900 <table id='mwAb'>
29901 <td id='mwAc'>foo</td>
29902 <td id='serialize-this'>bar</td>
29903 </table>
29904 !! wikitext
29905 {|
29906 |foo
29907 | id="serialize-this" |bar
29908 |}
29909 !! end
29910
29911 !! test
29912 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29913 !! options
29914 parsoid=html2wt
29915 !! html/parsoid
29916 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29917 !! wikitext
29918 <div id="hello">ok</div>
29919 !! end
29920
29921 !! test
29922 Testing serialization after deletion in references
29923 !! options
29924 parsoid={
29925 "modes": ["wt2wt"],
29926 "changes": [
29927 ["#x", "remove"]
29928 ]
29929 }
29930 !! wikitext
29931 hi <ref><div id="x">ho</div></ref>
29932
29933 <references />
29934 !! wikitext/edited
29935 hi <ref></ref>
29936
29937 <references />
29938 !! end
29939
29940 !!test
29941 Testing serialization after deletion of table cells
29942 !!options
29943 parsoid={
29944 "modes": ["wt2wt", "selser"],
29945 "changes": [
29946 ["#x", "remove"]
29947 ]
29948 }
29949 !!wikitext
29950 {|
29951 !h1 !!h2 !!h3
29952 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29953 |}
29954 !! wikitext/edited
29955 {|
29956 !h1!!h2!!h3
29957 |c2|||c3
29958 |}
29959 !!end
29960
29961 !! test
29962 Testing selser after addition of new row before first row (T125419)
29963 !! options
29964 parsoid={
29965 "modes": ["wt2wt", "selser"],
29966 "changes": [
29967 [ "tr", "before", "<tr><td>X</td></tr>" ]
29968 ]
29969 }
29970 !! wikitext
29971 {|
29972 |a
29973 |}
29974 !! wikitext/edited
29975 {|
29976 |X
29977 |-
29978 |a
29979 |}
29980 !! end
29981
29982 !! test
29983 Serialize new table rows in a HTML table using HTML tags
29984 !! options
29985 parsoid={
29986 "modes": ["wt2wt", "selser"],
29987 "changes": [
29988 [ "tr", "before", "<tr><td>X</td></tr>" ]
29989 ]
29990 }
29991 !! wikitext
29992 <table><tr><td>a</td></tr></table>
29993 !! wikitext/edited
29994 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29995 !! end
29996
29997 !! test
29998 Serialize new table cells in a HTML row using HTML tags
29999 !! options
30000 parsoid={
30001 "modes": ["wt2wt", "selser"],
30002 "changes": [
30003 [ "td", "before", "<td>X</td>" ]
30004 ]
30005 }
30006 !! wikitext
30007 <table><tr><td>a</td></tr></table>
30008 !! wikitext/edited
30009 <table><tr><td>X</td><td>a</td></tr></table>
30010 !! end
30011
30012 !! test
30013 Serialize wikitext list items as HTML list items when embedded in a HTML list
30014 !! options
30015 parsoid=html2wt
30016 !! html/parsoid
30017 <ul data-parsoid='{"stx": "html"}'>
30018 <li data-parsoid='{}'>a</li>
30019 <li>b</li>
30020 </ul>
30021 !! wikitext
30022 <ul>
30023 <li>a</li>
30024 <li>b</li>
30025 </ul>
30026 !! html/php+tidy
30027 <ul>
30028 <li>a</li>
30029 <li>b</li>
30030 </ul>
30031 !! end
30032
30033 # Nested list should be inside <li>, that is
30034 # <ul><li>foo<ul>..</ul></li></ul> instead of
30035 # <ul><li>foo</li><ul>..</ul></ul>
30036 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
30037 !! test
30038 Wikitext lists can be nested inside HTML lists
30039 !! options
30040 parsoid=html2wt
30041 !! html/parsoid
30042 <ul data-parsoid='{"stx": "html"}'>
30043 <li data-parsoid='{"stx": "html"}'>a
30044 <ul><li>b</li></ul>
30045 </li>
30046 </ul>
30047
30048 <ul data-parsoid='{"stx": "html"}'>
30049 <li>x
30050 <ul><li>y</li></ul>
30051 </li>
30052 </ul>
30053 !! wikitext
30054 <ul>
30055 <li>a
30056 * b
30057 </li>
30058 </ul>
30059
30060 <ul>
30061 <li>x
30062 * y
30063 </li>
30064 </ul>
30065 !! html/php+tidy
30066 <ul>
30067 <li>a
30068 <ul><li>b</li></ul>
30069 </li>
30070 </ul>
30071 <ul>
30072 <li>x
30073 <ul><li>y</li></ul>
30074 </li>
30075 </ul>
30076 !! end
30077
30078 !! test
30079 WTS change modes
30080 !! options
30081 parsoid={
30082 "modes": ["wt2wt"],
30083 "changes": [
30084 [ "#xyz", "before", "<b>before</b> stuff " ],
30085 [ "#xyz", "after", " stuff <i>after</i>" ],
30086 [ "#xyz", "html", "x <b>y</b> z" ]
30087 ]
30088 }
30089 !! wikitext
30090 <span id="xyz">hello</span>
30091 !! wikitext/edited
30092 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
30093 !! end
30094
30095 !! test
30096 Never serialize a-tag as html, regardless of what data-parsoid has to say
30097 !! options
30098 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30099 !! html/parsoid
30100 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
30101 !! wikitext
30102 [[Foo]]
30103 !! end
30104
30105 ## SSS FIXME: This is broken output nevertheless.
30106 ## What might be a reasonable non-broken output for this?
30107 ## This is an edge case unlikely to be seen in production
30108 ## that I am not wasting more time on this right now.
30109 !! test
30110 Never serialize a-tag as html, no matter what attributes it has
30111 !! options
30112 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30113 !! html/parsoid
30114 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
30115 !! wikitext
30116 [http://boo.org http://boohoo.org]
30117 !! end
30118
30119 # Misnested is an indication that selser can reuse the source but these have
30120 # shown to sneak through on occasion. See T101768.
30121 # The original wikitext here is: [http://test.com [[one]] two three]
30122 !! test
30123 Strip span tags added to mark misnested links
30124 !! options
30125 parsoid=html2wt
30126 !! html/parsoid
30127 <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>
30128 !! wikitext
30129 [http://test.com][[one]] two three
30130 !! end
30131
30132 !! test
30133 Catch regression when unpacking misnested links
30134 !! options
30135 parsoid=wt2html
30136 !! wikitext
30137 {{echo|hi}}[http://example.com [[ho]]]
30138 !! html/parsoid
30139 <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" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
30140 !! end
30141
30142 !! test
30143 Catch regression when unpacking with trailing content
30144 !! wikitext
30145 {{echo|Foo <references/> bar}}
30146 !! html/parsoid
30147 <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>
30148 !! end
30149
30150 !! test
30151 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
30152 !! options
30153 parsoid=html2wt
30154 !! html/parsoid
30155 <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|}"]}'>
30156 <tbody><tr><td>d
30157 </td></tr>
30158 </tbody></table>
30159 !! wikitext
30160 {{echo|a}}
30161 {|{{echo|c
30162 {{!}}d
30163 }}
30164 |}
30165 !! end
30166
30167 ## This test verifies the presence and computation of this attribute indirectly
30168 ## by making an edit and ensuring that the serialization is correct (which it would be
30169 ## only if firstWikitextNode is properly set).
30170 !! test
30171 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30172 !! options
30173 parsoid= {
30174 "modes": ["wt2wt"],
30175 "changes": [
30176 [ "div#x", "remove" ],
30177 [ "div", "before", "<div>new</div>" ]
30178 ]
30179 }
30180 !! wikitext
30181 <div id="x">foo</div>
30182 {|
30183 {{echo|<div>boo</div>
30184 {{!}}b}}
30185 |c
30186 |}
30187 !! wikitext/edited
30188
30189 <div>new</div>
30190 {|
30191 {{echo|<div>boo</div>
30192 {{!}}b}}
30193 |c
30194 |}
30195 !! end
30196
30197 ## Don't necessarily expect this to roundtrip, but run serialization to catch crashers
30198 !! test
30199 File in link scenarios
30200 !! options
30201 parsoid={
30202 "modes": ["wt2html","html2wt"],
30203 "suppressErrors": true
30204 }
30205 !! wikitext
30206 [http://www.google.com [[File:Foobar.jpg|123]]]
30207
30208 [http://www.google.com [[File:Foobar.jpg|thumb|123]]]
30209 !! html/php+tidy
30210 <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>
30211 </p>
30212 <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>
30213 !! html/parsoid
30214 <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com" 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>
30215
30216 <a rel="mw:ExtLink" class="external autonumber" href="http://www.google.com" 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" class="external autonumber" href="http://www.google.com" 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>
30217 !! end
30218
30219 # --------------------------------------------
30220 # Tests spec'ing wikitext serialization norms |
30221 # --------------------------------------------
30222
30223 !! test
30224 Serialize multi-line indent-pre starting with wikitext syntax
30225 !! options
30226 parsoid=html2wt
30227 !! html/parsoid
30228 <pre>* 1
30229 ** 2
30230 * 3</pre>
30231 !! wikitext
30232 * 1
30233 ** 2
30234 * 3
30235 !! end
30236
30237 !! test
30238 1. Categories should always be serialized on their own line
30239 !! options
30240 parsoid=html2wt
30241 !! html/parsoid
30242 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30243 !! wikitext
30244 foo
30245 [[Category:Foo]]
30246 bar
30247 !! end
30248
30249 !! test
30250 2. Categories that are part of templates should not introduce a line break
30251 !! wikitext
30252 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30253 !! html/parsoid
30254 <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>
30255 !! end
30256
30257 # Careful while editing these next 2 tests. There are \u200f characters
30258 # before and after the <link> tags in the HTML and following some
30259 # of the categories in wikitext
30260 # Do not remove these characters in edits.
30261 #
30262 # As part of the serialization, these bidi characters will get stripped.
30263 !! test
30264 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30265 !! options
30266 parsoid={
30267 "modes": ["html2wt"],
30268 "scrubWikitext": true
30269 }
30270 !! html/parsoid
30271 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30272 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30273 !! wikitext
30274 [[קטגוריה:טקסים]]
30275 [[קטגוריה: שיטות משפט]]
30276 !! end
30277
30278 !! test
30279 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30280 !! options
30281 parsoid={
30282 "modes": ["html2wt"],
30283 "scrubWikitext": true
30284 }
30285 !! html/parsoid
30286 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30287 !! wikitext
30288 [[קטגוריה:טקסים]]
30289 ‏y
30290 !! end
30291
30292 !! test
30293 Lists: Add space after bullets
30294 !! options
30295 parsoid=html2wt
30296 !! html/parsoid
30297 <ul>
30298 <li>foo</li>
30299 <li> bar</li>
30300 <li><span> baz</span></li>
30301 </ul>
30302 !! wikitext
30303 * foo
30304 * bar
30305 * <span> baz</span>
30306 !! end
30307
30308 !! test
30309 1. Headings: Add space before/after == (T53744)
30310 !! options
30311 parsoid=html2wt
30312 !! html/parsoid
30313 <h2>foo</h2>
30314 <h2> bar</h2>
30315 <h2>baz </h2>
30316 <h2><span> baz</span></h2>
30317 !! wikitext
30318 == foo ==
30319
30320 == bar ==
30321
30322 == baz ==
30323
30324 == <span> baz</span> ==
30325 !! end
30326
30327 !! test
30328 2. Headings: Add space before/after == even after hoisted content
30329 !! options
30330 parsoid={
30331 "modes": ["html2wt"],
30332 "scrubWikitext": true
30333 }
30334 !! html/parsoid
30335 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30336 !! wikitext
30337 [[Category:A2]]
30338
30339 == ok ==
30340 !! end
30341
30342 !! test
30343 1. Headings: suppress newly created empty headings
30344 !! options
30345 parsoid={
30346 "modes": ["html2wt"],
30347 "scrubWikitext": true
30348 }
30349 !! html/parsoid
30350 <h2></h2>
30351 !! wikitext
30352 !! end
30353
30354 !! test
30355 2. Headings: don't suppress empty headings if scrubWikitext is false
30356 !! options
30357 parsoid=html2wt
30358 !! html/parsoid
30359 <h2></h2>
30360 !! wikitext
30361 ==<nowiki/>==
30362 !! end
30363
30364 !! test
30365 3. Headings: suppress empty headings on edits
30366 !! options
30367 parsoid={
30368 "modes": ["selser"],
30369 "scrubWikitext": true,
30370 "changes": [
30371 [ "#x", "remove"]
30372 ]
30373 }
30374 !! wikitext
30375 ==<span id="x">foo</span>==
30376 !! wikitext/edited
30377 !! end
30378
30379 !! test
30380 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30381 !! options
30382 parsoid={
30383 "modes": ["html2wt"],
30384 "scrubWikitext": true
30385 }
30386 !! html/parsoid
30387 <h2>foo<br/>bar</h2>
30388 <h2>foo <span><br/>bar</span> baz</h2>
30389 !! wikitext
30390 == foo bar ==
30391
30392 == foo <span> bar</span> baz ==
30393 !! end
30394
30395 !! test
30396 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30397 !! options
30398 parsoid={
30399 "modes": ["html2wt"],
30400 "scrubWikitext": false
30401 }
30402 !! html/parsoid
30403 <h2>foo<br/>bar</h2>
30404 !! wikitext
30405 == foo<br />bar ==
30406 !! end
30407
30408 !! test
30409 1. WT Quote Tags: suppress newly created empty style tags
30410 !! options
30411 parsoid={
30412 "modes": ["html2wt"],
30413 "scrubWikitext": true
30414 }
30415 !! html/parsoid
30416 <i></i><b></b>
30417 !! wikitext
30418 !! end
30419
30420 !! test
30421 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30422 !! options
30423 parsoid=html2wt
30424 !! html/parsoid
30425 <i></i><b></b>
30426 !! wikitext
30427 ''<nowiki/>'''''<nowiki/>'''
30428 !! end
30429
30430 !! test
30431 3. WT Quote Tags: suppress empty style tags on edits
30432 !! options
30433 parsoid={
30434 "modes": ["selser"],
30435 "scrubWikitext": true,
30436 "changes": [
30437 [ "#x", "remove"]
30438 ]
30439 }
30440 !! wikitext
30441 '''<span id="x">foo</span>'''
30442 !! wikitext/edited
30443 !! end
30444
30445 !! test
30446 1. Anchors: suppress newly created empty anchors
30447 !! options
30448 parsoid={
30449 "modes": ["html2wt"],
30450 "scrubWikitext": true
30451 }
30452 !! html/parsoid
30453 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30454 !! wikitext
30455 !! end
30456
30457 !! test
30458 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30459 !! options
30460 parsoid={
30461 "modes": ["html2wt"],
30462 "scrubWikitext": false
30463 }
30464 !! html/parsoid
30465 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30466 !! wikitext
30467 [[Test|<nowiki/>]]
30468 !! end
30469
30470 !! test
30471 3. Anchors: suppress empty anchors on edits
30472 !! options
30473 parsoid={
30474 "modes": ["selser"],
30475 "scrubWikitext": true,
30476 "changes": [
30477 [ "#x", "remove"]
30478 ]
30479 }
30480 !! wikitext
30481 [[Test|<span id="x">foo</span>]]
30482 !! wikitext/edited
30483 !! end
30484
30485 !! test
30486 3a. Anchors: do not suppress numbered extlinks
30487 !! options
30488 parsoid={
30489 "modes": ["wt2wt"],
30490 "scrubWikitext": true
30491 }
30492 !! wikitext
30493 [http://foo.com]
30494 !! html/parsoid
30495 <a rel="mw:ExtLink" href="http://foo.com"></a>
30496 !! end
30497
30498 !! test
30499 3b. Anchors: do not suppress numbered extlinks
30500 !! options
30501 parsoid={
30502 "modes": ["wt2wt"],
30503 "scrubWikitext": true,
30504 "changes": [
30505 [ "#x", "remove"]
30506 ]
30507 }
30508 !! wikitext
30509 [http://foo.com <span id="x">foo</span>]
30510 !! wikitext/edited
30511 [http://foo.com]
30512 !! end
30513
30514 !!test
30515 Normalizations should be restricted to edited content
30516 !!options
30517 parsoid={
30518 "modes": ["selser"],
30519 "scrubWikitext": true,
30520 "changes": [
30521 [ "h1", "before", "<i></i>"]
30522 ]
30523 }
30524 !!wikitext
30525 a
30526 = =
30527 b
30528 !!wikitext/edited
30529 a
30530 = =
30531 b
30532 !!end
30533
30534 !! test
30535 1. Multiple normalizations (html2wt)
30536 !! options
30537 parsoid={
30538 "modes": ["html2wt"],
30539 "scrubWikitext": true
30540 }
30541 !! html/parsoid
30542 <h2><i></i></h2>
30543 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30544 </a><b><i></i></b>x</p>
30545 !! wikitext
30546
30547 [[foo]]
30548 x
30549 !! end
30550
30551 !! test
30552 2. Multiple normalizations (selser)
30553 !! options
30554 parsoid={
30555 "modes": ["selser"],
30556 "scrubWikitext": true,
30557 "changes": [
30558 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30559 ]
30560 }
30561 !! wikitext
30562 <div id="x">foo</div>
30563 !! wikitext/edited
30564 <div id="x">foo</div>
30565 bar
30566 !! end
30567
30568 !! test
30569 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30570 !! options
30571 parsoid={
30572 "modes": ["html2wt"],
30573 "scrubWikitext": true
30574 }
30575 !! html/parsoid
30576 <p> hi</p>
30577 <p> hello</p>
30578 !! wikitext
30579 hi
30580
30581 hello
30582 !! end
30583
30584 !! test
30585 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30586 !! options
30587 parsoid=html2wt
30588 !! html/parsoid
30589 <p> hi</p>
30590 <p> hello</p>
30591 !! wikitext
30592 <nowiki> </nowiki>hi
30593
30594 <nowiki> </nowiki> hello
30595 !! end
30596
30597 !! test
30598 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30599 !! options
30600 parsoid={
30601 "modes": ["html2wt"],
30602 "scrubWikitext": true
30603 }
30604 !! html/parsoid
30605 <p>Foo
30606 bar
30607 baz</p>
30608
30609 <table><tr><td>Foo
30610 bar
30611 baz bang</td></tr></table>
30612
30613 <p><!--boo--> foo
30614 bar</p>
30615
30616 <p> foo
30617 bar<span>boo</span></p>
30618 !! wikitext
30619 Foo
30620 bar
30621 baz
30622
30623 {|
30624 |Foo
30625 bar
30626 baz bang
30627 |}
30628
30629 <!--boo-->foo
30630 bar
30631
30632 foo
30633 bar<span>boo</span>
30634 !! end
30635
30636 !! test
30637 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30638 !! options
30639 parsoid={
30640 "modes": ["selser"],
30641 "scrubWikitext": true,
30642 "changes": [
30643 [ "p", "html", " a\n b" ]
30644 ]
30645 }
30646 !! wikitext
30647 xyz
30648 !! wikitext/edited
30649 a
30650 b
30651 !! end
30652
30653 !! test
30654 1. New links that end in spaces
30655 !! options
30656 parsoid={
30657 "modes": ["html2wt"],
30658 "scrubWikitext": false
30659 }
30660 !! html/parsoid
30661 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30662 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30663 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30664 !! wikitext
30665 [[Berlin ]]<nowiki/>is the capital of Germany.
30666
30667 [[Foo ]]'''bar'''
30668
30669 [[Boston ]] is a city.
30670 !! end
30671
30672 !! test
30673 2. New links that end in spaces
30674 !! options
30675 parsoid={
30676 "modes": ["html2wt"],
30677 "scrubWikitext": true
30678 }
30679 !! html/parsoid
30680 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30681 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30682 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30683 !! wikitext
30684 [[Berlin]] is the capital of Germany.
30685
30686 [[Foo]] '''bar'''
30687
30688 [[Boston]] is a city.
30689 !! end
30690
30691 !! test
30692 1. Table cells with escapable prefixes
30693 !! options
30694 parsoid={
30695 "modes": ["html2wt"],
30696 "scrubWikitext": false
30697 }
30698 !! html/parsoid
30699 <table>
30700 <tr><td>a</td></tr>
30701 <tr><td>-</td></tr>
30702 <tr><td>+</td></tr>
30703 <tr><td>}</td></tr>
30704 </table>
30705 !! wikitext
30706 {|
30707 |a
30708 |-
30709 |<nowiki>-</nowiki>
30710 |-
30711 |<nowiki>+</nowiki>
30712 |-
30713 |<nowiki>}</nowiki>
30714 |}
30715 !! end
30716
30717 !! test
30718 2. Table cells with escapable prefixes
30719 !! options
30720 parsoid={
30721 "modes": ["html2wt"],
30722 "scrubWikitext": true
30723 }
30724 !! html/parsoid
30725 <table>
30726 <tr><td>a</td></tr>
30727 <tr><td>-</td></tr>
30728 <tr><td>+</td></tr>
30729 <tr><td>}</td></tr>
30730 </table>
30731 !! wikitext
30732 {|
30733 |a
30734 |-
30735 | -
30736 |-
30737 | +
30738 |-
30739 | }
30740 |}
30741 !! end
30742
30743 !! test
30744 3a. Table cells with escapable prefixes after edits
30745 !! options
30746 parsoid={
30747 "modes": ["selser"],
30748 "scrubWikitext": true,
30749 "changes": [
30750 [ "table tbody tr:first-child td:first-child", "remove"]
30751 ]
30752 }
30753 !! wikitext
30754 {|
30755 |a||-
30756 |}
30757 !! wikitext/edited
30758 {|
30759 | -
30760 |}
30761 !! end
30762
30763 !! test
30764 3b. Table cells with escapable prefixes after edits
30765 !! options
30766 parsoid={
30767 "modes": ["selser"],
30768 "scrubWikitext": true,
30769 "changes": [
30770 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30771 [ "#x", "remove" ]
30772 ]
30773 }
30774 !! wikitext
30775 {|
30776 |pqr
30777 |<span id="x">foo</span>+
30778 |}
30779 !! wikitext/edited
30780 {|
30781 | -
30782 | +
30783 |}
30784 !! end
30785
30786 # FIXME: This test will fail because
30787 # normalization doesn't realize that the id attribute
30788 # will eliminate the escapable scenario
30789 !! test
30790 4a. Table cells without escapable prefixes after edits
30791 !! options
30792 parsoid={
30793 "modes": ["selser"],
30794 "scrubWikitext": true,
30795 "changes": [
30796 [ "#x", "html", "-" ]
30797 ]
30798 }
30799 !! wikitext
30800 {|
30801 | id="x" |abcd
30802 |}
30803 !! wikitext/edited
30804 {|
30805 | id="x" |-
30806 |}
30807 !! end
30808
30809 ## This tests normalizer's ability to discriminate between
30810 ## cells having identical content.
30811 !! test
30812 4b. Table cells without escapable prefixes after edits
30813 !! options
30814 parsoid={
30815 "modes": ["selser"],
30816 "scrubWikitext": true,
30817 "changes": [
30818 [ "td", "html", "-" ]
30819 ]
30820 }
30821 !! wikitext
30822 {|
30823 |a||b
30824 |}
30825 !! wikitext/edited
30826 {|
30827 | -||-
30828 |}
30829 !! end
30830
30831 ## This tests normalizer's ability to not be tripped by
30832 ## comments (and whitespace)
30833 !! test
30834 4c. Table cells without escapable prefixes after edits
30835 !! options
30836 parsoid={
30837 "modes": ["selser"],
30838 "scrubWikitext": true,
30839 "changes": [
30840 [ "table tbody tr td:first-child", "remove" ]
30841 ]
30842 }
30843 !! wikitext
30844 {|
30845 |-
30846 <!--foo--> |a||-
30847 |}
30848 !! wikitext/edited
30849 {|
30850 |-
30851 <!--foo--> | -
30852 |}
30853 !! end
30854
30855 ## This tests normalizer's ability to handle HTML cells
30856 !! test
30857 4d. Table cells without escapable prefixes after edits
30858 !! options
30859 parsoid={
30860 "modes": ["selser"],
30861 "scrubWikitext": true,
30862 "changes": [
30863 [ "td", "html", "-" ]
30864 ]
30865 }
30866 !! wikitext
30867 <table>
30868 <tr><td>a</td></tr>
30869 </table>
30870 !! wikitext/edited
30871 <table>
30872 <tr><td>-</td></tr>
30873 </table>
30874 !! end
30875
30876 ## T111151 Remove font elements without attributes
30877 !! test
30878 5a. font tags without attributes should be dropped in scrubWikitext mode
30879 !! options
30880 parsoid={
30881 "modes": ["html2wt"],
30882 "scrubWikitext": true
30883 }
30884 !! html/parsoid
30885 <font>foo</font>
30886 <font><font>bar</font></font>
30887 <font class="x">boo</font>
30888 !! wikitext
30889 foo
30890 bar
30891 <font class="x">boo</font>
30892 !! end
30893
30894 !! test
30895 5b. font tags should not be dropped without scrubWikitext being enabled
30896 !! options
30897 parsoid={
30898 "modes": ["html2wt"],
30899 "scrubWikitext": false
30900 }
30901 !! html/parsoid
30902 <font>foo</font>
30903 !! wikitext
30904 <font>foo</font>
30905 !! end
30906
30907 !! test
30908 Ignore empty <p></p> when scrubWikitext is false
30909 !! options
30910 parsoid={
30911 "modes": ["html2wt"],
30912 "scrubWikitext": false
30913 }
30914 !! html/parsoid
30915 <div>1</div>
30916 <p>a</p><p></p><p>b</p>
30917 <div>2</div>
30918 <p>a</p>
30919 <p></p>
30920 <p>b</p>
30921 <div>3</div>
30922 <p>a</p>
30923 <p></p>
30924 <p></p>
30925 <p></p>
30926 <p></p>
30927 <p>b</p>
30928 !! wikitext
30929 <div>1</div>
30930 a
30931
30932 b
30933 <div>2</div>
30934 a
30935
30936 b
30937 <div>3</div>
30938 a
30939
30940 b
30941 !! html/php+tidy
30942 <div>1</div>
30943 <p>a
30944 </p><p>b
30945 </p>
30946 <div>2</div>
30947 <p>a
30948 </p><p>b
30949 </p>
30950 <div>3</div>
30951 <p>a
30952 </p><p>b
30953 </p>
30954 !! end
30955
30956 !! test
30957 Normalize empty paragraphs to HTML form that html2wt expects
30958 !! options
30959 parsoid={
30960 "modes": ["html2wt"],
30961 "scrubWikitext": true
30962 }
30963 !! html/parsoid
30964 <div>1</div>
30965 <p>a</p><p></p><p>b</p>
30966 <div>2</div>
30967 <p>a</p>
30968 <p></p>
30969 <p>b</p>
30970 <div>3</div>
30971 <p>a</p>
30972 <p></p>
30973 <p></p>
30974 <p></p>
30975 <p></p>
30976 <p>b</p>
30977 <div>4</div>
30978 <p>a</p>
30979 <p></p>
30980 <div>foo</div>
30981 !! wikitext
30982 <div>1</div>
30983 a
30984
30985
30986 b
30987 <div>2</div>
30988 a
30989
30990
30991 b
30992 <div>3</div>
30993 a
30994
30995
30996
30997
30998
30999 b
31000 <div>4</div>
31001 a
31002
31003 <br />
31004 <div>foo</div>
31005 !! html/php+tidy
31006 <div>1</div>
31007 <p>a
31008 </p><p><br />
31009 b
31010 </p>
31011 <div>2</div>
31012 <p>a
31013 </p><p><br />
31014 b
31015 </p>
31016 <div>3</div>
31017 <p>a
31018 </p><p><br />
31019 </p><p><br />
31020 </p><p>b
31021 </p>
31022 <div>4</div>
31023 <p>a
31024 </p><p><br />
31025 </p>
31026 <div>foo</div>
31027 !! end
31028
31029 !! test
31030 Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away
31031 !! options
31032 parsoid={
31033 "modes": ["html2wt"],
31034 "scrubWikitext": true
31035 }
31036 !! html/parsoid
31037 <table>
31038 <tbody>
31039 <tr>
31040 <td><div>foo
31041 </div>
31042 <p class="mw-empty-elt"></p>
31043 </td>
31044 </tr>
31045 </tbody>
31046 <caption></caption>
31047 </table>
31048 !! wikitext
31049 {|
31050 |<div>foo
31051 </div>
31052 |+
31053 |}
31054 !! end
31055
31056 !! test
31057 Templated content should be skipped over by normalization
31058 !! options
31059 parsoid={
31060 "modes": ["html2wt"],
31061 "scrubWikitext": true
31062 }
31063 !! html/parsoid
31064 <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">
31065 </span><p about="#mwt2"></p><span about="#mwt2">
31066 </span>
31067 !! wikitext
31068 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
31069 !! end
31070
31071 !! test
31072 Escape nowiki DOM elements
31073 !! options
31074 parsoid=html2wt
31075 !! html/parsoid
31076 <nowiki><i>foo</i></nowiki>
31077 !! wikitext
31078 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
31079 !! end
31080
31081 # This is meant to be an interim fix while we go about figuring out
31082 # how to not introduce these trailing <nowiki/>s in the first place.
31083 !! test
31084 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
31085 !! options
31086 parsoid=html2wt
31087 !! html/parsoid
31088 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
31089 y</p>
31090 <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>
31091 <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>
31092 !! wikitext
31093 x
31094 y
31095
31096 {{echo|
31097 1 = <nowiki/>}}
31098
31099 {{echo|
31100 1 = <nowiki/>
31101 }}
31102 !! end
31103
31104 !! test
31105 New list is serialized on newlines
31106 !! options
31107 parsoid=html2wt
31108 !! html/parsoid
31109 <p>The quick brown fox jumps over the lazy dog.</p><ul>
31110 <li>Yesterday</li>
31111 <li>Today</li>
31112 <li>Tomorrow</li>
31113 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
31114 !! wikitext
31115 The quick brown fox jumps over the lazy dog.
31116
31117 * Yesterday
31118 * Today
31119 * Tomorrow
31120
31121 The quick onyx goblin jumps over the lazy dwarf.
31122 !! end
31123
31124 !! test
31125 New lists in formatting elements serialized w/o newlines
31126 !! options
31127 parsoid=html2wt
31128 !! html/parsoid
31129 <small>
31130
31131 <ul>
31132 <li>123</li>
31133 </ul>
31134
31135 </small>
31136
31137 <small><ul><li>hi</li></ul></small>
31138 !! wikitext
31139 <small>
31140 * 123
31141 </small>
31142
31143 <small>
31144 * hi
31145 </small>
31146 !! end
31147
31148 !! test
31149 New list in table doesn't need newlines
31150 !! options
31151 parsoid=html2wt
31152 !! html/parsoid
31153 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
31154 !! wikitext
31155 {|
31156 |
31157 * test
31158 * 123
31159 |}
31160 !! end
31161
31162 # ---------------------------------------------------
31163 # End of tests spec'ing wikitext serialization norms |
31164 # ---------------------------------------------------
31165
31166 # T104032
31167 !! test
31168 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
31169 !! options
31170 parsoid=html2wt
31171 !! html/parsoid
31172 a<p>b</p>
31173 <b>c</b><p>d</p>
31174 <table><tr>
31175 <td>a<p>b</p></td>
31176 <td><b>c</b><p>d</p></td>
31177 </tr></table>
31178 !! wikitext
31179 a
31180
31181 b
31182
31183 '''c'''
31184
31185 d
31186 {|
31187 |a
31188 b
31189 |'''c'''
31190 d
31191 |}
31192 !! end
31193
31194 !! test
31195 Anchor without href scenarios
31196 !! options
31197 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
31198 !! html/parsoid
31199 <a class="bc"></a>
31200 <a class="no">dice</a>
31201 <a name="foo"></a>
31202 !! wikitext
31203
31204 dice
31205 <span name="foo"></span>
31206 !! end
31207
31208 !! test
31209 New transclusion added after a list should be serialized after the list
31210 !! options
31211 parsoid=html2wt
31212 !! html/parsoid
31213 <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>
31214 !! wikitext
31215 * a
31216 {{echo|foo}}
31217 !! end
31218
31219 # -----------------------------------------------------------------
31220 # End of section for Parsoid-only html2wt tests for serialization
31221 # of new content
31222 # -----------------------------------------------------------------
31223
31224 # -----------------------------------------------------------------
31225 # The following section of tests are primarily to spec behavior of
31226 # the selective serializer. All these tests have manual selser
31227 # changes. The automated selser changes for all tests handle the
31228 # wide variation of changes, but these tests here capture specs
31229 # deterministically.
31230 # ----------------------------------------------------------------
31231
31232 ## T90517
31233 !! test
31234 Selser: New comments should not be lost
31235 !! options
31236 parsoid={
31237 "modes": ["selser"],
31238 "changes": [
31239 [ "#a", "after", "<!--c1-->" ],
31240 [ "#b", "before", "<!--c2-->" ]
31241 ]
31242 }
31243 !! wikitext
31244 <span id="a">a</span>
31245
31246 <span id="b">b</span>
31247 !! wikitext/edited
31248 <span id="a">a</span><!--c1-->
31249
31250 <!--c2--><span id="b">b</span>
31251 !! end
31252
31253 ## T89383
31254 !! test
31255 Selser: Check for validity of DSR before using it
31256 !! options
31257 parsoid={
31258 "modes": ["selser"],
31259 "changes": [
31260 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31261 ]
31262 }
31263 !! wikitext
31264 <span id="a">a</span>
31265 !! wikitext/edited
31266 {{DISPLAYTITLE:foo}}
31267 <span id="a">a</span>
31268 !! end
31269
31270 !! test
31271 1. DOMDiff: Changes to <ref> content should be looked up using id
31272 !! options
31273 parsoid={
31274 "modes": ["selser"],
31275 "changes": [
31276 ["#X", "after", "bar"],
31277 ["#Y", "after", "baz"]
31278 ]
31279 }
31280 !! wikitext
31281 X <ref><span id="X">foo</span></ref>
31282 Y <ref name="a" />
31283 <references>
31284 <ref name="a"><span id="Y">foo</span></ref>
31285 </references>
31286 !! wikitext/edited
31287 X <ref><span id="X">foo</span>bar</ref>
31288 Y <ref name="a" />
31289 <references>
31290 <ref name="a"><span id="Y">foo</span>baz</ref>
31291 </references>
31292 !! end
31293
31294 !! test
31295 2. DOMDiff: Changes to <ref> content should be looked up using id
31296 !! options
31297 parsoid={
31298 "modes": ["selser"],
31299 "changes": [
31300 ["#Z", "after", "bar"]
31301 ]
31302 }
31303 !! wikitext
31304 A <ref>foo bar for a</ref>
31305 B <ref group="X" name="b" />
31306
31307 <references />
31308
31309 <references group="X">
31310 <ref name="b"><span id="Z">foo</span></ref>
31311 </references>
31312 !! wikitext/edited
31313 A <ref>foo bar for a</ref>
31314 B <ref group="X" name="b" />
31315
31316 <references />
31317
31318 <references group="X">
31319 <ref name="b"><span id="Z">foo</span>bar</ref>
31320 </references>
31321 !! end
31322
31323 !! test
31324 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31325 !! options
31326 parsoid={
31327 "modes": ["selser"],
31328 "changes": [
31329 [ "div:first-child", "text", "bar" ]
31330 ]
31331 }
31332 !! wikitext
31333 <div style="{{1x|color:red;}}%">foo</div>
31334 !! wikitext/edited
31335 <div style="{{1x|color:red;}}%">bar</div>
31336 !! end
31337
31338 !! test
31339 Empty LI (T49673)
31340 !! wikitext
31341 *a
31342 *
31343 *
31344 *b
31345 !! html+tidy
31346 <ul><li>a</li>
31347 <li class="mw-empty-elt"></li>
31348 <li class="mw-empty-elt"></li>
31349 <li>b</li></ul>
31350 !! end
31351
31352 !! test
31353 Thumbnail output
31354 !! wikitext
31355 [[File:Thumb.png|thumb]]
31356 !! html/php+tidy
31357 <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>
31358 !! html/parsoid
31359 <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>
31360 !! end
31361
31362 !! test
31363 unclosed internal link XSS (T137264)
31364 !! wikitext
31365 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31366 !! html/php
31367 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31368 </p>
31369 !! html/parsoid
31370 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31371 !! end
31372
31373 !! test
31374 Validating that <style> isn't eaten by tidy (T167349)
31375 !! options
31376 styletag=1
31377 !! wikitext
31378 <div class="foo">
31379 <style>.foo::before { content: "<foo>"; }</style>
31380 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31381 </div>
31382 !! html/php+tidy
31383 <div class="foo">
31384 <style>.foo::before { content: "<foo>"; }</style>
31385 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31386 </div>
31387 !! html/parsoid
31388 <div class="foo">
31389 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31390 <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>
31391 </div>
31392 !! end
31393
31394 ## Right now, Parsoid doesn't de-duplicate style tags.
31395 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31396 ## In a followup patch, when we de-duplicate style tags and
31397 ## introduce link tags, we'll add a hook for link tags in
31398 ## the parser test runner script.
31399 !! test
31400 Validating that <style> isn't wrapped in a paragraph (T186965)
31401 !! options
31402 styletag=1
31403 !! wikitext
31404 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31405
31406 <style>.foo::before { content: "<foo>"; }</style>
31407
31408 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31409
31410 But if it's on a line with other content, let it be wrapped.
31411
31412 <style>.foo::before { content: "<foo>"; }</style> bar
31413
31414 foo <style>.foo::before { content: "<foo>"; }</style>
31415
31416 foo <style>.foo::before { content: "<foo>"; }</style> bar
31417
31418 And the same if we have non-paragraph-breaking whitespace
31419
31420 foo
31421 <style>.foo::before { content: "<foo>"; }</style>
31422 bar
31423 !! html/php
31424 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31425 </p>
31426 <style>.foo::before { content: "<foo>"; }</style>
31427 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31428 <p>But if it's on a line with other content, let it be wrapped.
31429 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31430 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31431 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31432 </p><p>And the same if we have non-paragraph-breaking whitespace
31433 </p><p>foo
31434 <style>.foo::before { content: "<foo>"; }</style>
31435 bar
31436 </p>
31437 !! html/parsoid
31438 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31439
31440 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31441
31442 <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>
31443
31444 <p>But if it's on a line with other content, let it be wrapped.</p>
31445
31446 <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>
31447
31448 <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>
31449
31450 <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>
31451
31452 <p>And the same if we have non-paragraph-breaking whitespace</p>
31453
31454 <p>foo
31455 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31456 bar</p>
31457 !! end
31458
31459 !! test
31460 Validating that <link> isn't wrapped in a paragraph (T186965)
31461 !! options
31462 styletag=1
31463 !! wikitext
31464 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31465
31466 <link rel="foo" href="bar"/>
31467
31468 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31469
31470 But if it's on a line with other content, let it be wrapped.
31471
31472 <link rel="foo" href="bar"/> bar
31473
31474 foo <link rel="foo" href="bar"/>
31475
31476 foo <link rel="foo" href="bar"/> bar
31477
31478 And the same if we have non-paragraph-breaking whitespace
31479
31480 foo
31481 <link rel="foo" href="bar"/>
31482 bar
31483 !! html/php
31484 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31485 </p>
31486 <link rel="foo" href="bar"/>
31487 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31488 <p>But if it's on a line with other content, let it be wrapped.
31489 </p><p><link rel="foo" href="bar"/> bar
31490 </p><p>foo <link rel="foo" href="bar"/>
31491 </p><p>foo <link rel="foo" href="bar"/> bar
31492 </p><p>And the same if we have non-paragraph-breaking whitespace
31493 </p><p>foo
31494 <link rel="foo" href="bar"/>
31495 bar
31496 </p>
31497 !! end
31498
31499 !! test
31500 Extension returning multiple nodes starting with a style tag roundtrips
31501 !! options
31502 wgRawHtml=1
31503 !! wikitext
31504 <table>
31505 {{echo|<html><style>.hi { color: red; }</style>
31506 </html>}}
31507 <tr><td class="hi">ho</td></tr>
31508 </table>
31509 !! html/parsoid
31510 <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">
31511 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31512
31513 <tbody><tr><td class="hi">ho</td></tr>
31514 </tbody></table>
31515 !! end
31516
31517 !! test
31518 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31519 !! config
31520 wgFragmentMode=[ 'html5', 'legacy' ]
31521 !! wikitext
31522 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31523 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31524 !! html/php
31525 <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>
31526 <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>
31527 </p>
31528 !! html/parsoid
31529 <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>
31530 <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>
31531 !! end
31532
31533 !! test
31534 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31535 !! config
31536 wgFragmentMode=[ 'legacy' ]
31537 !! wikitext
31538 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31539 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31540 !! html/php
31541 <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>
31542 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31543 </p>
31544 !! end
31545
31546 !! test
31547 Decoding of HTML entities in embedded HTML tags
31548 !! wikitext
31549 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31550 !! html/php
31551 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31552 !! html/parsoid
31553 <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>
31554 !! end
31555
31556 !! test
31557 Decoding of HTML entities in indicator names for IDs (T104196)
31558 !! options
31559 parsoid=wt2html,html2html
31560 showindicators
31561 !! wikitext
31562 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31563 !! html/php
31564 1&2&3&amp;4&amp;amp;5=Indicator
31565
31566 !! html/parsoid
31567 <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>
31568 !! end
31569
31570 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31571 !! test
31572 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31573 !! options
31574 showindicators
31575 !! wikitext
31576 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31577 !! html/php
31578 1&2&3&amp;4&amp;amp;5=Indicator
31579
31580 !! html/parsoid
31581 <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>
31582 !! end
31583
31584 # This fragment mode is what Parsoid supports.
31585 !! test
31586 HTML5 ids: fallback to legacy
31587 !! config
31588 wgFragmentMode=[ 'html5', 'legacy' ]
31589 !! wikitext
31590 ==Foo bar==
31591
31592 ==foo Bar==
31593
31594 ==Тест==
31595
31596 ==Тест==
31597
31598 ==тест==
31599
31600 ==Hey < # " > % : '==
31601 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31602
31603 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31604
31605 <!-- These two links should produce identical HTML -->
31606 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31607
31608 !! html/php
31609 <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>
31610 <ul>
31611 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31612 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31613 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31614 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31615 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31616 <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>
31617 </ul>
31618 </div>
31619
31620 <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>
31621 <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>
31622 <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>
31623 <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>
31624 <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>
31625 <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>
31626 <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>
31627 </p><p>💩 <span id="💩"></span>
31628 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31629 </p>
31630 !! html/parsoid
31631 <h2 id="Foo_bar">Foo bar</h2>
31632
31633 <h2 id="foo_Bar_2">foo Bar</h2>
31634
31635 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31636
31637 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31638
31639 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31640
31641 <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>
31642 <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>
31643
31644 <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>
31645
31646 <!-- These two links should produce identical HTML -->
31647 <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>
31648 !! end
31649
31650 # Parsoid doesn't support this mode
31651 !! test
31652 HTML5 ids: legacy with a fallback to modern
31653 !! config
31654 wgFragmentMode=[ 'legacy', 'html5' ]
31655 !! wikitext
31656 ==Foo bar==
31657
31658 ==foo Bar==
31659
31660 ==Тест==
31661
31662 ==Тест==
31663
31664 ==тест==
31665
31666 ==Hey < # " > % : '==
31667 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31668
31669 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31670
31671 <!-- These two links should produce identical HTML -->
31672 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31673
31674 !! html/php
31675 <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>
31676 <ul>
31677 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31678 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31679 <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>
31680 <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>
31681 <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>
31682 <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>
31683 </ul>
31684 </div>
31685
31686 <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>
31687 <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>
31688 <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>
31689 <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>
31690 <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>
31691 <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>
31692 <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>
31693 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31694 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31695 </p>
31696 !! end
31697
31698 # Parsoid doesn't support this mode.
31699 !! test
31700 HTML5 ids: no legacy
31701 !! config
31702 wgFragmentMode=[ 'html5' ]
31703 !! wikitext
31704 ==Foo bar==
31705
31706 ==foo Bar==
31707
31708 ==Тест==
31709
31710 ==Тест==
31711
31712 ==тест==
31713
31714 ==Hey < # " > % : '==
31715 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31716
31717 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31718
31719 <!-- These two links should produce identical HTML -->
31720 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31721
31722 !! html/php
31723 <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>
31724 <ul>
31725 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31726 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31727 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31728 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31729 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31730 <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>
31731 </ul>
31732 </div>
31733
31734 <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>
31735 <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>
31736 <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>
31737 <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>
31738 <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>
31739 <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>
31740 <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>
31741 </p><p>💩 <span id="💩"></span>
31742 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31743 </p>
31744 !! end
31745
31746 !! test
31747 T90902: Normalize weird characters in section IDs
31748 !! config
31749 wgFragmentMode=[ 'html5', 'legacy' ]
31750 !! wikitext
31751 ==Foo&nbsp;bar==
31752 [[#Foo&nbsp;bar]]
31753
31754 !! html/php
31755 <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>
31756 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31757 </p>
31758 !! html/parsoid
31759 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31760 <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>
31761 !! end
31762
31763 !! test
31764 T51672: Test for brackets in attributes of elements in external link texts
31765 !! wikitext
31766 [http://example.com/ link <span title="title with [brackets]">span</span>]
31767 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31768
31769 !! html/php
31770 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31771 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31772 </p>
31773 !! html/parsoid
31774 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31775 <a rel="mw:ExtLink" class="external text" href="http://example.com/">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>
31776 !! end
31777
31778 !! test
31779 T72875: Test for brackets in attributes of elements in internal link texts
31780 !! wikitext
31781 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31782 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31783
31784 !! html/php
31785 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31786 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31787 </p>
31788 !! html/parsoid
31789 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31790 <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>
31791 !! end
31792
31793 !! test
31794 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31795 !! options
31796 parsoid={
31797 "modes": ["html2wt"]
31798 }
31799 !! html/parsoid
31800 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31801 <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>
31802 !! wikitext
31803 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31804 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31805 !! end
31806
31807 ## FIXME: "gerrit" isn't in PHP's setupInterwikis
31808 !! test
31809 T199926: Hash only interwiki link
31810 !! wikitext
31811 [[meatball:Test#1/2]]
31812 [[gerrit:#/q/project:mediawiki/services/parsoid|Gerrit]]
31813 !! html/php+tidy
31814 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" class="extiw" title="meatball:Test">meatball:Test#1/2</a>
31815 <a href="/index.php?title=Gerrit:&amp;action=edit&amp;redlink=1" class="new" title="Gerrit: (page does not exist)">Gerrit</a>
31816 </p>
31817 !! html/parsoid
31818 <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>
31819 <a rel="mw:WikiLink/Interwiki" href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid">Gerrit</a></p>
31820 !! end
31821
31822 !! test
31823 T179544: {{anchorencode:}} output should be always usable in links
31824 !! config
31825 wgFragmentMode=[ 'html5' ]
31826 !! wikitext
31827 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31828 !! html/php
31829 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31830 </p>
31831 !! html/parsoid
31832 <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>
31833 !! end
31834
31835 ## ------------------------------
31836 ## Parsoid section-wrapping tests
31837 ## ------------------------------
31838 !! test
31839 Section wrapping for well-nested sections (no leading content)
31840 !! options
31841 notoc
31842 parsoid={
31843 "wrapSections": true
31844 }
31845 !! wikitext
31846 =1=
31847 a
31848
31849 =2=
31850 b
31851
31852 ==2.1==
31853 c
31854
31855 ==2.2==
31856 d
31857
31858 ===2.2.1===
31859 e
31860
31861 =3=
31862 f
31863 !! html/php+tidy
31864
31865 <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>
31866 <p>a
31867 </p>
31868 <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>
31869 <p>b
31870 </p>
31871 <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>
31872 <p>c
31873 </p>
31874 <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>
31875 <p>d
31876 </p>
31877 <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>
31878 <p>e
31879 </p>
31880 <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>
31881 <p>f
31882 </p>
31883 !! html/parsoid
31884 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31885 <p>a</p>
31886
31887 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
31888 <p>b</p>
31889
31890 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
31891 <p>c</p>
31892
31893 </section><section data-mw-section-id="4"><h2 id="2.2" data-parsoid="{}">2.2</h2>
31894 <p>d</p>
31895
31896 <section data-mw-section-id="5"><h3 id="2.2.1" data-parsoid="{}">2.2.1</h3>
31897 <p>e</p>
31898
31899 </section></section></section><section data-mw-section-id="6"><h1 id="3" data-parsoid="{}">3</h1>
31900 <p>f</p>
31901
31902 </section>
31903 !! end
31904
31905 !! test
31906 Section wrapping for well-nested sections (with leading content)
31907 !! options
31908 notoc
31909 parsoid={
31910 "wrapSections": true
31911 }
31912 !! wikitext
31913 Para 1.
31914
31915 Para 2 with a <div>nested in it</div>
31916
31917 Para 3.
31918
31919 =1=
31920 a
31921
31922 =2=
31923 b
31924
31925 ==2.1==
31926 c
31927 !! html/php+tidy
31928 <p>Para 1.
31929 </p><p>
31930 Para 2 with a </p><div>nested in it</div>
31931 <p>Para 3.
31932 </p>
31933 <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>
31934 <p>a
31935 </p>
31936 <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>
31937 <p>b
31938 </p>
31939 <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>
31940 <p>c
31941 </p>
31942 !! html/parsoid
31943 <section data-mw-section-id="0"><p>Para 1.</p>
31944
31945 <p>Para 2 with a </p><div>nested in it</div>
31946
31947 <p>Para 3.</p>
31948
31949 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31950 <p>a</p>
31951
31952 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
31953 <p>b</p>
31954
31955 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
31956 <p>c</p>
31957
31958 </section></section>
31959 !! end
31960
31961 !! test
31962 Section wrapping with template-generated sections (good nesting 1)
31963 !! options
31964 notoc
31965 parsoid={
31966 "wrapSections": true
31967 }
31968 !! wikitext
31969 =1=
31970 a
31971
31972 {{echo|1=
31973 ==1.1==
31974 b
31975 }}
31976 ==1.2==
31977 c
31978
31979 =2=
31980 d
31981 !! html/php+tidy
31982
31983 <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>
31984 <p>a
31985 </p>
31986 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
31987 <p>b
31988 </p>
31989 <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>
31990 <p>c
31991 </p>
31992 <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>
31993 <p>d
31994 </p>
31995 !! html/parsoid
31996 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31997 <p>a</p>
31998
31999 <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">
32000 </span><p about="#mwt1">b</p>
32001 </section><section data-mw-section-id="3"><h2 id="1.2" data-parsoid="{}">1.2</h2>
32002 <p>c</p>
32003
32004 </section></section><section data-mw-section-id="4"><h1 id="2" data-parsoid="{}">2</h1>
32005 <p>d</p></section>
32006 !! end
32007
32008 # In this example, the template scope is mildly expanded to incorporate the
32009 # trailing newline after the transclusion since that is part of section 1.1.1
32010 !! test
32011 Section wrapping with template-generated sections (good nesting 2)
32012 !! options
32013 notoc
32014 parsoid={
32015 "wrapSections": true,
32016 "modes": ["wt2html", "wt2wt"]
32017 }
32018 !! wikitext
32019 =1=
32020 a
32021
32022 {{echo|1=
32023 ==1.1==
32024 b
32025 ===1.1.1===
32026 d
32027 }}
32028 =2=
32029 e
32030 !! html/php+tidy
32031
32032 <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>
32033 <p>a
32034 </p>
32035 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32036 <p>b
32037 </p>
32038 <h3><span class="mw-headline" id="1.1.1">1.1.1</span></h3>
32039 <p>d
32040 </p>
32041 <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>
32042 <p>e
32043 </p>
32044 !! html/parsoid
32045 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
32046 <p>a</p>
32047
32048 <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">
32049 </span><p about="#mwt1">b</p><span about="#mwt1">
32050 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
32051 </span><p about="#mwt1">d</p><span about="#mwt1">
32052 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
32053 <p>e</p></section>
32054 !! end
32055
32056 # In this example, the template scope is mildly expanded to incorporate the
32057 # trailing newline after the transclusion since that is part of section 1.2.1
32058 !! test
32059 Section wrapping with template-generated sections (good nesting 3)
32060 !! options
32061 notoc
32062 parsoid={
32063 "wrapSections": true,
32064 "modes": ["wt2html", "wt2wt"]
32065 }
32066 !! wikitext
32067 =1=
32068 a
32069
32070 {{echo|1=
32071 x
32072 ==1.1==
32073 b
32074 ==1.2==
32075 c
32076 ===1.2.1===
32077 d
32078 }}
32079 =2=
32080 e
32081 !! html/php+tidy
32082
32083 <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>
32084 <p>a
32085 </p><p>x
32086 </p>
32087 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32088 <p>b
32089 </p>
32090 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32091 <p>c
32092 </p>
32093 <h3><span class="mw-headline" id="1.2.1">1.2.1</span></h3>
32094 <p>d
32095 </p>
32096 <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>
32097 <p>e
32098 </p>
32099 !! html/parsoid
32100 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
32101 <p>a</p>
32102
32103 <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">
32104 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
32105 </span><p about="#mwt1">b</p><span about="#mwt1">
32106 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
32107 </span><p about="#mwt1">c</p><span about="#mwt1">
32108 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
32109 </span><p about="#mwt1">d</p><span about="#mwt1">
32110 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
32111 <p>e</p></section>
32112 !! end
32113
32114 # Because of section-wrapping and template-wrapping interactions,
32115 # the scope of the template is expanded so that the template markup
32116 # is valid in the presence of <section> tags.
32117 # This exercises the s1 is null scenario in the wrapSections code
32118 !! test
32119 Section wrapping with template-generated sections (bad nesting 1)
32120 !! options
32121 notoc
32122 parsoid={
32123 "wrapSections": true
32124 }
32125 !! wikitext
32126 <div>
32127 a
32128
32129 {{echo|1=
32130 =1=
32131 b
32132 }}
32133
32134 c
32135 </div>
32136 !! html/php+tidy
32137 <div>
32138 <p>a
32139 </p>
32140 <h1><span class="mw-headline" id="1">1</span></h1>
32141 <p>b
32142 </p><p>c
32143 </p>
32144 </div>
32145 !! html/parsoid
32146 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
32147 <p>a</p>
32148
32149 <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">
32150 </span><p about="#mwt1">b</p>
32151
32152 <p>c</p>
32153 </section></div></section>
32154 !! end
32155
32156 # Because of section-wrapping and template-wrapping interactions,
32157 # the scope of the template is expanded so that the template markup
32158 # is valid in the presence of <section> tags.
32159 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
32160 !! test
32161 Section wrapping with template-generated sections (bad nesting 2)
32162 !! options
32163 notoc
32164 parsoid={
32165 "wrapSections": true
32166 }
32167 !! wikitext
32168 =1=
32169 a
32170
32171 {{echo|1=
32172 =2=
32173 b
32174 ==2.1==
32175 c
32176 }}
32177
32178 d
32179
32180 =3=
32181 e
32182 !! html/php+tidy
32183
32184 <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>
32185 <p>a
32186 </p>
32187 <h1><span class="mw-headline" id="2">2</span></h1>
32188 <p>b
32189 </p>
32190 <h2><span class="mw-headline" id="2.1">2.1</span></h2>
32191 <p>c
32192 </p><p>d
32193 </p>
32194 <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>
32195 <p>e
32196 </p>
32197 !! html/parsoid
32198 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32199 <p>a</p>
32200
32201 </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">
32202 </span><p about="#mwt1">b</p><span about="#mwt1">
32203 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
32204 </span><p about="#mwt1">c</p><span about="#mwt1">
32205
32206 </span><p about="#mwt1">d</p><span about="#mwt1">
32207
32208 </span></section></section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32209 <p>e</p></section>
32210 !! end
32211
32212 # Because of section-wrapping and template-wrapping interactions,
32213 # additional template wrappers are added to <section> tags
32214 # so that template wrapping semantics are valid whether section
32215 # tags are retained or stripped. But, the template scope can expand
32216 # greatly when accounting for section tags.
32217 # This exercises the s1 and s2 are in different subtrees scenario
32218 !! test
32219 Section wrapping with template-generated sections (bad nesting 3)
32220 !! options
32221 notoc
32222 parsoid={
32223 "wrapSections": true,
32224 "modes": ["wt2html", "wt2wt"]
32225 }
32226 !! wikitext
32227 =1=
32228 a
32229
32230 {{echo|1=
32231 ==1.2==
32232 b
32233 =2=
32234 c
32235 }}
32236
32237 d
32238
32239 =3=
32240 e
32241 !! html/php+tidy
32242
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 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32247 <p>b
32248 </p>
32249 <h1><span class="mw-headline" id="2">2</span></h1>
32250 <p>c
32251 </p><p>d
32252 </p>
32253 <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>
32254 <p>e
32255 </p>
32256 !! html/parsoid
32257 <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>
32258 <p>a</p>
32259
32260 <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">
32261 </span><p about="#mwt1">b</p><span about="#mwt1">
32262 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
32263 </span><p about="#mwt1">c</p>
32264
32265 <p>d</p>
32266 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
32267 <p>e</p></section>
32268 !! end
32269
32270 !! test
32271 Section wrapping with uneditable lead section + div wrapping multiple sections
32272 !! options
32273 notoc
32274 parsoid={
32275 "wrapSections": true
32276 }
32277 !! wikitext
32278 foo
32279
32280 <div style="border:1px solid red;">
32281 =1=
32282 a
32283
32284 ==1.1==
32285 b
32286
32287 =2=
32288 c
32289 </div>
32290
32291 =3=
32292 d
32293
32294 ==3.1==
32295 e
32296 !! html/php+tidy
32297 <p>foo
32298 </p>
32299 <div style="border:1px solid red;">
32300
32301 <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>
32302 <p>a
32303 </p>
32304 <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>
32305 <p>b
32306 </p>
32307 <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>
32308 <p>c
32309 </p>
32310 </div>
32311 <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>
32312 <p>d
32313 </p>
32314 <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>
32315 <p>e
32316 </p>
32317 !! html/parsoid
32318 <section data-mw-section-id="-1"><p>foo</p>
32319
32320 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32321 <section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32322 <p>a</p>
32323
32324 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32325 <p>b</p>
32326
32327 </section></section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32328 <p>c</p>
32329 </section></div>
32330
32331 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32332 <p>d</p>
32333
32334 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32335 <p>e</p>
32336 </section></section>
32337 !! end
32338
32339 !! test
32340 Section wrapping with editable lead section + div overlapping multiple sections
32341 !! options
32342 notoc
32343 parsoid={
32344 "wrapSections": true
32345 }
32346 !! wikitext
32347 foo
32348
32349 =1=
32350 a
32351 <div style="border:1px solid red;">
32352 b
32353
32354 ==1.1==
32355 c
32356
32357 =2=
32358 d
32359 </div>
32360 e
32361
32362 =3=
32363 f
32364
32365 ==3.1==
32366 g
32367 !! html/php+tidy
32368 <p>foo
32369 </p>
32370
32371 <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>
32372 <p>a
32373 </p>
32374 <div style="border:1px solid red;">
32375 <p>b
32376 </p>
32377 <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>
32378 <p>c
32379 </p>
32380 <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>
32381 <p>d
32382 </p>
32383 </div>
32384 <p>e
32385 </p>
32386 <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>
32387 <p>f
32388 </p>
32389 <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>
32390 <p>g
32391 </p>
32392 !! html/parsoid
32393 <section data-mw-section-id="0"><p>foo</p>
32394
32395 </section><section data-mw-section-id="-1"><h1 id="1" data-parsoid="{}">1</h1>
32396 <p>a</p>
32397 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32398 <p>b</p>
32399
32400 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32401 <p>c</p>
32402
32403 </section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32404 <p>d</p>
32405 </section></div>
32406 <p>e</p>
32407
32408 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32409 <p>f</p>
32410
32411 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32412 <p>g</p>
32413 </section></section>
32414 !! end
32415
32416 !! test
32417 HTML header tags should not be wrapped in section tags
32418 !! options
32419 notoc
32420 parsoid={
32421 "wrapSections": true
32422 }
32423 !! wikitext
32424 foo
32425
32426 <h1>a</h1>
32427
32428 =b=
32429
32430 <h1>c</h1>
32431
32432 =d=
32433 !! html/php+tidy
32434 <p>foo
32435 </p>
32436
32437 <h1><span class="mw-headline" id="a">a</span></h1>
32438 <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>
32439 <h1><span class="mw-headline" id="c">c</span></h1>
32440 <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>
32441 !! html/parsoid
32442 <section data-mw-section-id="0"><p>foo</p>
32443
32444 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32445
32446 </section><section data-mw-section-id="1"><h1 id="b" data-parsoid="{}">b</h1>
32447
32448 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32449
32450 </section><section data-mw-section-id="2"><h1 id="d" data-parsoid="{}">d</h1></section>
32451 !! end
32452
32453 !! test
32454 Lead section containing only whitespace and comments.
32455 !! options
32456 notoc
32457 parsoid={
32458 "wrapSections": true
32459 }
32460 !! wikitext
32461
32462 <!-- this is a comment, presumably significant to editors -->
32463 =1=
32464 a
32465
32466 =2=
32467 b
32468 !! html/php+tidy
32469 <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>
32470 <p>a
32471 </p>
32472 <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>
32473 <p>b
32474 </p>
32475 !! html/parsoid
32476 <section data-mw-section-id="0" data-parsoid="{}">
32477 <!-- this is a comment, presumably significant to editors -->
32478 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32479 <p>a</p>
32480
32481 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
32482 <p>b</p>
32483 </section>
32484 !! end
32485
32486 !! test
32487 Pseudo-sections emitted by templates should have id -2
32488 !! options
32489 notoc
32490 parsoid={
32491 "wrapSections": true
32492 }
32493 !! wikitext
32494 foo
32495 {{echo|<div>
32496 ==a==
32497 ==b==
32498 </div>
32499 }}
32500 !! html/php+tidy
32501 <p>foo
32502 </p>
32503 <div>
32504 <h2><span class="mw-headline" id="a">a</span></h2>
32505 <h2><span class="mw-headline" id="b">b</span></h2>
32506 </div>
32507 !! html/parsoid
32508 <section data-mw-section-id="-1"><p>foo</p>
32509 </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}}]}'>
32510 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32511 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32512 </section></div><span about="#mwt1">
32513 </span></section>
32514 !! end
32515
32516 !! test
32517 T213468: Transcluded sections don't get PHP section numbers
32518 !! options
32519 notoc
32520 parsoid={
32521 "wrapSections": true
32522 }
32523 !! wikitext
32524 ==PHP section=1==
32525 {{echo|1=
32526 == This is counted as if it were section 2 ==
32527 }}
32528 ==PHP section=3==
32529 !! html/php+tidy
32530 <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>
32531 <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>
32532 <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>
32533 !! html/parsoid
32534 <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>
32535 </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>
32536 </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>
32537 !! end
32538
32539 !! test
32540 T213468: Corner cases in edit section ID assignment in tokenizer
32541 !! options
32542 notoc
32543 parsoid={
32544 "wrapSections": true
32545 }
32546 !! wikitext
32547 ==PHP section=1==
32548 {{echo|Not a section|
32549 == This is counted as if it were section 2 ==
32550 }}
32551 ==PHP section=3==
32552 {{echo3|1=
32553 == This is counted as if it were section 4 ==
32554 }}
32555 ==PHP section=5==
32556 {{#tag:p|Not a section|data-ignored=
32557 == This is counted as if it were section 6 ==
32558 }}
32559 ==PHP section=7==
32560 {{echo|1=Not a ==heading==}}
32561 ==PHP section=8==
32562 [[File:Foobar.jpg|thumb|
32563 ==This is section 9, even though it's in a caption==
32564 ]]
32565 ==PHP section=10==
32566 !! html/php+tidy
32567
32568 <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>
32569 <p>Not a section
32570 </p>
32571 <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>
32572 <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>
32573 <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>
32574 <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>
32575 <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>
32576 <p data-ignored="== This is counted as if it were section 6 ==">Not a section</p>
32577 <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>
32578 <p>Not a ==heading==
32579 </p>
32580 <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>
32581 <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>
32582 <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>
32583 !! html/parsoid
32584 <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>
32585 <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>
32586 </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>
32587 </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">
32588 </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">
32589 </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>
32590 </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>
32591 <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>
32592 </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>
32593 <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>
32594 </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>
32595 <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>
32596 <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>
32597 </section></figcaption></figure>
32598 </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>
32599 !! end
32600
32601 !! test
32602 T215628: Section numbering and <includeonly> and <noinclude> on a page
32603 !! options
32604 notoc
32605 parsoid={
32606 "wrapSections": true
32607 }
32608 !! wikitext
32609 ==PHP section=1==
32610 <noinclude>
32611 ==PHP section=2==
32612 </noinclude>
32613 ==PHP section=3==
32614 <includeonly>
32615 ==This is not counted as section 4==
32616 </includeonly>
32617 ==PHP section=4==
32618 !! html/php+tidy
32619
32620 <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>
32621 <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>
32622 <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>
32623 <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>
32624 !! html/parsoid
32625 PARSOID HAS A BUG HERE: T215628
32626 !! end
32627
32628 ##########################################################################
32629 Tests demonstrating white-space insensitivity in input wikitext
32630 for wikitext headings, wikitext list items, and wikitext table captions,
32631 headings, and cells. HTML versions of the same should preserve whitespace.
32632 ##########################################################################
32633 !! test
32634 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32635 !! options
32636 parsoid={
32637 "modes": ["wt2html"],
32638 "preserveIEW": true
32639 }
32640 !! wikitext
32641 __NOTOC__
32642 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32643 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32644 == <!--Headings with fallback ids--> Личная жизнь ==
32645 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32646 ; <!--term to define--> term : <!--term's definition--> definition
32647 {|
32648 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32649 |-
32650 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32651 |-
32652 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32653 |-
32654 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32655 |-
32656 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32657 |}
32658 : {|
32659 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32660 |} foo <!--c1-->
32661 !! html/php+tidy
32662 <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>
32663 <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>
32664 <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>
32665 <ul><li>List item</li></ul>
32666 <dl><dt>term&#160;</dt>
32667 <dd>definition</dd></dl>
32668 <table>
32669 <caption>Table Caption
32670 </caption>
32671 <tbody><tr>
32672 <th>Table Heading 1</th>
32673 <th>Table Heading 2
32674 </th></tr>
32675 <tr>
32676 <td>Table Cell 1</td>
32677 <td>Table Cell 2
32678 </td></tr>
32679 <tr>
32680 <td>class="foo"</td>
32681 <td>Table Cell 3
32682 </td></tr>
32683 <tr>
32684 <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
32685 </td></tr></tbody></table>
32686 <dl><dd><table>
32687 <tbody><tr>
32688 <td>Table Cell 1</td>
32689 <td>Table Cell 2
32690 </td></tr></tbody></table> foo</dd></dl>
32691 !! html/parsoid
32692 <meta property="mw:PageProp/notoc">
32693 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32694 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32695 <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>
32696 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32697 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32698 <table>
32699 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32700 <tbody><tr>
32701 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32702 <tr>
32703 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32704 <tr>
32705 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32706 <tr>
32707 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32708 </tbody></table>
32709 <dl><dd><table>
32710 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32711 </tbody></table> foo<!--c1--></dd></dl>
32712 !! end
32713
32714 # Looks like <caption> is not accepted in HTML
32715 !! test
32716 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32717 !! options
32718 parsoid={
32719 "modes": ["wt2html"],
32720 "preserveIEW": true
32721 }
32722 !! wikitext
32723 __NOTOC__
32724 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32725 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32726 <table>
32727 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32728 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32729 </table>
32730 !! html/php+tidy
32731 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32732 <ul><li> List item </li></ul>
32733 <table>
32734 <tbody><tr><th> Table Heading </th><th></th></tr>
32735 <tr><td> Table Cell </td><th></th></tr>
32736 </tbody></table>
32737 !! html/parsoid
32738 <meta property="mw:PageProp/notoc"/>
32739 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32740 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32741 <table>
32742 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32743 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32744 </tbody></table>
32745 !! end
32746
32747 !! test
32748 Do not trim whitespace in links and quotes
32749 !! options
32750 parsoid={
32751 "modes": ["wt2html"],
32752 "preserveIEW": true
32753 }
32754 !! wikitext
32755 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32756 [[Foo| some text ]]
32757 !! html/php+tidy
32758 <p>foo <i> italic </i> and <b> bold </b>
32759 <a href="/wiki/Foo" title="Foo"> some text </a>
32760 </p>
32761 !! html/parsoid
32762 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32763 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32764 !! end
32765
32766 !! test
32767 Remove p tags surrounding a single element in a figcaption
32768 !! options
32769 parsoid=html2wt
32770 !! wikitext
32771 [[File:Foobar.jpg|right|200x200px|Caption]]
32772 !! html/parsoid
32773 <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>
32774 !! end
32775
32776 !! test
32777 Selser preserves lack of newline before list and allows newline after the list
32778 !! options
32779 parsoid={
32780 "modes": ["selser"],
32781 "scrubWikitext": true,
32782 "changes": [
32783 [ "ul", "after", "<p>footer</p>" ]
32784 ]
32785 }
32786 !! wikitext
32787 header
32788 *foo
32789 *bar
32790 !! wikitext/edited
32791 header
32792 *foo
32793 *bar
32794
32795 footer
32796 !! end
32797
32798
32799 !! test
32800 Selser does not introduce newlines between unedited paragraph preceding the list
32801 !! options
32802 parsoid={
32803 "modes": ["selser"],
32804 "changes": [
32805 [ "table tbody tr td p:last-child", "empty" ]
32806 ]
32807 }
32808 !! wikitext
32809 {|
32810 |
32811 header
32812 *foo
32813 *bar
32814 footer
32815 |}
32816 !! wikitext/edited
32817 {|
32818 |
32819 header
32820 *foo
32821 *bar
32822
32823 |}
32824 !! end
32825
32826 !! test
32827 Selser does not introduce newlines between unedited paragraph following the list
32828 !! options
32829 parsoid={
32830 "modes": ["selser"],
32831 "changes": [
32832 [ "table tbody tr td p:first-child", "empty" ]
32833 ]
32834 }
32835 !! wikitext
32836 {|
32837 |
32838 header
32839 *foo
32840 *bar
32841 footer
32842 |}
32843 !! wikitext/edited
32844 {|
32845 |
32846
32847 *foo
32848 *bar
32849 footer
32850 |}
32851 !! end
32852
32853 !! test
32854 Remove a list item but do not insert newline above list
32855 !! options
32856 parsoid={
32857 "modes": ["selser"],
32858 "changes": [
32859 [ "ul li:last-child", "remove" ]
32860 ]
32861 }
32862 !! wikitext
32863 header
32864 *foo
32865 *bar
32866 footer
32867 !! wikitext/edited
32868 header
32869 *foo
32870 footer
32871 !! end