Merge "Type hint against LinkTarget in WatchedItemStore"
[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 &quot;Gator&quot;.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 Redirect containing double quotes and spaces
8084 !! wikitext
8085 #REDIRECT [[Cool "Gator"]]
8086 !! html/parsoid
8087 <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
8088 !! end
8089
8090 !! test
8091 Link containing double-single-quotes '' in text (T6598 sanity check)
8092 !! wikitext
8093 Some [[Link|pretty ''italics'' and stuff]]!
8094 !! html/php
8095 <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>!
8096 </p>
8097 !! html/parsoid
8098 <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
8099 !! end
8100
8101 !! test
8102 Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
8103 !! wikitext
8104 ''Some [[Link|pretty ''italics'' and stuff]]!''
8105 !! html
8106 <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>
8107 </p>
8108 !! end
8109
8110 ## FIXME: Title part of filename is interpreted in php
8111 !! test
8112 Link with double quotes in title part (literal) and alternate part (interpreted)
8113 !! wikitext
8114 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
8115
8116 [[''Pentecoste'']]
8117
8118 [[''Pentecoste''|Pentecoste]]
8119
8120 [[''Pentecoste''|''Pentecoste'']]
8121 !! html/php
8122 <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>
8123 </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>
8124 </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>
8125 </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>
8126 </p>
8127 !! html/parsoid
8128 <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>
8129 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
8130 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
8131 <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
8132 !! end
8133
8134 !! test
8135 Broken image links with HTML captions (T41700)
8136 !! wikitext
8137 [[File:Nonexistent|<script></script>]]
8138 [[File:Nonexistent|100x100px|<script></script>]]
8139 [[File:Nonexistent|&lt;]]
8140 [[File:Nonexistent|a<i>b</i>c]]
8141 !! html/php
8142 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8143 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
8144 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
8145 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
8146 </p>
8147 !! html/parsoid
8148 <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>
8149 <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>
8150 <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>
8151 <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>
8152 !! end
8153
8154 !! test
8155 Plain link to URL
8156 !! wikitext
8157 [[http://www.example.com]]
8158 !! html/php
8159 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
8160 </p>
8161 !! html/parsoid
8162 <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
8163 !! end
8164
8165 !! test
8166 Plain link to URL with link text
8167 !! wikitext
8168 [[http://www.example.com Link text]]
8169 !! html
8170 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
8171 </p>
8172 !! end
8173
8174 !! test
8175 Plain link to URL containing special characters, with link text (see T213950).
8176 !! wikitext
8177 [[http://www.example.com/?q=%7Babc%7D Link text]]
8178 !! html
8179 <p>[<a rel="nofollow" class="external text" href="http://www.example.com/?q=%7Babc%7D">Link text</a>]
8180 </p>
8181 !! end
8182
8183 !! test
8184 Plain link to protocol-relative URL
8185 !! wikitext
8186 [[//www.example.com]]
8187 !! html/php
8188 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
8189 </p>
8190 !! html/parsoid
8191 <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
8192 !! end
8193
8194 !! test
8195 Plain link to protocol-relative URL with link text
8196 !! wikitext
8197 [[//www.example.com Link text]]
8198 !! html
8199 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
8200 </p>
8201 !! end
8202
8203 !! test
8204 Plain link to page with question mark in title
8205 !! wikitext
8206 [[A?b]]
8207
8208 [[A?b|Baz]]
8209 !! html
8210 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
8211 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
8212 </p>
8213 !! end
8214
8215 # I'm fairly sure the expected result here is wrong.
8216 # We want these to be URL links, not pseudo-pages with URLs for titles....
8217 # However the current output is also pretty screwy.
8218 #
8219 # ----
8220 # I'm changing it to match the current output--it arguably makes more
8221 # sense in the light of the test above. Old expected result was:
8222 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
8223 #</p>
8224 # But I think this test is bordering on "garbage in, garbage out" anyway.
8225 # -- wtm
8226 !! test
8227 Piped link to URL
8228 !! wikitext
8229 Piped link to URL: [[http://www.example.com|an example URL]]
8230 !! html/php
8231 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
8232 </p>
8233 !! html/parsoid
8234 <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>
8235 !! end
8236
8237 !! test
8238 Plain link in template argument
8239 !! options
8240 parsoid=wt2html
8241 !! wikitext
8242 {{echo|[http://www.example.com |123]}}
8243
8244 {{echo|[[http://www.example.com |123]]}}
8245
8246 {{echo|[[http://www.example.com |123]}}
8247
8248 {{echo|[http://www.example.com |123]]}}
8249 !! html/php
8250 <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8251 </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
8252 </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
8253 </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
8254 </p>
8255 !! html/parsoid
8256 <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>
8257
8258 <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>
8259
8260 <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>
8261
8262 <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>
8263 !! end
8264
8265 !! test
8266 T2002: [[page|http://url/]] should link to page, not http://url/
8267 !! wikitext
8268 [[Main Page|http://url/]]
8269 !! html/php
8270 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
8271 </p>
8272 !! html/parsoid
8273 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
8274 !! end
8275
8276 # Parsoid does not mark self-links, by design.
8277 !! test
8278 T2337: Escaped self-links should be bold
8279 !! options
8280 title=[[Bug462]]
8281 !! wikitext
8282 [[Bu&#103;462]] [[Bug462]]
8283 !! html/php+tidy
8284 <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
8285 </p>
8286 !! html/parsoid
8287 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8288 !! end
8289
8290 !! test
8291 Self-link to section should not be bold
8292 !! options
8293 title=[[Main Page]]
8294 !! wikitext
8295 [[Main Page#section]]
8296 !! html
8297 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8298 </p>
8299 !! end
8300
8301 !! article
8302 00
8303 !! text
8304 This is 00.
8305 !! endarticle
8306
8307 !!test
8308 Self-link to numeric title
8309 !!options
8310 title=[[0]]
8311 !! wikitext
8312 [[0]]
8313 !! html
8314 <p><a class="mw-selflink selflink">0</a>
8315 </p>
8316 !!end
8317
8318 !!test
8319 Link to numeric-equivalent title
8320 !!options
8321 title=[[0]]
8322 !! wikitext
8323 [[00]]
8324 !! html
8325 <p><a href="/wiki/00" title="00">00</a>
8326 </p>
8327 !!end
8328
8329 !! test
8330 <nowiki> inside a link
8331 !! wikitext
8332 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8333 !! html/php+tidy
8334 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8335 </p>
8336 !! html/parsoid
8337 <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>
8338 !! end
8339
8340 ## Parsoid doesn't get this right and even fails wt2html because, when doing the
8341 ## normalization for comparison, the html serialization / re-parse doesn't
8342 ## roundtrip. This is T49963
8343 !! test
8344 <pre> inside a link
8345 !! wikitext
8346 [[Main<pre> Page</pre>]] [[Main Page|the main page <pre>[it's not very good]</pre>]]
8347 !! html/php+tidy
8348 <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>
8349 !! html/parsoid
8350 <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>
8351 !! end
8352
8353 !! test
8354 Non-breaking spaces in title
8355 !! wikitext
8356 [[&nbsp; Main &nbsp; Page &nbsp;]]
8357 !! html
8358 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8359 </p>
8360 !!end
8361
8362 # Add new article for the test below so that it doesn't red-link
8363 !! article
8364 Foo bar baz
8365 !! text
8366 boo
8367 !! endarticle
8368
8369 !! test
8370 Multiple spaces in titles should normalize to a single underscore
8371 !! options
8372 parsoid=wt2html,wt2wt
8373 !! wikitext
8374 [[Foo bar baz|x]]
8375 [[Foo bar baz|x]]
8376 [[Foo bar baz|x]]
8377 !! html/php
8378 <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8379 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8380 <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
8381 </p>
8382 !! html/parsoid
8383 <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8384 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8385 <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
8386 </p>
8387 !! end
8388
8389 !! test
8390 Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
8391 !! options
8392 language=ca
8393 !! wikitext
8394 '''[[Main Page]]'''
8395 !! html
8396 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8397 </p>
8398 !! end
8399
8400 !! test
8401 Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
8402 !! options
8403 language=ca
8404 !! wikitext
8405 ''[[Main Page]]''
8406 !! html
8407 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Internal link with en linktrail: no apostrophes (T29473)
8413 !! options
8414 language=en
8415 !! wikitext
8416 [[Something]]'nice
8417 !! html
8418 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8419 </p>
8420 !! end
8421
8422 !! test
8423 Internal link with ca linktrail with apostrophes (T29473)
8424 !! options
8425 language=ca
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 (encara no existeix)">Something'nice</a>
8430 </p>
8431 !! end
8432
8433 !! test
8434 Internal link with kaa linktrail with apostrophes (T29473)
8435 !! options
8436 language=kaa
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 (bet ele jaratılmag&#39;an)">Something'nice</a>
8441 </p>
8442 !! end
8443
8444 !! test
8445 Link with multiple ":" in a subpage-supporting namespace (T65636)
8446 !! wikitext
8447 [[User:Foo/Test/63636:Bar|Test]]
8448 !! html/php
8449 <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>
8450 </p>
8451 !! html/parsoid
8452 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8453 !! end
8454
8455 ## Mainly a sanity check for Parsoid
8456 !! test
8457 Handle title parsing for subpages
8458 !! options
8459 title=[[/123123]]
8460 subpage
8461 !! wikitext
8462 123
8463 !! html/php
8464 <p>123
8465 </p>
8466 !! html/parsoid
8467 <p>123</p>
8468 !! end
8469
8470 !! article
8471 User:Test/123
8472 !! text
8473 test 123
8474 !! endarticle
8475
8476 !! test
8477 Link to a subpage from a namespace other than main
8478 !! options
8479 title=[[User:Test]]
8480 subpage
8481 !! wikitext
8482 [[/123]]
8483 !! html/php
8484 <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
8485 </p>
8486 !! html/parsoid
8487 <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>
8488 !! end
8489
8490 !! test
8491 Ensure that transclusion titles are not url-decoded
8492 !! options
8493 subpage title=[[Test]]
8494 parsoid=wt2html
8495 !! wikitext
8496 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8497 !! html/php
8498 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8499 </p>
8500 !! html/parsoid
8501 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8502 !! end
8503
8504 !! test
8505 Purely hash wikilink
8506 !! options
8507 title=[[User:Test/123]]
8508 subpage
8509 !! wikitext
8510 [[#a|b]]
8511 !! html/php
8512 <p><a href="#a">b</a>
8513 </p>
8514 !! html/parsoid
8515 <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>
8516 !! end
8517
8518 !! test
8519 Serialization of purely hash wikilink
8520 !! options
8521 title=[[User:Test/123]]
8522 subpage
8523 parsoid=html2wt
8524 !! html/parsoid
8525 <p><a href="#a">[[</a></p>
8526 !! wikitext
8527 [[#a|<nowiki>[[</nowiki>]]
8528 !! html/php
8529 <p><a href="#a">[[</a>
8530 </p>
8531 !! end
8532
8533 !! test
8534 1. Interaction of linktrail and template encapsulation
8535 !! wikitext
8536 {{echo|[[Foo]]}}l
8537 !! html/php+tidy
8538 <p><a href="/wiki/Foo" title="Foo">Fool</a>
8539 </p>
8540 !! html/parsoid
8541 <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>
8542 !! end
8543
8544 !! test
8545 2. Interaction of linktrail and template encapsulation
8546 !! wikitext
8547 {{echo|Some [[Fool]]}}s
8548 !! html/php+tidy
8549 <p>Some <a href="/index.php?title=Fool&amp;action=edit&amp;redlink=1" class="new" title="Fool (page does not exist)">Fools</a>
8550 </p>
8551 !! html/parsoid
8552 <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>
8553 !! end
8554
8555 !! test
8556 3. Interaction of linktrail and template encapsulation
8557 !! wikitext
8558 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
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> are <b>bold and foolish</b>
8561 </p>
8562 !! html/parsoid
8563 <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>
8564 !! end
8565
8566 !! article
8567 Söfnuður
8568 !! text
8569 Test.
8570 !! endarticle
8571
8572 !! test
8573 Internal link with is link prefix
8574 !! options
8575 language=is
8576 !! wikitext
8577 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8578 !! html
8579 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8580 </p>
8581 !! end
8582
8583 !! article
8584 Mótmælendatrú
8585 !! text
8586 Test.
8587 !! endarticle
8588
8589 !! test
8590 Internal link with is link trail and link prefix
8591 !! options
8592 language=is
8593 !! wikitext
8594 [[mótmælendatrú|xxx]]ar
8595 [[mótmælendatrú]]ar
8596 mótmælenda[[söfnuður]]
8597 mótmælenda[[söfnuður|söfnuðir]]
8598 mótmælenda[[söfnuður|söfnuðir]]xxx
8599 !! html
8600 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8601 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8602 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8603 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8604 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8605 </p>
8606 !! end
8607
8608 !! test
8609 Parsoid link trail escaping
8610 !! options
8611 parsoid=html2wt,html2html
8612 !! html/parsoid
8613 <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
8614 !! wikitext
8615 [[apple]]<nowiki/>s
8616 !! end
8617
8618 !! test
8619 Parsoid link prefix escaping
8620 !! options
8621 language=is
8622 parsoid=html2wt,html2html
8623 !! html/parsoid
8624 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
8625 !! wikitext
8626 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8627 !! end
8628
8629 !! test
8630 Parsoid link bracket escaping
8631 !! options
8632 parsoid=html2wt,html2html
8633 !! html/parsoid
8634 <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
8635 <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
8636 <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
8637 <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
8638 <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
8639 <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
8640 !! wikitext
8641 [[Test]]
8642
8643 [<nowiki/>[[Test]]]
8644
8645 [[[[Test]]]]
8646
8647 [[[<nowiki/>[[Test]]]]]
8648
8649 [[[[[[Test]]]]]]
8650
8651 [[[[[<nowiki/>[[Test]]]]]]]
8652 !! end
8653
8654 !! test
8655 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8656 !! wikitext
8657 [[Foo| bar]]
8658
8659 [[Foo| ''bar'']]
8660
8661 [http://wp.org foo]
8662
8663 [http://wp.org ''foo'']
8664 !! html
8665 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8666 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8667 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8668 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8669 </p>
8670 !! end
8671
8672 !! test
8673 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8674 !! wikitext
8675 [[Foo|{{echo|a}} b {{echo|c}}]]
8676 !! html/parsoid
8677 <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>
8678 !! end
8679
8680 !! test
8681 Link with angle bracket after anchor
8682 !! config
8683 wgFragmentMode=[ 'html5', 'legacy' ]
8684 !! wikitext
8685 [[Foo#<bar>]]
8686 !! html/php
8687 <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
8688 </p>
8689 !! html/parsoid
8690 <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>
8691 !! end
8692
8693 !! test
8694 Link with angle bracket after anchor (legacy)
8695 !! config
8696 wgFragmentMode=[ 'legacy' ]
8697 !! wikitext
8698 [[Foo#<bar>]]
8699 !! html/php
8700 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8701 </p>
8702 !! end
8703
8704 ###
8705 ### Interwiki links (see maintenance/interwiki.sql)
8706 ###
8707
8708 !! test
8709 Inline interwiki link
8710 !! options
8711 parsoid=wt2html,wt2wt,html2html
8712 !! wikitext
8713 [[MeatBall:SoftSecurity]]
8714 !! html/php
8715 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8716 </p>
8717 !! html/parsoid
8718 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8719 !! end
8720
8721 !! test
8722 Inline interwiki link with empty title (T4372)
8723 !! options
8724 parsoid=wt2html,wt2wt,html2html
8725 !! wikitext
8726 [[MeatBall:]]
8727 !! html/php
8728 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8729 </p>
8730 !! html/parsoid
8731 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8732 !! end
8733
8734 ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
8735 !! test
8736 Interwiki link encoding conversion (T3636)
8737 !! options
8738 parsoid=wt2html,wt2wt
8739 !! wikitext
8740 *[[Wikipedia:ro:Olteni&#0355;a]]
8741 *[[Wikipedia:ro:Olteni&#355;a]]
8742 !! html/php
8743 <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>
8744 <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>
8745 !! html/php+tidy
8746 <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>
8747 <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>
8748 !! html/parsoid
8749 <ul>
8750 <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>
8751 <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>
8752 </ul>
8753 !! end
8754
8755 !! test
8756 Interwiki link with fragment (T4130)
8757 !! wikitext
8758 [[MeatBall:SoftSecurity#foo]]
8759 !! html
8760 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8761 </p>
8762 !! end
8763
8764 ## The interwiki case here continued to be legacy escaped because of the
8765 ## default setting of $wgExternalInterwikiFragmentMode
8766 !! test
8767 Link scenarios with escaped fragments
8768 !! options
8769 title=[[Main Page]]
8770 !! config
8771 wgFragmentMode=[ 'html5', 'legacy' ]
8772 !! wikitext
8773 [[#Is this great?]]
8774 [[Foo#Is this great?]]
8775 [[meatball:Foo#Is this great?]]
8776 !! html/php
8777 <p><a href="#Is_this_great?">#Is this great?</a>
8778 <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
8779 <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>
8780 </p>
8781 !! html/parsoid
8782 <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>
8783 <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>
8784 <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>
8785 !! end
8786
8787 !! test
8788 Link scenarios with escaped fragments (legacy)
8789 !! config
8790 wgFragmentMode=[ 'legacy' ]
8791 !! wikitext
8792 [[#Is this great?]]
8793 [[Foo#Is this great?]]
8794 [[meatball:Foo#Is this great?]]
8795 !! html/php
8796 <p><a href="#Is_this_great.3F">#Is this great?</a>
8797 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8798 <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>
8799 </p>
8800 !! end
8801
8802 # Ideally the wikipedia: prefix here should be proto-relative too
8803 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8804 # define the 'en' prefix, and originally the test used 'wikipedia',
8805 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8806 # article.
8807 !! test
8808 Different interwiki prefixes mapping to the same URL
8809 !! wikitext
8810 [[:en:Foo]]
8811
8812 [[:en:Foo|Foo]]
8813
8814 [[wikipedia:Foo]]
8815
8816 [[:wikipedia:Foo|Foo]]
8817
8818 [[wikipedia:en:Foo]]
8819
8820 [[:wikipedia:en:Foo]]
8821
8822 [[ wikiPEdia :Foo]]
8823 !! html/parsoid
8824 <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>
8825
8826 <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>
8827
8828 <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>
8829
8830 <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>
8831
8832 <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>
8833
8834 <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>
8835
8836 <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>
8837 !! end
8838
8839 !! test
8840 Interwiki links that cannot be represented in wiki syntax
8841 !! wikitext
8842 [[meatball:ok]]
8843 [[meatball:ok#foo|ok with fragment]]
8844 [[meatball:ok_as_well?|ok ending with ? mark]]
8845 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8846 [http://de.wikipedia.org/wiki/#foo is just fragment]
8847
8848 !! html/php
8849 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8850 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8851 <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>
8852 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8853 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8854 </p>
8855 !! html/parsoid
8856 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8857 <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8858 <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>
8859 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8860 <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8861 !! end
8862
8863 !! test
8864 Interwiki links: trail
8865 !! wikitext
8866 [[wikipedia:Foo|Ba]]r
8867 !! html/php
8868 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8869 </p>
8870 !! html/parsoid
8871 <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>
8872 !! end
8873
8874 !! test
8875 Local interwiki link
8876 !! options
8877 parsoid=wt2html,wt2wt,html2html
8878 !! wikitext
8879 [[local:Template:Foo]]
8880 !! html/php
8881 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8882 </p>
8883 !! html/parsoid
8884 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8885 !! end
8886
8887 # Parsoid does not mark self-links, by design.
8888 !! test
8889 Local interwiki link: self-link to current page
8890 !! options
8891 title=[[Main Page]]
8892 parsoid=wt2html,wt2wt,html2html
8893 !! wikitext
8894 [[local:Main Page]]
8895 !! html/php
8896 <p><a class="mw-selflink selflink">local:Main Page</a>
8897 </p>
8898 !! html/parsoid
8899 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8900 !! end
8901
8902 !! test
8903 Local interwiki link: prefix only (T66167)
8904 !! options
8905 parsoid=wt2html,wt2wt,html2html
8906 !! wikitext
8907 [[local:]]
8908 !! html/php
8909 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8910 </p>
8911 !! html/parsoid
8912 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8913 !! end
8914
8915 !! test
8916 Local interwiki link: with additional interwiki prefix (T63357)
8917 !! options
8918 parsoid=wt2html,wt2wt,html2html
8919 !! wikitext
8920 [[local:meatball:Hello]]
8921 !! html/php
8922 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8923 </p>
8924 !! html/parsoid
8925 <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8926 !! end
8927
8928 !! test
8929 Multiple local interwiki link prefixes
8930 !! wikitext
8931 [[local:local:local:local:mi:local:Foo]]
8932 !! options
8933 parsoid=wt2html,wt2wt,html2html
8934 !! html/php
8935 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8936 </p>
8937 !! html/parsoid
8938 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8939 !! end
8940
8941 !! test
8942 Interwiki link with percent encoded target
8943 !! wikitext
8944 [[:es:Nueva Guip%C3%BAzcoa|Nueva Guipúzcoa]]
8945 !! html/php
8946 <p><a href="http://es.wikipedia.org/wiki/Nueva_Guip%C3%BAzcoa" class="extiw" title="es:Nueva Guipúzcoa">Nueva Guipúzcoa</a>
8947 </p>
8948 !! html/parsoid
8949 <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>
8950 !! end
8951
8952 ###
8953 ### Interlanguage links
8954 ### Language links (so that searching for '### language' matches..)
8955 ###
8956
8957 !! test
8958 Interlanguage link
8959 !! wikitext
8960 Blah blah blah
8961 [[zh:Chinese]]
8962 !! html/php
8963 <p>Blah blah blah
8964 </p>
8965 !! html/parsoid
8966 <p>Blah blah blah</p>
8967 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8968 !! end
8969
8970 ## parsoid html2wt will lose the space variations
8971 !! test
8972 Interlanguage link with spacing
8973 !! options
8974 parsoid=wt2html,wt2wt,html2html
8975 !! wikitext
8976 Blah blah blah
8977 [[ zh : Chinese ]]
8978 !! html/php
8979 <p>Blah blah blah
8980 </p>
8981 !! html/parsoid
8982 <p>Blah blah blah</p>
8983 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8984 !! end
8985
8986 !! test
8987 Double interlanguage link
8988 !! wikitext
8989 Blah blah blah
8990 [[es:Spanish]]
8991 [[zh:Chinese]]
8992 !! html/php
8993 <p>Blah blah blah
8994 </p>
8995 !! html/parsoid
8996 <p>Blah blah blah</p>
8997 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8998 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8999 !! end
9000
9001 ## parsoid html2wt will lose the space variations
9002 !! test
9003 Interlanguage link variations
9004 !! options
9005 parsoid=wt2html,wt2wt,html2html
9006 !! wikitext
9007 Blah blah blah
9008 [[ es :Spanish]]
9009 [[ ZH :Chinese]]
9010 [[es:Foo_bar]]
9011 !! html/php
9012 <p>Blah blah blah
9013 </p>
9014 !! html/parsoid
9015 <p>Blah blah blah</p>
9016 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
9017 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
9018 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
9019 !! end
9020
9021 !! test
9022 Escaping of interlanguage links (T129218, T156308)
9023 !! wikitext
9024 Blah blah blah
9025 [[:es:Spanish]]
9026 [[ : zh : Chinese ]]
9027 !! html/php
9028 <p>Blah blah blah
9029 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9030 <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
9031 </p>
9032 !! html/parsoid
9033 <p>Blah blah blah
9034 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9035 <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
9036 !! end
9037
9038 !! test
9039 Multiple colons escaping interlanguage links
9040 !! options
9041 parsoid=wt2html
9042 !! wikitext
9043 [[:es:Spanish]]
9044 [[::es:Spanish]]
9045 [[:::es:Spanish]]
9046 !! html/php
9047 <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
9048 [[::es:Spanish]]
9049 [[:::es:Spanish]]
9050 </p>
9051 !! html/parsoid
9052 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
9053 [[::es:Spanish]]
9054 [[:::es:Spanish]]</p>
9055 !! end
9056
9057 ## parsoid html2wt will normalize the space to _
9058 !! test
9059 Space and question mark encoding in interlanguage links (T95473)
9060 !! options
9061 parsoid=wt2html,wt2wt,html2html
9062 !! wikitext
9063 Blah blah blah
9064 [[es:Foo bar?]]
9065 !! html/php
9066 <p>Blah blah blah
9067 </p>
9068 !! html/parsoid
9069 <p>Blah blah blah</p>
9070 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
9071 !! end
9072
9073 !! test
9074 Interlanguage link, with prefix links
9075 !! options
9076 language=ln
9077 !! wikitext
9078 Blah blah blah
9079 [[zh:Chinese]]
9080 !! html/php
9081 <p>Blah blah blah
9082 </p>
9083 !! html/parsoid
9084 <p>Blah blah blah</p>
9085 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9086 !! end
9087
9088 !! test
9089 Double interlanguage link, with prefix links (T10897)
9090 !! options
9091 language=ln
9092 !! wikitext
9093 Blah blah blah
9094 [[es:Spanish]]
9095 [[zh:Chinese]]
9096 !! html/php
9097 <p>Blah blah blah
9098 </p>
9099 !! html/parsoid
9100 <p>Blah blah blah</p>
9101 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
9102 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
9103 !! end
9104
9105 !! test
9106 "Extra" interlanguage links (T34189 / gerrit 111390)
9107 !! wikitext
9108 Blah blah blah
9109 [[mul:Article]]
9110 !! html/php
9111 <p>Blah blah blah
9112 </p>
9113 !! html/parsoid
9114 <p>Blah blah blah</p>
9115 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
9116 !! end
9117
9118 ## PHP parser tests script needs an update
9119 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9120 !! test
9121 Language links render as inline links if $wgInterwikiMagic=false
9122 !! options
9123 wgInterwikiMagic=false
9124 parsoid=wt2html,wt2wt,html2html
9125 !! wikitext
9126 Blah blah blah
9127 [[zh:Chinese]]
9128 !! html/parsoid
9129 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9130 !! end
9131
9132 ## PHP parser tests script needs an update
9133 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
9134 !! test
9135 Language links render as inline links in the Talk namespace
9136 !! options
9137 title=Talk:Foo
9138 parsoid=wt2html,wt2wt,html2html
9139 !! wikitext
9140 Blah blah blah
9141 [[zh:Chinese]]
9142 !! html/parsoid
9143 <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
9144 !! end
9145
9146 !! test
9147 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
9148 !! options
9149 language=ln
9150 !! wikitext
9151 [[WW&nbsp;II]]
9152 !! html
9153 <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>
9154 </p>
9155 !! end
9156
9157 !! test
9158 Parsoid T55221: Wikilinks should be properly entity-escaped
9159 !! options
9160 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
9161 !! html/parsoid
9162 <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9163 <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
9164 !! wikitext
9165 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
9166
9167 He&amp;nbsp;llo He&amp;nbsp;llo
9168 !! html/php
9169 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
9170 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
9171 </p>
9172 !! end
9173
9174 # html2wt will fail because of title normalization without data-parsoid
9175 !! test
9176 Parsoid: handle constructor well
9177 !! options
9178 parsoid=wt2html,wt2wt
9179 !! wikitext
9180 [[constructor]]
9181
9182 [[constructor:foo]]
9183 !! html/php
9184 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
9185 </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>
9186 </p>
9187 !! html/parsoid
9188 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
9189
9190 <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>
9191 !! end
9192
9193 !! test
9194 Template parameter named "constructor"
9195 !! wikitext
9196 {{echo| constructor = |hi}}
9197 !! html/parsoid
9198 <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>
9199 !! end
9200
9201 !! article
9202 ko:
9203 !! text
9204 Test.
9205 !! endarticle
9206
9207 # Note that `ko` isn't a known interlanguage prefix
9208 !! test
9209 Parsoid: recognize interlanguage links without a target page
9210 !! options
9211 ill
9212 !! wikitext
9213 [[es:]]
9214
9215 [[ko:]]
9216 !! html/php
9217 es:
9218 !! html/parsoid
9219 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
9220
9221 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9222 !! end
9223
9224 # Note that `ko` isn't a known interwiki prefix
9225 !! test
9226 Parsoid: recognize interwiki links without a target page
9227 !! options
9228 parsoid=wt2html,wt2wt,html2html
9229 !! wikitext
9230 [[:es:]]
9231
9232 [[:ko:]]
9233 !! html/php
9234 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
9235 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
9236 </p>
9237 !! html/parsoid
9238 <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
9239 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
9240 !! end
9241
9242 !! test
9243 Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
9244 !! wikitext
9245 [[mi:Foo]]
9246 !! html/php
9247 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
9248 </p>
9249 !! html/parsoid
9250 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
9251 !! end
9252
9253 !! test
9254 Interlanguage link with preceding local interwiki link (T70085)
9255 !! options
9256 parsoid=wt2html,wt2wt,html2html
9257 !! wikitext
9258 Blah blah blah
9259 [[local:es:Spanish]]
9260 !! html/php
9261 <p>Blah blah blah
9262 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
9263 </p>
9264 !! html/parsoid
9265 <p>Blah blah blah
9266 <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
9267 !! end
9268
9269 !! test
9270 Looks like an interlanguage link, but is actually a local interwiki
9271 !! options
9272 parsoid=wt2html,wt2wt,html2html
9273 !! wikitext
9274 Blah blah blah
9275 [[mi:Template:Foo]]
9276 !! html/php
9277 <p>Blah blah blah
9278 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
9279 </p>
9280 !! html/parsoid
9281 <p>Blah blah blah
9282 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
9283 !! end
9284
9285 ###
9286 ### Redirects, Parsoid-only
9287 ###
9288
9289 !! test
9290 1. Simple redirect to page
9291 !! wikitext
9292 #REDIRECT [[Main Page]]
9293 !! html/parsoid
9294 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9295 !! end
9296
9297 !! test
9298 2. Other redirect variants
9299 !! wikitext
9300 #REDIRECT [[Main_Page]]
9301 !! html/parsoid
9302 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
9303 !! end
9304
9305 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
9306 # This tests the Parsoid bail-out code.
9307 !! test
9308 3. Other redirect variants
9309 !! options
9310 parsoid=wt2html
9311 !! wikitext
9312 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
9313 !! html/parsoid
9314 <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
9315 !! end
9316
9317 !! test
9318 4. Redirect to a templated destination
9319 !! wikitext
9320 #REDIRECT [[{{echo|Foo}}bar]]
9321 !! html/parsoid
9322 <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"}]]}'/>
9323 !! end
9324
9325 !! test
9326 Empty redirect
9327 !! options
9328 parsoid=wt2html,wt2wt
9329 !! wikitext
9330 #REDIRECT [[]]
9331 !! html/parsoid
9332 <ol>
9333 <li>REDIRECT [[]]</li></ol>
9334 !! end
9335
9336 !! test
9337 Optional colon in #REDIRECT
9338 !! options
9339 # the colon is archaic syntax. we support it for wt2html, but we
9340 # don't care that it roundtrips back to the modern syntax.
9341 parsoid=wt2html,html2html
9342 !! wikitext
9343 #REDIRECT:[[Main Page]]
9344 !! html/parsoid
9345 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9346 !! end
9347
9348 !! test
9349 Whitespace in #REDIRECT with optional colon
9350 !! options
9351 # the colon and gratuitous whitespace is archaic syntax. we support
9352 # it for wt2html, but we don't care that it roundtrips back to the
9353 # modern syntax (without extra whitespace)
9354 parsoid=wt2html,html2html
9355 !! wikitext
9356
9357 #REDIRECT
9358 :
9359 [[Main Page]]
9360 !! html/parsoid
9361 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9362 !! end
9363
9364 !! test
9365 Piped link in #REDIRECT
9366 !! options
9367 # content after piped link is ignored. we support this syntax,
9368 # but don't care that the piped link is lost when we roundtrip this.
9369 parsoid=wt2html
9370 !! wikitext
9371 #REDIRECT [[Main Page|bar]]
9372 !! html/parsoid
9373 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9374 !! end
9375
9376 !! test
9377 Redirect to category (T104502)
9378 !! options
9379 parsoid=wt2html,wt2wt
9380 !! wikitext
9381 #REDIRECT [[Category:Foo]]
9382 !! html/parsoid
9383 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9384 !! end
9385
9386 !! test
9387 Redirect to category with URL encoding (T104502)
9388 !! options
9389 parsoid=wt2html
9390 !! wikitext
9391 #REDIRECT [[Category%3AFoo]]
9392 !! html/parsoid
9393 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9394 !! end
9395
9396 !! test
9397 Redirect to category page
9398 !! wikitext
9399 #REDIRECT [[:Category:Foo]]
9400 !! html/parsoid
9401 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
9402 !! end
9403
9404 !! test
9405 Redirect to image page (1)
9406 !! wikitext
9407 #REDIRECT [[File:Wiki.png]]
9408 !! html/parsoid
9409 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
9410 !! end
9411
9412 !! test
9413 Redirect to image page (2)
9414 !! wikitext
9415 #REDIRECT [[Image:Wiki.png]]
9416 !! html/parsoid
9417 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
9418 !! end
9419
9420 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
9421 # Next test confirms this.
9422 !! test
9423 Redirect to language (1) (T104918)
9424 !! options
9425 parsoid=wt2html,wt2wt,html2html
9426 !! wikitext
9427 #REDIRECT [[en:File:Wiki.png]]
9428 !! html/parsoid
9429 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9430 !! end
9431
9432 !! test
9433 Redirect to language (2) (T104918)
9434 !! wikitext
9435 #REDIRECT [[:en:File:Wiki.png]]
9436 !! html/parsoid
9437 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
9438 !! end
9439
9440 !! test
9441 Redirect to interwiki (T104918)
9442 !! wikitext
9443 #REDIRECT [[meatball:File:Wiki.png]]
9444 !! html/parsoid
9445 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
9446 !! end
9447
9448 !! test
9449 Non-English #REDIRECT
9450 !! options
9451 language=is
9452 !! wikitext
9453 #TILVÍSUN [[Main Page]]
9454 !! html/parsoid
9455 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
9456 !! end
9457
9458 !! test
9459 Redirect syntax under text isn't considered a redirect
9460 !! wikitext
9461 some text
9462
9463 #redirect [[Main Page]]
9464 !! html/parsoid
9465 <p>some text</p>
9466 <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>
9467 !! end
9468
9469 !! test
9470 New redirect
9471 !! options
9472 parsoid=html2wt
9473 !! html/parsoid
9474 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9475 !! wikitext
9476 #REDIRECT [[Foo]]
9477 Foo
9478 !! end
9479
9480 !! test
9481 Redirect followed by block on the same line
9482 !! options
9483 parsoid=wt2html
9484 !! wikitext
9485 #REDIRECT [[Main Page]]<!-- haha -->==hi==
9486 !! html/parsoid
9487 <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
9488 !! end
9489
9490 !! test
9491 Redirect followed by a newline
9492 !! wikitext
9493 #REDIRECT [[Main Page]]
9494 A newline
9495 !! html/parsoid
9496 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9497 <p>A newline</p>
9498 !! end
9499
9500 !! test
9501 Redirect followed by multiple newlines
9502 !! wikitext
9503 #REDIRECT [[Main Page]]
9504
9505
9506 A newline
9507 !! html/parsoid
9508 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
9509
9510 <p><br/>
9511 A newline</p>
9512 !! end
9513
9514 !! test
9515 Drop duplicate redirects
9516 !! options
9517 parsoid=html2wt
9518 !! html/parsoid
9519 <link rel="mw:PageProp/redirect" href="./Foo"/>
9520 <link rel="mw:PageProp/redirect" href="./Bar"/>
9521 <link rel="mw:PageProp/redirect" href="./Baz"/>
9522 !! wikitext
9523 #REDIRECT [[Foo]]
9524 !! end
9525
9526 ##
9527 ## XHTML tidiness
9528 ###
9529
9530 !! test
9531 <br> to <br />
9532 !! wikitext
9533 1<br>2<br />3
9534 !! html
9535 <p>1<br />2<br />3
9536 </p>
9537 !! end
9538
9539 !! test
9540 Broken br tag sanitization
9541 !! wikitext
9542 </br>
9543 !! html/php
9544 <p>&lt;/br&gt;
9545 </p>
9546 !! end
9547
9548 # TODO: Fix html2html mode (T53055)!
9549 !! test
9550 Parsoid: Broken br tag recognition
9551 !! options
9552 parsoid=wt2html
9553 !! wikitext
9554 </br>
9555
9556 <br/ >
9557 !! html+tidy
9558 <p><br />
9559 </p><p><br />
9560 </p>
9561 !! end
9562
9563 !! test
9564 Incorrecly removing closing slashes from correctly formed XHTML
9565 !! wikitext
9566 <br style="clear:both;" />
9567 !! html
9568 <p><br style="clear:both;" />
9569 </p>
9570 !! end
9571
9572 !! test
9573 Failing to transform badly formed HTML into correct XHTML
9574 !! wikitext
9575 <br style="clear: left;">
9576 <br style="clear: right;">
9577 <br style="clear: both;">
9578 !! html
9579 <p><br style="clear: left;" />
9580 <br style="clear: right;" />
9581 <br style="clear: both;" />
9582 </p>
9583 !!end
9584
9585 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9586 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9587 !! test
9588 Handling html with a div self-closing tag
9589 !! wikitext
9590 <div title />
9591 <div title/>
9592 <div title/ >
9593 <div title=bar />
9594 <div title=bar/>
9595 <div title=bar/ >
9596 !! html/php+tidy
9597 <div title=""></div>
9598 <div title=""></div>
9599 <div title="">
9600 <div title="bar"></div>
9601 <div title="bar"></div>
9602 <div title="bar/"></div></div>
9603 !! html/parsoid
9604 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9605 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9606 <div title="" data-parsoid='{"stx":"html","autoInsertedEnd":true}'>
9607 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9608 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9609 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div></div>
9610 !! end
9611
9612 !! test
9613 Elements with solidus in various attribute positions
9614 !! options
9615 parsoid=wt2html,html2html
9616 !! wikitext
9617 <div cla/ss="123">ha</div>
9618
9619 <div / class="123">ha</div>
9620
9621 <div class= / "123">ha</div>
9622 !! html/php+tidy
9623 <div>ha</div>
9624 <div class="123">ha</div>
9625 <div class="/">ha</div>
9626 !! html/parsoid
9627 <div data-parsoid='{"stx":"html","a":{"cla":null,"ss":null},"sa":{"cla":"","ss":"123"}}'>ha</div>
9628
9629 <div class="123" data-parsoid='{"stx":"html"}'>ha</div>
9630
9631 <div class="/" data-parsoid='{"stx":"html","a":{"\"123\"":null},"sa":{"\"123\"":""}}'>ha</div>
9632 !! end
9633
9634 !! test
9635 Handling html with a br self-closing tag
9636 !! wikitext
9637 <br title />
9638 <br title/>
9639 <br title/ >
9640 <br title=bar />
9641 <br title=bar/>
9642 <br title=bar/ >
9643 !! html/php+tidy
9644 <p><br title="" />
9645 <br title="" />
9646 <br title="" />
9647 <br title="bar" />
9648 <br title="bar" />
9649 <br title="bar/" />
9650 </p>
9651 !! html/parsoid
9652 <p><br title="" />
9653 <br title="" />
9654 <br title="" />
9655 <br title="bar" />
9656 <br title="bar" />
9657 <br title="bar/" />
9658 </p>
9659 !! end
9660
9661 !! test
9662 Quoted attributes without spaces
9663 !! options
9664 parsoid=wt2html
9665 !! wikitext
9666 <div class="foo"style="color:red">red</div>
9667 !! html/php+tidy
9668 <div class="foo" style="color:red">red</div>
9669 !! html/parsoid
9670 <div class="foo" style="color:red">red</div>
9671 !! end
9672
9673 !! test
9674 Horizontal ruler (should it add that extra space?)
9675 !! wikitext
9676 <hr>
9677 <hr >
9678 foo <hr
9679 > bar
9680 !! html+tidy
9681 <hr />
9682 <hr /><p>
9683 foo </p><hr /><p> bar</p>
9684 !! end
9685
9686 !! test
9687 Horizontal ruler -- 4+ dashes render hr
9688 !! wikitext
9689 ----
9690 !! html
9691 <hr />
9692 !! end
9693
9694 !! test
9695 Horizontal ruler -- eats additional dashes on the same line
9696 !! wikitext
9697 ---------
9698 !! html
9699 <hr />
9700 !! end
9701
9702 !! test
9703 Horizontal ruler -- does not collapse dashes on consecutive lines
9704 !! wikitext
9705 ----
9706 ----
9707 !! html
9708 <hr />
9709 <hr />
9710 !! end
9711
9712 !! test
9713 Horizontal ruler -- <4 dashes render as plain text
9714 !! wikitext
9715 ---
9716 !! html
9717 <p>---
9718 </p>
9719 !! end
9720
9721 !! test
9722 Horizontal ruler -- Supports content following dashes on same line
9723 !! wikitext
9724 ---- Foo
9725 !! html
9726 <hr /> Foo
9727 !! html+tidy
9728 <hr /><p> Foo</p>
9729 !! end
9730
9731 ###
9732 ### Block-level elements
9733 ###
9734 !! test
9735 Common list
9736 !! wikitext
9737 *Common list
9738 *item 2
9739 *item 3
9740 !! html
9741 <ul><li>Common list</li>
9742 <li>item 2</li>
9743 <li>item 3</li></ul>
9744 !! end
9745
9746 !! test
9747 Numbered list
9748 !! wikitext
9749 #Numbered list
9750 #item 2
9751 #item 3
9752 !! html
9753 <ol><li>Numbered list</li>
9754 <li>item 2</li>
9755 <li>item 3</li></ol>
9756 !! end
9757
9758 # the switch from level 3 to ordered should not introduce a newline between
9759 !! test
9760 Mixed list
9761 !! wikitext
9762 *Mixed list
9763 *#with numbers
9764 **and bullets
9765 *#and numbers
9766 *bullets again
9767 **bullet level 2
9768 ***bullet level 3
9769 ***#Number on level 4
9770 **bullet level 2
9771 **#Number on level 3
9772 **#Number on level 3
9773 *#number level 2
9774 *Level 1
9775 ***Level 3
9776 #**Level 3, but ordered
9777 !! html
9778 <ul><li>Mixed list
9779 <ol><li>with numbers</li></ol>
9780 <ul><li>and bullets</li></ul>
9781 <ol><li>and numbers</li></ol></li>
9782 <li>bullets again
9783 <ul><li>bullet level 2
9784 <ul><li>bullet level 3
9785 <ol><li>Number on level 4</li></ol></li></ul></li>
9786 <li>bullet level 2
9787 <ol><li>Number on level 3</li>
9788 <li>Number on level 3</li></ol></li></ul>
9789 <ol><li>number level 2</li></ol></li>
9790 <li>Level 1
9791 <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
9792 <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
9793 !! end
9794
9795 !! test
9796 1. Nested mixed wikitext and html list
9797 !! wikitext
9798 *hi
9799 *<ul><li>ho</li></ul>
9800 *hi
9801 **ho
9802 !! html/php
9803 <ul><li>hi</li>
9804 <li><ul><li>ho</li></ul></li>
9805 <li>hi
9806 <ul><li>ho</li></ul></li></ul>
9807 !! html/parsoid
9808 <ul><li>hi</li>
9809 <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9810 <li>hi
9811 <ul><li>ho</li></ul></li></ul>
9812 !! end
9813
9814 !! test
9815 2. Nested mixed wikitext and html list (incompatible)
9816 !! wikitext
9817 ;hi
9818 :{{echo|<li>ho</li>}}
9819 !! html/php
9820 <dl><dt>hi</dt>
9821 <dd><li>ho</li></dd></dl>
9822 !! html/parsoid
9823 <dl><dt>hi</dt>
9824 <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>
9825 !! end
9826
9827 !! test
9828 Nested lists 1
9829 !! wikitext
9830 *foo
9831 **bar
9832 !! html
9833 <ul><li>foo
9834 <ul><li>bar</li></ul></li></ul>
9835 !! end
9836
9837 !! test
9838 Nested lists 2
9839 !! wikitext
9840 **foo
9841 *bar
9842 !! html
9843 <ul><li><ul><li>foo</li></ul></li>
9844 <li>bar</li></ul>
9845 !! end
9846
9847 !! test
9848 Nested lists 3 (first element empty)
9849 !! wikitext
9850 *
9851 **bar
9852 !! html
9853 <ul><li>
9854 <ul><li>bar</li></ul></li></ul>
9855 !! end
9856
9857 !! test
9858 Nested lists 4 (first element empty)
9859 !! wikitext
9860 **
9861 *bar
9862 !! html
9863 <ul><li><ul><li></li></ul></li>
9864 <li>bar</li></ul>
9865 !! end
9866
9867 !! test
9868 Nested lists 5 (both elements empty)
9869 !! wikitext
9870 **
9871 *
9872 !! html
9873 <ul><li><ul><li></li></ul></li>
9874 <li></li></ul>
9875 !! end
9876
9877 !! test
9878 Nested lists 6 (both elements empty)
9879 !! wikitext
9880 *
9881 **
9882 !! html
9883 <ul><li>
9884 <ul><li></li></ul></li></ul>
9885 !! end
9886
9887 !! test
9888 Nested lists 7 (skip initial nesting levels)
9889 !! wikitext
9890 ***foo
9891 !! html
9892 <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
9893 !! end
9894
9895 !! test
9896 Nested lists 8 (multiple nesting transitions)
9897 !! wikitext
9898 *foo
9899 ***bar
9900 **baz
9901 *boo
9902 !! html
9903 <ul><li>foo
9904 <ul><li><ul><li>bar</li></ul></li>
9905 <li>baz</li></ul></li>
9906 <li>boo</li></ul>
9907 !! end
9908
9909 # XXX this test should be moved to citeParserTests, since it depends
9910 # on the Cite extension, which is "built in" to Parsoid.
9911 !! test
9912 Nested lists 9 (extension interaction)
9913 !! wikitext
9914 *<references />
9915 !! html/php+tidy-DISABLED
9916 <ul><li class="mw-empty-elt"></li></ul>
9917 !! html/parsoid
9918 <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>
9919 !! end
9920
9921 !! test
9922 1. Lists with start-of-line-transparent tokens before bullets: Comments
9923 !! wikitext
9924 *foo
9925 *<!--cmt-->bar
9926 <!--cmt-->*baz
9927 !! html
9928 <ul><li>foo</li>
9929 <li>bar</li>
9930 <li>baz</li></ul>
9931 !! end
9932
9933 !! test
9934 Nested lists 10 (list and span siblings: wt2wt regression)
9935 !! wikitext
9936 *a <span>x</span>
9937 **b <span>y</span>
9938 !! html/parsoid
9939 <ul><li>a <span>x</span>
9940 <ul><li>b <span>y</span></li></ul></li></ul>
9941 !! end
9942
9943 !! test
9944 2. Lists with start-of-line-transparent tokens before bullets: Template close
9945 !! wikitext
9946 *foo {{echo|bar
9947 }}*baz
9948 !! html
9949 <ul><li>foo bar</li>
9950 <li>baz</li></ul>
9951 !! end
9952
9953 !! test
9954 List items are not parsed correctly following a <pre> block (T2785)
9955 !! wikitext
9956 *<pre>foo</pre>
9957 *<pre>bar</pre>
9958 *zar
9959 !! html/php
9960 <ul><li><pre>foo</pre></li>
9961 <li><pre>bar</pre></li>
9962 <li>zar</li></ul>
9963 !! html/parsoid
9964 <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
9965 <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
9966 <li>zar</li></ul>
9967 !! end
9968
9969 # FIXME: Might benefit from a html/parsoid since this has a template
9970 !! test
9971 List items from template
9972 !! wikitext
9973
9974 {{inner list}}
9975 *item 2
9976
9977 *item 0
9978 {{inner list}}
9979 *item 2
9980
9981 *item 0
9982 *notSOL{{inner list}}
9983 *item 2
9984 !! html
9985 <ul><li>item 1</li>
9986 <li>item 2</li></ul>
9987 <ul><li>item 0</li>
9988 <li>item 1</li>
9989 <li>item 2</li></ul>
9990 <ul><li>item 0</li>
9991 <li>notSOL</li>
9992 <li>item 1</li>
9993 <li>item 2</li></ul>
9994 !! end
9995
9996 !! test
9997 List interrupted by empty line or heading
9998 !! wikitext
9999 *foo
10000
10001 **bar
10002 ==A heading==
10003 *Another list item
10004 !! html
10005 <ul><li>foo</li></ul>
10006 <ul><li><ul><li>bar</li></ul></li></ul>
10007 <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>
10008 <ul><li>Another list item</li></ul>
10009 !!end
10010
10011 !! test
10012 Multiple list tags generated by templates
10013 !! wikitext
10014 {{echo|<li>}}a
10015 {{echo|<li>}}b
10016 {{echo|<li>}}c
10017 !! html
10018 <li>a
10019 <li>b
10020 <li>c</li>
10021 </li>
10022 </li>
10023
10024 !! html+tidy
10025 <li>a
10026 </li><li>b
10027 </li><li>c</li>
10028 !! html/parsoid
10029 <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>
10030 <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>
10031 <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>
10032 !! end
10033
10034 !! test
10035 Multiple newlines in between HTML list items don't induce paragraph wrapping
10036 !! wikitext
10037 <ul>
10038 <li>hi</li>
10039
10040
10041
10042
10043 <li>ho</li>
10044 </ul>
10045
10046 <dl>
10047 <dt>hi</dt>
10048 <dd>ho<div>123</div>
10049 </dd>
10050
10051
10052 </dl>
10053 !! html/php+tidy
10054 <ul>
10055 <li>hi</li>
10056
10057
10058
10059
10060 <li>ho</li>
10061 </ul>
10062 <dl>
10063 <dt>hi</dt>
10064 <dd>ho<div>123</div>
10065 </dd>
10066
10067
10068 </dl>
10069 !! end
10070
10071 !!test
10072 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
10073 !! wikitext
10074 *a
10075 <!--This line will NOT split the list-->
10076 *b
10077 <!--This line will NOT split the list either-->
10078 *c
10079 <!--foo--> <!----> <!--This line NOT split the list either-->
10080 *d
10081 !! html
10082 <ul><li>a</li>
10083 <li>b</li>
10084 <li>c</li>
10085 <li>d</li></ul>
10086 !!end
10087
10088 !!test
10089 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
10090 !! wikitext
10091 *a
10092 <!--This line will NOT split the list-->
10093 *b
10094 <!--This line will NOT split the list either-->
10095 *c
10096 <!--foo--> <!----> <!--This line NOT split the list
10097 either-->
10098 *d
10099 !! html
10100 <ul><li>a</li>
10101 <li>b</li>
10102 <li>c</li>
10103 <li>d</li></ul>
10104 !!end
10105
10106 # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
10107 # That pass could possibly be removed.
10108 !!test
10109 Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
10110 !!options
10111 parsoid=wt2html,wt2wt
10112 !! wikitext
10113 *foo
10114 *<li>li-hack
10115 *{{echo|<li>templated li-hack}}
10116 *<!--foo--><li> unsupported li-hack with preceding comments
10117
10118 <ul>
10119 <li><li>not a li-hack
10120 </li>
10121 </ul>
10122 !! html+tidy
10123 <ul><li>foo</li>
10124 <li class="mw-empty-elt"></li><li>li-hack</li>
10125 <li class="mw-empty-elt"></li><li>templated li-hack</li>
10126 <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
10127 <ul>
10128 <li class="mw-empty-elt"></li><li>not a li-hack
10129 </li>
10130 </ul>
10131 !! html/parsoid
10132 <ul><li> foo</li>
10133 <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
10134 <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>
10135 <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
10136
10137 <ul data-parsoid='{"stx":"html"}'>
10138 <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
10139 </li>
10140 </ul>
10141 !! end
10142
10143 !! test
10144 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
10145 !! wikitext
10146 #foo
10147 ##bar
10148
10149 *foo
10150 **bar
10151
10152 :foo
10153 ::bar
10154 !! html/php+tidy
10155 <ol><li>foo
10156 <ol><li>bar</li></ol></li></ol>
10157 <ul><li>foo
10158 <ul><li>bar</li></ul></li></ul>
10159 <dl><dd>foo
10160 <dl><dd>bar</dd></dl></dd></dl>
10161 !! html/parsoid
10162 <ol>
10163 <li>foo<ol>
10164 <li>bar</li>
10165 </ol></li>
10166 </ol><ul>
10167 <li>foo<ul>
10168 <li>bar</li>
10169 </ul></li>
10170 </ul><dl>
10171 <dd>foo<dl>
10172 <dd>bar</dd>
10173 </dl></dd>
10174 </dl>
10175 !! end
10176
10177 !! test
10178 Parsoid: Test of whitespace serialization with Templated bullets
10179 !! options
10180 parsoid=wt2html
10181 !! wikitext
10182 * {{bullet}}
10183 !! html/parsoid
10184 <ul>
10185 <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>
10186 </ul>
10187 !! end
10188
10189 # ------------------------------------------------------------------------
10190 # The next set of tests are about Parsoid's ability to handle badly nested
10191 # tags (parse, minimize scope of fixup, and roundtrip back)
10192 # ------------------------------------------------------------------------
10193
10194 # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
10195 # Parsoid's list handling is more aware of block structure.
10196 !! test
10197 Unbalanced closing block tags break a list
10198 !! wikitext
10199 <div>
10200 *a</div><div>
10201 *b</div>
10202 !! html+tidy
10203 <div>
10204 <ul><li>a</li></ul></div><div>
10205 <li>b</li></div>
10206 !! html/parsoid
10207 <div><ul>
10208 <li>a</li>
10209 </ul></div>
10210 <div><ul>
10211 <li>b</li>
10212 </ul></div>
10213 !! end
10214
10215 !! test
10216 Unbalanced closing non-block tags don't break a list
10217 !! options
10218 parsoid=wt2html,html2html
10219 !! wikitext
10220 <span>
10221 *a</span><span>
10222 *b</span>
10223 !! html/php+tidy
10224 <p><span>
10225 </span></p>
10226 <ul><li>a<span></span></li>
10227 <li>b</li></ul>
10228 !! html/parsoid
10229 <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></p>
10230 <ul><li>a<span data-parsoid='{"stx":"html","autoInsertedEnd":true}'></span></li>
10231 <li>b</li></ul>
10232 !! end
10233
10234 # Parsoid does some post-dom-building cleanup
10235 # which is why its output differs from Remex.
10236 !! test
10237 Unclosed formatting tags that straddle lists are closed and reopened
10238 !! options
10239 parsoid=wt2html,wt2wt,html2html
10240 !! wikitext
10241 #<s> a
10242 #b </s>
10243 !! html/php+tidy
10244 <ol><li><s> a</s></li><s>
10245 </s><li><s>b </s></li></ol>
10246 !! html/parsoid
10247 <ol><li><s> a</s></li>
10248 <li><s>b </s></li></ol>
10249 !! end
10250
10251 # Output is ugly because of all the misnested tag fixups.
10252 !! test
10253 1. List embedded in a formatting tag
10254 !! wikitext
10255 <small>
10256 *foo
10257 </small>
10258 !! html/php+tidy
10259 <p><small>
10260 </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
10261 </p>
10262 !! html/parsoid
10263 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
10264 <ul><li data-parsoid='{}'>foo</li></ul></small>
10265 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p>
10266 !! end
10267
10268 # Output is ugly because of all the misnested tag fixups.
10269 !! test
10270 2. List embedded in a formatting tag in a misnested way
10271 !! wikitext
10272 <small>
10273 *a
10274 *b</small>
10275 !! html/php+tidy
10276 <p><small>
10277 </small></p><small></small><ul><small><li>a</li>
10278 </small><li><small>b</small></li></ul>
10279 !! html/parsoid
10280 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10281 <ul><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'><li>a</li></small>
10282 <li><small data-parsoid='{"stx":"html","autoInsertedStart":true}'>b</small></li></ul>
10283 !! end
10284
10285 # Output is ugly because of all the misnested tag fixups.
10286 !! test
10287 3. List embedded in a formatting tag in a misnested way
10288 !! wikitext
10289 <small>
10290
10291 ** 123</small>
10292 !! html/php+tidy
10293 <p><small>
10294 </small></p><small></small><ul><small></small><li><small></small><ul><small></small><li><small>123</small></li></ul></li></ul>
10295 !! html/parsoid
10296 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p>
10297
10298 <ul><li><ul><li data-parsoid='{}'><small data-parsoid='{"stx":"html","autoInsertedStart":true}'> 123</small></li></ul></li></ul>
10299 !! end
10300
10301 ###
10302 ### Magic Words
10303 ###
10304
10305 # Note that the current date is hard-coded as
10306 # 1970-01-01T00:02:03Z (a Thursday)
10307 # when running parser tests. The timezone is also fixed to GMT, so
10308 # local date will be identical to current date.
10309
10310 !! test
10311 Magic Word: {{CURRENTDAY}}
10312 !! wikitext
10313 {{CURRENTDAY}}
10314 !! html
10315 <p>1
10316 </p>
10317 !! end
10318
10319 !! test
10320 Magic Word: {{CURRENTDAY2}}
10321 !! wikitext
10322 {{CURRENTDAY2}}
10323 !! html
10324 <p>01
10325 </p>
10326 !! end
10327
10328 !! test
10329 Magic Word: {{CURRENTDAYNAME}}
10330 !! wikitext
10331 {{CURRENTDAYNAME}}
10332 !! html
10333 <p>Thursday
10334 </p>
10335 !! end
10336
10337 !! test
10338 Magic Word: {{CURRENTDOW}}
10339 !! wikitext
10340 {{CURRENTDOW}}
10341 !! html
10342 <p>4
10343 </p>
10344 !! end
10345
10346 !! test
10347 Magic Word: {{CURRENTMONTH}}
10348 !! wikitext
10349 {{CURRENTMONTH}}
10350 !! html
10351 <p>01
10352 </p>
10353 !! end
10354
10355 !! test
10356 Magic Word: {{CURRENTMONTH1}}
10357 !! wikitext
10358 {{CURRENTMONTH1}}
10359 !! html
10360 <p>1
10361 </p>
10362 !! end
10363
10364 !! test
10365 Magic Word: {{CURRENTMONTHABBREV}}
10366 !! wikitext
10367 {{CURRENTMONTHABBREV}}
10368 !! html
10369 <p>Jan
10370 </p>
10371 !! end
10372
10373 !! test
10374 Magic Word: {{CURRENTMONTHNAME}}
10375 !! wikitext
10376 {{CURRENTMONTHNAME}}
10377 !! html
10378 <p>January
10379 </p>
10380 !! end
10381
10382 !! test
10383 Magic Word: {{CURRENTMONTHNAMEGEN}}
10384 !! wikitext
10385 {{CURRENTMONTHNAMEGEN}}
10386 !! html
10387 <p>January
10388 </p>
10389 !! end
10390
10391 !! test
10392 Magic Word: {{CURRENTTIME}}
10393 !! wikitext
10394 {{CURRENTTIME}}
10395 !! html
10396 <p>00:02
10397 </p>
10398 !! end
10399
10400 !! test
10401 Magic Word: {{CURRENTHOUR}}
10402 !! wikitext
10403 {{CURRENTHOUR}}
10404 !! html
10405 <p>00
10406 </p>
10407 !! end
10408
10409 !! test
10410 Magic Word: {{CURRENTWEEK}} (T6594)
10411 !! wikitext
10412 {{CURRENTWEEK}}
10413 !! html
10414 <p>1
10415 </p>
10416 !! end
10417
10418 !! test
10419 Magic Word: {{CURRENTYEAR}}
10420 !! wikitext
10421 {{CURRENTYEAR}}
10422 !! html
10423 <p>1970
10424 </p>
10425 !! end
10426
10427 !! test
10428 Magic Word: {{CURRENTTIMESTAMP}}
10429 !! wikitext
10430 {{CURRENTTIMESTAMP}}
10431 !! html
10432 <p>19700101000203
10433 </p>
10434 !! end
10435
10436 !! test
10437 Magic Words LOCAL (UTC)
10438 !! wikitext
10439 *{{LOCALMONTH}}
10440 *{{LOCALMONTH1}}
10441 *{{LOCALMONTHNAME}}
10442 *{{LOCALMONTHNAMEGEN}}
10443 *{{LOCALMONTHABBREV}}
10444 *{{LOCALDAY}}
10445 *{{LOCALDAY2}}
10446 *{{LOCALDAYNAME}}
10447 *{{LOCALYEAR}}
10448 *{{LOCALTIME}}
10449 *{{LOCALHOUR}}
10450 *{{LOCALWEEK}}
10451 *{{LOCALDOW}}
10452 *{{LOCALTIMESTAMP}}
10453 !! html
10454 <ul><li>01</li>
10455 <li>1</li>
10456 <li>January</li>
10457 <li>January</li>
10458 <li>Jan</li>
10459 <li>1</li>
10460 <li>01</li>
10461 <li>Thursday</li>
10462 <li>1970</li>
10463 <li>00:02</li>
10464 <li>00</li>
10465 <li>1</li>
10466 <li>4</li>
10467 <li>19700101000203</li></ul>
10468 !! end
10469
10470 !! test
10471 Magic Word: {{FULLPAGENAME}}
10472 !! options
10473 title=[[User:Ævar Arnfjörð Bjarmason]]
10474 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10475 !! wikitext
10476 {{FULLPAGENAME}}
10477 !! html/*
10478 <p>User:Ævar Arnfjörð Bjarmason
10479 </p>
10480 !! end
10481
10482 !! test
10483 Magic Word: {{FULLPAGENAMEE}}
10484 !! options
10485 title=[[User:Ævar Arnfjörð Bjarmason]]
10486 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10487 !! wikitext
10488 {{FULLPAGENAMEE}}
10489 !! html/*
10490 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10491 </p>
10492 !! end
10493
10494 !! test
10495 Magic Word: {{TALKSPACE}}
10496 !! options
10497 title=[[User:Ævar Arnfjörð Bjarmason]]
10498 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10499 !! wikitext
10500 {{TALKSPACE}}
10501 !! html/*
10502 <p>User talk
10503 </p>
10504 !! end
10505
10506 !! test
10507 Magic Word: {{TALKSPACE}}, same namespace
10508 !! options
10509 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10510 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10511 !! wikitext
10512 {{TALKSPACE}}
10513 !! html/*
10514 <p>User talk
10515 </p>
10516 !! end
10517
10518 !! test
10519 Magic Word: {{TALKSPACE}}, main namespace
10520 !! options
10521 title=[[Parser Test]]
10522 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10523 !! wikitext
10524 {{TALKSPACE}}
10525 !! html/*
10526 <p>Talk
10527 </p>
10528 !! end
10529
10530 !! test
10531 Magic Word: {{TALKSPACEE}}
10532 !! options
10533 title=[[User:Ævar Arnfjörð Bjarmason]]
10534 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10535 !! wikitext
10536 {{TALKSPACEE}}
10537 !! html/*
10538 <p>User_talk
10539 </p>
10540 !! end
10541
10542 !! test
10543 Magic Word: {{SUBJECTSPACE}}
10544 !! options
10545 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10546 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10547 !! wikitext
10548 {{SUBJECTSPACE}}
10549 !! html/*
10550 <p>User
10551 </p>
10552 !! end
10553
10554 !! test
10555 Magic Word: {{SUBJECTSPACE}}, same namespace
10556 !! options
10557 title=[[User:Ævar Arnfjörð Bjarmason]]
10558 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10559 !! wikitext
10560 {{SUBJECTSPACE}}
10561 !! html/*
10562 <p>User
10563 </p>
10564 !! end
10565
10566 !! test
10567 Magic Word: {{SUBJECTSPACE}}, main namespace
10568 !! options
10569 title=[[Parser Test]]
10570 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10571 !! wikitext
10572 {{SUBJECTSPACE}}
10573 !! html/*
10574 !! end
10575
10576 !! test
10577 Magic Word: {{SUBJECTSPACEE}}
10578 !! options
10579 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10580 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10581 !! wikitext
10582 {{SUBJECTSPACEE}}
10583 !! html/*
10584 <p>User
10585 </p>
10586 !! end
10587
10588 !! test
10589 Magic Word: {{NAMESPACE}}
10590 !! options
10591 title=[[User:Ævar Arnfjörð Bjarmason]]
10592 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10593 !! wikitext
10594 {{NAMESPACE}}
10595 !! html/*
10596 <p>User
10597 </p>
10598 !! end
10599
10600 !! test
10601 Magic Word: {{NAMESPACEE}}
10602 !! options
10603 title=[[User:Ævar Arnfjörð Bjarmason]]
10604 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10605 !! wikitext
10606 {{NAMESPACEE}}
10607 !! html/*
10608 <p>User
10609 </p>
10610 !! end
10611
10612 !! test
10613 Magic Word: {{NAMESPACENUMBER}}
10614 !! options
10615 title=[[User:Ævar Arnfjörð Bjarmason]]
10616 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10617 !! wikitext
10618 {{NAMESPACENUMBER}}
10619 !! html/*
10620 <p>2
10621 </p>
10622 !! end
10623
10624 !! test
10625 Magic Word: {{SUBPAGENAME}}
10626 !! options
10627 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10628 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10629 !! wikitext
10630 {{SUBPAGENAME}}
10631 !! html/*
10632 <p>sub ö
10633 </p>
10634 !! end
10635
10636 !! test
10637 Magic Word: {{SUBPAGENAMEE}}
10638 !! options
10639 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10640 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10641 !! wikitext
10642 {{SUBPAGENAMEE}}
10643 !! html/*
10644 <p>sub_%C3%B6
10645 </p>
10646 !! end
10647
10648 !! test
10649 Magic Word: {{ROOTPAGENAME}}
10650 !! options
10651 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10652 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10653 !! wikitext
10654 {{ROOTPAGENAME}}
10655 !! html/*
10656 <p>Ævar Arnfjörð Bjarmason
10657 </p>
10658 !! end
10659
10660 !! test
10661 Magic Word: {{ROOTPAGENAMEE}}
10662 !! options
10663 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10664 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10665 !! wikitext
10666 {{ROOTPAGENAMEE}}
10667 !! html/*
10668 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10669 </p>
10670 !! end
10671
10672 !! test
10673 Magic Word: {{BASEPAGENAME}}
10674 !! options
10675 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10676 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10677 !! wikitext
10678 {{BASEPAGENAME}}
10679 !! html/*
10680 <p>Ævar Arnfjörð Bjarmason
10681 </p>
10682 !! end
10683
10684 !! test
10685 Magic Word: {{BASEPAGENAMEE}}
10686 !! options
10687 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10688 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10689 !! wikitext
10690 {{BASEPAGENAMEE}}
10691 !! html/*
10692 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10693 </p>
10694 !! end
10695
10696 !! test
10697 Magic Word: {{TALKPAGENAME}}
10698 !! options
10699 title=[[User:Ævar Arnfjörð Bjarmason]]
10700 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10701 !! wikitext
10702 {{TALKPAGENAME}}
10703 !! html/*
10704 <p>User talk:Ævar Arnfjörð Bjarmason
10705 </p>
10706 !! end
10707
10708 !! test
10709 Magic Word: {{TALKPAGENAMEE}}
10710 !! options
10711 title=[[User:Ævar Arnfjörð Bjarmason]]
10712 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10713 !! wikitext
10714 {{TALKPAGENAMEE}}
10715 !! html/*
10716 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10717 </p>
10718 !! end
10719
10720 !! test
10721 Magic Word: {{SUBJECTPAGENAME}}
10722 !! options
10723 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10724 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10725 !! wikitext
10726 {{SUBJECTPAGENAME}}
10727 !! html/*
10728 <p>User:Ævar Arnfjörð Bjarmason
10729 </p>
10730 !! end
10731
10732 !! test
10733 Magic Word: {{SUBJECTPAGENAMEE}}
10734 !! options
10735 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10736 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10737 !! wikitext
10738 {{SUBJECTPAGENAMEE}}
10739 !! html/*
10740 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10741 </p>
10742 !! end
10743
10744 !! test
10745 Magic Word: {{NUMBEROFFILES}}
10746 !! options
10747 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10748 !! wikitext
10749 {{NUMBEROFFILES}}
10750 !! html/*
10751 <p>7
10752 </p>
10753 !! end
10754
10755 !! test
10756 Magic Word: {{PAGENAME}}
10757 !! options
10758 title=[[User:Ævar Arnfjörð Bjarmason]]
10759 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10760 !! wikitext
10761 {{PAGENAME}}
10762 !! html/*
10763 <p>Ævar Arnfjörð Bjarmason
10764 </p>
10765 !! end
10766
10767 !! test
10768 Magic Word: {{PAGENAME}} with metacharacters
10769 !! options
10770 title=[['foo & bar = baz']]
10771 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10772 !! wikitext
10773 ''{{PAGENAME}}''
10774 !! html+tidy
10775 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10776 </p>
10777 !! end
10778
10779 !! test
10780 Magic Word: {{PAGENAME}} with metacharacters (T28781)
10781 !! options
10782 title=[[*RFC 1234 http://example.com/]]
10783 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10784 !! wikitext
10785 {{PAGENAME}}
10786 !! html+tidy
10787 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10788 </p>
10789 !! end
10790
10791 !! test
10792 Magic Word: {{PAGENAMEE}}
10793 !! options
10794 title=[[User:Ævar Arnfjörð Bjarmason]]
10795 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10796 !! wikitext
10797 {{PAGENAMEE}}
10798 !! html/*
10799 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10800 </p>
10801 !! end
10802
10803 !! test
10804 Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
10805 !! options
10806 title=[[*RFC 1234 http://example.com/]]
10807 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10808 !! wikitext
10809 {{PAGENAMEE}}
10810 !! html+tidy
10811 <p>&#42;RFC_1234_http&#58;//example.com/
10812 </p>
10813 !! end
10814
10815 !! test
10816 Magic Word: {{REVISIONID}} on latest revision
10817 !! options
10818 lastsavedrevision
10819 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10820 showflags
10821 !! wikitext
10822 {{REVISIONID}}
10823 !! html/*
10824 <p>1337
10825 </p>
10826 flags=vary-revision-id
10827 !! end
10828
10829 !! test
10830 Magic Word: {{REVISIONID}} on non-latest revision
10831 !! options
10832 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10833 showflags
10834 !! wikitext
10835 {{REVISIONID}}
10836 !! html/*
10837 <p>1337
10838 </p>
10839 flags=vary-revision-id
10840 !! end
10841
10842 !! test
10843 Magic Word: {{REVISIONTIMESTAMP}} on latest revision
10844 !! options
10845 lastsavedrevision
10846 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10847 showflags
10848 !! wikitext
10849 {{REVISIONTIMESTAMP}}
10850 !! html/*
10851 <p>19700101000203
10852 </p>
10853 flags=
10854 !! end
10855
10856 !! test
10857 Magic Word: {{REVISIONTIMESTAMP}} on non-existing page
10858 !! options
10859 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10860 showflags
10861 !! wikitext
10862 {{REVISIONTIMESTAMP}}
10863 !! html/*
10864 <p>123
10865 </p>
10866 flags=vary-revision-timestamp
10867 !! end
10868
10869 !! test
10870 Magic Word: {{REVISIONUSER}} on latest revision
10871 !! options
10872 lastsavedrevision
10873 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10874 showflags
10875 !! wikitext
10876 {{REVISIONUSER}}
10877 !! html/*
10878 <p>127.0.0.1
10879 </p>
10880 flags=vary-user
10881 !! end
10882
10883 !! test
10884 Parser Function: {{REVISIONID:{{PAGENAME}}}} on latest revision
10885 !! options
10886 lastsavedrevision
10887 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10888 showflags
10889 !! wikitext
10890 {{REVISIONID:{{PAGENAME}}}}
10891 !! html/*
10892 <p>1337
10893 </p>
10894 flags=vary-revision-id
10895 !! end
10896
10897 !! test
10898 Parser Function: {{REVISIONID:{{PAGENAME}}}} on non-saved revision
10899 !! options
10900 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10901 showflags
10902 !! wikitext
10903 {{REVISIONID:{{PAGENAME}}}}
10904 !! html/*
10905
10906 flags=vary-revision-id
10907 !! end
10908
10909 !! test
10910 Parser Function: {{REVISIONTIMESTAMP:{{PAGENAME}}}} on latest revision
10911 !! options
10912 lastsavedrevision
10913 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10914 showflags
10915 !! wikitext
10916 {{REVISIONTIMESTAMP:{{PAGENAME}}}}
10917 !! html/*
10918 <p>19700101000203
10919 </p>
10920 flags=vary-revision-timestamp
10921 !! end
10922
10923 !! test
10924 Parser Function: {{REVISIONDAY:{{PAGENAME}}}} on latest revision
10925 !! options
10926 lastsavedrevision
10927 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10928 showflags
10929 !! wikitext
10930 {{REVISIONDAY:{{PAGENAME}}}}
10931 !! html/*
10932 <p>1
10933 </p>
10934 flags=vary-revision-timestamp
10935 !! end
10936
10937 !! test
10938 Parser Function: {{REVISIONMONTH:{{PAGENAME}}}} on latest revision
10939 !! options
10940 lastsavedrevision
10941 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10942 showflags
10943 !! wikitext
10944 {{REVISIONMONTH:{{PAGENAME}}}}
10945 !! html/*
10946 <p>01
10947 </p>
10948 flags=vary-revision-timestamp
10949 !! end
10950
10951 !! test
10952 Parser Function: {{REVISIONYEAR:{{PAGENAME}}}} on latest revision
10953 !! options
10954 lastsavedrevision
10955 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10956 showflags
10957 !! wikitext
10958 {{REVISIONYEAR:{{PAGENAME}}}}
10959 !! html/*
10960 <p>1970
10961 </p>
10962 flags=vary-revision-timestamp
10963 !! end
10964
10965 !! test
10966 Parser Function: {{PAGESIZE:{{PAGENAME}}}} on latest revision
10967 !! options
10968 lastsavedrevision
10969 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10970 showflags
10971 !! wikitext
10972 {{PAGESIZE:{{PAGENAME}}}}
10973 !! html/*
10974 <p>25
10975 </p>
10976 flags=vary-revision-sha1
10977 !! end
10978
10979 !! test
10980 Magic Word: {{SCRIPTPATH}}
10981 !! options
10982 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10983 !! wikitext
10984 {{SCRIPTPATH}}
10985 !! html/*
10986 !! end
10987
10988 !! test
10989 Magic Word: {{STYLEPATH}}
10990 !! options
10991 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
10992 !! wikitext
10993 {{STYLEPATH}}
10994 !! html/*
10995 <p>/skins
10996 </p>
10997 !! end
10998
10999 !! test
11000 Magic Word: {{SERVER}}
11001 !! options
11002 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11003 !! wikitext
11004 {{SERVER}}
11005 !! html/*
11006 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11007 </p>
11008 !! end
11009
11010 !! test
11011 Magic Word: {{SERVERNAME}}
11012 !! options
11013 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11014 !! wikitext
11015 {{SERVERNAME}}
11016 !! html/*
11017 <p>example.org
11018 </p>
11019 !! end
11020
11021 !! test
11022 Magic Word: {{SITENAME}}
11023 !! options
11024 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11025 !! wikitext
11026 {{SITENAME}}
11027 !! html/*
11028 <p>MediaWiki
11029 </p>
11030 !! end
11031
11032 !! test
11033 Magic Word: {{PAGELANGUAGE}}
11034 !! options
11035 language=fr
11036 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11037 !! wikitext
11038 {{PAGELANGUAGE}}
11039 !! html/*
11040 <p>fr
11041 </p>
11042 !! end
11043
11044 !! test
11045 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
11046 !! options
11047 parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
11048 !! wikitext
11049 {{PAGELANGUAGE}}
11050 !! html/*
11051 <p>en
11052 </p>
11053 !! end
11054
11055 !! test
11056 Case-sensitive magic words, when cased differently, should just be template transclusions
11057 !! wikitext
11058 {{CurrentMonth}}
11059 {{currentday}}
11060 {{cURreNTweEK}}
11061 {{currentHour}}
11062 !! html
11063 <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>
11064 <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>
11065 <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>
11066 <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>
11067 </p>
11068 !! end
11069
11070 !! test
11071 Case-insensitive magic words should still work with weird casing.
11072 !! wikitext
11073 {{sErVeRNaMe}}
11074 {{LCFirst:AOEU}}
11075 {{ucFIRST:aoeu}}
11076 {{SERver}}
11077 !! html
11078 <p>example.org
11079 aOEU
11080 Aoeu
11081 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
11082 </p>
11083 !! end
11084
11085 # From plwiki:PLOS_ONE
11086 !! test
11087 Parsoid: Page property magic word with magic word contents
11088 !! options
11089 showtitle
11090 !! config
11091 wgAllowDisplayTitle=true
11092 wgRestrictDisplayTitle=false
11093 !! wikitext
11094 {{DISPLAYTITLE:''{{PAGENAME}}''}}
11095 !! html/php+tidy
11096 <i>Parser test</i>
11097
11098 !! html/parsoid
11099 <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>"}]]}'/>
11100 !! end
11101
11102 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
11103 # But, this is a limitation of our representation and is documented in
11104 # TemplateHandler.js in processSpecialMagicWord
11105 !! test
11106 Parsoid: Template-generated DISPLAYTITLE
11107 !! wikitext
11108 {{{{echo|DISPLAYTITLE}}:Foo}}
11109 !! options
11110 showtitle
11111 !! config
11112 wgAllowDisplayTitle=true
11113 wgRestrictDisplayTitle=false
11114 !! html/php
11115 Foo
11116
11117 !! html/parsoid
11118 <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"}]]}'/>
11119 !! end
11120
11121 !! test
11122 Namespace 1 {{ns:1}}
11123 !! wikitext
11124 {{ns:1}}
11125 !! html
11126 <p>Talk
11127 </p>
11128 !! end
11129
11130 !! test
11131 Namespace 1 {{ns:01}}
11132 !! wikitext
11133 {{ns:01}}
11134 !! html
11135 <p>Talk
11136 </p>
11137 !! end
11138
11139 !! test
11140 Namespace 0 {{ns:0}} (T6783)
11141 !! wikitext
11142 {{ns:0}}
11143 !! html
11144 !! end
11145
11146 !! test
11147 Namespace 0 {{ns:00}} (T6783)
11148 !! wikitext
11149 {{ns:00}}
11150 !! html
11151 !! end
11152
11153 !! test
11154 Namespace -1 {{ns:-1}}
11155 !! wikitext
11156 {{ns:-1}}
11157 !! html
11158 <p>Special
11159 </p>
11160 !! end
11161
11162 !! test
11163 Namespace User {{ns:User}}
11164 !! wikitext
11165 {{ns:User}}
11166 !! html
11167 <p>User
11168 </p>
11169 !! end
11170
11171 !! test
11172 Namespace User talk {{ns:User_talk}}
11173 !! wikitext
11174 {{ns:User_talk}}
11175 !! html
11176 <p>User talk
11177 </p>
11178 !! end
11179
11180 !! test
11181 Namespace User talk {{ns:uSeR tAlK}}
11182 !! wikitext
11183 {{ns:uSeR tAlK}}
11184 !! html
11185 <p>User talk
11186 </p>
11187 !! end
11188
11189 !! test
11190 Namespace File {{ns:File}}
11191 !! wikitext
11192 {{ns:File}}
11193 !! html
11194 <p>File
11195 </p>
11196 !! end
11197
11198 !! test
11199 Namespace File {{ns:Image}}
11200 !! wikitext
11201 {{ns:Image}}
11202 !! html
11203 <p>File
11204 </p>
11205 !! end
11206
11207 !! test
11208 Namespace (lang=de) Benutzer {{ns:User}}
11209 !! options
11210 language=de
11211 !! wikitext
11212 {{ns:User}}
11213 !! html
11214 <p>Benutzer
11215 </p>
11216 !! end
11217
11218 !! test
11219 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
11220 !! options
11221 language=de
11222 !! wikitext
11223 {{ns:3}}
11224 !! html
11225 <p>Benutzer Diskussion
11226 </p>
11227 !! end
11228
11229 !! test
11230 Urlencode
11231 !! wikitext
11232 {{urlencode:hi world?!}}
11233 {{urlencode:hi world?!|WIKI}}
11234 {{urlencode:hi world?!|PATH}}
11235 {{urlencode:hi world?!|QUERY}}
11236 !! html/php
11237 <p>hi+world%3F%21
11238 hi_world%3F!
11239 hi%20world%3F%21
11240 hi+world%3F%21
11241 </p>
11242 !! end
11243
11244 !! test
11245 Magic Word: prioritize type info over data-parsoid
11246 !! options
11247 parsoid=html2wt
11248 !! html/parsoid
11249 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
11250 !! wikitext
11251 __FORCETOC__
11252 !! end
11253
11254 !! test
11255 Magic Word: serialize on separate line (parsoid)
11256 !! options
11257 parsoid=wt2wt,html2wt
11258 !! wikitext
11259 foo
11260 __NOTOC__
11261 bar
11262 !! html/parsoid
11263 foo<meta property="mw:PageProp/notoc"/>bar
11264 !! end
11265
11266 !! test
11267 Magic Word: rt non-english wikis
11268 !! options
11269 parsoid=wt2wt
11270 language=de
11271 !! wikitext
11272 __NOEDITSECTION__
11273 !! html/parsoid
11274 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
11275 !! end
11276
11277 !!test
11278 __proto__ is treated as normal wikitext (T105997)
11279 !!wikitext
11280 __proto__
11281 !!html
11282 <p>__proto__
11283 </p>
11284 !!end
11285
11286 ###
11287 ### Magic links
11288 ###
11289 !! test
11290 Magic links: internal link to RFC (T2479)
11291 !! wikitext
11292 [[RFC 123]]
11293 !! html/php
11294 <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>
11295 </p>
11296 !! html/parsoid
11297 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
11298 !! end
11299
11300 !! test
11301 Magic links: RFC (T2479)
11302 !! wikitext
11303 RFC 822
11304 !! html/php
11305 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11306 </p>
11307 !! html/parsoid
11308 <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external mw-magiclink">RFC 822</a></p>
11309 !! end
11310
11311 !! test
11312 Magic links: RFC (T67278)
11313 !! wikitext
11314 This is RFC 822 but thisRFC 822 is not RFC 822linked.
11315 !! html/php
11316 <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.
11317 </p>
11318 !! html/parsoid
11319 <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>
11320 !! end
11321
11322 !! test
11323 Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
11324 !! wikitext
11325 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
11326 RFC
11327 822
11328 !! html/php
11329 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
11330 RFC
11331 822
11332 </p>
11333 !! html/parsoid
11334 <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>
11335 RFC
11336 822</p>
11337 !! end
11338
11339 !! test
11340 Magic links: ISBN (T3937)
11341 !! wikitext
11342 ISBN 0-306-40615-2
11343 !! html/php
11344 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
11345 </p>
11346 !! html/parsoid
11347 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
11348 !! end
11349
11350 !! test
11351 Magic links: ISBN (T67278)
11352 !! wikitext
11353 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
11354 !! html/php
11355 <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.
11356 </p>
11357 !! html/parsoid
11358 <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>
11359 !! end
11360
11361 !! test
11362 Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
11363 !! wikitext
11364 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
11365 ISBN
11366 9780316098113
11367 ISBN 978
11368 0316098113
11369 !! html/php
11370 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
11371 ISBN
11372 9780316098113
11373 ISBN 978
11374 0316098113
11375 </p>
11376 !! html/parsoid
11377 <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>
11378 ISBN
11379 9780316098113
11380 ISBN 978
11381 0316098113</p>
11382 !! end
11383
11384 !! test
11385 Magic links: PMID incorrectly converts space to underscore
11386 !! wikitext
11387 PMID 1234
11388 !! html/php
11389 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11390 </p>
11391 !! html/parsoid
11392 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external mw-magiclink">PMID 1234</a></p>
11393 !! end
11394
11395 !! test
11396 Magic links: PMID (T67278)
11397 !! wikitext
11398 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
11399 !! html/php
11400 <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.
11401 </p>
11402 !! html/parsoid
11403 <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>
11404 !! end
11405
11406 !! test
11407 Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
11408 !! wikitext
11409 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
11410 PMID
11411 1234
11412 !! html/php
11413 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
11414 PMID
11415 1234
11416 </p>
11417 !! html/parsoid
11418 <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>
11419 PMID
11420 1234</p>
11421 !! end
11422
11423 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
11424 # since these are ExtLinkText, not MagicLinkText
11425 !! test
11426 Magic links: use appropriate serialization for "almost" magic links.
11427 !! wikitext
11428 X[[Special:BookSources/0978739256|foo]]
11429
11430 X[https://tools.ietf.org/html/rfc1234 foo]
11431 !! html/php
11432 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
11433 </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
11434 </p>
11435 !! html/parsoid
11436 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
11437 <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
11438 !! end
11439
11440 !! test
11441 Magic links: All disabled (T47942)
11442 !! options
11443 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
11444 !! wikitext
11445 ISBN 0-306-40615-2
11446 PMID 1234
11447 RFC 4321
11448 !! html/php
11449 <p>ISBN 0-306-40615-2
11450 PMID 1234
11451 RFC 4321
11452 </p>
11453 !! end
11454
11455 ###
11456 ### Templates
11457 ####
11458
11459 !! test
11460 Nonexistent template
11461 !! wikitext
11462 {{thistemplatedoesnotexist}}
11463 !! html
11464 <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>
11465 </p>
11466 !! end
11467
11468 !! test
11469 Template with invalid target containing tags
11470 !! wikitext
11471 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11472 !! html
11473 <p>{{a<b>b</b>|foo|a=b|a = b}}
11474 </p>
11475 !! end
11476
11477 !! test
11478 Template with invalid target containing unclosed tag
11479 !! wikitext
11480 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
11481 !! html
11482 <p>{{a<b>|foo|a=b|a = b}}</b>
11483 </p>
11484 !! end
11485
11486 !! test
11487 Template with invalid target containing wikilink
11488 !! wikitext
11489 {{[[Main Page]]}}
11490 !! html/php
11491 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
11492 </p>
11493 !! html/parsoid
11494 <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>
11495 !! end
11496
11497 !! test
11498 Template with just whitespace in it, T70421
11499 !! wikitext
11500 {{echo|{{ }}}}
11501 !! html/parsoid
11502 <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>
11503 !! end
11504
11505 !! article
11506 Template:test
11507 !! text
11508 This is a test template
11509 !! endarticle
11510
11511 !! test
11512 Simple template
11513 !! wikitext
11514 {{test}}
11515 !! html
11516 <p>This is a test template
11517 </p>
11518 !! end
11519
11520 !! test
11521 Template with explicit namespace
11522 !! wikitext
11523 {{Template:test}}
11524 !! html
11525 <p>This is a test template
11526 </p>
11527 !! end
11528
11529
11530 !! article
11531 Template:paramtest
11532 !! text
11533 This is a test template with parameter {{{param}}}
11534 !! endarticle
11535
11536 !! test
11537 Template parameter
11538 !! wikitext
11539 {{paramtest|param=foo}}
11540 !! html
11541 <p>This is a test template with parameter foo
11542 </p>
11543 !! end
11544
11545 !! article
11546 Template:paramtestnum
11547 !! text
11548 [[{{{1}}}|{{{2}}}]]
11549 !! endarticle
11550
11551 !! test
11552 Template unnamed parameter
11553 !! wikitext
11554 {{paramtestnum|Main Page|the main page}}
11555 !! html
11556 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
11557 </p>
11558 !! end
11559
11560 !! article
11561 Template:templatesimple
11562 !! text
11563 (test)
11564 !! endarticle
11565
11566 !! article
11567 Template:templateredirect
11568 !! text
11569 #redirect [[Template:templatesimple]]
11570 !! endarticle
11571
11572 !! article
11573 Template:templateasargtestnum
11574 !! text
11575 {{{{{1}}}}}
11576 !! endarticle
11577
11578 !! article
11579 Template:templateasargtest
11580 !! text
11581 {{template{{{templ}}}}}
11582 !! endarticle
11583
11584 !! article
11585 Template:templateasargtest2
11586 !! text
11587 {{{{{templ}}}}}
11588 !! endarticle
11589
11590 !! test
11591 Template with template name as unnamed argument
11592 !! wikitext
11593 {{templateasargtestnum|templatesimple}}
11594 !! html
11595 <p>(test)
11596 </p>
11597 !! end
11598
11599 !! test
11600 Template with template name as argument
11601 !! wikitext
11602 {{templateasargtest|templ=simple}}
11603 !! html
11604 <p>(test)
11605 </p>
11606 !! end
11607
11608 !! test
11609 Template with template name as argument (2)
11610 !! wikitext
11611 {{templateasargtest2|templ=templatesimple}}
11612 !! html
11613 <p>(test)
11614 </p>
11615 !! end
11616
11617 !! article
11618 Template:templateasargtestdefault
11619 !! text
11620 {{{{{templ|templatesimple}}}}}
11621 !! endarticle
11622
11623 !! article
11624 Template:templa
11625 !! text
11626 '''templ'''
11627 !! endarticle
11628
11629 !! test
11630 Template with default value
11631 !! wikitext
11632 {{templateasargtestdefault}}
11633 !! html
11634 <p>(test)
11635 </p>
11636 !! end
11637
11638 !! test
11639 Template with default value (value set)
11640 !! wikitext
11641 {{templateasargtestdefault|templ=templa}}
11642 !! html
11643 <p><b>templ</b>
11644 </p>
11645 !! end
11646
11647 !! test
11648 Template redirect
11649 !! wikitext
11650 {{templateredirect}}
11651 !! html/php
11652 <p>(test)
11653 </p>
11654 !! html/parsoid
11655 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
11656 !! end
11657
11658 !! test
11659 Template with argument in separate line
11660 !! wikitext
11661 {{ templateasargtest |
11662 templ = simple }}
11663 !! html
11664 <p>(test)
11665 </p>
11666 !! end
11667
11668 !! test
11669 Template with complex template as argument
11670 !! wikitext
11671 {{paramtest|
11672 param ={{ templateasargtest |
11673 templ = simple }}}}
11674 !! html
11675 <p>This is a test template with parameter (test)
11676 </p>
11677 !! end
11678
11679 !! test
11680 Templates with templated name
11681 !! wikitext
11682 {{{{echo|echo}}|foo}}
11683 {{{{echo|inner list}} }}
11684 !! html
11685 <p>foo
11686 </p>
11687 <ul><li>item 1</li></ul>
11688 !! html/parsoid
11689 <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>
11690 <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>
11691 !! end
11692
11693 ## Regression test; the output here isn't really that interesting.
11694 !! test
11695 Templates with templated name and top level template args
11696 !! wikitext
11697 {{1{{2{{{3}}}|4=5}}}}
11698 !! html/parsoid
11699 <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>
11700 !! end
11701
11702 # Parsoid markup is deliberate "broken". This is an edge case.
11703 # See long comment in TemplateHandler.js:convertAttribsToString.
11704 !! test
11705 Templates with invalid templated targets
11706 !! wikitext
11707 {{echo
11708 {{echo|foo}}
11709 }}
11710 !! html/php
11711 <p>{{echo
11712 foo
11713 }}
11714 </p>
11715 !! html/parsoid
11716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
11717 foo }}</p>
11718 !! end
11719
11720 !! test
11721 Template with thumb image (with link in description)
11722 !! wikitext
11723 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
11724 !! html/php
11725 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>
11726 !! html+tidy
11727 <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>
11728 !! html/parsoid
11729 <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>
11730 !! end
11731
11732 !! article
11733 Template:complextemplate
11734 !! text
11735 {{{1}}} {{paramtest|
11736 param ={{{param}}}}}
11737 !! endarticle
11738
11739 !! test
11740 Template with complex arguments
11741 !! wikitext
11742 {{complextemplate|
11743 param ={{ templateasargtest |
11744 templ = simple }}|[[Template:complextemplate|link]]}}
11745 !! html
11746 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
11747 </p>
11748 !! end
11749
11750 !! test
11751 T2553: link with two variables in a piped link
11752 !! wikitext
11753 {|
11754 |[[{{{1}}}|{{{2}}}]]
11755 |}
11756 !! html/php
11757 <table>
11758 <tr>
11759 <td>[[{{{1}}}|{{{2}}}]]
11760 </td></tr></table>
11761 !! html/parsoid
11762 <table>
11763 <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>
11764 </tbody></table>
11765 !! end
11766
11767 # See: T2553
11768 !! test
11769 Abort table cell attribute parsing on wikilink
11770 !! wikitext
11771 {|
11772 |testing [[one|two]] |three||four
11773 |testing one two |three||four
11774 |testing="[[one|two]]" |three||four
11775 |}
11776 !! html/php
11777 <table>
11778 <tr>
11779 <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>
11780 <td>four
11781 </td>
11782 <td>three</td>
11783 <td>four
11784 </td>
11785 <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>
11786 <td>four
11787 </td></tr></table>
11788 !! html/parsoid
11789 <table>
11790 <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>
11791 <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>
11792 <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>
11793 </tbody></table>
11794 !! end
11795
11796 !! test
11797 Don't abort table cell attribute parsing if wikilink is found in template arg
11798 !! wikitext
11799 {|
11800 |Test {{#tag:ref|One two "[[three]]" four}}
11801 |}
11802 !! html/parsoid
11803 <table>
11804 <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>
11805 </tbody></table>
11806 !! end
11807
11808 !! test
11809 Magic variable as template parameter
11810 !! wikitext
11811 {{paramtest|param={{SITENAME}}}}
11812 !! html
11813 <p>This is a test template with parameter MediaWiki
11814 </p>
11815 !! end
11816
11817 !! article
11818 Template:linktest
11819 !! text
11820 [[{{{param}}}|link]]
11821 !! endarticle
11822
11823 !! test
11824 Template parameter as link source
11825 !! wikitext
11826 {{linktest|param=Main Page}}
11827 !! html
11828 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11829 </p>
11830 !! end
11831
11832 !!article
11833 Template:paramtest2
11834 !! text
11835 including another template, {{paramtest|param={{{arg}}}}}
11836 !! endarticle
11837
11838 !! test
11839 Template passing argument to another template
11840 !! wikitext
11841 {{paramtest2|arg='hmm'}}
11842 !! html
11843 <p>including another template, This is a test template with parameter 'hmm'
11844 </p>
11845 !! end
11846
11847 !! article
11848 Template:Linktest2
11849 !! text
11850 Main Page
11851 !! endarticle
11852
11853 !! test
11854 Template as link source
11855 !! wikitext
11856 [[{{linktest2}}]]
11857
11858 [[{{linktest2}}|Main Page]]
11859
11860 [[{{linktest2}}]]Page
11861 !! html
11862 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11863 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11864 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11865 </p>
11866 !! end
11867
11868
11869 !! article
11870 Template:loop1
11871 !! text
11872 {{loop2}}
11873 !! endarticle
11874
11875 !! article
11876 Template:loop2
11877 !! text
11878 {{loop1}}
11879 !! endarticle
11880
11881 !! test
11882 Template infinite loop
11883 !! wikitext
11884 {{loop1}}
11885 !! html
11886 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11887 </p>
11888 !! end
11889
11890 !! test
11891 Template from main namespace
11892 !! wikitext
11893 {{:Main Page}}
11894 !! html
11895 <p>blah blah
11896 </p>
11897 !! end
11898
11899 !! test
11900 Template from non-includable namespace
11901 !! options
11902 wgNonincludableNamespaces=10
11903 !! wikitext
11904 {{echo|uh oh!}}
11905 !! html
11906 <p><a href="/wiki/Template:Echo" title="Template:Echo">Template:Echo</a>
11907 </p>
11908 !! end
11909
11910 !! article
11911 Template:table
11912 !! text
11913 {|
11914 | 1 || 2
11915 |-
11916 | 3 || 4
11917 |}
11918 !! endarticle
11919
11920 !! test
11921 T2529: Template with table, not included at beginning of line
11922 !! wikitext
11923 foo {{table}}
11924 !! html
11925 <p>foo
11926 </p>
11927 <table>
11928 <tr>
11929 <td>1</td>
11930 <td>2
11931 </td></tr>
11932 <tr>
11933 <td>3</td>
11934 <td>4
11935 </td></tr></table>
11936 !! end
11937
11938 !! test
11939 T2523: Template shouldn't eat newline (or add an extra one before table)
11940 !! wikitext
11941 foo
11942 {{table}}
11943 !! html
11944 <p>foo
11945 </p>
11946 <table>
11947 <tr>
11948 <td>1</td>
11949 <td>2
11950 </td></tr>
11951 <tr>
11952 <td>3</td>
11953 <td>4
11954 </td></tr></table>
11955 !! end
11956
11957 !! test
11958 T2041: Template parameters shown as broken links
11959 !! wikitext
11960 {{{parameter}}}
11961 !! html
11962 <p>{{{parameter}}}
11963 </p>
11964 !! end
11965
11966 !! test
11967 Template with targets containing wikilinks
11968 !! options
11969 parsoid=wt2html
11970 !! wikitext
11971 {{[[foo]]}}
11972
11973 {{[[{{echo|foo}}]]}}
11974
11975 {{{{echo|[[foo}}]]}}
11976 !! html/php
11977 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11978 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11979 </p><p>{{[[foo}}]]
11980 </p>
11981 !! html/parsoid
11982 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
11983 <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>
11984 <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
11985 !! end
11986
11987 !! article
11988 Template:''
11989 !! text
11990 bar
11991 !! endarticle
11992
11993 !! test
11994 Templates: Double quotes as template target
11995 !! wikitext
11996 foo {{''}} baz
11997 !! html/php
11998 <p>foo bar baz
11999 </p>
12000 !! html/parsoid
12001 <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
12002 </p>
12003 !! end
12004
12005 ## This test is about making sure Parsoid's data-mw is well formed in the
12006 ## face of multiple templates with intersecting and overlapping ranges. The
12007 ## wikitext itself is wretched.
12008 !! test
12009 Templates with intersecting and overlapping ranges
12010 !! wikitext
12011 {|{{echo|
12012 <p>ha</p>}}
12013 {|{{echo|
12014 <p>ho</p>}}
12015 {{echo|{{!}}hi}}
12016 |}
12017 !! html/php+tidy
12018 <p>ha</p><table>
12019
12020 </table><p>ho</p><table>
12021
12022 <tbody><tr>
12023 <td>hi
12024 </td></tr></tbody></table>
12025 !! html/parsoid
12026 <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":""}]]}'>
12027
12028 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
12029
12030 <tbody><tr><td>hi</td></tr>
12031 </tbody></table>
12032 !! end
12033
12034 !! article
12035 Template:MSGNW test
12036 !! text
12037 ''None'' of '''this''' should be
12038 * interpreted
12039 but rather passed unmodified
12040 {{test}}
12041 <gallery>
12042 File:Foobar.jpg
12043 </gallery>
12044 <!-- comment -->
12045 !! endarticle
12046
12047 # hmm, fix this or just deprecate msgnw and document its behavior?
12048 !! test
12049 msgnw keyword
12050 !! wikitext
12051 {{msgnw:MSGNW test}}
12052 !! html/php
12053 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
12054 &#42; interpreted
12055 &#32;but rather passed unmodified
12056 &#123;&#123;test&#125;&#125;
12057 &#60;gallery&#62;
12058 File:Foobar.jpg
12059 &#60;/gallery&#62;
12060 &#60;!-- comment --&#62;
12061 </p>
12062 !! end
12063
12064 !! test
12065 int keyword
12066 !! wikitext
12067 {{int:youhavenewmessages|lots of money|not!}}
12068 !! html
12069 <p>You have lots of money (not!).
12070 </p>
12071 !! end
12072
12073 !! test
12074 int keyword - non-existing message
12075 !! wikitext
12076 {{int:var}}
12077 !! html
12078 <p>⧼var⧽
12079 </p>
12080 !! end
12081
12082 !! article
12083 Template:Includes
12084 !! text
12085 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12086 !! endarticle
12087
12088 !! test
12089 <includeonly> and <noinclude> being included
12090 !! wikitext
12091 {{Includes}}
12092 !! html
12093 <p>Foobar
12094 </p>
12095 !! end
12096
12097 !! article
12098 Template:Includes2
12099 !! text
12100 <onlyinclude>Foo</onlyinclude>bar
12101 !! endarticle
12102
12103 !! test
12104 <onlyinclude> being included
12105 !! wikitext
12106 {{Includes2}}
12107 !! html
12108 <p>Foo
12109 </p>
12110 !! end
12111
12112
12113 !! article
12114 Template:Includes3
12115 !! text
12116 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
12117 !! endarticle
12118
12119 !! test
12120 <onlyinclude> and <includeonly> being included
12121 !! wikitext
12122 {{Includes3}}
12123 !! html
12124 <p>Foo
12125 </p>
12126 !! end
12127
12128 # FIXME: Parsoid's markup for this is quite ugly.
12129 !! test
12130 <includeonly> and <noinclude> on a page
12131 !! wikitext
12132 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
12133 !! html/php+tidy
12134 <p>Foozar
12135 </p>
12136 !! html/parsoid
12137 <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="{}"/>
12138 !! end
12139
12140 !! test
12141 Un-closed <noinclude>
12142 !! wikitext
12143 <noinclude>
12144 !! html
12145 !! end
12146
12147 !! test
12148 <onlyinclude> on a page
12149 !! wikitext
12150 <onlyinclude>Foo</onlyinclude>bar
12151 !! html
12152 <p>Foobar
12153 </p>
12154 !! end
12155
12156 !! test
12157 Un-closed <onlyinclude>
12158 !! wikitext
12159 <onlyinclude>
12160 !! html
12161 !! end
12162
12163 !!test
12164 Self-closed noinclude, includeonly, onlyinclude tags
12165 !! wikitext
12166 <noinclude />
12167 <includeonly />
12168 <onlyinclude />
12169 !! html
12170 <p><br />
12171 </p>
12172 !!end
12173
12174 !!test
12175 Unbalanced includeonly and noinclude tags
12176 !! wikitext
12177 {|
12178 |a</noinclude>
12179 |b</noinclude></noinclude>
12180 |c</noinclude></includeonly>
12181 |d</includeonly></includeonly>
12182 |}
12183 !! html
12184 <table>
12185 <tr>
12186 <td>a
12187 </td>
12188 <td>b
12189 </td>
12190 <td>c&lt;/includeonly&gt;
12191 </td>
12192 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
12193 </td></tr></table>
12194 !!end
12195
12196 !! article
12197 Template:Includeonly section
12198 !! text
12199 <includeonly>
12200 ==Includeonly section==
12201 </includeonly>
12202 ==Section T-1==
12203 !!endarticle
12204
12205 !! test
12206 T8563: Edit link generation for section shown by <includeonly>
12207 !! wikitext
12208 {{includeonly section}}
12209 !! html
12210 <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>
12211 <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>
12212 !! end
12213
12214 # Uses same input as the contents of [[Template:Includeonly section]]
12215 !! test
12216 T8563: Section extraction for section shown by <includeonly>
12217 !! options
12218 section=T-2
12219 !! wikitext
12220 <includeonly>
12221 ==Includeonly section==
12222 </includeonly>
12223 ==Section T-2==
12224 !! html
12225 ==Section T-2==
12226 !! end
12227
12228 !! test
12229 T8563: Edit link generation for section suppressed by <includeonly>
12230 !! wikitext
12231 <includeonly>
12232 ==Includeonly section==
12233 </includeonly>
12234 ==Section 1==
12235 !! html
12236 <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>
12237 !! end
12238
12239 !! test
12240 T8563: Section extraction for section suppressed by <includeonly>
12241 !! options
12242 section=1
12243 !! wikitext
12244 <includeonly>
12245 ==Includeonly section==
12246 </includeonly>
12247 ==Section 1==
12248 !! html
12249 ==Section 1==
12250 !! end
12251
12252 !! test
12253 Un-closed <includeonly>
12254 !! wikitext
12255 <includeonly>
12256 !! html/php
12257 !! html/parsoid
12258 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}' data-mw='{"src":"&lt;includeonly>"}'/>
12259 !! end
12260
12261 ## We used to, but no longer wt2wt this test since the default serializer
12262 ## will normalize the include directives to serialize on their own line.
12263 ## Selser will take care of preserving formatting in scenarios where they
12264 ## intermingled with other wikitext.
12265 !! test
12266 Includes and comments at SOL
12267 !! options
12268 parsoid=wt2html,html2html
12269 !! wikitext
12270 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
12271
12272 <noinclude>
12273 some
12274 </noinclude>*stuff
12275 *here
12276
12277 <noinclude>
12278 some</noinclude>* stuff
12279 * here
12280
12281 <includeonly>can have stuff</includeonly>===here===
12282
12283 !! html/php
12284 <h2><span class="mw-headline" id="hu">hu</span></h2>
12285 <p>some
12286 </p>
12287 <ul><li>stuff</li>
12288 <li>here</li></ul>
12289 <p><br />
12290 some* stuff
12291 </p>
12292 <ul><li>here</li></ul>
12293 <h3><span class="mw-headline" id="here">here</span></h3>
12294 !! html/parsoid
12295 <!-- 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>
12296
12297 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12298 <p>some</p>
12299 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
12300 <li>here</li></ul>
12301
12302 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
12303 <p>some<meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/>* stuff</p>
12304 <ul><li>here</li></ul>
12305
12306 <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>
12307 !! end
12308
12309 # TODO: test with DOM fragment reuse!
12310 !! test
12311 Parsoid: DOM fragment reuse
12312 !! options
12313 parsoid=wt2wt,wt2html
12314 !! wikitext
12315 a{{echo|b<table></table>c}}d
12316
12317 a{{echo|b
12318 <table></table>
12319 c}}d
12320
12321 {{echo|a
12322
12323 <table></table>
12324
12325 b}}
12326 !! html/php+tidy
12327 <p>ab</p><table></table><p>cd
12328 </p><p>ab
12329 </p>
12330 <table></table>
12331 <p>cd
12332 </p><p>a
12333 </p>
12334 <table></table>
12335 <p>b
12336 </p>
12337 !! html/parsoid
12338 <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>
12339
12340 <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">
12341 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
12342 </span><p about="#mwt2">cd</p>
12343
12344 <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">
12345
12346 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
12347
12348 </span><p about="#mwt3">b</p>
12349 !! end
12350
12351 !! test
12352 Parsoid: Merge double tds (T52603)
12353 !! wikitext
12354 {|
12355 |{{echo|{{!}} foo}}
12356 |}
12357 !! html/php+tidy
12358 <table>
12359 <tbody><tr>
12360 <td>foo
12361 </td></tr></tbody></table>
12362 !! html/parsoid
12363 <table><tbody>
12364 <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>
12365 </tbody></table>
12366 !! end
12367
12368 !! test
12369 Parsoid: Merge double tds in nested transclusion content (T52603)
12370 !! wikitext
12371 {{echo|<div>}}
12372 {|
12373 |{{echo|{{!}} foo}}
12374 |}
12375 {{echo|</div>}}
12376 !! html/php+tidy
12377 <div>
12378 <table>
12379 <tbody><tr>
12380 <td>foo
12381 </td></tr></tbody></table>
12382 </div>
12383 !! html/parsoid
12384 <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}}]}'>
12385 <table><tbody>
12386 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
12387 </tbody></table>
12388 </div>
12389 !! end
12390
12391 ###
12392 ### <includeonly> and <noinclude> in attributes
12393 ###
12394 !!test
12395 0. includeonly around the entire attribute
12396 !! wikitext
12397 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
12398 !! html
12399 <p><span id="v2">bar</span>
12400 </p>
12401 !!end
12402
12403 !!test
12404 1. includeonly in html attr key
12405 !! wikitext
12406 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
12407 !! html
12408 <p><span id="foo">bar</span>
12409 </p>
12410 !!end
12411
12412 !!test
12413 2. includeonly in html attr value
12414 !! wikitext
12415 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
12416 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
12417 !! html
12418 <p><span id="v1">bar</span>
12419 <span id="v1">bar</span>
12420 </p>
12421 !!end
12422
12423 !!test
12424 3. includeonly in part of an attr value
12425 !! wikitext
12426 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
12427 !! html
12428 <p><span style="color:red;">bar</span>
12429 </p>
12430 !!end
12431
12432 !!test
12433 4. includeonly in table attributes
12434 !! wikitext
12435 {|
12436 |- <noinclude>
12437 |-
12438 |a
12439 </noinclude>
12440 |- <includeonly>
12441 |-
12442 |b
12443 </includeonly>
12444 |}
12445 !! html
12446 <table>
12447
12448
12449 <tr>
12450 <td>a
12451 </td></tr>
12452 </table>
12453 !!end
12454
12455 ###
12456 ### Preprocessor precedence tests
12457 ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
12458 ###
12459 ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
12460 !! test
12461 Preprocessor precedence 1: link is rightmost opening
12462 !! options
12463 parsoid=wt2html
12464 !! wikitext
12465 {{[[Foo|bar}}]]
12466
12467 But close-brace is not a valid character in a link title:
12468 {{[[Foo}}|bar]]
12469
12470 However, we can still tell this was handled as a link in the preprocessor:
12471 {{echo|[[Foo}}|bar]]|bat}}
12472 !! html/php
12473 <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
12474 </p><p>But close-brace is not a valid character in a link title:
12475 {{[[Foo}}|bar]]
12476 </p><p>However, we can still tell this was handled as a link in the preprocessor:
12477 [[Foo}}|bar]]
12478 </p>
12479 !! html/parsoid
12480 <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
12481 <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
12482 <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>
12483 !! end
12484
12485 !! test
12486 Preprocessor precedence 2: template is rightmost opening
12487 !! options
12488 language=zh
12489 !! wikitext
12490 -{{echo|foo}-}}-
12491 !! html/php
12492 <p>-foo}--
12493 </p>
12494 !! html/parsoid
12495 <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
12496 !! end
12497
12498 !! test
12499 Preprocessor precedence 3: language converter is rightmost opening
12500 !! options
12501 language=zh
12502 parsoid=wt2html
12503 !! wikitext
12504 {{echo|hi}}
12505
12506 {{-{R|echo|hi}}}-
12507
12508 [[-{R|raw]]}-
12509 !! html/php
12510 <p>hi
12511 </p><p>{{echo|hi}}
12512 </p><p>[[raw]]
12513 </p>
12514 !! html/parsoid
12515 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
12516 <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
12517 <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
12518 !! end
12519
12520 !! test
12521 Preprocessor precedence 4: left-most angle bracket
12522 !! options
12523 language=zh
12524 !! wikitext
12525 <!--{raw}-->
12526 !! html/php
12527 !! html/parsoid
12528 <!--{raw}-->
12529 !! end
12530
12531 !! article
12532 Template:Precedence5
12533 !! text
12534 {{{{{1}}}}}
12535 !! endarticle
12536
12537 !! test
12538 Preprocessor precedence 5: tplarg takes precedence over template
12539 !! wikitext
12540 {{Precedence5|Bullet}}
12541 !! html/php
12542 <ul><li>Bar</li></ul>
12543 !! html/parsoid
12544 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
12545 !! end
12546
12547 !! test
12548 Preprocessor precedence 6: broken link is rightmost opening
12549 !! options
12550 parsoid=wt2html
12551 !! wikitext
12552 {{echo|[[Foo}}
12553
12554 {{echo|[[Foo|bar|bat=baz}}
12555 !! html/php
12556 <p>{{echo|[[Foo}}
12557 </p><p>{{echo|[[Foo|bar|bat=baz}}
12558 </p>
12559 !! html/parsoid
12560 <p>{{echo|[[Foo}}</p>
12561 <p>{{echo|[[Foo|bar|bat=baz}}</p>
12562 !! end
12563
12564 # This next test exposes a difference between PHP and Parsoid:
12565 # Given [[Foo|{{echo|Bar]]x}}y]]z:
12566 # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
12567 # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
12568 # outer `[[Foo` extends until the `y]]`
12569 # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
12570 # intermediate result (after template expansion), and link processing
12571 # happens on this intermediate result, which moves the wikilink
12572 # boundary leftward to `[[Foo|Bar]]`
12573 # 2b) Parsoid works in a single step, so it's going to keep the
12574 # wikilink as extending to the `y]]`
12575 # 3a) Then PHP does linktrail processing which slurps up the trailing
12576 # `xy` inside the link.
12577 # 3b) Parsoid will do linktrail processing to slurp up the trailing
12578 # `z` inside the link.
12579 # This is "correct" behavior. Parsoid's basic worldview is that the
12580 # `]]` inside the template shouldn't be allowed to leak out to affect
12581 # the surrounding wikilink. PHP may match Parsoid (in the future)
12582 # if you use {{#balance}} (T114445).
12583
12584 !! test
12585 Preprocessor precedence 7: broken template is rightmost opening
12586 !! options
12587 parsoid=wt2html
12588 !! wikitext
12589 [[Foo|{{echo|Bar]]
12590
12591 [[Foo|{{echo|Bar]]-x}}-y]]-z
12592
12593 Careful: linktrails can move the end of the wikilink:
12594 [[Foo|{{echo|y']]a}}l]]l
12595 !! html/php
12596 <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
12597 </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
12598 </p><p>Careful: linktrails can move the end of the wikilink:
12599 <a href="/wiki/Foo" title="Foo">y'al</a>]]l
12600 </p>
12601 !! html/parsoid
12602 <p>[[Foo|{{echo|Bar]]</p>
12603 <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>
12604 <p>Careful: linktrails can move the end of the wikilink:
12605 <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>
12606 !! end
12607
12608 !! test
12609 Preprocessor precedence 8: broken language converter is rightmost opening
12610 !! options
12611 language=zh
12612 !! wikitext
12613 [[Foo-{R|raw]]
12614 !! html
12615 <p>[[Foo-{R|raw]]
12616 </p>
12617 !! end
12618
12619 !! article
12620 Template:Preprocessor_precedence_9
12621 !! text
12622 ;4: {{{{1}}}}
12623 ;5: {{{{{2}}}}}
12624 ;6: {{{{{{3}}}}}}
12625 ;7: {{{{{{{4}}}}}}}
12626 !! endarticle
12627
12628 !! test
12629 Preprocessor precedence 9: groups of braces
12630 !! wikitext
12631 {{Preprocessor precedence 9|Four|Bullet|1|2}}
12632 !! html/php
12633 <dl><dt>4</dt>
12634 <dd>{Four}</dd>
12635 <dt>5</dt>
12636 <dd></dd></dl>
12637 <ul><li>Bar</li></ul>
12638 <dl><dt>6</dt>
12639 <dd>Four</dd>
12640 <dt>7</dt>
12641 <dd>{Bullet}</dd></dl>
12642 !! html/parsoid
12643 <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}}]}'>
12644 <dt>4</dt>
12645 <dd>{Four}</dd>
12646 <dt>5</dt>
12647 <dd></dd>
12648 </dl><ul about="#mwt1">
12649 <li>Bar</li>
12650 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12651 <dt>6</dt>
12652 <dd>Four</dd>
12653 <dt>7</dt>
12654 <dd>{Bullet}</dd>
12655 </dl>
12656 !! end
12657
12658 !! article
12659 Template:Preprocessor_precedence_10
12660 !! text
12661 ;1: -{R|raw}-
12662 ;2: -{{Bullet}}-
12663 ;3: -{{{1}}}-
12664 ;4: -{{{{2}}}}-
12665 ;5: -{{{{{3}}}}}-
12666 ;6: -{{{{{{4}}}}}}-
12667 ;7: -{{{{{{{5}}}}}}}-
12668 !! endarticle
12669
12670 !! test
12671 Preprocessor precedence 10: groups of braces with leading dash
12672 !! options
12673 language=zh
12674 !! wikitext
12675 {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
12676 !! html/php
12677 <dl><dt>1</dt>
12678 <dd>raw</dd>
12679 <dt>2</dt>
12680 <dd>-</dd></dl>
12681 <ul><li>Bar-</li></ul>
12682 <dl><dt>3</dt>
12683 <dd>-Three-</dd>
12684 <dt>4</dt>
12685 <dd>raw2</dd>
12686 <dt>5</dt>
12687 <dd>-</dd></dl>
12688 <ul><li>Bar-</li></ul>
12689 <dl><dt>6</dt>
12690 <dd>-Three-</dd>
12691 <dt>7</dt>
12692 <dd>raw2</dd></dl>
12693 !! html/parsoid
12694 <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}}]}'>
12695 <dt>1</dt>
12696 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
12697 <dt>2</dt>
12698 <dd>-</dd>
12699 </dl><ul about="#mwt1">
12700 <li>Bar-</li>
12701 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12702 <dt>3</dt>
12703 <dd>-Three-</dd>
12704 <dt>4</dt>
12705 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12706 <dt>5</dt>
12707 <dd>-</dd>
12708 </dl><ul about="#mwt1">
12709 <li>Bar-</li>
12710 </ul><span about="#mwt1"> </span><dl about="#mwt1">
12711 <dt>6</dt>
12712 <dd>-Three-</dd>
12713 <dt>7</dt>
12714 <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
12715 </dl>
12716 !! end
12717
12718 !! test
12719 Preprocessor precedence 11: found during visual diff testing
12720 !! wikitext
12721 {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
12722
12723 {{echo|-{{echo|-{{echo|x}}}}}}
12724
12725 {{echo|-{{echo|x}}}}
12726 !! html/php
12727 <p><span>-<span>-x</span></span>
12728 </p><p>--x
12729 </p><p>-x
12730 </p>
12731 !! html/parsoid
12732 <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>
12733
12734 <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>
12735
12736 <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>
12737 !! end
12738
12739 !! test
12740 Preprocessor precedence 12: broken language converter closed by brace.
12741 !! options
12742 parsoid=wt2html
12743 !! wikitext
12744 This form breaks the template, which is unfortunate:
12745 *{{echo|foo-{bar}bat}}
12746
12747 But if the broken language converter markup is inside an extension
12748 tag, nothing bad happens:
12749 *<nowiki>foo-{bar}bat</nowiki>
12750 *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
12751 *<pre>foo-{bar}bat</pre>
12752 *{{echo|<pre>foo-{bar}bat</pre>}}
12753
12754 <tag>foo-{bar}bat</tag>
12755 {{echo|<tag>foo-{bar}bat</tag>}}
12756
12757 !! html/php+tidy
12758 <p>This form breaks the template, which is unfortunate:
12759 </p>
12760 <ul><li>{{echo|foo-{bar}bat}}</li></ul>
12761 <p>But if the broken language converter markup is inside an extension
12762 tag, nothing bad happens:
12763 </p>
12764 <ul><li>foo-&#123;bar}bat</li>
12765 <li>foo-&#123;bar}bat</li>
12766 <li><pre>foo-{bar}bat</pre></li>
12767 <li><pre>foo-{bar}bat</pre></li></ul>
12768 <pre>'foo-{bar}bat'
12769 array (
12770 )
12771 </pre>
12772 <pre>'foo-{bar}bat'
12773 array (
12774 )
12775 </pre>
12776 !! html/parsoid
12777 <p>This form breaks the template, which is unfortunate:</p>
12778 <ul>
12779 <li>{{echo|foo-{bar}bat}}</li>
12780 </ul>
12781 <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
12782 <ul>
12783 <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
12784 <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>
12785 <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
12786 <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>
12787 </ul>
12788 <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>
12789 !! end
12790
12791 !! test
12792 Preprocessor precedence 13: broken language converter in external link
12793 !! options
12794 parsoid=wt2html
12795 !! wikitext
12796 *[http://example.com/-{foo Example in URL]
12797 *[http://example.com Example in -{link} description]
12798 *{{echo|[http://example.com/-{foo Breaks template, however]}}
12799 !! html/php+tidy
12800 <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12801 <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
12802 <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
12803 !! html/parsoid
12804 <ul>
12805 <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
12806 <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
12807 <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
12808 </ul>
12809 !! end
12810
12811 !! test
12812 Preprocessor precedence 14: broken language converter in comment
12813 !! wikitext
12814 *<!--{{foo}}-->...should be ok
12815 *<!---{{foo}}-->...extra dashes
12816 *{{echo|foo<!-- -{bar} -->bat}}...should be ok
12817 !! html/php+tidy
12818 <ul><li>...should be ok</li>
12819 <li>...extra dashes</li>
12820 <li>foobat...should be ok</li></ul>
12821 !! html/parsoid
12822 <ul>
12823 <li><!--{{foo}}-->...should be ok</li>
12824 <li><!--&#x2D;{{foo}}-->...extra dashes</li>
12825 <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>
12826 </ul>
12827 !! end
12828
12829 !! test
12830 Preprocessor precedence 15: broken brace markup in headings
12831 !! config
12832 wgFragmentMode=[ 'html5', 'legacy' ]
12833 !! options
12834 parsoid=wt2html
12835 !! wikitext
12836 __NOTOC__ __NOEDITSECTION__
12837 ===1 foo[bar 1===
12838 1
12839 ===2 foo[[bar 2===
12840 2
12841 ===3 foo{bar 3===
12842 3
12843 ===4 foo{{bar 4===
12844 4
12845 ===5 foo{{{bar 5===
12846 5
12847 ===6 foo-{bar 6===
12848 6
12849 !! html/php+tidy
12850 <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
12851 <p>1
12852 </p>
12853 <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
12854 <p>2
12855 </p>
12856 <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
12857 <p>3
12858 </p>
12859 <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
12860 <p>4
12861 </p>
12862 <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>
12863 <p>5
12864 </p>
12865 <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
12866 <p>6
12867 </p>
12868 !! html/parsoid
12869 <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
12870 <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
12871 <p>1</p>
12872 <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
12873 <p>2</p>
12874 <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
12875 <p>3</p>
12876 <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
12877 <p>4</p>
12878 <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
12879 <p>5</p>
12880 <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
12881 <p>6</p>
12882 !! end
12883
12884 !! test
12885 Preprocessor precedence 16: matching closing braces to opening braces
12886 !! options
12887 language=zh
12888 parsoid=wt2html
12889 !! wikitext
12890 -{{{echo|foo}}bar}-
12891 !! html/php
12892 <p>foobar
12893 </p>
12894 !! html/parsoid
12895 <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>
12896 !! end
12897
12898 !! test
12899 Preprocessor precedence 17: template w/o target shouldn't prevent closing
12900 !! options
12901 parsoid=wt2html
12902 !! wikitext
12903 {{echo|hi {{}}}}
12904 !! html/php
12905 <p>hi {{}}
12906 </p>
12907 !! html/parsoid
12908 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
12909 !! end
12910
12911 # Ensure we're using a language without variants for this test; even
12912 # if $wgUsePigLatinVariant is true. We've picked `de` arbitrarily.
12913 !! test
12914 Preprocessor precedence 18: another rightmost wins scenario
12915 !! options
12916 parsoid=wt2html
12917 language=de
12918 !! wikitext
12919 {{ -{{{{1|tplarg}}} }} }-
12920 !! html/php
12921 <p>{{ -{tplarg }} }-
12922 </p>
12923 !! html/parsoid
12924 <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
12925 !! end
12926
12927 !! test
12928 Preprocessor precedence 19: break syntax
12929 !! options
12930 parsoid=wt2html
12931 !! wikitext
12932 -{{
12933 !! html/php
12934 <p>-{{
12935 </p>
12936 !! html/parsoid
12937 <p>-{{</p>
12938 !! end
12939
12940 ###
12941 ### Token Stream Patcher tests
12942 ###
12943 ### These tests won't always pass wt2wt and other modes because
12944 ### on serialization, the table will be output on a new line.
12945 ### For now, we are blacklisting them, and using this to test selser.
12946 ###
12947
12948 !!test
12949 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
12950 !!options
12951 parsoid=wt2html,wt2wt
12952 !!wikitext
12953 {{echo|}}{| width = '100%'
12954 |foo
12955 |}
12956 !!html/parsoid
12957 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
12958 <tbody><tr><td>foo</td></tr>
12959 </tbody></table>
12960 !!end
12961
12962 ## We used to, but no longer wt2wt this test since the default serializer
12963 ## will normalize the include directives to serialize on their own line.
12964 ## Selser will take care of preserving formatting in scenarios where they
12965 ## intermingled with other wikitext.
12966 !!test
12967 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
12968 !!options
12969 parsoid=wt2html
12970 !!wikitext
12971 <includeonly>a</includeonly>{| {{{b}}}
12972 |c
12973 |}
12974 !!html/parsoid
12975 <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":""}]]}'>
12976 <tbody><tr><td>c</td></tr>
12977 </tbody></table>
12978 !!end
12979
12980 !! test
12981 Table wikitext syntax outside wiki-tables
12982 !! wikitext
12983 a
12984 |+ not a caption
12985 ! not a table heading
12986 |- not a table row
12987 | not a table cell
12988 | class="foo bar" | baz
12989 b
12990 |}
12991 |-
12992 c
12993 !! html
12994 <p>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 </p>
13005 !! end
13006
13007 ###
13008 ### Testing parsing of templates where a template arg
13009 ### has the same name as the template itself.
13010 ###
13011
13012 !! article
13013 Template:quote
13014 !! text
13015 {{{quote|{{{1}}}}}}
13016 !! endarticle
13017
13018 !!test
13019 Templates: Template Name/Arg clash: 1. Use of positional param
13020 !! wikitext
13021 {{quote|foo}}
13022 !! html
13023 <p>foo
13024 </p>
13025 !!end
13026
13027 !!test
13028 Templates: Template Name/Arg clash: 2. Use of named param
13029 !! wikitext
13030 {{quote|quote=foo}}
13031 !! html
13032 <p>foo
13033 </p>
13034 !!end
13035
13036 !!test
13037 Templates: Template Name/Arg clash: 3. Use of named param with empty input
13038 !! wikitext
13039 {{quote|quote}}
13040 !! html
13041 <p>quote
13042 </p>
13043 !!end
13044
13045 ###
13046 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
13047 ###
13048
13049 !!test
13050 Templates: 1. Simple use
13051 !! wikitext
13052 {{echo|Foo}}
13053 !! html
13054 <p>Foo
13055 </p>
13056 !!end
13057
13058 !!test
13059 Templates: 2. Inside a block tag
13060 !! wikitext
13061 <div>{{echo|Foo}}</div>
13062 <blockquote>{{echo|Foo}}</blockquote>
13063 !! html
13064 <div>Foo</div>
13065 <blockquote>Foo</blockquote>
13066 !! html+tidy
13067 <div>Foo</div>
13068 <blockquote><p>Foo</p></blockquote>
13069 !!end
13070
13071 !!test
13072 Templates: P-wrapping: 1a. Templates on consecutive lines
13073 !! wikitext
13074 {{echo|Foo}}
13075 {{echo|bar}}
13076 !! html
13077 <p>Foo
13078 bar
13079 </p>
13080 !!end
13081
13082 !!test
13083 Templates: P-wrapping: 1b. Templates on consecutive lines
13084 !! wikitext
13085 Foo
13086
13087 {{echo|bar}}
13088 {{echo|baz}}
13089 !! html
13090 <p>Foo
13091 </p><p>bar
13092 baz
13093 </p>
13094 !!end
13095
13096 !!test
13097 Templates: P-wrapping: 1c. Templates on consecutive lines
13098 !! wikitext
13099 {{echo|Foo}}
13100 {{echo|bar}} <div>baz</div>
13101 !! html
13102 <p>Foo
13103 </p>
13104 bar <div>baz</div>
13105 !! html+tidy
13106 <p>Foo
13107 </p><p>
13108 bar </p><div>baz</div>
13109 !! end
13110
13111 !! test
13112 Templates: P-wrapping: 1d. Template preceded by comment-only line
13113 !! wikitext
13114 <!-- foo -->
13115 {{echo|Bar}}
13116 !! html/php+tidy
13117 <p>Bar
13118 </p>
13119 !! html/parsoid
13120 <!-- foo -->
13121
13122 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
13123 !!end
13124
13125 !! test
13126 Templates: Scopes should not be expanded unnecessarily
13127 !! options
13128 parsoid=wt2html,wt2wt
13129 !! wikitext
13130 {{echo|<div>a</div>}}b{{echo|
13131 <div>c</div>}}
13132 !! html/php+tidy
13133 <div>a</div><p>b
13134 </p><div>c</div>
13135 !! html/parsoid
13136 <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}}]}'>
13137 </span><div about="#mwt2">c</div>
13138 !! end
13139
13140 !!test
13141 Templates: Inline Text: 1. Multiple template uses
13142 !! wikitext
13143 {{echo|Foo}}bar{{echo|baz}}
13144 !! html
13145 <p>Foobarbaz
13146 </p>
13147 !!end
13148
13149 !!test
13150 Templates: Inline Text: 2. Back-to-back template uses
13151 !! wikitext
13152 {{echo|Foo}}{{echo|bar}}
13153 !! html
13154 <p>Foobar
13155 </p>
13156 !!end
13157
13158 !!test
13159 Templates: Block Tags: 1. Multiple template uses
13160 !! wikitext
13161 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
13162 !! html
13163 <div>Foo</div><div>bar</div><div>baz</div>
13164 !!end
13165
13166 !!test
13167 Templates: Block Tags: 2. Back-to-back template uses
13168 !! wikitext
13169 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
13170 !! html
13171 <div>Foo</div><div>bar</div>
13172 !!end
13173
13174 ## Parsoid drops empty elements in templates.
13175 !! test
13176 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
13177 !! wikitext
13178 {{echo|a
13179 b</p>}}
13180 !! html/php+tidy
13181 <p>a
13182 </p><p>
13183 b</p><p class="mw-empty-elt"></p>
13184 !! html/parsoid
13185 <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">
13186 </span><p about="#mwt1">b</p>
13187 !! end
13188
13189 !!test
13190 Templates: Links: 1. Simple example
13191 !! wikitext
13192 {{echo|[[Foo|bar]]}}
13193 !! html
13194 <p><a href="/wiki/Foo" title="Foo">bar</a>
13195 </p>
13196 !!end
13197
13198 !!test
13199 Templates: Links: 2. Generation of link href
13200 !! wikitext
13201 [[{{echo|Foo}}|bar]]
13202 !! html
13203 <p><a href="/wiki/Foo" title="Foo">bar</a>
13204 </p>
13205 !!end
13206
13207 !!test
13208 Templates: Links: 3. Generation of part of a link href
13209 !! wikitext
13210 [[Fo{{echo|o}}|bar]]
13211
13212 [[Foo{{echo|bar}}]]
13213
13214 [[Foo{{echo|bar}}baz]]
13215
13216 [[Foo{{echo|bar}}|bar]]
13217
13218 [[:Foo{{echo|bar}}]]
13219
13220 [[:Foo{{echo|bar}}|bar]]
13221 !! html
13222 <p><a href="/wiki/Foo" title="Foo">bar</a>
13223 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13224 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
13225 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13226 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13227 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
13228 </p>
13229 !!end
13230
13231 !!test
13232 Templates: Links: 4. Multiple templates generating link href
13233 !! wikitext
13234 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
13235 !! html
13236 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
13237 </p>
13238 !!end
13239
13240 !!test
13241 Templates: Links: 5. Generation of link text
13242 !! wikitext
13243 [[Foo|{{echo|bar}}]]
13244 !! html
13245 <p><a href="/wiki/Foo" title="Foo">bar</a>
13246 </p>
13247 !!end
13248
13249 !!test
13250 Templates: Links: 5. Nested templates (only outermost template should be marked)
13251 !! wikitext
13252 {{echo|[[{{echo|Foo}}|bar]]}}
13253 !! html
13254 <p><a href="/wiki/Foo" title="Foo">bar</a>
13255 </p>
13256 !!end
13257
13258 !! test
13259 File with template filename
13260 !! wikitext
13261 [[File:{{echo|Foobar.jpg}}]]
13262 !! html/parsoid
13263 <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>
13264 !! end
13265
13266 !!test
13267 Templates: HTML Tag: 1. Generation of HTML attr. key
13268 !! wikitext
13269 <div {{echo|style}}="color:red;">foo</div>
13270 !! html
13271 <div style="color:red;">foo</div>
13272 !!end
13273
13274 !!test
13275 Templates: HTML Tag: 2. Generation of HTML attr. value
13276 !! wikitext
13277 <div style={{echo|'color:red;'}}>foo</div>
13278 !! html
13279 <div style="color:red;">foo</div>
13280 !!end
13281
13282 !!test
13283 Templates: HTML Tag: 3. Generation of HTML attr key and value
13284 !! wikitext
13285 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
13286 !! html
13287 <div style="color:red;">foo</div>
13288 !!end
13289
13290 !!test
13291 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
13292 !! wikitext
13293 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
13294 !! html
13295 <div title="This is a long title with just one piece templated">foo</div>
13296 !!end
13297
13298 !!test
13299 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
13300 !! wikitext
13301 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
13302 !! html
13303 <div title="This is a long title with just one piece templated">foo</div>
13304 !!end
13305
13306 !!test
13307 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
13308 !! wikitext
13309 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
13310 !! html
13311 <div title="This is a long title with just one piece templated">foo</div>
13312 !!end
13313
13314 # SSS FIXME: While it is great we added support for all this,
13315 # do we want to make this part of the spec? Maybe we want to
13316 # deprecate this kind of usage in the future?
13317 !!test
13318 Templates: HTML Tag: 7. Generation of partial attribute key string
13319 !! wikitext
13320 <div st{{echo|yle}}="color:red;">foo</div>
13321 !! html
13322 <div style="color:red;">foo</div>
13323 !!end
13324
13325 !! test
13326 Templates: HTML Tag: 8. Template-generated attribute (k=v)
13327 !! wikitext
13328 <div {{echo|1=id="v1"}}>bar</div>
13329 !! html
13330 <div id="v1">bar</div>
13331 !!end
13332
13333 !! test
13334 Templates: HTML Tag: 9. Multiple template-generated attributes
13335 !! wikitext
13336 <div {{echo|1=id="v1" title="foo"}}>bar</div>
13337 !! html
13338 <div id="v1" title="foo">bar</div>
13339 !!end
13340
13341 !! test
13342 Templates: Support for templates generating attributes and content
13343 !! wikitext
13344 {| {{mixed_attr_content_template}}
13345 |-
13346 |bar
13347 |}
13348 !! html/php
13349 <table style="color:red;" title="T48811">
13350
13351 <tr>
13352 <td>foo
13353 </td></tr>
13354 <tr>
13355 <td>bar
13356 </td></tr></table>
13357 !! html/parsoid
13358 <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|}"]}'>
13359 <tbody><tr>
13360 <td>foo</td></tr>
13361 <tr>
13362 <td>bar</td></tr>
13363 </tbody></table>
13364 !!end
13365
13366 !! article
13367 Template:attribute_from_template
13368 !! text
13369 class="123"
13370 !! endarticle
13371
13372 !! test
13373 Table cell with attribute before expanded attribute
13374 !! wikitext
13375 {|
13376 | align="center" {{attribute_from_template}} |456
13377 |}
13378 !! html/parsoid
13379 <table>
13380 <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>
13381 </tbody></table>
13382 !! end
13383
13384 !! test
13385 1. Entities and nowikis inside templated attributes should be handled correctly
13386 !! wikitext
13387 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
13388 !! html/php
13389 <div style="background:#f9f9f9;">foo</div>
13390 !! html/parsoid
13391 <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>
13392 !! end
13393
13394 !! test
13395 2. Entities and nowikis inside templated attributes should be handled correctly
13396 !! wikitext
13397 {|
13398 |{{table_attribs_3}}
13399 |}
13400 !! html/php
13401 <table>
13402 <tr>
13403 <td style="background:#f9f9f9;">Foo
13404 </td></tr></table>
13405 !! html/parsoid
13406 <table>
13407 <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>
13408 </tbody></table>
13409 !! end
13410
13411 !! test
13412 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13413 !! wikitext
13414 {{tbl-start}}
13415 |{{table_attribs_3}}
13416 {{tbl-end}}
13417 !! html/php
13418 <table>
13419 <tr>
13420 <td style="background:#f9f9f9;">Foo
13421 </td></tr></table>
13422 !! html/parsoid
13423 <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}}]}'>
13424 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
13425 </tbody></table>
13426 !! end
13427
13428 # T107622
13429 !! test
13430 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
13431 !! wikitext
13432 {|
13433 |{{table_attribs_6}} hi
13434 |}
13435 !! html/php
13436 <table>
13437 <tr>
13438 <td style="background: red;">hi
13439 </td></tr></table>
13440 !! html/parsoid
13441 <table>
13442 <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>
13443 </tbody></table>
13444 !! end
13445
13446 !!test
13447 Templates: HTML Tables: 1. Generating start of a HTML table
13448 !! wikitext
13449 {{echo|<table><tr><td>foo</td>}}</tr></table>
13450 !! html
13451 <table><tr><td>foo</td></tr></table>
13452 !!end
13453
13454 !!test
13455 Templates: HTML Tables: 2a. Generating middle of a HTML table
13456 !! wikitext
13457 <table><tr>{{echo|<td>foo</td>}}</tr></table>
13458 !! html
13459 <table><tr><td>foo</td></tr></table>
13460 !!end
13461
13462 !!test
13463 Templates: HTML Tables: 2b. Generating middle of a HTML table
13464 !! wikitext
13465 <table>{{echo|<tr><td>foo</td></tr>}}</table>
13466 !! html
13467 <table><tr><td>foo</td></tr></table>
13468 !!end
13469
13470 !!test
13471 Templates: HTML Tables: 3. Generating end of a HTML table
13472 !! wikitext
13473 <table><tr>{{echo|<td>foo</td></tr></table>}}
13474 !! html
13475 <table><tr><td>foo</td></tr></table>
13476 !! end
13477
13478 !!test
13479 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
13480 !! wikitext
13481 {{echo|<table>}}<tr><td>foo</td></tr></table>
13482 !! html
13483 <table><tr><td>foo</td></tr></table>
13484 !! end
13485
13486 !!test
13487 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
13488 !! wikitext
13489 <table>{{echo|<tr>}}<td>foo</td></tr></table>
13490 !! html
13491 <table><tr><td>foo</td></tr></table>
13492 !! end
13493
13494 !!test
13495 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
13496 !! wikitext
13497 <table><tr>{{echo|<td>}}foo</td></tr></table>
13498 !! html
13499 <table><tr><td>foo</td></tr></table>
13500 !! end
13501
13502 !!test
13503 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
13504 !! wikitext
13505 <table><tr><td>foo{{echo|</td>}}</tr></table>
13506 !! html
13507 <table><tr><td>foo</td></tr></table>
13508 !! end
13509
13510 !!test
13511 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
13512 !! wikitext
13513 <table><tr><td>foo</td>{{echo|</tr>}}</table>
13514 !! html
13515 <table><tr><td>foo</td></tr></table>
13516 !! end
13517
13518 !!test
13519 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
13520 !! wikitext
13521 <table><tr><td>foo</td></tr>{{echo|</table>}}
13522 !! html
13523 <table><tr><td>foo</td></tr></table>
13524 !! end
13525
13526 !!test
13527 Templates: HTML Tables: 5. Proper fostering of categories from inside
13528 !!options
13529 parsoid=wt2html,wt2wt
13530 !! wikitext
13531 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
13532 <!--Two categories (T52330)-->
13533 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
13534 !! html/php+tidy
13535 <table><tbody><tr><td>foo</td></tr></tbody></table>
13536 <table><tbody><tr><td>foo</td></tr></tbody></table>
13537 !! html/parsoid
13538 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
13539 <!--Two categories (T52330)-->
13540 <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>
13541 !!end
13542
13543 ## Remex doesn't account for fostered content.
13544 !! test
13545 Templates: Wiki Tables: 1a. Fostering of entire template content
13546 !! wikitext
13547 {|
13548 {{echo|a}}
13549 |}
13550 !! html/php
13551 <table>
13552 a
13553 <tr><td></td></tr></table>
13554 !! html/php+tidy
13555
13556 a
13557 <table><tbody><tr><td></td></tr></tbody></table>
13558 !! html/parsoid
13559 <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">
13560
13561 </table>
13562 !! end
13563
13564 !!test
13565 Templates: Wiki Tables: 1b. Fostering of entire template content
13566 !! wikitext
13567 {|
13568 {{echo|<div>}}
13569 foo
13570 {{echo|</div>}}
13571 |}
13572 !! html
13573 <table>
13574 <div>
13575 <p>foo
13576 </p>
13577 </div>
13578 <tr><td></td></tr></table>
13579 !! html/php+tidy
13580 <div>
13581 <p>foo
13582 </p>
13583 </div><table>
13584
13585 <tbody><tr><td></td></tr></tbody></table>
13586 !! html/parsoid
13587 <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|}"]}'>
13588 <p>foo</p>
13589 </div><table about="#mwt3">
13590
13591 </table>
13592 !! end
13593
13594 ## Remex doesn't account for fostered content.
13595 !! test
13596 Templates: Wiki Tables: 2. Fostering of partial template content
13597 !! wikitext
13598 {|
13599 {{echo|a
13600 <div>b</div>}}
13601 |}
13602 !! html/php
13603 <table>
13604 a
13605 <div>b</div>
13606 <tr><td></td></tr></table>
13607 !! html/php+tidy
13608
13609 a
13610 <div>b</div><table>
13611 <tbody><tr><td></td></tr></tbody></table>
13612 !! html/parsoid
13613 <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">
13614
13615
13616 </table>
13617 !! end
13618
13619 !!test
13620 Templates: Wiki Tables: 3. td-content via multiple templates
13621 !! wikitext
13622 {|
13623 {{echo|{{pipe}}a}}{{echo|b}}
13624 |}
13625 !! html
13626 <table>
13627 <tr>
13628 <td>ab
13629 </td></tr></table>
13630 !! end
13631
13632 !!test
13633 Templates: Wiki Tables: 4. Templated tags, no content
13634 !! wikitext
13635 {{tbl-start}}
13636 {{tbl-end}}
13637 !! html
13638 <table>
13639 <tr><td></td></tr></table>
13640 !! end
13641
13642 !!test
13643 Templates: Wiki Tables: 5. Templated tags, regular td-tags
13644 !! wikitext
13645 {{tbl-start}}
13646 |foo
13647 {{tbl-end}}
13648 !! html
13649 <table>
13650 <tr>
13651 <td>foo
13652 </td></tr></table>
13653 !! end
13654
13655 !!test
13656 Templates: Wiki Tables: 6. Templated tags, templated td-tags
13657 !! wikitext
13658 {{tbl-start}}
13659 {{!}}foo
13660 {{tbl-end}}
13661 !! html
13662 <table>
13663 <tr>
13664 <td>foo
13665 </td></tr></table>
13666 !! end
13667
13668 ## This test case is very specific to Parsoid's internals
13669 ## and is hence only tested for Parsoid's code. Parsoid uses
13670 ## a <meta> marker tag for <ref> tags and they are expanded
13671 ## much later. We are verifying that this <meta> tag usage
13672 ## doesn't prevent foster parenting.
13673 !! test
13674 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
13675 !! wikitext
13676 {{PartialTable}}<ref>foo</ref>
13677 |}
13678
13679 <references />
13680 !! html/parsoid
13681 <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">
13682 <tbody>
13683 </tbody></table>
13684
13685 <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>
13686 !! end
13687
13688 !! test
13689 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
13690 !! wikitext
13691 {{echo|
13692 {{{!}}
13693 {{!}}-}}
13694 <onlyinclude>
13695 |foo
13696 </onlyinclude>
13697 {{!}}}
13698 !! html/parsoid
13699 <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{{!}}}"]}'>
13700 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
13701 <tbody><tr>
13702
13703 <td>foo
13704 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
13705 </tbody></table>
13706 !! end
13707
13708 !!test
13709 Templates: Lists: Multi-line list-items via templates
13710 !! wikitext
13711 *{{echo|a {{nonexistent|
13712 unused}}}}
13713 *{{echo|b {{nonexistent|
13714 unused}}}}
13715 !! html
13716 <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>
13717 <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>
13718 !!end
13719
13720 !!test
13721 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
13722 !! wikitext
13723 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
13724 !! html
13725 <p><i>ab</i>c<i>d</i>e
13726 </p>
13727 !!end
13728
13729 !!test
13730 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
13731 (PHP parser generates misnested html)
13732 !! wikitext
13733 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
13734 !! html/parsoid
13735 <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>
13736 !!end
13737
13738 !!test
13739 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
13740 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
13741 !! options
13742 parsoid=wt2html,wt2wt
13743 !! wikitext
13744 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
13745 !! html/php+tidy
13746 <div><i>a</i></div><div><i>b</i>c<i>d</i></div><div>e</div>
13747 !! html/parsoid
13748 <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>
13749 <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>
13750 <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>
13751 !!end
13752
13753 !!test
13754 Templates: Ugly nesting: 4. Divs opened/closed across templates
13755 !! wikitext
13756 a<div>b{{echo|c</div>d}}e
13757 !! html
13758 a<div>bc</div>de
13759 !! html+tidy
13760 <p>a</p><div>bc</div><p>de</p>
13761 !! end
13762
13763 !! test
13764 Templates: Ugly templates: 3. newline-only template parameter
13765 !! wikitext
13766 foo {{echo|
13767 }}
13768 !! html
13769 <p>foo
13770 </p>
13771 !! end
13772
13773 # This looks like a bug: a single newline triggers p/br for some reason.
13774 !! test
13775 Templates: Ugly templates: 4. newline-only template parameter inconsistency
13776 !! wikitext
13777 {{echo|
13778 }}
13779 !! html
13780 <p><br />
13781 </p>
13782 !! end
13783
13784 # T66017 -- ugly wikitext with fostered content generates two template ranges that
13785 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
13786 !! test
13787 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
13788 !! wikitext
13789 {{echo|<table>}}
13790 {{echo|<div>foo}}
13791 {{echo|</table>}}
13792 !! html/parsoid
13793 <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">
13794 </span><table about="#mwt1">
13795 </table>
13796 !! end
13797
13798 # T66017 -- ugly wikitext with fostered content generates two template ranges
13799 # that are "identical" and generate nesting cycles in the algorithm
13800 !! test
13801 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
13802 !! wikitext
13803 {{echo|<table><tr><td><table>}}
13804 {{echo|<div>}}
13805 {{echo|</div>}}
13806 !! html/parsoid
13807 <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"}'>
13808 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
13809 </table></td></tr></tbody></table>
13810 !! end
13811
13812 !! test
13813 Templates: Parameters substituted at the top-level
13814 !! wikitext
13815 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
13816
13817 {{{foo|bar|baz}}}
13818 !! html/php
13819 <p><i>who</i> me? <b>never!</b>
13820 </p><p>bar
13821 </p>
13822 !! html/parsoid
13823 <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>
13824
13825 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
13826 !! end
13827
13828 !! test
13829 Templates: Param with empty arg in the final position
13830 !! wikitext
13831 {{{hi|}}}
13832 !! html/parsoid
13833 <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
13834 !! end
13835
13836 !!test
13837 Parser Functions: 1. Simple example
13838 !! wikitext
13839 {{uc:foo}}
13840 !! html
13841 <p>FOO
13842 </p>
13843 !!end
13844
13845 !!test
13846 Parser Functions: 2. Nested use (only outermost should be marked up)
13847 !! wikitext
13848 {{uc:{{lc:FOO}}}}
13849 !! html
13850 <p>FOO
13851 </p>
13852 !!end
13853
13854 ## Note that the templates inside the references are not wrapped
13855 !! test
13856 Template nested in extension tag in template
13857 !! options
13858 title=[[Main Page]]
13859 language=zh
13860 !! wikitext
13861 {{echo|hi<ref>[[ho|{{echo|hi}}]]</ref>}}
13862 {{echo|hi<ref>[http://test.com?q={{echo|ho}}]</ref>}}
13863 {{echo|hi<ref>-{ho|{{echo|hi}}}-</ref>}}
13864 <references />
13865 !! html/parsoid
13866 <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>
13867 <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>
13868 <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>
13869 <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>
13870 !! end
13871
13872 ###
13873 ### Pre-save transform tests
13874 ###
13875
13876 !! test
13877 pre-save transform: subst:
13878 !! options
13879 pst
13880 !! wikitext
13881 {{subst:test}}
13882 !! html/php
13883 This is a test template
13884 !! end
13885
13886 !! test
13887 pre-save transform: normal template
13888 !! options
13889 pst
13890 !! wikitext
13891 {{test}}
13892 !! html/php
13893 {{test}}
13894 !! end
13895
13896 !! test
13897 pre-save transform: nonexistent template
13898 !! options
13899 pst
13900 !! wikitext
13901 {{thistemplatedoesnotexist}}
13902 !! html/php
13903 {{thistemplatedoesnotexist}}
13904 !! end
13905
13906 !! test
13907 pre-save transform: subst magic variables
13908 !! options
13909 pst
13910 !! wikitext
13911 {{subst:SITENAME}}
13912 !! html/php
13913 MediaWiki
13914 !! end
13915
13916 # This is T2089, which I fixed. -- wtm
13917 !! test
13918 pre-save transform: subst: templates with parameters
13919 !! options
13920 pst
13921 !! wikitext
13922 {{subst:paramtest|param="something else"}}
13923 !! html/php
13924 This is a test template with parameter "something else"
13925 !! end
13926
13927 !! article
13928 Template:nowikitest
13929 !! text
13930 <nowiki>'''not wiki'''</nowiki>
13931 !! endarticle
13932
13933 !! test
13934 pre-save transform: nowiki in subst (T3188)
13935 !! options
13936 pst
13937 !! wikitext
13938 {{subst:nowikitest}}
13939 !! html/php
13940 <nowiki>'''not wiki'''</nowiki>
13941 !! end
13942
13943 !! article
13944 Template:commenttest
13945 !! text
13946 This template has <!-- a comment --> in it.
13947 !! endarticle
13948
13949 !! test
13950 pre-save transform: comment in subst (T3936)
13951 !! options
13952 pst
13953 !! wikitext
13954 {{subst:commenttest}}
13955 !! html/php
13956 This template has <!-- a comment --> in it.
13957 !! end
13958
13959 !! test
13960 pre-save transform: unclosed tag
13961 !! options
13962 pst
13963 !! wikitext
13964 <nowiki>'''not wiki'''
13965 !! html/php
13966 <nowiki>'''not wiki'''
13967 !! end
13968
13969 !! test
13970 pre-save transform: mixed tag case
13971 !! options
13972 pst
13973 !! wikitext
13974 <NOwiki>'''not wiki'''</noWIKI>
13975 !! html/php
13976 <NOwiki>'''not wiki'''</noWIKI>
13977 !! end
13978
13979 !! test
13980 pre-save transform: unclosed comment in <nowiki>
13981 !! options
13982 pst
13983 !! wikitext
13984 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13985 !! html/php
13986 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
13987 !!end
13988
13989 # Leading @ in this template definition works around a limitation
13990 # in parsoid's parserTests which otherwise strips the <span> from the
13991 # result (confusing it for a template wrapper)
13992 !! article
13993 Template:dangerous
13994 !!text
13995 @<span onmouseover="alert('crap')">Oh no</span>
13996 !!endarticle
13997
13998 !!test
13999 (confirming safety of fix for subst T3936)
14000 !! wikitext
14001 {{Template:dangerous}}
14002 !! html
14003 <p>@<span>Oh no</span>
14004 </p>
14005 !! end
14006
14007 !! test
14008 pre-save transform: comment containing gallery (T7024)
14009 !! options
14010 pst
14011 !! wikitext
14012 <!-- <gallery>data</gallery> -->
14013 !! html/php
14014 <!-- <gallery>data</gallery> -->
14015 !!end
14016
14017 !! test
14018 pre-save transform: comment containing extension
14019 !! options
14020 pst
14021 !! wikitext
14022 <!-- <tag>data</tag> -->
14023 !! html/php
14024 <!-- <tag>data</tag> -->
14025 !!end
14026
14027 !! test
14028 pre-save transform: comment containing nowiki
14029 !! options
14030 pst
14031 !! wikitext
14032 <!-- <nowiki>data</nowiki> -->
14033 !! html/php
14034 <!-- <nowiki>data</nowiki> -->
14035 !!end
14036
14037 !! test
14038 pre-save transform: <noinclude> in subst (T5298)
14039 !! options
14040 pst
14041 !! wikitext
14042 {{subst:Includes}}
14043 !! html/php
14044 Foobar
14045 !! end
14046
14047 !! test
14048 pre-save transform: <onlyinclude> in subst (T5298)
14049 !! options
14050 pst
14051 !! wikitext
14052 {{subst:Includes2}}
14053 !! html/php
14054 Foo
14055 !! end
14056
14057 !! article
14058 Template:SubstTest
14059 !!text
14060 {{<includeonly>subst:</includeonly>Includes}}
14061 !! endarticle
14062
14063 !! article
14064 Template:SafeSubstTest
14065 !! text
14066 {{<includeonly>safesubst:</includeonly>Includes}}
14067 !! endarticle
14068
14069 !! test
14070 T24297: safesubst: works during PST
14071 !! options
14072 pst
14073 !! wikitext
14074 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
14075 !! html/php
14076 FoobarFoobar
14077 !! end
14078
14079 !! test
14080 T24297: safesubst: works during normal parse
14081 !! wikitext
14082 {{SafeSubstTest}}
14083 !! html
14084 <p>Foobar
14085 </p>
14086 !! end
14087
14088 !! test
14089 subst: does not work during normal parse
14090 !! wikitext
14091 {{SubstTest}}
14092 !! html
14093 <p>{{subst:Includes}}
14094 </p>
14095 !! end
14096
14097 !! test
14098 pre-save transform: context links ("pipe trick")
14099 !! options
14100 pst
14101 !! wikitext
14102 [[Article (context)|]]
14103 [[Bar:Article|]]
14104 [[:Bar:Article|]]
14105 [[Bar:Article (context)|]]
14106 [[:Bar:Article (context)|]]
14107 [[|Article]]
14108 [[|Article (context)]]
14109 [[Bar:X (Y) Z|]]
14110 [[:Bar:X (Y) Z|]]
14111 !! html/php
14112 [[Article (context)|Article]]
14113 [[Bar:Article|Article]]
14114 [[:Bar:Article|Article]]
14115 [[Bar:Article (context)|Article]]
14116 [[:Bar:Article (context)|Article]]
14117 [[Article]]
14118 [[Article (context)]]
14119 [[Bar:X (Y) Z|X (Y) Z]]
14120 [[:Bar:X (Y) Z|X (Y) Z]]
14121 !! end
14122
14123 !! test
14124 pre-save transform: context links ("pipe trick") with interwiki prefix
14125 !! options
14126 pst
14127 !! wikitext
14128 [[interwiki:Article|]]
14129 [[:interwiki:Article|]]
14130 [[interwiki:Bar:Article|]]
14131 [[:interwiki:Bar:Article|]]
14132 !! html/php
14133 [[interwiki:Article|Article]]
14134 [[:interwiki:Article|Article]]
14135 [[interwiki:Bar:Article|Bar:Article]]
14136 [[:interwiki:Bar:Article|Bar:Article]]
14137 !! end
14138
14139 !! test
14140 pre-save transform: context links ("pipe trick") with parens in title
14141 !! options
14142 pst title=[[Somearticle (context)]]
14143 !! wikitext
14144 [[|Article]]
14145 !! html/php
14146 [[Article (context)|Article]]
14147 !! end
14148
14149 !! test
14150 pre-save transform: context links ("pipe trick") with comma in title
14151 !! options
14152 pst title=[[Someplace, Somewhere]]
14153 !! wikitext
14154 [[|Otherplace]]
14155 [[Otherplace, Elsewhere|]]
14156 [[Otherplace, Elsewhere, Anywhere|]]
14157 !! html/php
14158 [[Otherplace, Somewhere|Otherplace]]
14159 [[Otherplace, Elsewhere|Otherplace]]
14160 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
14161 !! end
14162
14163 !! test
14164 pre-save transform: context links ("pipe trick") with parens and comma
14165 !! options
14166 pst title=[[Someplace (IGNORED), Somewhere]]
14167 !! wikitext
14168 [[|Otherplace]]
14169 [[Otherplace (place), Elsewhere|]]
14170 !! html/php
14171 [[Otherplace, Somewhere|Otherplace]]
14172 [[Otherplace (place), Elsewhere|Otherplace]]
14173 !! end
14174
14175 !! test
14176 pre-save transform: context links ("pipe trick") with comma and parens
14177 !! options
14178 pst title=[[Who, me? (context)]]
14179 !! wikitext
14180 [[|Yes, you.]]
14181 [[Me, Myself, and I (1937 song)|]]
14182 !! html/php
14183 [[Yes, you. (context)|Yes, you.]]
14184 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
14185 !! end
14186
14187 !! test
14188 pre-save transform: context links ("pipe trick") with namespace
14189 !! options
14190 pst title=[[Ns:Somearticle]]
14191 !! wikitext
14192 [[|Article]]
14193 !! html/php
14194 [[Ns:Article|Article]]
14195 !! end
14196
14197 !! test
14198 pre-save transform: context links ("pipe trick") with namespace and parens
14199 !! options
14200 pst title=[[Ns:Somearticle (context)]]
14201 !! wikitext
14202 [[|Article]]
14203 !! html/php
14204 [[Ns:Article (context)|Article]]
14205 !! end
14206
14207 !! test
14208 pre-save transform: context links ("pipe trick") with namespace and comma
14209 !! options
14210 pst title=[[Ns:Somearticle, Context, Whatever]]
14211 !! wikitext
14212 [[|Article]]
14213 !! html/php
14214 [[Ns:Article, Context, Whatever|Article]]
14215 !! end
14216
14217 !! test
14218 pre-save transform: context links ("pipe trick") with namespace, comma and parens
14219 !! options
14220 pst title=[[Ns:Somearticle, Context (context)]]
14221 !! wikitext
14222 [[|Article]]
14223 !! html/php
14224 [[Ns:Article (context)|Article]]
14225 !! end
14226
14227 !! test
14228 pre-save transform: context links ("pipe trick") with namespace, parens and comma
14229 !! options
14230 pst title=[[Ns:Somearticle (IGNORED), Context]]
14231 !! wikitext
14232 [[|Article]]
14233 !! html/php
14234 [[Ns:Article, Context|Article]]
14235 !! end
14236
14237 !! test
14238 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
14239 !! options
14240 pst
14241 !! wikitext
14242 [[Article(context)|]]
14243 [[Bar:Article(context)|]]
14244 [[:Bar:Article(context)|]]
14245 [[|Article(context)]]
14246 [[Bar:X(Y)Z|]]
14247 [[:Bar:X(Y)Z|]]
14248 !! html/php
14249 [[Article(context)|Article]]
14250 [[Bar:Article(context)|Article]]
14251 [[:Bar:Article(context)|Article]]
14252 [[Article(context)]]
14253 [[Bar:X(Y)Z|X(Y)Z]]
14254 [[:Bar:X(Y)Z|X(Y)Z]]
14255 !! end
14256
14257 !! test
14258 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
14259 !! options
14260 pst
14261 !! wikitext
14262 [[Article (context)|]]
14263 [[Bar:Article (context)|]]
14264 [[:Bar:Article (context)|]]
14265 [[|Article (context)]]
14266 [[Bar:X (Y) Z|]]
14267 [[:Bar:X (Y) Z|]]
14268 !! html/php
14269 [[Article (context)|Article]]
14270 [[Bar:Article (context)|Article]]
14271 [[:Bar:Article (context)|Article]]
14272 [[Article (context)]]
14273 [[Bar:X (Y) Z|X (Y) Z]]
14274 [[:Bar:X (Y) Z|X (Y) Z]]
14275 !! end
14276
14277 !! test
14278 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
14279 !! options
14280 pst
14281 !! wikitext
14282 [[Article(context)|]]
14283 [[Bar:Article(context)|]]
14284 [[:Bar:Article(context)|]]
14285 [[|Article(context)]]
14286 [[Bar:X(Y)Z|]]
14287 [[:Bar:X(Y)Z|]]
14288 !! html/php
14289 [[Article(context)|Article]]
14290 [[Bar:Article(context)|Article]]
14291 [[:Bar:Article(context)|Article]]
14292 [[Article(context)]]
14293 [[Bar:X(Y)Z|X(Y)Z]]
14294 [[:Bar:X(Y)Z|X(Y)Z]]
14295 !! end
14296
14297 !! test
14298 pre-save transform: context links ("pipe trick") with commas (T23660)
14299 !! options
14300 pst
14301 !! wikitext
14302 [[Article (context), context|]]
14303 [[Article (context),context|]]
14304 [[Bar:Article (context), context|]]
14305 [[Bar:Article (context),context|]]
14306 [[:Bar:Article (context), context|]]
14307 [[:Bar:Article (context),context|]]
14308 !! html/php
14309 [[Article (context), context|Article]]
14310 [[Article (context),context|Article]]
14311 [[Bar:Article (context), context|Article]]
14312 [[Bar:Article (context),context|Article]]
14313 [[:Bar:Article (context), context|Article]]
14314 [[:Bar:Article (context),context|Article]]
14315 !! end
14316
14317 !! test
14318 Parsoid: backwards pipe trick
14319 !! wikitext
14320 [[|'''bar''']]
14321 !! html/php
14322 <p>[[|<b>bar</b>]]
14323 </p>
14324 !! html/parsoid
14325 <p>[[|<b>bar</b>]]</p>
14326 !! end
14327
14328 !! test
14329 pre-save transform: trim trailing empty lines
14330 !! options
14331 pst
14332 !! wikitext
14333 Empty lines are trimmed
14334
14335
14336
14337
14338 !! html/php
14339 Empty lines are trimmed
14340 !! end
14341
14342 !! test
14343 pre-save transform: Signature expansion
14344 !! options
14345 pst
14346 !! wikitext
14347 * ~~~
14348 * ~~~~
14349 * ~~~~~
14350 * <noinclude>~~~</noinclude>
14351 * <includeonly>~~~</includeonly>
14352 * <onlyinclude>~~~</onlyinclude>
14353 !! html/php
14354 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
14355 * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14356 * 00:02, 1 January 1970 (UTC)
14357 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
14358 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
14359 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
14360 !! end
14361
14362
14363 !! test
14364 ParserOutput flags from signature expansion (T84843)
14365 !! options
14366 pst
14367 showflags
14368 !! wikitext
14369 ~~~~
14370 !! html/php
14371 [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
14372 flags=user-signature
14373 !! end
14374
14375
14376 !! test
14377 pre-save transform: Signature expansion in nowiki tags (T2093)
14378 !! options
14379 pst disabled
14380 !! wikitext
14381 Shall not expand:
14382
14383 <nowiki>~~~~</nowiki>
14384
14385 <includeonly><nowiki>~~~~</nowiki></includeonly>
14386
14387 <noinclude><nowiki>~~~~</nowiki></noinclude>
14388
14389 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14390
14391 {{subst:Foo}} shall be converted to FOO
14392
14393 As well as inside noinclude/onlyinclude
14394 <noinclude>{{subst:Foo}}</noinclude>
14395 <onlyinclude>{{subst:Foo}}</onlyinclude>
14396
14397 But not inside includeonly
14398 <includeonly>{{subst:Foo}}</includeonly>
14399 !! html/php
14400 Shall not expand:
14401
14402 <nowiki>~~~~</nowiki>
14403
14404 <includeonly><nowiki>~~~~</nowiki></includeonly>
14405
14406 <noinclude><nowiki>~~~~</nowiki></noinclude>
14407
14408 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
14409
14410 FOO shall be converted to FOO
14411
14412 As well as inside noinclude/onlyinclude
14413 <noinclude>FOO</noinclude>
14414 <onlyinclude>FOO</onlyinclude>
14415
14416 But not inside includeonly
14417 <includeonly>{{subst:Foo}}</includeonly>
14418 !! end
14419
14420 !! test
14421 Parsoid: Recognize nowiki with trailing space in tags
14422 !! options
14423 parsoid=wt2html
14424 !! wikitext
14425 <nowiki ><div>[[foo]]</nowiki >
14426
14427 a<nowiki / >b
14428
14429 c<nowiki />d
14430
14431 e<nowiki/ >f
14432 !! html/php+tidy
14433 <p>&lt;div&gt;[[foo]]
14434 </p><p>a&lt;nowiki / &gt;b
14435 </p><p>cd
14436 </p><p>e&lt;nowiki/ &gt;f
14437 </p>
14438 !! html/parsoid
14439 <p><span typeof="mw:Nowiki">&lt;div>[[foo]]</span></p>
14440
14441 <p>a&lt;nowiki / >b</p>
14442
14443 <p>c<span typeof="mw:Nowiki"></span>d</p>
14444
14445 <p>e&lt;nowiki/ >f</p>
14446 !! end
14447
14448 !! test
14449 Parsoid: Recognize nowiki with odd capitalization
14450 !! options
14451 parsoid=wt2html
14452 !! wikitext
14453 <noWikI ><div>[[foo]]</Nowiki >
14454 !! html/php+tidy
14455 <p>&lt;div&gt;[[foo]]
14456 </p>
14457 !! html/parsoid
14458 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
14459 !! end
14460
14461
14462 !! test
14463 Parsoid: Escape nowiki with trailing space in tags
14464 !! options
14465 parsoid=html2wt
14466 !! html/parsoid
14467 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
14468 <p>a&lt;nowiki /&gt;b</p>
14469 <p>c&lt;nowiki/ &gt;d</p>
14470 !! wikitext
14471 &lt;nowiki &gt; foo &lt;/nowiki &gt;
14472
14473 a&lt;nowiki /&gt;b
14474
14475 c&lt;nowiki/ &gt;d
14476 !! end
14477
14478 !! test
14479 Parsoid: Escape weird noWikI capitalizations
14480 !! options
14481 parsoid=html2wt
14482 !! html/parsoid
14483 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
14484 !! wikitext
14485 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
14486 !! end
14487
14488 ###
14489 ### Message transform tests
14490 ###
14491 !! test
14492 message transform: magic variables
14493 !! options
14494 msg
14495 !! wikitext
14496 {{SITENAME}}
14497 !! html
14498 MediaWiki
14499 !! end
14500
14501 !! test
14502 message transform: should not transform wiki markup
14503 !! options
14504 msg
14505 !! wikitext
14506 ''test''
14507 !! html
14508 ''test''
14509 !! end
14510
14511 !! test
14512 message transform: <noinclude> in transcluded template (T6926)
14513 !! options
14514 msg
14515 !! wikitext
14516 {{Includes}}
14517 !! html
14518 Foobar
14519 !! end
14520
14521 !! test
14522 message transform: <onlyinclude> in transcluded template (T6926)
14523 !! options
14524 msg
14525 !! wikitext
14526 {{Includes2}}
14527 !! html
14528 Foo
14529 !! end
14530
14531 !! test
14532 {{#special:}} page name, known
14533 !! options
14534 msg
14535 !! wikitext
14536 {{#special:Recentchanges}}
14537 !! html
14538 Special:RecentChanges
14539 !! end
14540
14541 !! test
14542 {{#special:}} page name with subpage, known
14543 !! options
14544 msg
14545 !! wikitext
14546 {{#special:Recentchanges/param}}
14547 !! html
14548 Special:RecentChanges/param
14549 !! end
14550
14551 !! test
14552 {{#special:}} page name, unknown
14553 !! options
14554 msg
14555 !! wikitext
14556 {{#special:foobar nonexistent}}
14557 !! html
14558 Special:Foobar nonexistent
14559 !! end
14560
14561 !! test
14562 {{#speciale:}} page name, known
14563 !! options
14564 msg
14565 !! wikitext
14566 {{#speciale:Recentchanges}}
14567 !! html
14568 Special:RecentChanges
14569 !! end
14570
14571 !! test
14572 {{#speciale:}} page name with subpage, known
14573 !! options
14574 msg
14575 !! wikitext
14576 {{#speciale:Recentchanges/param}}
14577 !! html
14578 Special:RecentChanges/param
14579 !! end
14580
14581 !! test
14582 {{#speciale:}} page name, unknown
14583 !! options
14584 msg
14585 !! wikitext
14586 {{#speciale:foobar nonexistent}}
14587 !! html
14588 Special:Foobar_nonexistent
14589 !! end
14590
14591 ###
14592 ### Images
14593 ###
14594 ### For Parsoid-specific tests, see
14595 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14596
14597 !! test
14598 Simple image
14599 !! options
14600 parsoid=wt2html,wt2wt,html2html
14601 !! wikitext
14602 [[Image:foobar.jpg]]
14603 !! html/php
14604 <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>
14605 </p>
14606 !! html/parsoid
14607 <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>
14608 !! end
14609
14610 !! test
14611 Serialize simple image with span wrapper
14612 !! options
14613 parsoid=html2wt
14614 !! html/parsoid
14615 <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>
14616 !! wikitext
14617 [[File:Foobar.jpg]]
14618 !! end
14619
14620 !! test
14621 Simple image (using File: namespace, now canonical)
14622 !! wikitext
14623 [[File:Foobar.jpg]]
14624 !! html/php
14625 <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>
14626 </p>
14627 !! html/parsoid
14628 <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>
14629 !! end
14630
14631 !! test
14632 Right-aligned image
14633 !! wikitext
14634 [[File:Foobar.jpg|right]]
14635 !! html/php
14636 <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>
14637 !! html/parsoid
14638 <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>
14639 !! end
14640
14641 !! test
14642 Image with caption
14643 !! wikitext
14644 [[File:Foobar.jpg|right|Caption text]]
14645 !! html/php
14646 <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>
14647 !! html/parsoid
14648 <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>
14649 !! end
14650
14651 !! test
14652 Image with caption, T55312 #1
14653 !! wikitext
14654 [[File:Foobar.jpg|right|Caption page stuff]]
14655 !! html/php
14656 <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>
14657 !! html/parsoid
14658 <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>
14659 !! end
14660
14661 !! test
14662 Image with caption, T55312 #2
14663 !! wikitext
14664 [[File:Foobar.jpg|right|Caption page=]]
14665 !! html/php
14666 <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>
14667 !! html/parsoid
14668 <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>
14669 !! end
14670
14671 !! test
14672 Image with caption, T55312 #3
14673 !! wikitext
14674 [[File:Foobar.jpg|right|Caption page=stuff]]
14675 !! html/php
14676 <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>
14677 !! html/parsoid
14678 <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>
14679 !! end
14680
14681 !! test
14682 Image caption with pipe entity
14683 !! wikitext
14684 [[File:Foobar.jpg|thumb|one &#x7C; two]]
14685 [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
14686 !! html/php
14687 <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>
14688 <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>
14689 !! html/parsoid
14690 <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>
14691 <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>
14692 !! end
14693
14694 !! test
14695 Allow empty links in image captions (T62753)
14696 !! options
14697 thumbsize=220
14698 !! wikitext
14699 [[File:Foobar.jpg|thumb|Caption [[Link1]]
14700 [[]]
14701 [[Link2]]
14702 ]]
14703 !! html/php
14704 <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>
14705 !! html/parsoid
14706 <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>
14707 [[]]
14708 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
14709 </figcaption></figure>
14710 !! end
14711
14712 !! test
14713 Titles in unlinked images (T23454)
14714 !! wikitext
14715 [[File:Foobar.jpg|link=|stuff]]
14716 !! html/php
14717 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" title="stuff" width="1941" height="220" />
14718 </p>
14719 !! html/parsoid
14720 <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>
14721 !! end
14722
14723 !! test
14724 Link with empty target
14725 !! wikitext
14726 [[]]
14727 !! html
14728 <p>[[]]
14729 </p>
14730 !! end
14731
14732 !! test
14733 Image with link trail
14734 !! wikitext
14735 Linktrails should not work for images: [[File:Foobar.jpg]]s
14736 !! html/php
14737 <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
14738 </p>
14739 !! html/parsoid
14740 <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>
14741 !! end
14742
14743 !! test
14744 Image with empty attribute
14745 !! options
14746 parsoid=wt2html,wt2wt,html2html
14747 !! wikitext
14748 [[File:Foobar.jpg|right||Caption text]]
14749 !! html/php
14750 <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>
14751 !! html/parsoid
14752 <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>
14753 !! end
14754
14755 !! test
14756 1. Block image with individual attributes from templates
14757 !! wikitext
14758 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
14759 !! html/php
14760 <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>
14761 !! html/parsoid
14762 <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>
14763 !! end
14764
14765 !! test
14766 2. Block Image with individual attributes from templates
14767 !! wikitext
14768 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
14769 !! html/php
14770 <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>
14771 !! html/parsoid
14772 <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>
14773 !! end
14774
14775 !! test
14776 3. Inline image with individual attributes from templates
14777 !! wikitext
14778 [[File:Foobar.jpg|{{echo|50px}}]]
14779 !! html/php
14780 <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>
14781 </p>
14782 !! html/parsoid
14783 <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>
14784 !! end
14785
14786 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
14787 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
14788 !! test
14789 Image with multiple attributes from the same template
14790 !! wikitext
14791 [[File:Foobar.jpg|{{image_attribs}}]]
14792 !! html/php
14793 <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>
14794 !! html/parsoid
14795 <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>
14796 !! end
14797
14798 !! test
14799 Image with link tails
14800 !! options
14801 thumbsize=220
14802 !! wikitext
14803 123[[File:Foobar.jpg]]456
14804 123[[File:Foobar.jpg|right]]456
14805 123[[File:Foobar.jpg|thumb]]456
14806 !! html/php
14807 <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
14808 </p>
14809 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
14810 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
14811 !! html/php+tidy
14812 <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
14813 </p><p>
14814 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
14815 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>
14816 !! html/parsoid
14817 <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>
14818 <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
14819 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>
14820 !! end
14821
14822 !! test
14823 Image with multiple captions -- only last one is accepted
14824 !! wikitext
14825 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
14826 !! html/php
14827 <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>
14828 !! html/parsoid
14829 <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>
14830 !! end
14831
14832 !! test
14833 Image with multiple widths -- use last
14834 !! wikitext
14835 [[File:Foobar.jpg|200px|300px|caption]]
14836 !! html/php
14837 <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>
14838 </p>
14839 !! html/parsoid
14840 <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>
14841 !! end
14842
14843 !! test
14844 Image with multiple alignments -- use first (T50664)
14845 !! options
14846 thumbsize=220
14847 !! wikitext
14848 [[File:Foobar.jpg|thumb|left|right|center|caption]]
14849
14850 [[File:Foobar.jpg|middle|text-top|caption]]
14851 !! html/php
14852 <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>
14853 <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>
14854 </p>
14855 !! html/parsoid
14856 <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>
14857 <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>
14858 !! end
14859
14860 !! test
14861 Image with width attribute at different positions
14862 !! wikitext
14863 [[File:Foobar.jpg|200px|right|Caption]]
14864 [[File:Foobar.jpg|right|200px|Caption]]
14865 [[File:Foobar.jpg|right|Caption|200px]]
14866 !! html/php
14867 <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>
14868 <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>
14869 <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>
14870 !! html/parsoid
14871 <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>
14872 <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>
14873 <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>
14874 !! end
14875
14876 # a sad bit of backward-compatibility
14877 !! test
14878 Image with size specified with pxpx (T15500, T53628)
14879 !! options
14880 parsoid=wt2html,wt2wt,html2html
14881 !! wikitext
14882 [[File:Foobar.jpg|20pxpx]]
14883 [[File:Foobar.jpg|200x20pxpx]]
14884 !! html/php
14885 <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>
14886 <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>
14887 </p>
14888 !! html/parsoid
14889 <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>
14890 !! end
14891
14892 !! test
14893 Image with link parameter, wiki target
14894 !! wikitext
14895 [[File:Foobar.jpg|link=Main Page]]
14896 !! html/php
14897 <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>
14898 </p>
14899 !! html/parsoid
14900 <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>
14901 !! end
14902
14903 # parsoid T51293 (part 1)
14904 !! test
14905 Image with link parameter, URL target
14906 !! wikitext
14907 [[File:Foobar.jpg|link=http://example.com/]]
14908 !! html/php
14909 <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>
14910 </p>
14911 !! html/parsoid
14912 <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>
14913 !! end
14914
14915 # parsoid T51293 (part 2)
14916 !! test
14917 Image with link parameter, protocol-less URL target
14918 !! wikitext
14919 [[File:Foobar.jpg|link=//example.com/]]
14920 !! html/php
14921 <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>
14922 </p>
14923 !! html/parsoid
14924 <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>
14925 !! end
14926
14927 !! test
14928 Escaping non-block captions (T107435)
14929 !! options
14930 parsoid={
14931 "modes": ["wt2wt"],
14932 "changes": [
14933 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
14934 ]
14935 }
14936 !! wikitext
14937 [[Image:Foobar.jpg|caption]]
14938 !! wikitext/edited
14939 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
14940 !! end
14941
14942 # wgExternalLinkTarget not supported by Parsoid
14943 !! test
14944 Image with link parameter, wgExternalLinkTarget
14945 !! wikitext
14946 [[Image:foobar.jpg|link=http://example.com/]]
14947 !! config
14948 wgExternalLinkTarget='foobar'
14949 !! html/php
14950 <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>
14951 </p>
14952 !! end
14953
14954 !! test
14955 Image with link parameter, wgNoFollowLinks set to false
14956 !! wikitext
14957 [[Image:foobar.jpg|link=http://example.com/]]
14958 !! config
14959 wgNoFollowLinks=false
14960 !! html/php
14961 <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>
14962 </p>
14963 !! end
14964
14965 !! test
14966 Image with link parameter, wgNoFollowDomainExceptions
14967 !! wikitext
14968 [[Image:foobar.jpg|link=http://example.com/]]
14969 !! config
14970 wgNoFollowDomainExceptions='example.com'
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 # wgExternalLinkTarget not supported by Parsoid
14977 !! test
14978 Image with link parameter, wgExternalLinkTarget, unnamed parameter
14979 !! wikitext
14980 [[Image:foobar.jpg|link=http://example.com/|Title]]
14981 !! config
14982 wgExternalLinkTarget='foobar'
14983 !! html/php
14984 <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>
14985 </p>
14986 !! end
14987
14988 !! test
14989 Image with empty link parameter
14990 !! wikitext
14991 [[File:Foobar.jpg|link=]]
14992 !! html/php
14993 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" decoding="async" width="1941" height="220" />
14994 </p>
14995 !! html/parsoid
14996 <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>
14997 !! end
14998
14999 !! test
15000 Image with link parameter (wiki target) and unnamed parameter
15001 !! wikitext
15002 [[File:Foobar.jpg|link=Main_Page|Title]]
15003 !! html/php
15004 <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>
15005 </p>
15006 !! html/parsoid
15007 <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>
15008 !! end
15009
15010 !! test
15011 Image with link parameter (URL target) and unnamed parameter
15012 !! wikitext
15013 [[File:Foobar.jpg|link=http://example.com/|Title]]
15014 !! html/php
15015 <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>
15016 </p>
15017 !! html/parsoid
15018 <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>
15019 !! end
15020
15021 !! test
15022 Thumbnail image with link parameter
15023 !! options
15024 thumbsize=220
15025 parsoid=wt2html,wt2wt,html2html
15026 !! wikitext
15027 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
15028 !! html/php
15029 <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>
15030 !! html/parsoid
15031 <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>
15032 !! end
15033
15034 !! test
15035 Manually-specified thumbnail image
15036 !! options
15037 thumbsize=220
15038 !! wikitext
15039 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15040 !! html/php
15041 <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>
15042 !! html/parsoid
15043 <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>
15044 !! end
15045
15046 !! test
15047 Manually-specified thumbnail image (backwards compat)
15048 !! options
15049 thumbsize=220
15050 parsoid=html2wt
15051 !! wikitext
15052 [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
15053 !! html/php
15054 <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>
15055 !! html/parsoid
15056 <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>
15057 !! end
15058
15059 !! test
15060 Manually-specified thumbnail image with explicit link to wiki page
15061 !! options
15062 thumbsize=220
15063 parsoid=wt2html,wt2wt,html2html
15064 !! wikitext
15065 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
15066 !! html/php
15067 <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>
15068 !! html/parsoid
15069 <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>
15070 !! end
15071
15072 !! test
15073 Manually-specified thumbnail image with explicit link to url
15074 !! options
15075 thumbsize=220
15076 parsoid=wt2html,wt2wt,html2html
15077 !! wikitext
15078 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
15079 !! html/php
15080 <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>
15081 !! html/parsoid
15082 <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>
15083 !! end
15084
15085 !! test
15086 Manually-specified thumbnail image with explicit no link
15087 !! options
15088 thumbsize=220
15089 parsoid=wt2html,wt2wt,html2html
15090 !! wikitext
15091 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
15092 !! html/php
15093 <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>
15094 !! html/parsoid
15095 <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>
15096 !! end
15097
15098 !! test
15099 Manually-specified thumbnail image with explicit link and alt text
15100 !! options
15101 thumbsize=220
15102 parsoid=wt2html,wt2wt,html2html
15103 !! wikitext
15104 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
15105 !! html/php
15106 <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>
15107 !! html/parsoid
15108 <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>
15109 !! end
15110
15111 !! test
15112 Image with frame and link
15113 !! options
15114 parsoid=wt2html,wt2wt,html2html
15115 !! wikitext
15116 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
15117 !! html/php
15118 <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>
15119 !! html/parsoid
15120 <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>
15121 !! end
15122
15123 !! test
15124 Image with frame and link and explicit alt
15125 !! options
15126 parsoid=wt2html,wt2wt,html2html
15127 !! wikitext
15128 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
15129 !! html/php
15130 <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>
15131 !! html/parsoid
15132 <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>
15133 !! end
15134
15135 !! test
15136 Image with wiki markup in implicit alt
15137 !! wikitext
15138 [[Image:Foobar.jpg|testing '''bold''' in alt]]
15139
15140 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
15141 !! html/php
15142 <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>
15143 </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>
15144 </p>
15145 !! html/parsoid
15146 <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>
15147
15148 <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>
15149 !! end
15150
15151 !! test
15152 Alt image option should handle most kinds of wikitext without barfing
15153 !! wikitext
15154 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
15155 !! html/php
15156 <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>
15157 !! html/parsoid
15158 <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>
15159 !! end
15160
15161 !! test
15162 Ampersand in alt attribute (T206940)
15163 !! wikitext
15164 [[File:Foobar.jpg|alt=&amp;amp;]]
15165
15166 <!-- consistency with gallery extension -->
15167 <gallery>
15168 File:Foobar.jpg|alt=&amp;amp;
15169 </gallery>
15170 !! html/php+tidy
15171 <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>
15172 </p>
15173 <ul class="gallery mw-gallery-traditional">
15174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15175 <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>
15176 <div class="gallerytext">
15177 </div>
15178 </div></li>
15179 </ul>
15180 !! html/parsoid
15181 <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>
15182
15183 <!-- consistency with gallery extension -->
15184 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15185 <li class="gallerybox" style="width: 155px;">
15186 <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>
15187 <div class="gallerytext"></div>
15188 </li>
15189 </ul>
15190 !! end
15191
15192 ## FIXME: The inconsistency in the gallery extension on the php side is T49646
15193 !! test
15194 Link with encoded pipe in alt option
15195 !! options
15196 parsoid={
15197 "modes": ["wt2html", "html2html"]
15198 }
15199 !! wikitext
15200 [[File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption]]
15201
15202 <!-- consistency with gallery extension -->
15203 <gallery>
15204 File:Foobar.jpg|alt=http://testing.123?4=5&vert;6|caption
15205 </gallery>
15206 !! html/php+tidy
15207 <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>
15208 </p>
15209 <ul class="gallery mw-gallery-traditional">
15210 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15211 <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>
15212 <div class="gallerytext">
15213 </div>
15214 </div></li>
15215 </ul>
15216 !! html/parsoid
15217 <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>
15218
15219 <!-- consistency with gallery extension -->
15220 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15221 <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>
15222 !! end
15223
15224 !! test
15225 Italics markup in alt attribute (T206940)
15226 !! options
15227 parsoid=wt2html,html2html
15228 !! wikitext
15229 [[File:Foobar.jpg|alt=''x''|caption]]
15230
15231 <!-- consistency with gallery extension -->
15232 <gallery>
15233 File:Foobar.jpg|alt=''x''|caption
15234 </gallery>
15235 !! html/php+tidy
15236 <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>
15237 </p>
15238 <ul class="gallery mw-gallery-traditional">
15239 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15240 <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>
15241 <div class="gallerytext">
15242 <p>caption
15243 </p>
15244 </div>
15245 </div></li>
15246 </ul>
15247 !! html/parsoid
15248 <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>
15249
15250 <!-- consistency with gallery extension -->
15251 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt5" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15252 <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>
15253 </ul>
15254 !! end
15255
15256 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15257 ## are no longer in storage.
15258 !! test
15259 Nowiki markup in alt attribute (T206940)
15260 !! options
15261 parsoid=html2wt
15262 !! wikitext
15263 [[File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption]]
15264
15265 <!-- consistency with gallery extension -->
15266 <gallery>
15267 File:Foobar.jpg|alt=<nowiki>''</nowiki>x<nowiki>''</nowiki>|caption
15268 </gallery>
15269 !! html/php+tidy
15270 <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>
15271 </p>
15272 <ul class="gallery mw-gallery-traditional">
15273 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15274 <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>
15275 <div class="gallerytext">
15276 <p>caption
15277 </p>
15278 </div>
15279 </div></li>
15280 </ul>
15281 !! html/parsoid
15282 <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>
15283
15284 <!-- consistency with gallery extension -->
15285 <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"}}'>
15286 <li class="gallerybox" style="width: 155px;">
15287 <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>
15288 <div class="gallerytext">caption</div>
15289 </li>
15290 </ul>
15291 !! end
15292
15293 !! test
15294 Nowiki markup in alt attribute (edited html, no data-parsoid) (T206940)
15295 !! wikitext
15296 [[File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption]]
15297
15298 <!-- consistency with gallery extension -->
15299 <gallery>
15300 File:Foobar.jpg|alt=<nowiki>''x''</nowiki>|caption
15301 </gallery>
15302 !! html/php+tidy
15303 <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>
15304 </p>
15305 <ul class="gallery mw-gallery-traditional">
15306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15307 <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>
15308 <div class="gallerytext">
15309 <p>caption
15310 </p>
15311 </div>
15312 </div></li>
15313 </ul>
15314 !! html/parsoid
15315 <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>
15316
15317 <!-- consistency with gallery extension -->
15318 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt9" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15319 <li class="gallerybox" style="width: 155px;">
15320 <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>
15321 <div class="gallerytext">caption</div>
15322 </li>
15323 </ul>
15324 !! end
15325
15326 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15327 ## are no longer in storage.
15328 !! test
15329 Ampersand in link attribute (T206940)
15330 !! options
15331 parsoid=html2wt
15332 !! wikitext
15333 [[File:Foobar.jpg|link=Foo &amp; bar]]
15334
15335 <!-- consistency with gallery extension -->
15336 <gallery>
15337 File:Foobar.jpg|link=Foo &amp; bar
15338 </gallery>
15339 !! html/php+tidy
15340 <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>
15341 </p>
15342 <ul class="gallery mw-gallery-traditional">
15343 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15344 <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>
15345 <div class="gallerytext">
15346 </div>
15347 </div></li>
15348 </ul>
15349 !! html/parsoid
15350 <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>
15351
15352 <!-- consistency with gallery extension -->
15353 <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"}}'>
15354 <li class="gallerybox">
15355 <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>
15356 <div class="gallerytext"></div>
15357 </li>
15358 </ul>
15359 !! end
15360
15361 !! test
15362 Ampersand in link attribute (edited html, no data-parsoid) (T206940)
15363 !! wikitext
15364 [[File:Foobar.jpg|link=Foo_&_bar]]
15365
15366 <!-- consistency with gallery extension -->
15367 <gallery>
15368 File:Foobar.jpg|link=Foo_&_bar
15369 </gallery>
15370 !! html/php+tidy
15371 <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>
15372 </p>
15373 <ul class="gallery mw-gallery-traditional">
15374 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15375 <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>
15376 <div class="gallerytext">
15377 </div>
15378 </div></li>
15379 </ul>
15380 !! html/parsoid
15381 <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>
15382
15383 <!-- consistency with gallery extension -->
15384 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15385 <li class="gallerybox">
15386 <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>
15387 <div class="gallerytext"></div>
15388 </li>
15389 </ul>
15390 !! end
15391
15392 !! test
15393 Italics markup in link attribute (T206940)
15394 !! options
15395 parsoid=wt2html,html2html
15396 !! wikitext
15397 [[Foo''s bar''s]]
15398
15399 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15400 [[File:Foobar.jpg|link=Foo''s bar''s|caption1]]
15401
15402 [[File:Foobar.jpg|link=''Main Page''|caption2]]
15403
15404 <!-- consistency with gallery extension -->
15405 <gallery>
15406 File:Foobar.jpg|link=Foo''s bar''s|caption1
15407 File:Foobar.jpg|link=''Main Page''|caption2
15408 </gallery>
15409 !! html/php+tidy
15410 <p><a href="/wiki/Foo%27%27s_bar%27%27s" title="Foo&#39;&#39;s bar&#39;&#39;s">Foo''s bar''s</a>
15411 </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>
15412 </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>
15413 </p>
15414 <ul class="gallery mw-gallery-traditional">
15415 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15416 <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>
15417 <div class="gallerytext">
15418 <p>caption1
15419 </p>
15420 </div>
15421 </div></li>
15422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15423 <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>
15424 <div class="gallerytext">
15425 <p>caption2
15426 </p>
15427 </div>
15428 </div></li>
15429 </ul>
15430 !! html/parsoid
15431 <p><a rel="mw:WikiLink" href="./Foo''s_bar''s" title="Foo''s bar''s">Foo''s bar''s</a></p>
15432
15433 <!-- Note that "italics" are stripped, even though this is a valid page title -->
15434 <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>
15435
15436 <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>
15437
15438 <!-- consistency with gallery extension -->
15439 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15440 <li class="gallerybox">
15441 <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>
15442 <div class="gallerytext">caption1</div>
15443 </li>
15444 <li class="gallerybox">
15445 <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>
15446 <div class="gallerytext">caption2</div>
15447 </li>
15448 </ul>
15449 !! end
15450
15451 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
15452 ## are no longer in storage.
15453 !! test
15454 Nowiki markup in link attribute (T206940)
15455 !! options
15456 parsoid=html2wt
15457 !! wikitext
15458 [[File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption]]
15459
15460 <!-- consistency with gallery extension -->
15461 <gallery>
15462 File:Foobar.jpg|link=Foo<nowiki>''</nowiki>s_bar<nowiki>''</nowiki>s|caption
15463 </gallery>
15464 !! html/php+tidy
15465 <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>
15466 </p>
15467 <ul class="gallery mw-gallery-traditional">
15468 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15469 <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>
15470 <div class="gallerytext">
15471 <p>caption
15472 </p>
15473 </div>
15474 </div></li>
15475 </ul>
15476 !! html/parsoid
15477 <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>
15478
15479 <!-- consistency with gallery extension -->
15480 <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"}}'>
15481 <li class="gallerybox">
15482 <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>
15483 <div class="gallerytext">caption</div>
15484 </li>
15485 </ul>
15486 !! end
15487
15488 !! test
15489 Nowiki markup in link attribute (edited html, no data-parsoid) (T206940)
15490 !! wikitext
15491 [[File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption]]
15492
15493 <!-- consistency with gallery extension -->
15494 <gallery>
15495 File:Foobar.jpg|link=Foo<nowiki>''s_bar''</nowiki>s|caption
15496 </gallery>
15497 !! html/php+tidy
15498 <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>
15499 </p>
15500 <ul class="gallery mw-gallery-traditional">
15501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15502 <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>
15503 <div class="gallerytext">
15504 <p>caption
15505 </p>
15506 </div>
15507 </div></li>
15508 </ul>
15509 !! html/parsoid
15510 <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>
15511
15512 <!-- consistency with gallery extension -->
15513 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15514 <li class="gallerybox">
15515 <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>
15516 <div class="gallerytext">caption</div>
15517 </li>
15518 </ul>
15519 !! end
15520
15521 !! test
15522 HTML entity prefix in link markup (T209236)
15523 !! wikitext
15524 [[File:Foobar.jpg|link=https://example.com?foo&params=bar]]
15525
15526 <!-- consistency with gallery extension -->
15527 <gallery>
15528 File:Foobar.jpg|link=https://example.com?foo&params=bar
15529 </gallery>
15530 !! html/php+tidy
15531 <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>
15532 </p>
15533 <ul class="gallery mw-gallery-traditional">
15534 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
15535 <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>
15536 <div class="gallerytext">
15537 </div>
15538 </div></li>
15539 </ul>
15540 !! html/parsoid
15541 <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>
15542
15543 <!-- consistency with gallery extension -->
15544 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
15545 <li class="gallerybox">
15546 <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>
15547 <div class="gallerytext"></div>
15548 </li>
15549 </ul>
15550 !! end
15551
15552 !! test
15553 Image with table with attributes in caption
15554 !! options
15555 parsoid=wt2html,html2html
15556 !! wikitext
15557 [[File:Foobar.jpg|thumb|
15558 {| class="123" |
15559 |- class="456" |
15560 | ha
15561 |}
15562 ]]
15563 !! html/parsoid
15564 <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>
15565 <table class="123">
15566 <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
15567 <td> ha</td></tr>
15568 </tbody></table>
15569 </figcaption></figure>
15570 !! end
15571
15572 !! test
15573 Image with table with rows from templates in caption
15574 !! wikitext
15575 [[File:Foobar.jpg|thumb|
15576 {|
15577 {{echo|{{!}} hi}}
15578 |}
15579 ]]
15580 !! html/parsoid
15581 <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>
15582 <table>
15583 <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>
15584 </tbody></table>
15585 </figcaption></figure>
15586 !! end
15587
15588 !! test
15589 Image with nested tables in caption
15590 !! wikitext
15591 [[File:Foobar.jpg|thumb|Foo<br />
15592 {|
15593 |
15594 {|
15595 |z
15596 |}
15597 |}
15598 ]]
15599 !! html/parsoid
15600 <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}'/>
15601 <table>
15602 <tbody><tr><td>
15603 <table>
15604 <tbody><tr><td>z</td></tr>
15605 </tbody></table></td></tr>
15606 </tbody></table>
15607 </figcaption></figure>
15608 !! end
15609
15610 !! test
15611 Image with heading and horizontal rule in caption
15612 !! wikitext
15613 [[File:Foobar.jpg|thumb|
15614 ===Testing===
15615 123
15616 --------------
15617 ]]
15618 !! html/php
15619 <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>
15620 !! html/parsoid
15621 <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>
15622 <h3 id="Testing">Testing</h3>
15623 123
15624 <hr data-parsoid='{"extra_dashes":10}'/>
15625 </figcaption></figure>
15626 !! end
15627
15628 ###################
15629 # Conflicting image format options.
15630 # First option specified should 'win'.
15631 # All three cases in each test should be identical.
15632
15633 !! test
15634 Image with 'frameless' first.
15635 !! options
15636 parsoid=wt2html,wt2wt,html2html
15637 !! wikitext
15638 [[File:Foobar.jpg|frameless|caption]]
15639
15640 [[File:Foobar.jpg|frameless|frame|caption]]
15641
15642 [[File:Foobar.jpg|frameless|thumb|caption]]
15643 !! html/php
15644 <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>
15645 </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>
15646 </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>
15647 </p>
15648 !! html/parsoid
15649 <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>
15650 <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>
15651 <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>
15652 !! end
15653
15654 !! test
15655 Image with 'frame' first.
15656 !! options
15657 parsoid=wt2html,wt2wt,html2html
15658 !! wikitext
15659 [[File:Foobar.jpg|frame|caption]]
15660 [[File:Foobar.jpg|frame|frameless|caption]]
15661 [[File:Foobar.jpg|frame|thumb|caption]]
15662 !! html/php
15663 <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>
15664 <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>
15665 <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>
15666 !! html/parsoid
15667 <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>
15668 <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>
15669 <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>
15670 !! end
15671
15672 !! test
15673 Image with 'thumb' first.
15674 !! options
15675 parsoid=wt2html,wt2wt,html2html
15676 !! wikitext
15677 [[File:Foobar.jpg|thumb|caption]]
15678 [[File:Foobar.jpg|thumb|frameless|caption]]
15679 [[File:Foobar.jpg|thumb|frame|caption]]
15680 !! html/php
15681 <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>
15682 <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>
15683 <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>
15684 !! html/parsoid
15685 <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>
15686 <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>
15687 <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>
15688 !! end
15689
15690 ###################
15691 # Image sizing.
15692 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
15693 # and https://phabricator.wikimedia.org/T64258
15694 # Foobar has actual size of 1941x220
15695 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
15696 # a scalable format.
15697 # 2. Framed images always ignore size options; always render at default size.
15698 # 3. "Unspecified format" and border are the only types which can be
15699 # enlarged.
15700
15701 !! test
15702 Image: unspecified format and border enlarge
15703 !! options
15704 parsoid=wt2html,wt2wt,html2html
15705 !! wikitext
15706 [[File:Foobar.jpg|2000px]]
15707
15708 [[File:Foobar.jpg|border|2000px]]
15709 !! html/php
15710 <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>
15711 </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>
15712 </p>
15713 !! html/parsoid
15714 <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>
15715 <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>
15716 !! end
15717
15718 !! test
15719 Image: "unspecified format" and border reduce
15720 !! options
15721 parsoid=wt2html,wt2wt,html2html
15722 !! wikitext
15723 [[File:Foobar.jpg|1000px]]
15724
15725 [[File:Foobar.jpg|border|1000px]]
15726 !! html/php
15727 <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>
15728 </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>
15729 </p>
15730 !! html/parsoid
15731 <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>
15732 <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>
15733 !! end
15734
15735 !! test
15736 Image: thumbs reduce
15737 !! options
15738 parsoid=wt2html,wt2wt,html2html
15739 !! wikitext
15740 [[File:Foobar.jpg|thumb|50px]]
15741 !! html/php
15742 <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>
15743 !! html/parsoid
15744 <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>
15745 !! end
15746
15747 !! test
15748 Image: bitmap thumbs can't be enlarged past original size, but vector can.
15749 !! options
15750 parsoid=wt2html,wt2wt,html2html
15751 !! wikitext
15752 [[File:Foobar.jpg|thumb|2000px]]
15753
15754 [[File:Foobar.svg|thumb|2000px]]
15755 !! html/php
15756 <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>
15757 <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>
15758 !! html/parsoid
15759 <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>
15760 <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>
15761 !! end
15762
15763 !! test
15764 Image: frameless can reduce in size
15765 !! options
15766 parsoid=wt2html,wt2wt,html2html
15767 !! wikitext
15768 [[File:Foobar.jpg|frameless|50px]]
15769 !! html/php
15770 <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>
15771 </p>
15772 !! html/parsoid
15773 <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>
15774 !! end
15775
15776 !! test
15777 Image: bitmap frameless can't be enlarged past original size, but vector can
15778 !! options
15779 parsoid=wt2html,wt2wt,html2html
15780 !! wikitext
15781 [[File:Foobar.jpg|frameless|2000px]]
15782
15783 [[File:Foobar.svg|frameless|2000px]]
15784 !! html/php
15785 <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>
15786 </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>
15787 </p>
15788 !! html/parsoid
15789 <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>
15790 <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>
15791 !! end
15792
15793 !! test
15794 Image: framed images are always unscaled.
15795 !! options
15796 parsoid=wt2html,wt2wt,html2html
15797 !! wikitext
15798 [[File:Foobar.jpg|frame]]
15799
15800 [[File:Foobar.jpg|frame|50px]]
15801
15802 [[File:Foobar.jpg|frame|50x50px]]
15803
15804 [[File:Foobar.jpg|frame|2000px]]
15805 !! html/php
15806 <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>
15807 <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>
15808 <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>
15809 <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>
15810 !! html/parsoid
15811 <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>
15812 <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>
15813 <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>
15814 <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>
15815 !! end
15816
15817 ###################
15818
15819 !! test
15820 Link to image page- image page normally doesn't exists, hence edit link
15821 Add test with existing image page
15822 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
15823 !! wikitext
15824 [[:Image:test]]
15825 !! html
15826 <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>
15827 </p>
15828 !! end
15829
15830 !! test
15831 T20784 Link to non-existent image page with caption should use caption as link text
15832 !! wikitext
15833 [[:Image:test|caption]]
15834 !! html
15835 <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>
15836 </p>
15837 !! end
15838
15839 !! test
15840 Frameless image caption with a free URL
15841 !! wikitext
15842 [[File:Foobar.jpg|http://example.com]]
15843 !! html/php
15844 <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>
15845 </p>
15846 !! html/parsoid
15847 <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>
15848 !! end
15849
15850 !! test
15851 Thumbnail image caption with a free URL
15852 !! options
15853 thumbsize=220
15854 !! wikitext
15855 [[File:Foobar.jpg|thumb|http://example.com]]
15856 !! html/php
15857 <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>
15858 !! html/parsoid
15859 <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>
15860 !! end
15861
15862 !! test
15863 Thumbnail image caption with a free URL and explicit alt
15864 !! options
15865 thumbsize=220
15866 parsoid=wt2html,wt2wt,html2html
15867 !! wikitext
15868 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
15869 !! html/php
15870 <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>
15871 !! html/parsoid
15872 <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>
15873 !! end
15874
15875 !! test
15876 SVG thumbnails with no language set
15877 !! options
15878 !! wikitext
15879 [[File:Foobar.svg|thumb|caption]]
15880 !! html/php
15881 <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>
15882 !! html/parsoid
15883 <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>
15884 !! end
15885
15886 !! test
15887 SVG thumbnails with language de
15888 !! options
15889 parsoid=wt2html,wt2wt,html2html
15890 !! wikitext
15891 [[File:Foobar.svg|thumb|caption|lang=de]]
15892 !! html/php
15893 <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>
15894 !! html/parsoid
15895 <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>
15896 !! end
15897
15898 !! test
15899 SVG thumbnails with invalid language code
15900 !! options
15901 parsoid=wt2html,wt2wt,html2html
15902 !! wikitext
15903 [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
15904 !! html/php
15905 <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>
15906 !! html/parsoid
15907 <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>
15908 !! end
15909
15910 !! test
15911 SVG thumbnails in page language
15912 !! options
15913 language=ru
15914 !! wikitext
15915 [[File:Foobar.svg]] [[File:Foobar.svg|lang=en]]
15916 !! html/php
15917 <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>
15918 </p>
15919 !! end
15920
15921 !! test
15922 SVG thumbnails in page language not present in the file
15923 !! options
15924 language=de
15925 !! wikitext
15926 [[File:Foobar.svg]] [[File:Foobar.svg|lang=ru]]
15927 !! html/php
15928 <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>
15929 </p>
15930 !! end
15931
15932 !! test
15933 T3887: A ISBN with a thumbnail
15934 !! wikitext
15935 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
15936 !! html/php
15937 <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>
15938 !! html/parsoid
15939 <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>
15940 !! end
15941
15942 !! test
15943 T3887: A RFC with a thumbnail
15944 !! wikitext
15945 [[File:Foobar.jpg|thumb|This is RFC 12354]]
15946 !! html/php
15947 <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>
15948 !! html/parsoid
15949 <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>
15950 !! end
15951
15952 !! test
15953 T3887: A mailto link with a thumbnail
15954 !! wikitext
15955 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
15956 !! html/php
15957 <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>
15958 !! html/parsoid
15959 <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>
15960 !! end
15961
15962 # Pending resolution to T2368
15963 !! test
15964 T2648: Frameless image caption with a link
15965 !! wikitext
15966 [[File:Foobar.jpg|text with a [[link]] in it]]
15967 !! html/php
15968 <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>
15969 </p>
15970 !! html/parsoid
15971 <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>
15972 !! end
15973
15974 !! test
15975 T2648: Frameless image caption with a link (suffix)
15976 !! wikitext
15977 [[File:Foobar.jpg|text with a [[link]]foo in it]]
15978 !! html/php
15979 <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>
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]]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>
15983 !! end
15984
15985 !! test
15986 T2648: Frameless image caption with an interwiki link
15987 !! wikitext
15988 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
15989 !! html/php
15990 <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>
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 [[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>
15994 !! end
15995
15996 !! test
15997 T2648: Frameless image caption with a piped interwiki link
15998 !! wikitext
15999 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
16000 !! html/php
16001 <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>
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|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>
16005 !! end
16006
16007 !! test
16008 T107474: Frameless image caption with <nowiki>
16009 !! wikitext
16010 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
16011 !! html/parsoid
16012 <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>
16013 !! end
16014
16015 !! test
16016 Escape HTML special chars in image alt text
16017 !! wikitext
16018 [[File:Foobar.jpg|& < > "]]
16019 !! html/php
16020 <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>
16021 </p>
16022 !! html/parsoid
16023 <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>
16024 !! end
16025
16026 !! test
16027 Escape HTML special chars in image alt text with LanguageConverter
16028 !! options
16029 language=zh
16030 !! wikitext
16031 [[File:Foobar.jpg|& < > "]]
16032 !! html/php
16033 <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>
16034 </p>
16035 !! html/parsoid
16036 <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>
16037 !! end
16038
16039 !! test
16040 Entities in file name and attributes
16041 !! wikitext
16042 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
16043 !! html/php
16044 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
16045 </p>
16046 !! html/parsoid
16047 <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>
16048 !! end
16049
16050 !! test
16051 T2499: Alt text should have &#1234;, not &amp;1234;
16052 !! wikitext
16053 [[File:Foobar.jpg|&#9792;]]
16054 !! html/php
16055 <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>
16056 </p>
16057 !! html/parsoid
16058 <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>
16059 !! end
16060
16061 !! test
16062 Broken image caption with link
16063 !! options
16064 parsoid=wt2html,wt2wt,html2html
16065 !! wikitext
16066 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
16067 !! html/php
16068 <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.
16069 </p>
16070 !! html/parsoid
16071 <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>
16072 !! end
16073
16074 !! test
16075 Image caption containing another image
16076 !! wikitext
16077 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
16078 !! html/php
16079 <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>
16080 !! html/parsoid
16081 <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>
16082 !! end
16083
16084 !! test
16085 Image: caption containing a newline
16086 !! wikitext
16087 [[File:Foobar.jpg|This
16088 *is some text]]
16089 !! html/php
16090 <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>
16091 </p>
16092 !! html/parsoid
16093 <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>
16094 !!end
16095
16096 !!test
16097 Image: caption containing leading space
16098 (The leading space should not trigger nowiki escaping in wt2wt mode)
16099 !! wikitext
16100 [[File:Foobar.jpg|thumb| bar]]
16101 !! html/php
16102 <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>
16103 !! html/parsoid
16104 <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>
16105 !!end
16106
16107 # html/php output not have newlines after table, td, th, etc. because
16108 # Linker::makeThumbLink2() replaces the newlines with spaces since
16109 # the table is inside a caption.
16110 # FIXME: Verify if that circa 2004 fix is still required.
16111 !! test
16112 Image: caption containing a table
16113 !! options
16114 parsoid=wt2html,wt2wt,html2html
16115 !! wikitext
16116 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
16117 {|
16118 !Foo!!Bar
16119 |-
16120 |Foo1||Bar1
16121 |}
16122 and some more text.]]
16123 !! html/php
16124 <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>
16125 !! html/parsoid
16126 <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
16127 <table>
16128 <tbody>
16129 <tr><th>Foo</th><th>Bar</th></tr>
16130 <tr>
16131 <td>Foo1</td>
16132 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
16133 !! end
16134
16135 !! test
16136 T5090: External links other than http: in image captions
16137 !! wikitext
16138 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
16139 !! html/php
16140 <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>
16141 !! html/parsoid
16142 <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>
16143 !! end
16144
16145 !! test
16146 Custom class
16147 !! options
16148 parsoid=wt2html,wt2wt,html2html
16149 !! wikitext
16150 [[Image:foobar.jpg|a|class=b]]
16151 !! html/php
16152 <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>
16153 </p>
16154 !! html/parsoid
16155 <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>
16156 !! end
16157
16158 !! test
16159 Localized image handling (1).
16160 !! options
16161 parsoid=wt2html,wt2wt,html2html
16162 language=es
16163 !! wikitext
16164 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
16165 !! html/php
16166 <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>
16167 !! html/parsoid
16168 <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>
16169 !! end
16170
16171 !! test
16172 Localized image handling (2).
16173 !! options
16174 thumbsize=220
16175 parsoid=wt2html,wt2wt,html2html
16176 language=es
16177 !! wikitext
16178 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
16179 !! html/php
16180 <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>
16181 !! html/parsoid
16182 <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>
16183 !! end
16184
16185 !! test
16186 Localized image handling (3).
16187 !! options
16188 language=fa
16189 parsoid=html2wt
16190 !! html/parsoid
16191 <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>
16192 !! wikitext
16193 [[File:Foobar.jpg|بندانگشتی]]
16194 !! end
16195
16196 !! test
16197 "border", "frameless" and "class" attributes on an image.
16198 !! options
16199 thumbsize=220
16200 parsoid=wt2html,wt2wt,html2html
16201 !! wikitext
16202 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
16203 !! html/php
16204 <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>
16205 </p>
16206 !! html/parsoid
16207 <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>
16208 !! end
16209
16210 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
16211 !! test
16212 Invalid image attributes (T64500)
16213 !! options
16214 thumbsize=220
16215 parsoid=wt2html,wt2wt,html2html
16216 !! wikitext
16217 [[File:Foobar.jpg|thumb|float|left|caption]]
16218
16219 [[File:Foobar.jpg|thumb|righ|caption]]
16220
16221 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
16222 !! html/php
16223 <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>
16224 <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>
16225 <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>
16226 !! html/parsoid
16227 <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>
16228 <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>
16229 <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>
16230 !! end
16231
16232 !! article
16233 File:Barfoo.jpg
16234 !! text
16235 #REDIRECT [[File:Barfoo.jpg]]
16236 !! endarticle
16237
16238 # FIXME: Parsoid should run this test -- but we'd need to teach the
16239 # mockAPI about the redirected Barfoo.jpg image.
16240 !! test
16241 Redirected image
16242 !! wikitext
16243 [[Image:Barfoo.jpg]]
16244 !! html/php
16245 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
16246 </p>
16247 !! end
16248
16249 ## FIXME: Parsoid needs to learn about this flag.
16250 !! test
16251 Missing image with uploads disabled
16252 !! options
16253 wgEnableUploads=0
16254 !! wikitext
16255 [[File:Foobaz.jpg]]
16256 !! html/php
16257 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
16258 </p>
16259 !! html/parsoid
16260 <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>
16261 !! end
16262
16263 # Parsoid-specific testing for images
16264 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
16265 # Currently imperfect due to a flaw in the Parsoid testrunner
16266 # Work in progress
16267 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
16268 # image tests.
16269
16270 !! test
16271 Parsoid-specific image handling - simple image with size and middle alignment
16272 !! wikitext
16273 [[File:Foobar.jpg|middle|50px]]
16274 !! html/parsoid
16275 <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>
16276 !! end
16277
16278 !! test
16279 Parsoid-specific image handling - simple image with size, middle alignment, non-standard namespace alias
16280 !! options
16281 parsoid=wt2wt,wt2html,html2html
16282 !! wikitext
16283 [[Image:Foobar.jpg|middle|50px]]
16284 !! html/parsoid
16285 <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>
16286 !! end
16287
16288 !! test
16289 Parsoid-specific image handling - simple image with size and middle alignment (existing content)
16290 !! wikitext
16291 [[File:Foobar.jpg|50px|middle]]
16292 !! html/parsoid
16293 <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>
16294 !! end
16295
16296 !! test
16297 Parsoid-specific image handling - simple image with size and middle alignment and non-standard namespace name
16298 !! options
16299 parsoid=wt2html,wt2wt,html2html
16300 !! wikitext
16301 [[Image:Foobar.jpg|50px|middle]]
16302 !! html/parsoid
16303 <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>
16304 !! end
16305
16306 !! test
16307 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
16308 !! wikitext
16309 [[File:Foobar.jpg|500x10px|baseline|caption]]
16310 !! html/parsoid
16311 <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>
16312 !! end
16313
16314 !! test
16315 Parsoid-specific image handling - simple image with border and size spec
16316 !! wikitext
16317 [[File:Foobar.jpg|50px|border|caption]]
16318 !! html/parsoid
16319 <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>
16320 !! end
16321
16322 !! test
16323 Parsoid-specific image handling - thumbnail with halign, valign, and caption
16324 !! options
16325 parsoid=wt2html,html2html
16326 !! wikitext
16327 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
16328 !! html/parsoid
16329 <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>
16330 !! end
16331
16332 !! test
16333 Parsoid-specific image handling - thumbnail with halign, valign, and caption (existing content)
16334 !! options
16335 parsoid=wt2html,html2html
16336 !! wikitext
16337 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
16338 !! html/parsoid
16339 <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>
16340 !! end
16341
16342 !! test
16343 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
16344 !! options
16345 parsoid=wt2html,html2html
16346 !! wikitext
16347 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
16348 !! html/parsoid
16349 <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>
16350 !! end
16351
16352 !! test
16353 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption (existing content)
16354 !! options
16355 parsoid=wt2html,html2html
16356 !! wikitext
16357 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
16358 !! html/parsoid
16359 <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>
16360 !! end
16361
16362 !! test
16363 Parsoid-specific image handling - framed image with specific size and caption (size is ignored)
16364 !! options
16365 parsoid=wt2html,wt2wt,html2html
16366 !! wikitext
16367 [[File:Foobar.jpg|frame|500x50px|caption]]
16368 !! html/parsoid
16369 <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>
16370 !! end
16371
16372 !! test
16373 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption (size is ignored)
16374 !! options
16375 parsoid=wt2html,html2html
16376 !! wikitext
16377 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
16378 !! html/parsoid
16379 <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>
16380 !! end
16381
16382 !! test
16383 Parsoid-specific image handling - frameless image with specific size, border, and caption
16384 !! wikitext
16385 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
16386 !! html/parsoid
16387 <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>
16388 !! end
16389
16390 !! test
16391 Parsoid-specific image handling - simple image with a formatted caption
16392 !! wikitext
16393 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
16394 !! html/parsoid
16395 <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>
16396 !! end
16397
16398 !! test
16399 Parsoid-specific image handling - caption with a template in it
16400 !! wikitext
16401 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
16402 !! html/parsoid
16403 <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>
16404 !! end
16405
16406 !! test
16407 Parsoid-specific image handling - caption with unbalanced tags in it
16408 !! options
16409 parsoid=wt2html,wt2wt,html2html
16410 !! wikitext
16411 foo
16412 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
16413 bar
16414 !! html/parsoid
16415 <p>foo</p>
16416 <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>
16417 <p>bar</p>
16418 !! end
16419
16420 !! test
16421 Parsoid-specific image handling - empty caption (1)
16422 !! options
16423 parsoid=wt2html,wt2wt
16424 !! wikitext
16425 [[File:Foobar.jpg|thumb|]]
16426 !! html/parsoid
16427 <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>
16428 !! end
16429
16430 # empty captions don't get serialized unless we're in the "round trip" case
16431 !! test
16432 Parsoid-specific image handling - empty caption (2)
16433 !! options
16434 parsoid=html2wt
16435 !! html/parsoid
16436 <figure class="mw-default-size" typeof="mw:Image/Thumb">
16437 <a href="./File:Foobar.jpg">
16438 <img resource="./File:Foobar.jpg"
16439 src="//example.com/images/3/3a/Foobar.jpg"
16440 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
16441 height="25" width="220"/>
16442 </a>
16443 <figcaption></figcaption>
16444 </figure>
16445 !! wikitext
16446 [[File:Foobar.jpg|thumb]]
16447 !! end
16448
16449 !! test
16450 Parsoid-specific image handling - whitespace caption
16451 !! wikitext
16452 [[File:Foobar.jpg|thumb| ]]
16453 !! html/parsoid
16454 <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>
16455 !! end
16456
16457 !! test
16458 Parsoid-specific image handling - lang option
16459 !! wikitext
16460 foo
16461 [[File:Foobar.svg|lang=de|caption]]
16462 bar
16463 !! html/parsoid
16464 <p>foo
16465 <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>
16466 bar</p>
16467 !! end
16468
16469 ## Edge case bugs in Parsoid from T93580
16470 !! test
16471 T93580: 1. Templated <ref> inside block images
16472 !! wikitext
16473 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
16474
16475 <references />
16476 !! html/parsoid
16477 <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>
16478
16479 <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>
16480 !! end
16481
16482 !! test
16483 T93580: 2. <ref> inside inline images
16484 !! wikitext
16485 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
16486
16487 <references />
16488 !! html/parsoid
16489 <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>
16490
16491 <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>
16492 !! end
16493
16494 !! test
16495 T93580: 3. Templated <ref> inside inline images
16496 !! wikitext
16497 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
16498
16499 <references />
16500 !! html/parsoid
16501 <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>
16502
16503 <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>
16504 !! end
16505
16506 ###
16507 ### Subpages
16508 ###
16509 !! article
16510 Subpage test/subpage
16511 !! text
16512 foo
16513 !! endarticle
16514
16515 !! test
16516 Subpage link
16517 !! options
16518 subpage title=[[Subpage test]]
16519 !! wikitext
16520 [[/subpage]]
16521 !! html
16522 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
16523 </p>
16524 !! end
16525
16526 !! test
16527 Subpage noslash 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 !! article
16538 Subpage test/1/2/subpage
16539 !! text
16540 blah
16541 !! endarticle
16542
16543 !! test
16544 Relative subpage noslash link
16545 !! options
16546 parsoid=wt2wt,wt2html,html2html
16547 subpage title=[[Subpage test/1/2/3/4]]
16548 !! wikitext
16549 [[../../subpage/]]
16550
16551 [[../../subpage]]
16552 !! html/php
16553 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
16554 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
16555 </p>
16556 !! html/parsoid
16557 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
16558 <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
16559 !! end
16560
16561 !! test
16562 Parsoid: dot-slash prefixed wikilinks
16563 !! wikitext
16564 [[./foo]]
16565
16566 [[././bar]]
16567
16568 [[././baz/]]
16569 !! html/php
16570 <p>[[./foo]]
16571 </p><p>[[././bar]]
16572 </p><p>[[././baz/]]
16573 </p>
16574 !! html/parsoid
16575 <p>[[./foo]]
16576 </p><p>[[././bar]]
16577 </p><p>[[././baz/]]
16578 </p>
16579 !! end
16580
16581 !! test
16582 Render invalid page names as plain text (T53090)
16583 !! wikitext
16584 [[./../foo|bar]]
16585 [[foo�|bar]]
16586 [[foo/.|bar]]
16587 [[foo/..|bar]]
16588 [[foo~~~bar]]
16589 [[foo>bar]]
16590 [[foo[bar]]
16591 [[.]]
16592 [[..]]
16593 [[foo././bar]]
16594 [[foo[http://example.com]xyz]]
16595
16596 [[{{echo|./../foo}}|bar]]
16597 [[{{echo|foo/.}}|bar]]
16598 [[{{echo|foo/..}}|bar]]
16599 [[{{echo|foo~~~~bar}}]]
16600 [[{{echo|foo>bar}}]]
16601 [[{{echo|foo././bar}}]]
16602 [[{{echo|foo{bar}}]]
16603 [[{{echo|foo}bar}}]]
16604 [[{{echo|foo[bar}}]]
16605 [[{{echo|foo]bar}}]]
16606 [[{{echo|foo<bar}}]]
16607 !!html/php
16608 <p>[[./../foo|bar]]
16609 [[foo�|bar]]
16610 [[foo/.|bar]]
16611 [[foo/..|bar]]
16612 [[foo~~~bar]]
16613 [[foo&gt;bar]]
16614 [[foo[bar]]
16615 [[.]]
16616 [[..]]
16617 [[foo././bar]]
16618 [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
16619 </p><p>[[./../foo|bar]]
16620 [[foo/.|bar]]
16621 [[foo/..|bar]]
16622 [[foo~~~~bar]]
16623 [[foo&gt;bar]]
16624 [[foo././bar]]
16625 [[foo{bar]]
16626 [[foo}bar]]
16627 [[foo[bar]]
16628 [[foo]bar]]
16629 [[foo&lt;bar]]
16630 </p>
16631 !!html/parsoid
16632 <p>[[./../foo|bar]]
16633 [[foo�|bar]]
16634 [[foo/.|bar]]
16635 [[foo/..|bar]]
16636 [[foo~~~bar]]
16637 [[foo>bar]]
16638 [[foo[bar]]
16639 [[.]]
16640 [[..]]
16641 [[foo././bar]]
16642 [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
16643
16644 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
16645 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
16646 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
16647 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
16648 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
16649 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
16650 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
16651 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
16652 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
16653 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
16654 [[<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>
16655 !!end
16656
16657 !! test
16658 Disabled subpages
16659 !! wikitext
16660 [[/subpage]]
16661 !! html
16662 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
16663 </p>
16664 !! end
16665
16666 !! test
16667 T2561: {{/Subpage}}
16668 !! options
16669 subpage title=[[Page]]
16670 !! wikitext
16671 {{/Subpage}}
16672 !! html
16673 <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>
16674 </p>
16675 !! end
16676
16677 ###
16678 ### Categories
16679 ###
16680 !! article
16681 Category:MediaWiki User's Guide
16682 !! text
16683 blah
16684 !! endarticle
16685
16686 !! test
16687 Link to category
16688 !! wikitext
16689 [[:Category:MediaWiki User's Guide]]
16690 !! html
16691 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
16692 </p>
16693 !! end
16694
16695 !! test
16696 Simple category
16697 !! options
16698 cat
16699 !! wikitext
16700 [[Category:MediaWiki User's Guide]]
16701 !! html/php
16702 cat=MediaWiki_User's_Guide sort=
16703 !! html/parsoid
16704 <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"}}'/>
16705 !! end
16706
16707 !! test
16708 PAGESINCATEGORY invalid title fatal (r33546 fix)
16709 !! wikitext
16710 {{PAGESINCATEGORY:<bogus>}}
16711 !! html
16712 <p>0
16713 </p>
16714 !! end
16715
16716 !! test
16717 Category with different sort key
16718 !! options
16719 cat
16720 !! wikitext
16721 [[Category:MediaWiki User's Guide|Foo]]
16722 !! html/php
16723 cat=MediaWiki_User's_Guide sort=Foo
16724 !! html/parsoid
16725 <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"}}'/>
16726 !! end
16727
16728 !! test
16729 Category with identical sort key
16730 !! options
16731 cat
16732 !! wikitext
16733 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16734 !! html/php
16735 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
16736 !! html/parsoid
16737 <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"}}'/>
16738 !! end
16739
16740 !! test
16741 Category with empty sort key
16742 !! options
16743 cat
16744 pst
16745 !! wikitext
16746 [[Category:MediaWiki User's Guide|]]
16747 !! html/php
16748 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
16749 !! end
16750
16751 !! test
16752 Category with empty sort key and parentheses
16753 !! options
16754 cat
16755 pst
16756 !! wikitext
16757 [[Category:Foo (bar)|]]
16758 !! html/php
16759 [[Category:Foo (bar)|Foo]]
16760 !! end
16761
16762 !! test
16763 Category with link tail
16764 !! options
16765 cat
16766 pst
16767 !! wikitext
16768 123[[Category:Foo]]456
16769 !! html/php
16770 123[[Category:Foo]]456
16771 !! end
16772
16773 !! test
16774 Category with template
16775 !! options
16776 cat
16777 pst
16778 !! wikitext
16779 [[Category:{{echo|Foo}}]]
16780 !! html/php
16781 [[Category:{{echo|Foo}}]]
16782 !! end
16783
16784 !! test
16785 Category with template in sort key
16786 !! options
16787 cat
16788 pst
16789 !! wikitext
16790 [[Category:Foo|{{echo|Bar}}]]
16791 !! html/php
16792 [[Category:Foo|{{echo|Bar}}]]
16793 !! end
16794
16795 !! test
16796 Category with template in sort key and title
16797 !! options
16798 cat
16799 pst
16800 !! wikitext
16801 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16802 !! html/php
16803 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
16804 !! end
16805
16806 ## We used to, but no longer wt2wt this test since the default serializer
16807 ## will normalize all categories to serialize on their own line.
16808 ## This wikitext usage is going to be fairly uncommon in production and
16809 ## selser will take care of preserving formatting in those scenarios.
16810 !! test
16811 Category / paragraph interactions
16812 !! options
16813 parsoid=wt2html
16814 !! wikitext
16815 Foo [[Category:Baz]] Bar
16816
16817 Foo [[Category:Baz]]
16818 Bar
16819
16820 Foo
16821 [[Category:Baz]]
16822 Bar
16823
16824 Foo
16825 [[Category:Baz]] Bar
16826
16827 Foo
16828 [[Category:Baz]]
16829 [[Category:Baz]]
16830 [[Category:Baz]]
16831 Bar
16832
16833 [[Category:Baz]]
16834 [[Category:Baz]]
16835 [[Category:Baz]]
16836
16837 [[Category:Baz]]
16838 {{echo|[[Category:Baz]]}}
16839 [[Category:Baz]]
16840 !! html/php
16841 <p>Foo Bar
16842 </p><p>Foo
16843 Bar
16844 </p><p>Foo
16845 Bar
16846 </p><p>Foo Bar
16847 </p><p>Foo
16848 Bar
16849 </p>
16850 !! html/parsoid
16851 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16852 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16853 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16854 <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
16855 <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>
16856 <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}}]}'/>
16857 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16858 !! end
16859
16860 ## We used to, but no longer wt2wt this test since the default serializer
16861 ## will normalize all categories to serialize on their own line.
16862 ## This wikitext usage is going to be fairly uncommon in production and
16863 ## selser will take care of preserving formatting in those scenarios.
16864 ##
16865 ## The whitespace on the empty line is part of the test. Please do not delete
16866 !! test
16867 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16868 !! options
16869 parsoid=wt2html
16870 !! wikitext
16871 This
16872
16873 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
16874
16875 {{echo|[[Category:Foo]] and so should this!}}
16876 !! html/php
16877 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
16878 </p>
16879 !! html/parsoid
16880 <p>This
16881
16882 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
16883
16884 <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>
16885 !! end
16886
16887 ## Parsoid will not try to wt2wt this while preserving newlines because
16888 ## it suppresses excess newlines within list items -- and we don't want to
16889 ## introduce a special case just for categories, which is, in reality somewhat
16890 ## odd behavior -- categories are unlikely to be used in list items like this
16891 ## in top-level pages and are only likely to show up in template-generated
16892 ## list items where this RT-ing is a non-issue.
16893 ##
16894 ## The whitespace on the empty line is part of the test. Please do not delete
16895 !! test
16896 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
16897 !! options
16898 parsoid=wt2html
16899 !! wikitext
16900 * This
16901
16902 [[Category:Foo]] and this should be part of the same list item
16903 * So should this
16904
16905 {{echo|[[Category:Foo]] and this should be part of the same list item}}
16906 !! html/php+tidy
16907 <ul><li>This and this should be part of the same list item</li>
16908 <li>So should this and this should be part of the same list item</li></ul>
16909 !! html/parsoid
16910 <ul>
16911 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
16912 <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>
16913 </ul>
16914 !! end
16915
16916 ## Newlines and categories that follow the last item of a list
16917 ## are treated differently because this (list followed by categories)
16918 ## is an extremely common pattern on wikis.
16919 !! test
16920 3. Categories and newlines: newline suppression for last list item should RT properly
16921 !! wikitext
16922 *a
16923 *b
16924
16925 [[Category:Foo]]
16926
16927 [[Category:Bar]]
16928 [[Category:Baz]]
16929
16930 :c
16931
16932 [[Category:C]]
16933
16934 ;d
16935
16936 [[Category:D]]
16937 !! html/parsoid
16938 <ul><li>a</li>
16939 <li>b</li></ul>
16940
16941 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
16942
16943 <link rel="mw:PageProp/Category" href="./Category:Bar"/>
16944 <link rel="mw:PageProp/Category" href="./Category:Baz"/>
16945
16946 <dl><dd>c</dd></dl>
16947
16948 <link rel="mw:PageProp/Category" href="./Category:C"/>
16949
16950 <dl><dt>d</dt></dl>
16951
16952 <link rel="mw:PageProp/Category" href="./Category:D"/>
16953 !! end
16954
16955 !! test
16956 4. Categories and newlines: newline suppression for last list item should RT properly
16957 !! wikitext
16958 *a
16959 ****b
16960
16961 [[Category:Foo]]
16962 !! html/parsoid
16963 <ul><li>a
16964 <ul><li><ul><li><ul><li>b</li></ul></li></ul></li></ul></li></ul>
16965
16966 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16967 !! end
16968
16969 ## only wt2html for this to make sure the algo only applies to the rightmost path
16970 !! test
16971 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
16972 !! options
16973 parsoid=wt2html
16974 !! wikitext
16975 *a
16976 **b
16977 [[Category:Foo]]
16978 *c
16979 **d
16980 [[Category:Foo]]
16981 !! html/parsoid
16982 <ul><li>a
16983 <ul><li>b
16984 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
16985 <li>c
16986 <ul><li>d</li></ul></li></ul>
16987 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
16988 !! end
16989
16990 ## We used to, but no longer wt2wt this test since the default serializer
16991 ## will normalize all categories to serialize on their own line.
16992 ## This wikitext usage is going to be fairly uncommon in production and
16993 ## selser will take care of preserving formatting in those scenarios.
16994 !! test
16995 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
16996 !! options
16997 parsoid=wt2html
16998 !! wikitext
16999 *a [[Category:Foo]]
17000 !! html/parsoid
17001 <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>
17002 !! end
17003
17004 # This test also demonstrates because of newline+category tunneling
17005 # through the list hander, template wrapping doesn't expand to the
17006 # containing list when the list item swallows the category.
17007 !! test
17008 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
17009 !! wikitext
17010 *{{echo|a
17011 [[Category:Foo]]}}
17012 !! html/parsoid
17013 <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
17014 </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>
17015 !! end
17016
17017 !! test
17018 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
17019 !! wikitext
17020 *a
17021
17022 {{echo|[[Category:Foo]]
17023 [[Category:Bar]]}}
17024 [[Category:Baz]]
17025 !! html/parsoid
17026 <ul><li>a</li></ul>
17027
17028 <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">
17029 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
17030 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
17031 !! end
17032
17033 !! test
17034 Categories and newlines: migrateTrailingCategories dom pass should not get tripped by comments and whitespace
17035 !! wikitext
17036 *a
17037
17038 [[Category:Bar]]<!--boo1--> <!--boo2-->
17039 [[Category:Baz]]<!--boo3--> <!--boo4-->
17040 !! html/parsoid
17041 <ul><li>a</li></ul>
17042
17043 <link rel="mw:PageProp/Category" href="./Category:Bar"/><!--boo1--> <!--boo2-->
17044 <link rel="mw:PageProp/Category" href="./Category:Baz"/><!--boo3--> <!--boo4-->
17045 !! end
17046
17047 !! test
17048 Categories and newlines: should behave properly with linkprefix (T87753)
17049 !! options
17050 language=ar
17051 !! wikitext
17052 foo bar
17053 foo bar
17054 [[تصنيف:Foo]]
17055 [[تصنيف:Bar]]
17056 !! html/php
17057 <p>foo bar
17058 foo bar
17059 </p>
17060 !! html/parsoid
17061 <p>foo bar
17062 foo bar</p>
17063 <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
17064 <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
17065 !! end
17066
17067 !! test
17068 No regressions on internal links following category (T174639)
17069 !! options
17070 parsoid=wt2html,html2html
17071 !! wikitext
17072 [[Category:Foo]]<div>a
17073
17074 [[Foo]]</div>
17075 !! html/php
17076 <div>a
17077 <a href="/wiki/Foo" title="Foo">Foo</a></div>
17078 !! html/parsoid
17079 <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
17080
17081 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
17082 !! end
17083
17084 # Note that Parsoid differs slightly from PHP due to T175421
17085 !! test
17086 11. Special case where only newlines separate links (T175416)
17087 !! options
17088 parsoid=wt2html,html2html
17089 !! wikitext
17090 [[Category:Foo]]
17091
17092 [[Foo]][[es:Alimento]]
17093
17094 [[Foo]]
17095 !! html/php
17096 <p><br />
17097 <a href="/wiki/Foo" title="Foo">Foo</a>
17098 </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
17099 </p>
17100 !! html/parsoid
17101 <link rel="mw:PageProp/Category" href="./Category:Foo"/>
17102
17103 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17104
17105 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
17106 !! end
17107
17108 !! test
17109 Category links with multiple namespaces
17110 !! wikitext
17111 [[Category:Project:Foo]]
17112 !! html/parsoid
17113 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
17114 !! end
17115
17116 !! test
17117 Parsoid: Serialize link to category page with colon escape
17118 !! wikitext
17119
17120 [[:Category:Foo]]
17121 [[:Category:Foo|Bar]]
17122 !! html/php+tidy
17123 <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>
17124 <a href="/index.php?title=Category:Foo&amp;action=edit&amp;redlink=1" class="new" title="Category:Foo (page does not exist)">Bar</a>
17125 </p>
17126 !! html/parsoid
17127 <p>
17128 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
17129 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
17130 </p>
17131 !! end
17132
17133 # We used to, but no longer wt2wt this test since the default serializer
17134 # will normalize all categories to serialize on their own line.
17135 # This wikitext usage is going to be fairly uncommon in production and
17136 # selser will take care of preventing whitespace insertion if this
17137 # occurs in an article.
17138 #
17139 # html2html disabled for the same reason (whitespace insertion between
17140 # x and y).
17141 #
17142 # html2wt disabled because it localizes the "Category" namespace.
17143 !! test
17144 Link prefix/suffixes aren't applied to category links
17145 !! options
17146 parsoid=wt2html
17147 language=is
17148 !! wikitext
17149 x[[Category:Foo]]y
17150 !! html/php
17151 <p>xy
17152 </p>
17153 !! html/parsoid
17154 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
17155 !! end
17156
17157 !! test
17158 Link prefix/suffixes aren't applied to language links
17159 !! options
17160 parsoid=wt2html
17161 language=is
17162 !! wikitext
17163 x[[es:Foo]]y
17164 !! html/php
17165 <p>xy
17166 </p>
17167 !! html/parsoid
17168 <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
17169 !! end
17170
17171 !! test
17172 Parsoid: Serialize link to file page with colon escape
17173 !! wikitext
17174
17175 [[:File:Foo.png]]
17176 [[:File:Foo.png|Bar]]
17177 !! html/php+tidy
17178 <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>
17179 <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>
17180 </p>
17181 !! html/parsoid
17182 <p>
17183 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
17184 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
17185 </p>
17186 !! end
17187
17188 !! test
17189 Parsoid: Serialize a genuine category link without colon escape
17190 !! wikitext
17191 [[Category:Foo]]
17192 [[Category:Foo|Bar]]
17193 !! html/php+tidy
17194 !! html/parsoid
17195 <link rel="mw:PageProp/Category" href="./Category:Foo">
17196 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
17197 !! end
17198
17199 !! test
17200 Normalize hrefs properly before testing for invalid link targets (T72894)
17201 !! options
17202 parsoid=html2wt
17203 !! html/parsoid
17204 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
17205 !! wikitext
17206 [[Category:Toxine bactérienne]]
17207 !! end
17208
17209 !! test
17210 Parsoid: Defaultsort
17211 !! wikitext
17212 {{DEFAULTSORT:Foo}}
17213 !! html/parsoid
17214 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
17215 !! end
17216
17217 # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
17218 # But, this is a limitation of our representation and is documented in
17219 # TemplateHandler.js in processSpecialMagicWord
17220 !! test
17221 Parsoid: Defaultsort (template-generated)
17222 !! wikitext
17223 {{{{echo|DEFAULTSORT}}:Foo}}
17224 !! html/parsoid
17225 <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"}]]}'/>
17226 !! end
17227
17228 ###
17229 ### Inter-language links
17230 ###
17231 !! test
17232 Interlanguage links
17233 !! options
17234 ill
17235 !! wikitext
17236 [[es:Alimento]]
17237 [[fr:Nourriture]]
17238 [[zh:食品]]
17239 !! html/php
17240 es:Alimento fr:Nourriture zh:食品
17241 !! html/parsoid
17242 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
17243 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
17244 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
17245 !! end
17246
17247 !! test
17248 Duplicate interlanguage links (T26502)
17249 !! options
17250 ill
17251 !! wikitext
17252 [[es:1]]
17253 [[es:2]]
17254 [[fr:1]]
17255 [[fr:2]]
17256 !! html/php
17257 es:1 fr:1
17258 !! html/parsoid
17259 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
17260 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
17261 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
17262 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
17263 !! end
17264
17265 ###
17266 ### Sections
17267 ###
17268 !! test
17269 Basic section headings
17270 !! wikitext
17271 ==Headline 1==
17272 Some text
17273
17274 ==Headline 2==
17275 More
17276 ===Smaller headline===
17277 Blah blah
17278 !! html
17279 <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>
17280 <p>Some text
17281 </p>
17282 <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>
17283 <p>More
17284 </p>
17285 <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>
17286 <p>Blah blah
17287 </p>
17288 !! end
17289
17290 !! test
17291 Section headings with TOC
17292 !! wikitext
17293 ==Headline 1==
17294 ===Subheadline 1===
17295 =====Skipping a level=====
17296 ======Skipping a level======
17297
17298 ==Headline 2==
17299 Some text
17300 ===Another headline===
17301 !! html
17302 <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>
17303 <ul>
17304 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
17305 <ul>
17306 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
17307 <ul>
17308 <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>
17309 <ul>
17310 <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>
17311 </ul>
17312 </li>
17313 </ul>
17314 </li>
17315 </ul>
17316 </li>
17317 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
17318 <ul>
17319 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
17320 </ul>
17321 </li>
17322 </ul>
17323 </div>
17324
17325 <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>
17326 <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>
17327 <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>
17328 <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>
17329 <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>
17330 <p>Some text
17331 </p>
17332 <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>
17333 !! end
17334
17335 !! test
17336 TOC anchors don't collide
17337 !! wikitext
17338 __FORCETOC__
17339 ==Headline 2==
17340 ==Headline==
17341 ==Headline 2==
17342 ==Headline==
17343 !! html/php
17344 <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>
17345 <ul>
17346 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
17347 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
17348 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
17349 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
17350 </ul>
17351 </div>
17352
17353 <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>
17354 <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>
17355 <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>
17356 <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>
17357 !! end
17358
17359 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
17360 # Parsoid html2wt direction adds <nowiki> for level 7 and up.
17361 !! test
17362 Handling of sections up to level 6 and beyond
17363 !! options
17364 parsoid=wt2html
17365 !! wikitext
17366 =Level 1 Heading=
17367 ==Level 2 Heading==
17368 ===Level 3 Heading===
17369 ====Level 4 Heading====
17370 =====Level 5 Heading=====
17371 ======Level 6 Heading======
17372 =======Level 7 Heading=======
17373 ========Level 8 Heading========
17374 =========Level 9 Heading=========
17375 ==========Level 10 Heading==========
17376 !! html/php
17377 <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>
17378 <ul>
17379 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
17380 <ul>
17381 <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>
17382 <ul>
17383 <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>
17384 <ul>
17385 <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>
17386 <ul>
17387 <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>
17388 <ul>
17389 <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>
17390 <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>
17391 <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>
17392 <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>
17393 <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>
17394 </ul>
17395 </li>
17396 </ul>
17397 </li>
17398 </ul>
17399 </li>
17400 </ul>
17401 </li>
17402 </ul>
17403 </li>
17404 </ul>
17405 </div>
17406
17407 <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>
17408 <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>
17409 <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>
17410 <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>
17411 <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>
17412 <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>
17413 <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>
17414 <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>
17415 <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>
17416 <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>
17417 !! html/parsoid
17418 <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
17419 <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
17420 <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
17421 <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
17422 <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
17423 <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
17424 <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
17425 <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
17426 <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>
17427 <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>
17428 !! end
17429
17430 !! test
17431 TOC regression (T11764)
17432 !! wikitext
17433 ==title 1==
17434 ===title 1.1===
17435 ====title 1.1.1====
17436 ===title 1.2===
17437 ==title 2==
17438 ===title 2.1===
17439 !! html
17440 <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>
17441 <ul>
17442 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17443 <ul>
17444 <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>
17445 <ul>
17446 <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>
17447 </ul>
17448 </li>
17449 <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>
17450 </ul>
17451 </li>
17452 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17453 <ul>
17454 <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>
17455 </ul>
17456 </li>
17457 </ul>
17458 </div>
17459
17460 <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>
17461 <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>
17462 <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>
17463 <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>
17464 <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>
17465 <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>
17466 !! end
17467
17468 !! test
17469 TOC for heading containing <span id="..."></span> (T96153)
17470 !! wikitext
17471 __FORCETOC__
17472 ==<span id="old-anchor"></span>New title==
17473 !! html/php
17474 <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>
17475 <ul>
17476 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
17477 </ul>
17478 </div>
17479
17480 <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>
17481 !! end
17482
17483 !! test
17484 TOC with wgMaxTocLevel=3 (T8204)
17485 !! options
17486 wgMaxTocLevel=3
17487 !! wikitext
17488 ==title 1==
17489 ===title 1.1===
17490 ====title 1.1.1====
17491 ===title 1.2===
17492 ==title 2==
17493 ===title 2.1===
17494 !! html
17495 <div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none"/><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
17496 <ul>
17497 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17498 <ul>
17499 <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>
17500 <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>
17501 </ul>
17502 </li>
17503 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
17504 <ul>
17505 <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>
17506 </ul>
17507 </li>
17508 </ul>
17509 </div>
17510
17511 <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>
17512 <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>
17513 <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>
17514 <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>
17515 <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>
17516 <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>
17517 !! end
17518
17519 !! test
17520 TOC with wgMaxTocLevel=3 and two level four headings (T8204)
17521 !! options
17522 wgMaxTocLevel=3
17523 !! wikitext
17524 ==Section 1==
17525 ===Section 1.1===
17526 ====Section 1.1.1====
17527 ====Section 1.1.1.1====
17528 ==Section 2==
17529 !! html
17530 <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>
17531 <ul>
17532 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
17533 <ul>
17534 <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>
17535 </ul>
17536 </li>
17537 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
17538 </ul>
17539 </div>
17540
17541 <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>
17542 <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>
17543 <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>
17544 <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>
17545 <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>
17546 !! end
17547
17548
17549 !! test
17550 Resolving duplicate section names
17551 !! wikitext
17552 ==Foo bar==
17553 ==Foo bar==
17554 !! html
17555 <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>
17556 <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>
17557 !! end
17558
17559 !! test
17560 Resolving duplicate section names with differing case (T12721)
17561 !! wikitext
17562 ==Foo bar==
17563 ==Foo Bar==
17564 !! html
17565 <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>
17566 <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>
17567 !! end
17568
17569 !! article
17570 Template:sections
17571 !! text
17572 ===Section 1===
17573 ==Section 2==
17574 !! endarticle
17575
17576 !! test
17577 Template with sections, __NOTOC__
17578 !! wikitext
17579 __NOTOC__
17580 ==Section 0==
17581 {{sections}}
17582 ==Section 4==
17583 !! html
17584 <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>
17585 <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>
17586 <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>
17587 <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>
17588 !! end
17589
17590 !! test
17591 __NOEDITSECTION__ keyword
17592 !! wikitext
17593 __NOEDITSECTION__
17594 ==Section 1==
17595 ==Section 2==
17596 !! html
17597 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
17598 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
17599 !! end
17600
17601 !! test
17602 Link inside a section heading
17603 !! wikitext
17604 ==Section with a [[Main Page|link]] in it==
17605 !! html
17606 <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>
17607 !! end
17608
17609 !! test
17610 TOC regression (T14077)
17611 !! wikitext
17612 __TOC__
17613 ==title 1==
17614 ===title 1.1===
17615 ==title 2==
17616 !! html
17617 <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>
17618 <ul>
17619 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
17620 <ul>
17621 <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>
17622 </ul>
17623 </li>
17624 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
17625 </ul>
17626 </div>
17627
17628 <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>
17629 <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>
17630 <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>
17631 !! end
17632
17633 !! test
17634 T3219 URL next to image (good)
17635 !! wikitext
17636 http://example.com [[File:Foobar.jpg]]
17637 !! html/php
17638 <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>
17639 </p>
17640 !! html/parsoid
17641 <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>
17642 !!end
17643
17644 # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
17645 !! test
17646 Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
17647 !! options
17648 parsoid=wt2html,html2html
17649 !! wikitext
17650 ===
17651 The line above must have a trailing space!
17652 === <!--
17653 --> <!-- -->
17654 But just in case it doesn't...
17655 !! html/php
17656 <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>
17657 <p>The line above must have a trailing space!
17658 </p>
17659 <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>
17660 <p>But just in case it doesn't...
17661 </p>
17662 !! html/parsoid
17663 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
17664 <p>The line above must have a trailing space!</p>
17665 <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
17666 --> <!-- -->
17667 <p>But just in case it doesn't...</p>
17668 !! end
17669
17670 !! test
17671 Header with special characters (T27462)
17672 !! wikitext
17673 The tooltips shall not show entities to the user (ie. be double escaped)
17674
17675 ==text > text==
17676 section 1
17677
17678 ==text < text==
17679 section 2
17680
17681 ==text & text==
17682 section 3
17683
17684 ==text ' text==
17685 section 4
17686
17687 ==text " text==
17688 section 5
17689 !! html/php
17690 <p>The tooltips shall not show entities to the user (ie. be double escaped)
17691 </p>
17692 <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>
17693 <ul>
17694 <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>
17695 <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>
17696 <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>
17697 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
17698 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
17699 </ul>
17700 </div>
17701
17702 <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>
17703 <p>section 1
17704 </p>
17705 <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>
17706 <p>section 2
17707 </p>
17708 <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>
17709 <p>section 3
17710 </p>
17711 <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>
17712 <p>section 4
17713 </p>
17714 <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>
17715 <p>section 5
17716 </p>
17717 !! html/parsoid
17718 <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
17719
17720 <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
17721 <p>section 1</p>
17722
17723 <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
17724 <p>section 2</p>
17725
17726 <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
17727 <p>section 3</p>
17728
17729 <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
17730 <p>section 4</p>
17731
17732 <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
17733 <p>section 5</p>
17734 !! end
17735
17736 !! test
17737 Header with space, plus and underscore as entity
17738 !! wikitext
17739 Id should not contain + for spaces
17740
17741 ==Space between Text==
17742 section 1
17743
17744 ==Space-Entity&#32;between&#32;Text==
17745 section 2
17746
17747 ==Plus+between+Text==
17748 section 3
17749
17750 ==Plus-Entity&#43;between&#43;Text==
17751 section 4
17752
17753 ==Underscore_between_Text==
17754 section 5
17755
17756 ==Underscore-Entity&#95;between&#95;Text==
17757 section 6
17758
17759 [[#Space between Text]]
17760 [[#Space-Entity&#32;between&#32;Text]]
17761 [[#Plus+between+Text]]
17762 [[#Plus-Entity&#43;between&#43;Text]]
17763 [[#Underscore_between_Text]]
17764 [[#Underscore-Entity&#95;between&#95;Text]]
17765 !! html/php
17766 <p>Id should not contain + for spaces
17767 </p>
17768 <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>
17769 <ul>
17770 <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>
17771 <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>
17772 <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>
17773 <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>
17774 <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>
17775 <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>
17776 </ul>
17777 </div>
17778
17779 <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>
17780 <p>section 1
17781 </p>
17782 <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>
17783 <p>section 2
17784 </p>
17785 <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>
17786 <p>section 3
17787 </p>
17788 <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>
17789 <p>section 4
17790 </p>
17791 <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>
17792 <p>section 5
17793 </p>
17794 <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>
17795 <p>section 6
17796 </p><p><a href="#Space_between_Text">#Space between Text</a>
17797 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
17798 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
17799 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
17800 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
17801 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
17802 </p>
17803 !! html/parsoid
17804 <p>Id should not contain + for spaces</p>
17805
17806 <h2 id="Space_between_Text">Space between Text</h2>
17807 <p>section 1</p>
17808
17809 <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>
17810 <p>section 2</p>
17811
17812 <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
17813 <p>section 3</p>
17814
17815 <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>
17816 <p>section 4</p>
17817
17818 <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
17819 <p>section 5</p>
17820
17821 <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>
17822 <p>section 6</p>
17823
17824 <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>
17825 <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>
17826 <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>
17827 <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>
17828 <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>
17829 <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>
17830 !! end
17831
17832 # Parsoid html2wt disabled because it adds padding spaces around =
17833 !! test
17834 Headers with excess '=' characters
17835 (Are similar tests necessary beyond the 1st level?)
17836 !! options
17837 parsoid=wt2html,wt2wt,html2html
17838 !! wikitext
17839 =foo==
17840 ==foo=
17841 =''italic'' heading==
17842 ==''italic'' heading=
17843 !! html/php
17844 <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>
17845 <ul>
17846 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
17847 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
17848 <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>
17849 <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>
17850 </ul>
17851 </div>
17852
17853 <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>
17854 <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>
17855 <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>
17856 <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>
17857 !! html/parsoid
17858 <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
17859 <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
17860 <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
17861 <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
17862 !! end
17863
17864 !! test
17865 HTML headers vs TOC (T25393)
17866 (__NOEDITSECTION__ for clearer output, doesn't matter here)
17867 !! wikitext
17868 <h1>Header 1</h1>
17869 ==Header 1.1==
17870 ==Header 1.2==
17871
17872 <h1>Header 2
17873 </h1>
17874 ==Header 2.1==
17875 ==Header 2.2==
17876 __NOEDITSECTION__
17877 !! html/php
17878 <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>
17879 <ul>
17880 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
17881 <ul>
17882 <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>
17883 <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>
17884 </ul>
17885 </li>
17886 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
17887 <ul>
17888 <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>
17889 <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>
17890 </ul>
17891 </li>
17892 </ul>
17893 </div>
17894
17895 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
17896 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
17897 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
17898 <h1><span class="mw-headline" id="Header_2">Header 2
17899 </span></h1>
17900 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
17901 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
17902 !! html/parsoid
17903 <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
17904 <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
17905 <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
17906
17907 <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
17908 </h1>
17909 <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
17910 <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
17911 <meta property="mw:PageProp/noeditsection"/>
17912 !! end
17913
17914 !! test
17915 Single-line or multiline-comments can follow headings
17916 !! options
17917 parsoid=wt2html,wt2wt
17918 !! wikitext
17919 ==foo==<!---->
17920 ==bar==<!--c1-->
17921 ==baz==<!--
17922 c2
17923 c3-->
17924 !! html/php
17925 <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>
17926 <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>
17927 <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>
17928 !! html/parsoid
17929 <h2 id="foo">foo</h2><!---->
17930 <h2 id="bar">bar</h2><!--c1-->
17931 <h2 id="baz">baz</h2><!--
17932 c2
17933 c3-->
17934 !! end
17935
17936 !! test
17937 T3219 URL next to image (broken)
17938 !! wikitext
17939 http://example.com[[File:Foobar.jpg]]
17940 !! html/php
17941 <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>
17942 </p>
17943 !! html/parsoid
17944 <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>
17945 !!end
17946
17947 !! test
17948 T3186 news: in the middle of text
17949 !! wikitext
17950 http://en.wikinews.org/wiki/Wikinews:Workplace
17951 !! html
17952 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
17953 </p>
17954 !!end
17955
17956
17957 !! test
17958 Namespaced link must have a title
17959 !! wikitext
17960 [[Project:]]
17961 !! html
17962 <p>[[Project:]]
17963 </p>
17964 !!end
17965
17966 !! test
17967 Namespaced link must have a title (bad fragment version)
17968 !! wikitext
17969 [[Project:#fragment]]
17970 !! html
17971 <p>[[Project:#fragment]]
17972 </p>
17973 !!end
17974
17975
17976 ###
17977 ### HTML tags and HTML attributes
17978 ###
17979
17980 !! test
17981 div with no attributes
17982 !! wikitext
17983 <div>HTML rocks</div>
17984 !! html
17985 <div>HTML rocks</div>
17986 !! end
17987
17988 !! test
17989 div with double-quoted attribute
17990 !! wikitext
17991 <div id="rock">HTML rocks</div>
17992 !! html
17993 <div id="rock">HTML rocks</div>
17994 !! end
17995
17996 !! test
17997 div with single-quoted attribute
17998 !! wikitext
17999 <div id='rock'>HTML rocks</div>
18000 !! html
18001 <div id="rock">HTML rocks</div>
18002 !! end
18003
18004 !! test
18005 div with unquoted attribute
18006 !! wikitext
18007 <div id=rock>HTML rocks</div>
18008 !! html
18009 <div id="rock">HTML rocks</div>
18010 !! end
18011
18012 !! test
18013 div with illegal double attributes
18014 !! wikitext
18015 <div id="a" id="b">HTML rocks</div>
18016 !! html
18017 <div id="b">HTML rocks</div>
18018 !! end
18019
18020 !! test
18021 div with empty attribute value, space before equals
18022 !! options
18023 parsoid=wt2html,html2html
18024 !! wikitext
18025 <div class =>HTML rocks</div>
18026 !! html/php
18027 <div class="">HTML rocks</div>
18028 !! html/parsoid
18029 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18030 !! end
18031
18032 !! test
18033 div with multiple empty attribute values
18034 !! config
18035 wgFragmentMode=[ 'html5', 'legacy' ]
18036 !! options
18037 parsoid=wt2html,html2html
18038 !! wikitext
18039 <div id= title=>HTML rocks</div>
18040 !! html/php
18041 <div id="title=">HTML rocks</div>
18042 !! html/parsoid
18043 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
18044 !! end
18045
18046 # FIXME Parsoid doesn't actually match PHP here.
18047 !! test
18048 Extension tag in attribute value
18049 !! options
18050 wgRawHtml=1
18051 !! wikitext
18052 <span title="<html><div>123</div></html>">ok</span>
18053 !! html/php+tidy
18054 <p><span title="&lt;div&gt;123&lt;/div&gt;">ok</span>
18055 </p>
18056 !! html/parsoid
18057 <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>
18058 !! end
18059
18060 !! test
18061 table with multiple empty attribute values
18062 !! options
18063 parsoid=wt2html,html2html
18064 !! wikitext
18065 {| title= id=
18066 |hi
18067 |}
18068 !! html/php
18069 <table title="id=">
18070 <tr>
18071 <td>hi
18072 </td></tr></table>
18073 !! html/parsoid
18074 <table title="id=">
18075 <tbody><tr><td>hi</td></tr>
18076 </tbody></table>
18077 !! end
18078
18079 !! test
18080 div with braces in attribute value
18081 !! wikitext
18082 <div title="{}">Foo</div>
18083 !! html/php
18084 <div title="&#123;&#125;">Foo</div>
18085 !! html/parsoid
18086 <div title="{}">Foo</div>
18087 !! end
18088
18089 !! test
18090 div with empty attribute value, no space before equals
18091 !! options
18092 parsoid=wt2html,html2html
18093 !! wikitext
18094 <div class=>HTML rocks</div>
18095 !! html/php
18096 <div class="">HTML rocks</div>
18097 !! html/parsoid
18098 <div class="">HTML rocks</div>
18099 !! end
18100
18101 !! test
18102 HTML multiple attributes correction
18103 !! wikitext
18104 <p class="error" class="awesome">Awesome!</p>
18105 !! html
18106 <p class="awesome">Awesome!</p>
18107 !! end
18108
18109 !! test
18110 Table multiple attributes correction
18111 !! wikitext
18112 {|
18113 !+ class="error" class="awesome"|status
18114 |}
18115 !! html
18116 <table>
18117 <tr>
18118 <th class="awesome">status
18119 </th></tr></table>
18120 !! end
18121
18122 !! test
18123 DIV IN UPPERCASE
18124 !! wikitext
18125 <DIV ID="x">HTML ROCKS</DIV>
18126 !! html
18127 <div id="x">HTML ROCKS</div>
18128 !! end
18129
18130 !! test
18131 Non-ASCII pseudo-tags are rendered as text
18132 !! wikitext
18133 <khyô>
18134 !! html
18135 <p>&lt;khyô&gt;
18136 </p>
18137 !! end
18138
18139 !! test
18140 Pseudo-tag with URL 'name' renders as url link
18141 !! wikitext
18142 <http://example.com/>
18143 !! html
18144 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
18145 </p>
18146 !! end
18147
18148 !! test
18149 text with amp in the middle of nowhere
18150 !! wikitext
18151 Remember AT&T?
18152 !! html
18153 <p>Remember AT&amp;T?
18154 </p>
18155 !! end
18156
18157 !! test
18158 text with character entity: eacute
18159 !! wikitext
18160 I always thought &eacute; was a cute letter.
18161 !! html+tidy
18162 <p>I always thought &#233; was a cute letter.
18163 </p>
18164 !! end
18165
18166 !! test
18167 text with entity-escaped character entity-like string: eacute
18168 !! wikitext
18169 I always thought &amp;eacute; was a cute letter.
18170 !! html
18171 <p>I always thought &amp;eacute; was a cute letter.
18172 </p>
18173 !! end
18174
18175 !! test
18176 text with undefined character entity: xacute
18177 !! wikitext
18178 I always thought &xacute; was a cute letter.
18179 !! html
18180 <p>I always thought &amp;xacute; was a cute letter.
18181 </p>
18182 !! end
18183
18184 !! test
18185 HTML5 tags
18186 !! wikitext
18187 <data value="5">five</data>
18188 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18189 <mark>This highlighted text</mark>
18190 !! html
18191 <p><data value="5">five</data>
18192 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
18193 <mark>This highlighted text</mark>
18194 </p>
18195 !! end
18196
18197 !! test
18198 HTML tag with leading space is parsed as text
18199 !! wikitext
18200 < div>foo< /div>
18201 !! html
18202 <p>&lt; div&gt;foo&lt; /div&gt;
18203 </p>
18204 !! end
18205
18206 ## FIXME: The untrimmed attribute in Parsoid is T205737
18207 !! test
18208 Element with broken attribute syntax
18209 !! options
18210 parsoid=wt2html
18211 !! wikitext
18212 <div style=" style="123">hi</div>
18213 <div =>ho</div>
18214 !! html/php
18215 <div style="style=">hi</div>
18216 <div>ho</div>
18217 !! html/parsoid
18218 <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
18219 <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
18220 !! end
18221
18222 ###
18223 ### Nesting tests (see T43545, T52604, T53081)
18224 ###
18225
18226 # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
18227 # Note that html2wt is considerably more difficult if we use <b> in
18228 # the test case, instead of <small>
18229 !! test
18230 Ensure that HTML adoption agency algorithm is properly implemented.
18231 !! wikitext
18232 <small>X<small>Y</small>Z</small>
18233 !! html
18234 <p><small>X<small>Y</small>Z</small>
18235 </p>
18236 !! end
18237
18238 # This was T43545 in the PHP parser.
18239 !! test
18240 Nesting of <kbd>
18241 !! wikitext
18242 <kbd>X<kbd>Y</kbd>Z</kbd>
18243 !! html+tidy
18244 <p><kbd>X<kbd>Y</kbd>Z</kbd>
18245 </p>
18246 !! end
18247
18248 # The following cases were T53081 in the PHP parser.
18249 # Note that there are some other nestable tags (b, i, etc) which are
18250 # not covered; see T53081 for discussion.
18251
18252 !! test
18253 Nesting of <em>
18254 !! wikitext
18255 <em>X<em>Y</em>Z</em>
18256 !! html+tidy
18257 <p><em>X<em>Y</em>Z</em>
18258 </p>
18259 !! end
18260
18261 !! test
18262 Nesting of <strong>
18263 !! wikitext
18264 <strong>X<strong>Y</strong>Z</strong>
18265 !! html+tidy
18266 <p><strong>X<strong>Y</strong>Z</strong>
18267 </p>
18268 !! end
18269
18270 !! test
18271 Nesting of <q>
18272 !! wikitext
18273 <q>X<q>Y</q>Z</q>
18274 !! html+tidy
18275 <p><q>X<q>Y</q>Z</q>
18276 </p>
18277 !! end
18278
18279 !! test
18280 Nesting of <ruby>
18281 !! wikitext
18282 <ruby>X<ruby>Y</ruby>Z</ruby>
18283 !! html
18284 <p><ruby>X<ruby>Y</ruby>Z</ruby>
18285 </p>
18286 !! end
18287
18288 !! test
18289 Nesting of <bdo>
18290 !! wikitext
18291 <bdo>X<bdo>Y</bdo>Z</bdo>
18292 !! html
18293 <p><bdo>X<bdo>Y</bdo>Z</bdo>
18294 </p>
18295 !! end
18296
18297
18298 ###
18299 ### Media links
18300 ###
18301
18302 !! test
18303 Media link
18304 !! wikitext
18305 [[Media:Foobar.jpg]]
18306 [[Media:Video.ogv]]
18307 [[:Media:Video.ogv]]
18308 !! html/php
18309 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
18310 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18311 <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
18312 </p>
18313 !! html/parsoid
18314 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Media:Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
18315 <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" resource="./Media:Video.ogv" title="Video.ogv">Media:Video.ogv</a>
18316 <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>
18317 !! end
18318
18319 !! test
18320 Media link with text
18321 !! wikitext
18322 [[Media:Foobar.jpg|A neat file to look at]]
18323 !! html/php
18324 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
18325 </p>
18326 !! html/parsoid
18327 <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>
18328 !! end
18329
18330 !! test
18331 Localized media link
18332 !! options
18333 language=is
18334 !! wikitext
18335 [[Miðill:Foobar.jpg]]
18336
18337 [[Miðill:Foobar.jpg|Icelandic]]
18338 !! html/php
18339 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Miðill:Foobar.jpg</a>
18340 </p><p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Icelandic</a>
18341 </p>
18342 !! html/parsoid
18343 <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>
18344 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" resource="./Miðill:Foobar.jpg" title="Foobar.jpg">Icelandic</a></p>
18345 !! end
18346
18347 # FIXME: this is still bad HTML tag nesting
18348 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
18349 # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
18350 !! test
18351 Media link with nasty text
18352 !! options
18353 parsoid=wt2html,html2html
18354 !! wikitext
18355 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
18356 !! html/php
18357 <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>
18358 !! html/php+tidy
18359 <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>
18360 !! html/parsoid
18361 <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>
18362 !! end
18363
18364 !! test
18365 Media link from missing resource (parsoid-only)
18366 !! options
18367 parsoid=html2wt
18368 !! html/parsoid
18369 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18370 !! wikitext
18371 [[Media:Foobar.jpg|Bat!]]
18372 !! end
18373
18374 !! test
18375 Media link from missing resource, localized (parsoid-only)
18376 !! options
18377 parsoid=html2wt
18378 language=is
18379 !! html/parsoid
18380 <a rel="mw:MediaLink" href="http://example.com/images/3/3a/Foobar.jpg">Bat!</a>
18381 !! wikitext
18382 [[Miðill:Foobar.jpg|Bat!]]
18383 !! end
18384
18385 # This is a sanity test to ensure we don't crash or choke when given
18386 # old cached 1.7.0 HTML for media links; we don't require that the
18387 # result be "valid" because wt2wt was completely broken in 1.7.0
18388 !! test
18389 Media link from old 1.7.0 DOM spec (crash test, parsoid-only) T198511
18390 !! options
18391 parsoid=html2wt
18392 !! html/parsoid
18393 <p>This is what Parsoid would emit (and we still handle this HTML fine):</p>
18394 <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18395 <p>But VisualEditor would mangle the rel attribute, and give us back this:</p>
18396 <p><a rel="mw:ExtLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
18397 <p>But at least we don't crash when trying to handle the mangled HTML!</p>
18398 !! wikitext
18399 This is what Parsoid would emit (and we still handle this HTML fine):
18400
18401 [[Media:Foobar.jpg|A neat file to look at]]
18402
18403 But VisualEditor would mangle the rel attribute, and give us back this:
18404
18405 [//example.com/images/3/3a/Foobar.jpg A neat file to look at]
18406
18407 But at least we don't crash when trying to handle the mangled HTML!
18408 !! end
18409
18410 !! test
18411 Media link to nonexistent file (T3702)
18412 !! wikitext
18413 [[Media:No such.jpg]]
18414 [[Media:No_such file.jpg]]
18415 !! html/php
18416 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
18417 <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>
18418 </p>
18419 !! html/parsoid
18420 <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>
18421 <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>
18422 !! end
18423
18424 !! test
18425 Image link to nonexistent file (T3850 - good)
18426 !! wikitext
18427 [[File:No_such.jpg]]
18428 !! html/php
18429 <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>
18430 </p>
18431 !! html/parsoid
18432 <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>
18433 !! end
18434
18435 !! test
18436 :Image link to nonexistent file (T3850 - bad)
18437 !! wikitext
18438 [[:Image:No such.jpg]]
18439 !! html/php
18440 <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>
18441 </p>
18442 !! html/parsoid
18443 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
18444 !! end
18445
18446 !! test
18447 Character reference normalization in link text (T3938)
18448 !! wikitext
18449 [[Main Page|this&that]]
18450 !! html
18451 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
18452 </p>
18453 !!end
18454
18455 !! article
18456 אַ
18457 !! text
18458 Test for unicode normalization
18459
18460 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
18461 !! endarticle
18462
18463 !! test
18464 (T21451) Links should refer to the normalized form.
18465 !! wikitext
18466 [[&#xFB2E;]]
18467 [[&#x5d0;&#x5b7;]]
18468 [[&#x5d0;ַ]]
18469 [[א&#x5b7;]]
18470 [[אַ]]
18471 !! html
18472 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
18473 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
18474 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
18475 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
18476 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
18477 </p>
18478 !! end
18479
18480 !! test
18481 Empty attribute crash test (T4067)
18482 !! wikitext
18483 <font color="">foo</font>
18484 !! html
18485 <p><font color="">foo</font>
18486 </p>
18487 !! end
18488
18489 !! test
18490 Empty attribute crash test single-quotes (T4067)
18491 !! wikitext
18492 <font color=''>foo</font>
18493 !! html
18494 <p><font color="">foo</font>
18495 </p>
18496 !! end
18497
18498 !! test
18499 Attribute test: equals, then nothing
18500 !! options
18501 parsoid=wt2html,html2html
18502 !! wikitext
18503 <font color=>foo</font>
18504 !! html/php
18505 <p><font color="">foo</font>
18506 </p>
18507 !! html/parsoid
18508 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
18509 !! end
18510
18511 !! test
18512 Attribute test: unquoted value
18513 !! options
18514 parsoid=wt2html,html2html
18515 !! wikitext
18516 <font color=x>foo</font>
18517 !! html/php
18518 <p><font color="x">foo</font>
18519 </p>
18520 !! html/parsoid
18521 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
18522 !! end
18523
18524 !! test
18525 Attribute test: unquoted but illegal value (hash)
18526 !! wikitext
18527 <font color=#x>foo</font>
18528 !! html
18529 <p><font color="#x">foo</font>
18530 </p>
18531 !! end
18532
18533 # Parsoid does not serialize to empty attribute syntax,
18534 # so wt2wt and html2wt cases are skipped
18535 !! test
18536 Attribute test: no value (T54330)
18537 !! options
18538 parsoid=wt2html,html2html
18539 !! wikitext
18540 <font color>foo</font>
18541 !! html/php
18542 <p><font color="">foo</font>
18543 </p>
18544 !! html/parsoid
18545 <p><font color="">foo</font></p>
18546 !! end
18547
18548 !! test
18549 T4095: link with three closing brackets
18550 !! wikitext
18551 [[Main Page]]]
18552 !! html/php
18553 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
18554 </p>
18555 !! html/parsoid
18556 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
18557 !! end
18558
18559 !! test
18560 T4095: link with pipe and three closing brackets
18561 !! wikitext
18562 [[Main Page|link]]]
18563 !! html/php
18564 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
18565 </p>
18566 !! html/parsoid
18567 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
18568 !! end
18569
18570 !! test
18571 T4095: link with pipe and three closing brackets, version 2
18572 !! wikitext
18573 [[Main Page|[http://example.com/]]]
18574 !! html/php
18575 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
18576 </p>
18577 !! html/parsoid
18578 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
18579 !! end
18580
18581
18582 ###
18583 ### Safety
18584 ###
18585
18586 !! article
18587 Template:Dangerous attribute
18588 !! text
18589 " onmouseover="alert(document.cookie)
18590 !! endarticle
18591
18592 !! article
18593 Template:Dangerous style attribute
18594 !! text
18595 border-size: expression(alert(document.cookie))
18596 !! endarticle
18597
18598 !! article
18599 Template:Div style
18600 !! text
18601 <div style="float: right; {{{1}}}">Magic div</div>
18602 !! endarticle
18603
18604 !! test
18605 T4304: HTML attribute safety (safe template; regression T4309)
18606 !! wikitext
18607 <div title="{{test}}"></div>
18608 !! html/php
18609 <div title="This is a test template"></div>
18610 !! html/parsoid
18611 <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>
18612 !! end
18613
18614 # Parsoid has enough context to handle this case
18615 !! test
18616 T4304: HTML attribute safety (dangerous template; 2309)
18617 !! wikitext
18618 <div title="{{dangerous attribute}}"></div>
18619 !! html/php
18620 <div title=""></div>
18621 !! html/parsoid
18622 <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>
18623 !! end
18624
18625 !! test
18626 T4304: HTML attribute safety (dangerous style template; 2309)
18627 !! wikitext
18628 <div style="{{dangerous style attribute}}"></div>
18629 !! html/php
18630 <div style="/* insecure input */"></div>
18631 !! html/parsoid
18632 <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>
18633 !! end
18634
18635 !! test
18636 T4304: HTML attribute safety (safe parameter; 2309)
18637 !! wikitext
18638 {{div style|width: 200px}}
18639 !! html/php
18640 <div style="float: right; width: 200px">Magic div</div>
18641 !! html/parsoid
18642 <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>
18643 !! end
18644
18645 !! test
18646 T4304: HTML attribute safety (unsafe parameter; 2309)
18647 !! wikitext
18648 {{div style|width: expression(alert(document.cookie))}}
18649 !! html/php
18650 <div style="/* insecure input */">Magic div</div>
18651 !! html/parsoid
18652 <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>
18653 !! end
18654
18655 ## Parsoid output here differs; needs investigation.
18656 !! test
18657 T4304: HTML attribute safety (unsafe breakout parameter; 2309)
18658 !! wikitext
18659 {{div style|"><script>alert(document.cookie)</script>}}
18660 !! html
18661 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18662 !! end
18663
18664 ## Parsoid output here differs; needs investigation.
18665 !! test
18666 T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
18667 !! wikitext
18668 {{div style|" ><script>alert(document.cookie)</script>}}
18669 !! html
18670 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
18671 !! end
18672
18673 !! test
18674 T4304: HTML attribute safety (link)
18675 !! wikitext
18676 <div title="[[Main Page]]"></div>
18677 !! html/php
18678 <div title="&#91;&#91;Main Page&#93;&#93;"></div>
18679 !! html/parsoid
18680 <div title="[[Main Page]]"></div>
18681 !! end
18682
18683 !! test
18684 T4304: HTML attribute safety (italics)
18685 !! wikitext
18686 <div title="''foobar''"></div>
18687 !! html
18688 <div title="&#39;&#39;foobar&#39;&#39;"></div>
18689 !! end
18690
18691 !! test
18692 T4304: HTML attribute safety (bold)
18693 !! wikitext
18694 <div title="'''foobar'''"></div>
18695 !! html
18696 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
18697 !! end
18698
18699 !! test
18700 T4304: HTML attribute safety (ISBN)
18701 !! wikitext
18702 <div title="ISBN 1234567890"></div>
18703 !! html
18704 <div title="&#73;SBN 1234567890"></div>
18705 !! end
18706
18707 !! test
18708 T4304: HTML attribute safety (RFC)
18709 !! wikitext
18710 <div title="RFC 1234"></div>
18711 !! html
18712 <div title="&#82;FC 1234"></div>
18713 !! end
18714
18715 !! test
18716 T4304: HTML attribute safety (PMID)
18717 !! wikitext
18718 <div title="PMID 1234567890"></div>
18719 !! html
18720 <div title="&#80;MID 1234567890"></div>
18721 !! end
18722
18723 !! test
18724 T4304: HTML attribute safety (web link)
18725 !! wikitext
18726 <div title="http://example.com/"></div>
18727 !! html
18728 <div title="http&#58;//example.com/"></div>
18729 !! end
18730
18731 !! test
18732 T4304: HTML attribute safety (named web link)
18733 !! wikitext
18734 <div title="[http://example.com/ link]"></div>
18735 !! html/php
18736 <div title="&#91;http&#58;//example.com/ link&#93;"></div>
18737 !! html/parsoid
18738 <div title="[http://example.com/ link]"></div>
18739 !! end
18740
18741 !! test
18742 T5244: HTML attribute safety (extension; safe)
18743 !! wikitext
18744 <div style="<nowiki>background:blue</nowiki>"></div>
18745 !! html/php
18746 <div style="background:blue"></div>
18747 !! html/parsoid
18748 <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>
18749 !! end
18750
18751 !! test
18752 T5244: HTML attribute safety (extension; unsafe)
18753 !! wikitext
18754 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
18755 !! html/php
18756 <div style="/* insecure input */"></div>
18757 !! html/parsoid
18758 <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>
18759 !! end
18760
18761 # More MSIE fun discovered by Tom Gilder
18762
18763 !! test
18764 MSIE CSS safety test: spurious slash
18765 !! wikitext
18766 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
18767 !! html/php
18768 <div style="/* insecure input */">evil</div>
18769 !! html/parsoid
18770 <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>
18771 !! end
18772
18773 !! test
18774 MSIE CSS safety test: hex code
18775 !! wikitext
18776 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
18777 !! html/php
18778 <div style="/* insecure input */">evil</div>
18779 !! html/parsoid
18780 <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>
18781 !! end
18782
18783 !! test
18784 MSIE CSS safety test: comment in url
18785 !! wikitext
18786 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
18787 !! html/php
18788 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
18789 !! html/parsoid
18790 <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>
18791 !! end
18792
18793 !! test
18794 MSIE CSS safety test: comment in expression
18795 !! wikitext
18796 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
18797 !! html/php
18798 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
18799 !! html/parsoid
18800 <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>
18801 !! end
18802
18803 !! test
18804 CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
18805 !! wikitext
18806 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
18807 !! html/php
18808 <p style="/* invalid control char */">A</p>
18809 !! html/parsoid
18810 <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>
18811 !! end
18812
18813 !! test
18814 MSIE 6 CSS safety test: Fullwidth (T57332)
18815 !! wikitext
18816 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
18817 <div style="top:EXPRESSION(alert())">B</div>
18818 !! html/php
18819 <p style="/* insecure input */">A</p>
18820 <div style="/* insecure input */">B</div>
18821 !! html/parsoid
18822 <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>
18823 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
18824 !! end
18825
18826 !! test
18827 MSIE 6 CSS safety test: IPA extensions (T57332)
18828 !! wikitext
18829 <div style="background-image:uʀʟ(javascript:alert())">A</div>
18830 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
18831 !! html/php
18832 <div style="/* insecure input */">A</div>
18833 <p style="/* insecure input */">B</p>
18834 !! html/parsoid
18835 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
18836 <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>
18837 !! end
18838
18839 !! test
18840 MSIE 6 CSS safety test: sup/sub script (T57332)
18841 !! wikitext
18842 <div style="background-image:url⁽javascript:alert())">A</div>
18843 <div style="background-image:url₍javascript:alert())">B</div>
18844 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
18845 !! html/php
18846 <div style="/* insecure input */">A</div>
18847 <div style="/* insecure input */">B</div>
18848 <p style="/* insecure input */">C</p>
18849 !! html/parsoid
18850 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
18851 <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
18852 <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>
18853 !! end
18854
18855 !! test
18856 Opera -o-link CSS
18857 !! options
18858 parsoid=wt2html,html2html
18859 !! wikitext
18860 <div
18861 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;"
18862 style="-o-link:attr(title);-o-link-source:current">X</div>
18863 !! html/php
18864 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
18865 !! html/parsoid
18866 <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>
18867 !! end
18868
18869 !! test
18870 MSIE 6 CSS safety test: Repetition markers (T57332)
18871 !! wikitext
18872 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
18873 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
18874 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
18875 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
18876 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
18877 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
18878 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
18879 !! html/php
18880 <p style="/* insecure input */">A</p>
18881 <p style="/* insecure input */">B</p>
18882 <p style="/* insecure input */">C</p>
18883 <p style="/* insecure input */">D</p>
18884 <p style="/* insecure input */">E</p>
18885 <p style="/* insecure input */">F</p>
18886 <p style="/* insecure input */">G</p>
18887 !! html/parsoid
18888 <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>
18889 <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>
18890 <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>
18891 <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>
18892 <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>
18893 <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>
18894 <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>
18895 !! end
18896
18897 !! test
18898 Table attribute legitimate extension
18899 !! wikitext
18900 {|
18901 !+ style="<nowiki>color:blue</nowiki>"|status
18902 |}
18903 !! html
18904 <table>
18905 <tr>
18906 <th style="color:blue">status
18907 </th></tr></table>
18908 !! end
18909
18910 !! test
18911 Table attribute safety
18912 !! wikitext
18913 {|
18914 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
18915 |}
18916 !! html
18917 <table>
18918 <tr>
18919 <th style="/* insecure input */">status
18920 </th></tr></table>
18921 !! end
18922
18923 !! test
18924 CSS line continuation 1
18925 !! wikitext
18926 <div style="background-image: u\&#10;rl(test.jpg);"></div>
18927 !! html
18928 <div style="/* insecure input */"></div>
18929 !! end
18930
18931 !! test
18932 CSS line continuation 2
18933 !! wikitext
18934 <div style="background-image: u\&#13;rl(test.jpg); "></div>
18935 !! html
18936 <div style="/* invalid control char */"></div>
18937 !! end
18938
18939 !! article
18940 Template:Identity
18941 !! text
18942 {{{1}}}
18943 !! endarticle
18944
18945 !! test
18946 Expansion of multi-line templates in attribute values (T8255)
18947 !! wikitext
18948 <div style="background: {{identity|#00FF00}}">-</div>
18949 !! html
18950 <div style="background: #00FF00">-</div>
18951 !! end
18952
18953 !! test
18954 Expansion of multi-line templates in attribute values (T8255 sanity check)
18955 !! wikitext
18956 <div style="background:
18957 #00FF00">-</div>
18958 !! html/php
18959 <div style="background: #00FF00">-</div>
18960 !! html/parsoid
18961 <div style="background:
18962 #00FF00">-</div>
18963 !! end
18964
18965 !! test
18966 Expansion of multi-line templates in attribute values (T8255 sanity check 2)
18967 !! wikitext
18968 <div style="background: &#10;#00FF00">-</div>
18969 !! html
18970 <div style="background: &#10;#00FF00">-</div>
18971 !! end
18972
18973 !! test
18974 Tags which are hidden from tidiers cannot pass through the Sanitizer
18975 !! wikitext
18976 <mw:toc><script>alert();</script></mw:toc>
18977 !! html+tidy
18978 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
18979 </p>
18980 !! end
18981
18982 ###
18983 ### Parser hooks (see tests/parser/ParserTestParserHook.php for the <tag> extension)
18984 ###
18985
18986 !! test
18987 Parser hook: empty input
18988 !! wikitext
18989 <tag></tag>
18990 !! html/php
18991 <pre>
18992 ''
18993 array (
18994 )
18995 </pre>
18996 !! html/parsoid
18997 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
18998 !! end
18999
19000 ## Don't expect parsoid to rt this form.
19001 !! test
19002 Parser hook: empty input using terminated empty elements
19003 !! options
19004 parsoid=wt2html,html2html
19005 !! wikitext
19006 <tag/>
19007 !! html/php
19008 <pre>
19009 NULL
19010 array (
19011 )
19012 </pre>
19013 !! html/parsoid
19014 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19015 !! end
19016
19017 !! test
19018 Parser hook: empty input using terminated empty elements (space before)
19019 !! wikitext
19020 <tag />
19021 !! html/php
19022 <pre>
19023 NULL
19024 array (
19025 )
19026 </pre>
19027 !! html/parsoid
19028 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{}}' data-parsoid='{}' about="#mwt2"></pre>
19029 !! end
19030
19031 !! test
19032 Parser hook: basic input
19033 !! wikitext
19034 <tag>input</tag>
19035 !! html/php
19036 <pre>
19037 'input'
19038 array (
19039 )
19040 </pre>
19041 !! html/parsoid
19042 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19043 !! end
19044
19045 ## Don't expect parsoid to rt this form.
19046 !! test
19047 Parser hook: case insensitive
19048 !! options
19049 parsoid=wt2html,html2html
19050 !! wikitext
19051 <TAG>input</TAG>
19052 !! html/php
19053 <pre>
19054 'input'
19055 array (
19056 )
19057 </pre>
19058 !! html/parsoid
19059 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19060 !! end
19061
19062 ## Don't expect parsoid to rt this form.
19063 !! test
19064 Parser hook: case insensitive, redux
19065 !! options
19066 parsoid=wt2html,html2html
19067 !! wikitext
19068 <TaG>input</TAg>
19069 !! html/php
19070 <pre>
19071 'input'
19072 array (
19073 )
19074 </pre>
19075 !! html/parsoid
19076 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
19077 !! end
19078
19079 !! test
19080 Parser hook: nested tags
19081 !! options
19082 parsoid=wt2html
19083 !! wikitext
19084 <tag><tag></tag></tag>
19085 !! html/php
19086 <pre>
19087 '<tag>'
19088 array (
19089 )
19090 </pre>&lt;/tag&gt;
19091 !! html/php+tidy
19092 <pre>'<tag>'
19093 array (
19094 )
19095 </tag></pre><p>&lt;/tag&gt;</p>
19096 !! html/parsoid
19097 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}'></pre><p>&lt;/tag></p>
19098 !! end
19099
19100 !! test
19101 Parser hook: basic arguments
19102 !! wikitext
19103 <tag width="200" height="100" depth="50" square=""></tag>
19104 !! html/php
19105 <pre>
19106 ''
19107 array (
19108 'width' => '200',
19109 'height' => '100',
19110 'depth' => '50',
19111 'square' => '',
19112 )
19113 </pre>
19114 !! html/parsoid
19115 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19116 !! end
19117
19118 ## Don't expect parsoid to rt this form.
19119 !! test
19120 Parser hook: basic arguments, variations
19121 !! options
19122 parsoid=wt2html,html2html
19123 !! wikitext
19124 <tag width=200 height = "100" depth = '50' square></tag>
19125 !! html/php
19126 <pre>
19127 ''
19128 array (
19129 'width' => '200',
19130 'height' => '100',
19131 'depth' => '50',
19132 'square' => '',
19133 )
19134 </pre>
19135 !! html/parsoid
19136 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19137 !! end
19138
19139 !! test
19140 Parser hook: argument containing a forward slash (T7344)
19141 !! wikitext
19142 <tag filename="/tmp/bla"></tag>
19143 !! html/php
19144 <pre>
19145 ''
19146 array (
19147 'filename' => '/tmp/bla',
19148 )
19149 </pre>
19150 !! html/parsoid
19151 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
19152 !! end
19153
19154 ## Don't expect parsoid to rt this form.
19155 !! test
19156 Parser hook: empty input using terminated empty elements (T4374)
19157 !! options
19158 parsoid=wt2html,html2html
19159 !! wikitext
19160 <tag foo=bar/>text
19161 !! html/php
19162 <pre>
19163 NULL
19164 array (
19165 'foo' => 'bar',
19166 )
19167 </pre>text
19168 !! html/parsoid
19169 <pre typeof="mw:Extension/tag" about="#mwt2" data-mw='{"name":"tag","attrs":{"foo":"bar"}}'></pre><p>text</p>
19170 !! end
19171
19172 ## </tag> should be output literally since there is no matching tag that begins it
19173 ## Don't expect parsoid to rt this form.
19174 !! test
19175 Parser hook: basic arguments using terminated empty elements (T4374)
19176 !! options
19177 parsoid=wt2html
19178 !! wikitext
19179 <tag width=200 height = "100" depth = '50' square/>
19180 other stuff
19181 </tag>
19182 !! html/php
19183 <pre>
19184 NULL
19185 array (
19186 'width' => '200',
19187 'height' => '100',
19188 'depth' => '50',
19189 'square' => '',
19190 )
19191 </pre>
19192 <p>other stuff
19193 &lt;/tag&gt;
19194 </p>
19195 !! html/parsoid
19196 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""}}' about="#mwt2"></pre><p>other stuff
19197 &lt;/tag></p>
19198 !! end
19199
19200 ## Don't expect parsoid to rt this form.
19201 !! test
19202 Parser hook: Don't allow unclosed extension tags
19203 !! options
19204 parsoid=wt2html
19205 !! wikitext
19206 test <tag>123
19207
19208 this is a '''test'''
19209 !! html/php
19210 <p>test &lt;tag&gt;123
19211 </p><p>this is a <b>test</b>
19212 </p>
19213 !! html/parsoid
19214 <p>test &lt;tag>123</p>
19215
19216 <p>this is a <b>test</b></p>
19217 !! end
19218
19219 !! test
19220 Parser hook: horizontal rule inside extension tag that outputs <pre>
19221 !! wikitext
19222 <tag>
19223 Hello
19224 <hr/>
19225 Goodbye
19226 </tag>
19227 !! html/php
19228 <pre>
19229 '
19230 Hello
19231 <hr/>
19232 Goodbye
19233 '
19234 array (
19235 )
19236 </pre>
19237 !! end
19238
19239 ###
19240 ### (see tests/parser/ParserTestParserHook.php for the <statictag> extension)
19241 ###
19242
19243 !! test
19244 Parser hook: static parser hook not inside a comment
19245 !! wikitext
19246 <statictag>hello, world</statictag>
19247
19248 <statictag action="flush" />
19249 !! html/php
19250 <p><br />
19251 hello, world
19252 </p>
19253 !! html/parsoid
19254 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' about="#mwt2"></span></p>
19255 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"}}' about="#mwt4">hello, world</span></p>
19256 !! end
19257
19258 !! test
19259 Parser hook: static parser hook inside a comment
19260 !! wikitext
19261 <!-- <statictag>hello, world</statictag> -->
19262 <statictag action="flush" />
19263 !! html/php
19264 <p><br />
19265 </p>
19266 !! html/parsoid
19267 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
19268 <p><span typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"}}' data-parsoid='{}' about='#mwt2'></span></p>
19269 !! end
19270
19271 # Nested template calls; this case was broken by Parser.php rev 1.506,
19272 # since reverted.
19273
19274 !! article
19275 Template:One-parameter
19276 !! text
19277 (My parameter is: {{{1}}})
19278 !! endarticle
19279
19280 !! article
19281 Template:Map-one-parameter
19282 !! text
19283 {{{{{1}}}|{{{2}}}}}
19284 !! endarticle
19285
19286 !! test
19287 Nested template calls
19288 !! wikitext
19289 {{Map-one-parameter|One-parameter|param}}
19290 !! html
19291 <p>(My parameter is: param)
19292 </p>
19293 !! end
19294
19295
19296 ###
19297 ### Sanitizer
19298 ###
19299
19300 !! test
19301 Sanitizer: Closing of open tags
19302 !! wikitext
19303 <s></s><table></table>
19304 !! html/php+tidy
19305 <p><s></s></p><table></table>
19306 !! html/parsoid
19307 <p><s data-parsoid='{"stx":"html"}'></s></p><table data-parsoid='{"stx":"html"}'></table>
19308 !! end
19309
19310 !! test
19311 Sanitizer: Closing of open but not closed tags
19312 !! wikitext
19313 <s>foo
19314 !! html
19315 <p><s>foo</s>
19316 </p>
19317 !! end
19318
19319 !! test
19320 Sanitizer: Closing of closed but not open tags
19321 !! options
19322 parsoid=wt2html
19323 !! wikitext
19324 </s>
19325 !! html+tidy
19326 <p class="mw-empty-elt">
19327 </p>
19328 !! end
19329
19330 !! test
19331 Sanitizer: Closing of closed but not open table tags
19332 !! options
19333 parsoid=wt2html
19334 !! wikitext
19335 Table not started</td></tr></table>
19336 !! html+tidy
19337 <p>Table not started</p>
19338 !! end
19339
19340 !! test
19341 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
19342 !! options
19343 title=[[Main Page]]
19344 !! config
19345 wgFragmentMode=[ 'html5', 'legacy' ]
19346 !! wikitext
19347 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19348 !! html/php
19349 <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
19350 </p>
19351 !! html/parsoid
19352 <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>
19353 !! end
19354
19355 !! test
19356 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
19357 !! config
19358 wgFragmentMode=[ 'legacy' ]
19359 !! wikitext
19360 <span id="æ: v">byte</span>[[#æ: v|backlink]]
19361 !! html/php
19362 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
19363 </p>
19364 !! end
19365
19366 # In HTML5, the restrictions are that id must contain at least one character,
19367 # and must not contain any space characters.
19368 !! test
19369 Sanitizer: Validating the contents of the id attribute (T6515)
19370 !! options
19371 disabled
19372 !! wikitext
19373 <br id="" /><br id="a space" />
19374 !! html
19375 Something ...
19376 !! end
19377
19378 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
19379 !! test
19380 Sanitizer: Validating id attribute uniqueness (T6515, T8301)
19381 !! options
19382 disabled
19383 !! wikitext
19384 <br id="foo" /><br id="foo" />
19385 !! html
19386 Something need to be done. foo-2 ?
19387 !! end
19388
19389 !! test
19390 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
19391 !! wikitext
19392 <div itemscope>
19393 <meta itemprop="hello" content="world">
19394 <meta http-equiv="refresh" content="5">
19395 <meta itemprop="hello" http-equiv="refresh" content="5">
19396 <link itemprop="hello" href="{{SERVER}}">
19397 <link rel="stylesheet" href="{{SERVER}}">
19398 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
19399 </div>
19400 !! html
19401 <div itemscope="">
19402 <p> <meta itemprop="hello" content="world" />
19403 &lt;meta http-equiv="refresh" content="5"&gt;
19404 <meta itemprop="hello" content="5" />
19405 <link itemprop="hello" href="http&#58;//example.org" />
19406 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
19407 <link itemprop="hello" href="http&#58;//example.org" />
19408 </p>
19409 </div>
19410 !! end
19411
19412 !! test
19413 Sanitizer: Strip comments from CSS attributes
19414 !! options
19415 parsoid=wt2html,wt2wt
19416 !! wikitext
19417 <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
19418 !! html/php
19419 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
19420 </p>
19421 !! html/parsoid
19422 <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
19423 !! end
19424
19425 !! test
19426 Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
19427 !! wikitext
19428 [[meatball:Soft"Security]]
19429 !! html/php
19430 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
19431 </p>
19432 !! html/parsoid
19433 <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>
19434 !! end
19435
19436 !! test
19437 Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
19438 !! wikitext
19439 [[meatball:Foo<Bar]]
19440 [[meatball:Foo>Bar]]
19441 [[meatball:Foo&lt;bar]]
19442 [[meatball:Foo&gt;bar]]
19443 !! html/php
19444 <p>[[meatball:Foo&lt;Bar]]
19445 [[meatball:Foo&gt;Bar]]
19446 [[meatball:Foo&lt;bar]]
19447 [[meatball:Foo&gt;bar]]
19448 </p>
19449 !! html/parsoid
19450 <p>[[meatball:Foo&lt;Bar]]
19451 [[meatball:Foo>Bar]]
19452 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
19453 [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
19454 !! end
19455
19456 !! test
19457 Language converter: output gets cut off unexpectedly (T7757)
19458 !! options
19459 language=zh
19460 !! wikitext
19461 this bit is safe: }-
19462
19463 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
19464
19465 then we get cut off here: }-
19466
19467 all additional text is vanished
19468 !! html/php
19469 <p>this bit is safe: }-
19470 </p><p>but if we add a conversion instance: xxx
19471 </p><p>then we get cut off here: }-
19472 </p><p>all additional text is vanished
19473 </p>
19474 !! html/parsoid
19475 <p>this bit is safe: }-</p>
19476 <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>
19477 <p>then we get cut off here: }-</p>
19478 <p>all additional text is vanished</p>
19479 !! end
19480
19481 !! test
19482 Language converter glossary rules inside attributes (T119158)
19483 !! options
19484 language=sr variant=sr-el
19485 !! wikitext
19486 -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
19487
19488 [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
19489 !! html/php
19490 <p>
19491 </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>
19492 </p>
19493 !! html/parsoid
19494 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
19495
19496 <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>
19497 !! end
19498
19499 !! test
19500 Self closed html pairs (T7487)
19501 !! wikitext
19502 <center><font id="bug" />Centered text</center>
19503 <div><font id="bug2" />In div text</div>
19504 !! html+tidy
19505 <center><font id="bug"></font>Centered text</center>
19506 <div><font id="bug2"></font>In div text</div>
19507 !! end
19508
19509 !! test
19510 Punctuation: nbsp before exclamation
19511 !! wikitext
19512 C'est grave !
19513 !! html
19514 <p>C'est grave&#160;!
19515 </p>
19516 !! end
19517
19518 !! test
19519 Punctuation: CSS !important (T13874)
19520 !! wikitext
19521 <div style="width:50% !important">important</div>
19522 !! html
19523 <div style="width:50% !important">important</div>
19524 !! end
19525
19526 !! test
19527 Punctuation: CSS ! important (T13874; with space after)
19528 !! wikitext
19529 <div style="width:50% ! important">important</div>
19530 !! html
19531 <div style="width:50%&#32;! important">important</div>
19532 !! end
19533
19534 !! test
19535 HTML bullet list, closed tags (T7497)
19536 !! wikitext
19537 <ul>
19538 <li>One</li>
19539 <li>Two</li>
19540 </ul>
19541 !! html/php
19542 <ul>
19543 <li>One</li>
19544 <li>Two</li>
19545 </ul>
19546 !! html/parsoid
19547 <ul data-parsoid='{"stx":"html"}'>
19548 <li data-parsoid='{"stx":"html"}'>One</li>
19549 <li data-parsoid='{"stx":"html"}'>Two</li>
19550 </ul>
19551 !! end
19552
19553 !! test
19554 HTML bullet list, unclosed tags (T7497)
19555 !! wikitext
19556 <ul>
19557 <li>One
19558 <li>Two
19559 </ul>
19560 !! html/php+tidy
19561 <ul>
19562 <li>One
19563 </li><li>Two
19564 </li></ul>
19565 !! html/parsoid
19566 <ul data-parsoid='{"stx":"html"}'>
19567 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19568 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19569 </ul>
19570 !! end
19571
19572 !! test
19573 HTML ordered list, closed tags (T7497)
19574 !! wikitext
19575 <ol>
19576 <li>One</li>
19577 <li>Two</li>
19578 </ol>
19579 !! html/php
19580 <ol>
19581 <li>One</li>
19582 <li>Two</li>
19583 </ol>
19584 !! html/parsoid
19585 <ol data-parsoid='{"stx":"html"}'>
19586 <li data-parsoid='{"stx":"html"}'>One</li>
19587 <li data-parsoid='{"stx":"html"}'>Two</li>
19588 </ol>
19589 !! end
19590
19591 !! test
19592 HTML ordered list, unclosed tags (T7497)
19593 !! options
19594 !! wikitext
19595 <ol>
19596 <li>One
19597 <li>Two
19598 </ol>
19599 !! html/php+tidy
19600 <ol>
19601 <li>One
19602 </li><li>Two
19603 </li></ol>
19604 !! html/parsoid
19605 <ol data-parsoid='{"stx":"html"}'>
19606 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
19607 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
19608 </ol>
19609 !! end
19610
19611 !! test
19612 HTML nested bullet list, closed tags (T7497)
19613 !! wikitext
19614 <ul>
19615 <li>One</li>
19616 <li>Two:
19617 <ul>
19618 <li>Sub-one</li>
19619 <li>Sub-two</li>
19620 </ul>
19621 </li>
19622 </ul>
19623 !! html/php
19624 <ul>
19625 <li>One</li>
19626 <li>Two:
19627 <ul>
19628 <li>Sub-one</li>
19629 <li>Sub-two</li>
19630 </ul>
19631 </li>
19632 </ul>
19633 !! html/parsoid
19634 <ul data-parsoid='{"stx":"html"}'>
19635 <li data-parsoid='{"stx":"html"}'>One</li>
19636 <li data-parsoid='{"stx":"html"}'>Two:
19637 <ul data-parsoid='{"stx":"html"}'>
19638 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
19639 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
19640 </ul>
19641 </li>
19642 </ul>
19643 !! end
19644
19645 !! test
19646 HTML nested bullet list, open tags (T7497)
19647 !! wikitext
19648 <ul>
19649 <li>One
19650 <li>Two:
19651 <ul>
19652 <li>Sub-one
19653 <li>Sub-two
19654 </ul>
19655 </ul>
19656 !! html+tidy
19657 <ul>
19658 <li>One
19659 </li><li>Two:
19660 <ul>
19661 <li>Sub-one
19662 </li><li>Sub-two
19663 </li></ul>
19664 </li></ul>
19665 !! end
19666
19667 !! test
19668 HTML nested ordered list, closed tags (T7497)
19669 !! wikitext
19670 <ol>
19671 <li>One</li>
19672 <li>Two:
19673 <ol>
19674 <li>Sub-one</li>
19675 <li>Sub-two</li>
19676 </ol>
19677 </li>
19678 </ol>
19679 !! html
19680 <ol>
19681 <li>One</li>
19682 <li>Two:
19683 <ol>
19684 <li>Sub-one</li>
19685 <li>Sub-two</li>
19686 </ol>
19687 </li>
19688 </ol>
19689 !! end
19690
19691 !! test
19692 HTML nested ordered list, open tags (T7497)
19693 !! wikitext
19694 <ol>
19695 <li>One
19696 <li>Two:
19697 <ol>
19698 <li>Sub-one
19699 <li>Sub-two
19700 </ol>
19701 </ol>
19702 !! html/php
19703 <ol>
19704 <li>One
19705 <li>Two:
19706 <ol>
19707 <li>Sub-one
19708 <li>Sub-two
19709 </ol>
19710 </ol>
19711 !! html/parsoid
19712 <ol>
19713 <li>One
19714 </li>
19715 <li>Two:
19716 <ol>
19717 <li>Sub-one
19718 </li>
19719 <li>Sub-two
19720 </li>
19721 </ol>
19722 </li>
19723 </ol>
19724 !! end
19725
19726 !! test
19727 HTML ordered list item with parameters oddity
19728 !! wikitext
19729 <ol><li id="fragment">One</li>
19730 </ol>
19731 !! html
19732 <ol><li id="fragment">One</li>
19733 </ol>
19734 !! end
19735
19736 # parsoid doesn't explicitly mark autonumbered links, see T55505
19737 !!test
19738 T7918: autonumbering
19739 !! wikitext
19740 [http://first/] [http://second] [ftp://ftp]
19741
19742 ftp://inlineftp
19743
19744 [mailto:enclosed@mail.tld With target]
19745
19746 [mailto:enclosed@mail.tld]
19747
19748 mailto:inline@mail.tld
19749 !! html/php
19750 <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>
19751 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
19752 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
19753 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
19754 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
19755 </p>
19756 !! html/parsoid
19757 <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>
19758 <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
19759 <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
19760 <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
19761 <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
19762 !! end
19763
19764
19765 #
19766 # Security and HTML correctness
19767 # From Nick Jenkins' fuzz testing
19768 #
19769
19770 !! test
19771 Fuzz testing: Parser13
19772 !! wikitext
19773 {|
19774 | http://a|
19775 !! html
19776 <table>
19777 <tr>
19778 <td>
19779 </td>
19780 </tr>
19781 </table>
19782 !! end
19783
19784 # Note that Parsoid output differs from the PHP parser here: the PHP
19785 # parser breaks the URL for the magic word, while in Parsoid the URL
19786 # production takes precedence.
19787 !! test
19788 Fuzz testing: Parser14
19789 !! wikitext
19790 ==onmouseover===
19791 http://__TOC__
19792 !! html/php
19793 <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>
19794 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>
19795 <ul>
19796 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19797 </ul>
19798 </div>
19799
19800 !! html/php+tidy
19801 <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>
19802 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>
19803 <ul>
19804 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
19805 </ul>
19806 </div>
19807 !! html/parsoid
19808 <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
19809 <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
19810 !! end
19811
19812 !! test
19813 Fuzz testing: Parser14-table
19814 !! options
19815 parsoid=wt2html,html2html
19816 !! wikitext
19817 ==a==
19818 {| STYLE=__TOC__
19819 !! html/php
19820 <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>
19821 <table style="&#95;_TOC&#95;_">
19822 <tr><td></td></tr>
19823 </table>
19824 !! html/php+tidy
19825 <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>
19826 <table style="&#95;_TOC&#95;_">
19827 <tbody><tr><td></td></tr>
19828 </tbody></table>
19829 !! html/parsoid
19830 <h2 id="a">a</h2>
19831 <table style="__TOC__"></table>
19832 !! end
19833
19834 # Known to produce bogus xml (extra </td>)
19835 # Don't add the html/php section since it generates broken HTML
19836 !! test
19837 Fuzz testing: Parser16
19838 !! wikitext
19839 {|
19840 !https://||||||
19841 !! html+tidy
19842 <table>
19843 <tbody><tr>
19844 <th>https://</th>
19845 <th></th>
19846 <th></th>
19847 <th>
19848
19849 </th></tr>
19850 </tbody></table>
19851 !! end
19852
19853 !! test
19854 Fuzz testing: Parser21
19855 !! wikitext
19856 {|
19857 !irc://{{ftp://a" onmouseover="alert('hello world');"
19858 |
19859 !! html
19860 <table>
19861 <tr>
19862 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
19863 </th>
19864 <td>
19865 </td>
19866 </tr>
19867 </table>
19868 !! end
19869
19870 !! test
19871 Fuzz testing: Parser22
19872 !! wikitext
19873 http://===r:::https://b
19874
19875 {|
19876 !! html
19877 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
19878 </p>
19879 <table>
19880 <tr><td></td></tr>
19881 </table>
19882 !! end
19883
19884 ## Remex doesn't account for fostered content.
19885 ## Known to produce bad XML for now
19886 !! test
19887 Fuzz testing: Parser24
19888 !! options
19889 parsoid=wt2html
19890 !! wikitext
19891 {|
19892 {{{|
19893 <u CLASS=
19894 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
19895 <br style="onmouseover='alert(document.cookie);' " />
19896
19897 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19898 |
19899 !! html/php
19900 <table>
19901 {{{|
19902 <u class="&#124;">}}}} &gt;
19903 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19904
19905 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19906 <tr>
19907 <td></u>
19908 </td>
19909 </tr>
19910 </table>
19911 !! html/php+tidy
19912
19913 {{{|
19914 <u class="&#124;">}}}} &gt;
19915 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
19916
19917 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
19918 </u><table><tbody><tr>
19919 <td>
19920 </td>
19921 </tr>
19922 </tbody></table>
19923 !! html/parsoid
19924 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'>
19925 {{{|
19926 <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>"}'/>}}}} >
19927 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/>
19928
19929 MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p>
19930 <table data-parsoid='{"autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedStart":true}'><td></td></tr></tbody></table>
19931 !! end
19932
19933 # Note: the current result listed for this is not what the original one was,
19934 # but the original bug was JavaScript injection, which is fixed in any case.
19935 # It's not clear that the original result listed was any more correct than the
19936 # current one. Original result:
19937 # <p>{{{|
19938 # </p>
19939 # <li class="&#124;&#124;">
19940 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19941 !!test
19942 Fuzz testing: Parser25 (T8055)
19943 !! wikitext
19944 {{{
19945 |
19946 <LI CLASS=||
19947 >
19948 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
19949 !! html/php
19950 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
19951 </p>
19952 !! html/parsoid
19953 <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"]}'>
19954 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
19955 !! end
19956
19957 !!test
19958 Fuzz testing: URL adjacent extension (with space, clean)
19959 !! wikitext
19960 http://example.com <nowiki>junk</nowiki>
19961 !! html/php
19962 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
19963 </p>
19964 !! html/parsoid
19965 <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>
19966 !! end
19967
19968 !!test
19969 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
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; pre)
19981 !! wikitext
19982 http://example.com<pre>junk</pre>
19983 !! html/php
19984 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
19985 !! html/php+tidy
19986 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
19987 !! html/parsoid
19988 <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>
19989 !! end
19990
19991 !! test
19992 Fuzz testing: image with bogus manual thumbnail
19993 !! wikitext
19994 [[Image:foobar.jpg|thumbnail= ]]
19995 !! html/php
19996 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
19997 !! html/parsoid
19998 <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>
19999 !! end
20000
20001 # Parsoid will emit the newline literally in wt2wt; see next test case.
20002 !! test
20003 Fuzz testing: encoded newline in generated HTML replacements (T8577)
20004 !! options
20005 parsoid=wt2html
20006 !! wikitext
20007 <pre dir="&#10;"></pre>
20008 !! html/php
20009 <pre dir="&#10;"></pre>
20010 !! html/parsoid
20011 <pre dir="
20012 " typeof="mw:Extension/pre" about="#mwt2"data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20013 !! end
20014
20015 !! test
20016 Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
20017 !! options
20018 parsoid=html2wt
20019 !! html/parsoid
20020 <pre typeof="mw:Extension/pre" about="#mwt2" dir="
20021 " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
20022 !! wikitext
20023 <pre dir="
20024 "></pre>
20025 !! html/php
20026 <pre dir=""></pre>
20027 !! end
20028
20029 !! test
20030 Templates in extension attributes are not expanded
20031 !! wikitext
20032 <pre dir="{{echo|ltr}}"></pre>
20033 !! html/php
20034 <pre dir="{{echo|ltr}}"></pre>
20035 !! html/parsoid
20036 <pre dir="{{echo|ltr}}" typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
20037 !! end
20038
20039 !! test
20040 Parsing optional HTML elements (T8171)
20041 !! options
20042 !! wikitext
20043 <table>
20044 <tr>
20045 <td> Some tabular data</td>
20046 <td> More tabular data ...
20047 <td> And yet som tabular data</td>
20048 </tr>
20049 </table>
20050 !! html
20051 <table>
20052 <tr>
20053 <td> Some tabular data</td>
20054 <td> More tabular data ...
20055 </td><td> And yet som tabular data</td>
20056 </tr>
20057 </table>
20058 !! end
20059
20060 !! test
20061 Correct handling of <td>, <tr> (T8171)
20062 !! options
20063 !! wikitext
20064 <table>
20065 <tr>
20066 <td> Some tabular data</td>
20067 <td> More tabular data ...</td>
20068 <td> And yet som tabular data</td>
20069 </tr>
20070 </table>
20071 !! html
20072 <table>
20073 <tr>
20074 <td> Some tabular data</td>
20075 <td> More tabular data ...</td>
20076 <td> And yet som tabular data</td>
20077 </tr>
20078 </table>
20079 !! end
20080
20081
20082 !! test
20083 Parsing crashing regression (fr:JavaScript)
20084 !! wikitext
20085 </body></x>
20086 !! html
20087 <p>&lt;/body&gt;&lt;/x&gt;
20088 </p>
20089 !! end
20090
20091 !! test
20092 Inline wiki vs wiki block nesting
20093 !! wikitext
20094 '''Bold paragraph
20095
20096 New wiki paragraph
20097 !! html
20098 <p><b>Bold paragraph</b>
20099 </p><p>New wiki paragraph
20100 </p>
20101 !! end
20102
20103 # FIXME: The current php output is documented
20104 # and desired output is the parsoid target.
20105 !! test
20106 Inline HTML vs wiki block nesting
20107 !! wikitext
20108 <b>Bold paragraph
20109
20110 New wiki paragraph
20111 !! html/php
20112 <p><b>Bold paragraph
20113 </p><p>New wiki paragraph</b>
20114 </p>
20115 !! html/php+tidy
20116 <p><b>Bold paragraph
20117 </b></p><p><b>New wiki paragraph
20118 </b></p>
20119 !! html/parsoid
20120 <p><b>Bold paragraph</b>
20121 </p><p>New wiki paragraph
20122 </p>
20123 !! end
20124
20125 # Original result was this:
20126 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
20127 # </p>
20128 # While that might be marginally more intuitive, maybe, the six-apostrophe
20129 # construct is clearly pathological and the result stated here (which is what
20130 # the parser actually does) is about as reasonable as anything.
20131 !!test
20132 Mixing markup for italics and bold
20133 !! options
20134 !! wikitext
20135 '''bold''''''bold''bolditalics'''''
20136 !! html
20137 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
20138 </p>
20139 !! end
20140
20141
20142 !! article
20143 Xyzzyx
20144 !! text
20145 Article for special page transclusion test
20146 !! endarticle
20147
20148 !! test
20149 Special page transclusion
20150 !! options
20151 !! wikitext
20152 {{Special:Prefixindex/Xyzzyx}}
20153 !! html
20154 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20155 </ul>
20156 !! end
20157
20158 !! test
20159 Special page transclusion twice (T7021)
20160 !! options
20161 !! wikitext
20162 {{Special:Prefixindex/Xyzzyx}}
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 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
20168 </ul>
20169 !! end
20170
20171 !! test
20172 Transclusion of default MediaWiki message
20173 !! wikitext
20174 {{MediaWiki:Mainpage}}
20175 !! html
20176 <p>Main Page
20177 </p>
20178 !! end
20179
20180 !! test
20181 Transclusion of nonexistent MediaWiki message
20182 !! wikitext
20183 {{MediaWiki:Mainpagexxx}}
20184 !! html
20185 <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>
20186 </p>
20187 !! end
20188
20189 !! test
20190 Transclusion of MediaWiki message with underscore
20191 !! wikitext
20192 {{MediaWiki:history_short}}
20193 !! html
20194 <p>History
20195 </p>
20196 !! end
20197
20198 !! test
20199 Transclusion of MediaWiki message with space
20200 !! wikitext
20201 {{MediaWiki:history short}}
20202 !! html
20203 <p>History
20204 </p>
20205 !! end
20206
20207 !! test
20208 Invalid header with following text
20209 !! wikitext
20210 = x = y
20211 !! html
20212 <p>= x = y
20213 </p>
20214 !! end
20215
20216
20217 !! test
20218 Section extraction test (section 0)
20219 !! options
20220 section=0
20221 !! wikitext
20222 start
20223 ==a==
20224 ===aa===
20225 ====aaa====
20226 ==b==
20227 ===ba===
20228 ===bb===
20229 ====bba====
20230 ===bc===
20231 ==c==
20232 ===ca===
20233 !! html/php
20234 start
20235 !! end
20236
20237 !! test
20238 Section extraction test (section 1)
20239 !! options
20240 section=1
20241 !! wikitext
20242 start
20243 ==a==
20244 ===aa===
20245 ====aaa====
20246 ==b==
20247 ===ba===
20248 ===bb===
20249 ====bba====
20250 ===bc===
20251 ==c==
20252 ===ca===
20253 !! html/php
20254 ==a==
20255 ===aa===
20256 ====aaa====
20257 !! end
20258
20259 !! test
20260 Section extraction test (section 2)
20261 !! options
20262 section=2
20263 !! wikitext
20264 start
20265 ==a==
20266 ===aa===
20267 ====aaa====
20268 ==b==
20269 ===ba===
20270 ===bb===
20271 ====bba====
20272 ===bc===
20273 ==c==
20274 ===ca===
20275 !! html/php
20276 ===aa===
20277 ====aaa====
20278 !! end
20279
20280 !! test
20281 Section extraction test (section 3)
20282 !! options
20283 section=3
20284 !! wikitext
20285 start
20286 ==a==
20287 ===aa===
20288 ====aaa====
20289 ==b==
20290 ===ba===
20291 ===bb===
20292 ====bba====
20293 ===bc===
20294 ==c==
20295 ===ca===
20296 !! html/php
20297 ====aaa====
20298 !! end
20299
20300 !! test
20301 Section extraction test (section 4)
20302 !! options
20303 section=4
20304 !! wikitext
20305 start
20306 ==a==
20307 ===aa===
20308 ====aaa====
20309 ==b==
20310 ===ba===
20311 ===bb===
20312 ====bba====
20313 ===bc===
20314 ==c==
20315 ===ca===
20316 !! html/php
20317 ==b==
20318 ===ba===
20319 ===bb===
20320 ====bba====
20321 ===bc===
20322 !! end
20323
20324 !! test
20325 Section extraction test (section 5)
20326 !! options
20327 section=5
20328 !! wikitext
20329 start
20330 ==a==
20331 ===aa===
20332 ====aaa====
20333 ==b==
20334 ===ba===
20335 ===bb===
20336 ====bba====
20337 ===bc===
20338 ==c==
20339 ===ca===
20340 !! html/php
20341 ===ba===
20342 !! end
20343
20344 !! test
20345 Section extraction test (section 6)
20346 !! options
20347 section=6
20348 !! wikitext
20349 start
20350 ==a==
20351 ===aa===
20352 ====aaa====
20353 ==b==
20354 ===ba===
20355 ===bb===
20356 ====bba====
20357 ===bc===
20358 ==c==
20359 ===ca===
20360 !! html/php
20361 ===bb===
20362 ====bba====
20363 !! end
20364
20365 !! test
20366 Section extraction test (section 7)
20367 !! options
20368 section=7
20369 !! wikitext
20370 start
20371 ==a==
20372 ===aa===
20373 ====aaa====
20374 ==b==
20375 ===ba===
20376 ===bb===
20377 ====bba====
20378 ===bc===
20379 ==c==
20380 ===ca===
20381 !! html/php
20382 ====bba====
20383 !! end
20384
20385 !! test
20386 Section extraction test (section 8)
20387 !! options
20388 section=8
20389 !! wikitext
20390 start
20391 ==a==
20392 ===aa===
20393 ====aaa====
20394 ==b==
20395 ===ba===
20396 ===bb===
20397 ====bba====
20398 ===bc===
20399 ==c==
20400 ===ca===
20401 !! html/php
20402 ===bc===
20403 !! end
20404
20405 !! test
20406 Section extraction test (section 9)
20407 !! options
20408 section=9
20409 !! wikitext
20410 start
20411 ==a==
20412 ===aa===
20413 ====aaa====
20414 ==b==
20415 ===ba===
20416 ===bb===
20417 ====bba====
20418 ===bc===
20419 ==c==
20420 ===ca===
20421 !! html/php
20422 ==c==
20423 ===ca===
20424 !! end
20425
20426 !! test
20427 Section extraction test (section 10)
20428 !! options
20429 section=10
20430 !! wikitext
20431 start
20432 ==a==
20433 ===aa===
20434 ====aaa====
20435 ==b==
20436 ===ba===
20437 ===bb===
20438 ====bba====
20439 ===bc===
20440 ==c==
20441 ===ca===
20442 !! html/php
20443 ===ca===
20444 !! end
20445
20446 !! test
20447 Section extraction test (nonexistent section 11)
20448 !! options
20449 section=11
20450 !! wikitext
20451 start
20452 ==a==
20453 ===aa===
20454 ====aaa====
20455 ==b==
20456 ===ba===
20457 ===bb===
20458 ====bba====
20459 ===bc===
20460 ==c==
20461 ===ca===
20462 !! html/php
20463 !! end
20464
20465 !! test
20466 Section extraction test with bogus heading (section 1)
20467 !! options
20468 section=1
20469 !! wikitext
20470 ==a==
20471 ==bogus== not a legal section
20472 ==b==
20473 !! html/php
20474 ==a==
20475 ==bogus== not a legal section
20476 !! end
20477
20478 !! test
20479 Section extraction test with bogus heading (section 2)
20480 !! options
20481 section=2
20482 !! wikitext
20483 ==a==
20484 ==bogus== not a legal section
20485 ==b==
20486 !! html/php
20487 ==b==
20488 !! end
20489
20490 !! test
20491 Section extraction test with comment after heading (section 1)
20492 !! options
20493 section=1
20494 !! wikitext
20495 ==a==
20496 ==b== <!-- -->
20497 ==c==
20498 !! html/php
20499 ==a==
20500 !! end
20501
20502 !! test
20503 Section extraction test with comment after heading (section 2)
20504 !! options
20505 section=2
20506 !! wikitext
20507 ==a==
20508 ==b== <!-- -->
20509 ==c==
20510 !! html/php
20511 ==b== <!-- -->
20512 !! end
20513
20514 !! test
20515 Section extraction test with bogus <nowiki> heading (section 1)
20516 !! options
20517 section=1
20518 !! wikitext
20519 ==a==
20520 ==bogus== <nowiki>not a legal section</nowiki>
20521 ==b==
20522 !! html/php
20523 ==a==
20524 ==bogus== <nowiki>not a legal section</nowiki>
20525 !! end
20526
20527 !! test
20528 Section extraction test with bogus <nowiki> heading (section 2)
20529 !! options
20530 section=2
20531 !! wikitext
20532 ==a==
20533 ==bogus== <nowiki>not a legal section</nowiki>
20534 ==b==
20535 !! html/php
20536 ==b==
20537 !! end
20538
20539 # Formerly testing for T4587, now resolved by the use of unmarked sections
20540 # instead of respecting commented sections
20541 !! test
20542 Section extraction prefixed by comment (section 1)
20543 !! options
20544 section=1
20545 !! wikitext
20546 <!-- -->==sec1==
20547 ==sec2==
20548 !! html/php
20549 ==sec2==
20550 !!end
20551
20552 !! test
20553 Section extraction prefixed by comment (section 2)
20554 !! options
20555 section=2
20556 !! wikitext
20557 <!-- -->==sec1==
20558 ==sec2==
20559 !! html/php
20560 !! end
20561
20562 # Formerly testing for T4607, now resolved by the use of unmarked sections
20563 # instead of respecting HTML-style headings
20564 !! test
20565 Section extraction, mixed wiki and html (section 1)
20566 !! options
20567 section=1
20568 !! wikitext
20569 <h2>unmarked</h2>
20570 unmarked
20571 ==1==
20572 one
20573 ==2==
20574 two
20575 !! html/php
20576 ==1==
20577 one
20578 !! end
20579
20580 !! test
20581 Section extraction, mixed wiki and html (section 2)
20582 !! options
20583 section=2
20584 !! wikitext
20585 <h2>unmarked</h2>
20586 unmarked
20587 ==1==
20588 one
20589 ==2==
20590 two
20591 !! html/php
20592 ==2==
20593 two
20594 !! end
20595
20596
20597 # Formerly testing for T5342
20598 !! test
20599 Section extraction, heading surrounded by <noinclude>
20600 !! options
20601 section=1
20602 !! wikitext
20603 <noinclude>==unmarked==</noinclude>
20604 ==marked==
20605 !! html/php
20606 ==marked==
20607 !!end
20608
20609 # Test behavior of T21910
20610 !! test
20611 Sectiion with all-equals
20612 !! options
20613 section=2
20614 !! wikitext
20615 ===
20616 The line above must have a trailing space
20617 === <!--
20618 --> <!-- -->
20619 But just in case it doesn't...
20620 !! html/php
20621 === <!--
20622 --> <!-- -->
20623 But just in case it doesn't...
20624 !! end
20625
20626 !! test
20627 Section replacement test (section 0)
20628 !! options
20629 replace=0,"xxx"
20630 !! wikitext
20631 start
20632 ==a==
20633 ===aa===
20634 ====aaa====
20635 ==b==
20636 ===ba===
20637 ===bb===
20638 ====bba====
20639 ===bc===
20640 ==c==
20641 ===ca===
20642 !! html/php
20643 xxx
20644
20645 ==a==
20646 ===aa===
20647 ====aaa====
20648 ==b==
20649 ===ba===
20650 ===bb===
20651 ====bba====
20652 ===bc===
20653 ==c==
20654 ===ca===
20655 !! end
20656
20657 !! test
20658 Section replacement test (section 1)
20659 !! options
20660 replace=1,"xxx"
20661 !! wikitext
20662 start
20663 ==a==
20664 ===aa===
20665 ====aaa====
20666 ==b==
20667 ===ba===
20668 ===bb===
20669 ====bba====
20670 ===bc===
20671 ==c==
20672 ===ca===
20673 !! html/php
20674 start
20675 xxx
20676
20677 ==b==
20678 ===ba===
20679 ===bb===
20680 ====bba====
20681 ===bc===
20682 ==c==
20683 ===ca===
20684 !! end
20685
20686 !! test
20687 Section replacement test (section 2)
20688 !! options
20689 replace=2,"xxx"
20690 !! wikitext
20691 start
20692 ==a==
20693 ===aa===
20694 ====aaa====
20695 ==b==
20696 ===ba===
20697 ===bb===
20698 ====bba====
20699 ===bc===
20700 ==c==
20701 ===ca===
20702 !! html/php
20703 start
20704 ==a==
20705 xxx
20706
20707 ==b==
20708 ===ba===
20709 ===bb===
20710 ====bba====
20711 ===bc===
20712 ==c==
20713 ===ca===
20714 !! end
20715
20716 !! test
20717 Section replacement test (section 3)
20718 !! options
20719 replace=3,"xxx"
20720 !! wikitext
20721 start
20722 ==a==
20723 ===aa===
20724 ====aaa====
20725 ==b==
20726 ===ba===
20727 ===bb===
20728 ====bba====
20729 ===bc===
20730 ==c==
20731 ===ca===
20732 !! html/php
20733 start
20734 ==a==
20735 ===aa===
20736 xxx
20737
20738 ==b==
20739 ===ba===
20740 ===bb===
20741 ====bba====
20742 ===bc===
20743 ==c==
20744 ===ca===
20745 !! end
20746
20747 !! test
20748 Section replacement test (section 4)
20749 !! options
20750 replace=4,"xxx"
20751 !! wikitext
20752 start
20753 ==a==
20754 ===aa===
20755 ====aaa====
20756 ==b==
20757 ===ba===
20758 ===bb===
20759 ====bba====
20760 ===bc===
20761 ==c==
20762 ===ca===
20763 !! html/php
20764 start
20765 ==a==
20766 ===aa===
20767 ====aaa====
20768 xxx
20769
20770 ==c==
20771 ===ca===
20772 !! end
20773
20774 !! test
20775 Section replacement test (section 5)
20776 !! options
20777 replace=5,"xxx"
20778 !! wikitext
20779 start
20780 ==a==
20781 ===aa===
20782 ====aaa====
20783 ==b==
20784 ===ba===
20785 ===bb===
20786 ====bba====
20787 ===bc===
20788 ==c==
20789 ===ca===
20790 !! html/php
20791 start
20792 ==a==
20793 ===aa===
20794 ====aaa====
20795 ==b==
20796 xxx
20797
20798 ===bb===
20799 ====bba====
20800 ===bc===
20801 ==c==
20802 ===ca===
20803 !! end
20804
20805 !! test
20806 Section replacement test (section 6)
20807 !! options
20808 replace=6,"xxx"
20809 !! wikitext
20810 start
20811 ==a==
20812 ===aa===
20813 ====aaa====
20814 ==b==
20815 ===ba===
20816 ===bb===
20817 ====bba====
20818 ===bc===
20819 ==c==
20820 ===ca===
20821 !! html/php
20822 start
20823 ==a==
20824 ===aa===
20825 ====aaa====
20826 ==b==
20827 ===ba===
20828 xxx
20829
20830 ===bc===
20831 ==c==
20832 ===ca===
20833 !! end
20834
20835 !! test
20836 Section replacement test (section 7)
20837 !! options
20838 replace=7,"xxx"
20839 !! wikitext
20840 start
20841 ==a==
20842 ===aa===
20843 ====aaa====
20844 ==b==
20845 ===ba===
20846 ===bb===
20847 ====bba====
20848 ===bc===
20849 ==c==
20850 ===ca===
20851 !! html/php
20852 start
20853 ==a==
20854 ===aa===
20855 ====aaa====
20856 ==b==
20857 ===ba===
20858 ===bb===
20859 xxx
20860
20861 ===bc===
20862 ==c==
20863 ===ca===
20864 !! end
20865
20866 !! test
20867 Section replacement test (section 8)
20868 !! options
20869 replace=8,"xxx"
20870 !! wikitext
20871 start
20872 ==a==
20873 ===aa===
20874 ====aaa====
20875 ==b==
20876 ===ba===
20877 ===bb===
20878 ====bba====
20879 ===bc===
20880 ==c==
20881 ===ca===
20882 !! html/php
20883 start
20884 ==a==
20885 ===aa===
20886 ====aaa====
20887 ==b==
20888 ===ba===
20889 ===bb===
20890 ====bba====
20891 xxx
20892
20893 ==c==
20894 ===ca===
20895 !!end
20896
20897 !! test
20898 Section replacement test (section 9)
20899 !! options
20900 replace=9,"xxx"
20901 !! wikitext
20902 start
20903 ==a==
20904 ===aa===
20905 ====aaa====
20906 ==b==
20907 ===ba===
20908 ===bb===
20909 ====bba====
20910 ===bc===
20911 ==c==
20912 ===ca===
20913 !! html/php
20914 start
20915 ==a==
20916 ===aa===
20917 ====aaa====
20918 ==b==
20919 ===ba===
20920 ===bb===
20921 ====bba====
20922 ===bc===
20923 xxx
20924 !! end
20925
20926 !! test
20927 Section replacement test (section 10)
20928 !! options
20929 replace=10,"xxx"
20930 !! wikitext
20931 start
20932 ==a==
20933 ===aa===
20934 ====aaa====
20935 ==b==
20936 ===ba===
20937 ===bb===
20938 ====bba====
20939 ===bc===
20940 ==c==
20941 ===ca===
20942 !! html/php
20943 start
20944 ==a==
20945 ===aa===
20946 ====aaa====
20947 ==b==
20948 ===ba===
20949 ===bb===
20950 ====bba====
20951 ===bc===
20952 ==c==
20953 xxx
20954 !! end
20955
20956 !! test
20957 Section replacement test with initial whitespace (T15728)
20958 !! options
20959 replace=2,"xxx"
20960 !! wikitext
20961 Preformatted initial line
20962 ==a==
20963 ===a===
20964 !! html/php
20965 Preformatted initial line
20966 ==a==
20967 xxx
20968 !! end
20969
20970
20971 !! test
20972 Section extraction, heading followed by pre with 20 spaces (T8398)
20973 !! options
20974 section=1
20975 !! wikitext
20976 ==a==
20977 a
20978 !! html/php
20979 ==a==
20980 a
20981 !! end
20982
20983 !! test
20984 Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
20985 !! options
20986 section=1
20987 !! wikitext
20988 ==a==
20989 a
20990 !! html/php
20991 ==a==
20992 a
20993 !! end
20994
20995
20996 !! test
20997 Section extraction, <pre> around bogus header (T12309)
20998 !! options
20999 section=2
21000 !! wikitext
21001 == Section One ==
21002 <pre>
21003 =======
21004 </pre>
21005
21006 == Section Two ==
21007 stuff
21008 !! html/php
21009 == Section Two ==
21010 stuff
21011 !! end
21012
21013 !! test
21014 Section replacement, <pre> around bogus header (T12309)
21015 !! options
21016 replace=2,"xxx"
21017 !! wikitext
21018 == Section One ==
21019 <pre>
21020 =======
21021 </pre>
21022
21023 == Section Two ==
21024 stuff
21025 !! html/php
21026 == Section One ==
21027 <pre>
21028 =======
21029 </pre>
21030
21031 xxx
21032 !! end
21033
21034 !! test
21035 Handling of &#x0A; in URLs
21036 !! wikitext
21037 *irc://&#x0A;a
21038 !! html/php
21039 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21040 !! html/parsoid
21041 <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>
21042 !! end
21043
21044 !! test
21045 Handling of %0A in URLs
21046 !! wikitext
21047 *irc://%0Aa
21048 !! html/php
21049 <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21050 !! html/parsoid
21051 <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
21052 !! end
21053
21054 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
21055 !! test
21056 5 quotes, code coverage +1 line
21057 !! options
21058 parsoid=wt2html
21059 !! wikitext
21060 '''''
21061 !! html/php
21062 !! html/parsoid
21063 <p><b><i></i></b></p>
21064 !! end
21065
21066 # same html as previous, but wikitext adjusted to match parsoid html2wt
21067 # note that wt2html and html2html will put the <i> before the <b>
21068 !! test
21069 5 quotes, code coverage +1 line w/ nowiki (1)
21070 !! options
21071 parsoid=wt2wt,html2wt
21072 !! wikitext
21073 '''''<nowiki/>'''''
21074 !! html/php
21075 <p><i></i>
21076 </p>
21077 !! html/parsoid
21078 <p><b><i></i></b></p>
21079 !! end
21080
21081 # same as previous, just swapping the <i> and <b>
21082 !! test
21083 5 quotes, code coverage +1 line w/ nowiki (2)
21084 !! wikitext
21085 '''''<nowiki/>'''''
21086 !! html/php
21087 <p><i></i>
21088 </p>
21089 !! html/parsoid
21090 <p><i><b></b></i></p>
21091 !! end
21092
21093 !! test
21094 Special:Search page linking.
21095 !! wikitext
21096 {{Special:search}}
21097 !! html
21098 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
21099 </p>
21100 !! end
21101
21102 !! test
21103 {{!}} is a magic word
21104 !! wikitext
21105 {{!}} is a magic word there and {{!}} is still a magic word here
21106 | is not a magic word here but {{!}} is still a magic word here
21107 !! html/php
21108 <p>| is a magic word there and | is still a magic word here
21109 | is not a magic word here but | is still a magic word here
21110 </p>
21111 !! html/parsoid
21112 <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
21113 | 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>
21114 !! end
21115
21116 !! test
21117 Say the magic word
21118 !! options
21119 title=[[Parser test]]
21120 !! wikitext
21121 *{{PAGENAME}}
21122 *{{PAGENAMEE}}
21123 *{{FULLPAGENAME}}
21124 *{{FULLPAGENAMEE}}
21125 *{{BASEPAGENAME}}
21126 *{{BASEPAGENAMEE}}
21127 *{{SUBPAGENAME}}
21128 *{{SUBPAGENAMEE}}
21129 *{{ROOTPAGENAME}}
21130 *{{ROOTPAGENAMEE}}
21131 *{{TALKPAGENAME}}
21132 *{{TALKPAGENAMEE}}
21133 *{{SUBJECTPAGENAME}}
21134 *{{SUBJECTPAGENAMEE}}
21135 *{{NAMESPACEE}}
21136 *{{NAMESPACE}}
21137 *{{NAMESPACENUMBER}}
21138 *{{TALKSPACE}}
21139 *{{TALKSPACEE}}
21140 *{{SUBJECTSPACE}}
21141 *{{SUBJECTSPACEE}}
21142 *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
21143 !! html
21144 <ul><li>Parser test</li>
21145 <li>Parser_test</li>
21146 <li>Parser test</li>
21147 <li>Parser_test</li>
21148 <li>Parser test</li>
21149 <li>Parser_test</li>
21150 <li>Parser test</li>
21151 <li>Parser_test</li>
21152 <li>Parser test</li>
21153 <li>Parser_test</li>
21154 <li>Talk:Parser test</li>
21155 <li>Talk:Parser_test</li>
21156 <li>Parser test</li>
21157 <li>Parser_test</li>
21158 <li></li>
21159 <li></li>
21160 <li>0</li>
21161 <li>Talk</li>
21162 <li>Talk</li>
21163 <li></li>
21164 <li></li>
21165 <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>
21166 !! end
21167 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
21168
21169 !! test
21170 Gallery with valid attributes
21171 !! wikitext
21172 <gallery type="123" summary="345">
21173 File:File:Foobar.jpg
21174 </gallery>
21175 !! html/php
21176 <ul class="gallery mw-gallery-traditional" type="123">
21177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21178 <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
21179 <div class="gallerytext">
21180 </div>
21181 </div></li>
21182 </ul>
21183 !! html/parsoid
21184 <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{}}'>
21185 <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>
21186 </ul>
21187 !! end
21188
21189 ## Parsoid thinks the "centre" here is a property, not a caption.
21190 !! test
21191 Gallery
21192 !! options
21193 parsoid={
21194 "modes": ["wt2html"]
21195 }
21196 !! wikitext
21197 <gallery>
21198 image1.png |
21199 image2.gif|||||
21200
21201 image3|
21202 image4 |300px| centre
21203 image5.svg| http://///////
21204 [[x|xx]]]]
21205 * image6
21206 </gallery>
21207 !! html/php
21208 <ul class="gallery mw-gallery-traditional">
21209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21210 <div class="thumb" style="height: 150px;">Image1.png</div>
21211 <div class="gallerytext">
21212 </div>
21213 </div></li>
21214 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21215 <div class="thumb" style="height: 150px;">Image2.gif</div>
21216 <div class="gallerytext">
21217 </div>
21218 </div></li>
21219 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21220 <div class="thumb" style="height: 150px;">Image3</div>
21221 <div class="gallerytext">
21222 </div>
21223 </div></li>
21224 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21225 <div class="thumb" style="height: 150px;">Image4</div>
21226 <div class="gallerytext">
21227 <pre>centre
21228 </pre>
21229 </div>
21230 </div></li>
21231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21232 <div class="thumb" style="height: 150px;">Image5.svg</div>
21233 <div class="gallerytext">
21234 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
21235 </p>
21236 </div>
21237 </div></li>
21238 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21239 <div class="thumb" style="height: 150px;">* image6</div>
21240 <div class="gallerytext">
21241 </div>
21242 </div></li>
21243 </ul>
21244 !! html/parsoid
21245 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21246 <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>
21247 <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>
21248 <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>
21249 <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>
21250 <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>
21251 <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>
21252 </ul>
21253 !! end
21254
21255 !! test
21256 Gallery (with options, html)
21257 !! options
21258 parsoid={
21259 "modes": ["wt2html", "html2html"]
21260 }
21261 !! wikitext
21262 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21263 File:Nonexistent.jpg|caption
21264 File:Nonexistent.jpg
21265 image:foobar.jpg|some '''caption''' [[Main Page]]
21266 image:foobar.jpg
21267 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21268 </gallery>
21269 !! html/php
21270 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21271 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21272 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21273 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21274 <div class="gallerytext">
21275 <p>caption
21276 </p>
21277 </div>
21278 </div></li>
21279 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21280 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21281 <div class="gallerytext">
21282 </div>
21283 </div></li>
21284 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21285 <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>
21286 <div class="gallerytext">
21287 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21288 </p>
21289 </div>
21290 </div></li>
21291 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21292 <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>
21293 <div class="gallerytext">
21294 </div>
21295 </div></li>
21296 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21297 <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>
21298 <div class="gallerytext">
21299 <p>blabla.
21300 </p>
21301 </div>
21302 </div></li>
21303 </ul>
21304 !! html/parsoid
21305 <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":{}}'>
21306 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21307 <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>
21308 <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>
21309 <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>
21310 <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>
21311 <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>
21312 </ul>
21313 !! end
21314
21315 ## FIXME: This test can be dropped when Parsoid content versions 2.0.0 / 1.8.0
21316 ## are no longer in storage.
21317 !! test
21318 Gallery (with options, extsrc)
21319 !! options
21320 parsoid=html2wt
21321 !! wikitext
21322 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
21323 File:Nonexistent.jpg|caption
21324 File:Nonexistent.jpg
21325 image:foobar.jpg|some '''caption''' [[Main Page]]
21326 image:foobar.jpg
21327 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
21328 </gallery>
21329 !! html/php
21330 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
21331 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
21332 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21333 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21334 <div class="gallerytext">
21335 <p>caption
21336 </p>
21337 </div>
21338 </div></li>
21339 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21340 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
21341 <div class="gallerytext">
21342 </div>
21343 </div></li>
21344 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21345 <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>
21346 <div class="gallerytext">
21347 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21348 </p>
21349 </div>
21350 </div></li>
21351 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21352 <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>
21353 <div class="gallerytext">
21354 </div>
21355 </div></li>
21356 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21357 <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>
21358 <div class="gallerytext">
21359 <p>blabla.
21360 </p>
21361 </div>
21362 </div></li>
21363 </ul>
21364 !! html/parsoid
21365 <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"}}'>
21366 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
21367 <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>
21368 <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>
21369 <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>
21370 <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>
21371 <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>
21372 </ul>
21373 !! end
21374
21375 !! test
21376 Gallery (without px units)
21377 !! wikitext
21378 <gallery widths="70" heights="40">
21379 File:Foobar.jpg
21380 </gallery>
21381 !! html/php
21382 <ul class="gallery mw-gallery-traditional">
21383 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
21384 <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>
21385 <div class="gallerytext">
21386 </div>
21387 </div></li>
21388 </ul>
21389 !! html/parsoid
21390 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{}}'>
21391 <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>
21392 </ul>
21393 !! end
21394
21395 !! test
21396 Gallery (with invalid units)
21397 !! wikitext
21398 <gallery widths="70em" heights="40em">
21399 File:Foobar.jpg
21400 </gallery>
21401 !! html/php
21402 <ul class="gallery mw-gallery-traditional">
21403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21404 <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>
21405 <div class="gallerytext">
21406 </div>
21407 </div></li>
21408 </ul>
21409 !! html/parsoid
21410 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{}}'>
21411 <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>
21412 </ul>
21413 !! end
21414
21415 !! test
21416 Gallery with link that has fragment
21417 !! options
21418 parsoid={
21419 "modes": ["wt2html", "html2html"]
21420 }
21421 !! wikitext
21422 <gallery>
21423 image:foobar.jpg|link=Main_Page
21424 image:foobar.jpg|link=Main_Page#section
21425 image:foobar.jpg|link=Main Page#section|caption
21426 </gallery>
21427 !! html/php
21428 <ul class="gallery mw-gallery-traditional">
21429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21430 <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>
21431 <div class="gallerytext">
21432 </div>
21433 </div></li>
21434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21435 <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>
21436 <div class="gallerytext">
21437 </div>
21438 </div></li>
21439 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21440 <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>
21441 <div class="gallerytext">
21442 <p>caption
21443 </p>
21444 </div>
21445 </div></li>
21446 </ul>
21447 !! html/parsoid
21448 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21449 <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>
21450 <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>
21451 <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>
21452 </ul>
21453 !! end
21454
21455 !! test
21456 Gallery with template inside caption
21457 !! wikitext
21458 <gallery caption="{{echo|hi}}">
21459 File:Foobar.jpg|{{echo|ho}}
21460 </gallery>
21461 !! html/php
21462 <ul class="gallery mw-gallery-traditional">
21463 <li class='gallerycaption'>hi</li>
21464 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21465 <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>
21466 <div class="gallerytext">
21467 <p>ho
21468 </p>
21469 </div>
21470 </div></li>
21471 </ul>
21472 !! html/parsoid
21473 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21474 <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>
21475 <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>
21476 </ul>
21477 !! end
21478
21479 !! test
21480 Gallery with wikitext inside gallery caption
21481 !! options
21482 parsoid={
21483 "modes": ["wt2html", "html2html"]
21484 }
21485 !! wikitext
21486 <gallery caption="# This should not be a list item
21487
21488 Text '''bold''' [[link]] {{ns:-1}}
21489
21490 [[File:Foobar.jpg|thumb|File in gallery caption]]">
21491 File:Foobar.jpg|Image caption
21492 </gallery>
21493 !! html/php
21494 <ul class="gallery mw-gallery-traditional">
21495 <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>
21496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21497 <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>
21498 <div class="gallerytext">
21499 <p>Image caption
21500 </p>
21501 </div>
21502 </div></li>
21503 </ul>
21504 !! html/parsoid
21505 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21506 <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>
21507 <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>
21508 </ul>
21509 !! end
21510
21511 !! test
21512 Gallery with wikitext inside caption
21513 !! wikitext
21514 <gallery>
21515 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
21516 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
21517 </gallery>
21518 !! html/php
21519 <ul class="gallery mw-gallery-traditional">
21520 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21521 <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>
21522 <div class="gallerytext">
21523 <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>
21524 </p>
21525 </div>
21526 </div></li>
21527 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21528 <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>
21529 <div class="gallerytext">
21530 <p>This is a test template
21531 </p>
21532 </div>
21533 </div></li>
21534 </ul>
21535 !! html/parsoid
21536 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21537 <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>
21538 <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>
21539 </ul>
21540 !! end
21541
21542 !! test
21543 Gallery (with showfilename option)
21544 !! wikitext
21545 <gallery showfilename="">
21546 File:Nonexistent.jpg|caption
21547 File:Nonexistent.jpg
21548 File:Foobar.jpg|some '''caption''' [[Main Page]]
21549 File:Foobar.jpg
21550 </gallery>
21551 !! html/php
21552 <ul class="gallery mw-gallery-traditional">
21553 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21554 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21555 <div class="gallerytext">
21556 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21557 caption
21558 </p>
21559 </div>
21560 </div></li>
21561 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21562 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21563 <div class="gallerytext">
21564 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
21565 </p>
21566 </div>
21567 </div></li>
21568 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21569 <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>
21570 <div class="gallerytext">
21571 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21572 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21573 </p>
21574 </div>
21575 </div></li>
21576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21577 <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>
21578 <div class="gallerytext">
21579 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
21580 </p>
21581 </div>
21582 </div></li>
21583 </ul>
21584 !! html/parsoid
21585 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
21586 <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>
21587 <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>
21588 <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>
21589 <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>
21590 </ul>
21591 !! end
21592
21593 ## Should Parsoid be preserving these variations? See T151367
21594 !! test
21595 Gallery (with namespace-less filenames)
21596 !! options
21597 parsoid={
21598 "modes": ["wt2html", "html2html"]
21599 }
21600 !! wikitext
21601 <gallery>
21602 File:Nonexistent.jpg
21603 Nonexistent.jpg
21604 image:foobar.jpg
21605 foobar.jpg
21606 </gallery>
21607 !! html/php
21608 <ul class="gallery mw-gallery-traditional">
21609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21610 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21611 <div class="gallerytext">
21612 </div>
21613 </div></li>
21614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21615 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
21616 <div class="gallerytext">
21617 </div>
21618 </div></li>
21619 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21620 <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>
21621 <div class="gallerytext">
21622 </div>
21623 </div></li>
21624 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21625 <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>
21626 <div class="gallerytext">
21627 </div>
21628 </div></li>
21629 </ul>
21630 !! html/parsoid
21631 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21632 <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>
21633 <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>
21634 <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>
21635 <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>
21636 </ul>
21637 !! end
21638
21639 !! test
21640 Gallery override link with wikilink (T36852)
21641 !! wikitext
21642 <gallery>
21643 File:Foobar.jpg|alt=galleryalt|link=Wikilink
21644 </gallery>
21645 !! html/php
21646 <ul class="gallery mw-gallery-traditional">
21647 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21648 <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>
21649 <div class="gallerytext">
21650 </div>
21651 </div></li>
21652 </ul>
21653 !! html/parsoid
21654 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21655 <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>
21656 </ul>
21657 !! end
21658
21659 !! test
21660 Gallery override link with absolute external link (T36852)
21661 !! wikitext
21662 <gallery>
21663 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
21664 </gallery>
21665 !! html/php
21666 <ul class="gallery mw-gallery-traditional">
21667 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21668 <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>
21669 <div class="gallerytext">
21670 </div>
21671 </div></li>
21672 </ul>
21673 !! html/parsoid
21674 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21675 <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>
21676 </ul>
21677 !! end
21678
21679 ## Putting the caption at the end here runs into T49646 on the php side
21680 ## so reducing the modes this runs in Parsoid
21681 !! test
21682 Gallery override link with absolute external link with LanguageConverter
21683 !! options
21684 language=zh
21685 parsoid=wt2html,html2html
21686 !! wikitext
21687 <gallery>
21688 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21689 </gallery>
21690 !! html/php
21691 <ul class="gallery mw-gallery-traditional">
21692 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21693 <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>
21694 <div class="gallerytext">
21695 <p>caption
21696 </p>
21697 </div>
21698 </div></li>
21699 </ul>
21700 !! html/parsoid
21701 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21702 <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>
21703 </ul>
21704 !! end
21705
21706 !! test
21707 Gallery override link with malicious javascript (T36852)
21708 !! options
21709 parsoid={
21710 "modes": ["wt2html", "html2html"]
21711 }
21712 !! wikitext
21713 <gallery>
21714 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21715 </gallery>
21716 !! html/php
21717 <ul class="gallery mw-gallery-traditional">
21718 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21719 <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>
21720 <div class="gallerytext">
21721 </div>
21722 </div></li>
21723 </ul>
21724 !! html/parsoid
21725 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21726 <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>
21727 </ul>
21728 !! end
21729
21730 !! test
21731 Gallery with invalid title as link (T45964)
21732 !! options
21733 parsoid={
21734 "modes": ["wt2html", "html2html"]
21735 }
21736 !! wikitext
21737 <gallery>
21738 File:Foobar.jpg|link=<
21739 </gallery>
21740 !! html/php
21741 <ul class="gallery mw-gallery-traditional">
21742 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21743 <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>
21744 <div class="gallerytext">
21745 </div>
21746 </div></li>
21747 </ul>
21748 !! html/parsoid
21749 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21750 <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>
21751 </ul>
21752 !! end
21753
21754 !! test
21755 Serialize gallery without attrs in data-mw
21756 !! options
21757 parsoid={
21758 "modes": ["html2wt"]
21759 }
21760 !! html/parsoid
21761 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
21762 <li class="gallerycaption">123</li>
21763 <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>
21764 </ul>
21765 !! wikitext
21766 <gallery caption="123">
21767 File:Test.png
21768 </gallery>
21769 !! end
21770
21771 !! test
21772 Gallery with class and style attributes
21773 !! wikitext
21774 <gallery class="center" style="text-align: center;">
21775 File:Foobar.jpg
21776 </gallery>
21777 !! html/php
21778 <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
21779 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21780 <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>
21781 <div class="gallerytext">
21782 </div>
21783 </div></li>
21784 </ul>
21785 !! html/parsoid
21786 <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":{}}'>
21787 <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>
21788 </ul>
21789 !! end
21790
21791 !! test
21792 Gallery in slideshow mode
21793 !! wikitext
21794 <gallery mode="slideshow" showthumbnails="">
21795 File:Foobar.jpg
21796 </gallery>
21797 !! html/php
21798 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
21799 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21800 <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>
21801 <div class="gallerytext">
21802 </div>
21803 </div></li>
21804 </ul>
21805 !! html/parsoid
21806 <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
21807 <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>
21808 </ul>
21809 !! end
21810
21811 !! test
21812 Gallery in packed mode
21813 !! wikitext
21814 <gallery mode="packed">
21815 File:Foobar.jpg
21816 </gallery>
21817 !! html/php
21818 <ul class="gallery mw-gallery-packed">
21819 <li class="gallerybox" style="width: 1061.3333333333px"><div style="width: 1061.3333333333px">
21820 <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>
21821 <div class="gallerytext">
21822 </div>
21823 </div></li>
21824 </ul>
21825 !! html/parsoid
21826 <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":{}}'>
21827 <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>
21828 </ul>
21829 !! end
21830
21831 !! test
21832 Serialize gallery image captions on a line
21833 !! options
21834 parsoid={
21835 "modes": ["html2wt"]
21836 }
21837 !! html/parsoid
21838 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
21839 <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>
21840 <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>
21841 </ul>
21842 !! wikitext
21843 <gallery>
21844 File:Foobar.jpg| hi ho
21845 File:Foobar.jpg|hi<br />ho
21846 </gallery>
21847 !! end
21848
21849 !! test
21850 HTML Hex character encoding (spells the word "JavaScript")
21851 !! options
21852 parsoid=wt2html,wt2wt,html2html
21853 !! wikitext
21854 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
21855 !! html/php
21856 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
21857 </p>
21858 !! html/parsoid
21859 <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>
21860 !! end
21861
21862 !! test
21863 HTML Hex character encoding bogus encoding (T28437 regression check)
21864 !! wikitext
21865 &#xsee;&#XSEE;
21866 !! html
21867 <p>&amp;#xsee;&amp;#XSEE;
21868 </p>
21869 !! end
21870
21871 !! test
21872 HTML Hex character encoding mixed case
21873 !! options
21874 parsoid=wt2html,wt2wt,html2html
21875 !! wikitext
21876 &#xEE;&#Xee;
21877 !! html/php
21878 <p>&#xee;&#xee;
21879 </p>
21880 !! html/parsoid
21881 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
21882 !! end
21883
21884 # See: https://www.w3.org/TR/html5/syntax.html#character-references
21885 # Note that U+000C (form feed) is not a valid XML character, so
21886 # it is banned even though allowed in HTML5.
21887 !! test
21888 Illegal character references (T106578)
21889 !! wikitext
21890 ; Null: &#00;
21891 ; FF: &#xC;
21892 ; CR: &#xD;
21893 ; Control (low): &#8;
21894 ; Control (high): &#x7F; &#x9F;
21895 ; Surrogate: &#xD83D;&#xDCA9;
21896 ; This is an okay astral character: &#x1F4A9;
21897 !! html+tidy
21898 <dl><dt>Null</dt>
21899 <dd>&amp;#00;</dd>
21900 <dt>FF</dt>
21901 <dd>&amp;#xC;</dd>
21902 <dt>CR</dt>
21903 <dd>&amp;#xD;</dd>
21904 <dt>Control (low)</dt>
21905 <dd>&amp;#8;</dd>
21906 <dt>Control (high)</dt>
21907 <dd>&amp;#x7F; &amp;#x9F;</dd>
21908 <dt>Surrogate</dt>
21909 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
21910 <dt>This is an okay astral character</dt>
21911 <dd>&#x1f4a9;</dd></dl>
21912 !! end
21913
21914 !! test
21915 __FORCETOC__ override
21916 !! wikitext
21917 __NEWSECTIONLINK__
21918 __FORCETOC__
21919 !! html/php
21920 <p><br />
21921 </p>
21922 !! end
21923
21924 !! test
21925 ISBN code coverage
21926 !! wikitext
21927 ISBN 978-0-1234-56&#x20;789
21928 !! html/php
21929 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
21930 </p>
21931 !! html/parsoid
21932 <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>
21933 !! end
21934
21935 !! test
21936 ISBN followed by 5 spaces
21937 !! wikitext
21938 ISBN
21939 !! html
21940 <p>ISBN
21941 </p>
21942 !! end
21943
21944 !! test
21945 Double ISBN
21946 !! wikitext
21947 ISBN ISBN 1234567890
21948 !! html/php
21949 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21950 </p>
21951 !! html/parsoid
21952 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
21953 !! end
21954
21955 # Uppercase X and lowercase x as well
21956 !! test
21957 ISBN with an X
21958 !! wikitext
21959 ISBN 3-462-04561-X
21960 ISBN 3-462-04561-x
21961 ISBN 080442957X
21962 ISBN 080442957x
21963 ISBN 978080442957X
21964 ISBN 978080442957x
21965 !! html/php
21966 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
21967 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
21968 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
21969 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
21970 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
21971 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
21972 </p>
21973 !! html/parsoid
21974 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
21975 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
21976 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
21977 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
21978 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
21979 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
21980 !! end
21981
21982 !! test
21983 ISBN with empty prefix (parsoid test)
21984 !! wikitext
21985 ISBN 1234567890
21986 !! html/php
21987 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
21988 </p>
21989 !! html/parsoid
21990 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
21991 !! end
21992
21993 !! test
21994 T24905: <abbr> followed by ISBN followed by </a>
21995 !! wikitext
21996 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
21997 !! html/php
21998 <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>
21999 </p>
22000 !! html/parsoid
22001 <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>
22002 !! end
22003
22004 !! test
22005 Double RFC
22006 !! wikitext
22007 RFC RFC 1234
22008 !! html/php
22009 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
22010 </p>
22011 !! html/parsoid
22012 <p>RFC <a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external mw-magiclink">RFC 1234</a></p>
22013 !! end
22014
22015 !! test
22016 Double RFC with a wiki link
22017 !! wikitext
22018 RFC [[RFC 1234]]
22019 !! html/php
22020 <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>
22021 </p>
22022 !! html/parsoid
22023 <p>RFC <a rel="mw:WikiLink" href="./RFC_1234" title="RFC 1234">RFC 1234</a></p>
22024 !! end
22025
22026 !! test
22027 RFC code coverage
22028 !! wikitext
22029 RFC 983&#x20;987
22030 !! html/php
22031 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
22032 </p>
22033 !! html/parsoid
22034 <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>
22035 !! end
22036
22037 !! test
22038 Centre-aligned image
22039 !! wikitext
22040 [[Image:foobar.jpg|centre]]
22041 !! html/php
22042 <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>
22043 !! html/parsoid
22044 <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>
22045 !! end
22046
22047 !! test
22048 None-aligned image
22049 !! wikitext
22050 [[Image:foobar.jpg|none]]
22051 !! html/php
22052 <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>
22053 !! html/parsoid
22054 <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>
22055 !! end
22056
22057 !! test
22058 Width + Height sized image (using px) (height is ignored)
22059 !! wikitext
22060 [[Image:foobar.jpg|640x480px]]
22061 !! html/php
22062 <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>
22063 </p>
22064 !! html/parsoid
22065 <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>
22066 !! end
22067
22068 !! test
22069 Width-sized image (using px, no following whitespace)
22070 !! wikitext
22071 [[Image:foobar.jpg|640px]]
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":"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>
22077 !! end
22078
22079 !! test
22080 Width-sized image (using px, with following whitespace - test regression from r39467)
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 preceding 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 ## FIXME: Parsoid mocking should include the page in the url to catch regressions
22102 !! test
22103 Image with page parameter
22104 !! options
22105 djvu
22106 !! wikitext
22107 [[File:LoremIpsum.djvu|page=2]]
22108 !! html/php
22109 <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>
22110 </p>
22111 !! html/parsoid
22112 <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>
22113 !! end
22114
22115 !! test
22116 Another italics / bold test
22117 !! wikitext
22118 ''' ''x'
22119 !! html
22120 <pre>'<i> </i>x'
22121 </pre>
22122 !!end
22123
22124 # FIXME: The php output seems broken. It's interleaving some open/close tags.
22125 !! test
22126 dt/dd/dl test
22127 !! wikitext
22128 :;;;::
22129 !! html/php
22130 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
22131 !! html/parsoid
22132 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
22133 !! end
22134
22135 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
22136 !! test
22137 Images with the "|" character in the comment
22138 !! wikitext
22139 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
22140 !! html/php
22141 <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>
22142 !! html/parsoid
22143 <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>
22144 !! end
22145
22146 !! test
22147 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
22148 !! wikitext
22149 <html><script>alert(1);</script></html>
22150 !! html
22151 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
22152 </p>
22153 !! end
22154
22155 !! test
22156 HTML with raw HTML ($wgRawHtml==true)
22157 !! options
22158 wgRawHtml=1
22159 !! wikitext
22160 <html><script>alert(1);</script></html>
22161 !! html/php
22162 <p><script>alert(1);</script>
22163 </p>
22164 !! html/parsoid
22165 <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>
22166 !! end
22167
22168 !! test
22169 Parents of subpages, one level up
22170 !! options
22171 subpage title=[[Subpage test/L1/L2/L3]]
22172 !! wikitext
22173 [[../|L2]]
22174 !! html
22175 <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>
22176 </p>
22177 !! end
22178
22179
22180 !! test
22181 Parents of subpages, one level up, not named
22182 !! options
22183 subpage title=[[Subpage test/L1/L2/L3]]
22184 !! wikitext
22185 [[../]]
22186 !! html
22187 <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>
22188 </p>
22189 !! end
22190
22191
22192
22193 !! test
22194 Parents of subpages, two levels up
22195 !! options
22196 subpage title=[[Subpage test/L1/L2/L3]]
22197 !! wikitext
22198 [[../../|L1]]2
22199
22200 [[../../|L1]]l
22201 !! html
22202 <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
22203 </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>
22204 </p>
22205 !! end
22206
22207 !! test
22208 Parents of subpages, two levels up, without trailing slash or name.
22209 !! options
22210 subpage title=[[Subpage test/L1/L2/L3]]
22211 !! wikitext
22212 [[../..]]
22213 !! html
22214 <p>[[../..]]
22215 </p>
22216 !! end
22217
22218 !! test
22219 Parents of subpages, two levels up, with lots of extra trailing slashes.
22220 !! options
22221 subpage title=[[Subpage test/L1/L2/L3]]
22222 !! wikitext
22223 [[../../////]]
22224 !! html
22225 <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>
22226 </p>
22227 !! end
22228
22229 !! article
22230 Subpage test/L1/L2/L3Sibling
22231 !! text
22232 Sibling article
22233 !! endarticle
22234
22235 !! test
22236 Transclusion of a sibling page (one level up)
22237 !! options
22238 subpage title=[[Subpage test/L1/L2/L3]]
22239 !! wikitext
22240 {{../L3Sibling}}
22241 !! html
22242 <p>Sibling article
22243 </p>
22244 !! end
22245
22246 !! test
22247 Transclusion of a child page
22248 !! options
22249 subpage title=[[Subpage test/L1/L2]]
22250 !! wikitext
22251 {{/L3Sibling}}
22252 !! html
22253 <p>Sibling article
22254 </p>
22255 !! end
22256
22257 # This is wt2html only in Parsoid because we add <nowiki>
22258 # because of {{..}} and we don't expect to fix that to
22259 # eliminate the nowikis selective for {{..}} markup.
22260 !! test
22261 Non-transclusion because of too many up levels
22262 !! options
22263 subpage title=[[Subpage test/L1/L2/L3]]
22264 parsoid=wt2html
22265 !! wikitext
22266 {{../../../../More than parent}}
22267 !! html/php
22268 <p>{{../../../../More than parent}}
22269 </p>
22270 !! html/parsoid
22271 <p>{{../../../../More than parent}}</p>
22272 !! end
22273
22274 !! test
22275 Definition list code coverage
22276 !! wikitext
22277 ;title :def
22278 ;title :def
22279 ;title:def
22280 !! html/php
22281 <dl><dt>title</dt>
22282 <dd>def</dd>
22283 <dt>title</dt>
22284 <dd>def</dd>
22285 <dt>title</dt>
22286 <dd>def</dd></dl>
22287 !! html/parsoid
22288 <dl><dt>title </dt><dd>def</dd>
22289 <dt>title </dt><dd>def</dd>
22290 <dt>title</dt><dd>def</dd></dl>
22291 !! end
22292
22293 !! test
22294 Don't fall for the self-closing div
22295 !! wikitext
22296 <div>hello world</div/>
22297 !! html
22298 <div>hello world</div>
22299 !! end
22300
22301 !! test
22302 MSGNW magic word
22303 !! wikitext
22304 {{MSGNW:msg}}
22305 !! html/php
22306 <p>&#91;&#91;:Template:Msg&#93;&#93;
22307 </p>
22308 !! end
22309
22310 !! test
22311 RAW magic word
22312 !! wikitext
22313 {{RAW:QUERTY}}
22314 !! html
22315 <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>
22316 </p>
22317 !! end
22318
22319 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
22320 !! test
22321 Always escape literal '>' in output, not just after '<'
22322 !! wikitext
22323 ><>
22324 !! html
22325 <p>&gt;&lt;&gt;
22326 </p>
22327 !! end
22328
22329 !! test
22330 Template caching
22331 !! wikitext
22332 {{Test}}
22333 {{Test}}
22334 !! html
22335 <p>This is a test template
22336 This is a test template
22337 </p>
22338 !! end
22339
22340
22341 !! article
22342 MediaWiki:Fake
22343 !! text
22344 ==header==
22345 !! endarticle
22346
22347 !! test
22348 Inclusion of !userCanEdit() content
22349 !! wikitext
22350 {{MediaWiki:Fake}}
22351 !! html
22352 <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>
22353 !! end
22354
22355
22356 !! test
22357 Out-of-order TOC heading levels
22358 !! wikitext
22359 ==2==
22360 ======6======
22361 ===3===
22362 =1=
22363 =====5=====
22364 ==2==
22365 !! html
22366 <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>
22367 <ul>
22368 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
22369 <ul>
22370 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
22371 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
22372 </ul>
22373 </li>
22374 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
22375 <ul>
22376 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
22377 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
22378 </ul>
22379 </li>
22380 </ul>
22381 </div>
22382
22383 <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>
22384 <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>
22385 <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>
22386 <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>
22387 <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>
22388 <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>
22389 !! end
22390
22391
22392 !! test
22393 ISBN with a dummy number
22394 !! wikitext
22395 ISBN ---
22396 !! html
22397 <p>ISBN ---
22398 </p>
22399 !! end
22400
22401
22402 !! test
22403 ISBN with space-delimited number
22404 !! wikitext
22405 ISBN 92 9017 032 8
22406 !! html/php
22407 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
22408 </p>
22409 !! html/parsoid
22410 <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>
22411 !! end
22412
22413
22414 !! test
22415 ISBN with multiple spaces, no number
22416 !! wikitext
22417 ISBN foo
22418 !! html
22419 <p>ISBN foo
22420 </p>
22421 !! end
22422
22423
22424 !! test
22425 ISBN length
22426 !! wikitext
22427 ISBN 123456789
22428
22429 ISBN 1234567890
22430
22431 ISBN 12345678901
22432 !! html/php
22433 <p>ISBN 123456789
22434 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
22435 </p><p>ISBN 12345678901
22436 </p>
22437 !! html/parsoid
22438 <p>ISBN 123456789</p>
22439
22440 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
22441
22442 <p>ISBN 12345678901</p>
22443 !! end
22444
22445
22446 !! test
22447 ISBN with trailing year (T9110)
22448 !! wikitext
22449 ISBN 1-234-56789-0 - 2006
22450
22451 ISBN 1 234 56789 0 - 2006
22452 !! html/php
22453 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
22454 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
22455 </p>
22456 !! html/parsoid
22457 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
22458
22459 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
22460 !! end
22461
22462
22463 !! test
22464 anchorencode
22465 !! config
22466 wgFragmentMode=[ 'html5', 'legacy' ]
22467 !! wikitext
22468 {{anchorencode:foo bar©#%n}}
22469 !! html/php
22470 <p>foo_bar©#%n
22471 </p>
22472 !! html/parsoid
22473 <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>
22474 !! end
22475
22476 !! test
22477 anchorencode (legacy)
22478 !! config
22479 wgFragmentMode=[ 'legacy' ]
22480 !! wikitext
22481 {{anchorencode:foo bar©#%n}}
22482 !! html/php
22483 <p>foo_bar.C2.A9.23.25n
22484 </p>
22485 !! end
22486
22487 !! test
22488 anchorencode trims spaces
22489 !! config
22490 wgFragmentMode=[ 'html5', 'legacy' ]
22491 !! wikitext
22492 {{anchorencode: __pretty__please__}}
22493 !! html/php
22494 <p>pretty_please
22495 </p>
22496 !! html/parsoid
22497 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
22498 !! end
22499
22500 !! test
22501 anchorencode deals with links
22502 !! config
22503 wgFragmentMode=[ 'html5', 'legacy' ]
22504 !! wikitext
22505 {{anchorencode: [[hello|world]] [[hi]]}}
22506 !! html/php
22507 <p>world_hi
22508 </p>
22509 !! html/parsoid
22510 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
22511 !! end
22512
22513 !! test
22514 anchorencode deals with templates
22515 !! config
22516 wgFragmentMode=[ 'html5', 'legacy' ]
22517 !! wikitext
22518 {{anchorencode: {{Foo}} x}}
22519 !! html/php
22520 <p>FOO_x
22521 </p>
22522 !! html/parsoid
22523 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
22524 !! end
22525
22526 !! test
22527 anchorencode encodes like the TOC generator: (T20431)
22528 !! config
22529 wgFragmentMode=[ 'html5', 'legacy' ]
22530 !! wikitext
22531 ===_ +:.3A%3A _ &&amp;]] x===
22532 {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
22533 __NOEDITSECTION__
22534 !! html/php
22535 <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>
22536 <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
22537 </p>
22538 !! html/parsoid
22539 <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>
22540 <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>
22541 <meta property="mw:PageProp/noeditsection"/>
22542 !! end
22543
22544 !! test
22545 anchorencode encodes like the TOC generator: (T20431) (legacy)
22546 !! config
22547 wgFragmentMode=[ 'legacy' ]
22548 !! wikitext
22549 ===_ +:.3A%3A&&amp;]]===
22550 {{anchorencode: _ +:.3A%3A&&amp;]] }}
22551 __NOEDITSECTION__
22552 !! html/php
22553 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
22554 <p>.2B:.3A.253A.26.26.5D.5D
22555 </p>
22556 !! end
22557
22558 !! test
22559 T8200: blockquotes and paragraph formatting
22560 !! wikitext
22561 <blockquote>
22562 foo
22563 </blockquote>
22564
22565 bar
22566
22567 baz
22568 !! html
22569 <blockquote>
22570 <p>foo
22571 </p>
22572 </blockquote>
22573 <p>bar
22574 </p>
22575 <pre>baz
22576 </pre>
22577 !! end
22578
22579 !! test
22580 T10293: Use of center tag ruins paragraph formatting
22581 !! wikitext
22582 <center>
22583 foo
22584 </center>
22585
22586 bar
22587
22588 baz
22589 !! html
22590 <center>
22591 <p>foo
22592 </p>
22593 </center>
22594 <p>bar
22595 </p>
22596 <pre>baz
22597 </pre>
22598 !! end
22599
22600 !!test
22601 Parsing of overlapping (improperly nested) inline html tags
22602 !! wikitext
22603 <span><s>x</span></s>
22604 !! html/php
22605 <p><span><s>x&lt;/span&gt;</s></span>
22606 </p>
22607 !! html/parsoid
22608 <p><span><s>x</s></span>
22609 </p>
22610 !!end
22611
22612 ###
22613 ### Language variants related tests
22614 ###
22615
22616 # Parsoid does not mark self-links.
22617 # Parsoid does not convert links; PHP will do any necessary redirects.
22618
22619 !! test
22620 Self-link in language variants
22621 !! options
22622 title=[[Dunav]] language=sr
22623 !! wikitext
22624 Both [[Dunav]] and [[Дунав]] are names for this river.
22625 !! html/php
22626 <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
22627 </p>
22628 !! html/parsoid
22629 <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>
22630 !! end
22631
22632 !! article
22633 Дуна
22634 !! text
22635 content
22636 !! endarticle
22637
22638 !! test
22639 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
22640 !! options
22641 title=[[Duna]] language=sr
22642 !! wikitext
22643 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
22644 !! html/php
22645 <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.
22646 </p>
22647 !! html/parsoid
22648 <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>
22649 !! end
22650
22651 !! test
22652 Link to a section of a variant of this title shouldn't be parsed as self-link
22653 !! options
22654 title=[[Duna]] language=sr
22655 !! wikitext
22656 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
22657 !! html/php
22658 <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.
22659 </p>
22660 !! html/parsoid
22661 <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>
22662 !! end
22663
22664 !! test
22665 Link to pages in language variants
22666 !! options
22667 language=sr
22668 !! wikitext
22669 Main Page can be written as [[Маин Паге]]
22670 !! html/php
22671 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
22672 </p>
22673 !! html/parsoid
22674 <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
22675 !! end
22676
22677
22678 !! test
22679 Multiple links to pages in language variants
22680 !! options
22681 language=sr
22682 !! wikitext
22683 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
22684 !! html/php
22685 <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>.
22686 </p>
22687 !! html/parsoid
22688 <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>
22689 !! end
22690
22691
22692 !! test
22693 Simple template in language variants
22694 !! options
22695 language=sr
22696 !! wikitext
22697 {{тест}}
22698 !! html/php
22699 <p>This is a test template
22700 </p>
22701 !! end
22702
22703
22704 !! test
22705 Template with explicit namespace in language variants
22706 !! options
22707 language=sr
22708 !! wikitext
22709 {{Template:тест}}
22710 !! html/php
22711 <p>This is a test template
22712 </p>
22713 !! end
22714
22715
22716 !! test
22717 Basic test for template parameter in language variants
22718 !! options
22719 language=sr
22720 !! wikitext
22721 {{парамтест|param=foo}}
22722 !! html/php
22723 <p>This is a test template with parameter foo
22724 </p>
22725 !! end
22726
22727 !! test
22728 Simple category in language variants
22729 !! options
22730 language=sr cat
22731 !! wikitext
22732 [[Category:МедиаWики Усер'с Гуиде]]
22733 !! html/php
22734 cat=МедиаWики_Усер'с_Гуиде sort=
22735 !! html/parsoid
22736 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
22737 !! end
22738
22739 !! article
22740 Category:分类
22741 !! text
22742 blah
22743 !! endarticle
22744
22745 !! article
22746 Category:分類
22747 !! text
22748 blah
22749 !! endarticle
22750
22751 ## We used to, but no longer wt2wt this test since the default serializer
22752 ## will normalize all categories to serialize on their own line.
22753 ## This wikitext usage is going to be fairly uncommon in production and
22754 ## selser will take care of preserving formatting in those scenarios.
22755 !! test
22756 Don't convert blue categorylinks to another variant (T35210)
22757 !! options
22758 cat
22759 language=zh
22760 parsoid=wt2html
22761 !! wikitext
22762 [[A]][[Category:分类]]
22763 !! html/php
22764 cat=分类 sort=
22765 !! html/parsoid
22766 <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
22767 <link rel="mw:PageProp/Category" href="./Category:分类"/>
22768 !! end
22769
22770 !! test
22771 Stripping -{}- tags (language variants)
22772 !! options
22773 language=sr
22774 !! wikitext
22775 Latin proverb: -{Ne nuntium necare}-
22776 !! html/php
22777 <p>Latin proverb: Ne nuntium necare
22778 </p>
22779 !! html/parsoid
22780 <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22781 !! end
22782
22783
22784 !! test
22785 Prevent conversion with -{}- tags (language variants)
22786 !! options
22787 language=sr variant=sr-ec
22788 !! wikitext
22789 Latinski: -{Ne nuntium necare}-
22790 !! html/php
22791 <p>Латински: Ne nuntium necare
22792 </p>
22793 !! html/parsoid
22794 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22795 !! end
22796
22797
22798 !! test
22799 Prevent conversion of text with -{}- tags (language variants)
22800 !! options
22801 language=sr variant=sr-ec
22802 !! wikitext
22803 Latinski: -{Ne nuntium necare}-
22804 !! html/php
22805 <p>Латински: Ne nuntium necare
22806 </p>
22807 !! html/parsoid
22808 <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
22809 !! end
22810
22811
22812 !! test
22813 Prevent conversion of links with -{}- tags (language variants)
22814 !! options
22815 language=sr variant=sr-ec
22816 !! wikitext
22817 -{[[Main Page]]}-
22818 !! html/php
22819 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
22820 </p>
22821 !! html/parsoid
22822 <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>
22823 !! end
22824
22825
22826 !! test
22827 -{}- tags within headlines (within html for parserConvert())
22828 !! config
22829 wgFragmentMode=[ 'html5', 'legacy' ]
22830 !! options
22831 language=sr variant=sr-ec
22832 !! wikitext
22833 ==-{Naslov}-==
22834
22835 Note that even an unprotected headline ID is not affected by language
22836 conversion:
22837
22838 ==Latinski==
22839 !! html/php
22840 <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>
22841 <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
22842 цонверсион:
22843 </p>
22844 <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>
22845 !! html/parsoid
22846 <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
22847
22848 <p>Note that even an unprotected headline ID is not affected by language
22849 conversion:</p>
22850
22851 <h2 id="Latinski">Latinski</h2>
22852 !! end
22853
22854 !! test
22855 Explicit definition of language variant alternatives
22856 !! options
22857 language=zh variant=zh-tw
22858 !! wikitext
22859 -{zh:China;zh-tw:Taiwan}-, not China
22860 !! html/php
22861 <p>Taiwan, not China
22862 </p>
22863 !! html/parsoid
22864 <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>
22865 !! end
22866
22867 !! test
22868 Explicit definition of language variant alternatives (BCP 47 codes)
22869 !! options
22870 language=zh variant=zh-tw
22871 !! wikitext
22872 -{zh:China;zh-Hant-TW:Taiwan}-, not China
22873 !! html/php
22874 <p>Taiwan, not China
22875 </p>
22876 !! html/parsoid
22877 <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>
22878 !! end
22879
22880 !! test
22881 Filter syntax for language variants
22882 !! options
22883 language=zh variant=zh-tw
22884 !! wikitext
22885 foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
22886 !! html/php
22887 <p>fooblog, WEBJOURNAL, WEBLOGquux
22888 </p>
22889 !! html/parsoid
22890 <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
22891 !! end
22892
22893 # Note that Parsoid post-processing for language variants needs to
22894 # update the `title` attribute here, based on the mw:ExpandedAttrs property
22895 !! test
22896 Conversion around HTML tags
22897 !! options
22898 language=sr variant=sr-ec
22899 !! wikitext
22900 -{H|span=>sr-ec:script;title=>sr-ec:src}-
22901 <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
22902 !! html/php
22903 <p>
22904 <span title="ЛаCтин">ски</span>
22905 </p>
22906 !! html/parsoid
22907 <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"}]}'/>
22908 <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>
22909 !! end
22910
22911 !! test
22912 Explicit session-wise two-way language variant mapping (A flag and - flag)
22913 !! options
22914 language=zh variant=zh-tw
22915 !! wikitext
22916 This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
22917
22918 Taiwan is not China.
22919
22920 But -{A|zh:China; zh-tw:Taiwan}- is China,
22921
22922 (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
22923
22924 and -{China}- is China.
22925 !! html/php
22926 <p>This is Taiwan, but we'll forget that now.
22927 </p><p>Taiwan is not China.
22928 </p><p>But Taiwan is Taiwan,
22929 </p><p>(This should be stripped!)
22930 </p><p>and China is China.
22931 </p>
22932 !! html/parsoid
22933 <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>
22934 <p>Taiwan is not China.</p>
22935 <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>
22936 <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>
22937 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
22938 !! end
22939
22940 !! test
22941 Explicit session-wise one-way language variant mapping (A flag and - flag)
22942 !! options
22943 language=zh variant=zh-tw
22944 !! wikitext
22945 This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
22946
22947 COUNTRY is China or Taiwan.
22948
22949 But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
22950
22951 (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22952
22953 and -{COUNTRY}- is COUNTRY.
22954 !! html/php
22955 <p>This is Taiwan, but we'll forget that now.
22956 </p><p>COUNTRY is China or Taiwan.
22957 </p><p>But Taiwan is Taiwan,
22958 </p><p>(This should be stripped!)
22959 </p><p>and COUNTRY is COUNTRY.
22960 </p>
22961 !! html/parsoid
22962 <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>
22963 <p>COUNTRY is China or Taiwan.</p>
22964 <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>
22965 <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>
22966 <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
22967 !! end
22968
22969 !! test
22970 Explicit session-wise two-way language variant mapping (H flag for hide)
22971 !! options
22972 language=zh variant=zh-tw
22973 !! wikitext
22974 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
22975
22976 Taiwan is China.
22977 !! html/php
22978 <p>(This should be stripped!)
22979 </p><p>Taiwan is Taiwan.
22980 </p>
22981 !! html/parsoid
22982 <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>
22983 <p>Taiwan is China.</p>
22984 !! end
22985
22986 !! test
22987 Explicit session-wise one-way language variant mapping (H flag for hide)
22988 !! options
22989 language=zh variant=zh-tw
22990 !! wikitext
22991 (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
22992
22993 COUNTRY is Taiwan or China.
22994 !! html/php
22995 <p>(This should be stripped!)
22996 </p><p>Taiwan is Taiwan or China.
22997 </p>
22998 !! html/parsoid
22999 <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>
23000 <p>COUNTRY is Taiwan or China.</p>
23001 !! end
23002
23003 ## Note that parsoid test runner does not support 'showtitle' option.
23004 !! test
23005 Adding explicit conversion rule for title (T flag)
23006 !! options
23007 language=zh variant=zh-tw showtitle
23008 !! wikitext
23009 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
23010
23011 Taiwan is China.
23012 !! html/php
23013 Taiwan
23014 <p>Should be stripped!
23015 </p><p>Taiwan is China.
23016 </p>
23017 !! html/parsoid
23018 <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>
23019 <p>Taiwan is China.</p>
23020 !! end
23021
23022 !! test
23023 Code coverage: T combined with H flag
23024 !! options
23025 language=zh variant=zh-tw showtitle
23026 !! wikitext
23027 Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
23028
23029 Taiwan is China.
23030 !! html/php
23031 Taiwan
23032 <p>Should be stripped!
23033 </p><p>Taiwan is Taiwan.
23034 </p>
23035 !! html/parsoid
23036 <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>
23037 <p>Taiwan is China.</p>
23038 !! end
23039
23040 !! test
23041 Code coverage: T with no variants
23042 !! options
23043 language=zh variant=zh-tw showtitle
23044 !! wikitext
23045 -{H|zh:China; zh-tw:Taiwan}-
23046 Taiwan is China.-{T|Taiwan is China}-
23047 !! html/php
23048 Taiwan is China
23049 <p>
23050 Taiwan is Taiwan.
23051 </p>
23052 !! html/parsoid
23053 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23054 Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
23055 !! end
23056
23057 !! test
23058 Code coverage: rules with no variants
23059 !! options
23060 language=zh variant=zh-tw
23061 !! wikitext
23062 -{H|zh:China; zh-tw:Taiwan}-
23063 Taiwan is China.
23064 -{H|China}-
23065 Taiwan is China.
23066 !! html/php
23067 <p>
23068 Taiwan is Taiwan.
23069
23070 Taiwan is China.
23071 </p>
23072 !! html/parsoid
23073 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
23074 Taiwan is China.
23075 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
23076 Taiwan is China.</p>
23077 !! end
23078
23079
23080 !! test
23081 Code coverage: D flag for conversion rule
23082 !! options
23083 language=zh variant=zh-tw
23084 !! wikitext
23085 -{D|zh-cn:XA; zh-tw:YA}-
23086 -{A;D|zh-cn:XB; zh-tw:YB}-
23087 -{D;H|zh-cn:XC; zh-tw:YC}-
23088
23089 -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
23090
23091 -{D|0=>zh-tw:1}-
23092 -{A;D|2=>zh-tw:3}-
23093 -{D;H|4=>zh-tw:5}-
23094
23095 XA XB XC YA YB YC FOO BAR BAT 012345
23096 !! html/php
23097 <p>大陆:XA;台灣:YA;
23098
23099 大陆:XC;台灣:YC;
23100 </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
23101 </p><p>0⇒台灣:1;
23102
23103 4⇒台灣:5;
23104 </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
23105 </p>
23106 !! html/parsoid
23107 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
23108 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
23109 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
23110 <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>
23111 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
23112 <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
23113 <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
23114 <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
23115 !! end
23116
23117 !! test
23118 Code coverage: N flag for conversion rule
23119 !! options
23120 language=zh variant=zh-cn
23121 !! wikitext
23122 -{N|zh-cn}-
23123
23124 -{N|zh-tw}-
23125
23126 -{N|sr-ec}-
23127 !! html/php
23128 <p>大陆
23129 </p><p>台灣
23130 </p><p>српски (ћирилица)‎
23131 </p>
23132 !! html/parsoid
23133 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
23134 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
23135 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
23136 !! end
23137
23138 # html2wt suppresses the bogus 'D' flag, so this is wt2html only
23139 !! test
23140 Code coverage: N flag for conversion rule (wt2html only)
23141 !! options
23142 language=zh variant=zh-cn
23143 parsoid=wt2html,html2html
23144 !! wikitext
23145 -{D;N|en}-
23146 !! html/php
23147 <p>English
23148 </p>
23149 !! html/parsoid
23150 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
23151 !! end
23152
23153 !! test
23154 Testing that changing the language variant here in the tests actually works
23155 !! options
23156 language=zh variant=zh showtitle
23157 !! wikitext
23158 Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23159 !! html/php
23160 China
23161 <p>Should be stripped!
23162 </p>
23163 !! html/parsoid
23164 <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
23165 !! end
23166
23167 !! test
23168 Recursive conversion of alt and title attrs shouldn't clear converter state
23169 !! options
23170 language=zh variant=zh-cn
23171 showtitle
23172 !! wikitext
23173 -{H|zh-cn:Exclamation; zh-tw:exclamation}-
23174 Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
23175 !! html/php
23176 China
23177 <p>
23178 Should be stripped<span title="Exclamation">!</span>
23179 </p>
23180 !! html/parsoid
23181 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
23182 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>
23183 !! end
23184
23185 !! test
23186 T26072: more test on conversion rule for title
23187 !! options
23188 language=zh variant=zh-tw showtitle
23189 !! wikitext
23190 This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
23191
23192 This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
23193 !! html/php
23194 Taiwan
23195 <p>This should be stripped!
23196 </p><p>This won't take interferes with the title rule.
23197 </p>
23198 !! html/parsoid
23199 <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>
23200 <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>
23201 !! end
23202
23203 !! test
23204 Partly disable title conversion if variant == main language code
23205 !! options
23206 language=zh variant=zh title=[[ZH]] showtitle
23207 !! wikitext
23208 -{T|zh-cn:CN;zh-tw:TW}-
23209 !! html/php
23210 ZH
23211 <p>
23212 </p>
23213 !! html/parsoid
23214 <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>
23215 !! end
23216
23217 !! test
23218 Partly disable title conversion if variant == main language code, more
23219 !! options
23220 language=zh variant=zh title=[[ZH]] showtitle
23221 !! wikitext
23222 -{T|TW}-
23223 !! html/php
23224 ZH
23225 <p>
23226 </p>
23227 !! html/parsoid
23228 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
23229 !! end
23230
23231 !! test
23232 Raw output of variant escape tags (R flag)
23233 !! options
23234 language=zh variant=zh-tw
23235 !! wikitext
23236 Raw: -{R|zh:China;zh-tw:Taiwan}-
23237 !! html/php
23238 <p>Raw: zh:China;zh-tw:Taiwan
23239 </p>
23240 !! html/parsoid
23241 <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
23242 !! end
23243
23244 # html2wt suppresses the bogus 'D' flags, so this is wt2html only
23245 !! test
23246 Raw output of variant escape tags (R flag) (wt2html only)
23247 !! options
23248 language=zh variant=zh-tw
23249 parsoid=wt2html,html2html
23250 !! wikitext
23251 -{Variant}- -{D|syntax}- -{D;R|options}-
23252 !! html/php
23253 <p>Variant syntax options
23254 </p>
23255 !! html/parsoid
23256 <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>
23257 !! end
23258
23259 !! test
23260 Nested markup inside raw output of variant escape tags (R flag)
23261 !! options
23262 language=zh variant=zh-tw
23263 !! wikitext
23264 Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
23265 !! html/php
23266 <p>Nested raw: nested Taiwan nested
23267 </p>
23268 !! html/parsoid
23269 <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>
23270 !! end
23271
23272 !! test
23273 Nested markup and spaces inside raw output of variant escape tags (R flag)
23274 !! options
23275 language=zh variant=zh-tw
23276 !! wikitext
23277 X-{ outer -{ inner }- outer }-X
23278 !! html/php
23279 <p>X outer inner outer X
23280 </p>
23281 !! html/parsoid
23282 <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>
23283 !! end
23284
23285 !! test
23286 Templates inside raw output of variant escape tags (R flag)
23287 !! options
23288 language=zh variant=zh-tw
23289 !! wikitext
23290 Nested raw: -{R|nested {{echo|hi}} templates}-
23291 !! html/php
23292 <p>Nested raw: nested hi templates
23293 </p>
23294 !! html/parsoid
23295 <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>
23296 !! end
23297
23298 !! test
23299 Strings evaluating false shouldn't be ignored by Language converter (T51072)
23300 !! options
23301 language=zh variant=zh-cn
23302 !! wikitext
23303 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
23304 !! html/php
23305 <p>0
23306 </p>
23307 !! html/parsoid
23308 <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>
23309 !! end
23310
23311 !! test
23312 Conversion rules from [numeric-only string] to [something else] (T48634)
23313 !! options
23314 language=zh variant=zh-cn
23315 !! wikitext
23316 -{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
23317 !! html/php
23318 <p>D12345EE12345
23319 </p>
23320 !! html/parsoid
23321 <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>
23322 !! end
23323
23324 !! test
23325 Two-way converter rule entries with an empty value should be ignored (T53551)
23326 !! options
23327 language=zh variant=zh-cn
23328 !! wikitext
23329 -{H|zh-cn:foo;zh-tw:;}-foobar
23330 !! html/php
23331 <p>foobar
23332 </p>
23333 !! html/parsoid
23334 <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>
23335 !! end
23336
23337 !! test
23338 One-way converter rule entries with an empty "from" string should be ignored (T53551)
23339 !! options
23340 language=zh variant=zh-cn
23341 !! wikitext
23342 -{H|=>zh-cn:foo;}-foobar
23343 !! html/php
23344 <p>foobar
23345 </p>
23346 !! html/parsoid
23347 <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
23348 !! end
23349
23350 !! test
23351 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
23352 !! options
23353 language=zh variant=zh-cn
23354 !! wikitext
23355 -{H|}-foobar
23356 !! html/php
23357 <p>foobar
23358 </p>
23359 !! html/parsoid
23360 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
23361 !! end
23362
23363 !! test
23364 Nested using of manual convert syntax
23365 !! options
23366 language=zh variant=zh-hk
23367 !! wikitext
23368 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
23369 !! html/php
23370 <p>Nested: Hello Hong Kong!
23371 </p>
23372 !! html/parsoid
23373 <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>
23374 !! end
23375
23376 !! test
23377 HTML markups with conversion syntax in attribs, nested in other conversion blocks
23378 !! options
23379 language=zh variant=zh-cn
23380 !! wikitext
23381 -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
23382 !! html/php
23383 <p><span title="X">A</span>
23384 </p>
23385 !! html/parsoid
23386 <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>
23387 !! end
23388
23389 !! test
23390 HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
23391 !! options
23392 language=zh variant=zh-cn
23393 !! wikitext
23394 -{<span title="-{X}-">A</span>}-
23395 !! html/php+disabled
23396 <p><span title="X">A</span>
23397 </p>
23398 !! html/parsoid
23399 <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>
23400 !! end
23401
23402 # Parsoid and PHP disagree on how to parse this example: Parsoid
23403 # insists that the content of a language converter element be a valid
23404 # DOM fragment or attribute string
23405 !! test
23406 Language converter markup with block content
23407 !! options
23408 language=zh variant=zh-cn
23409 !! wikitext
23410 <span>a-{b<div>c}-d
23411
23412 <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
23413
23414 <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
23415 !! html/php+tidy
23416 <span>ab<div>cd
23417 <span>ab<div>cd
23418 <span>ad</span></div></span></div></span>
23419 !! html/parsoid
23420 <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
23421
23422 <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
23423
23424 <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>
23425 !! end
23426
23427 !! test
23428 LanguageConverter selser (1)
23429 !! options
23430 language=zh variant=zh-cn
23431 parsoid={
23432 "modes": ["wt2wt", "selser"],
23433 "changes": [
23434 ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23435 ]
23436 }
23437 !! wikitext
23438 -{raw}-
23439 !! wikitext/edited
23440 -{edited}-
23441 !! end
23442
23443 !! test
23444 LanguageConverter selser (2)
23445 !! options
23446 language=zh variant=zh-cn
23447 parsoid={
23448 "modes": ["wt2wt", "selser"],
23449 "changes": [
23450 ["span[class='x']", "contents", "text", "-{foo}-"],
23451 ["a", "contents", "text", "-{"],
23452 ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
23453 ]
23454 }
23455 !! wikitext
23456 <span class="x">TEXT1</span>
23457 [http://example.com TEXT2]
23458 [[Foo|TEXT3]]
23459 {{echo|TEXT4}}
23460 !! wikitext/edited
23461 <span class="x"><nowiki>-{foo}-</nowiki></span>
23462 [http://example.com -{]
23463 [[Foo|<nowiki>-{</nowiki>]]
23464 {{1x|<nowiki>-{</nowiki>}}
23465 !! end
23466
23467 # Tests LanguageVariantText in ConstrainedText
23468 !! test
23469 LanguageConverter selser (3)
23470 !! options
23471 language=zh variant=zh-cn
23472 parsoid={
23473 "modes": ["wt2wt", "selser"],
23474 "changes": [
23475 ["td > span", "attr", "typeof", "mw:LanguageVariant"],
23476 ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
23477 ]
23478 }
23479 !! wikitext
23480 {|
23481 |-
23482 |<span>Foo</span>
23483 |}
23484 !! wikitext/edited
23485 {|
23486 |-
23487 |<nowiki/>-{edited}-
23488 |}
23489 !! end
23490
23491 # Tests LanguageVariantText._fromSelSer
23492 !! test
23493 LanguageConverter selser (4)
23494 !! options
23495 language=zh variant=zh-cn
23496 parsoid={
23497 "modes": ["wt2wt", "selser"],
23498 "changes": [
23499 ["td > span.x", "remove"]
23500 ]
23501 }
23502 !! wikitext
23503 {|
23504 |-
23505 |<span class="x">Foo</span>-{Bar}-
23506 ||<span class="x">Foo</span>-{Bar}-
23507 |}
23508 !! wikitext/edited
23509 {|
23510 |-
23511 |<nowiki/>-{Bar}-
23512 ||-{Bar}-
23513 |}
23514 !! end
23515
23516 # Since Parsoid is starting to emit canonical wikitext for links,
23517 # [http://example.com http://example.com] will not RT back to that
23518 # form anymore.
23519 # Parsoid does not language-convert links (it is done in a
23520 # post-processing step)
23521 !! test
23522 Proper conversion of text in external links
23523 !! options
23524 language=sr variant=sr-ec
23525 parsoid=wt2html
23526 !! wikitext
23527 http://www.google.com
23528 gopher://www.google.com
23529 [http://www.google.com http://www.google.com]
23530 [gopher://www.google.com gopher://www.google.com]
23531 [https://www.google.com irc://www.google.com]
23532 [ftp://www.google.com www.google.com/ftp://dir]
23533 [//www.google.com www.google.com]
23534 !! html/php
23535 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
23536 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23537 <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
23538 <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23539 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
23540 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
23541 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
23542 </p>
23543 !! html/parsoid
23544 <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
23545 <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
23546 <a rel="mw:ExtLink" class="external text" href="http://www.google.com">http://www.google.com</a>
23547 <a rel="mw:ExtLink" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
23548 <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
23549 <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
23550 <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
23551 !! end
23552
23553 !! test
23554 Do not convert roman numbers to language variants
23555 !! options
23556 language=sr variant=sr-ec
23557 !! wikitext
23558 Fridrih IV je car.
23559 !! html/php
23560 <p>Фридрих IV је цар.
23561 </p>
23562 !! html/parsoid
23563 <p>Fridrih IV je car.</p>
23564 !! end
23565
23566 !! test
23567 Unclosed language converter markup "-{"
23568 !! options
23569 language=sr
23570 !! wikitext
23571 -{T|hello
23572 !! html
23573 <p>-{T|hello
23574 </p>
23575 !! end
23576
23577 !! test
23578 Don't convert raw rule "-{R|=&gt;}-" to "=>"
23579 !! options
23580 language=sr
23581 !! wikitext
23582 -{R|=&gt;}-
23583 !! html/php
23584 <p>=&gt;
23585 </p>
23586 !! html/parsoid
23587 <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>
23588 !!end
23589
23590 !! test
23591 Don't break link parsing if language converter markup is in the caption.
23592 !! options
23593 language=sr variant=sr-ec
23594 !! wikitext
23595 [[Main Page|-{R|main page}-]]
23596 !! html/php
23597 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
23598 </p>
23599 !! html/parsoid
23600 <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>
23601 !! end
23602
23603 !! test
23604 T146304: Don't break template parsing if language converter markup is in the parameter.
23605 !! options
23606 language=sr variant=sr-ec
23607 !! wikitext
23608 {{echo|-{R|foo}-}}
23609 !! html/php
23610 <p>foo
23611 </p>
23612 !! html/parsoid
23613 <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>
23614 !! end
23615
23616 !! test
23617 T146305: Don't break image parsing if language converter markup is in the caption.
23618 !! options
23619 language=sr
23620 !! wikitext
23621 [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
23622 !! html/php
23623 <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>
23624 !! html/parsoid
23625 <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>
23626 !! end
23627
23628 !! test
23629 T146305: Don't break image parsing if nested language converter markup is in the caption.
23630 !! options
23631 language=zh variant=zh-cn
23632 !! wikitext
23633 [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
23634 !! html/php
23635 <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>
23636 !! html/parsoid
23637 <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>
23638 !! end
23639
23640 # XXX html2wt disabled because rich markup in alt is not preserved.
23641 !! test
23642 Don't break gallery if language converter markup is inside.
23643 !! options
23644 language=zh
23645 parsoid=wt2html,html2html
23646 !! wikitext
23647 <gallery>
23648 File:Foobar.jpg|alt=-{R|bat}-|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]
23649 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=-{R|param}-}}
23650 </gallery>
23651 !! html/php
23652 <ul class="gallery mw-gallery-traditional">
23653 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23654 <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>
23655 <div class="gallerytext">
23656 <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>
23657 </p>
23658 </div>
23659 </div></li>
23660 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
23661 <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>
23662 <div class="gallerytext">
23663 <p>This is a test template
23664 </p>
23665 </div>
23666 </div></li>
23667 </ul>
23668 !! html/parsoid
23669 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
23670 <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>
23671 <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>
23672 </ul>
23673 !! end
23674
23675 !! test
23676 T153135: Don't break list handling if language converter markup is in the item.
23677 !! options
23678 language=zh variant=zh-cn
23679 !! wikitext
23680 ;-{zh-cn:AAA;zh-tw:BBB}-
23681 ;-{R|foo:bar}-
23682 !! html/php
23683 <dl><dt>AAA</dt>
23684 <dt>foo:bar</dt></dl>
23685 !! html/parsoid
23686 <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>
23687 <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
23688 </dl>
23689 !! end
23690
23691 // Note that parsoid does not protect colons unless language converter
23692 // markup is properly nested, because it is a backtracking parser.
23693 !! test
23694 T153135: Unclosed markup in definition list (code coverage)
23695 !! options
23696 language=zh variant=zh-cn
23697 !! wikitext
23698 ;<b>foo:bar
23699 ;-{zh-cn:AAA
23700 !! html/php+tidy
23701 <dl><dt><b>foo:bar</b></dt><b>
23702 <dt>-{zh-cn:AAA</dt></b></dl>
23703 !! html/parsoid
23704 <dl><dt data-parsoid='{}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
23705 <dt data-parsoid='{}'>-{zh-cn</dt><dd data-parsoid='{"stx":"row"}'>AAA</dd></b></dl>
23706 !! end
23707
23708 !! test
23709 T153135: Nested language converter markup in definition list (code coverage)
23710 !! options
23711 language=zh variant=zh-cn
23712 !! wikitext
23713 ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
23714 !! html/php
23715 <dl><dt>AAA foo:bar bat:baz</dt>
23716 <dd>def</dd></dl>
23717 !! html/parsoid
23718 <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>
23719 <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
23720 </dl>
23721 !! end
23722
23723 # html2wt mode disabled due to <nowiki> insertion.
23724 !! test
23725 T153140: Don't break table handling if language converter markup is in the cell.
23726 !! options
23727 language=sr variant=sr-ec
23728 parsoid=wt2html,wt2wt,html2html
23729 !! wikitext
23730 {|
23731 |-
23732 | -{R|B}-
23733 |}
23734 !! html/php
23735 <table>
23736
23737 <tr>
23738 <td>B
23739 </td></tr></table>
23740 !! html/parsoid
23741 <table>
23742 <tbody>
23743 <tr>
23744 <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
23745 </tr>
23746 </tbody>
23747 </table>
23748 !! end
23749
23750 !! test
23751 Language converter tricky html2wt cases (1)
23752 !! options
23753 language=sr
23754 parsoid=html2wt,wt2wt
23755 !! html/parsoid
23756 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
23757 !! wikitext
23758 -{<nowiki>}-</nowiki>}-
23759 !! html/php
23760 <p>&#125;-
23761 </p>
23762 !! end
23763
23764 !! test
23765 Language converter tricky html2wt cases (2)
23766 !! options
23767 language=sr
23768 parsoid=html2wt,wt2wt
23769 !! html/parsoid
23770 <p>-{foo}-</p>
23771 !! wikitext
23772 <nowiki>-{foo}-</nowiki>
23773 !! html/php
23774 <p>-&#123;foo&#125;-
23775 </p>
23776 !! end
23777
23778 !! test
23779 Language converter tricky html2wt cases (3)
23780 !! options
23781 language=sr
23782 parsoid=html2wt,wt2wt
23783 !! html/parsoid
23784 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
23785 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
23786 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
23787 !! wikitext
23788 -{R||}-
23789
23790 -{R|R|raw}-
23791
23792 -{<nowiki>-{foo}-</nowiki>}-
23793 !! html/php
23794 <p>|
23795 </p><p>R|raw
23796 </p><p>-&#123;foo&#125;-
23797 </p>
23798 !! end
23799
23800 !! test
23801 Language converter tricky html2wt cases (4)
23802 !! options
23803 language=sr
23804 parsoid=html2wt,wt2wt
23805 !! html/parsoid
23806 <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>
23807 !! wikitext
23808 -{R|{{echo|hey}}}-
23809 !! html/php
23810 <p>hey
23811 </p>
23812 !! end
23813
23814 # Note that the <nowiki> escaping added by parsoid for source text,
23815 # destination text, and language names only works on the PHP side
23816 # for *destination text*. (HTML entity escaping wouldn't work
23817 # any better.) This is probably a bug, at least for source texts.
23818 # (For language names PHP uses a precise regexp based on the languages
23819 # it currently knows have variants, which is fragile since this set
23820 # can grow/shrink over time.)
23821 !! test
23822 Language converter tricky html2wt cases (5)
23823 !! options
23824 language=zh variant=zh-cn
23825 !! html/parsoid
23826 <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>
23827 <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
23828 <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>
23829 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
23830 <p>a:b=>c xyz</p>
23831 !! wikitext
23832 -{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
23833
23834 -{H|A=><nowiki>bo:g;us</nowiki>:B}-
23835
23836 -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
23837
23838 -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
23839
23840 a:b=>c xyz
23841 !! html/php+disabled
23842 <p>foobat;xyz=&gt;zh-cn:abc
23843 </p><p>A
23844 </p><p>0;zh-tw:bar
23845 </p><p>abc
23846 </p><p>a:b=&gt;c 0;zh-tw:bar
23847 </p>
23848 !! end
23849
23850 !! test
23851 T179579: Nowiki and lc interaction
23852 !! options
23853 parsoid=wt2html
23854 language=sr
23855 !! wikitext
23856 -{</nowiki>123}-
23857
23858 -{123<nowiki>|</nowiki>456}-
23859 !! html/parsoid
23860 <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
23861
23862 <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>
23863 !! end
23864
23865 !! test
23866 T2529: Uncovered bullet
23867 !! wikitext
23868 *Foo {{bullet}}
23869 !! html
23870 <ul><li>Foo</li>
23871 <li>Bar</li></ul>
23872 !! end
23873
23874 !! test
23875 T2529: Uncovered bullet in a deeply nested list
23876 !! wikitext
23877 *******Foo {{bullet}}
23878 !! html
23879 <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>
23880 <li>Bar</li></ul>
23881 !! end
23882
23883 !! test
23884 T2529: Uncovered table already at line-start
23885 !! wikitext
23886 x
23887
23888 {{table}}
23889 y
23890 !! html
23891 <p>x
23892 </p>
23893 <table>
23894 <tr>
23895 <td>1</td>
23896 <td>2
23897 </td></tr>
23898 <tr>
23899 <td>3</td>
23900 <td>4
23901 </td></tr></table>
23902 <p>y
23903 </p>
23904 !! end
23905
23906 !! test
23907 T2529: Uncovered bullet in parser function result
23908 !! wikitext
23909 *Foo {{lc:{{bullet}} }}
23910 !! html
23911 <ul><li>Foo</li>
23912 <li>bar</li></ul>
23913 !! end
23914
23915 !! test
23916 T7678: Double-parsed template argument
23917 !! wikitext
23918 {{lc:{{{1}}}|hello}}
23919 !! html
23920 <p>{{{1}}}
23921 </p>
23922 !! end
23923
23924 !! test
23925 T7678: Double-parsed template invocation
23926 !! wikitext
23927 {{lc:{{paramtest {{!}} param = hello }} }}
23928 !! html
23929 <p>{{paramtest | param = hello }}
23930 </p>
23931 !! end
23932
23933 !! test
23934 Case insensitivity of parser functions for non-ASCII characters (T10143)
23935 !! options
23936 language=cs
23937 title=[[Main Page]]
23938 !! wikitext
23939 {{PRVNÍVELKÉ:ěščř}}
23940 {{prvnívelké:ěščř}}
23941 {{PRVNÍMALÉ:ěščř}}
23942 {{prvnímalé:ěščř}}
23943 {{MALÁ:ěščř}}
23944 {{malá:ěščř}}
23945 {{VELKÁ:ěščř}}
23946 {{velká:ěščř}}
23947 !! html
23948 <p>Ěščř
23949 Ěščř
23950 ěščř
23951 ěščř
23952 ěščř
23953 ěščř
23954 ĚŠČŘ
23955 ĚŠČŘ
23956 </p>
23957 !! end
23958
23959 !! test
23960 Morwen/13: Unclosed link followed by heading
23961 !! wikitext
23962 [[link
23963 ==heading==
23964 !! html
23965 <p>[[link
23966 </p>
23967 <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>
23968 !! end
23969
23970 !! test
23971 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
23972 !! wikitext
23973 {{foo|
23974 =heading=
23975 !! html
23976 <p>{{foo|
23977 </p>
23978 <h1><span class="mw-headline" id="heading">heading</span></h1>
23979 !! end
23980
23981 !! test
23982 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
23983 !! wikitext
23984 {{foo|
23985 ==heading==
23986 !! html
23987 <p>{{foo|
23988 </p>
23989 <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>
23990 !! end
23991
23992 !! test
23993 Tildes in comments
23994 !! options
23995 pst
23996 !! wikitext
23997 <!-- ~~~~ -->
23998 !! html/php
23999 <!-- ~~~~ -->
24000 !! end
24001
24002 !! test
24003 Paragraphs inside divs (no extra line breaks)
24004 !! wikitext
24005 <div>Line one
24006
24007 Line two</div>
24008 !! html
24009 <div>Line one
24010 Line two</div>
24011 !! end
24012
24013 !! test
24014 Paragraphs inside divs (extra line break on open)
24015 !! wikitext
24016 <div>
24017 Line one
24018
24019 Line two</div>
24020 !! html
24021 <div>
24022 <p>Line one
24023 </p>
24024 Line two</div>
24025 !! end
24026
24027 !! test
24028 Paragraphs inside divs (extra line break on close)
24029 !! wikitext
24030 <div>Line one
24031
24032 Line two
24033 </div>
24034 !! html
24035 <div>Line one
24036 <p>Line two
24037 </p>
24038 </div>
24039 !! end
24040
24041 !! test
24042 Paragraphs inside divs (extra line break on open and close)
24043 !! wikitext
24044 <div>
24045 Line one
24046
24047 Line two
24048 </div>
24049 !! html
24050 <div>
24051 <p>Line one
24052 </p><p>Line two
24053 </p>
24054 </div>
24055 !! end
24056
24057 # doBlockLevels screws up this output and Remex cleans up as much as it can.
24058 !! test
24059 Nesting tags, paragraphs on lines which begin with <div>
24060 !! wikitext
24061 <div></div><strong>A
24062 B</strong>
24063 !! html/php+tidy
24064 <div></div><p><strong>A
24065 </strong></p><strong></strong><p><strong>B</strong>
24066 </p>
24067 !! html/parsoid
24068 <div data-parsoid='{"stx":"html"}'></div><p><strong data-parsoid='{"stx":"html","autoInsertedEnd":true}'>A</strong></p>
24069 <p><strong data-parsoid='{"stx":"html","autoInsertedStart":true}'>B</strong></p>
24070 !! end
24071
24072 # T8200: <blockquote> should behave like <div> with respect to line breaks
24073 !! test
24074 T8200: paragraphs inside blockquotes (no extra line breaks)
24075 !! wikitext
24076 <blockquote>Line one
24077
24078 Line two</blockquote>
24079 !! html
24080 <blockquote>Line one
24081 Line two</blockquote>
24082 !! html+tidy
24083 <blockquote><p>Line one
24084 Line two</p></blockquote>
24085 !! end
24086
24087 !! test
24088 T8200: paragraphs inside blockquotes (extra line break on open)
24089 !! wikitext
24090 <blockquote>
24091 Line one
24092
24093 Line two</blockquote>
24094 !! html
24095 <blockquote>
24096 <p>Line one
24097 </p>
24098 Line two</blockquote>
24099 !! html+tidy
24100 <blockquote>
24101 <p>Line one
24102 </p><p>
24103 Line two</p></blockquote>
24104 !! end
24105
24106 !! test
24107 T8200: paragraphs inside blockquotes (extra line break on close)
24108 !! wikitext
24109 <blockquote>Line one
24110
24111 Line two
24112 </blockquote>
24113 !! html
24114 <blockquote>Line one
24115 <p>Line two
24116 </p>
24117 </blockquote>
24118 !! html+tidy
24119 <blockquote><p>Line one
24120 </p><p>Line two
24121 </p>
24122 </blockquote>
24123 !! end
24124
24125 !! test
24126 T8200: paragraphs inside blockquotes (extra line break on open and close)
24127 !! wikitext
24128 <blockquote>
24129 Line one
24130
24131 Line two
24132 </blockquote>
24133 !! html
24134 <blockquote>
24135 <p>Line one
24136 </p><p>Line two
24137 </p>
24138 </blockquote>
24139 !! end
24140
24141 ## This is a corner case interaction between the paragraph wrapping in the
24142 ## php parser's BlockLevelPass and Remex. `doBlockLevels` has a notion of
24143 ## some tags which close paragraphs (and thus prevent wrapping on their line),
24144 ## of which "div" is one, but do p-wrapping inside them. These are referred
24145 ## to as "never suppressing". Remex, for its part, doesn't traverse into
24146 ## "div"s to p-wrap. Hence, we only get this partial wrapping.
24147 !! test
24148 Paragraphs inside blockquotes/divs (no extra line breaks)
24149 !! wikitext
24150 <blockquote><div>Line one
24151
24152 Line two</div></blockquote>
24153 !! html
24154 <blockquote><div>Line one
24155 Line two</div></blockquote>
24156 !! end
24157
24158 !! test
24159 Paragraphs inside blockquotes/divs (extra line break on open)
24160 !! wikitext
24161 <blockquote><div>
24162 Line one
24163
24164 Line two</div></blockquote>
24165 !! html
24166 <blockquote><div>
24167 <p>Line one
24168 </p>
24169 Line two</div></blockquote>
24170 !! end
24171
24172 !! test
24173 Paragraphs inside blockquotes/divs (extra line break on close)
24174 !! wikitext
24175 <blockquote><div>Line one
24176
24177 Line two
24178 </div></blockquote>
24179 !! html
24180 <blockquote><div>Line one
24181 <p>Line two
24182 </p>
24183 </div></blockquote>
24184 !! end
24185
24186 !! test
24187 Paragraphs inside blockquotes/divs (extra line break on open and close)
24188 !! wikitext
24189 <blockquote><div>
24190 Line one
24191
24192 Line two
24193 </div></blockquote>
24194 !! html
24195 <blockquote><div>
24196 <p>Line one
24197 </p><p>Line two
24198 </p>
24199 </div></blockquote>
24200 !! end
24201
24202 !! test
24203 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
24204 !! options
24205 wgLinkHolderBatchSize=0
24206 !! wikitext
24207 [[meatball:1]]
24208 [[meatball:2]]
24209 [[meatball:3]]
24210 !! html
24211 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
24212 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
24213 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
24214 </p>
24215 !! end
24216
24217 !! test
24218 Free external link invading image caption
24219 !! wikitext
24220 [[Image:Foobar.jpg|thumb|http://x|hello]]
24221 !! html/php
24222 <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>
24223 !! html/parsoid
24224 <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>
24225 !! end
24226
24227 !! test
24228 T17196: localised external link numbers
24229 !! options
24230 language=fa
24231 !! wikitext
24232 [http://en.wikipedia.org/]
24233 !! html/php
24234 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
24235 </p>
24236 !! html/parsoid
24237 <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
24238 !! end
24239
24240 !! test
24241 Multibyte character in padleft
24242 !! wikitext
24243 {{padleft:-Hello|7|Æ}}
24244 !! html/php
24245 <p>Æ-Hello
24246 </p>
24247 !! html/parsoid
24248 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
24249 !! end
24250
24251 !! test
24252 Multibyte character in padright
24253 !! wikitext
24254 {{padright:Hello-|7|Æ}}
24255 !! html/php
24256 <p>Hello-Æ
24257 </p>
24258 !! html/parsoid
24259 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
24260 !! end
24261
24262 !!test
24263 formatdate parser function
24264 !! wikitext
24265 {{#formatdate:2009-03-24}}
24266 !! html
24267 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
24268 </p>
24269 !! end
24270
24271 !!test
24272 formatdate parser function, with default format
24273 !! wikitext
24274 {{#formatdate:2009-03-24|mdy}}
24275 !! html
24276 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
24277 </p>
24278 !! end
24279
24280 !! test
24281 Spacing of numbers in formatted dates
24282 !! wikitext
24283 {{#formatdate:January 15}}
24284 !! html
24285 <p><span class="mw-formatted-date" title="01-15">January 15</span>
24286 </p>
24287 !! end
24288
24289 !! test
24290 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
24291 !! options
24292 language=nl title=[[MediaWiki:Common.css]]
24293 !! wikitext
24294 {{#formatdate:2009-03-24|dmy}}
24295 !! html
24296 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
24297 </p>
24298 !! end
24299
24300 !! test
24301 formatdate with invalid month
24302 !! wikitext
24303 {{#formatdate:2019-22-22|dmy}}
24304 !! html
24305 <p>2019-22-22
24306 </p>
24307 !! end
24308
24309 !! test
24310 formatdate: dots in month name do not match any char (T220563)
24311 !! options
24312 language=de
24313 !! wikitext
24314 {{#formatdate:jun. 3|dmy}}
24315 {{#formatdate:junx 3|dmy}}
24316 !! html
24317 <p><span class="mw-formatted-date" title="06-03">3 Juni</span>
24318 junx 3
24319 </p>
24320 !! end
24321
24322 !! test
24323 formatdate uses correct capitalisation in French
24324 !! options
24325 language=fr
24326 !! wikitext
24327 {{#formatdate:Juin 3|dmy}}
24328 !! html
24329 <p><span class="mw-formatted-date" title="06-03">3 juin</span>
24330 </p>
24331 !! end
24332
24333 !! test
24334 formatdate uses correct capitalisation in English
24335 !! wikitext
24336 {{#formatdate:june 3|dmy}}
24337 !! html
24338 <p><span class="mw-formatted-date" title="06-03">3 June</span>
24339 </p>
24340 !! end
24341
24342
24343 #
24344 #
24345 #
24346
24347 #
24348 # Edit comments
24349 #
24350
24351 !! test
24352 Edit comment with link
24353 !! options
24354 comment
24355 !! wikitext
24356 I like the [[Main Page]] a lot
24357 !! html/php
24358 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
24359 !!end
24360
24361 !! test
24362 Edit comment with link and link text
24363 !! options
24364 comment
24365 !! wikitext
24366 I like the [[Main Page|best pages]] a lot
24367 !! html/php
24368 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24369 !!end
24370
24371 !! test
24372 Edit comment with link and link text with suffix
24373 !! options
24374 comment
24375 !! wikitext
24376 I like the [[Main Page|best page]]s a lot
24377 !! html/php
24378 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
24379 !!end
24380
24381 !! test
24382 Edit comment with section link (non-local, eg in history list)
24383 !! options
24384 comment title=[[Main Page]]
24385 !! wikitext
24386 /* External links */ removed bogus entries
24387 !! html/php
24388 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→‎External links</a>: </span> removed bogus entries</span>
24389 !!end
24390
24391 !! test
24392 Edit comment with section link and text before it (non-local, eg in history list)
24393 !! options
24394 comment title=[[Main Page]]
24395 !! wikitext
24396 pre-comment text /* External links */ removed bogus entries
24397 !! html/php
24398 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>
24399 !!end
24400
24401 !! test
24402 Edit comment with section link (local, eg in diff view)
24403 !! options
24404 comment local title=[[Main Page]]
24405 !! wikitext
24406 /* External links */ removed bogus entries
24407 !! html/php
24408 <span dir="auto"><span class="autocomment"><a href="#External_links">→‎External links</a>: </span> removed bogus entries</span>
24409 !!end
24410
24411 !! test
24412 Edit comment with section link that has a link in it
24413 !! options
24414 comment local title=[[Main Page]]
24415 !! wikitext
24416 /* [[A link]] */
24417 !! html/php
24418 <span dir="auto"><span class="autocomment"><a href="#A_link">→‎&#91;[A link]]</a></span></span>
24419 !! end
24420
24421 !! test
24422 Edit comment with section link that has a template in it
24423 !! options
24424 comment local title=[[Main Page]]
24425 !! wikitext
24426 /* {{foobar|param}} */
24427 !! html/php
24428 <span dir="auto"><span class="autocomment"><a href="#.7B.7Bfoobar.7Cparam.7D.7D">→‎{{foobar|param}}</a></span></span>
24429 !! end
24430
24431 !! test
24432 Edit comment with subpage link (T16080)
24433 !! options
24434 comment
24435 subpage
24436 title=[[Subpage test]]
24437 !! wikitext
24438 Poked at a [[/subpage]] here...
24439 !! html/php
24440 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
24441 !!end
24442
24443 !! test
24444 Edit comment with subpage link and link text (T16080)
24445 !! options
24446 comment
24447 subpage
24448 title=[[Subpage test]]
24449 !! wikitext
24450 Poked at a [[/subpage|neat little page]] here...
24451 !! html/php
24452 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
24453 !!end
24454
24455 !! test
24456 Edit comment with bogus subpage link in non-subpage NS (T16080)
24457 !! options
24458 comment
24459 title=[[Subpage test]]
24460 !! wikitext
24461 Poked at a [[/subpage]] here...
24462 !! html/php
24463 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...
24464 !!end
24465
24466 !! test
24467 Edit comment with bare anchor link (local, as on diff)
24468 !! options
24469 comment
24470 local
24471 title=[[Main Page]]
24472 !! wikitext
24473 [[#section]]
24474 !! html/php
24475 <a href="#section">#section</a>
24476 !! end
24477
24478 !! test
24479 Edit comment with bare anchor link (non-local, as on history)
24480 !! options
24481 comment
24482 title=[[Main Page]]
24483 !! wikitext
24484 [[#section]]
24485 !! html/php
24486 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
24487 !! end
24488
24489 !! test
24490 Anchor starting with underscore
24491 !! options
24492 title=[[Foo]]
24493 !! wikitext
24494 [[#_ref|One]]
24495 !! html/php
24496 <p><a href="#_ref">One</a>
24497 </p>
24498 !! html/parsoid
24499 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
24500 !! end
24501
24502 !! test
24503 Id starting with underscore
24504 !! wikitext
24505 <div id="_ref"></div>
24506 !! html/*
24507 <div id="_ref"></div>
24508 !! end
24509
24510 !! test
24511 Edit comment with link with more than one pipe (T99346)
24512 !! options
24513 comment
24514 !! wikitext
24515 [[Main Page|Many|pipes]]
24516 !! html/php
24517 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
24518 !! end
24519
24520 !! test
24521 Complex edit comment with link with more than one pipe (T99346)
24522 !! options
24523 comment
24524 !! wikitext
24525 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
24526 !! html/php
24527 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;
24528 !! end
24529
24530 !! test
24531 Space normalisation on autocomment (T24784)
24532 !! options
24533 comment
24534 title=[[Main Page]]
24535 !! wikitext
24536 /* __hello__world__ */
24537 !! html/php
24538 <span dir="auto"><span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→‎__hello__world__</a></span></span>
24539 !! end
24540
24541 !! test
24542 percent-encoding and + signs in comments (T28410)
24543 !! options
24544 comment
24545 !! wikitext
24546 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
24547 !! html/php
24548 <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>
24549 !! end
24550
24551 # Parsoid doesn't support this yet: see T75581
24552 # but it *should* omit the 'src' attribute if the image is bad.
24553 # PHP side of tests was disabled in
24554 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
24555 # because of issues in the PHP parserTests infrastructure
24556 # (but the output below is indeed what the PHP side emits)
24557 !! test
24558 Bad images - basic functionality
24559 !! wikitext
24560 [[File:Bad.jpg]]
24561 !! html/php+disabled
24562 !! html/parsoid
24563 <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>
24564 !! end
24565
24566 !! test
24567 Bad images - T18039: text after bad image disappears
24568 !! wikitext
24569 Foo bar
24570 [[File:Bad.jpg]]
24571 Bar foo
24572 !! html/php+disabled
24573 <p>Foo bar
24574 </p><p>Bar foo
24575 </p>
24576 !! html/parsoid
24577 <p>Foo bar
24578 <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>
24579 Bar foo</p>
24580 !! end
24581
24582 !! test
24583 Verify that displaytitle works (T24501) no displaytitle
24584 !! options
24585 showtitle
24586 !! config
24587 wgAllowDisplayTitle=true
24588 wgRestrictDisplayTitle=false
24589 !! wikitext
24590 this is not the the title
24591 !! html/php
24592 Parser test
24593 <p>this is not the the title
24594 </p>
24595 !! end
24596
24597 !! test
24598 Verify that displaytitle works (T24501) RestrictDisplayTitle=false
24599 !! options
24600 showtitle
24601 title=[[Screen]]
24602 !! config
24603 wgAllowDisplayTitle=true
24604 wgRestrictDisplayTitle=false
24605 !! wikitext
24606 this is not the the title
24607 {{DISPLAYTITLE:whatever}}
24608 !! html/php
24609 whatever
24610 <p>this is not the the title
24611 </p>
24612 !! end
24613
24614 !! test
24615 Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
24616 !! options
24617 showtitle
24618 title=[[Screen]]
24619 !! config
24620 wgAllowDisplayTitle=true
24621 wgRestrictDisplayTitle=true
24622 !! wikitext
24623 this is not the the title
24624 {{DISPLAYTITLE:whatever}}
24625 !! html/php
24626 Screen
24627 <p>this is not the the title
24628 </p>
24629 !! end
24630
24631 !! test
24632 Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
24633 !! options
24634 showtitle
24635 title=[[Screen]]
24636 !! config
24637 wgAllowDisplayTitle=true
24638 wgRestrictDisplayTitle=true
24639 !! wikitext
24640 this is not the the title
24641 {{DISPLAYTITLE:screen}}
24642 !! html/php
24643 screen
24644 <p>this is not the the title
24645 </p>
24646 !! end
24647
24648 !! test
24649 Verify that displaytitle works (T24501) AllowDisplayTitle=false
24650 !! options
24651 showtitle
24652 title=[[Screen]]
24653 !! config
24654 wgAllowDisplayTitle=false
24655 !! wikitext
24656 this is not the the title
24657 {{DISPLAYTITLE:screen}}
24658 !! html/php
24659 Screen
24660 <p>this is not the the title
24661 <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>
24662 </p>
24663 !! end
24664
24665 !! test
24666 Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
24667 !! options
24668 showtitle
24669 title=[[Screen]]
24670 !! config
24671 wgAllowDisplayTitle=false
24672 !! wikitext
24673 this is not the the title
24674 !! html/php
24675 Screen
24676 <p>this is not the the title
24677 </p>
24678 !! end
24679
24680 !! test
24681 Verify that displaytitle handles inline CSS styles (T28547) - rejected value
24682 !! options
24683 showtitle
24684 title=[[Screen]]
24685 !! config
24686 wgAllowDisplayTitle=true
24687 wgRestrictDisplayTitle=true
24688 !! wikitext
24689 this is not the the title
24690 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
24691 !! html/php
24692 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
24693 <p>this is not the the title
24694 </p>
24695 !! end
24696
24697 !! test
24698 Verify that displaytitle handles inline CSS styles (T28547) - accepted value
24699 !! options
24700 showtitle
24701 title=[[Screen]]
24702 !! config
24703 wgAllowDisplayTitle=true
24704 wgRestrictDisplayTitle=true
24705 !! wikitext
24706 this is not the the title
24707 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
24708 !! html/php
24709 <span style="color: red;">s</span>creen
24710 <p>this is not the the title
24711 </p>
24712 !! end
24713
24714 !! test
24715 Page status indicators: Empty name is invalid
24716 !! options
24717 showindicators
24718 !! wikitext
24719 <indicator name=" "></indicator>
24720 <indicator></indicator>
24721 !! html/php
24722 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24723 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
24724 </p>
24725 !! end
24726
24727 !! test
24728 Page status indicators: Weird syntaxes that are okay
24729 !! options
24730 showindicators
24731 !! wikitext
24732 <indicator name="empty" />
24733 <indicator name="name"></indicator>
24734 !! html/php
24735 empty=
24736 name=
24737 <p><br />
24738 </p>
24739 !! end
24740
24741 !! test
24742 Page status indicators: Torture test
24743 !! options
24744 showindicators
24745 !! wikitext
24746 <indicator name="01">hello world</indicator>
24747 <indicator name="02">[[Main Page]]</indicator>
24748 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
24749 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
24750 <indicator name="05">*foo
24751 *bar</indicator>
24752 <indicator name="06"><nowiki>foo</nowiki></indicator>
24753 <indicator name="07"> Preformatted</indicator>
24754 <indicator name="08"><div>Broken tag</indicator>
24755 <indicator name="09">{| class=wikitable
24756 |cell
24757 |}</indicator>
24758 <indicator name="10">Two
24759
24760 paragraphs</indicator>
24761 !! html/php
24762 01=hello world
24763 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
24764 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" />
24765 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>
24766 05=<ul><li>foo</li>
24767 <li>bar</li></ul>
24768 06=foo
24769 07=<pre>Preformatted
24770 </pre>
24771 08=<div>Broken tag</div>
24772
24773 09=<table class="wikitable">
24774 <tr>
24775 <td>cell
24776 </td></tr></table>
24777 10=<p>Two
24778 </p><p>paragraphs
24779 </p>
24780 <p><br />
24781 </p><p><br />
24782 </p><p><br />
24783 </p><p><br />
24784 </p><p><br />
24785 </p>
24786 !! end
24787
24788 !! test
24789 preload: check <noinclude> and <includeonly>
24790 !! options
24791 preload
24792 !! wikitext
24793 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
24794 !! html/php
24795 Hello kind world.
24796 !! end
24797
24798 !! test
24799 preload: check <onlyinclude>
24800 !! options
24801 preload
24802 !! wikitext
24803 Goodbye <onlyinclude>Hello world</onlyinclude>
24804 !! html/php
24805 Hello world
24806 !! end
24807
24808 !! test
24809 preload: can pass tags through if we want to
24810 !! options
24811 preload
24812 !! wikitext
24813 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
24814 !! html/php
24815 <includeonly>Hello world</includeonly>
24816 !! end
24817
24818 !! test
24819 preload: check that it doesn't try to do tricks
24820 !! options
24821 preload
24822 !! wikitext
24823 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24824 !! html/php
24825 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
24826 !! end
24827
24828 !! test
24829 Play a bit with r67090 and T5158
24830 !! wikitext
24831 <div style="width:50% !important">&nbsp;</div>
24832 <div style="width:50%&nbsp;!important">&nbsp;</div>
24833 <div style="width:50%&#160;!important">&nbsp;</div>
24834 <div style="border : solid;">&nbsp;</div>
24835 !! html/php
24836 <div style="width:50% !important">&#160;</div>
24837 <div style="width:50% !important">&#160;</div>
24838 <div style="width:50% !important">&#160;</div>
24839 <div style="border&#32;: solid;">&#160;</div>
24840 !! html/parsoid
24841 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24842 <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>
24843 <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>
24844 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
24845 !! end
24846
24847 !! test
24848 French spaces in wikitext
24849 !! wikitext
24850 foo ! bar ? bat 50 % is less than 75 %.
24851
24852 Hello : this ; is « something ‹ else › again »
24853 !! html
24854 <p>foo&#160;! bar&#160;? bat 50&#160;% is less than 75&#160;%.
24855 </p><p>Hello&#160;: this&#160;; is «&#160;something ‹&#160;else&#160;› again&#160;»
24856 </p>
24857 !! end
24858
24859 # It would be reasonable for Parsoid and PHP to differ here.
24860 # The PHP behavior is arguably a bug.
24861 !! test
24862 Corner case: french spaces in definition list
24863 !! wikitext
24864 ;foo : bar
24865 !! html+tidy
24866 <dl><dt>foo&#160;</dt>
24867 <dd>bar</dd></dl>
24868 !! end
24869
24870 !! test
24871 T5158: Test for French spaces in attributes
24872 !! wikitext
24873 <br style=" clear : both ; " />
24874 !! html/php
24875 <p><br style="clear&#32;: both&#32;;" />
24876 </p>
24877 !! end
24878
24879 !! test
24880 HTML5 data attributes
24881 !! wikitext
24882 <span data-foo="bar">Baz</span>
24883 <p data-abc-def_hij="">Quuz</p>
24884 !! html/php
24885 <p><span data-foo="bar">Baz</span>
24886 </p>
24887 <p data-abc-def_hij="">Quuz</p>
24888 !! html/parsoid
24889 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
24890 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
24891 !! end
24892
24893 !! test
24894 Strip reserved data attributes
24895 !! wikitext
24896 <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>
24897 !! html/php
24898 <div data-ok="fred" data-object-id="123">d</div>
24899 !! html/parsoid
24900 <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>
24901 !! end
24902
24903 !! test
24904 percent-encoding and + signs in internal links (T28410)
24905 !! wikitext
24906 [[User:+%]] [[Page+title%]]
24907 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
24908 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
24909 [[%33%45]] [[%33%45+]]
24910 !! html/php
24911 <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>
24912 <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>
24913 <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>
24914 <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>
24915 </p>
24916 !! html/parsoid
24917 <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>
24918 <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>
24919 <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>
24920 <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>
24921 !! end
24922
24923 !! test
24924 Special characters in embedded file links (T29679)
24925 !! wikitext
24926 [[File:Contains & ampersand.jpg]]
24927 [[File:Does not exist.jpg|Title with & ampersand]]
24928 !! html/php
24929 <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>
24930 <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>
24931 </p>
24932 !! html/parsoid
24933 <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>
24934 <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>
24935 !! end
24936
24937 !! test
24938 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
24939 !! wikitext
24940 Text&apos;s been normalized?
24941 !! html
24942 <p>Text&#39;s been normalized?
24943 </p>
24944 !! end
24945
24946 !! test
24947 T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
24948 !! wikitext
24949 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
24950 !! html
24951 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
24952 </p>
24953 !! end
24954
24955 !! test
24956 T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
24957 !! wikitext
24958 [http://www.example.org/ ideograms]
24959 !! html
24960 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
24961 </p>
24962 !! end
24963
24964 !! test
24965 T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
24966 !! wikitext
24967 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
24968 !! html
24969 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
24970 </p>
24971 !! end
24972
24973 !! article
24974 Mediawiki:loop1
24975 !! text
24976 {{Identical|A}}
24977 !! endarticle
24978
24979 !! article
24980 Mediawiki:loop2
24981 !! text
24982 {{Identical|B}}
24983 !! endarticle
24984
24985 !! article
24986 Template:Identical
24987 !! text
24988 {{int:loop1}}
24989 {{int:loop2}}
24990 !! endarticle
24991
24992 !! test
24993 T33098 Template which includes system messages which includes the template
24994 !! wikitext
24995 {{Identical}}
24996 !! html
24997 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24998 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
24999 </p>
25000 !! end
25001
25002 !! test
25003 T33490 Turkish: ucfirst 'blah'
25004 !! options
25005 language=tr
25006 !! wikitext
25007 {{ucfirst:blah}}
25008 !! html
25009 <p>Blah
25010 </p>
25011 !! end
25012
25013 !! test
25014 T33490 Turkish: ucfirst 'ix'
25015 !! options
25016 language=tr
25017 !! wikitext
25018 {{ucfirst:ix}}
25019 !! html
25020 <p>İx
25021 </p>
25022 !! end
25023
25024 !! test
25025 T33490 Turkish: lcfirst 'BLAH'
25026 !! options
25027 language=tr
25028 !! wikitext
25029 {{lcfirst:BLAH}}
25030 !! html
25031 <p>bLAH
25032 </p>
25033 !! end
25034
25035 !! test
25036 T33490 Turkish: ucfırst (with a dotless i)
25037 !! options
25038 language=tr
25039 !! wikitext
25040 {{ucfırst:blah}}
25041 !! html
25042 <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>
25043 </p>
25044 !! end
25045
25046 !! test
25047 T33490 ucfırst (with a dotless i) with English language
25048 !! options
25049 language=en
25050 !! wikitext
25051 {{ucfırst:blah}}
25052 !! html
25053 <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>
25054 </p>
25055 !! end
25056
25057 # Note that Parsoid doesn't emit an explicit TOC.
25058 # Note also that the html2wt direction tends to emit an extra newline
25059 # between the __TOC__ magicword and the first heading unless *both*
25060 # the <meta> and the <h2> have a data-parsoid attribute set (even if
25061 # it's "{}").
25062
25063 !! test
25064 T28375: TOC with italics
25065 !! options
25066 title=[[Main Page]]
25067 !! wikitext
25068 __TOC__
25069 ==''Lost'' episodes==
25070 !! html/php
25071 <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>
25072 <ul>
25073 <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>
25074 </ul>
25075 </div>
25076
25077 <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>
25078 !! html/parsoid
25079 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25080 <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
25081 !! end
25082
25083 !! test
25084 T28375: TOC with bold
25085 !! options
25086 title=[[Main Page]]
25087 !! wikitext
25088 __TOC__
25089 =='''should be bold''' then normal text==
25090 !! html/php
25091 <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>
25092 <ul>
25093 <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>
25094 </ul>
25095 </div>
25096
25097 <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>
25098 !! html/parsoid
25099 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25100 <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
25101 !! end
25102
25103 !! test
25104 T35845: Headings become cursive in TOC when they contain an image
25105 !! options
25106 title=[[Main Page]]
25107 !! wikitext
25108 __TOC__
25109 ==Image [[Image:foobar.jpg]]==
25110 !! html/php
25111 <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>
25112 <ul>
25113 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
25114 </ul>
25115 </div>
25116
25117 <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>
25118 !! html/parsoid
25119 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25120 <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>
25121 !! end
25122
25123 !! test
25124 T35845 (2): Headings become bold in TOC when they contain a blockquote
25125 !! options
25126 title=[[Main Page]]
25127 !! wikitext
25128 __TOC__
25129 ==<blockquote>Quote</blockquote>==
25130 !! html/php
25131 <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>
25132 <ul>
25133 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25134 </ul>
25135 </div>
25136
25137 <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>
25138 !! html/php+tidy
25139 <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>
25140 <ul>
25141 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
25142 </ul>
25143 </div>
25144
25145 <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>
25146 !! html/parsoid
25147 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25148 <h2 id="Quote" data-parsoid='{}'><blockquote><p>Quote</p></blockquote></h2>
25149 !! end
25150
25151 !! test
25152 Unclosed tags in TOC
25153 !! config
25154 wgFragmentMode=[ 'html5', 'legacy' ]
25155 !! options
25156 title=[[Main Page]]
25157 !! wikitext
25158 __TOC__
25159 ==Proof: 2 < 3==
25160 <small>Hanc marginis exiguitas non caperet.</small>
25161 QED
25162 !! html/php
25163 <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>
25164 <ul>
25165 <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>
25166 </ul>
25167 </div>
25168
25169 <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>
25170 <p><small>Hanc marginis exiguitas non caperet.</small>
25171 QED
25172 </p>
25173 !! html/parsoid
25174 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25175 <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
25176 <p><small>Hanc marginis exiguitas non caperet.</small>
25177 QED</p>
25178 !! end
25179
25180 !! test
25181 Multiple tags in TOC
25182 !! wikitext
25183 __TOC__
25184 ==<i>Foo</i> <b>Bar</b>==
25185
25186 ==<i>Foo</i> <blockquote>Bar</blockquote>==
25187 !! html/php
25188 <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>
25189 <ul>
25190 <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>
25191 <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>
25192 </ul>
25193 </div>
25194
25195 <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>
25196 <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>
25197 !! html/php+tidy
25198 <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>
25199 <ul>
25200 <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>
25201 <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>
25202 </ul>
25203 </div>
25204
25205 <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>
25206 <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>
25207 !! html/parsoid
25208 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25209 <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
25210
25211 <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote><p>Bar</p></blockquote></h2>
25212 !! end
25213
25214 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
25215 # html5 tag parsing.
25216 !! test
25217 Tags with parameters in TOC
25218 !! options
25219 parsoid=wt2html
25220 !! wikitext
25221 __TOC__
25222 ==<sup class="in-h2">Hello</sup>==
25223
25224 ==<sup class="a > b">Evilbye</sup>==
25225 !! html/php
25226 <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>
25227 <ul>
25228 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
25229 <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>
25230 </ul>
25231 </div>
25232
25233 <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>
25234 <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>
25235 !! html/parsoid
25236 <meta property="mw:PageProp/toc" />
25237 <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
25238
25239 <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
25240 !! end
25241
25242 !! test
25243 span tags with directionality in TOC
25244 !! wikitext
25245 __TOC__
25246 ==<span dir="ltr">C++</span>==
25247
25248 ==<span dir="rtl">זבנג!</span>==
25249
25250 ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
25251
25252 ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
25253
25254 ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
25255 !! html/php
25256 <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>
25257 <ul>
25258 <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>
25259 <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>
25260 <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>
25261 <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>
25262 <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>
25263 </ul>
25264 </div>
25265
25266 <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>
25267 <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>
25268 <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>
25269 <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>
25270 <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>
25271 !! html/parsoid
25272 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25273 <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
25274 <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
25275 <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>
25276 <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>
25277 <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>
25278 !! end
25279
25280 !! test
25281 T74884: bdi element in ToC
25282 !! wikitext
25283 __TOC__
25284 ==<bdi>test</bdi>==
25285 !! html/php
25286 <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>
25287 <ul>
25288 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
25289 </ul>
25290 </div>
25291
25292 <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>
25293 !! html/parsoid
25294 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25295 <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
25296 !! end
25297
25298 !! test
25299 T35715: s/strike element in ToC
25300 !! wikitext
25301 __TOC__
25302 ==<s>test</s> test <strike>test</strike>==
25303 !! html/php
25304 <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>
25305 <ul>
25306 <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>
25307 </ul>
25308 </div>
25309
25310 <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>
25311 !! html/parsoid
25312 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25313 <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
25314 !! end
25315
25316 !! test
25317 T198618: style element in ToC
25318 !! options
25319 styletag=1
25320 !! wikitext
25321 __TOC__
25322 ==<style>.foo {}</style>Style<style>.bar {}</style>==
25323 !! html/php
25324 <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>
25325 <ul>
25326 <li class="toclevel-1 tocsection-1"><a href="#Style"><span class="tocnumber">1</span> <span class="toctext">Style</span></a></li>
25327 </ul>
25328 </div>
25329
25330 <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>
25331 !! html/parsoid
25332 <meta property="mw:PageProp/toc" data-parsoid="{}"/>
25333 <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>
25334 !! end
25335
25336 !! test
25337 T198618: script element in ToC
25338 !! options
25339 wgRawHtml=1
25340 !! wikitext
25341 __TOC__
25342 ==<html><script>alert(1);</script></html>Script<html><script>alert(1);</script></html>==
25343 !! html/php
25344 <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>
25345 <ul>
25346 <li class="toclevel-1 tocsection-1"><a href="#Script"><span class="tocnumber">1</span> <span class="toctext">Script</span></a></li>
25347 </ul>
25348 </div>
25349
25350 <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>
25351 !! html/parsoid
25352 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25353 <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>
25354 !! end
25355
25356 !! test
25357 Empty <p> tag in TOC, removed by Sanitizer (T92892)
25358 !! wikitext
25359 __TOC__
25360 ==x==
25361 !! html/php
25362 <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>
25363 <ul>
25364 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
25365 </ul>
25366 </div>
25367
25368 <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>
25369 !! html/parsoid
25370 <meta property="mw:PageProp/toc" data-parsoid='{}'/>
25371 <h2 id="x" data-parsoid='{}'>x</h2>
25372 !! end
25373
25374 !! article
25375 MediaWiki:T34057
25376 !! text
25377 == {{int:headline_sample}} ==
25378 !! endarticle
25379
25380 !! test
25381 T34057: Title needed when expanding <h> nodes.
25382 !! options
25383 title=[[Main Page]]
25384 !! wikitext
25385 {{int:T34057}}
25386 !! html
25387 <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>
25388 !! end
25389
25390 !! test
25391 Strip marker in urlencode
25392 !! wikitext
25393 {{urlencode:x<nowiki/>y}}
25394 {{urlencode:x<nowiki/>y|wiki}}
25395 {{urlencode:x<nowiki/>y|path}}
25396 {{urlencode:x<pre id="one">two</pre>y}}
25397 !! html/php
25398 <p>xy
25399 xy
25400 xy
25401 xy
25402 </p>
25403 !! end
25404
25405 !! test
25406 Strip marker in lc
25407 !! wikitext
25408 {{lc:x<nowiki/>y}}
25409 !! html
25410 <p>xy
25411 </p>
25412 !! end
25413
25414 !! test
25415 Strip marker in uc
25416 !! wikitext
25417 {{uc:x<nowiki/>y}}
25418 !! html
25419 <p>XY
25420 </p>
25421 !! end
25422
25423 !! test
25424 Strip marker in formatNum
25425 !! wikitext
25426 {{formatnum:1<nowiki/>2}}
25427 {{formatnum:1<nowiki/>2|R}}
25428 !! html
25429 <p>12
25430 12
25431 </p>
25432 !! end
25433
25434 !! test
25435 Check noCommafy in formatNum
25436 !! options
25437 language=be-tarask
25438 !! wikitext
25439 {{formatnum:123456.78}}
25440 {{formatnum:123456.78|NOSEP}}
25441 !! html
25442 <p>123 456,78
25443 123456.78
25444 </p>
25445 !! end
25446
25447 !! test
25448 Wrong option for formatNum (T58199)
25449 !! wikitext
25450 {{formatnum:1,234.56|Random}}
25451 {{formatnum:1,234.56|EVERYTHING}}
25452 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
25453 !! html
25454 <p>1,234.56
25455 1,234.56
25456 1,234.56
25457 </p>
25458 !! end
25459
25460 !! test
25461 Strip marker in grammar
25462 !! options
25463 language=fi
25464 !! wikitext
25465 {{grammar:elative|foo<nowiki/>bar}}
25466 !! html
25467 <p>foobarista
25468 </p>
25469 !! end
25470
25471 !! test
25472 Strip marker in padleft
25473 !! wikitext
25474 {{padleft:|2|x<nowiki/>y}}
25475 !! html
25476 <p>xy
25477 </p>
25478 !! end
25479
25480 !! test
25481 Strip marker in padright
25482 !! wikitext
25483 {{padright:|2|x<nowiki/>y}}
25484 !! html
25485 <p>xy
25486 </p>
25487 !! end
25488
25489 !! test
25490 Strip marker in anchorencode
25491 !! wikitext
25492 {{anchorencode:x<nowiki/>y}}
25493 !! html/php
25494 <p>xy
25495 </p>
25496 !! html/parsoid
25497 <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>
25498 !! end
25499
25500 !! test
25501 nowiki inside link inside heading (T20295)
25502 !! wikitext
25503 ==[[foo|x<nowiki>y</nowiki>z]]==
25504 !! html
25505 <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>
25506 !! end
25507
25508 !! test
25509 new support for bdi element (T33817)
25510 !! wikitext
25511 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25512 !! html
25513 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
25514 !! end
25515
25516 !! test
25517 Ignore pipe between table row attributes
25518 !! wikitext
25519 {|
25520 |quux
25521 |- id=foo | style='color: red'
25522 |bar
25523 |}
25524 !! html
25525 <table>
25526 <tr>
25527 <td>quux
25528 </td></tr>
25529 <tr id="foo" style="color: red">
25530 <td>bar
25531 </td></tr></table>
25532 !! end
25533
25534 !!test
25535 Language parser function
25536 !! wikitext
25537 {{#language:ar}}
25538 !! html
25539 <p>العربية
25540 </p>
25541 !! end
25542
25543 !!test
25544 Padleft and padright (default 0-padding)
25545 !! wikitext
25546 {{padleft:xyz|5}}
25547 {{padright:xyz|5}}
25548 !! html/php
25549 <p>00xyz
25550 xyz00
25551 </p>
25552 !! html/parsoid
25553 <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
25554 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
25555 !! end
25556
25557 !!test
25558 Padleft and padright (partial fill)
25559 !! wikitext
25560 {{padleft:xyz|6|ab}}
25561 {{padright:xyz|6|ab}}
25562 !! html/php
25563 <p>abaxyz
25564 xyzaba
25565 </p>
25566 !! html/parsoid
25567 <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>
25568 <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>
25569 !! end
25570
25571 !!test
25572 Padleft and padright as substr
25573 !! wikitext
25574 {{padleft:|3|abcde}}
25575 {{padright:|3|abcde}}
25576 !! html/php
25577 <p>abc
25578 abc
25579 </p>
25580 !! html/parsoid
25581 <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>
25582 <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>
25583 !! end
25584
25585 !! test
25586 Padleft and padright with non-numerical length (T180403)
25587 !! wikitext
25588 {{padleft:abcdef|junk}}
25589 {{padright:abcdef|junk}}
25590 !! html/php
25591 <p>abcdef
25592 abcdef
25593 </p>
25594 !! end
25595
25596 !!test
25597 Special parser function
25598 !! wikitext
25599 {{#special:RandomPage}}
25600 {{#special:BaDtItLe}}
25601 {{#special:Foobar}}
25602 !! html
25603 <p>Special:Random
25604 Special:Badtitle
25605 Special:Foobar
25606 </p>
25607 !! end
25608
25609 !!test
25610 T36939 - Case insensitive link parsing ([HttP://])
25611 !! wikitext
25612 [HttP://MediaWiki.Org/]
25613 !! html/php
25614 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
25615 </p>
25616 !! html/parsoid
25617 <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
25618 !! end
25619
25620 !!test
25621 T36939 - Case insensitive link parsing ([HttP:// title])
25622 !! wikitext
25623 [HttP://MediaWiki.Org/ MediaWiki]
25624 !! html
25625 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
25626 </p>
25627 !! end
25628
25629 !!test
25630 T36939 - Case insensitive link parsing (HttP://)
25631 !! wikitext
25632 HttP://MediaWiki.Org/
25633 !! html/php
25634 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
25635 </p>
25636 !! html/parsoid
25637 <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
25638 !! end
25639
25640 !!test
25641 Disable TOC
25642 !! options
25643 notoc
25644 !! wikitext
25645 Lead
25646 ==Section 1==
25647 ==Section 2==
25648 ==Section 3==
25649 ==Section 4==
25650 ==Section 5==
25651 !! html
25652 <p>Lead
25653 </p>
25654
25655 <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>
25656 <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>
25657 <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>
25658 <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>
25659 <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>
25660 !! end
25661
25662
25663 ###
25664 ### Parsoid-specific tests
25665 ### Parsoid-PHP parser incompatibilities
25666 ###
25667 !!test
25668 1. SOL-sensitive wikitext tokens as template-args
25669 !! options
25670 parsoid=wt2html,wt2wt
25671 !! wikitext
25672 {{echo|*a}}
25673 {{echo|#a}}
25674 {{echo|:a}}
25675 !! html/php+tidy
25676 <ul><li>a</li></ul>
25677 <ol><li>a</li></ol>
25678 <dl><dd>a</dd></dl>
25679 !! html/parsoid
25680 <span about="#mwt1" typeof="mw:Transclusion">
25681 </span><ul about="#mwt1"><li>a</li>
25682 </ul>
25683 <span about="#mwt2" typeof="mw:Transclusion">
25684 </span><ol about="#mwt2"><li>a</li>
25685 </ol>
25686 <span about="#mwt3" typeof="mw:Transclusion">
25687 </span><dl about="#mwt3"><dd>a</dd>
25688 </dl>
25689 !!end
25690
25691 #### -----------------------------------------------------------------
25692 #### Parsoid-specific functionality tests
25693 #### -----------------------------------------------------------------
25694
25695 # T65642/T68749: Formatting elt fixup around images.
25696 # We know wt2wt will fail, but we expect selser to pass.
25697 # Due to the nature of our testing, wt2wt and selser tests will enter the
25698 # blacklist and we'll catch selser regressions based on changes to the
25699 # blacklist entries for selser tests.
25700 !! test
25701 1. Treebuilder fixup of formatting elt
25702 !! options
25703 parsoid=wt2html,wt2wt
25704 !! wikitext
25705 {|
25706 |
25707 <small>
25708 [[Image:Foobar.jpg|right|Test]]
25709 </small>
25710 |}
25711 !! html/php+tidy
25712 <table>
25713 <tbody><tr>
25714 <td>
25715 <p><small>
25716 </small></p><small>
25717 <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>
25718 </small><p><small></small>
25719 </p>
25720 </td></tr></tbody></table>
25721 !! html/parsoid
25722 <table>
25723 <tbody><tr><td>
25724 <p><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></p><small data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
25725 <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>
25726 <p><small data-parsoid='{"stx":"html","autoInsertedStart":true}'></small></p></td></tr>
25727 </tbody></table>
25728 !! end
25729
25730 !! test
25731 2. Treebuilder fixup of formatting elt
25732 !! options
25733 parsoid=wt2html,wt2wt
25734 !! wikitext
25735 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
25736
25737 <small>[[Image:Foobar.jpg|right|300px]]</small>
25738 !! html/php+tidy
25739 <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>
25740 </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>
25741 !! html/parsoid
25742 <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>
25743
25744 <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>
25745 !! end
25746
25747 !! test
25748 3. Treebuilder fixup of formatting elt
25749 !! options
25750 parsoid=wt2html,wt2wt
25751 !! wikitext
25752 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
25753 !! html/php+tidy
25754 <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>
25755 !! html/parsoid
25756 <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>
25757 !! end
25758
25759 !! test
25760 4. Treebuilder fixup of formatting elt: formatting tags around captionless images
25761 !! options
25762 parsoid=wt2html,wt2wt
25763 !! wikitext
25764 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
25765 !! html/php+tidy
25766 <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>
25767 !! html/parsoid
25768 <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>
25769 !! end
25770
25771 #### ----------------------------------------------------------------
25772 #### Parsoid-only testing of Parsoid's impl of LST
25773 #### Not implemented yet, see
25774 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
25775 #### ----------------------------------------------------------------
25776
25777 ## We still need to support serializing the older format while content is stored.
25778 !! test
25779 LST Sections: Backwards compatibility
25780 !! options
25781 parsoid={
25782 "suppressErrors": true,
25783 "modes": ["html2wt"]
25784 }
25785 !! wikitext
25786 <section begin="2011-05-16" />
25787 <section end="2014-04-10 (MW 1.23wmf22)" />
25788 !! html/parsoid
25789 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
25790 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
25791 !! end
25792
25793 !! test
25794 LST Sections: Newfangled approach
25795 !! wikitext
25796 <section begin="2011-05-16" />
25797 <section end="2014-04-10 (MW 1.23wmf22)" />
25798 !! html/parsoid
25799 <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"}}'>
25800 </span>
25801 <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"}}'>
25802 </span></p>
25803 !! end
25804
25805 #--------- Test stripping of empty nodes in template content ----------
25806
25807 !! test
25808 Empty LI and TR nodes should be stripped from template content
25809 !! wikitext
25810 {{EmptyLITest}}
25811 {{EmptyTRTest}}
25812 !! html/parsoid
25813 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
25814 <li>a</li>
25815 <li>b</li>
25816 </ul>
25817 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
25818 <tbody>
25819 <tr>
25820 <td>foo</td>
25821 </tr>
25822 <tr>
25823 <td>bar</td>
25824 </tr>
25825 </tbody>
25826 </table>
25827 !! end
25828
25829 !! test
25830 Empty LI and TR nodes should not be stripped from top-level content
25831 !! wikitext
25832 *a
25833 *
25834 *b
25835
25836 {|
25837 |-
25838 |-
25839 |foo
25840 |}
25841 !! html/parsoid
25842 <ul>
25843 <li>a</li>
25844 <li class='mw-empty-elt'></li>
25845 <li>b</li>
25846 </ul>
25847 <table>
25848 <tbody>
25849 <tr class='mw-empty-elt'></tr>
25850 <tr>
25851 <td>foo</td>
25852 </tr>
25853 </tbody>
25854 </table>
25855 !! end
25856
25857 !! test
25858 Empty TR nodes should not be stripped if they have any attributes set
25859 !! wikitext
25860 {{EmptyTRWithHTMLAttrTest}}
25861 !! html/parsoid
25862 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
25863 <tr align='center'></tr>
25864 <tr><td>foo</td></tr>
25865 <tr align='center'></tr>
25866 <tr><td>bar</td></tr>
25867 </table>
25868 !! end
25869
25870 #### ----------------------------------------------------------------
25871 #### The following section of tests are primarily to test
25872 #### wikitext escaping capabilities of Parsoid. Given that
25873 #### escaping can be done any number of ways, the wikitext (input)
25874 #### is always adjusted to reflect how Parsoid adds nowiki
25875 #### escape tags.
25876 ####
25877 #### We are marking several tests as parsoid-only since the
25878 #### HTML in the result section is different from what the
25879 #### PHP parser generates for it.
25880 #### ----------------------------------------------------------------
25881
25882
25883 #### --------------- Headings ---------------
25884 #### 0. Unnested
25885 #### 1. Nested inside html <h1>=foo=</h1>
25886 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
25887 #### 3. Nested inside html with wikitext split by html tags
25888 #### 4. No escape needed
25889 #### 5. Empty headings <h1></h1>
25890 #### 6. Heading chars in SOL context
25891 #### ----------------------------------------
25892 !! test
25893 Headings: 0. Unnested
25894 !! options
25895 parsoid=html2wt
25896 !! html/parsoid
25897 <p>=foo=</p>
25898
25899 <p> =foo=
25900 <!--cmt-->
25901 =foo=</p>
25902
25903 <p>=foo<i>a</i>=</p>
25904 !! wikitext
25905 <nowiki>=foo=</nowiki>
25906
25907 <nowiki> </nowiki>=foo=
25908 <!--cmt-->
25909 <nowiki>=foo=</nowiki>
25910
25911 =foo''a''<nowiki>=</nowiki>
25912 !!end
25913
25914 # New headings and existing headings are handled differently
25915 !! test
25916 Headings: 1. Nested inside html
25917 !! options
25918 parsoid=html2wt
25919 !! html/parsoid
25920 <h1>=foo=</h1>
25921 <h2>=foo=</h2>
25922 <h3>=foo=</h3>
25923
25924 <h1 data-parsoid='{}'>=foo=</h1>
25925 <h2 data-parsoid='{}'>=foo=</h2>
25926 <h3 data-parsoid='{}'>=foo=</h3>
25927 <h4 data-parsoid='{}'>=foo=</h4>
25928 <h5 data-parsoid='{}'>=foo=</h5>
25929 <h6 data-parsoid='{}'>=foo=</h6>
25930 !! wikitext
25931 = =foo= =
25932
25933 == =foo= ==
25934
25935 === =foo= ===
25936
25937 =<nowiki>=foo=</nowiki>=
25938 ==<nowiki>=foo=</nowiki>==
25939 ===<nowiki>=foo=</nowiki>===
25940 ====<nowiki>=foo=</nowiki>====
25941 =====<nowiki>=foo=</nowiki>=====
25942 ======<nowiki>=foo=</nowiki>======
25943 !! end
25944
25945 !! test
25946 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
25947 !! options
25948 parsoid=html2wt
25949 !! html/parsoid
25950 <h1>foo</h1>*bar
25951 <h1>foo</h1>=bar
25952 <h1>foo</h1>=bar=
25953 !! wikitext
25954 = foo =
25955 <nowiki>*</nowiki>bar
25956
25957 = foo =
25958 =bar
25959
25960 = foo =
25961 <nowiki>=bar=</nowiki>
25962 !!end
25963
25964 !! test
25965 Headings: 3. Nested inside html with wikitext split by html tags
25966 !! options
25967 parsoid=html2wt
25968 !! html/parsoid
25969 <h1>=<b>bold</b>foo=</h1>
25970 !! wikitext
25971 = ='''bold'''foo= =
25972 !!end
25973
25974 !! test
25975 Headings: 4a. No escaping needed (testing just h1 and h2)
25976 !! options
25977 parsoid=html2wt
25978 !! html/parsoid
25979 <h1>=foo</h1>
25980 <h1>foo=</h1>
25981 <h1> =foo= </h1>
25982 <h1>=foo= bar</h1>
25983 <h2>=foo</h2>
25984 <h2>foo=</h2>
25985 <h1>=</h1>
25986 <h1><i>=</i>foo=</h1>
25987 !! wikitext
25988 = =foo =
25989
25990 = foo= =
25991
25992 = =foo= =
25993
25994 = =foo= bar =
25995
25996 == =foo ==
25997
25998 == foo= ==
25999
26000 = = =
26001
26002 = ''=''foo= =
26003 !!end
26004
26005 !! test
26006 Headings: 4b. No escaping needed (inside p-tags)
26007 !! options
26008 parsoid=html2wt
26009 !! html/parsoid
26010 <p>=foo= x
26011 =foo= <s></s>
26012 </p>
26013 !! wikitext
26014 =foo= x
26015 =foo= <s></s>
26016 !! html/php
26017 <p>=foo= x
26018 =foo= <s></s>
26019 </p>
26020 !!end
26021
26022 !! test
26023 Headings: 4c. Short headings (1)
26024 !! options
26025 parsoid=html2wt
26026 !! html/parsoid
26027 <p>===
26028 </p>
26029 !! wikitext
26030 <nowiki>===</nowiki>
26031 !! html/php
26032 <p>===
26033 </p>
26034 !! end
26035
26036 # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
26037 !! test
26038 Headings: 4d. Short headings (2)
26039 !! options
26040 parsoid=wt2html,html2html
26041 !! wikitext
26042 =
26043 ==
26044 ===
26045 ====
26046 =====
26047 !! html/php
26048 <p>=
26049 ==
26050 </p>
26051 <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>
26052 <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>
26053 <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>
26054 !! html/parsoid
26055 <p>=
26056 ==</p>
26057 <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
26058 <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
26059 <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
26060 !! end
26061
26062 !! test
26063 Headings: 5. Empty headings
26064 !! options
26065 parsoid=html2wt
26066 !! html/parsoid
26067 <h1 data-parsoid='{}'></h1>
26068
26069 <h2 data-parsoid='{}'></h2>
26070
26071 <h3 data-parsoid='{}'></h3>
26072
26073 <h4 data-parsoid='{}'></h4>
26074
26075 <h5 data-parsoid='{}'></h5>
26076
26077 <h6 data-parsoid='{}'></h6>
26078 !! wikitext
26079 =<nowiki/>=
26080
26081 ==<nowiki/>==
26082
26083 ===<nowiki/>===
26084
26085 ====<nowiki/>====
26086
26087 =====<nowiki/>=====
26088
26089 ======<nowiki/>======
26090 !!end
26091
26092 !! test
26093 Headings: 6a. Heading chars in SOL context (with trailing spaces)
26094 !! options
26095 parsoid=html2wt
26096 !! html/parsoid
26097 <p>=a=</p>
26098
26099 <p>=a=</p>
26100
26101 <p>=a=</p>
26102 !! wikitext
26103 <nowiki>=a=</nowiki>
26104
26105 <nowiki>=a=</nowiki>
26106
26107 <nowiki>=a=</nowiki>
26108 !!end
26109
26110 !! test
26111 Headings: 6b. Heading chars in SOL context (with trailing newlines)
26112 !! options
26113 parsoid=html2wt
26114 !! html/parsoid
26115 <p>=a=
26116 b</p>
26117
26118 <p>=a=
26119 b</p>
26120
26121 <p>=a=
26122 b</p>
26123 !! wikitext
26124 <nowiki>=a=</nowiki>
26125 b
26126
26127 <nowiki>=a=</nowiki>
26128 b
26129
26130 <nowiki>=a=</nowiki>
26131 b
26132 !!end
26133
26134 !! test
26135 Headings: 6c. Heading chars in SOL context (leading newline break)
26136 !! options
26137 parsoid=html2wt
26138 !! html/parsoid
26139 <p>a
26140 =b=</p>
26141 !! wikitext
26142 a
26143 <nowiki>=b=</nowiki>
26144 !!end
26145
26146 !! test
26147 Headings: 6d. Heading chars in SOL context (with interspersed comments)
26148 !! options
26149 parsoid=html2wt
26150 !! html/parsoid
26151 <!--c0--><p>=a=</p>
26152
26153 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
26154 !! wikitext
26155 <!--c0--><nowiki>=a=</nowiki>
26156
26157 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
26158 !!end
26159
26160 !! test
26161 Headings: 6d. Heading chars in SOL context (No escaping needed)
26162 !! options
26163 parsoid=html2wt
26164 !! html/parsoid
26165 =a=<div>b</div>
26166 !! wikitext
26167 =a=<div>b</div>
26168 !!end
26169
26170 !! test
26171 Headings: 7. Insert a newline between new content and headings
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <h2>NEW</h2>
26176 <p>new</p>
26177 <h2 data-parsoid='{}'>A</h2>
26178 <p data-parsoid='{}'>a</p>
26179 !! wikitext
26180 == NEW ==
26181 new
26182
26183 ==A==
26184 a
26185 !! end
26186
26187 !! test
26188 Headings: Used as horizontal rule
26189 !! config
26190 wgFragmentMode=[ 'html5', 'legacy' ]
26191 !! options
26192 parsoid=wt2html
26193 !! wikitext
26194 ===============
26195 !! html/php
26196 <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>
26197 !! html/parsoid
26198 <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
26199 !! end
26200
26201 #### --------------- Lists ---------------
26202 #### 0. Outside nests (*foo, etc.)
26203 #### 1. Nested inside html <ul><li>*foo</li></ul>
26204 #### 2. Inside definition lists
26205 #### 3. Only bullets at start should be escaped
26206 #### 4. No escapes needed
26207 #### 5. No unnecessary escapes
26208 #### 6. Escape bullets in SOL position
26209 #### 7. Escape bullets in a multi-line context
26210 #### ----------------------------------------
26211
26212 !! test
26213 Lists: 0. Outside nests
26214 !! options
26215 parsoid=html2wt
26216 !! html/parsoid
26217 <p>*foo</p>
26218
26219 <p>#foo</p>
26220
26221 <p>;Foo:bar</p>
26222 !! wikitext
26223 <nowiki>*</nowiki>foo
26224
26225 <nowiki>#</nowiki>foo
26226
26227 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
26228 !!end
26229
26230 ## Making these next 3 tests Parsoid-only since they are html2wt tests
26231 ## to test wikitext escaping, and insignificant whitespace diffs
26232 ## cause PHP parser tests to barf
26233 !! test
26234 Lists: 1. Nested inside html (No unnecessary escapes)
26235 !! options
26236 parsoid=html2wt
26237 !! html/parsoid
26238 <ul>
26239 <li>*foo</li>
26240 <li>#foo</li>
26241 <li>:foo</li>
26242 <li>;foo</li>
26243 <li data-parsoid='{}'>*foo</li>
26244 <li data-parsoid='{}'>#foo</li>
26245 <li data-parsoid='{}'>:foo</li>
26246 <li data-parsoid='{}'>;foo</li>
26247 </ul>
26248
26249 <ol>
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 </ol>
26259 !! wikitext
26260 * *foo
26261 * #foo
26262 * :foo
26263 * ;foo
26264 *<nowiki>*foo</nowiki>
26265 *<nowiki>#foo</nowiki>
26266 *<nowiki>:foo</nowiki>
26267 *<nowiki>;foo</nowiki>
26268
26269 # *foo
26270 # #foo
26271 # :foo
26272 # ;foo
26273 #<nowiki>*foo</nowiki>
26274 #<nowiki>#foo</nowiki>
26275 #<nowiki>:foo</nowiki>
26276 #<nowiki>;foo</nowiki>
26277 !!end
26278
26279 !! test
26280 Lists: 2. Inside definition lists
26281 !! options
26282 parsoid=html2wt
26283 !! html/parsoid
26284 <dl><dt>;foo</dt></dl>
26285 <dl><dt>:foo</dt></dl>
26286 <dl><dt>:foo</dt>
26287 <dd>bar</dd></dl>
26288 <dl><dd>:foo</dd></dl>
26289 !! wikitext
26290 ; ;foo
26291
26292 ; <nowiki>:foo</nowiki>
26293
26294 ; <nowiki>:foo</nowiki>
26295 : bar
26296
26297 : :foo
26298 !!end
26299
26300 !! test
26301 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
26302 !! options
26303 parsoid=html2wt
26304 !! html/parsoid
26305 <ul>
26306 <li>*foo*bar</li>
26307 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
26308 </ul>
26309 !! wikitext
26310 * *foo*bar
26311 *<nowiki>*foo</nowiki>''it''*bar
26312 !!end
26313
26314 !! test
26315 Lists: 4. No escapes needed
26316 !! options
26317 parsoid=html2wt
26318 !! html/parsoid
26319 <ul>
26320 <li>foo*bar
26321 </li>
26322 </ul>
26323 <ul>
26324 <li><i>foo</i>*bar
26325 </li>
26326 </ul>
26327 <ul>
26328 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
26329 </li>
26330 </ul>
26331 <ul>
26332 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
26333 </li>
26334 </ul>
26335 !! wikitext
26336 *foo*bar
26337
26338 *''foo''*bar
26339
26340 *[[Foo]]: bar
26341
26342 *[[Foo]]*bar
26343 !!end
26344
26345 !! test
26346 Lists: 5. No unnecessary escapes
26347 !! options
26348 parsoid=html2wt
26349 !! html/parsoid
26350 <ul><li> bar <span>[[foo]]</span></li></ul>
26351 <ul><li> =bar <span>[[foo]]</span></li></ul>
26352 <ul><li> [[bar <span>[[foo]]</span></li></ul>
26353 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
26354 <ul><li> =bar <span>foo]]</span>=</li></ul>
26355 <ul><li> <s></s>: a</li></ul>
26356 <ul><li> <i>* foo</i></li></ul>
26357
26358 !! wikitext
26359 * bar <span><nowiki>[[foo]]</nowiki></span>
26360
26361 * =bar <span><nowiki>[[foo]]</nowiki></span>
26362
26363 * [[bar <span><nowiki>[[foo]]</nowiki></span>
26364
26365 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
26366
26367 * =bar <span>foo]]</span>=
26368
26369 * <s></s>: a
26370
26371 * ''* foo''
26372 !!end
26373
26374 !! test
26375 Lists: 6. Escape bullets in SOL position
26376 !! options
26377 parsoid=html2wt
26378 !! html/parsoid
26379 <p><!--cmt-->*foo</p>
26380 !! wikitext
26381 <!--cmt--><nowiki>*</nowiki>foo
26382 !!end
26383
26384 !! test
26385 Lists: 7. Escape bullets in a multi-line context
26386 !! options
26387 parsoid=html2wt
26388 !! html/parsoid
26389 <p>a
26390 *b
26391 </p>
26392 !! wikitext
26393 a
26394 <nowiki>*</nowiki>b
26395 !!end
26396
26397 !! test
26398 Lists: 8. Escape colons only if not present in tags
26399 !! options
26400 parsoid=html2wt
26401 !! html/parsoid
26402 <dl><dt>a:b<i>c:d</i></dt></dl>
26403 !! wikitext
26404 ; <nowiki>a:b</nowiki>''c:d''
26405 !! end
26406
26407 #### --------------- HRs ---------------
26408 #### 1. Single line
26409 #### -----------------------------------
26410
26411 !! test
26412 HRs: 1. Single line
26413 !! options
26414 parsoid=html2wt
26415 !! html/parsoid
26416 <hr />----
26417 <hr />=foo=
26418 <hr />*foo
26419 !! wikitext
26420 ----<nowiki>----</nowiki>
26421 ----=foo=
26422 ----*foo
26423 !! end
26424
26425 #### --------------- Tables ---------------
26426 #### 1a. Simple example
26427 #### 1b. No escaping needed (!foo)
26428 #### 1c. No escaping needed (|foo)
26429 #### 1d. No escaping needed (|}foo)
26430 ####
26431 #### 2a. Nested in td (<td>foo|bar</td>)
26432 #### 2b. Nested in td (<td>foo||bar</td>)
26433 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
26434 ####
26435 #### 3a. Nested in th (<th>foo!bar</th>)
26436 #### 3b. Nested in th (<th>foo!!bar</th>)
26437 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
26438 ####
26439 #### 4a. Escape -
26440 #### 4b. Escape +
26441 #### 4c. No escaping needed
26442 #### --------------------------------------
26443
26444 !! test
26445 Tables: 1a. Simple example
26446 !! options
26447 parsoid=html2wt
26448 !! html/parsoid
26449 <p>{|
26450 |}
26451 </p>
26452 !! wikitext
26453 <nowiki>{|</nowiki>
26454 |}
26455 !! end
26456
26457 !! test
26458 Tables: 1b. No escaping needed
26459 !! options
26460 parsoid=html2wt
26461 !! html/parsoid
26462 <p>!foo
26463 </p>
26464 !! wikitext
26465 !foo
26466 !! end
26467
26468 !! test
26469 Tables: 1c. 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: 1d. 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: 2a. Nested in td
26492 !! options
26493 parsoid=html2wt
26494 !! html/parsoid
26495 <table><tbody><tr>
26496 <td>foo|bar</td></tr>
26497 <tr><td>x<div>a|b</div></td>
26498 </tbody></table>
26499 !! wikitext
26500 {|
26501 |<nowiki>foo|bar</nowiki>
26502 |-
26503 |x<div><nowiki>a|b</nowiki></div>
26504 |}
26505 !! html/php+tidy
26506 <table>
26507 <tbody><tr>
26508 <td>foo|bar
26509 </td></tr>
26510 <tr>
26511 <td>x<div>a|b</div>
26512 </td></tr></tbody></table>
26513 !! end
26514
26515 !! test
26516 Tables: 2b. Nested in td
26517 !! options
26518 parsoid=html2wt
26519 !! html/parsoid
26520 <table><tbody><tr>
26521 <td>foo||bar</td>
26522 <td>a<i>b||c</i></td>
26523 <td>a<i><div>b||c</div></i></td>
26524 </tr></tbody></table>
26525 !! wikitext
26526 {|
26527 |<nowiki>foo||bar</nowiki>
26528 |a''<nowiki>b||c</nowiki>''
26529 |a''<div><nowiki>b||c</nowiki></div>''
26530 |}
26531 !! html/php
26532 <table>
26533 <tr>
26534 <td>foo||bar
26535 </td>
26536 <td>a<i>b||c</i>
26537 </td>
26538 <td>a<i><div>b||c</div></i>
26539 </td></tr></table>
26540 !! end
26541
26542 !! test
26543 Tables: 2c. Nested in td -- no escaping needed
26544 !! options
26545 parsoid=html2wt
26546 !! html/*
26547 <table>
26548 <tr>
26549 <td>foo!!bar
26550 </td></tr></table>
26551 !! wikitext
26552 {|
26553 |foo!!bar
26554 |}
26555 !! end
26556
26557 !! test
26558 Tables: 3a. Nested in th
26559 !! options
26560 parsoid=html2wt
26561 !! html/*
26562 <table>
26563 <tr>
26564 <th>foo!bar
26565 </th></tr></table>
26566 !! wikitext
26567 {|
26568 !foo!bar
26569 |}
26570 !! end
26571
26572 !! test
26573 Tables: 3b. Nested in th
26574 !! options
26575 parsoid=html2wt
26576 !! html/parsoid
26577 <table><tbody>
26578 <tr><th>foo!!bar</th>
26579 <th><i>foo|bar</i></th>
26580 <th><i>foo!!bar</i></th>
26581 <th><i><span>foo!!bar</span></i></th>
26582 </tr></tbody></table>
26583 !! wikitext
26584 {|
26585 !<nowiki>foo!!bar</nowiki>
26586 !''<nowiki>foo|bar</nowiki>''
26587 !''<nowiki>foo!!bar</nowiki>''
26588 !''<span><nowiki>foo!!bar</nowiki></span>''
26589 |}
26590 !! html/php
26591 <table>
26592 <tr>
26593 <th>foo!!bar
26594 </th>
26595 <th><i>foo|bar</i>
26596 </th>
26597 <th><i>foo!!bar</i>
26598 </th>
26599 <th><i><span>foo!!bar</span></i>
26600 </th></tr></table>
26601 !! end
26602
26603 !! test
26604 Tables: 3c. Nested in th
26605 !! options
26606 parsoid=html2wt
26607 !! html/parsoid
26608 <table><tbody>
26609 <tr><th>foo||bar</th>
26610 <th><span typeof="mw:Nowiki">foo||bar</span></th>
26611 </tr></tbody></table>
26612 !! wikitext
26613 {|
26614 !<nowiki>foo||bar</nowiki>
26615 !<nowiki>foo||bar</nowiki>
26616 |}
26617 !! html/php
26618 <table>
26619 <tr>
26620 <th>foo||bar
26621 </th>
26622 <th>foo||bar
26623 </th></tr></table>
26624 !! end
26625
26626 !! test
26627 Tables: 4a. Escape -
26628 !! options
26629 parsoid=html2wt
26630 !! html/*
26631 <table>
26632 <tr>
26633 <th>-bar
26634 </th></tr>
26635 <tr>
26636 <td>-bar
26637 </td></tr></table>
26638 !! wikitext
26639 {|
26640 !-bar
26641 |-
26642 |<nowiki>-bar</nowiki>
26643 |}
26644 !! end
26645
26646 !! test
26647 Tables: 4b. Escape +
26648 !! options
26649 parsoid=html2wt
26650 !! html/*
26651 <table>
26652 <tr>
26653 <th>+bar
26654 </th></tr>
26655 <tr>
26656 <td>+bar
26657 </td></tr></table>
26658 !! wikitext
26659 {|
26660 !+bar
26661 |-
26662 |<nowiki>+bar</nowiki>
26663 |}
26664 !! end
26665
26666 !! test
26667 Tables: 4c. No escaping needed
26668 !! options
26669 parsoid=html2wt
26670 !! html/parsoid
26671 <table><tbody>
26672 <tr><td>foo-bar</td><td>foo+bar</td></tr>
26673 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
26674 <tr><td>foo
26675 <p>bar|baz
26676 +bar
26677 -bar</p></td></tr>
26678 <tr><td>x
26679 <div>a|b</div></td>
26680 </tbody></table>
26681 !! wikitext
26682 {|
26683 |foo-bar
26684 |foo+bar
26685 |-
26686 |''foo''-bar
26687 |''foo''+bar
26688 |-
26689 |foo
26690 bar|baz
26691 +bar
26692 -bar
26693 |-
26694 |x
26695 <div>a|b</div>
26696 |}
26697 !! html/php
26698 <table>
26699 <tr>
26700 <td>foo-bar
26701 </td>
26702 <td>foo+bar
26703 </td></tr>
26704 <tr>
26705 <td><i>foo</i>-bar
26706 </td>
26707 <td><i>foo</i>+bar
26708 </td></tr>
26709 <tr>
26710 <td>foo
26711 <p>bar|baz
26712 +bar
26713 -bar
26714 </p>
26715 </td></tr>
26716 <tr>
26717 <td>x
26718 <div>a|b</div>
26719 </td></tr></table>
26720 !! end
26721
26722 !! test
26723 Tables: 4d. No escaping needed
26724 !! options
26725 parsoid=html2wt
26726 !! html/parsoid
26727 <table>
26728 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
26729 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
26730 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
26731 </tbody></table>
26732 !! wikitext
26733 {|
26734 |[[Foo]]-bar
26735 ||+1
26736 ||-2
26737 |}
26738 !! html/php
26739 <table>
26740 <tr>
26741 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
26742 </td>
26743 <td>+1
26744 </td>
26745 <td>-2
26746 </td></tr></table>
26747 !! end
26748
26749 !! test
26750 Tables: 4e. Escape }
26751 !! options
26752 parsoid=html2wt
26753 !! html/parsoid
26754 <table>
26755 <tr><td>}</td></tr>
26756 <tr><td>x</td><td data-parsoid='{"stx":"row"}'>}</td></tr></table>
26757 </table>
26758 !! wikitext
26759 {|
26760 |<nowiki>}</nowiki>
26761 |-
26762 |x||}
26763 |}
26764 !! html/php
26765 <table>
26766 <tr>
26767 <td>}
26768 </td></tr>
26769 <tr>
26770 <td>x</td>
26771 <td>}
26772 </td></tr></table>
26773 !! end
26774
26775 !! test
26776 Tables: 5. Empty table cells should get whitespace to avoid need for nowikis
26777 !! options
26778 parsoid=html2wt
26779 !! html/parsoid
26780 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26781
26782 <table><tr><td></td><td align="center"></td><td></td></tr></table>
26783
26784 <table><tr><td></td><td align="center" data-parsoid='{"stx":"row", "startTagSrc":"{{!}}{{!}}"}'></td><td data-parsoid='{"stx":"row"}'></td></tr></table>
26785
26786 <table><tr><th></th><th align="center" data-parsoid='{"stx":"row"}'></th><th data-parsoid='{"stx":"row"}'></th></tr></table>
26787 !! wikitext
26788 {|
26789 | || align="center" | ||
26790 |}
26791
26792 {|
26793 |
26794 | align="center" |
26795 |
26796 |}
26797
26798 {|
26799 | {{!}}{{!}} align="center" | ||
26800 |}
26801
26802 {|
26803 ! !! align="center" | !!
26804 |}
26805 !! html/php+tidy
26806 <table>
26807 <tbody><tr>
26808 <td></td>
26809 <td align="center"></td>
26810 <td>
26811 </td></tr></tbody></table>
26812 <table>
26813 <tbody><tr>
26814 <td>
26815 </td>
26816 <td align="center">
26817 </td>
26818 <td>
26819 </td></tr></tbody></table>
26820 <table>
26821 <tbody><tr>
26822 <td></td>
26823 <td align="center"></td>
26824 <td>
26825 </td></tr></tbody></table>
26826 <table>
26827 <tbody><tr>
26828 <th></th>
26829 <th align="center"></th>
26830 <th>
26831 </th></tr></tbody></table>
26832 !! end
26833
26834 !! test
26835 T97430: Don't emit empty nowiki pairs around marker meta tags
26836 !! options
26837 parsoid=html2wt
26838 !! html/parsoid
26839 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26840 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
26841 !! wikitext
26842 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
26843 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
26844 !! end
26845
26846 !! test
26847 Unclosed xmlish element in table line shouldn't eat end delimiters
26848 !! options
26849 parsoid=html2wt
26850 !! html/parsoid
26851 <table>
26852 <tbody><tr><td> &lt;foo</td>
26853 <td> bar></td></tr>
26854 </tbody></table>
26855 !! wikitext
26856 {|
26857 | <foo
26858 | bar>
26859 |}
26860 !! html/php
26861 <table>
26862 <tr>
26863 <td>&lt;foo
26864 </td>
26865 <td>bar&gt;
26866 </td></tr></table>
26867 !! end
26868
26869 #### --------------- Links ----------------
26870 #### 1. Quote marks in link text
26871 #### 2. Wikilinks: Escapes needed
26872 #### 3. Wikilinks: No escapes needed
26873 #### 4. Extlinks: Escapes needed
26874 #### 5. Extlinks: No escapes needed
26875 #### --------------------------------------
26876 !! test
26877 Links 1. WikiLinks: No escapes needed
26878 !! options
26879 parsoid=html2wt
26880 !! html/parsoid
26881 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
26882 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
26883 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
26884 !! wikitext
26885 [[Foo|Foo''boo'']]
26886 [[Foo|[Foobar]]]
26887 [[Foo|x [Foobar] x]]
26888 !! html/php
26889 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
26890 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
26891 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
26892 </p>
26893 !! end
26894
26895 !! test
26896 Links 2. WikiLinks: Escapes needed
26897 !! options
26898 parsoid=html2wt
26899 !! html/parsoid
26900 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
26901 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
26902 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
26903 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
26904 <a href="Foo" rel="mw:WikiLink">|Bar</a>
26905 <a href="Foo" rel="mw:WikiLink">]]bar</a>
26906 <a href="Foo" rel="mw:WikiLink">[[bar</a>
26907 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
26908 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
26909 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
26910 !! wikitext
26911 [[Foo|<nowiki>Foobar]</nowiki>]]
26912 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
26913 [[Foo|<nowiki>[[Bar]]</nowiki>]]
26914 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
26915 [[Foo||Bar]]
26916 [[Foo|<nowiki>]]bar</nowiki>]]
26917 [[Foo|<nowiki>[[bar</nowiki>]]
26918 [[Foo|<nowiki>x [[ y</nowiki>]]
26919 [[Foo|<nowiki>x ]] y</nowiki>]]
26920 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
26921 !! html/php
26922 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
26923 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
26924 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
26925 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
26926 <a href="/wiki/Foo" title="Foo">|Bar</a>
26927 <a href="/wiki/Foo" title="Foo">]]bar</a>
26928 <a href="/wiki/Foo" title="Foo">[[bar</a>
26929 <a href="/wiki/Foo" title="Foo">x [[ y</a>
26930 <a href="/wiki/Foo" title="Foo">x ]] y</a>
26931 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
26932 </p>
26933 !! end
26934
26935 !! test
26936 Links 3. WikiLinks: No escapes needed
26937 !! options
26938 parsoid=html2wt
26939 !! html/parsoid
26940 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
26941 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
26942 !! wikitext
26943 [[Foo|[Foobar]]
26944 [[Foo|foo|bar]]
26945 !! html/php
26946 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
26947 <a href="/wiki/Foo" title="Foo">foo|bar</a>
26948 </p>
26949 !! end
26950
26951 !! test
26952 Links 4. ExtLinks: Escapes needed
26953 !! options
26954 parsoid=html2wt
26955 !! html/parsoid
26956 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
26957 <a rel="mw:ExtLink" href="http://google.com">google]</a>
26958 <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
26959 <p>[http://google.com]</p>
26960 <p>[http://google.com google]</p>
26961 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
26962 <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>
26963 !! wikitext
26964 [http://google.com <nowiki>[google]</nowiki>]
26965 [http://google.com <nowiki>google]</nowiki>]
26966 [http://google.com <nowiki>goog] le</nowiki>]
26967
26968 <nowiki>[http://google.com]</nowiki>
26969
26970 <nowiki>[http://google.com google]</nowiki>
26971
26972 [http://google.com<nowiki>]</nowiki>
26973
26974 [{{echo|http://google.com}}<nowiki>]</nowiki>
26975 !! html/php
26976 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
26977 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
26978 <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
26979 </p><p>[http://google.com]
26980 </p><p>[http://google.com google]
26981 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26982 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
26983 </p>
26984 !! end
26985
26986 !! test
26987 Links 5. ExtLinks: No escapes needed
26988 !! options
26989 parsoid=html2wt
26990 !! html/parsoid
26991 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
26992 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
26993 !! wikitext
26994 [http://google.com [google]
26995
26996 [[http://google.com]]
26997 !! html/php
26998 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
26999 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
27000 </p>
27001 !! end
27002
27003 !! test
27004 Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
27005 !! options
27006 parsoid=html2wt
27007 !! html/parsoid
27008 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
27009 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
27010 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
27011 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
27012 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
27013 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
27014 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27015 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
27016 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
27017 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
27018 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
27019 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
27020 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
27021 </p>
27022 !! wikitext
27023 x<nowiki/>http://example.com<nowiki/>y
27024 http://example.com<nowiki/>?x
27025 http://example.com<nowiki/>&x
27026 http://example.com<nowiki/>'x
27027 http://example.com<nowiki/>,x
27028 http://example.com<nowiki/>.x
27029 http://example.com<nowiki/>;x
27030 http://example.com<nowiki/>:x
27031 http://example.com<nowiki/>;x
27032 http://example.com<nowiki/>!x
27033 http://example.com<nowiki/>=x
27034 http://example.com<nowiki/>(x)
27035 http://example.com(x<nowiki/>)
27036 !! end
27037
27038 !! test
27039 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27040 !! options
27041 parsoid=html2wt
27042 !! html/parsoid
27043 <p>x
27044 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
27045 y
27046 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
27047 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
27048 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
27049 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
27050 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
27051 </p>
27052 !! wikitext
27053 x
27054 http://example.com
27055 y
27056 "http://example.com"
27057 (http://example.com)
27058 (http://example.com) foo
27059 http://example.com,
27060 http://example.com, foo
27061 !! html/php
27062 <p>x
27063 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
27064 y
27065 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
27066 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
27067 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
27068 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
27069 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
27070 </p>
27071 !! end
27072
27073 !! test
27074 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
27075 !! options
27076 parsoid=html2wt
27077 !! html/parsoid
27078 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
27079 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
27080 !! wikitext
27081 http://example.com.,;:!?\
27082 -http://example.com:
27083 !! html/php
27084 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
27085 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
27086 </p>
27087 !! end
27088
27089 !! test
27090 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
27091 !! options
27092 parsoid=html2wt
27093 !! html/parsoid
27094 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
27095 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
27096 X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
27097 !! wikitext
27098 RFC 123<nowiki/>4
27099 RFC 123<nowiki/>y
27100 X<nowiki/>RFC 123<nowiki/>y
27101 !! end
27102
27103 !! test
27104 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
27105 !! options
27106 parsoid=html2wt
27107 !! html/parsoid
27108 <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
27109 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
27110 -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
27111 </p>
27112 !! wikitext
27113 RFC 123?foo
27114 RFC 123&foo
27115 -RFC 123-
27116 !! html/php
27117 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
27118 <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
27119 -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
27120 </p>
27121 !! end
27122
27123 !! test
27124 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
27125 !! options
27126 parsoid=html2wt
27127 !! html/parsoid
27128 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
27129 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27130 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
27131 !! wikitext
27132 PMID 123<nowiki/>4
27133 PMID 123<nowiki/>y
27134 X<nowiki/>PMID 123<nowiki/>y
27135 !! end
27136
27137 !! test
27138 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
27139 !! options
27140 parsoid=html2wt
27141 !! html/parsoid
27142 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
27143 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
27144 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
27145 </p>
27146 !! wikitext
27147 PMID 123?foo
27148 PMID 123&foo
27149 -PMID 123-
27150 !! html/php
27151 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
27152 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
27153 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
27154 </p>
27155 !! end
27156
27157 !! test
27158 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
27159 !! options
27160 parsoid=html2wt
27161 !! html/parsoid
27162 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
27163 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
27164 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
27165 </p>
27166 !! wikitext
27167 ISBN 1234567890<nowiki/>1
27168 ISBN 1234567890<nowiki/>x
27169 a<nowiki/>ISBN 1234567890<nowiki/>b
27170 !! end
27171
27172 !! test
27173 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
27174 !! options
27175 parsoid=html2wt
27176 !! html/parsoid
27177 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
27178 !! wikitext
27179 -ISBN 1234567890's
27180 !! html/php
27181 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
27182 </p>
27183 !! end
27184
27185 !! test
27186 Links 14. Protect link-like plain text. (Parsoid bug T78425)
27187 !! options
27188 parsoid=html2wt
27189 !! html/*
27190 <p>this is not a link: http://example.com
27191 </p>
27192 !! wikitext
27193 this is not a link: <nowiki>http://example.com</nowiki>
27194 !! end
27195
27196 !! test
27197 Links 15. Link trails can't become link prefixes.
27198 !! options
27199 language=is
27200 parsoid=html2wt
27201 !! html/parsoid
27202 <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>
27203 !! wikitext
27204 [[Söfnuður]]-[[00]]
27205 !! html/php
27206 <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>
27207 </p>
27208 !! end
27209
27210 #### --------------- Quotes ---------------
27211 #### 1. Quotes inside <b> and <i>
27212 #### 2. Link fragments separated by <i> and <b> tags
27213 #### 3. Link fragments inside <i> and <b>
27214 #### 4. No escaping needed
27215 #### --------------------------------------
27216 !! test
27217 1a. Quotes inside <b> and <i>
27218 !! options
27219 parsoid=html2wt
27220 !! html/*
27221 <p><i>'foo'</i>
27222 <i>''foo''</i>
27223 <i>'''foo'''</i>
27224 <i>foo</i>'s
27225 <b>'foo'</b>
27226 <b>''foo''</b>
27227 <b>'''foo'''</b>
27228 <b>foo'<i>bar'</i>baz</b>
27229 <b>foo</b>'s
27230 '<i>foo</i>
27231 <i>foo</i>'
27232 <i>foo'</i>'
27233 '<i>foo</i>'
27234 '<b>foo</b>
27235 <b>foo</b>'
27236 '<b>foo</b>'
27237 <i>fools'<span> errand</span></i>
27238 <i><span>fool</span>'s errand</i>
27239 '<i>foo</i> bar '<i>baz</i>
27240 a|!*#-:;+-~[]{}b'<i>x</i>
27241 </p>
27242 !! wikitext
27243 ''<nowiki/>'foo'''
27244 ''<nowiki>''foo''</nowiki>''
27245 ''<nowiki>'''foo'''</nowiki>''
27246 ''foo''<nowiki/>'s
27247 '''<nowiki/>'foo''''
27248 '''<nowiki>''foo''</nowiki>'''
27249 '''<nowiki>'''foo'''</nowiki>'''
27250 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
27251 '''foo'''<nowiki/>'s
27252 '''foo''
27253 ''foo''<nowiki/>'
27254 ''foo'''<nowiki/>'
27255 '''foo''<nowiki/>'
27256 ''''foo'''
27257 '''foo'''<nowiki/>'
27258 ''''foo'''<nowiki/>'
27259 ''fools'<span> errand</span>''
27260 ''<span>fool</span>'s errand''
27261 '<nowiki/>''foo'' bar '''baz''
27262 a|!*#-:;+-~[]{}b'''x''
27263 !! end
27264
27265 !! test
27266 1b. Quotes inside <b> and <i> with other tags on same line
27267 !! options
27268 parsoid=html2wt
27269 !! html/parsoid
27270 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27271 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
27272 <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>
27273 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
27274 '<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>
27275 '<i>foo</i> <div title="name">test</div>
27276 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
27277 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
27278 <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>
27279 </ol>
27280 !! wikitext
27281 '''a'' foo ''[[bar]]''
27282 ''a''' foo ''[[bar]]''
27283 ''a''' foo '''{{echo|[[bar]]}}'''
27284 [[foo]] x'''[[bar]]''
27285 '''foo'' <ref>test</ref>
27286 '''foo'' <div title="name">test</div>
27287 '''foo'' and <br> bar
27288 <references />
27289 !! end
27290
27291 !! test
27292 2. Link fragments separated by <i> and <b> tags
27293 !! options
27294 parsoid=html2wt
27295 !! html/parsoid
27296 <p>[[<i>foo</i>hello]]</p>
27297 <p>[[<b>foo</b>hello]]</p>
27298 !! wikitext
27299 [[''foo''<nowiki>hello]]</nowiki>
27300
27301 [['''foo'''<nowiki>hello]]</nowiki>
27302 !! end
27303
27304 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
27305 # this is one of the shortcomings of this format
27306 !! test
27307 3. Link fragments inside <i> and <b>
27308 !! options
27309 parsoid=html2wt
27310 !! html/parsoid
27311 <p><i>[[foo</i>]]</p>
27312 <p><b>[[foo</b>]]</p>
27313 !! wikitext
27314 ''[[foo''<nowiki>]]</nowiki>
27315
27316 '''[[foo'''<nowiki>]]</nowiki>
27317 !! end
27318
27319 !! test
27320 4. No escaping needed
27321 !! options
27322 parsoid=html2wt
27323 !! html/parsoid
27324 <p>'<span><i>bar</i></span>'
27325 '<span><b>bar</b></span>'
27326 'a:b'foo
27327 </p>
27328 !! wikitext
27329 '<span>''bar''</span>'
27330 '<span>'''bar'''</span>'
27331 'a:b'foo
27332 !! end
27333
27334 #### ----------- Paragraphs ---------------
27335 #### 1. No unnecessary escapes
27336 #### --------------------------------------
27337
27338 !! test
27339 1. No unnecessary escapes
27340 !! options
27341 parsoid=html2wt
27342 !! html/parsoid
27343 <p>bar <span>[[foo]]</span>
27344 </p><p>=bar <span>[[foo]]</span>
27345 </p><p>[[bar <span>[[foo]]</span>
27346 </p><p>]]bar <span>[[foo]]</span>
27347 </p><p>=bar <span>foo]]</span>=
27348 </p>
27349 !! wikitext
27350 bar <span><nowiki>[[foo]]</nowiki></span>
27351
27352 =bar <span><nowiki>[[foo]]</nowiki></span>
27353
27354 [[bar <span><nowiki>[[foo]]</nowiki></span>
27355
27356 ]]bar <span><nowiki>[[foo]]</nowiki></span>
27357
27358 =bar <span>foo]]</span><nowiki>=</nowiki>
27359 !!end
27360
27361 #### ----------------------- PRE --------------------------
27362 !! test
27363 1. Leading whitespace in SOL context should be escaped
27364 !! options
27365 parsoid=html2wt
27366 !! html/parsoid
27367 <p> a</p>
27368
27369 <p> a</p>
27370
27371 <p> a(tab)</p>
27372
27373 <p> a
27374 <!--cmt-->
27375 a</p>
27376
27377 <p>a
27378 b</p>
27379
27380 <p>a
27381 b</p>
27382
27383 <p>a
27384 b</p>
27385 !! wikitext
27386 <nowiki> </nowiki>a
27387
27388 <nowiki> </nowiki> a
27389
27390 a(tab)
27391
27392 <nowiki> </nowiki> a
27393 <!--cmt-->
27394 <nowiki> </nowiki>a
27395
27396 a
27397 <nowiki> </nowiki>b
27398
27399 a
27400 b
27401
27402 a
27403 b
27404 !! html/php
27405 <p> a
27406 </p><p> a
27407 </p><p> a(tab)
27408 </p><p> a
27409 a
27410 </p><p>a
27411 b
27412 </p><p>a
27413 b
27414 </p><p>a
27415 b
27416 </p>
27417 !! end
27418
27419 !! test
27420 2. Leading whitespace in non-indent-pre contexts should not be escaped
27421 !! options
27422 parsoid=html2wt
27423 !! html/parsoid
27424 <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>
27425 <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
27426 <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>
27427 b</span></li>
27428 </ol>
27429 !! wikitext
27430 foo <ref>''a''
27431 b</ref>
27432 <references />
27433 !! end
27434
27435 !! test
27436 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
27437 !! options
27438 parsoid=html2wt
27439 !! html/parsoid
27440 <blockquote>
27441 <p>
27442 a
27443 <span>b</span>
27444 c</p>
27445 </blockquote>
27446 !! wikitext
27447 <blockquote>
27448 a
27449 <span>b</span>
27450 c
27451 </blockquote>
27452 !! end
27453
27454 !! test
27455 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
27456 !! options
27457 parsoid=html2wt
27458 !! html/parsoid
27459 <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>
27460 !! wikitext
27461 [[File:Foobar.jpg|thumb|caption]]
27462 !! end
27463
27464 !! test
27465 5. Nowiki escaping should account for indent-pres
27466 !! options
27467 parsoid=html2wt
27468 !! html/parsoid
27469 <pre>==foo==</pre>
27470 !! wikitext
27471 ==foo==
27472 !! end
27473
27474 !! test
27475 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
27476 !! options
27477 parsoid=html2wt
27478 !! html/parsoid
27479 <pre>
27480 * foo
27481 * bar
27482 </pre>
27483 !! wikitext
27484 * foo
27485 * bar
27486 !! end
27487
27488 !! test
27489 Whitespace scrubbing in SOL position should account for SOL-sensitive wikitext markup
27490 !! options
27491 parsoid = {
27492 "modes": ["html2wt"],
27493 "scrubWikitext": true
27494 }
27495 !! html/parsoid
27496 <p> foo</p>
27497 <p> %foo</p>
27498 <p> *foo</p>
27499 <p> #foo</p>
27500 <p> =foo=</p>
27501 <p><link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}"> *foo</p>
27502 <p> <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid="{}">*foo</p>
27503 <p> <!--boo-->*foo</p>
27504 <p><!--boo--> *foo</p>
27505 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> foo</p>
27506 <p><!--a--> <!--b--> <!--c--> <!--d--> <!--e--> *foo</p>
27507 !! wikitext
27508 foo
27509
27510 %foo
27511
27512 <nowiki/>*foo
27513
27514 <nowiki/>#foo
27515
27516 <nowiki/>=foo=
27517
27518 [[Category:Foo]]
27519 <nowiki/>*foo
27520
27521 [[Category:Foo]]
27522 <nowiki>*</nowiki>foo
27523
27524 <nowiki/><!--boo-->*foo
27525
27526 <!--boo--><nowiki/>*foo
27527
27528 <!--a--><!--b--><!--c--><!--d--><!--e-->foo
27529
27530 <!--a--><nowiki/><!--b--><!--c--><!--d--><!--e-->*foo
27531 !! end
27532
27533 #### --------------- Behavior Switches --------------------
27534
27535 !! test
27536 1. Valid behavior switches should be escaped
27537 !! options
27538 parsoid=html2wt
27539 !! html/parsoid
27540 __TOC__
27541 <i>__TOC__</i>
27542 !! wikitext
27543 <nowiki>__TOC__</nowiki>
27544 ''<nowiki>__TOC__</nowiki>''
27545 !! end
27546
27547 !! test
27548 2. Invalid behavior switches should not be escaped
27549 !! options
27550 parsoid=html2wt
27551 !! html/parsoid
27552 __TOO__
27553 __|__
27554 !! wikitext
27555 __TOO__
27556 __|__
27557 !! end
27558
27559 # We use indent-pre as an indirect way to test for sol-transparent behavior.
27560 !! test
27561 Behavior switches should be SOL-transparent
27562 !! options
27563 parsoid=html2wt
27564 !! html/parsoid
27565 <meta property="mw:PageProp/toc" />
27566
27567 <!-- this one's bogus -->
27568 <pre>__TOO__</pre>
27569
27570 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
27571
27572 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
27573 !! wikitext
27574 __TOC__
27575
27576 <!-- this one's bogus -->
27577 __TOO__
27578
27579 __TOC__ foo
27580
27581 __TOC__
27582 bar
27583 !! end
27584
27585 #### --------------- HTML tags ---------------
27586 #### 1. a tags
27587 #### 2. other tags
27588 #### 3. multi-line html tag
27589 #### 4. extension tags
27590 #### -----------------------------------------
27591 !! test
27592 1. a tags
27593 !! options
27594 parsoid=html2wt
27595 !! html/parsoid
27596 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
27597 !! wikitext
27598 <a href="http://google.com">google</a>
27599 !! end
27600
27601 !! test
27602 2. other tags
27603 !! options
27604 parsoid=html2wt
27605 !! html/parsoid
27606 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
27607 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
27608 <li> &lt;td&gt;</li></ul>
27609
27610 !! wikitext
27611 * <nowiki><div>foo</div></nowiki>
27612 * <nowiki><div style="color:red">foo</div></nowiki>
27613 * <nowiki><td></nowiki>
27614 !! end
27615
27616 !! test
27617 3. multi-line html tag
27618 !! options
27619 parsoid=html2wt
27620 !! html/parsoid
27621 <p>&lt;div
27622 &gt;foo&lt;/div
27623 &gt;
27624 </p>
27625 !! wikitext
27626 <nowiki><div
27627 >foo</div
27628 ></nowiki>
27629 !! end
27630
27631 !! test
27632 4. extension tags
27633 !! options
27634 parsoid=html2wt
27635 !! html/parsoid
27636 <p>&lt;ref&gt;foo&lt;/ref&gt;
27637 </p><p>&lt;ref&gt;bar
27638 </p><p>baz&lt;/ref&gt;
27639 </p>
27640 !! wikitext
27641 <nowiki><ref>foo</ref></nowiki>
27642
27643 <nowiki><ref>bar</nowiki>
27644
27645 baz<nowiki></ref></nowiki>
27646 !! end
27647
27648 !! test
27649 Parsoid: newline inducing block nodes don't suppress <nowiki>
27650 !! options
27651 parsoid=html2wt
27652 !! html/parsoid
27653 a<h1>foo</h1>
27654 !! wikitext
27655 <nowiki> </nowiki>a
27656
27657 = foo =
27658 !! end
27659
27660 #### --------------- Others ---------------
27661 !! test
27662 Escaping nowikis
27663 !! options
27664 parsoid=html2wt
27665 !! html/parsoid
27666 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
27667 </p>
27668 !! wikitext
27669 &lt;nowiki&gt;foo&lt;/nowiki&gt;
27670 !! end
27671
27672 ## The quote-char in the input is necessary for triggering the bug
27673 !! test
27674 (T54035) Nowiki-escaping should not get tripped by " :" in text
27675 !! options
27676 parsoid=html2wt
27677 !! html/parsoid
27678 <p>foo's bar :</p>
27679 !! wikitext
27680 foo's bar :
27681 !! end
27682
27683 #----------- End of wikitext escaping tests --------------
27684
27685 !! test
27686
27687 Tag-like HTML structures are passed through as text
27688 !! wikitext
27689 <x y>
27690
27691 <x.y>
27692
27693 <x-y>
27694
27695 1>2
27696
27697 x<y
27698
27699 a>b
27700
27701 1<d e>f
27702 !! html
27703 <p>&lt;x y&gt;
27704 </p><p>&lt;x.y&gt;
27705 </p><p>&lt;x-y&gt;
27706 </p><p>1&gt;2
27707 </p><p>x&lt;y
27708 </p><p>a&gt;b
27709 </p><p>1&lt;d e&gt;f
27710 </p>
27711 !! end
27712
27713 !! test
27714 HTML tag with necessary entities in attributes
27715 !! wikitext
27716 <span title="&amp;amp;">foo</span>
27717 !! html
27718 <p><span title="&amp;amp;">foo</span>
27719 </p>
27720 !! end
27721
27722 !! test
27723 HTML tag with 'unnecessary' entity encoding in attributes
27724 !! wikitext
27725 <span title="&amp;">foo</span>
27726 !! html
27727 <p><span title="&amp;">foo</span>
27728 </p>
27729 !! end
27730
27731 !! test
27732 HTML tag with broken attribute value quoting
27733 !! options
27734 parsoid=wt2html,html2html
27735 !! wikitext
27736 <span title="Hello world>Foo</span>
27737 !! html/php
27738 <p><span title="Hello world">Foo</span>
27739 </p>
27740 !! html/parsoid
27741 <p><span title="Hello world">Foo</span></p>
27742 !! end
27743
27744 !! test
27745 Self-closed tag with broken attribute value quoting
27746 !! options
27747 parsoid=wt2html,html2html
27748 !! wikitext
27749 <div title="Hello world />Foo
27750 !! html/php+tidy
27751 <div title="Hello world"></div><p>Foo</p>
27752 !! html/parsoid
27753 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
27754 !! end
27755
27756 !! test
27757 Table with broken attribute value quoting
27758 !! options
27759 parsoid=wt2html,html2html
27760 !! wikitext
27761 {|
27762 | title="Hello world|Foo
27763 |}
27764 !! html/php
27765 <table>
27766 <tr>
27767 <td title="Hello world">Foo
27768 </td></tr></table>
27769 !! html/parsoid
27770 <table>
27771 <tr>
27772 <td title="Hello world">Foo
27773 </td></tr></table>
27774 !! end
27775
27776 !! test
27777 Table with broken attribute value quoting on consecutive lines
27778 !! options
27779 parsoid=wt2html,html2html
27780 !! wikitext
27781 {|
27782 | title="Hello world|Foo
27783 | style="color:red|Bar
27784 |}
27785 !! html/php
27786 <table>
27787 <tr>
27788 <td title="Hello world">Foo
27789 </td>
27790 <td style="color:red">Bar
27791 </td></tr></table>
27792 !! html/parsoid
27793 <table><tbody>
27794 <tr>
27795 <td title="Hello world">Foo
27796 </td><td style="color: red">Bar
27797 </td></tr></tbody></table>
27798 !! end
27799
27800 !!test
27801 Accept empty td cell attribute
27802 !! wikitext
27803 {|
27804 | align="center" |foo|| |
27805 |}
27806 !! html
27807 <table>
27808 <tr>
27809 <td align="center">foo</td>
27810 <td>
27811 </td></tr></table>
27812 !! end
27813
27814 !!test
27815 Non-empty attributes in th-cells
27816 !! wikitext
27817 {|
27818 !Foo!! style="color: red" |Bar
27819 |}
27820 !! html
27821 <table>
27822 <tr>
27823 <th>Foo</th>
27824 <th style="color: red">Bar
27825 </th></tr></table>
27826 !! end
27827
27828 !!test
27829 Accept empty attributes in th-cells
27830 !! wikitext
27831 {|
27832 !|foo!!|bar
27833 |}
27834 !! html
27835 <table>
27836 <tr>
27837 <th>foo</th>
27838 <th>bar
27839 </th></tr></table>
27840 !! end
27841
27842 !!test
27843 Empty table rows go away
27844 !! wikitext
27845 {|
27846 |Hello
27847 |there
27848 |- class="foo"
27849 |-
27850 |}
27851 !! html
27852 <table>
27853 <tr>
27854 <td>Hello
27855 </td>
27856 <td>there
27857 </td></tr>
27858
27859 </table>
27860 !! end
27861
27862 ###
27863 ### Parsoid-centric tests for testing RTing of inter-element separators
27864 ### Edge cases not tested by existing parser tests and specific to
27865 ### Parsoid-specific serialization strategies.
27866 ###
27867
27868 !!test
27869 RT-ed inter-element separators should be valid separators
27870 !! wikitext
27871 {|
27872 |- [[foo]]
27873 |}
27874 !! html/php
27875 <table>
27876
27877 </table>
27878 !! html/parsoid
27879 <table>
27880 <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
27881 </tbody></table>
27882 !!end
27883
27884 # Parsoid-only test of a DOM pass
27885 !!test
27886 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
27887 !! wikitext
27888 {|
27889 |<small>foo
27890 bar
27891 |}
27892
27893 {|
27894 |<small>foo<small>
27895 |}
27896 !! html/parsoid
27897 <table>
27898 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
27899 <p>bar</p></small></td></tr>
27900 </tbody></table>
27901
27902 <table>
27903 <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>
27904 </tbody></table>
27905 !!end
27906
27907 # Note that the "style" attribute is really a template parameter here.
27908 # The = would have to be {{=}} if you wanted the literal.
27909 !!test
27910 Empty TD followed by TD with tpl-generated attribute
27911 !! wikitext
27912 {|
27913 |-
27914 |
27915 |{{echo|style='color:red'}}|foo
27916 |}
27917 !! html
27918 <table>
27919
27920 <tr>
27921 <td>
27922 </td>
27923 <td>foo
27924 </td></tr></table>
27925 !! end
27926
27927 !!test
27928 Indented table with an empty td
27929 !! wikitext
27930 {|
27931 |-
27932 |
27933 |foo
27934 |}
27935 !! html
27936 <table>
27937
27938 <tr>
27939 <td>
27940 </td>
27941 <td>foo
27942 </td></tr></table>
27943 !! end
27944
27945 !! test
27946 Indented table with blank lines in between (T85627)
27947 !! wikitext
27948 {|
27949 |foo
27950
27951
27952 |}
27953 !! html/php
27954 <table>
27955 <tr>
27956 <td>foo
27957 <p><br />
27958 </p>
27959 </td></tr></table>
27960 !! html/parsoid
27961 <table>
27962 <tbody><tr><td>foo
27963 <p>
27964 <br /></p></td></tr>
27965 </tbody></table>
27966 !! end
27967
27968 !!test
27969 Indented block & table
27970 !! wikitext
27971 <div>foo</div>
27972 {|
27973 |foo
27974 |}
27975 !! html/php
27976 <div>foo</div>
27977 <table>
27978 <tr>
27979 <td>foo
27980 </td></tr></table>
27981 !! html/parsoid
27982 <div data-parsoid='{"stx":"html"}'>foo</div>
27983 <table><tbody>
27984 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
27985 </tbody></table>
27986 !!end
27987
27988 !! test
27989 Indent and comment before table row
27990 !! wikitext
27991 {|
27992 <!--hi-->|-
27993 |there
27994 |}
27995 !! html/php
27996 <table>
27997
27998 <tr>
27999 <td>there
28000 </td></tr></table>
28001 !! html/parsoid
28002 <table>
28003 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
28004 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
28005 </tbody></table>
28006 !! end
28007
28008 # PHP parser omits empty TR
28009 !!test
28010 Empty TR followed by a template-generated TR
28011 !! wikitext
28012 {|
28013 |-
28014 {{echo|<tr><td>foo</td></tr>}}
28015 |}
28016 !! html/php+tidy
28017 <table>
28018
28019 <tbody><tr><td>foo</td></tr>
28020 </tbody></table>
28021 !! html/parsoid
28022 <table>
28023 <tbody>
28024 <tr class='mw-empty-elt'></tr>
28025 <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}}]}'>
28026 <td>foo</td></tr>
28027 </tbody></table>
28028 !!end
28029
28030 ## PHP and parsoid output differ for this; as usual PHP omits empty
28031 ## elements, and since it strips the comments the TR is empty.
28032 !!test
28033 Empty TR followed by mixed-ws-comment line should RT correctly
28034 !! wikitext
28035 {|
28036 |-
28037 <!--c-->
28038 |-
28039 <!--c--> <!--d-->
28040 |}
28041 !! html/php+tidy
28042 <table>
28043
28044
28045 </table>
28046 !! html/parsoid
28047 <table>
28048 <tbody>
28049 <tr class='mw-empty-elt'></tr>
28050 <!--c-->
28051 <tr>
28052 <!--c--> </tr><!--d-->
28053 </tbody></table>
28054 !! end
28055
28056 !!test
28057 Multi-line image caption generated by templates with/without trailing newlines
28058 !! wikitext
28059 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
28060 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
28061 !! html/parsoid
28062 <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>
28063 <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>
28064 !!end
28065
28066 !! test
28067 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
28068 !! options
28069 parsoid=html2wt
28070 !! html/parsoid
28071 <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>
28072
28073 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
28074 !! wikitext
28075 <includeonly>foo</includeonly>
28076 new para
28077
28078 [[Category:Foo]]
28079
28080 = new heading =
28081 !! end
28082
28083 ## PHP emits broken html for this, and since this is primarily
28084 ## a Parsoid serializer test, marking this Parsoid only
28085 !!test
28086 Improperly nested inline or quotes tags with whitespace in between
28087 !! wikitext
28088 <span> <s>x</span> </s>
28089 ''' ''x''' ''
28090 !! html/parsoid
28091 <p><span> <s>x</s></span><s> </s>
28092 <b> <i>x</i></b><i> </i>
28093 </p>
28094 !!end
28095
28096 !!test
28097 Encapsulate protected attributes from wt
28098 !! wikitext
28099 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
28100
28101 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
28102 |ok
28103 |}
28104 !! html/parsoid
28105 <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>
28106
28107 <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">
28108 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'>ok</td></tr>
28109 </tbody></table>
28110 !!end
28111
28112 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
28113 ## Having nested or stray pre tags results in the attempt to add duplicates,
28114 ## causing an assertion fail. This test tries to prevent that situation.
28115 !! test
28116 Ensure ParagraphWrapper can deal with stray closing pre tags
28117 !! options
28118 parsoid=wt2html
28119 !! wikitext
28120 plain text</pre>
28121 !! html/parsoid
28122 <p>plain text</p>
28123 !! end
28124
28125 ## Remex doesn't account for fostered content.
28126 !! test
28127 1. Ensure fostered text content is wrapped in element nodes
28128 !! options
28129 parsoid=wt2html
28130 !! wikitext
28131 <table>hi</table><table>ho</table>
28132 !! html/php+tidy
28133 hi<table></table>ho<table></table>
28134 !! html/parsoid
28135 <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>
28136 !! end
28137
28138 ## Remex doesn't account for fostered content.
28139 !! test
28140 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
28141 !! options
28142 parsoid=wt2html,wt2wt
28143 !! wikitext
28144 <table>
28145 <tr> || ||
28146 <td> a
28147 </table>
28148 !! html/php+tidy
28149 || ||
28150 <table>
28151 <tbody><tr><td> a
28152 </td></tr></tbody></table>
28153 !! html/parsoid
28154 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true}'> || ||</p>
28155 <table data-parsoid='{"stx":"html"}'>
28156 <tbody><tr data-parsoid='{"stx":"html","autoInsertedEnd":true}'><td data-parsoid='{"stx":"html","autoInsertedEnd":true}'> a
28157 </td></tr></tbody></table>
28158 !! end
28159
28160 ## Remex doesn't account for fostered content.
28161 !! test
28162 Encapsulation properly handles null DSR information from foster box
28163 !! options
28164 parsoid=wt2html,wt2wt
28165 !! wikitext
28166 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
28167 !! html/parsoid
28168 <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>
28169 !! end
28170
28171 ## Remex doesn't account for fostered content.
28172 !! test
28173 1. Encapsulate foster-parented transclusion content
28174 !! options
28175 parsoid=wt2wt,wt2html
28176 !! wikitext
28177 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
28178 !! html/php+tidy
28179 foo<table><tbody><tr><td>bar</td></tr></tbody></table>
28180 !! html/parsoid
28181 <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>
28182 !! end
28183
28184 !! test
28185 2. Encapsulate foster-parented transclusion content
28186 !! options
28187 parsoid=wt2wt,wt2html
28188 !! wikitext
28189 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
28190 !! html/parsoid
28191 <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>
28192 <table>
28193 <tbody>
28194 <tr>
28195 <td>bar</td>
28196 </tr>
28197 </tbody>
28198 </table>
28199 !! end
28200
28201 !! test
28202 3. Encapsulate foster-parented transclusion content
28203 !! options
28204 parsoid=wt2wt,wt2html
28205 !! wikitext
28206 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28207 !! html/parsoid
28208 <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;]}">
28209 <p>foo</p>
28210 </div>
28211 <table>
28212 <tbody>
28213 <tr>
28214 <td>bar</td>
28215 </tr>
28216 </tbody>
28217 </table>
28218 !! end
28219
28220 !! test
28221 4. Encapsulate foster-parented transclusion content
28222 !! options
28223 parsoid=wt2wt,wt2html
28224 !! wikitext
28225 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
28226 !! html/parsoid
28227 <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;]}">
28228 <p>foo</p>
28229 </div>
28230 <table>
28231 <tbody>
28232 <tr>
28233 <td>bar</td>
28234 </tr>
28235 </tbody>
28236 </table>
28237 !! end
28238
28239 ## Remex doesn't account for fostered content.
28240 !! test
28241 5. Encapsulate foster-parented transclusion content
28242 !!options
28243 parsoid=wt2wt,wt2html
28244 !! wikitext
28245 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
28246 !! html/php+tidy
28247 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table>
28248 !! html/parsoid
28249 <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>
28250 !! end
28251
28252 ## Remex doesn't account for fostered content.
28253 !! test
28254 6. Encapsulate foster-parented transclusion content
28255 !! options
28256 parsoid=wt2wt,wt2html
28257 !! wikitext
28258 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
28259 !! html/php+tidy
28260 foo<table><tbody><tr><td><div><p>foo</p></div></td></tr></tbody></table><p>ok</p>
28261 !! html/parsoid
28262 <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>
28263 !! end
28264
28265 !! test
28266 7. Encapsulate foster-parented transclusion content
28267 !!options
28268 parsoid=wt2wt,wt2html
28269 !! wikitext
28270 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
28271 !! html/parsoid
28272 <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>
28273 <table>
28274 <tbody>
28275 <tr>
28276 <td>bar</td>
28277 </tr>
28278 </tbody>
28279 </table>
28280 !! end
28281
28282 ## Remex doesn't account for fostered content.
28283 # Note that the wt is broken on purpose: the = should be {{=}} if you
28284 # don't want it to be a template parameter key.
28285 !! test
28286 8. Encapsulate foster-parented transclusion content
28287 !! options
28288 parsoid=wt2wt,wt2html
28289 !! wikitext
28290 {{echo|a
28291 }}{|{{echo|style='color:red'}}
28292 |-
28293 |b
28294 |}
28295 !! html/php+tidy
28296 <p>a
28297 </p>
28298 <table>
28299
28300 <tbody><tr>
28301 <td>b
28302 </td></tr></tbody></table>
28303 !! html/parsoid
28304 <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">
28305 </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">
28306 <tbody><tr>
28307 <td>b
28308 </td></tr></tbody></table>
28309 !! end
28310
28311 ## Remex doesn't account for fostered content.
28312 !! test
28313 9. Encapsulate foster-parented transclusion content
28314 !!options
28315 parsoid=wt2wt,wt2html
28316 !! wikitext
28317 <table>{{echo|hi</table>hello}}
28318 !! html/php+tidy
28319 hi<table></table><p>hello</p>
28320 !! html/parsoid
28321 <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>
28322 !! end
28323
28324 !! test
28325 Table in fosterable position
28326 !!options
28327 parsoid=wt2html
28328 !! wikitext
28329 {{OpenTable}}
28330 <div>
28331 {|
28332 |}
28333 </div>
28334 |}
28335 !! html/parsoid
28336 <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">
28337 </span>
28338 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
28339
28340 <table>
28341 </table>
28342 !! end
28343
28344 # Parsoid only for T66747
28345 # (Also core doesn't define {{#if}} in default install)
28346 !! test
28347 Properly encapsulate empty-content transclusions in fosterable positions
28348 !! wikitext
28349 <table>
28350 {{#if:|
28351 <td>foo</td>
28352 }}
28353 </table>
28354 !! html/parsoid
28355 <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"}]]}'>
28356
28357 </table>
28358 !! end
28359
28360 ## No longer captures its original intention
28361 !! test
28362 Always encapsulate foster box when template range is expanded to table
28363 !! options
28364 disabled
28365 parsoid=wt2wt
28366 !! wikitext
28367 {|
28368 hello
28369 {{OpenTable}}
28370 |}
28371 !! html/parsoid
28372 !! end
28373
28374 !! test
28375 T115289: Unclosed table
28376 !! wikitext
28377 {{echo|<table>}}<!--c-->[[Category:Two]]
28378 !! html/parsoid
28379 <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>
28380 !! end
28381
28382 !! test
28383 T115289: Don't migrate newlines out of tables with fostered content
28384 !! wikitext
28385 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
28386 !! html/parsoid
28387 <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>
28388 !! end
28389
28390 !! test
28391 T73074: More fostering fun
28392 !! wikitext
28393 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
28394 !! html/parsoid
28395 <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>
28396 !! end
28397
28398 !!test
28399 Support <object> element with .data attribute
28400 !!options
28401 parsoid=html2wt
28402 !! html/parsoid
28403 <object data="test.swf"></object>
28404 !! wikitext
28405 <object data="test.swf"></object>
28406 !!end
28407
28408 !! test
28409 Don't block XML namespace declaration
28410 !! wikitext
28411 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28412 !! html/php
28413 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
28414 </p>
28415 !! html/parsoid
28416 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
28417 !! end
28418
28419 # -----------------------------------------------------------------
28420 # The following section of tests are primarily to spec requirements
28421 # around Parsoid's serialization (old, new, edited content)
28422 #
28423 # All these tests are marked Parsoid html2wt and html2html only
28424 # ----------------------------------------------------------------
28425
28426 !! test
28427 Ignore rel attribute in a-tags during serialization to url-links
28428 !! options
28429 parsoid=html2wt
28430 !! html/parsoid
28431 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
28432 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
28433 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
28434 !! wikitext
28435 http://en.wikipedia.org/wiki/Foobar
28436 http://en.wikipedia.org/wiki/Foobar
28437 http://en.wikipedia.org/wiki/Foobar
28438 !! end
28439
28440 # 'mi' is a localinterwiki prefix as well as a language
28441 !! test
28442 Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
28443 !! options
28444 parsoid=html2wt
28445 !! html/parsoid
28446 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
28447 !! wikitext
28448 [[Foo]]
28449 !! end
28450
28451 !! test
28452 Parsoid should accept interwiki shortcuts
28453 !! options
28454 parsoid=html2wt
28455 !! html/parsoid
28456 <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
28457 <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
28458 <a href='./fr:Foo'>Foo</a></p>
28459 <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
28460 <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
28461 <a href='fr%3AFoo'>Foo</a></p>
28462 <p><a href='FR%3AFoo'>Foo</a>
28463 <a href='./FR:Foo'>Foo</a></p>
28464 !! wikitext
28465 [[:fr:Foo|Foo]]
28466 [[:fr:Foo|Foo]]
28467 [[:fr:Foo|Foo]]
28468
28469 [[:fr:Foo|Foo]]
28470 [[:fr:Foo|Foo]]
28471 [[:fr:Foo|Foo]]
28472
28473 [[:fr:Foo|Foo]]
28474 [[:fr:Foo|Foo]]
28475 !! end
28476
28477 !! test
28478 Parsoid should not accept invalid interwiki shortcuts
28479 !! options
28480 parsoid=html2wt
28481 !! html/parsoid
28482 <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
28483 <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
28484 <a href='news:Foo'>Foo</a></p>
28485 !! wikitext
28486 [news:Foo Foo]
28487 [news:Foo Foo]
28488 [news:Foo Foo]
28489 !! end
28490
28491 # See T93839
28492 !! test
28493 New wikilinks should be serialized properly
28494 !! options
28495 parsoid=html2wt
28496 !! html/parsoid
28497 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
28498 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
28499 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
28500 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
28501 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
28502 !! wikitext
28503 [[Foo]]
28504 [[Foo]]
28505 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
28506 http://en.wikipedia.org/wiki/Foo
28507 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
28508 !! end
28509
28510 !! test
28511 New wiki links (href variations)
28512 !! options
28513 parsoid=html2wt
28514 !! html/parsoid
28515 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28516 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
28517 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
28518 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
28519 !! wikitext
28520 [[Foo_bar]]
28521 [[Foo_bar]]
28522 [[Foo_bar]]
28523 [[Toxine bactérienne]]
28524 !! end
28525
28526 !! test
28527 New wiki links (content string variations)
28528 !! options
28529 parsoid=html2wt
28530 !! html/parsoid
28531 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
28532 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
28533 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
28534 !! wikitext
28535 [[Foo_bar]]
28536 [[Foo bar]]
28537 [[Foo_bar|./Foo_bar]]
28538 !! end
28539
28540 !! test
28541 New category links (href variations)
28542 !! options
28543 parsoid=html2wt
28544 !! html/parsoid
28545 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
28546 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
28547 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
28548 !! wikitext
28549 [[Category:Toxine bactérienne]]
28550 [[Category:Toxine bactérienne]]
28551 [[Category:Toxine bactérienne]]
28552 !! end
28553
28554 !! test
28555 New sol transparent links don't need indent-pre nowiki protection
28556 !! options
28557 parsoid=html2wt
28558 language=de
28559 !! html/parsoid
28560 <link rel="mw:PageProp/redirect" href="./Main_Page">
28561 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
28562 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
28563 !! wikitext
28564 #WEITERLEITUNG [[Main Page]]
28565 <!-- this is good --> [[Category:Good]]
28566 <!-- this is great --> [[Kategorie:Great]]
28567 !! end
28568
28569 !! test
28570 New interlanguage links (href variations)
28571 !! options
28572 parsoid=html2wt
28573 !! html/parsoid
28574 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
28575 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
28576 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
28577 !! wikitext
28578 [[es:Toxine bactérienne]]
28579 [[es:Toxine_bactérienne]]
28580 [[es:Toxine_bactérienne]]
28581 !! end
28582
28583 !! test
28584 Image: Modifying size of an image (1)
28585 !! options
28586 parsoid={
28587 "modes": ["wt2wt"],
28588 "changes": [
28589 ["img[height]", "attr", "height", "22"],
28590 ["img[width]", "attr", "width", "200"]
28591 ]
28592 }
28593 !! wikitext
28594 [[Image:Foobar.jpg|230x230px]]
28595 !! wikitext/edited
28596 [[Image:Foobar.jpg|200x200px]]
28597 !!end
28598
28599 !! test
28600 Image: Modifying size of an image (2)
28601 !! options
28602 parsoid={
28603 "modes": ["wt2wt"],
28604 "changes": [
28605 ["img[height]", "attr", "height", "100"],
28606 ["img[width]", "attr", "width", "500"]
28607 ]
28608 }
28609 !! wikitext
28610 [[Image:Foobar.jpg|230x230px]]
28611 !! wikitext/edited
28612 [[Image:Foobar.jpg|500x500px]]
28613 !!end
28614
28615 # Change in size is ignored so long as class='mw-default-size'
28616 !! test
28617 Image: Modifying size of an image (3)
28618 !! options
28619 parsoid={
28620 "modes": ["wt2wt"],
28621 "changes": [
28622 ["figure[class]", "removeClass", "mw-default-size"],
28623 ["figure img", "attr", "height", "19"],
28624 ["figure img", "attr", "width", "170"]
28625 ]
28626 }
28627 !! wikitext
28628 [[Image:Foobar.jpg|thumb]]
28629 !! wikitext/edited
28630 [[Image:Foobar.jpg|thumb|170x170px]]
28631 !!end
28632
28633 !! test
28634 Image: Modifying alignment of an image (T50665)
28635 !! options
28636 parsoid={
28637 "modes": ["wt2wt"],
28638 "changes": [
28639 ["figure[class]", "removeClass", "mw-halign-right"],
28640 ["figure[class]", "addClass", "mw-halign-left"]
28641 ]
28642 }
28643 !! wikitext
28644 [[Image:Foobar.jpg|thumb|caption|right]]
28645 !! wikitext/edited
28646 [[Image:Foobar.jpg|thumb|caption|left]]
28647 !! end
28648
28649 !! test
28650 Image: Modifying mw-default-size of an frameless image (T64805)
28651 !! options
28652 parsoid={
28653 "modes": ["wt2wt"],
28654 "changes": [
28655 ["figure.mw-default-size", "removeClass", "mw-default-size"]
28656 ]
28657 }
28658 !! wikitext
28659 [[Image:Foobar.jpg|frameless|right]]
28660 !! wikitext/edited
28661 [[Image:Foobar.jpg|frameless|right|220x220px]]
28662 !! end
28663
28664 !! test
28665 Image: Modifying valign of an image (T51221)
28666 !! options
28667 parsoid={
28668 "modes": ["wt2wt"],
28669 "changes": [
28670 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
28671 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
28672 ]
28673 }
28674 !! wikitext
28675 [[File:Foobar.jpg|20px|middle]]
28676 !! wikitext/edited
28677 [[File:Foobar.jpg|20px|text-top]]
28678 !! end
28679
28680 !! test
28681 Image: Modifying alt attribute of an image (T58400)
28682 !! options
28683 disabled
28684 parsoid={
28685 "modes": ["wt2wt"],
28686 "changes": [
28687 ["img[alt]", "attr", "alt", "some alternate edited text"]
28688 ]
28689 }
28690 !! wikitext
28691 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
28692 !! wikitext/edited
28693 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
28694 !!end
28695
28696 !! test
28697 Image: Modifying caption of an image
28698 !! options
28699 parsoid={
28700 "modes": ["wt2wt"],
28701 "changes": [
28702 ["figcaption", "text", "new caption"]
28703 ]
28704 }
28705 !! wikitext
28706 [[Image:Foobar.jpg|thumb|original caption]]
28707 !! wikitext/edited
28708 [[Image:Foobar.jpg|thumb|new caption]]
28709 !!end
28710
28711 !! test
28712 Image: empty alt attribute (T50924)
28713 !! wikitext
28714 [[File:Foobar.jpg|thumb|alt=|bar]]
28715 !! html/php+tidy
28716 <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>
28717 !! html/parsoid
28718 <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>
28719 !! end
28720
28721 !! test
28722 Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
28723 !! options
28724 parsoid=html2wt
28725 language=ar
28726 disabled
28727 !! html/parsoid
28728 <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>
28729 !! wikitext
28730 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
28731 !! end
28732
28733 !! test
28734 Image: Block level image should have \n before and after
28735 !! wikitext
28736 123
28737 [[File:Foobar.jpg|right|thumb|150x150px]]
28738 456
28739 !! html/parsoid
28740 <p>123</p>
28741 <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>
28742 <p>456</p>
28743 !! end
28744
28745 !! test
28746 Image: New block level image should have \n before and after (existing content)
28747 !! wikitext
28748 123
28749 [[File:Foobar.jpg|right|thumb|150x150px]]
28750 456
28751 !! html/parsoid
28752 <p>123</p>
28753 <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>
28754 <p>456</p>
28755 !! end
28756
28757 !! test
28758 Image: upright option (parsoid)
28759 !! wikitext
28760 [[File:Foobar.jpg|thumb|upright|caption]]
28761 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
28762 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
28763 !! html/parsoid
28764 <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>
28765 <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>
28766 <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>
28767 !! end
28768
28769 !! test
28770 Image: upright option is ignored on inline and frame images (parsoid)
28771 !! wikitext
28772 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
28773 !! html/parsoid
28774 <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>
28775 !! end
28776
28777 !! test
28778 Image: in template parameter with empty parameter
28779 !! wikitext
28780 {{echo|[[File:Foobar.jpg|link=]]}}
28781 !! html/parsoid
28782 <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>
28783 !! end
28784
28785 !! test
28786 Image: from basic HTML (1)
28787 !! options
28788 parsoid=html2wt
28789 !! html/parsoid
28790 <span typeof="mw:Image">
28791 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28792 </span>
28793 !! wikitext
28794 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28795 !! end
28796
28797 !! test
28798 Image: from basic HTML (2)
28799 !! options
28800 parsoid=html2wt
28801 !! html/parsoid
28802 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
28803 !! wikitext
28804 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
28805 !! end
28806
28807 !! test
28808 Image: from basic HTML (3)
28809 !! options
28810 parsoid=html2wt
28811 !! html/parsoid
28812 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
28813 !! wikitext
28814 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
28815 !! end
28816
28817 !! test
28818 Image: from basic HTML (4)
28819 !! options
28820 parsoid=html2wt
28821 !! html/parsoid
28822 <img src="./File:Foobar.jpg">
28823 !! wikitext
28824 [[File:Foobar.jpg|link=]]
28825 !! end
28826
28827 !! test
28828 Image: Invalid title as link
28829 !! wikitext
28830 [[File:Foobar.jpg|link=<]]
28831 !! html/php
28832 <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>
28833 </p>
28834 !! html/parsoid
28835 <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>
28836 !! end
28837
28838 !! test
28839 Various link types in alt and link options
28840 !! wikitext
28841 [[File:Foobar.jpg|link=[[Main Page]]|alt=[[Main Page]]|caption]]
28842
28843 [[File:Foobar.jpg|link=[[Media:Thumb.png]]|alt=[[Media:Thumb.png]]|caption]]
28844
28845 [[File:Foobar.jpg|link=[[wikipedia:Foo]]|alt=[[wikipedia:Foo]]|caption]]
28846 !! html/php+tidy
28847 <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>
28848 </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>
28849 </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>
28850 </p>
28851 !! html/parsoid
28852 <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>
28853
28854 <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>
28855
28856 <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>
28857 !! end
28858
28859 !! test
28860 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
28861 !! options
28862 parsoid=html2wt
28863 !! html/parsoid
28864 <ul>
28865 <li><p>foo</p></li>
28866 </ul>
28867 !! wikitext
28868 * foo
28869 !! end
28870
28871 !! test
28872 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
28873 !! options
28874 parsoid=html2wt
28875 !! html/parsoid
28876 <ul> <li>foo</li></ul>
28877 !! wikitext
28878 * foo
28879 !! end
28880
28881 !! test
28882 Don't strip leading whitespace when handling indent-pre suppressing tags
28883 !! options
28884 parsoid=html2wt
28885 !! html/parsoid
28886 <table>
28887 <tr><td> indented row</td></tr>
28888 </table>
28889 <blockquote><p>
28890 <b>This is very bold of you!</b>
28891 </p>
28892 <table><tr><td>
28893 indented cell (no pre-wrapping!)
28894 </td></tr></table>
28895 </blockquote>
28896 <p>foo</p>
28897 <div>bar</div>
28898 !! wikitext
28899 {|
28900 | indented row
28901 |}
28902 <blockquote>
28903 '''This is very bold of you!'''
28904
28905 {|
28906 |
28907 indented cell (no pre-wrapping!)
28908 |}
28909 </blockquote>
28910 foo
28911 <div>bar</div>
28912 !! end
28913
28914 !! test
28915 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
28916 !! options
28917 parsoid=html2wt
28918 !! html/parsoid
28919 <p>foo</p>
28920 <span>bar</span>
28921
28922 <span>foo2
28923 </span>bar2
28924
28925 <div>foo</div>
28926 <span>bar</span>
28927
28928 <div>
28929 <span>foo</span>
28930 </div>
28931 !! wikitext
28932 foo
28933
28934 <span>bar</span>
28935
28936 <span>foo2
28937 <nowiki> </nowiki></span>bar2
28938
28939 <div>foo</div>
28940 <nowiki> </nowiki><span>bar</span>
28941
28942 <div>
28943 <nowiki> </nowiki><span>foo</span>
28944 </div>
28945 !! end
28946
28947 !! test
28948 Lists: Dont insert newlines in a serialized list item.
28949 !! options
28950 parsoid=html2wt
28951 !! html/parsoid
28952 <ul><li>a<br>b</li><li>c</li></ul>
28953 !! wikitext
28954 * a<br />b
28955 * c
28956 !! end
28957
28958 !! test
28959 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
28960 !! options
28961 parsoid={
28962 "modes": ["html2wt"],
28963 "scrubWikitext": false
28964 }
28965 !! html/parsoid
28966 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28967 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28968
28969 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
28970 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
28971
28972 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
28973
28974 <h2><meta property="mw:PageProp/toc" /> ok</h2>
28975 !! wikitext
28976 == hello there [[Category:A1]] ==
28977
28978 == [[Category:A2]] hi pal ==
28979
28980 == <!--foo--> [[Category:A3]] how goes it ==
28981
28982 == it goes well [[Category:A4]] <!--bar--> ==
28983
28984 ==howdy [[Category:A5]]==
28985
28986 == __TOC__ ok ==
28987 !! end
28988
28989 !! test
28990 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
28991 !! options
28992 parsoid={
28993 "modes": ["html2wt"],
28994 "scrubWikitext": true
28995 }
28996 !! html/parsoid
28997 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
28998 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
28999
29000 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
29001 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
29002
29003 <h2><meta property="mw:PageProp/toc" /> ok</h2>
29004 !! wikitext
29005 == hello there ==
29006 [[Category:A1]]
29007 [[Category:A2]]
29008
29009 == hi pal ==
29010
29011 <!--foo-->[[Category:A3]]
29012
29013 == how goes it ==
29014
29015 == it goes well ==
29016 [[Category:A4]] <!--bar-->
29017
29018 __TOC__
29019
29020 == ok ==
29021 !! end
29022
29023 !! test
29024 Headings: Don't hoist metas that come from templates
29025 !! options
29026 parsoid={
29027 "modes": ["html2wt"],
29028 "scrubWikitext": true
29029 }
29030 !! html/parsoid
29031 <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>
29032 !! wikitext
29033 == {{echo|foo [[Category:Foo]]}} ==
29034 !! end
29035
29036 !! test
29037 Headings: Category in ref isn't hoisted
29038 !! options
29039 parsoid={
29040 "modes": ["html2wt"],
29041 "scrubWikitext": true
29042 }
29043 !! html/parsoid
29044 <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>
29045
29046 <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>
29047 !! wikitext
29048 == foo <ref>bar
29049 [[Category:Baz]] </ref> ==
29050
29051 <references />
29052 !! end
29053
29054 !! test
29055 Parsoid: Serialize positional parameters with = in them as named parameter
29056 !! options
29057 parsoid=html2wt
29058 !! html/parsoid
29059 <p about="#mwt1" typeof="mw:Transclusion"
29060 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
29061
29062 <p about="#mwt1" typeof="mw:Transclusion"
29063 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
29064
29065 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29066 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29067 <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>
29068 !! wikitext
29069 {{echo|1=f=oo}}
29070
29071 {{echo|1=f=oo|2=bar}}
29072
29073 <!--Orig params with data-parsoid has heuristics for handling = chars-->
29074 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
29075 {{echo|<nowiki>f=oo</nowiki>|bar}}
29076 !! end
29077
29078 !! test
29079 Parsoid: Serialize positional parameters with = in extlink as named parameter
29080 !! options
29081 parsoid=html2wt
29082 !! html/parsoid
29083 <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>
29084 !! wikitext
29085 {{echo|1=http://stuff?is=ok}}
29086 !! end
29087
29088 !! test
29089 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
29090 !! options
29091 parsoid=html2wt
29092 !! html/parsoid
29093 <div>a<p>b</p></div>
29094 <div>a
29095 <p>b</p></div>
29096 <div>
29097 a
29098 <p>b</p></div>
29099 !! wikitext
29100 <div>a
29101 b
29102 </div>
29103 <div>a
29104 b
29105 </div>
29106 <div>
29107 a
29108
29109 b
29110 </div>
29111 !! end
29112
29113 !! test
29114 Substrings resembling wikitext in hrefs should not get nowiki escapes
29115 !! options
29116 parsoid=html2wt
29117 !! html/parsoid
29118 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
29119 !! wikitext
29120 [[Foo''bar''baz]]
29121 !! end
29122
29123 !! test
29124 Enforce single-line context in the serializer
29125 !! options
29126 parsoid=html2wt
29127 !! html/parsoid
29128 <h2>testing
29129 123</h2>
29130
29131 <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">
29132 </span><span about="#mwt1">you</span> </h2>
29133
29134 <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>
29135
29136 <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
29137 there</span></li></ol>
29138
29139 <ul><li>asd
29140 sdf</li></ul>
29141
29142 <ul><li>foo
29143 bar
29144 baz</li>
29145 <li>foo <b>bar</b>
29146 baz</li></ul>
29147
29148 <dl><dt>hi
29149 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
29150 ho</dd></dl>
29151
29152 <dl><dd> <table>
29153 <tbody><tr><td> ha
29154 ha
29155 ha</td></tr>
29156 </tbody></table></dd></dl>
29157 !! wikitext
29158 == testing 123 ==
29159
29160 == hi {{bogus|there
29161 you}} ==
29162
29163 == foo <ref>hello
29164 there</ref> ==
29165
29166 <references />
29167
29168 * asd sdf
29169
29170 * foo bar baz
29171 * foo '''bar''' baz
29172
29173 ; hi ho : hi ho
29174
29175 : {|
29176 | ha
29177 ha
29178 ha
29179 |}
29180 !! end
29181
29182 !! test
29183 Serialize new placeholder space without spans
29184 !! options
29185 parsoid=html2wt
29186 !! html/parsoid
29187 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
29188
29189 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
29190
29191 <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>
29192 !! wikitext
29193 foo : bar
29194
29195 foo : bar
29196
29197 <ref>foo : bar</ref>ok
29198 !! end
29199
29200
29201 #-----------------------
29202 # Tag minimization tests
29203 #-----------------------
29204
29205 !! test
29206 1. I/B quote minimization: wikitext-only tags should be combined
29207 !! options
29208 parsoid=html2wt
29209 !! html/parsoid
29210 <p><i>A</i><i>B</i></p>
29211 <p><b>A</b><b>B</b></p>
29212 <p><i>A</i><b><i>B</i></b></p>
29213 <p><b>A</b><i><b>B</b></i></p>
29214 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
29215 <p><i><b>A</b></i><i><b>B</b></i></p>
29216 <p><i><b>A</b></i><b><i>B</i></b></p>
29217 <p><b><i>A</i></b><i><b>B</b></i></p>
29218 !! wikitext
29219 ''AB''
29220
29221 '''AB'''
29222
29223 ''A'''B'''''
29224
29225 '''A''B'''''
29226
29227 '''A''BC''D'''
29228
29229 '''''AB'''''
29230
29231 '''''AB'''''
29232
29233 '''''AB'''''
29234 !! end
29235
29236 !! test
29237 2. I/B quote minimization: wikitext and html tags should not be combined
29238 !! options
29239 parsoid=html2wt
29240 !! html/parsoid
29241 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
29242 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
29243 !! wikitext
29244 ''A''<i>B</i>
29245
29246 ''A''<nowiki/>'''<i>B</i>'''
29247 !! end
29248
29249 !! test
29250 3. I/B quote minimization: templated content stops minimization
29251 !! options
29252 parsoid=html2wt
29253 !! html/parsoid
29254 <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>
29255 <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>
29256 !! wikitext
29257 ''A''{{echo|''B''}}
29258
29259 ''A''{{echo|'''''B'''''}}
29260 !! end
29261
29262 !! test
29263 4. I/B quote minimization: new content should be mimimized with adjacent old content
29264 !! options
29265 parsoid=html2wt
29266 !! html/parsoid
29267 <p><i>A</i><i>B</i></p>
29268 <p><b>A</b><b>B</b></p>
29269 <p><i>A</i><b><i>B</i></b></p>
29270 !! wikitext
29271 ''AB''
29272
29273 '''AB'''
29274
29275 ''A'''B'''''
29276 !! end
29277
29278 !! test
29279 5a. Merge adjacent quote nodes if they've been edited
29280 !! options
29281 parsoid={
29282 "modes": ["wt2wt", "selser"],
29283 "changes": [
29284 ["p", "contents", "remove", ":contains('b')"]
29285 ]
29286 }
29287 !! wikitext
29288 ''a''b''c''
29289 !! wikitext/edited
29290 ''ac''
29291 !! end
29292
29293 !! test
29294 5b. Merge adjacent quote nodes if they've been edited
29295 !! options
29296 parsoid={
29297 "modes": ["wt2wt", "selser"],
29298 "changes": [
29299 ["#x", "remove"]
29300 ]
29301 }
29302 !! wikitext
29303 ''a''<span id="x">b</span>''c''
29304 !! wikitext/edited
29305 ''ac''
29306 !! end
29307
29308 !! test
29309 1. Merge adjacent link nodes as long as at least one element is new
29310 !! options
29311 parsoid={
29312 "modes": ["html2wt"],
29313 "scrubWikitext": true
29314 }
29315 !! html/parsoid
29316 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29317 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29318 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
29319 !! wikitext
29320 [[Football]]
29321 [[Football]]
29322 [[Football|Foot]][[Football|ball]]
29323 !! end
29324
29325 !! test
29326 2. Merge adjacent link nodes and enable additional normalizations
29327 !! options
29328 parsoid={
29329 "modes": ["html2wt"],
29330 "scrubWikitext": true
29331 }
29332 !! html/parsoid
29333 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
29334 !! wikitext
29335 ''[[Football]]''
29336 !! end
29337
29338 !! test
29339 3. Don't merge adjacent link nodes if scrubWikitext is false
29340 !! options
29341 parsoid={
29342 "modes": ["html2wt"],
29343 "scrubWikitext": false
29344 }
29345 !! html/parsoid
29346 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
29347 !! wikitext
29348 [[Football|Foot]][[Football|ball]]
29349 !! end
29350
29351 !! test
29352 1. Move format tags outside of WikiLink
29353 !! options
29354 parsoid={
29355 "modes": ["html2wt"],
29356 "scrubWikitext": true
29357 }
29358 !! html/parsoid
29359 <a rel="mw:WikiLink" href="./Football"><i>Football</i></a>
29360 <a rel="mw:WikiLink" href="./Football"><i><b>Football</b></i></a>
29361 <a rel="mw:WikiLink" href="./Football"><u><i><b>Football</b></i></u></a>
29362 !! wikitext
29363 ''[[Football]]''
29364 '''''[[Football]]'''''
29365 <u>'''''[[Football]]'''''</u>
29366 !! end
29367
29368 !! test
29369 2. Move format tags outside of WikiLink with mergable A tags
29370 !! options
29371 parsoid={
29372 "modes": ["html2wt"],
29373 "scrubWikitext": true
29374 }
29375 !! html/parsoid
29376 <a rel="mw:WikiLink" href="./Football"><i><b>Foot</b></i></a><a rel="mw:WikiLink" href="./Football"><i><b>ball</b></i></a>
29377 !! wikitext
29378 '''''[[Football]]'''''
29379 !! end
29380
29381 !! test
29382 3. Move format tags outside of WikiLink while preserving formats already outside WikiLink
29383 !! options
29384 parsoid={
29385 "modes": ["html2wt"],
29386 "scrubWikitext": true
29387 }
29388 !! html/parsoid
29389 <font color="red"><a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><u><b>Foo</b></u></a></font>
29390 !! wikitext
29391 <font color="red"><u>'''[[Foo]]'''</u></font>
29392 !! end
29393
29394 !! test
29395 4. Do not move format tags outside of WikiLink which includes attributes color, style and class
29396 !! options
29397 parsoid={
29398 "modes": ["html2wt"],
29399 "scrubWikitext": true
29400 }
29401 !! html/parsoid
29402 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><font color="red">Foo</font></a>
29403 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span style="color: blue; font-size: 46px;">Foo></span></a>
29404 <a rel="mw:WikiLink" href="./Foo" title="Foo" class="mw-redirect"><span class="Bar">Foo</span></a>
29405 !! wikitext
29406 [[Foo|<font color="red">Foo</font>]]
29407 [[Foo|<span style="color: blue; font-size: 46px;">Foo></span>]]
29408 [[Foo|<span class="Bar">Foo</span>]]
29409 !! end
29410
29411 !! test
29412 5. T194083 Regression test: Manual edit test that also enables scrubWikitext to move format tags outside wikilinks
29413 !! options
29414 parsoid={
29415 "modes": ["selser"],
29416 "scrubWikitext": true,
29417 "changes": [
29418 ["a", "html", "<i>Foo</i>"]
29419 ]
29420 }
29421 !! wikitext
29422 [[Foo]]
29423 !! wikitext/edited
29424 ''[[Foo]]''
29425 !! end
29426
29427 !! test
29428 6. Regression test: Manual edit test to ensure diff markers are not lost
29429 !! options
29430 parsoid={
29431 "modes": ["selser"],
29432 "scrubWikitext": true,
29433 "changes": [
29434 ["i", "wrap", "<a href='./Foo' rel='mw:WikiLink'></a>"]
29435 ]
29436 }
29437 !! wikitext
29438 ''Foo''
29439 !! wikitext/edited
29440 ''[[Foo]]''
29441 !! end
29442
29443 !! test
29444 7. T194083 Regression test: Manual edit test to ensure nested diff markers aren't inserted
29445 !! options
29446 parsoid={
29447 "modes": ["selser"],
29448 "scrubWikitext": true,
29449 "changes": [
29450 ["div", "after", "\n<p><a href='./Foo' rel='mw:WikiLink'>Foo </a>, placeholder</p>"]
29451 ]
29452 }
29453 !! wikitext
29454 <div>placeholder</div>
29455 !! wikitext/edited
29456 <div>placeholder</div>
29457 [[Foo]] , placeholder
29458 !! end
29459
29460 #------------------------------
29461 # End of tag minimization tests
29462 #------------------------------
29463
29464 !!test
29465 T56262: New entities
29466 !! options
29467 parsoid=html2wt
29468 !! html/parsoid
29469 <span typeof="mw:Entity">&nbsp;</span>
29470 !! wikitext
29471 &nbsp;
29472 !! end
29473
29474 ## Note that there is no wikitext output for 'unknownproperty' ##
29475 ## Unknown magic words are silently dropped ##
29476
29477 !! test
29478 Magic words
29479 !! options
29480 parsoid=html2wt
29481 !! html/parsoid
29482 <meta property='mw:PageProp/toc' />
29483 <meta property='mw:PageProp/notoc' />
29484 <meta property='mw:PageProp/forcetoc' />
29485 <meta property='mw:PageProp/index' />
29486 <meta property='mw:PageProp/noindex' />
29487 <meta property='mw:PageProp/nogallery' />
29488 <meta property='mw:PageProp/noeditsection' />
29489 <meta property='mw:PageProp/notitleconvert' />
29490 <meta property='mw:PageProp/nocontentconvert' />
29491 <meta property='mw:PageProp/unknownproperty' />
29492 !! wikitext
29493 __TOC__
29494 __NOTOC__
29495 __FORCETOC__
29496 __INDEX__
29497 __NOINDEX__
29498 __NOGALLERY__
29499 __NOEDITSECTION__
29500 __NOTITLECONVERT__
29501 __NOCONTENTCONVERT__
29502 !! end
29503
29504 !! test
29505 Consecutive <pre>s should not get merged
29506 !! options
29507 parsoid=html2wt,html2html
29508 !! html/parsoid
29509 <pre>a</pre><pre>b</pre>
29510
29511 <pre>c
29512 </pre><pre>
29513 d</pre>
29514
29515 <pre>e
29516
29517 </pre><pre>
29518
29519 f</pre>
29520 !! wikitext
29521 a
29522
29523 b
29524
29525 c
29526
29527 d
29528
29529 e
29530
29531
29532
29533 f
29534 !! end
29535
29536 !! test
29537 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
29538 !! options
29539 parsoid=html2wt
29540 !! html/parsoid
29541 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
29542 !! wikitext
29543 [[Special:BookSources/1234567890|ISBN 1234567895]]
29544 !! end
29545
29546 !! test
29547 Edited RFC links not serializable as RFC links should serialize as extlinks
29548 !! options
29549 parsoid=html2wt
29550 !! html/parsoid
29551 <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
29552 !! wikitext
29553 [https://tools.ietf.org/html/rfc123 New RFC]
29554 !! end
29555
29556 !! test
29557 Edited PMID links not serializable as PMID links should serialize as extlinks
29558 !! options
29559 parsoid=html2wt
29560 !! html/parsoid
29561 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
29562 !! wikitext
29563 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
29564 !! end
29565
29566 !! test
29567 WTS of autolinks with trailing/surrounding context
29568 !! options
29569 parsoid=html2wt
29570 !! html/parsoid
29571 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
29572 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
29573 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
29574 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
29575 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
29576 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
29577 !! wikitext
29578 http://cscott.net'''foo'''
29579
29580 http://cscott.net<b>foo</b>
29581
29582 '''http://cscott.net'''
29583
29584 '''http://cscott.net '''
29585
29586 '''http://cscott.net<nowiki/>x'''
29587
29588 http://cscott.net<nowiki/>x
29589 !! end
29590
29591 !! test
29592 WTS of autolinks with nowikis (round-trip)
29593 !! wikitext
29594 x<nowiki/>http://cscott.net<nowiki/>x
29595 !! html/parsoid
29596 <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
29597 !! end
29598
29599 # this is the "easy" test because it leaves in place all the
29600 # data-parsoid information indicating this is an autolink
29601 !! test
29602 WTS of autolinks with escapes (editing)
29603 !! options
29604 parsoid={
29605 "modes": ["wt2wt"],
29606 "changes": [
29607 [ "span", "remove" ]
29608 ]
29609 }
29610 !! wikitext
29611 x<nowiki/>http://cscott.net<nowiki/>x
29612 !! wikitext/edited
29613 x<nowiki/>http://cscott.net<nowiki/>x
29614 !! end
29615
29616 !! test
29617 WTS of edited autolink-like text (T103364)
29618 !! options
29619 parsoid={
29620 "modes": ["wt2wt"],
29621 "changes": [
29622 [ "span[typeof]", "removeAttr", "typeof" ]
29623 ]
29624 }
29625 !! wikitext
29626 Not a link: <nowiki>http://example.com</nowiki>.
29627 !! wikitext/edited
29628 Not a link: <span><nowiki>http://example.com</nowiki></span>.
29629 !! end
29630
29631 !! test
29632 WTS of newly-authored autolink-like text (T103364)
29633 !! options
29634 parsoid=html2wt
29635 !! html/parsoid
29636 <p>http://example.com is not a link.</p>
29637 !! wikitext
29638 <nowiki>http://example.com</nowiki> is not a link.
29639 !! end
29640
29641 !! test
29642 WTS of autolink-like text after an autolink (T108563)
29643 !! options
29644 parsoid=html2wt
29645 !! html/parsoid
29646 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
29647 !! wikitext
29648 http://example.com <nowiki>http://example.com</nowiki> is not a link.
29649 !! end
29650
29651 !! test
29652 Magic links inside links (not autolinked)
29653 !! wikitext
29654 [[Foo|http://example.com]]
29655 [[Foo|RFC 1234]]
29656 [[Foo|PMID 1234]]
29657 [[Foo|ISBN 123456789x]]
29658
29659 [http://foo.com http://example.com]
29660 [http://foo.com RFC 1234]
29661 [http://foo.com PMID 1234]
29662 [http://foo.com ISBN 123456789x]
29663 !! html+tidy
29664 <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
29665 <a href="/wiki/Foo" title="Foo">RFC 1234</a>
29666 <a href="/wiki/Foo" title="Foo">PMID 1234</a>
29667 <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
29668 </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
29669 <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
29670 <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
29671 <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
29672 </p>
29673 !! html/parsoid
29674 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
29675 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
29676 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
29677 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
29678
29679 <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
29680 <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
29681 <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
29682 <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
29683 !! end
29684
29685 !! test
29686 Magic links inside image captions (autolinked)
29687 !! wikitext
29688 [[File:Foobar.jpg|thumb|http://example.com]]
29689 [[File:Foobar.jpg|thumb|RFC 1234]]
29690 [[File:Foobar.jpg|thumb|PMID 1234]]
29691 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
29692 !! html+tidy
29693 <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>
29694 <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>
29695 <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>
29696 <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>
29697 !! html/parsoid
29698 <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>
29699 <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>
29700 <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>
29701 <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>
29702 !! end
29703
29704 !! test
29705 WTS of magic word text (T109371)
29706 !! options
29707 parsoid=html2wt
29708 !! html/parsoid
29709 <p>RFC 1234</p>
29710 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
29711 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
29712 !! wikitext
29713 <nowiki>RFC 1234</nowiki>
29714
29715 [http://foo.com RFC 1234]
29716
29717 [[Foo|RFC 1234]]
29718 !! end
29719
29720 !! test
29721 Edited Redirect link should emit a non-piped wikitext link
29722 !! options
29723 parsoid=html2wt
29724 !! html/parsoid
29725 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
29726 !! wikitext
29727 #REDIRECT [[Bar]]
29728 !! end
29729
29730 !! test
29731 T75121: Infer extension name from typeOf if data-mw is not present
29732 !! options
29733 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
29734 !! html/parsoid
29735 <div typeOf="mw:Extension/foo"></div>
29736 !! wikitext
29737 <foo />
29738 !! end
29739
29740 # Note that the <p> wrapping isn't present in PHP parser output
29741 # The important thing for this test is that P-wrapping doesn't
29742 # interfere with the <nowiki> protection for leading - in <td>
29743 # (which isn't necessary for <th>).
29744 !! test
29745 T88318: p-wrapped dash in table.
29746 !! options
29747 parsoid=html2wt,wt2wt
29748 !! html/parsoid
29749 <table><tbody>
29750 <tr><th><p>-</p></th><th><p>- </p></th></tr>
29751 <tr><td><p>-</p></td><td><p>- </p></td></tr>
29752 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
29753 </tbody></table>
29754 !! wikitext
29755 {|
29756 !-
29757 !-
29758 |-
29759 |<nowiki>-</nowiki>
29760 |<nowiki>- </nowiki>
29761 |-
29762 |<small>-</small>
29763 |<br />
29764 -
29765 |<br />-
29766 |}
29767 !! html/php+tidy
29768 <table>
29769 <tbody><tr>
29770 <th>-
29771 </th>
29772 <th>-
29773 </th></tr>
29774 <tr>
29775 <td>-
29776 </td>
29777 <td>-
29778 </td></tr>
29779 <tr>
29780 <td><small>-</small>
29781 </td>
29782 <td><br />
29783 <p>-
29784 </p>
29785 </td>
29786 <td><br />-
29787 </td></tr></tbody></table>
29788 !! end
29789
29790 !! test
29791 T149209: WTS: Handle newlines in table cells properly
29792 !! options
29793 parsoid=html2wt
29794 !! html/parsoid
29795 <table>
29796 <tbody>
29797 <tr><td>a
29798 b
29799 </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
29800 <tr><td><p>x</p>
29801 </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
29802 </tbody></table>
29803 <table>
29804 <tbody>
29805 <tr><th>a
29806 b
29807 </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
29808 <tr><th><p>x</h>
29809 </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
29810 </tbody></table>
29811 !! wikitext
29812 {|
29813 |a
29814 b
29815 |c
29816 |-
29817 |x
29818 {{!}}y
29819 |}
29820 {|
29821 !a
29822 b
29823 !c
29824 |-
29825 !x
29826 !y
29827 |}
29828 !! end
29829
29830 !! test
29831 T149209: Selser: Handle newlines in table cells properly
29832 !! options
29833 parsoid={
29834 "modes": ["selser"],
29835 "changes": [
29836 [ "#h1", "html", "a\nb\n" ],
29837 [ "#h2", "html", "a\nb\n" ],
29838 [ "#c1", "html", "a\nb\n" ],
29839 [ "#c2", "html", "<p>a</p>" ],
29840 [ "#c3", "html", "<p>a</p>" ],
29841 [ "#c4", "html", "edit-me<p>a</p>" ]
29842 ]
29843 }
29844 !! wikitext
29845 {|
29846 ! id="h1" |edit-me!!1
29847 |-
29848 ! id="h2" |edit-me||2
29849 |-
29850 | id="c1" |edit-me||3
29851 |-
29852 | id="c2" |edit-me||4
29853 |-
29854 | id="c3" |edit-me||p||q||r
29855 |-
29856 | id="c4" |edit-me||p||q||r
29857 |}
29858 !! wikitext/edited
29859 {|
29860 ! id="h1" |a
29861 b
29862 !1
29863 |-
29864 ! id="h2" |a
29865 b
29866 !2
29867 |-
29868 | id="c1" |a
29869 b
29870 |3
29871 |-
29872 | id="c2" |a
29873 |4
29874 |-
29875 | id="c3" |a
29876 |p||q||r
29877 |-
29878 | id="c4" |edit-me
29879 a
29880 |p||q||r
29881 |}
29882 !! end
29883
29884 !! test
29885 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
29886 !! options
29887 parsoid=html2wt
29888 !! html/parsoid
29889 <table id='mwAb'>
29890 <td id='mwAc'>foo</td>
29891 <td id='serialize-this'>bar</td>
29892 </table>
29893 !! wikitext
29894 {|
29895 |foo
29896 | id="serialize-this" |bar
29897 |}
29898 !! end
29899
29900 !! test
29901 Parsoid-like element ids should not be serialized to wikitext unless shadowed
29902 !! options
29903 parsoid=html2wt
29904 !! html/parsoid
29905 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
29906 !! wikitext
29907 <div id="hello">ok</div>
29908 !! end
29909
29910 !! test
29911 Testing serialization after deletion in references
29912 !! options
29913 parsoid={
29914 "modes": ["wt2wt"],
29915 "changes": [
29916 ["#x", "remove"]
29917 ]
29918 }
29919 !! wikitext
29920 hi <ref><div id="x">ho</div></ref>
29921
29922 <references />
29923 !! wikitext/edited
29924 hi <ref></ref>
29925
29926 <references />
29927 !! end
29928
29929 !!test
29930 Testing serialization after deletion of table cells
29931 !!options
29932 parsoid={
29933 "modes": ["wt2wt", "selser"],
29934 "changes": [
29935 ["#x", "remove"]
29936 ]
29937 }
29938 !!wikitext
29939 {|
29940 !h1 !!h2 !!h3
29941 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
29942 |}
29943 !! wikitext/edited
29944 {|
29945 !h1!!h2!!h3
29946 |c2|||c3
29947 |}
29948 !!end
29949
29950 !! test
29951 Testing selser after addition of new row before first row (T125419)
29952 !! options
29953 parsoid={
29954 "modes": ["wt2wt", "selser"],
29955 "changes": [
29956 [ "tr", "before", "<tr><td>X</td></tr>" ]
29957 ]
29958 }
29959 !! wikitext
29960 {|
29961 |a
29962 |}
29963 !! wikitext/edited
29964 {|
29965 |X
29966 |-
29967 |a
29968 |}
29969 !! end
29970
29971 !! test
29972 Serialize new table rows in a HTML table using HTML tags
29973 !! options
29974 parsoid={
29975 "modes": ["wt2wt", "selser"],
29976 "changes": [
29977 [ "tr", "before", "<tr><td>X</td></tr>" ]
29978 ]
29979 }
29980 !! wikitext
29981 <table><tr><td>a</td></tr></table>
29982 !! wikitext/edited
29983 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
29984 !! end
29985
29986 !! test
29987 Serialize new table cells in a HTML row using HTML tags
29988 !! options
29989 parsoid={
29990 "modes": ["wt2wt", "selser"],
29991 "changes": [
29992 [ "td", "before", "<td>X</td>" ]
29993 ]
29994 }
29995 !! wikitext
29996 <table><tr><td>a</td></tr></table>
29997 !! wikitext/edited
29998 <table><tr><td>X</td><td>a</td></tr></table>
29999 !! end
30000
30001 !! test
30002 Serialize wikitext list items as HTML list items when embedded in a HTML list
30003 !! options
30004 parsoid=html2wt
30005 !! html/parsoid
30006 <ul data-parsoid='{"stx": "html"}'>
30007 <li data-parsoid='{}'>a</li>
30008 <li>b</li>
30009 </ul>
30010 !! wikitext
30011 <ul>
30012 <li>a</li>
30013 <li>b</li>
30014 </ul>
30015 !! html/php+tidy
30016 <ul>
30017 <li>a</li>
30018 <li>b</li>
30019 </ul>
30020 !! end
30021
30022 # Nested list should be inside <li>, that is
30023 # <ul><li>foo<ul>..</ul></li></ul> instead of
30024 # <ul><li>foo</li><ul>..</ul></ul>
30025 # See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list
30026 !! test
30027 Wikitext lists can be nested inside HTML lists
30028 !! options
30029 parsoid=html2wt
30030 !! html/parsoid
30031 <ul data-parsoid='{"stx": "html"}'>
30032 <li data-parsoid='{"stx": "html"}'>a
30033 <ul><li>b</li></ul>
30034 </li>
30035 </ul>
30036
30037 <ul data-parsoid='{"stx": "html"}'>
30038 <li>x
30039 <ul><li>y</li></ul>
30040 </li>
30041 </ul>
30042 !! wikitext
30043 <ul>
30044 <li>a
30045 * b
30046 </li>
30047 </ul>
30048
30049 <ul>
30050 <li>x
30051 * y
30052 </li>
30053 </ul>
30054 !! html/php+tidy
30055 <ul>
30056 <li>a
30057 <ul><li>b</li></ul>
30058 </li>
30059 </ul>
30060 <ul>
30061 <li>x
30062 <ul><li>y</li></ul>
30063 </li>
30064 </ul>
30065 !! end
30066
30067 !! test
30068 WTS change modes
30069 !! options
30070 parsoid={
30071 "modes": ["wt2wt"],
30072 "changes": [
30073 [ "#xyz", "before", "<b>before</b> stuff " ],
30074 [ "#xyz", "after", " stuff <i>after</i>" ],
30075 [ "#xyz", "html", "x <b>y</b> z" ]
30076 ]
30077 }
30078 !! wikitext
30079 <span id="xyz">hello</span>
30080 !! wikitext/edited
30081 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
30082 !! end
30083
30084 !! test
30085 Never serialize a-tag as html, regardless of what data-parsoid has to say
30086 !! options
30087 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30088 !! html/parsoid
30089 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
30090 !! wikitext
30091 [[Foo]]
30092 !! end
30093
30094 ## SSS FIXME: This is broken output nevertheless.
30095 ## What might be a reasonable non-broken output for this?
30096 ## This is an edge case unlikely to be seen in production
30097 ## that I am not wasting more time on this right now.
30098 !! test
30099 Never serialize a-tag as html, no matter what attributes it has
30100 !! options
30101 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
30102 !! html/parsoid
30103 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
30104 !! wikitext
30105 [http://boo.org http://boohoo.org]
30106 !! end
30107
30108 # Misnested is an indication that selser can reuse the source but these have
30109 # shown to sneak through on occasion. See T101768.
30110 # The original wikitext here is: [http://test.com [[one]] two three]
30111 !! test
30112 Strip span tags added to mark misnested links
30113 !! options
30114 parsoid=html2wt
30115 !! html/parsoid
30116 <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>
30117 !! wikitext
30118 [http://test.com][[one]] two three
30119 !! end
30120
30121 !! test
30122 Catch regression when unpacking misnested links
30123 !! options
30124 parsoid=wt2html
30125 !! wikitext
30126 {{echo|hi}}[http://example.com [[ho]]]
30127 !! html/parsoid
30128 <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>
30129 !! end
30130
30131 !! test
30132 Catch regression when unpacking with trailing content
30133 !! wikitext
30134 {{echo|Foo <references/> bar}}
30135 !! html/parsoid
30136 <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>
30137 !! end
30138
30139 !! test
30140 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
30141 !! options
30142 parsoid=html2wt
30143 !! html/parsoid
30144 <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|}"]}'>
30145 <tbody><tr><td>d
30146 </td></tr>
30147 </tbody></table>
30148 !! wikitext
30149 {{echo|a}}
30150 {|{{echo|c
30151 {{!}}d
30152 }}
30153 |}
30154 !! end
30155
30156 ## This test verifies the presence and computation of this attribute indirectly
30157 ## by making an edit and ensuring that the serialization is correct (which it would be
30158 ## only if firstWikitextNode is properly set).
30159 !! test
30160 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
30161 !! options
30162 parsoid= {
30163 "modes": ["wt2wt"],
30164 "changes": [
30165 [ "div#x", "remove" ],
30166 [ "div", "before", "<div>new</div>" ]
30167 ]
30168 }
30169 !! wikitext
30170 <div id="x">foo</div>
30171 {|
30172 {{echo|<div>boo</div>
30173 {{!}}b}}
30174 |c
30175 |}
30176 !! wikitext/edited
30177
30178 <div>new</div>
30179 {|
30180 {{echo|<div>boo</div>
30181 {{!}}b}}
30182 |c
30183 |}
30184 !! end
30185
30186 ## Don't necessarily expect this to roundtrip, but run serialization to catch crashers
30187 !! test
30188 File in link scenarios
30189 !! options
30190 parsoid={
30191 "modes": ["wt2html","html2wt"],
30192 "suppressErrors": true
30193 }
30194 !! wikitext
30195 [http://www.google.com [[File:Foobar.jpg|123]]]
30196
30197 [http://www.google.com [[File:Foobar.jpg|thumb|123]]]
30198 !! html/php+tidy
30199 <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>
30200 </p>
30201 <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>
30202 !! html/parsoid
30203 <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>
30204
30205 <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>
30206 !! end
30207
30208 # --------------------------------------------
30209 # Tests spec'ing wikitext serialization norms |
30210 # --------------------------------------------
30211
30212 !! test
30213 Serialize multi-line indent-pre starting with wikitext syntax
30214 !! options
30215 parsoid=html2wt
30216 !! html/parsoid
30217 <pre>* 1
30218 ** 2
30219 * 3</pre>
30220 !! wikitext
30221 * 1
30222 ** 2
30223 * 3
30224 !! end
30225
30226 !! test
30227 1. Categories should always be serialized on their own line
30228 !! options
30229 parsoid=html2wt
30230 !! html/parsoid
30231 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
30232 !! wikitext
30233 foo
30234 [[Category:Foo]]
30235 bar
30236 !! end
30237
30238 !! test
30239 2. Categories that are part of templates should not introduce a line break
30240 !! wikitext
30241 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
30242 !! html/parsoid
30243 <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>
30244 !! end
30245
30246 # Careful while editing these next 2 tests. There are \u200f characters
30247 # before and after the <link> tags in the HTML and following some
30248 # of the categories in wikitext
30249 # Do not remove these characters in edits.
30250 #
30251 # As part of the serialization, these bidi characters will get stripped.
30252 !! test
30253 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
30254 !! options
30255 parsoid={
30256 "modes": ["html2wt"],
30257 "scrubWikitext": true
30258 }
30259 !! html/parsoid
30260 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
30261 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
30262 !! wikitext
30263 [[קטגוריה:טקסים]]
30264 [[קטגוריה: שיטות משפט]]
30265 !! end
30266
30267 !! test
30268 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
30269 !! options
30270 parsoid={
30271 "modes": ["html2wt"],
30272 "scrubWikitext": true
30273 }
30274 !! html/parsoid
30275 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
30276 !! wikitext
30277 [[קטגוריה:טקסים]]
30278 ‏y
30279 !! end
30280
30281 !! test
30282 Lists: Add space after bullets
30283 !! options
30284 parsoid=html2wt
30285 !! html/parsoid
30286 <ul>
30287 <li>foo</li>
30288 <li> bar</li>
30289 <li><span> baz</span></li>
30290 </ul>
30291 !! wikitext
30292 * foo
30293 * bar
30294 * <span> baz</span>
30295 !! end
30296
30297 !! test
30298 1. Headings: Add space before/after == (T53744)
30299 !! options
30300 parsoid=html2wt
30301 !! html/parsoid
30302 <h2>foo</h2>
30303 <h2> bar</h2>
30304 <h2>baz </h2>
30305 <h2><span> baz</span></h2>
30306 !! wikitext
30307 == foo ==
30308
30309 == bar ==
30310
30311 == baz ==
30312
30313 == <span> baz</span> ==
30314 !! end
30315
30316 !! test
30317 2. Headings: Add space before/after == even after hoisted content
30318 !! options
30319 parsoid={
30320 "modes": ["html2wt"],
30321 "scrubWikitext": true
30322 }
30323 !! html/parsoid
30324 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
30325 !! wikitext
30326 [[Category:A2]]
30327
30328 == ok ==
30329 !! end
30330
30331 !! test
30332 1. Headings: suppress newly created empty headings
30333 !! options
30334 parsoid={
30335 "modes": ["html2wt"],
30336 "scrubWikitext": true
30337 }
30338 !! html/parsoid
30339 <h2></h2>
30340 !! wikitext
30341 !! end
30342
30343 !! test
30344 2. Headings: don't suppress empty headings if scrubWikitext is false
30345 !! options
30346 parsoid=html2wt
30347 !! html/parsoid
30348 <h2></h2>
30349 !! wikitext
30350 ==<nowiki/>==
30351 !! end
30352
30353 !! test
30354 3. Headings: suppress empty headings on edits
30355 !! options
30356 parsoid={
30357 "modes": ["selser"],
30358 "scrubWikitext": true,
30359 "changes": [
30360 [ "#x", "remove"]
30361 ]
30362 }
30363 !! wikitext
30364 ==<span id="x">foo</span>==
30365 !! wikitext/edited
30366 !! end
30367
30368 !! test
30369 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
30370 !! options
30371 parsoid={
30372 "modes": ["html2wt"],
30373 "scrubWikitext": true
30374 }
30375 !! html/parsoid
30376 <h2>foo<br/>bar</h2>
30377 <h2>foo <span><br/>bar</span> baz</h2>
30378 !! wikitext
30379 == foo bar ==
30380
30381 == foo <span> bar</span> baz ==
30382 !! end
30383
30384 !! test
30385 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
30386 !! options
30387 parsoid={
30388 "modes": ["html2wt"],
30389 "scrubWikitext": false
30390 }
30391 !! html/parsoid
30392 <h2>foo<br/>bar</h2>
30393 !! wikitext
30394 == foo<br />bar ==
30395 !! end
30396
30397 !! test
30398 1. WT Quote Tags: suppress newly created empty style tags
30399 !! options
30400 parsoid={
30401 "modes": ["html2wt"],
30402 "scrubWikitext": true
30403 }
30404 !! html/parsoid
30405 <i></i><b></b>
30406 !! wikitext
30407 !! end
30408
30409 !! test
30410 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
30411 !! options
30412 parsoid=html2wt
30413 !! html/parsoid
30414 <i></i><b></b>
30415 !! wikitext
30416 ''<nowiki/>'''''<nowiki/>'''
30417 !! end
30418
30419 !! test
30420 3. WT Quote Tags: suppress empty style tags on edits
30421 !! options
30422 parsoid={
30423 "modes": ["selser"],
30424 "scrubWikitext": true,
30425 "changes": [
30426 [ "#x", "remove"]
30427 ]
30428 }
30429 !! wikitext
30430 '''<span id="x">foo</span>'''
30431 !! wikitext/edited
30432 !! end
30433
30434 !! test
30435 1. Anchors: suppress newly created empty anchors
30436 !! options
30437 parsoid={
30438 "modes": ["html2wt"],
30439 "scrubWikitext": true
30440 }
30441 !! html/parsoid
30442 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30443 !! wikitext
30444 !! end
30445
30446 !! test
30447 2. Anchors: don't suppress empty anchors if scrubWikitext is false
30448 !! options
30449 parsoid={
30450 "modes": ["html2wt"],
30451 "scrubWikitext": false
30452 }
30453 !! html/parsoid
30454 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
30455 !! wikitext
30456 [[Test|<nowiki/>]]
30457 !! end
30458
30459 !! test
30460 3. Anchors: suppress empty anchors on edits
30461 !! options
30462 parsoid={
30463 "modes": ["selser"],
30464 "scrubWikitext": true,
30465 "changes": [
30466 [ "#x", "remove"]
30467 ]
30468 }
30469 !! wikitext
30470 [[Test|<span id="x">foo</span>]]
30471 !! wikitext/edited
30472 !! end
30473
30474 !! test
30475 3a. Anchors: do not suppress numbered extlinks
30476 !! options
30477 parsoid={
30478 "modes": ["wt2wt"],
30479 "scrubWikitext": true
30480 }
30481 !! wikitext
30482 [http://foo.com]
30483 !! html/parsoid
30484 <a rel="mw:ExtLink" href="http://foo.com"></a>
30485 !! end
30486
30487 !! test
30488 3b. Anchors: do not suppress numbered extlinks
30489 !! options
30490 parsoid={
30491 "modes": ["wt2wt"],
30492 "scrubWikitext": true,
30493 "changes": [
30494 [ "#x", "remove"]
30495 ]
30496 }
30497 !! wikitext
30498 [http://foo.com <span id="x">foo</span>]
30499 !! wikitext/edited
30500 [http://foo.com]
30501 !! end
30502
30503 !!test
30504 Normalizations should be restricted to edited content
30505 !!options
30506 parsoid={
30507 "modes": ["selser"],
30508 "scrubWikitext": true,
30509 "changes": [
30510 [ "h1", "before", "<i></i>"]
30511 ]
30512 }
30513 !!wikitext
30514 a
30515 = =
30516 b
30517 !!wikitext/edited
30518 a
30519 = =
30520 b
30521 !!end
30522
30523 !! test
30524 1. Multiple normalizations (html2wt)
30525 !! options
30526 parsoid={
30527 "modes": ["html2wt"],
30528 "scrubWikitext": true
30529 }
30530 !! html/parsoid
30531 <h2><i></i></h2>
30532 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
30533 </a><b><i></i></b>x</p>
30534 !! wikitext
30535
30536 [[foo]]
30537 x
30538 !! end
30539
30540 !! test
30541 2. Multiple normalizations (selser)
30542 !! options
30543 parsoid={
30544 "modes": ["selser"],
30545 "scrubWikitext": true,
30546 "changes": [
30547 [ "#x", "after", "<h1><i></i></h1>\n<p> bar<b></b></p>"]
30548 ]
30549 }
30550 !! wikitext
30551 <div id="x">foo</div>
30552 !! wikitext/edited
30553 <div id="x">foo</div>
30554 bar
30555 !! end
30556
30557 !! test
30558 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
30559 !! options
30560 parsoid={
30561 "modes": ["html2wt"],
30562 "scrubWikitext": true
30563 }
30564 !! html/parsoid
30565 <p> hi</p>
30566 <p> hello</p>
30567 !! wikitext
30568 hi
30569
30570 hello
30571 !! end
30572
30573 !! test
30574 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
30575 !! options
30576 parsoid=html2wt
30577 !! html/parsoid
30578 <p> hi</p>
30579 <p> hello</p>
30580 !! wikitext
30581 <nowiki> </nowiki>hi
30582
30583 <nowiki> </nowiki> hello
30584 !! end
30585
30586 !! test
30587 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
30588 !! options
30589 parsoid={
30590 "modes": ["html2wt"],
30591 "scrubWikitext": true
30592 }
30593 !! html/parsoid
30594 <p>Foo
30595 bar
30596 baz</p>
30597
30598 <table><tr><td>Foo
30599 bar
30600 baz bang</td></tr></table>
30601
30602 <p><!--boo--> foo
30603 bar</p>
30604
30605 <p> foo
30606 bar<span>boo</span></p>
30607 !! wikitext
30608 Foo
30609 bar
30610 baz
30611
30612 {|
30613 |Foo
30614 bar
30615 baz bang
30616 |}
30617
30618 <!--boo-->foo
30619 bar
30620
30621 foo
30622 bar<span>boo</span>
30623 !! end
30624
30625 !! test
30626 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
30627 !! options
30628 parsoid={
30629 "modes": ["selser"],
30630 "scrubWikitext": true,
30631 "changes": [
30632 [ "p", "html", " a\n b" ]
30633 ]
30634 }
30635 !! wikitext
30636 xyz
30637 !! wikitext/edited
30638 a
30639 b
30640 !! end
30641
30642 !! test
30643 1. New links that end in spaces
30644 !! options
30645 parsoid={
30646 "modes": ["html2wt"],
30647 "scrubWikitext": false
30648 }
30649 !! html/parsoid
30650 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30651 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30652 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30653 !! wikitext
30654 [[Berlin ]]<nowiki/>is the capital of Germany.
30655
30656 [[Foo ]]'''bar'''
30657
30658 [[Boston ]] is a city.
30659 !! end
30660
30661 !! test
30662 2. New links that end in spaces
30663 !! options
30664 parsoid={
30665 "modes": ["html2wt"],
30666 "scrubWikitext": true
30667 }
30668 !! html/parsoid
30669 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
30670 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
30671 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
30672 !! wikitext
30673 [[Berlin]] is the capital of Germany.
30674
30675 [[Foo]] '''bar'''
30676
30677 [[Boston]] is a city.
30678 !! end
30679
30680 !! test
30681 1. Table cells with escapable prefixes
30682 !! options
30683 parsoid={
30684 "modes": ["html2wt"],
30685 "scrubWikitext": false
30686 }
30687 !! html/parsoid
30688 <table>
30689 <tr><td>a</td></tr>
30690 <tr><td>-</td></tr>
30691 <tr><td>+</td></tr>
30692 <tr><td>}</td></tr>
30693 </table>
30694 !! wikitext
30695 {|
30696 |a
30697 |-
30698 |<nowiki>-</nowiki>
30699 |-
30700 |<nowiki>+</nowiki>
30701 |-
30702 |<nowiki>}</nowiki>
30703 |}
30704 !! end
30705
30706 !! test
30707 2. Table cells with escapable prefixes
30708 !! options
30709 parsoid={
30710 "modes": ["html2wt"],
30711 "scrubWikitext": true
30712 }
30713 !! html/parsoid
30714 <table>
30715 <tr><td>a</td></tr>
30716 <tr><td>-</td></tr>
30717 <tr><td>+</td></tr>
30718 <tr><td>}</td></tr>
30719 </table>
30720 !! wikitext
30721 {|
30722 |a
30723 |-
30724 | -
30725 |-
30726 | +
30727 |-
30728 | }
30729 |}
30730 !! end
30731
30732 !! test
30733 3a. Table cells with escapable prefixes after edits
30734 !! options
30735 parsoid={
30736 "modes": ["selser"],
30737 "scrubWikitext": true,
30738 "changes": [
30739 [ "table tbody tr:first-child td:first-child", "remove"]
30740 ]
30741 }
30742 !! wikitext
30743 {|
30744 |a||-
30745 |}
30746 !! wikitext/edited
30747 {|
30748 | -
30749 |}
30750 !! end
30751
30752 !! test
30753 3b. Table cells with escapable prefixes after edits
30754 !! options
30755 parsoid={
30756 "modes": ["selser"],
30757 "scrubWikitext": true,
30758 "changes": [
30759 [ "table tbody tr:first-child td:first-child", "html", "-" ],
30760 [ "#x", "remove" ]
30761 ]
30762 }
30763 !! wikitext
30764 {|
30765 |pqr
30766 |<span id="x">foo</span>+
30767 |}
30768 !! wikitext/edited
30769 {|
30770 | -
30771 | +
30772 |}
30773 !! end
30774
30775 # FIXME: This test will fail because
30776 # normalization doesn't realize that the id attribute
30777 # will eliminate the escapable scenario
30778 !! test
30779 4a. Table cells without escapable prefixes after edits
30780 !! options
30781 parsoid={
30782 "modes": ["selser"],
30783 "scrubWikitext": true,
30784 "changes": [
30785 [ "#x", "html", "-" ]
30786 ]
30787 }
30788 !! wikitext
30789 {|
30790 | id="x" |abcd
30791 |}
30792 !! wikitext/edited
30793 {|
30794 | id="x" |-
30795 |}
30796 !! end
30797
30798 ## This tests normalizer's ability to discriminate between
30799 ## cells having identical content.
30800 !! test
30801 4b. Table cells without escapable prefixes after edits
30802 !! options
30803 parsoid={
30804 "modes": ["selser"],
30805 "scrubWikitext": true,
30806 "changes": [
30807 [ "td", "html", "-" ]
30808 ]
30809 }
30810 !! wikitext
30811 {|
30812 |a||b
30813 |}
30814 !! wikitext/edited
30815 {|
30816 | -||-
30817 |}
30818 !! end
30819
30820 ## This tests normalizer's ability to not be tripped by
30821 ## comments (and whitespace)
30822 !! test
30823 4c. Table cells without escapable prefixes after edits
30824 !! options
30825 parsoid={
30826 "modes": ["selser"],
30827 "scrubWikitext": true,
30828 "changes": [
30829 [ "table tbody tr td:first-child", "remove" ]
30830 ]
30831 }
30832 !! wikitext
30833 {|
30834 |-
30835 <!--foo--> |a||-
30836 |}
30837 !! wikitext/edited
30838 {|
30839 |-
30840 <!--foo--> | -
30841 |}
30842 !! end
30843
30844 ## This tests normalizer's ability to handle HTML cells
30845 !! test
30846 4d. Table cells without escapable prefixes after edits
30847 !! options
30848 parsoid={
30849 "modes": ["selser"],
30850 "scrubWikitext": true,
30851 "changes": [
30852 [ "td", "html", "-" ]
30853 ]
30854 }
30855 !! wikitext
30856 <table>
30857 <tr><td>a</td></tr>
30858 </table>
30859 !! wikitext/edited
30860 <table>
30861 <tr><td>-</td></tr>
30862 </table>
30863 !! end
30864
30865 ## T111151 Remove font elements without attributes
30866 !! test
30867 5a. font tags without attributes should be dropped in scrubWikitext mode
30868 !! options
30869 parsoid={
30870 "modes": ["html2wt"],
30871 "scrubWikitext": true
30872 }
30873 !! html/parsoid
30874 <font>foo</font>
30875 <font><font>bar</font></font>
30876 <font class="x">boo</font>
30877 !! wikitext
30878 foo
30879 bar
30880 <font class="x">boo</font>
30881 !! end
30882
30883 !! test
30884 5b. font tags should not be dropped without scrubWikitext being enabled
30885 !! options
30886 parsoid={
30887 "modes": ["html2wt"],
30888 "scrubWikitext": false
30889 }
30890 !! html/parsoid
30891 <font>foo</font>
30892 !! wikitext
30893 <font>foo</font>
30894 !! end
30895
30896 !! test
30897 Ignore empty <p></p> when scrubWikitext is false
30898 !! options
30899 parsoid={
30900 "modes": ["html2wt"],
30901 "scrubWikitext": false
30902 }
30903 !! html/parsoid
30904 <div>1</div>
30905 <p>a</p><p></p><p>b</p>
30906 <div>2</div>
30907 <p>a</p>
30908 <p></p>
30909 <p>b</p>
30910 <div>3</div>
30911 <p>a</p>
30912 <p></p>
30913 <p></p>
30914 <p></p>
30915 <p></p>
30916 <p>b</p>
30917 !! wikitext
30918 <div>1</div>
30919 a
30920
30921 b
30922 <div>2</div>
30923 a
30924
30925 b
30926 <div>3</div>
30927 a
30928
30929 b
30930 !! html/php+tidy
30931 <div>1</div>
30932 <p>a
30933 </p><p>b
30934 </p>
30935 <div>2</div>
30936 <p>a
30937 </p><p>b
30938 </p>
30939 <div>3</div>
30940 <p>a
30941 </p><p>b
30942 </p>
30943 !! end
30944
30945 !! test
30946 Normalize empty paragraphs to HTML form that html2wt expects
30947 !! options
30948 parsoid={
30949 "modes": ["html2wt"],
30950 "scrubWikitext": true
30951 }
30952 !! html/parsoid
30953 <div>1</div>
30954 <p>a</p><p></p><p>b</p>
30955 <div>2</div>
30956 <p>a</p>
30957 <p></p>
30958 <p>b</p>
30959 <div>3</div>
30960 <p>a</p>
30961 <p></p>
30962 <p></p>
30963 <p></p>
30964 <p></p>
30965 <p>b</p>
30966 <div>4</div>
30967 <p>a</p>
30968 <p></p>
30969 <div>foo</div>
30970 !! wikitext
30971 <div>1</div>
30972 a
30973
30974
30975 b
30976 <div>2</div>
30977 a
30978
30979
30980 b
30981 <div>3</div>
30982 a
30983
30984
30985
30986
30987
30988 b
30989 <div>4</div>
30990 a
30991
30992 <br />
30993 <div>foo</div>
30994 !! html/php+tidy
30995 <div>1</div>
30996 <p>a
30997 </p><p><br />
30998 b
30999 </p>
31000 <div>2</div>
31001 <p>a
31002 </p><p><br />
31003 b
31004 </p>
31005 <div>3</div>
31006 <p>a
31007 </p><p><br />
31008 </p><p><br />
31009 </p><p>b
31010 </p>
31011 <div>4</div>
31012 <p>a
31013 </p><p><br />
31014 </p>
31015 <div>foo</div>
31016 !! end
31017
31018 !! test
31019 Empty paragraphs (marked with mw-empty-elt) found in source should not be normalized away
31020 !! options
31021 parsoid={
31022 "modes": ["html2wt"],
31023 "scrubWikitext": true
31024 }
31025 !! html/parsoid
31026 <table>
31027 <tbody>
31028 <tr>
31029 <td><div>foo
31030 </div>
31031 <p class="mw-empty-elt"></p>
31032 </td>
31033 </tr>
31034 </tbody>
31035 <caption></caption>
31036 </table>
31037 !! wikitext
31038 {|
31039 |<div>foo
31040 </div>
31041 |+
31042 |}
31043 !! end
31044
31045 !! test
31046 Templated content should be skipped over by normalization
31047 !! options
31048 parsoid={
31049 "modes": ["html2wt"],
31050 "scrubWikitext": true
31051 }
31052 !! html/parsoid
31053 <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">
31054 </span><p about="#mwt2"></p><span about="#mwt2">
31055 </span>
31056 !! wikitext
31057 {{SomeTemplate1|boo}}{{SomeTemplate2|booboo}}
31058 !! end
31059
31060 !! test
31061 Escape nowiki DOM elements
31062 !! options
31063 parsoid=html2wt
31064 !! html/parsoid
31065 <nowiki><i>foo</i></nowiki>
31066 !! wikitext
31067 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
31068 !! end
31069
31070 # This is meant to be an interim fix while we go about figuring out
31071 # how to not introduce these trailing <nowiki/>s in the first place.
31072 !! test
31073 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
31074 !! options
31075 parsoid=html2wt
31076 !! html/parsoid
31077 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
31078 y</p>
31079 <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>
31080 <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>
31081 !! wikitext
31082 x
31083 y
31084
31085 {{echo|
31086 1 = <nowiki/>}}
31087
31088 {{echo|
31089 1 = <nowiki/>
31090 }}
31091 !! end
31092
31093 !! test
31094 New list is serialized on newlines
31095 !! options
31096 parsoid=html2wt
31097 !! html/parsoid
31098 <p>The quick brown fox jumps over the lazy dog.</p><ul>
31099 <li>Yesterday</li>
31100 <li>Today</li>
31101 <li>Tomorrow</li>
31102 </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
31103 !! wikitext
31104 The quick brown fox jumps over the lazy dog.
31105
31106 * Yesterday
31107 * Today
31108 * Tomorrow
31109
31110 The quick onyx goblin jumps over the lazy dwarf.
31111 !! end
31112
31113 !! test
31114 New lists in formatting elements serialized w/o newlines
31115 !! options
31116 parsoid=html2wt
31117 !! html/parsoid
31118 <small>
31119
31120 <ul>
31121 <li>123</li>
31122 </ul>
31123
31124 </small>
31125
31126 <small><ul><li>hi</li></ul></small>
31127 !! wikitext
31128 <small>
31129 * 123
31130 </small>
31131
31132 <small>
31133 * hi
31134 </small>
31135 !! end
31136
31137 !! test
31138 New list in table doesn't need newlines
31139 !! options
31140 parsoid=html2wt
31141 !! html/parsoid
31142 <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
31143 !! wikitext
31144 {|
31145 |
31146 * test
31147 * 123
31148 |}
31149 !! end
31150
31151 # ---------------------------------------------------
31152 # End of tests spec'ing wikitext serialization norms |
31153 # ---------------------------------------------------
31154
31155 # T104032
31156 !! test
31157 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
31158 !! options
31159 parsoid=html2wt
31160 !! html/parsoid
31161 a<p>b</p>
31162 <b>c</b><p>d</p>
31163 <table><tr>
31164 <td>a<p>b</p></td>
31165 <td><b>c</b><p>d</p></td>
31166 </tr></table>
31167 !! wikitext
31168 a
31169
31170 b
31171
31172 '''c'''
31173
31174 d
31175 {|
31176 |a
31177 b
31178 |'''c'''
31179 d
31180 |}
31181 !! end
31182
31183 !! test
31184 Anchor without href scenarios
31185 !! options
31186 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
31187 !! html/parsoid
31188 <a class="bc"></a>
31189 <a class="no">dice</a>
31190 <a name="foo"></a>
31191 !! wikitext
31192
31193 dice
31194 <span name="foo"></span>
31195 !! end
31196
31197 !! test
31198 New transclusion added after a list should be serialized after the list
31199 !! options
31200 parsoid=html2wt
31201 !! html/parsoid
31202 <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>
31203 !! wikitext
31204 * a
31205 {{echo|foo}}
31206 !! end
31207
31208 # -----------------------------------------------------------------
31209 # End of section for Parsoid-only html2wt tests for serialization
31210 # of new content
31211 # -----------------------------------------------------------------
31212
31213 # -----------------------------------------------------------------
31214 # The following section of tests are primarily to spec behavior of
31215 # the selective serializer. All these tests have manual selser
31216 # changes. The automated selser changes for all tests handle the
31217 # wide variation of changes, but these tests here capture specs
31218 # deterministically.
31219 # ----------------------------------------------------------------
31220
31221 ## T90517
31222 !! test
31223 Selser: New comments should not be lost
31224 !! options
31225 parsoid={
31226 "modes": ["selser"],
31227 "changes": [
31228 [ "#a", "after", "<!--c1-->" ],
31229 [ "#b", "before", "<!--c2-->" ]
31230 ]
31231 }
31232 !! wikitext
31233 <span id="a">a</span>
31234
31235 <span id="b">b</span>
31236 !! wikitext/edited
31237 <span id="a">a</span><!--c1-->
31238
31239 <!--c2--><span id="b">b</span>
31240 !! end
31241
31242 ## T89383
31243 !! test
31244 Selser: Check for validity of DSR before using it
31245 !! options
31246 parsoid={
31247 "modes": ["selser"],
31248 "changes": [
31249 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
31250 ]
31251 }
31252 !! wikitext
31253 <span id="a">a</span>
31254 !! wikitext/edited
31255 {{DISPLAYTITLE:foo}}
31256 <span id="a">a</span>
31257 !! end
31258
31259 !! test
31260 1. DOMDiff: Changes to <ref> content should be looked up using id
31261 !! options
31262 parsoid={
31263 "modes": ["selser"],
31264 "changes": [
31265 ["#X", "after", "bar"],
31266 ["#Y", "after", "baz"]
31267 ]
31268 }
31269 !! wikitext
31270 X <ref><span id="X">foo</span></ref>
31271 Y <ref name="a" />
31272 <references>
31273 <ref name="a"><span id="Y">foo</span></ref>
31274 </references>
31275 !! wikitext/edited
31276 X <ref><span id="X">foo</span>bar</ref>
31277 Y <ref name="a" />
31278 <references>
31279 <ref name="a"><span id="Y">foo</span>baz</ref>
31280 </references>
31281 !! end
31282
31283 !! test
31284 2. DOMDiff: Changes to <ref> content should be looked up using id
31285 !! options
31286 parsoid={
31287 "modes": ["selser"],
31288 "changes": [
31289 ["#Z", "after", "bar"]
31290 ]
31291 }
31292 !! wikitext
31293 A <ref>foo bar for a</ref>
31294 B <ref group="X" name="b" />
31295
31296 <references />
31297
31298 <references group="X">
31299 <ref name="b"><span id="Z">foo</span></ref>
31300 </references>
31301 !! wikitext/edited
31302 A <ref>foo bar for a</ref>
31303 B <ref group="X" name="b" />
31304
31305 <references />
31306
31307 <references group="X">
31308 <ref name="b"><span id="Z">foo</span>bar</ref>
31309 </references>
31310 !! end
31311
31312 !! test
31313 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
31314 !! options
31315 parsoid={
31316 "modes": ["selser"],
31317 "changes": [
31318 [ "div:first-child", "text", "bar" ]
31319 ]
31320 }
31321 !! wikitext
31322 <div style="{{1x|color:red;}}%">foo</div>
31323 !! wikitext/edited
31324 <div style="{{1x|color:red;}}%">bar</div>
31325 !! end
31326
31327 !! test
31328 Empty LI (T49673)
31329 !! wikitext
31330 *a
31331 *
31332 *
31333 *b
31334 !! html+tidy
31335 <ul><li>a</li>
31336 <li class="mw-empty-elt"></li>
31337 <li class="mw-empty-elt"></li>
31338 <li>b</li></ul>
31339 !! end
31340
31341 !! test
31342 Thumbnail output
31343 !! wikitext
31344 [[File:Thumb.png|thumb]]
31345 !! html/php+tidy
31346 <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>
31347 !! html/parsoid
31348 <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>
31349 !! end
31350
31351 !! test
31352 unclosed internal link XSS (T137264)
31353 !! wikitext
31354 [[#%3Cscript%3Ealert(1)%3C/script%3E|
31355 !! html/php
31356 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
31357 </p>
31358 !! html/parsoid
31359 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
31360 !! end
31361
31362 !! test
31363 Validating that <style> isn't eaten by tidy (T167349)
31364 !! options
31365 styletag=1
31366 !! wikitext
31367 <div class="foo">
31368 <style>.foo::before { content: "<foo>"; }</style>
31369 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31370 </div>
31371 !! html/php+tidy
31372 <div class="foo">
31373 <style>.foo::before { content: "<foo>"; }</style>
31374 <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
31375 </div>
31376 !! html/parsoid
31377 <div class="foo">
31378 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31379 <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>
31380 </div>
31381 !! end
31382
31383 ## Right now, Parsoid doesn't de-duplicate style tags.
31384 ## So, we shouldn't see link tags that need to bypass the sanitizer.
31385 ## In a followup patch, when we de-duplicate style tags and
31386 ## introduce link tags, we'll add a hook for link tags in
31387 ## the parser test runner script.
31388 !! test
31389 Validating that <style> isn't wrapped in a paragraph (T186965)
31390 !! options
31391 styletag=1
31392 !! wikitext
31393 A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31394
31395 <style>.foo::before { content: "<foo>"; }</style>
31396
31397 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31398
31399 But if it's on a line with other content, let it be wrapped.
31400
31401 <style>.foo::before { content: "<foo>"; }</style> bar
31402
31403 foo <style>.foo::before { content: "<foo>"; }</style>
31404
31405 foo <style>.foo::before { content: "<foo>"; }</style> bar
31406
31407 And the same if we have non-paragraph-breaking whitespace
31408
31409 foo
31410 <style>.foo::before { content: "<foo>"; }</style>
31411 bar
31412 !! html/php
31413 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31414 </p>
31415 <style>.foo::before { content: "<foo>"; }</style>
31416 <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
31417 <p>But if it's on a line with other content, let it be wrapped.
31418 </p><p><style>.foo::before { content: "<foo>"; }</style> bar
31419 </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
31420 </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
31421 </p><p>And the same if we have non-paragraph-breaking whitespace
31422 </p><p>foo
31423 <style>.foo::before { content: "<foo>"; }</style>
31424 bar
31425 </p>
31426 !! html/parsoid
31427 <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph</p>
31428
31429 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31430
31431 <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>
31432
31433 <p>But if it's on a line with other content, let it be wrapped.</p>
31434
31435 <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>
31436
31437 <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>
31438
31439 <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>
31440
31441 <p>And the same if we have non-paragraph-breaking whitespace</p>
31442
31443 <p>foo
31444 <style typeof="mw:Extension/style" data-mw='{"name":"style","attrs":{},"body":{"extsrc":".foo::before { content: \"&lt;foo>\"; }"}}'>.foo::before { content: "<foo>"; }</style>
31445 bar</p>
31446 !! end
31447
31448 !! test
31449 Validating that <link> isn't wrapped in a paragraph (T186965)
31450 !! options
31451 styletag=1
31452 !! wikitext
31453 A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31454
31455 <link rel="foo" href="bar"/>
31456
31457 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31458
31459 But if it's on a line with other content, let it be wrapped.
31460
31461 <link rel="foo" href="bar"/> bar
31462
31463 foo <link rel="foo" href="bar"/>
31464
31465 foo <link rel="foo" href="bar"/> bar
31466
31467 And the same if we have non-paragraph-breaking whitespace
31468
31469 foo
31470 <link rel="foo" href="bar"/>
31471 bar
31472 !! html/php
31473 <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
31474 </p>
31475 <link rel="foo" href="bar"/>
31476 <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
31477 <p>But if it's on a line with other content, let it be wrapped.
31478 </p><p><link rel="foo" href="bar"/> bar
31479 </p><p>foo <link rel="foo" href="bar"/>
31480 </p><p>foo <link rel="foo" href="bar"/> bar
31481 </p><p>And the same if we have non-paragraph-breaking whitespace
31482 </p><p>foo
31483 <link rel="foo" href="bar"/>
31484 bar
31485 </p>
31486 !! end
31487
31488 !! test
31489 Extension returning multiple nodes starting with a style tag roundtrips
31490 !! options
31491 wgRawHtml=1
31492 !! wikitext
31493 <table>
31494 {{echo|<html><style>.hi { color: red; }</style>
31495 </html>}}
31496 <tr><td class="hi">ho</td></tr>
31497 </table>
31498 !! html/parsoid
31499 <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">
31500 </span></p><table about="#mwt5" data-parsoid='{"stx":"html"}'>
31501
31502 <tbody><tr><td class="hi">ho</td></tr>
31503 </tbody></table>
31504 !! end
31505
31506 !! test
31507 Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
31508 !! config
31509 wgFragmentMode=[ 'html5', 'legacy' ]
31510 !! wikitext
31511 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31512 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31513 !! html/php
31514 <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>
31515 <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>
31516 </p>
31517 !! html/parsoid
31518 <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>
31519 <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>
31520 !! end
31521
31522 !! test
31523 Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
31524 !! config
31525 wgFragmentMode=[ 'legacy' ]
31526 !! wikitext
31527 ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
31528 [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
31529 !! html/php
31530 <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>
31531 <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
31532 </p>
31533 !! end
31534
31535 !! test
31536 Decoding of HTML entities in embedded HTML tags
31537 !! wikitext
31538 <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31539 !! html/php
31540 <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
31541 !! html/parsoid
31542 <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>
31543 !! end
31544
31545 !! test
31546 Decoding of HTML entities in indicator names for IDs (T104196)
31547 !! options
31548 parsoid=wt2html,html2html
31549 showindicators
31550 !! wikitext
31551 <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31552 !! html/php
31553 1&2&3&amp;4&amp;amp;5=Indicator
31554
31555 !! html/parsoid
31556 <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>
31557 !! end
31558
31559 # this version of the test strips out the ambiguity so Parsoid rts cleanly
31560 !! test
31561 Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
31562 !! options
31563 showindicators
31564 !! wikitext
31565 <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
31566 !! html/php
31567 1&2&3&amp;4&amp;amp;5=Indicator
31568
31569 !! html/parsoid
31570 <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>
31571 !! end
31572
31573 # This fragment mode is what Parsoid supports.
31574 !! test
31575 HTML5 ids: fallback to legacy
31576 !! config
31577 wgFragmentMode=[ 'html5', 'legacy' ]
31578 !! wikitext
31579 ==Foo bar==
31580
31581 ==foo Bar==
31582
31583 ==Тест==
31584
31585 ==Тест==
31586
31587 ==тест==
31588
31589 ==Hey < # " > % : '==
31590 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31591
31592 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31593
31594 <!-- These two links should produce identical HTML -->
31595 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31596
31597 !! html/php
31598 <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>
31599 <ul>
31600 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31601 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31602 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31603 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31604 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31605 <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>
31606 </ul>
31607 </div>
31608
31609 <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>
31610 <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>
31611 <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>
31612 <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>
31613 <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>
31614 <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>
31615 <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>
31616 </p><p>💩 <span id="💩"></span>
31617 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31618 </p>
31619 !! html/parsoid
31620 <h2 id="Foo_bar">Foo bar</h2>
31621
31622 <h2 id="foo_Bar_2">foo Bar</h2>
31623
31624 <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
31625
31626 <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
31627
31628 <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
31629
31630 <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>
31631 <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>
31632
31633 <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>
31634
31635 <!-- These two links should produce identical HTML -->
31636 <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>
31637 !! end
31638
31639 # Parsoid doesn't support this mode
31640 !! test
31641 HTML5 ids: legacy with a fallback to modern
31642 !! config
31643 wgFragmentMode=[ 'legacy', 'html5' ]
31644 !! wikitext
31645 ==Foo bar==
31646
31647 ==foo Bar==
31648
31649 ==Тест==
31650
31651 ==Тест==
31652
31653 ==тест==
31654
31655 ==Hey < # " > % : '==
31656 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31657
31658 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31659
31660 <!-- These two links should produce identical HTML -->
31661 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31662
31663 !! html/php
31664 <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>
31665 <ul>
31666 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31667 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31668 <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>
31669 <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>
31670 <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>
31671 <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>
31672 </ul>
31673 </div>
31674
31675 <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>
31676 <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>
31677 <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>
31678 <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>
31679 <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>
31680 <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>
31681 <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>
31682 </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
31683 </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
31684 </p>
31685 !! end
31686
31687 # Parsoid doesn't support this mode.
31688 !! test
31689 HTML5 ids: no legacy
31690 !! config
31691 wgFragmentMode=[ 'html5' ]
31692 !! wikitext
31693 ==Foo bar==
31694
31695 ==foo Bar==
31696
31697 ==Тест==
31698
31699 ==Тест==
31700
31701 ==тест==
31702
31703 ==Hey < # " > % : '==
31704 [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
31705
31706 {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
31707
31708 <!-- These two links should produce identical HTML -->
31709 [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
31710
31711 !! html/php
31712 <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>
31713 <ul>
31714 <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
31715 <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
31716 <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
31717 <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
31718 <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
31719 <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>
31720 </ul>
31721 </div>
31722
31723 <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>
31724 <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>
31725 <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>
31726 <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>
31727 <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>
31728 <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>
31729 <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>
31730 </p><p>💩 <span id="💩"></span>
31731 </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
31732 </p>
31733 !! end
31734
31735 !! test
31736 T90902: Normalize weird characters in section IDs
31737 !! config
31738 wgFragmentMode=[ 'html5', 'legacy' ]
31739 !! wikitext
31740 ==Foo&nbsp;bar==
31741 [[#Foo&nbsp;bar]]
31742
31743 !! html/php
31744 <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>
31745 <p><a href="#Foo_bar">#Foo&#160;bar</a>
31746 </p>
31747 !! html/parsoid
31748 <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
31749 <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>
31750 !! end
31751
31752 !! test
31753 T51672: Test for brackets in attributes of elements in external link texts
31754 !! wikitext
31755 [http://example.com/ link <span title="title with [brackets]">span</span>]
31756 [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
31757
31758 !! html/php
31759 <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31760 <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
31761 </p>
31762 !! html/parsoid
31763 <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
31764 <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>
31765 !! end
31766
31767 !! test
31768 T72875: Test for brackets in attributes of elements in internal link texts
31769 !! wikitext
31770 [[Foo|link <span title="title with [[double brackets]]">span</span>]]
31771 [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
31772
31773 !! html/php
31774 <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31775 <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
31776 </p>
31777 !! html/parsoid
31778 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
31779 <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>
31780 !! end
31781
31782 !! test
31783 T199926: html arrow wt: Parsoid sometimes trips up on verticalbar chars in hrefs
31784 !! options
31785 parsoid={
31786 "modes": ["html2wt"]
31787 }
31788 !! html/parsoid
31789 <a href="https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total">9</a>
31790 <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>
31791 !! wikitext
31792 [https://stats.wikimedia.org/v2/#/fr.wikipedia.org/reading/page-views-by-country/normal|map|2-Year~2016060100~2018071100|~total 9]
31793 [[stats:v2/#/fr.wikipedia.org/reading/page-views-by-country/normal%7Cmap%7C2-Year~2016060100~2018071100%7C~total|10]]
31794 !! end
31795
31796 ## FIXME: "gerrit" isn't in PHP's setupInterwikis
31797 !! test
31798 T199926: Hash only interwiki link
31799 !! wikitext
31800 [[meatball:Test#1/2]]
31801 [[gerrit:#/q/project:mediawiki/services/parsoid|Gerrit]]
31802 !! html/php+tidy
31803 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Test#1.2F2" class="extiw" title="meatball:Test">meatball:Test#1/2</a>
31804 <a href="/index.php?title=Gerrit:&amp;action=edit&amp;redlink=1" class="new" title="Gerrit: (page does not exist)">Gerrit</a>
31805 </p>
31806 !! html/parsoid
31807 <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>
31808 <a rel="mw:WikiLink/Interwiki" href="https://gerrit.wikimedia.org/#/q/project:mediawiki/services/parsoid">Gerrit</a></p>
31809 !! end
31810
31811 !! test
31812 T179544: {{anchorencode:}} output should be always usable in links
31813 !! config
31814 wgFragmentMode=[ 'html5' ]
31815 !! wikitext
31816 <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
31817 !! html/php
31818 <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
31819 </p>
31820 !! html/parsoid
31821 <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>
31822 !! end
31823
31824 ## ------------------------------
31825 ## Parsoid section-wrapping tests
31826 ## ------------------------------
31827 !! test
31828 Section wrapping for well-nested sections (no leading content)
31829 !! options
31830 notoc
31831 parsoid={
31832 "wrapSections": true
31833 }
31834 !! wikitext
31835 =1=
31836 a
31837
31838 =2=
31839 b
31840
31841 ==2.1==
31842 c
31843
31844 ==2.2==
31845 d
31846
31847 ===2.2.1===
31848 e
31849
31850 =3=
31851 f
31852 !! html/php+tidy
31853
31854 <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>
31855 <p>a
31856 </p>
31857 <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>
31858 <p>b
31859 </p>
31860 <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>
31861 <p>c
31862 </p>
31863 <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>
31864 <p>d
31865 </p>
31866 <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>
31867 <p>e
31868 </p>
31869 <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>
31870 <p>f
31871 </p>
31872 !! html/parsoid
31873 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31874 <p>a</p>
31875
31876 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
31877 <p>b</p>
31878
31879 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
31880 <p>c</p>
31881
31882 </section><section data-mw-section-id="4"><h2 id="2.2" data-parsoid="{}">2.2</h2>
31883 <p>d</p>
31884
31885 <section data-mw-section-id="5"><h3 id="2.2.1" data-parsoid="{}">2.2.1</h3>
31886 <p>e</p>
31887
31888 </section></section></section><section data-mw-section-id="6"><h1 id="3" data-parsoid="{}">3</h1>
31889 <p>f</p>
31890
31891 </section>
31892 !! end
31893
31894 !! test
31895 Section wrapping for well-nested sections (with leading content)
31896 !! options
31897 notoc
31898 parsoid={
31899 "wrapSections": true
31900 }
31901 !! wikitext
31902 Para 1.
31903
31904 Para 2 with a <div>nested in it</div>
31905
31906 Para 3.
31907
31908 =1=
31909 a
31910
31911 =2=
31912 b
31913
31914 ==2.1==
31915 c
31916 !! html/php+tidy
31917 <p>Para 1.
31918 </p><p>
31919 Para 2 with a </p><div>nested in it</div>
31920 <p>Para 3.
31921 </p>
31922 <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>
31923 <p>a
31924 </p>
31925 <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>
31926 <p>b
31927 </p>
31928 <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>
31929 <p>c
31930 </p>
31931 !! html/parsoid
31932 <section data-mw-section-id="0"><p>Para 1.</p>
31933
31934 <p>Para 2 with a </p><div>nested in it</div>
31935
31936 <p>Para 3.</p>
31937
31938 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31939 <p>a</p>
31940
31941 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
31942 <p>b</p>
31943
31944 <section data-mw-section-id="3"><h2 id="2.1" data-parsoid="{}">2.1</h2>
31945 <p>c</p>
31946
31947 </section></section>
31948 !! end
31949
31950 !! test
31951 Section wrapping with template-generated sections (good nesting 1)
31952 !! options
31953 notoc
31954 parsoid={
31955 "wrapSections": true
31956 }
31957 !! wikitext
31958 =1=
31959 a
31960
31961 {{echo|1=
31962 ==1.1==
31963 b
31964 }}
31965 ==1.2==
31966 c
31967
31968 =2=
31969 d
31970 !! html/php+tidy
31971
31972 <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>
31973 <p>a
31974 </p>
31975 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
31976 <p>b
31977 </p>
31978 <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>
31979 <p>c
31980 </p>
31981 <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>
31982 <p>d
31983 </p>
31984 !! html/parsoid
31985 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
31986 <p>a</p>
31987
31988 <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">
31989 </span><p about="#mwt1">b</p>
31990 </section><section data-mw-section-id="3"><h2 id="1.2" data-parsoid="{}">1.2</h2>
31991 <p>c</p>
31992
31993 </section></section><section data-mw-section-id="4"><h1 id="2" data-parsoid="{}">2</h1>
31994 <p>d</p></section>
31995 !! end
31996
31997 # In this example, the template scope is mildly expanded to incorporate the
31998 # trailing newline after the transclusion since that is part of section 1.1.1
31999 !! test
32000 Section wrapping with template-generated sections (good nesting 2)
32001 !! options
32002 notoc
32003 parsoid={
32004 "wrapSections": true,
32005 "modes": ["wt2html", "wt2wt"]
32006 }
32007 !! wikitext
32008 =1=
32009 a
32010
32011 {{echo|1=
32012 ==1.1==
32013 b
32014 ===1.1.1===
32015 d
32016 }}
32017 =2=
32018 e
32019 !! html/php+tidy
32020
32021 <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>
32022 <p>a
32023 </p>
32024 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32025 <p>b
32026 </p>
32027 <h3><span class="mw-headline" id="1.1.1">1.1.1</span></h3>
32028 <p>d
32029 </p>
32030 <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>
32031 <p>e
32032 </p>
32033 !! html/parsoid
32034 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
32035 <p>a</p>
32036
32037 <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">
32038 </span><p about="#mwt1">b</p><span about="#mwt1">
32039 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
32040 </span><p about="#mwt1">d</p><span about="#mwt1">
32041 </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
32042 <p>e</p></section>
32043 !! end
32044
32045 # In this example, the template scope is mildly expanded to incorporate the
32046 # trailing newline after the transclusion since that is part of section 1.2.1
32047 !! test
32048 Section wrapping with template-generated sections (good nesting 3)
32049 !! options
32050 notoc
32051 parsoid={
32052 "wrapSections": true,
32053 "modes": ["wt2html", "wt2wt"]
32054 }
32055 !! wikitext
32056 =1=
32057 a
32058
32059 {{echo|1=
32060 x
32061 ==1.1==
32062 b
32063 ==1.2==
32064 c
32065 ===1.2.1===
32066 d
32067 }}
32068 =2=
32069 e
32070 !! html/php+tidy
32071
32072 <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>
32073 <p>a
32074 </p><p>x
32075 </p>
32076 <h2><span class="mw-headline" id="1.1">1.1</span></h2>
32077 <p>b
32078 </p>
32079 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32080 <p>c
32081 </p>
32082 <h3><span class="mw-headline" id="1.2.1">1.2.1</span></h3>
32083 <p>d
32084 </p>
32085 <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>
32086 <p>e
32087 </p>
32088 !! html/parsoid
32089 <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
32090 <p>a</p>
32091
32092 <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">
32093 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
32094 </span><p about="#mwt1">b</p><span about="#mwt1">
32095 </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
32096 </span><p about="#mwt1">c</p><span about="#mwt1">
32097 </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
32098 </span><p about="#mwt1">d</p><span about="#mwt1">
32099 </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
32100 <p>e</p></section>
32101 !! end
32102
32103 # Because of section-wrapping and template-wrapping interactions,
32104 # the scope of the template is expanded so that the template markup
32105 # is valid in the presence of <section> tags.
32106 # This exercises the s1 is null scenario in the wrapSections code
32107 !! test
32108 Section wrapping with template-generated sections (bad nesting 1)
32109 !! options
32110 notoc
32111 parsoid={
32112 "wrapSections": true
32113 }
32114 !! wikitext
32115 <div>
32116 a
32117
32118 {{echo|1=
32119 =1=
32120 b
32121 }}
32122
32123 c
32124 </div>
32125 !! html/php+tidy
32126 <div>
32127 <p>a
32128 </p>
32129 <h1><span class="mw-headline" id="1">1</span></h1>
32130 <p>b
32131 </p><p>c
32132 </p>
32133 </div>
32134 !! html/parsoid
32135 <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
32136 <p>a</p>
32137
32138 <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">
32139 </span><p about="#mwt1">b</p>
32140
32141 <p>c</p>
32142 </section></div></section>
32143 !! end
32144
32145 # Because of section-wrapping and template-wrapping interactions,
32146 # the scope of the template is expanded so that the template markup
32147 # is valid in the presence of <section> tags.
32148 # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
32149 !! test
32150 Section wrapping with template-generated sections (bad nesting 2)
32151 !! options
32152 notoc
32153 parsoid={
32154 "wrapSections": true
32155 }
32156 !! wikitext
32157 =1=
32158 a
32159
32160 {{echo|1=
32161 =2=
32162 b
32163 ==2.1==
32164 c
32165 }}
32166
32167 d
32168
32169 =3=
32170 e
32171 !! html/php+tidy
32172
32173 <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>
32174 <p>a
32175 </p>
32176 <h1><span class="mw-headline" id="2">2</span></h1>
32177 <p>b
32178 </p>
32179 <h2><span class="mw-headline" id="2.1">2.1</span></h2>
32180 <p>c
32181 </p><p>d
32182 </p>
32183 <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>
32184 <p>e
32185 </p>
32186 !! html/parsoid
32187 <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32188 <p>a</p>
32189
32190 </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">
32191 </span><p about="#mwt1">b</p><span about="#mwt1">
32192 </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
32193 </span><p about="#mwt1">c</p><span about="#mwt1">
32194
32195 </span><p about="#mwt1">d</p><span about="#mwt1">
32196
32197 </span></section></section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32198 <p>e</p></section>
32199 !! end
32200
32201 # Because of section-wrapping and template-wrapping interactions,
32202 # additional template wrappers are added to <section> tags
32203 # so that template wrapping semantics are valid whether section
32204 # tags are retained or stripped. But, the template scope can expand
32205 # greatly when accounting for section tags.
32206 # This exercises the s1 and s2 are in different subtrees scenario
32207 !! test
32208 Section wrapping with template-generated sections (bad nesting 3)
32209 !! options
32210 notoc
32211 parsoid={
32212 "wrapSections": true,
32213 "modes": ["wt2html", "wt2wt"]
32214 }
32215 !! wikitext
32216 =1=
32217 a
32218
32219 {{echo|1=
32220 ==1.2==
32221 b
32222 =2=
32223 c
32224 }}
32225
32226 d
32227
32228 =3=
32229 e
32230 !! html/php+tidy
32231
32232 <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>
32233 <p>a
32234 </p>
32235 <h2><span class="mw-headline" id="1.2">1.2</span></h2>
32236 <p>b
32237 </p>
32238 <h1><span class="mw-headline" id="2">2</span></h1>
32239 <p>c
32240 </p><p>d
32241 </p>
32242 <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>
32243 <p>e
32244 </p>
32245 !! html/parsoid
32246 <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>
32247 <p>a</p>
32248
32249 <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">
32250 </span><p about="#mwt1">b</p><span about="#mwt1">
32251 </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
32252 </span><p about="#mwt1">c</p>
32253
32254 <p>d</p>
32255 </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
32256 <p>e</p></section>
32257 !! end
32258
32259 !! test
32260 Section wrapping with uneditable lead section + div wrapping multiple sections
32261 !! options
32262 notoc
32263 parsoid={
32264 "wrapSections": true
32265 }
32266 !! wikitext
32267 foo
32268
32269 <div style="border:1px solid red;">
32270 =1=
32271 a
32272
32273 ==1.1==
32274 b
32275
32276 =2=
32277 c
32278 </div>
32279
32280 =3=
32281 d
32282
32283 ==3.1==
32284 e
32285 !! html/php+tidy
32286 <p>foo
32287 </p>
32288 <div style="border:1px solid red;">
32289
32290 <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>
32291 <p>a
32292 </p>
32293 <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>
32294 <p>b
32295 </p>
32296 <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>
32297 <p>c
32298 </p>
32299 </div>
32300 <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>
32301 <p>d
32302 </p>
32303 <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>
32304 <p>e
32305 </p>
32306 !! html/parsoid
32307 <section data-mw-section-id="-1"><p>foo</p>
32308
32309 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32310 <section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32311 <p>a</p>
32312
32313 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32314 <p>b</p>
32315
32316 </section></section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32317 <p>c</p>
32318 </section></div>
32319
32320 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32321 <p>d</p>
32322
32323 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32324 <p>e</p>
32325 </section></section>
32326 !! end
32327
32328 !! test
32329 Section wrapping with editable lead section + div overlapping multiple sections
32330 !! options
32331 notoc
32332 parsoid={
32333 "wrapSections": true
32334 }
32335 !! wikitext
32336 foo
32337
32338 =1=
32339 a
32340 <div style="border:1px solid red;">
32341 b
32342
32343 ==1.1==
32344 c
32345
32346 =2=
32347 d
32348 </div>
32349 e
32350
32351 =3=
32352 f
32353
32354 ==3.1==
32355 g
32356 !! html/php+tidy
32357 <p>foo
32358 </p>
32359
32360 <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>
32361 <p>a
32362 </p>
32363 <div style="border:1px solid red;">
32364 <p>b
32365 </p>
32366 <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>
32367 <p>c
32368 </p>
32369 <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>
32370 <p>d
32371 </p>
32372 </div>
32373 <p>e
32374 </p>
32375 <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>
32376 <p>f
32377 </p>
32378 <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>
32379 <p>g
32380 </p>
32381 !! html/parsoid
32382 <section data-mw-section-id="0"><p>foo</p>
32383
32384 </section><section data-mw-section-id="-1"><h1 id="1" data-parsoid="{}">1</h1>
32385 <p>a</p>
32386 </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
32387 <p>b</p>
32388
32389 <section data-mw-section-id="2"><h2 id="1.1" data-parsoid="{}">1.1</h2>
32390 <p>c</p>
32391
32392 </section><section data-mw-section-id="-1"><h1 id="2" data-parsoid="{}">2</h1>
32393 <p>d</p>
32394 </section></div>
32395 <p>e</p>
32396
32397 </section><section data-mw-section-id="4"><h1 id="3" data-parsoid="{}">3</h1>
32398 <p>f</p>
32399
32400 <section data-mw-section-id="5"><h2 id="3.1" data-parsoid="{}">3.1</h2>
32401 <p>g</p>
32402 </section></section>
32403 !! end
32404
32405 !! test
32406 HTML header tags should not be wrapped in section tags
32407 !! options
32408 notoc
32409 parsoid={
32410 "wrapSections": true
32411 }
32412 !! wikitext
32413 foo
32414
32415 <h1>a</h1>
32416
32417 =b=
32418
32419 <h1>c</h1>
32420
32421 =d=
32422 !! html/php+tidy
32423 <p>foo
32424 </p>
32425
32426 <h1><span class="mw-headline" id="a">a</span></h1>
32427 <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>
32428 <h1><span class="mw-headline" id="c">c</span></h1>
32429 <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>
32430 !! html/parsoid
32431 <section data-mw-section-id="0"><p>foo</p>
32432
32433 <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
32434
32435 </section><section data-mw-section-id="1"><h1 id="b" data-parsoid="{}">b</h1>
32436
32437 <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
32438
32439 </section><section data-mw-section-id="2"><h1 id="d" data-parsoid="{}">d</h1></section>
32440 !! end
32441
32442 !! test
32443 Lead section containing only whitespace and comments.
32444 !! options
32445 notoc
32446 parsoid={
32447 "wrapSections": true
32448 }
32449 !! wikitext
32450
32451 <!-- this is a comment, presumably significant to editors -->
32452 =1=
32453 a
32454
32455 =2=
32456 b
32457 !! html/php+tidy
32458 <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>
32459 <p>a
32460 </p>
32461 <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>
32462 <p>b
32463 </p>
32464 !! html/parsoid
32465 <section data-mw-section-id="0" data-parsoid="{}">
32466 <!-- this is a comment, presumably significant to editors -->
32467 </section><section data-mw-section-id="1"><h1 id="1" data-parsoid="{}">1</h1>
32468 <p>a</p>
32469
32470 </section><section data-mw-section-id="2"><h1 id="2" data-parsoid="{}">2</h1>
32471 <p>b</p>
32472 </section>
32473 !! end
32474
32475 !! test
32476 Pseudo-sections emitted by templates should have id -2
32477 !! options
32478 notoc
32479 parsoid={
32480 "wrapSections": true
32481 }
32482 !! wikitext
32483 foo
32484 {{echo|<div>
32485 ==a==
32486 ==b==
32487 </div>
32488 }}
32489 !! html/php+tidy
32490 <p>foo
32491 </p>
32492 <div>
32493 <h2><span class="mw-headline" id="a">a</span></h2>
32494 <h2><span class="mw-headline" id="b">b</span></h2>
32495 </div>
32496 !! html/parsoid
32497 <section data-mw-section-id="-1"><p>foo</p>
32498 </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}}]}'>
32499 <section data-mw-section-id="-1"><h2 id="a">a</h2>
32500 </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
32501 </section></div><span about="#mwt1">
32502 </span></section>
32503 !! end
32504
32505 !! test
32506 T213468: Transcluded sections don't get PHP section numbers
32507 !! options
32508 notoc
32509 parsoid={
32510 "wrapSections": true
32511 }
32512 !! wikitext
32513 ==PHP section=1==
32514 {{echo|1=
32515 == This is counted as if it were section 2 ==
32516 }}
32517 ==PHP section=3==
32518 !! html/php+tidy
32519 <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>
32520 <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>
32521 <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>
32522 !! html/parsoid
32523 <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>
32524 </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>
32525 </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>
32526 !! end
32527
32528 !! test
32529 T213468: Corner cases in edit section ID assignment in tokenizer
32530 !! options
32531 notoc
32532 parsoid={
32533 "wrapSections": true
32534 }
32535 !! wikitext
32536 ==PHP section=1==
32537 {{echo|Not a section|
32538 == This is counted as if it were section 2 ==
32539 }}
32540 ==PHP section=3==
32541 {{echo3|1=
32542 == This is counted as if it were section 4 ==
32543 }}
32544 ==PHP section=5==
32545 {{#tag:p|Not a section|data-ignored=
32546 == This is counted as if it were section 6 ==
32547 }}
32548 ==PHP section=7==
32549 {{echo|1=Not a ==heading==}}
32550 ==PHP section=8==
32551 [[File:Foobar.jpg|thumb|
32552 ==This is section 9, even though it's in a caption==
32553 ]]
32554 ==PHP section=10==
32555 !! html/php+tidy
32556
32557 <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>
32558 <p>Not a section
32559 </p>
32560 <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>
32561 <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>
32562 <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>
32563 <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>
32564 <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>
32565 <p data-ignored="== This is counted as if it were section 6 ==">Not a section</p>
32566 <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>
32567 <p>Not a ==heading==
32568 </p>
32569 <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>
32570 <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>
32571 <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>
32572 !! html/parsoid
32573 <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>
32574 <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>
32575 </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>
32576 </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">
32577 </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">
32578 </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>
32579 </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>
32580 <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>
32581 </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>
32582 <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>
32583 </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>
32584 <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>
32585 <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>
32586 </section></figcaption></figure>
32587 </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>
32588 !! end
32589
32590 !! test
32591 T215628: Section numbering and <includeonly> and <noinclude> on a page
32592 !! options
32593 notoc
32594 parsoid={
32595 "wrapSections": true
32596 }
32597 !! wikitext
32598 ==PHP section=1==
32599 <noinclude>
32600 ==PHP section=2==
32601 </noinclude>
32602 ==PHP section=3==
32603 <includeonly>
32604 ==This is not counted as section 4==
32605 </includeonly>
32606 ==PHP section=4==
32607 !! html/php+tidy
32608
32609 <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>
32610 <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>
32611 <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>
32612 <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>
32613 !! html/parsoid
32614 PARSOID HAS A BUG HERE: T215628
32615 !! end
32616
32617 ##########################################################################
32618 Tests demonstrating white-space insensitivity in input wikitext
32619 for wikitext headings, wikitext list items, and wikitext table captions,
32620 headings, and cells. HTML versions of the same should preserve whitespace.
32621 ##########################################################################
32622 !! test
32623 Trim whitespace in wikitext headings, list items, table captions, headings, and cells
32624 !! options
32625 parsoid={
32626 "modes": ["wt2html"],
32627 "preserveIEW": true
32628 }
32629 !! wikitext
32630 __NOTOC__
32631 == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
32632 == <!--c1--> <!--c2--> Tabs <!--c3--><!--c4--> ==
32633 == <!--Headings with fallback ids--> Личная жизнь ==
32634 * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
32635 ; <!--term to define--> term : <!--term's definition--> definition
32636 {|
32637 |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
32638 |-
32639 ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
32640 |-
32641 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32642 |-
32643 | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
32644 |-
32645 | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
32646 |}
32647 : {|
32648 | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
32649 |} foo <!--c1-->
32650 !! html/php+tidy
32651 <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>
32652 <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>
32653 <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>
32654 <ul><li>List item</li></ul>
32655 <dl><dt>term&#160;</dt>
32656 <dd>definition</dd></dl>
32657 <table>
32658 <caption>Table Caption
32659 </caption>
32660 <tbody><tr>
32661 <th>Table Heading 1</th>
32662 <th>Table Heading 2
32663 </th></tr>
32664 <tr>
32665 <td>Table Cell 1</td>
32666 <td>Table Cell 2
32667 </td></tr>
32668 <tr>
32669 <td>class="foo"</td>
32670 <td>Table Cell 3
32671 </td></tr>
32672 <tr>
32673 <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
32674 </td></tr></tbody></table>
32675 <dl><dd><table>
32676 <tbody><tr>
32677 <td>Table Cell 1</td>
32678 <td>Table Cell 2
32679 </td></tr></tbody></table> foo</dd></dl>
32680 !! html/parsoid
32681 <meta property="mw:PageProp/notoc">
32682 <h2 id="Spaces"><!--c1--><!--c2-->Spaces<!--c3--><!--c4--></h2>
32683 <h2 id="Tabs"><!--c1--><!--c2-->Tabs<!--c3--><!--c4--></h2>
32684 <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>
32685 <ul><li><!--c1--><!--c2-->List item<!--c3--><!--c4--></li></ul>
32686 <dl><dt><!--term to define-->term&nbsp;</dt><dd><!--term's definition-->definition</dd></dl>
32687 <table>
32688 <caption><!--c1--><!--c2-->Table Caption<!--c3--><!--c4--></caption>
32689 <tbody><tr>
32690 <th><!--c1--><!--c2-->Table Heading 1<!--c3--><!--c4--></th><th>Table Heading 2<!--c5--></th></tr>
32691 <tr>
32692 <td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32693 <tr>
32694 <td>class="foo"</td><td><!--c1--><!--c2-->Table Cell 3<!--c3--><!--c4--></td></tr>
32695 <tr>
32696 <td><!--c1-->testing <a rel="mw:WikiLink" href="./One" title="One">two</a> <!--c2--> | <!--c3--> some content</td></tr>
32697 </tbody></table>
32698 <dl><dd><table>
32699 <tbody><tr><td><!--c1--><!--c2-->Table Cell 1<!--c3--><!--c4--></td><td>Table Cell 2<!--c5--></td></tr>
32700 </tbody></table> foo<!--c1--></dd></dl>
32701 !! end
32702
32703 # Looks like <caption> is not accepted in HTML
32704 !! test
32705 Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
32706 !! options
32707 parsoid={
32708 "modes": ["wt2html"],
32709 "preserveIEW": true
32710 }
32711 !! wikitext
32712 __NOTOC__
32713 <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32714 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32715 <table>
32716 <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
32717 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
32718 </table>
32719 !! html/php+tidy
32720 <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
32721 <ul><li> List item </li></ul>
32722 <table>
32723 <tbody><tr><th> Table Heading </th><th></th></tr>
32724 <tr><td> Table Cell </td><th></th></tr>
32725 </tbody></table>
32726 !! html/parsoid
32727 <meta property="mw:PageProp/notoc"/>
32728 <h2 id="Heading"> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
32729 <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
32730 <table>
32731 <tbody><tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> </th><th></th></tr>
32732 <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> </td><th></th></tr>
32733 </tbody></table>
32734 !! end
32735
32736 !! test
32737 Do not trim whitespace in links and quotes
32738 !! options
32739 parsoid={
32740 "modes": ["wt2html"],
32741 "preserveIEW": true
32742 }
32743 !! wikitext
32744 foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
32745 [[Foo| some text ]]
32746 !! html/php+tidy
32747 <p>foo <i> italic </i> and <b> bold </b>
32748 <a href="/wiki/Foo" title="Foo"> some text </a>
32749 </p>
32750 !! html/parsoid
32751 <p>foo <i> <!--c1--> italic <!--c2--> </i> and <b> <!--c3--> bold <!--c4--> </b>
32752 <a rel="mw:WikiLink" href="./Foo" title="Foo"> some text </a></p>
32753 !! end
32754
32755 !! test
32756 Remove p tags surrounding a single element in a figcaption
32757 !! options
32758 parsoid=html2wt
32759 !! wikitext
32760 [[File:Foobar.jpg|right|200x200px|Caption]]
32761 !! html/parsoid
32762 <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>
32763 !! end
32764
32765 !! test
32766 Selser preserves lack of newline before list and allows newline after the list
32767 !! options
32768 parsoid={
32769 "modes": ["selser"],
32770 "scrubWikitext": true,
32771 "changes": [
32772 [ "ul", "after", "<p>footer</p>" ]
32773 ]
32774 }
32775 !! wikitext
32776 header
32777 *foo
32778 *bar
32779 !! wikitext/edited
32780 header
32781 *foo
32782 *bar
32783
32784 footer
32785 !! end
32786
32787
32788 !! test
32789 Selser does not introduce newlines between unedited paragraph preceding the list
32790 !! options
32791 parsoid={
32792 "modes": ["selser"],
32793 "changes": [
32794 [ "table tbody tr td p:last-child", "empty" ]
32795 ]
32796 }
32797 !! wikitext
32798 {|
32799 |
32800 header
32801 *foo
32802 *bar
32803 footer
32804 |}
32805 !! wikitext/edited
32806 {|
32807 |
32808 header
32809 *foo
32810 *bar
32811
32812 |}
32813 !! end
32814
32815 !! test
32816 Selser does not introduce newlines between unedited paragraph following the list
32817 !! options
32818 parsoid={
32819 "modes": ["selser"],
32820 "changes": [
32821 [ "table tbody tr td p:first-child", "empty" ]
32822 ]
32823 }
32824 !! wikitext
32825 {|
32826 |
32827 header
32828 *foo
32829 *bar
32830 footer
32831 |}
32832 !! wikitext/edited
32833 {|
32834 |
32835
32836 *foo
32837 *bar
32838 footer
32839 |}
32840 !! end
32841
32842 !! test
32843 Remove a list item but do not insert newline above list
32844 !! options
32845 parsoid={
32846 "modes": ["selser"],
32847 "changes": [
32848 [ "ul li:last-child", "remove" ]
32849 ]
32850 }
32851 !! wikitext
32852 header
32853 *foo
32854 *bar
32855 footer
32856 !! wikitext/edited
32857 header
32858 *foo
32859 footer
32860 !! end